Edit File by line
/home/barbar84/www/wp-inclu.../js/dist
File: components.js
function __read(o, n) {
[24500] Fix | Delete
var m = typeof Symbol === "function" && o[Symbol.iterator];
[24501] Fix | Delete
if (!m) return o;
[24502] Fix | Delete
var i = m.call(o), r, ar = [], e;
[24503] Fix | Delete
try {
[24504] Fix | Delete
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
[24505] Fix | Delete
}
[24506] Fix | Delete
catch (error) { e = { error: error }; }
[24507] Fix | Delete
finally {
[24508] Fix | Delete
try {
[24509] Fix | Delete
if (r && !r.done && (m = i["return"])) m.call(i);
[24510] Fix | Delete
}
[24511] Fix | Delete
finally { if (e) throw e.error; }
[24512] Fix | Delete
}
[24513] Fix | Delete
return ar;
[24514] Fix | Delete
}
[24515] Fix | Delete
[24516] Fix | Delete
/** @deprecated */
[24517] Fix | Delete
function __spread() {
[24518] Fix | Delete
for (var ar = [], i = 0; i < arguments.length; i++)
[24519] Fix | Delete
ar = ar.concat(__read(arguments[i]));
[24520] Fix | Delete
return ar;
[24521] Fix | Delete
}
[24522] Fix | Delete
[24523] Fix | Delete
/** @deprecated */
[24524] Fix | Delete
function __spreadArrays() {
[24525] Fix | Delete
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
[24526] Fix | Delete
for (var r = Array(s), k = 0, i = 0; i < il; i++)
[24527] Fix | Delete
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
[24528] Fix | Delete
r[k] = a[j];
[24529] Fix | Delete
return r;
[24530] Fix | Delete
}
[24531] Fix | Delete
[24532] Fix | Delete
function __spreadArray(to, from, pack) {
[24533] Fix | Delete
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
[24534] Fix | Delete
if (ar || !(i in from)) {
[24535] Fix | Delete
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
[24536] Fix | Delete
ar[i] = from[i];
[24537] Fix | Delete
}
[24538] Fix | Delete
}
[24539] Fix | Delete
return to.concat(ar || Array.prototype.slice.call(from));
[24540] Fix | Delete
}
[24541] Fix | Delete
[24542] Fix | Delete
function __await(v) {
[24543] Fix | Delete
return this instanceof __await ? (this.v = v, this) : new __await(v);
[24544] Fix | Delete
}
[24545] Fix | Delete
[24546] Fix | Delete
function __asyncGenerator(thisArg, _arguments, generator) {
[24547] Fix | Delete
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
[24548] Fix | Delete
var g = generator.apply(thisArg, _arguments || []), i, q = [];
[24549] Fix | Delete
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
[24550] Fix | Delete
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
[24551] Fix | Delete
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
[24552] Fix | Delete
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
[24553] Fix | Delete
function fulfill(value) { resume("next", value); }
[24554] Fix | Delete
function reject(value) { resume("throw", value); }
[24555] Fix | Delete
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
[24556] Fix | Delete
}
[24557] Fix | Delete
[24558] Fix | Delete
function __asyncDelegator(o) {
[24559] Fix | Delete
var i, p;
[24560] Fix | Delete
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
[24561] Fix | Delete
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; }
[24562] Fix | Delete
}
[24563] Fix | Delete
[24564] Fix | Delete
function __asyncValues(o) {
[24565] Fix | Delete
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
[24566] Fix | Delete
var m = o[Symbol.asyncIterator], i;
[24567] Fix | Delete
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
[24568] Fix | Delete
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
[24569] Fix | Delete
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
[24570] Fix | Delete
}
[24571] Fix | Delete
[24572] Fix | Delete
function __makeTemplateObject(cooked, raw) {
[24573] Fix | Delete
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
[24574] Fix | Delete
return cooked;
[24575] Fix | Delete
};
[24576] Fix | Delete
[24577] Fix | Delete
var __setModuleDefault = Object.create ? (function(o, v) {
[24578] Fix | Delete
Object.defineProperty(o, "default", { enumerable: true, value: v });
[24579] Fix | Delete
}) : function(o, v) {
[24580] Fix | Delete
o["default"] = v;
[24581] Fix | Delete
};
[24582] Fix | Delete
[24583] Fix | Delete
function __importStar(mod) {
[24584] Fix | Delete
if (mod && mod.__esModule) return mod;
[24585] Fix | Delete
var result = {};
[24586] Fix | Delete
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
[24587] Fix | Delete
__setModuleDefault(result, mod);
[24588] Fix | Delete
return result;
[24589] Fix | Delete
}
[24590] Fix | Delete
[24591] Fix | Delete
function __importDefault(mod) {
[24592] Fix | Delete
return (mod && mod.__esModule) ? mod : { default: mod };
[24593] Fix | Delete
}
[24594] Fix | Delete
[24595] Fix | Delete
function __classPrivateFieldGet(receiver, state, kind, f) {
[24596] Fix | Delete
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
[24597] Fix | Delete
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
[24598] Fix | Delete
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
[24599] Fix | Delete
}
[24600] Fix | Delete
[24601] Fix | Delete
function __classPrivateFieldSet(receiver, state, value, kind, f) {
[24602] Fix | Delete
if (kind === "m") throw new TypeError("Private method is not writable");
[24603] Fix | Delete
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
[24604] Fix | Delete
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
[24605] Fix | Delete
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
[24606] Fix | Delete
}
[24607] Fix | Delete
[24608] Fix | Delete
// CONCATENATED MODULE: ./node_modules/downshift/dist/downshift.esm.js
[24609] Fix | Delete
[24610] Fix | Delete
[24611] Fix | Delete
[24612] Fix | Delete
[24613] Fix | Delete
[24614] Fix | Delete
[24615] Fix | Delete
[24616] Fix | Delete
[24617] Fix | Delete
[24618] Fix | Delete
[24619] Fix | Delete
var idCounter = 0;
[24620] Fix | Delete
/**
[24621] Fix | Delete
* Accepts a parameter and returns it if it's a function
[24622] Fix | Delete
* or a noop function if it's not. This allows us to
[24623] Fix | Delete
* accept a callback, but not worry about it if it's not
[24624] Fix | Delete
* passed.
[24625] Fix | Delete
* @param {Function} cb the callback
[24626] Fix | Delete
* @return {Function} a function
[24627] Fix | Delete
*/
[24628] Fix | Delete
[24629] Fix | Delete
function cbToCb(cb) {
[24630] Fix | Delete
return typeof cb === 'function' ? cb : downshift_esm_noop;
[24631] Fix | Delete
}
[24632] Fix | Delete
[24633] Fix | Delete
function downshift_esm_noop() {}
[24634] Fix | Delete
/**
[24635] Fix | Delete
* Scroll node into view if necessary
[24636] Fix | Delete
* @param {HTMLElement} node the element that should scroll into view
[24637] Fix | Delete
* @param {HTMLElement} menuNode the menu element of the component
[24638] Fix | Delete
*/
[24639] Fix | Delete
[24640] Fix | Delete
[24641] Fix | Delete
function downshift_esm_scrollIntoView(node, menuNode) {
[24642] Fix | Delete
if (!node) {
[24643] Fix | Delete
return;
[24644] Fix | Delete
}
[24645] Fix | Delete
[24646] Fix | Delete
var actions = index_module(node, {
[24647] Fix | Delete
boundary: menuNode,
[24648] Fix | Delete
block: 'nearest',
[24649] Fix | Delete
scrollMode: 'if-needed'
[24650] Fix | Delete
});
[24651] Fix | Delete
actions.forEach(function (_ref) {
[24652] Fix | Delete
var el = _ref.el,
[24653] Fix | Delete
top = _ref.top,
[24654] Fix | Delete
left = _ref.left;
[24655] Fix | Delete
el.scrollTop = top;
[24656] Fix | Delete
el.scrollLeft = left;
[24657] Fix | Delete
});
[24658] Fix | Delete
}
[24659] Fix | Delete
/**
[24660] Fix | Delete
* @param {HTMLElement} parent the parent node
[24661] Fix | Delete
* @param {HTMLElement} child the child node
[24662] Fix | Delete
* @param {Window} environment The window context where downshift renders.
[24663] Fix | Delete
* @return {Boolean} whether the parent is the child or the child is in the parent
[24664] Fix | Delete
*/
[24665] Fix | Delete
[24666] Fix | Delete
[24667] Fix | Delete
function isOrContainsNode(parent, child, environment) {
[24668] Fix | Delete
var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
[24669] Fix | Delete
return result;
[24670] Fix | Delete
}
[24671] Fix | Delete
/**
[24672] Fix | Delete
* Simple debounce implementation. Will call the given
[24673] Fix | Delete
* function once after the time given has passed since
[24674] Fix | Delete
* it was last called.
[24675] Fix | Delete
* @param {Function} fn the function to call after the time
[24676] Fix | Delete
* @param {Number} time the time to wait
[24677] Fix | Delete
* @return {Function} the debounced function
[24678] Fix | Delete
*/
[24679] Fix | Delete
[24680] Fix | Delete
[24681] Fix | Delete
function debounce(fn, time) {
[24682] Fix | Delete
var timeoutId;
[24683] Fix | Delete
[24684] Fix | Delete
function cancel() {
[24685] Fix | Delete
if (timeoutId) {
[24686] Fix | Delete
clearTimeout(timeoutId);
[24687] Fix | Delete
}
[24688] Fix | Delete
}
[24689] Fix | Delete
[24690] Fix | Delete
function wrapper() {
[24691] Fix | Delete
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
[24692] Fix | Delete
args[_key] = arguments[_key];
[24693] Fix | Delete
}
[24694] Fix | Delete
[24695] Fix | Delete
cancel();
[24696] Fix | Delete
timeoutId = setTimeout(function () {
[24697] Fix | Delete
timeoutId = null;
[24698] Fix | Delete
fn.apply(void 0, args);
[24699] Fix | Delete
}, time);
[24700] Fix | Delete
}
[24701] Fix | Delete
[24702] Fix | Delete
wrapper.cancel = cancel;
[24703] Fix | Delete
return wrapper;
[24704] Fix | Delete
}
[24705] Fix | Delete
/**
[24706] Fix | Delete
* This is intended to be used to compose event handlers.
[24707] Fix | Delete
* They are executed in order until one of them sets
[24708] Fix | Delete
* `event.preventDownshiftDefault = true`.
[24709] Fix | Delete
* @param {...Function} fns the event handler functions
[24710] Fix | Delete
* @return {Function} the event handler to add to an element
[24711] Fix | Delete
*/
[24712] Fix | Delete
[24713] Fix | Delete
[24714] Fix | Delete
function callAllEventHandlers() {
[24715] Fix | Delete
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
[24716] Fix | Delete
fns[_key2] = arguments[_key2];
[24717] Fix | Delete
}
[24718] Fix | Delete
[24719] Fix | Delete
return function (event) {
[24720] Fix | Delete
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
[24721] Fix | Delete
args[_key3 - 1] = arguments[_key3];
[24722] Fix | Delete
}
[24723] Fix | Delete
[24724] Fix | Delete
return fns.some(function (fn) {
[24725] Fix | Delete
if (fn) {
[24726] Fix | Delete
fn.apply(void 0, [event].concat(args));
[24727] Fix | Delete
}
[24728] Fix | Delete
[24729] Fix | Delete
return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;
[24730] Fix | Delete
});
[24731] Fix | Delete
};
[24732] Fix | Delete
}
[24733] Fix | Delete
[24734] Fix | Delete
function handleRefs() {
[24735] Fix | Delete
for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
[24736] Fix | Delete
refs[_key4] = arguments[_key4];
[24737] Fix | Delete
}
[24738] Fix | Delete
[24739] Fix | Delete
return function (node) {
[24740] Fix | Delete
refs.forEach(function (ref) {
[24741] Fix | Delete
if (typeof ref === 'function') {
[24742] Fix | Delete
ref(node);
[24743] Fix | Delete
} else if (ref) {
[24744] Fix | Delete
ref.current = node;
[24745] Fix | Delete
}
[24746] Fix | Delete
});
[24747] Fix | Delete
};
[24748] Fix | Delete
}
[24749] Fix | Delete
/**
[24750] Fix | Delete
* This generates a unique ID for an instance of Downshift
[24751] Fix | Delete
* @return {String} the unique ID
[24752] Fix | Delete
*/
[24753] Fix | Delete
[24754] Fix | Delete
[24755] Fix | Delete
function downshift_esm_generateId() {
[24756] Fix | Delete
return String(idCounter++);
[24757] Fix | Delete
}
[24758] Fix | Delete
/**
[24759] Fix | Delete
* Resets idCounter to 0. Used for SSR.
[24760] Fix | Delete
*/
[24761] Fix | Delete
[24762] Fix | Delete
[24763] Fix | Delete
function resetIdCounter() {
[24764] Fix | Delete
idCounter = 0;
[24765] Fix | Delete
}
[24766] Fix | Delete
/**
[24767] Fix | Delete
* Default implementation for status message. Only added when menu is open.
[24768] Fix | Delete
* Will specify if there are results in the list, and if so, how many,
[24769] Fix | Delete
* and what keys are relevant.
[24770] Fix | Delete
*
[24771] Fix | Delete
* @param {Object} param the downshift state and other relevant properties
[24772] Fix | Delete
* @return {String} the a11y status message
[24773] Fix | Delete
*/
[24774] Fix | Delete
[24775] Fix | Delete
[24776] Fix | Delete
function getA11yStatusMessage$1(_ref2) {
[24777] Fix | Delete
var isOpen = _ref2.isOpen,
[24778] Fix | Delete
resultCount = _ref2.resultCount,
[24779] Fix | Delete
previousResultCount = _ref2.previousResultCount;
[24780] Fix | Delete
[24781] Fix | Delete
if (!isOpen) {
[24782] Fix | Delete
return '';
[24783] Fix | Delete
}
[24784] Fix | Delete
[24785] Fix | Delete
if (!resultCount) {
[24786] Fix | Delete
return 'No results are available.';
[24787] Fix | Delete
}
[24788] Fix | Delete
[24789] Fix | Delete
if (resultCount !== previousResultCount) {
[24790] Fix | Delete
return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter key to select.";
[24791] Fix | Delete
}
[24792] Fix | Delete
[24793] Fix | Delete
return '';
[24794] Fix | Delete
}
[24795] Fix | Delete
/**
[24796] Fix | Delete
* Takes an argument and if it's an array, returns the first item in the array
[24797] Fix | Delete
* otherwise returns the argument
[24798] Fix | Delete
* @param {*} arg the maybe-array
[24799] Fix | Delete
* @param {*} defaultValue the value if arg is falsey not defined
[24800] Fix | Delete
* @return {*} the arg or it's first item
[24801] Fix | Delete
*/
[24802] Fix | Delete
[24803] Fix | Delete
[24804] Fix | Delete
function unwrapArray(arg, defaultValue) {
[24805] Fix | Delete
arg = Array.isArray(arg) ?
[24806] Fix | Delete
/* istanbul ignore next (preact) */
[24807] Fix | Delete
arg[0] : arg;
[24808] Fix | Delete
[24809] Fix | Delete
if (!arg && defaultValue) {
[24810] Fix | Delete
return defaultValue;
[24811] Fix | Delete
} else {
[24812] Fix | Delete
return arg;
[24813] Fix | Delete
}
[24814] Fix | Delete
}
[24815] Fix | Delete
/**
[24816] Fix | Delete
* @param {Object} element (P)react element
[24817] Fix | Delete
* @return {Boolean} whether it's a DOM element
[24818] Fix | Delete
*/
[24819] Fix | Delete
[24820] Fix | Delete
[24821] Fix | Delete
function isDOMElement(element) {
[24822] Fix | Delete
[24823] Fix | Delete
[24824] Fix | Delete
return typeof element.type === 'string';
[24825] Fix | Delete
}
[24826] Fix | Delete
/**
[24827] Fix | Delete
* @param {Object} element (P)react element
[24828] Fix | Delete
* @return {Object} the props
[24829] Fix | Delete
*/
[24830] Fix | Delete
[24831] Fix | Delete
[24832] Fix | Delete
function getElementProps(element) {
[24833] Fix | Delete
[24834] Fix | Delete
return element.props;
[24835] Fix | Delete
}
[24836] Fix | Delete
/**
[24837] Fix | Delete
* Throws a helpful error message for required properties. Useful
[24838] Fix | Delete
* to be used as a default in destructuring or object params.
[24839] Fix | Delete
* @param {String} fnName the function name
[24840] Fix | Delete
* @param {String} propName the prop name
[24841] Fix | Delete
*/
[24842] Fix | Delete
[24843] Fix | Delete
[24844] Fix | Delete
function requiredProp(fnName, propName) {
[24845] Fix | Delete
// eslint-disable-next-line no-console
[24846] Fix | Delete
console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
[24847] Fix | Delete
}
[24848] Fix | Delete
[24849] Fix | Delete
var stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
[24850] Fix | Delete
/**
[24851] Fix | Delete
* @param {Object} state the state object
[24852] Fix | Delete
* @return {Object} state that is relevant to downshift
[24853] Fix | Delete
*/
[24854] Fix | Delete
[24855] Fix | Delete
function pickState(state) {
[24856] Fix | Delete
if (state === void 0) {
[24857] Fix | Delete
state = {};
[24858] Fix | Delete
}
[24859] Fix | Delete
[24860] Fix | Delete
var result = {};
[24861] Fix | Delete
stateKeys.forEach(function (k) {
[24862] Fix | Delete
if (state.hasOwnProperty(k)) {
[24863] Fix | Delete
result[k] = state[k];
[24864] Fix | Delete
}
[24865] Fix | Delete
});
[24866] Fix | Delete
return result;
[24867] Fix | Delete
}
[24868] Fix | Delete
/**
[24869] Fix | Delete
* This will perform a shallow merge of the given state object
[24870] Fix | Delete
* with the state coming from props
[24871] Fix | Delete
* (for the controlled component scenario)
[24872] Fix | Delete
* This is used in state updater functions so they're referencing
[24873] Fix | Delete
* the right state regardless of where it comes from.
[24874] Fix | Delete
*
[24875] Fix | Delete
* @param {Object} state The state of the component/hook.
[24876] Fix | Delete
* @param {Object} props The props that may contain controlled values.
[24877] Fix | Delete
* @returns {Object} The merged controlled state.
[24878] Fix | Delete
*/
[24879] Fix | Delete
[24880] Fix | Delete
[24881] Fix | Delete
function getState(state, props) {
[24882] Fix | Delete
return Object.keys(state).reduce(function (prevState, key) {
[24883] Fix | Delete
prevState[key] = isControlledProp(props, key) ? props[key] : state[key];
[24884] Fix | Delete
return prevState;
[24885] Fix | Delete
}, {});
[24886] Fix | Delete
}
[24887] Fix | Delete
/**
[24888] Fix | Delete
* This determines whether a prop is a "controlled prop" meaning it is
[24889] Fix | Delete
* state which is controlled by the outside of this component rather
[24890] Fix | Delete
* than within this component.
[24891] Fix | Delete
*
[24892] Fix | Delete
* @param {Object} props The props that may contain controlled values.
[24893] Fix | Delete
* @param {String} key the key to check
[24894] Fix | Delete
* @return {Boolean} whether it is a controlled controlled prop
[24895] Fix | Delete
*/
[24896] Fix | Delete
[24897] Fix | Delete
[24898] Fix | Delete
function isControlledProp(props, key) {
[24899] Fix | Delete
return props[key] !== undefined;
[24900] Fix | Delete
}
[24901] Fix | Delete
/**
[24902] Fix | Delete
* Normalizes the 'key' property of a KeyboardEvent in IE/Edge
[24903] Fix | Delete
* @param {Object} event a keyboardEvent object
[24904] Fix | Delete
* @return {String} keyboard key
[24905] Fix | Delete
*/
[24906] Fix | Delete
[24907] Fix | Delete
[24908] Fix | Delete
function normalizeArrowKey(event) {
[24909] Fix | Delete
var key = event.key,
[24910] Fix | Delete
keyCode = event.keyCode;
[24911] Fix | Delete
/* istanbul ignore next (ie) */
[24912] Fix | Delete
[24913] Fix | Delete
if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
[24914] Fix | Delete
return "Arrow" + key;
[24915] Fix | Delete
}
[24916] Fix | Delete
[24917] Fix | Delete
return key;
[24918] Fix | Delete
}
[24919] Fix | Delete
/**
[24920] Fix | Delete
* Simple check if the value passed is object literal
[24921] Fix | Delete
* @param {*} obj any things
[24922] Fix | Delete
* @return {Boolean} whether it's object literal
[24923] Fix | Delete
*/
[24924] Fix | Delete
[24925] Fix | Delete
[24926] Fix | Delete
function isPlainObject(obj) {
[24927] Fix | Delete
return Object.prototype.toString.call(obj) === '[object Object]';
[24928] Fix | Delete
}
[24929] Fix | Delete
/**
[24930] Fix | Delete
* Returns the new index in the list, in a circular way. If next value is out of bonds from the total,
[24931] Fix | Delete
* it will wrap to either 0 or itemCount - 1.
[24932] Fix | Delete
*
[24933] Fix | Delete
* @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
[24934] Fix | Delete
* @param {number} baseIndex The initial position to move from.
[24935] Fix | Delete
* @param {number} itemCount The total number of items.
[24936] Fix | Delete
* @param {Function} getItemNodeFromIndex Used to check if item is disabled.
[24937] Fix | Delete
* @param {boolean} circular Specify if navigation is circular. Default is true.
[24938] Fix | Delete
* @returns {number} The new index after the move.
[24939] Fix | Delete
*/
[24940] Fix | Delete
[24941] Fix | Delete
[24942] Fix | Delete
function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
[24943] Fix | Delete
if (circular === void 0) {
[24944] Fix | Delete
circular = true;
[24945] Fix | Delete
}
[24946] Fix | Delete
[24947] Fix | Delete
if (itemCount === 0) {
[24948] Fix | Delete
return -1;
[24949] Fix | Delete
}
[24950] Fix | Delete
[24951] Fix | Delete
var itemsLastIndex = itemCount - 1;
[24952] Fix | Delete
[24953] Fix | Delete
if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {
[24954] Fix | Delete
baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
[24955] Fix | Delete
}
[24956] Fix | Delete
[24957] Fix | Delete
var newIndex = baseIndex + moveAmount;
[24958] Fix | Delete
[24959] Fix | Delete
if (newIndex < 0) {
[24960] Fix | Delete
newIndex = circular ? itemsLastIndex : 0;
[24961] Fix | Delete
} else if (newIndex > itemsLastIndex) {
[24962] Fix | Delete
newIndex = circular ? 0 : itemsLastIndex;
[24963] Fix | Delete
}
[24964] Fix | Delete
[24965] Fix | Delete
var nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
[24966] Fix | Delete
[24967] Fix | Delete
if (nonDisabledNewIndex === -1) {
[24968] Fix | Delete
return baseIndex >= itemCount ? -1 : baseIndex;
[24969] Fix | Delete
}
[24970] Fix | Delete
[24971] Fix | Delete
return nonDisabledNewIndex;
[24972] Fix | Delete
}
[24973] Fix | Delete
/**
[24974] Fix | Delete
* Returns the next index in the list of an item that is not disabled.
[24975] Fix | Delete
*
[24976] Fix | Delete
* @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
[24977] Fix | Delete
* @param {number} baseIndex The initial position to move from.
[24978] Fix | Delete
* @param {number} itemCount The total number of items.
[24979] Fix | Delete
* @param {Function} getItemNodeFromIndex Used to check if item is disabled.
[24980] Fix | Delete
* @param {boolean} circular Specify if navigation is circular. Default is true.
[24981] Fix | Delete
* @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.
[24982] Fix | Delete
*/
[24983] Fix | Delete
[24984] Fix | Delete
[24985] Fix | Delete
function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
[24986] Fix | Delete
var currentElementNode = getItemNodeFromIndex(baseIndex);
[24987] Fix | Delete
[24988] Fix | Delete
if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {
[24989] Fix | Delete
return baseIndex;
[24990] Fix | Delete
}
[24991] Fix | Delete
[24992] Fix | Delete
if (moveAmount > 0) {
[24993] Fix | Delete
for (var index = baseIndex + 1; index < itemCount; index++) {
[24994] Fix | Delete
if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
[24995] Fix | Delete
return index;
[24996] Fix | Delete
}
[24997] Fix | Delete
}
[24998] Fix | Delete
} else {
[24999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function