funda-ui 4.7.202 → 4.7.222
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Date/index.js +20 -12
- package/README.md +205 -0
- package/Select/index.d.ts +20 -9
- package/Select/index.js +408 -345
- package/Table/index.js +69 -16
- package/Utils/time.d.ts +2 -0
- package/Utils/time.js +25 -20
- package/lib/cjs/Date/index.js +20 -12
- package/lib/cjs/Select/index.d.ts +20 -9
- package/lib/cjs/Select/index.js +408 -345
- package/lib/cjs/Table/index.js +69 -16
- package/lib/cjs/Utils/time.d.ts +2 -0
- package/lib/cjs/Utils/time.js +25 -20
- package/lib/esm/Date/index.tsx +24 -10
- package/lib/esm/Select/index.tsx +45 -18
- package/lib/esm/Table/Table.tsx +37 -2
- package/lib/esm/Table/TableCell.tsx +2 -2
- package/lib/esm/Table/utils/func.ts +2 -2
- package/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +28 -6
- package/lib/esm/Utils/libs/time.ts +24 -22
- package/package.json +1 -1
package/Select/index.js
CHANGED
|
@@ -3578,7 +3578,6 @@ var format_string = __webpack_require__(933);
|
|
|
3578
3578
|
var cls = __webpack_require__(188);
|
|
3579
3579
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
3580
3580
|
var _excluded = ["contentRef", "popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "optionsExClassName", "exceededSidePosOffset", "clearIcon", "renderOption", "multiSelect", "multiSelectEntireAreaTrigger", "multiSelectSelectedItemOnlyStatus", "renderSelectedValue", "disabled", "required", "defaultValue", "value", "label", "name", "readOnly", "placeholder", "id", "autoComplete", "autoCapitalize", "spellCheck", "options", "clearTrigger", "loader", "lockBodyScroll", "hierarchical", "indentation", "doubleIndent", "style", "depth", "controlArrow", "winWidth", "tabIndex", "firstRequestAutoExec", "fetchTrigger", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "data", "extractValueByBrackets", "fetchCallback", "onFetch", "onLoad", "onSelect", "onChange", "onBlur", "onFocus", "onKeyPressed"];
|
|
3581
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3582
3581
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3583
3582
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3584
3583
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
@@ -3589,6 +3588,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
3589
3588
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3590
3589
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
3591
3590
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
3591
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
3592
3592
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
3593
3593
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3594
3594
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
@@ -3978,7 +3978,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3978
3978
|
return _fetchData.apply(this, arguments);
|
|
3979
3979
|
}
|
|
3980
3980
|
function _fetchData() {
|
|
3981
|
-
_fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
3981
|
+
_fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, valueToInputDefault, inputDefault) {
|
|
3982
3982
|
var init,
|
|
3983
3983
|
defaultValue,
|
|
3984
3984
|
response,
|
|
@@ -3995,21 +3995,21 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
3995
3995
|
_currentData2,
|
|
3996
3996
|
_defaultValues2,
|
|
3997
3997
|
_defaultLabels2,
|
|
3998
|
-
|
|
3999
|
-
return _regeneratorRuntime().wrap(function
|
|
4000
|
-
while (1) switch (
|
|
3998
|
+
_args2 = arguments;
|
|
3999
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4000
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4001
4001
|
case 0:
|
|
4002
|
-
init =
|
|
4002
|
+
init = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : true;
|
|
4003
4003
|
// Determine whether the default value is user query input or default input
|
|
4004
4004
|
defaultValue = init ? valueToInputDefault : '';
|
|
4005
4005
|
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
4006
|
-
|
|
4006
|
+
_context2.next = 27;
|
|
4007
4007
|
break;
|
|
4008
4008
|
}
|
|
4009
|
-
|
|
4009
|
+
_context2.next = 5;
|
|
4010
4010
|
return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
4011
4011
|
case 5:
|
|
4012
|
-
response =
|
|
4012
|
+
response = _context2.sent;
|
|
4013
4013
|
_ORGIN_DATA = response.data; // reset data structure
|
|
4014
4014
|
if (typeof fetchCallback === 'function') {
|
|
4015
4015
|
_ORGIN_DATA = fetchCallback(_ORGIN_DATA);
|
|
@@ -4116,7 +4116,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4116
4116
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(selectInputRef.current, valueInputRef.current, defaultValue, _ORGIN_DATA, incomingData);
|
|
4117
4117
|
|
|
4118
4118
|
//
|
|
4119
|
-
return
|
|
4119
|
+
return _context2.abrupt("return", _ORGIN_DATA);
|
|
4120
4120
|
case 27:
|
|
4121
4121
|
// STEP 1: ===========
|
|
4122
4122
|
// Set hierarchical categories ( with sub-categories )
|
|
@@ -4212,12 +4212,12 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4212
4212
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(selectInputRef.current, valueInputRef.current, defaultValue, staticOptionsData, incomingData);
|
|
4213
4213
|
|
|
4214
4214
|
//
|
|
4215
|
-
return
|
|
4215
|
+
return _context2.abrupt("return", staticOptionsData);
|
|
4216
4216
|
case 43:
|
|
4217
4217
|
case "end":
|
|
4218
|
-
return
|
|
4218
|
+
return _context2.stop();
|
|
4219
4219
|
}
|
|
4220
|
-
},
|
|
4220
|
+
}, _callee2);
|
|
4221
4221
|
}));
|
|
4222
4222
|
return _fetchData.apply(this, arguments);
|
|
4223
4223
|
}
|
|
@@ -4602,7 +4602,7 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4602
4602
|
return _handleSelect.apply(this, arguments);
|
|
4603
4603
|
}
|
|
4604
4604
|
function _handleSelect() {
|
|
4605
|
-
_handleSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4605
|
+
_handleSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(el) {
|
|
4606
4606
|
var dataInput,
|
|
4607
4607
|
valueArr,
|
|
4608
4608
|
labelArr,
|
|
@@ -4628,18 +4628,18 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4628
4628
|
_$el,
|
|
4629
4629
|
_selected2,
|
|
4630
4630
|
_selectedVal2,
|
|
4631
|
-
|
|
4632
|
-
return _regeneratorRuntime().wrap(function
|
|
4633
|
-
while (1) switch (
|
|
4631
|
+
_args3 = arguments;
|
|
4632
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4633
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4634
4634
|
case 0:
|
|
4635
|
-
dataInput =
|
|
4636
|
-
valueArr =
|
|
4637
|
-
labelArr =
|
|
4635
|
+
dataInput = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
|
4636
|
+
valueArr = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : [];
|
|
4637
|
+
labelArr = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : [];
|
|
4638
4638
|
if (!(typeof el === 'undefined')) {
|
|
4639
|
-
|
|
4639
|
+
_context3.next = 5;
|
|
4640
4640
|
break;
|
|
4641
4641
|
}
|
|
4642
|
-
return
|
|
4642
|
+
return _context3.abrupt("return");
|
|
4643
4643
|
case 5:
|
|
4644
4644
|
curItem = el === null ? isObject(dataInput) ? dataInput : JSON.parse(dataInput) : optionsData[Number(el.currentTarget.dataset.index)]; // get options
|
|
4645
4645
|
options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.hide):not(.no-match)')); // current control of some option
|
|
@@ -4662,218 +4662,229 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4662
4662
|
}
|
|
4663
4663
|
|
|
4664
4664
|
// update value * label
|
|
4665
|
-
if (dataInput) {
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
// ++++++++++++++++++++
|
|
4679
|
-
// clear all active classes of options
|
|
4680
|
-
// (Avoid using the keyboard to select and two actives will appear after clicking on a non-selected option.)
|
|
4681
|
-
if (noCallback) {
|
|
4682
|
-
options.forEach(function (node) {
|
|
4683
|
-
node.classList.remove('active');
|
|
4684
|
-
});
|
|
4685
|
-
}
|
|
4665
|
+
if (!dataInput) {
|
|
4666
|
+
_context3.next = 28;
|
|
4667
|
+
break;
|
|
4668
|
+
}
|
|
4669
|
+
// ==========================================================================
|
|
4670
|
+
// Use the "keyboard" to trigger
|
|
4671
|
+
// ==========================================================================
|
|
4672
|
+
_data = isObject(dataInput) ? dataInput : JSON.parse(dataInput);
|
|
4673
|
+
_value = _data.value;
|
|
4674
|
+
_label = _data.label; // ++++++++++++++++++++
|
|
4675
|
+
// Callback
|
|
4676
|
+
// ++++++++++++++++++++
|
|
4677
|
+
(_data$callback = _data.callback) === null || _data$callback === void 0 ? void 0 : _data$callback.call(_data);
|
|
4686
4678
|
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4679
|
+
// ++++++++++++++++++++
|
|
4680
|
+
// Single selection
|
|
4681
|
+
// ++++++++++++++++++++
|
|
4682
|
+
// clear all active classes of options
|
|
4683
|
+
// (Avoid using the keyboard to select and two actives will appear after clicking on a non-selected option.)
|
|
4684
|
+
if (noCallback) {
|
|
4685
|
+
options.forEach(function (node) {
|
|
4686
|
+
node.classList.remove('active');
|
|
4687
|
+
});
|
|
4688
|
+
}
|
|
4693
4689
|
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
// ++++++++++++++++++++
|
|
4701
|
-
currentControlValueArr = JSON.parse(JSON.stringify(valueArr));
|
|
4702
|
-
currentControlLabelArr = JSON.parse(JSON.stringify(labelArr));
|
|
4703
|
-
if (MULTI_SEL_VALID) {
|
|
4704
|
-
$el = el === null ? curBtn : el.currentTarget; // update option checkboxes
|
|
4705
|
-
_selected = $el.dataset.selected;
|
|
4706
|
-
_selectedVal = _selected == 'true' ? true : false;
|
|
4707
|
-
if (_selectedVal) {
|
|
4708
|
-
//#########
|
|
4709
|
-
// remove item
|
|
4710
|
-
//#########
|
|
4711
|
-
$el.dataset.selected = 'false';
|
|
4712
|
-
$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.add('d-none');
|
|
4713
|
-
$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.remove('d-none');
|
|
4714
|
-
|
|
4715
|
-
//
|
|
4716
|
-
setControlArr(function (prevState) {
|
|
4717
|
-
// update temporary value
|
|
4718
|
-
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4719
|
-
return {
|
|
4720
|
-
labels: removeItemOnce(prevState.labels, formatIndentVal(_label, INDENT_LAST_PLACEHOLDER)),
|
|
4721
|
-
values: removeItemOnce(prevState.values, _value)
|
|
4722
|
-
};
|
|
4723
|
-
});
|
|
4724
|
-
currentControlValueArr = removeItemOnce(currentControlValueArr, _value);
|
|
4725
|
-
currentControlLabelArr = removeItemOnce(currentControlLabelArr, formatIndentVal(_label, INDENT_LAST_PLACEHOLDER));
|
|
4726
|
-
} else {
|
|
4727
|
-
//#########
|
|
4728
|
-
// add item
|
|
4729
|
-
//#########
|
|
4730
|
-
$el.dataset.selected = 'true';
|
|
4731
|
-
$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.remove('d-none');
|
|
4732
|
-
$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.add('d-none');
|
|
4733
|
-
|
|
4734
|
-
//
|
|
4735
|
-
setControlArr(function (prevState) {
|
|
4736
|
-
// update temporary value
|
|
4737
|
-
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4738
|
-
return {
|
|
4739
|
-
labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label, INDENT_LAST_PLACEHOLDER)]),
|
|
4740
|
-
values: [].concat(_toConsumableArray(prevState.values), [_value])
|
|
4741
|
-
};
|
|
4742
|
-
});
|
|
4743
|
-
currentControlValueArr.push(_value);
|
|
4744
|
-
currentControlLabelArr.push(_label);
|
|
4745
|
-
}
|
|
4690
|
+
// If there is a callback, delete the activated style
|
|
4691
|
+
if (!noCallback) {
|
|
4692
|
+
setTimeout(function () {
|
|
4693
|
+
curBtn.classList.remove('active', 'disabled');
|
|
4694
|
+
}, 0);
|
|
4695
|
+
}
|
|
4746
4696
|
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4697
|
+
//
|
|
4698
|
+
setControlValue(_value);
|
|
4699
|
+
setControlLabel(formatIndentVal(_label, INDENT_LAST_PLACEHOLDER));
|
|
4750
4700
|
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4701
|
+
// ++++++++++++++++++++
|
|
4702
|
+
// Multiple selection
|
|
4703
|
+
// ++++++++++++++++++++
|
|
4704
|
+
currentControlValueArr = JSON.parse(JSON.stringify(valueArr));
|
|
4705
|
+
currentControlLabelArr = JSON.parse(JSON.stringify(labelArr));
|
|
4706
|
+
if (MULTI_SEL_VALID) {
|
|
4707
|
+
$el = el === null ? curBtn : el.currentTarget; // update option checkboxes
|
|
4708
|
+
_selected = $el.dataset.selected;
|
|
4709
|
+
_selectedVal = _selected == 'true' ? true : false;
|
|
4710
|
+
if (_selectedVal) {
|
|
4711
|
+
//#########
|
|
4712
|
+
// remove item
|
|
4713
|
+
//#########
|
|
4714
|
+
$el.dataset.selected = 'false';
|
|
4715
|
+
$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.add('d-none');
|
|
4716
|
+
$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.remove('d-none');
|
|
4758
4717
|
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4718
|
+
//
|
|
4719
|
+
setControlArr(function (prevState) {
|
|
4720
|
+
// update temporary value
|
|
4721
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4722
|
+
return {
|
|
4723
|
+
labels: removeItemOnce(prevState.labels, formatIndentVal(_label, INDENT_LAST_PLACEHOLDER)),
|
|
4724
|
+
values: removeItemOnce(prevState.values, _value)
|
|
4725
|
+
};
|
|
4726
|
+
});
|
|
4727
|
+
currentControlValueArr = removeItemOnce(currentControlValueArr, _value);
|
|
4728
|
+
currentControlLabelArr = removeItemOnce(currentControlLabelArr, formatIndentVal(_label, INDENT_LAST_PLACEHOLDER));
|
|
4729
|
+
} else {
|
|
4730
|
+
//#########
|
|
4731
|
+
// add item
|
|
4732
|
+
//#########
|
|
4733
|
+
$el.dataset.selected = 'true';
|
|
4734
|
+
$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.remove('d-none');
|
|
4735
|
+
$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.add('d-none');
|
|
4762
4736
|
|
|
4763
4737
|
//
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
_label2 = typeof curItem !== 'undefined' ? curItem.label : ''; // ++++++++++++++++++++
|
|
4772
|
-
// Callback
|
|
4773
|
-
// ++++++++++++++++++++
|
|
4774
|
-
(_curItem$callback = curItem.callback) === null || _curItem$callback === void 0 ? void 0 : _curItem$callback.call(curItem);
|
|
4775
|
-
|
|
4776
|
-
// ++++++++++++++++++++
|
|
4777
|
-
// Single selection
|
|
4778
|
-
// ++++++++++++++++++++
|
|
4779
|
-
|
|
4780
|
-
// clear all active classes of options
|
|
4781
|
-
// (Avoid using the keyboard to select and two actives will appear after clicking on a non-selected option.)
|
|
4782
|
-
if (noCallback) {
|
|
4783
|
-
options.forEach(function (node) {
|
|
4784
|
-
node.classList.remove('active');
|
|
4738
|
+
setControlArr(function (prevState) {
|
|
4739
|
+
// update temporary value
|
|
4740
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4741
|
+
return {
|
|
4742
|
+
labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label, INDENT_LAST_PLACEHOLDER)]),
|
|
4743
|
+
values: [].concat(_toConsumableArray(prevState.values), [_value])
|
|
4744
|
+
};
|
|
4785
4745
|
});
|
|
4746
|
+
currentControlValueArr.push(_value);
|
|
4747
|
+
currentControlLabelArr.push(_label);
|
|
4786
4748
|
}
|
|
4787
4749
|
|
|
4788
|
-
//
|
|
4789
|
-
|
|
4750
|
+
// Appropriate multi-item container height
|
|
4751
|
+
// !!!set `false` to prevents the scrollbar position from changing when multi-selecting the option is clicked
|
|
4752
|
+
adjustMultiControlContainerHeight(false);
|
|
4753
|
+
|
|
4754
|
+
// active current option
|
|
4755
|
+
if (noCallback) {
|
|
4790
4756
|
setTimeout(function () {
|
|
4791
|
-
|
|
4757
|
+
$el.classList.add('active');
|
|
4792
4758
|
}, 0);
|
|
4793
4759
|
}
|
|
4760
|
+
}
|
|
4794
4761
|
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
setControlArr(function (prevState) {
|
|
4818
|
-
// update temporary value
|
|
4819
|
-
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4820
|
-
return {
|
|
4821
|
-
labels: removeItemOnce(prevState.labels, formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER)),
|
|
4822
|
-
values: removeItemOnce(prevState.values, _value2)
|
|
4823
|
-
};
|
|
4824
|
-
});
|
|
4825
|
-
_currentControlValueArr = removeItemOnce(_currentControlValueArr, _value2);
|
|
4826
|
-
_currentControlLabelArr = removeItemOnce(_currentControlLabelArr, formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER));
|
|
4827
|
-
} else {
|
|
4828
|
-
//#########
|
|
4829
|
-
// add item
|
|
4830
|
-
//#########
|
|
4831
|
-
|
|
4832
|
-
_$el.dataset.selected = 'true';
|
|
4833
|
-
_$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.remove('d-none');
|
|
4834
|
-
_$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.add('d-none');
|
|
4835
|
-
|
|
4836
|
-
//
|
|
4837
|
-
setControlArr(function (prevState) {
|
|
4838
|
-
// update temporary value
|
|
4839
|
-
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4840
|
-
return {
|
|
4841
|
-
labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER)]),
|
|
4842
|
-
values: [].concat(_toConsumableArray(prevState.values), [_value2])
|
|
4843
|
-
};
|
|
4844
|
-
});
|
|
4845
|
-
_currentControlValueArr.push(_value2);
|
|
4846
|
-
_currentControlLabelArr.push(_label2);
|
|
4847
|
-
}
|
|
4762
|
+
//
|
|
4763
|
+
if (!(noCallback && typeof onChange === 'function')) {
|
|
4764
|
+
_context3.next = 26;
|
|
4765
|
+
break;
|
|
4766
|
+
}
|
|
4767
|
+
_context3.next = 25;
|
|
4768
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? curItem : multipleSelectionCallback(currentControlValueArr, currentControlLabelArr));
|
|
4769
|
+
case 25:
|
|
4770
|
+
//
|
|
4771
|
+
selectInputRef.current.blur();
|
|
4772
|
+
case 26:
|
|
4773
|
+
_context3.next = 42;
|
|
4774
|
+
break;
|
|
4775
|
+
case 28:
|
|
4776
|
+
// ==========================================================================
|
|
4777
|
+
// Use the "mouse" to trigger
|
|
4778
|
+
// ==========================================================================
|
|
4779
|
+
_value2 = typeof curItem !== 'undefined' ? curItem.value : '';
|
|
4780
|
+
_label2 = typeof curItem !== 'undefined' ? curItem.label : ''; // ++++++++++++++++++++
|
|
4781
|
+
// Callback
|
|
4782
|
+
// ++++++++++++++++++++
|
|
4783
|
+
(_curItem$callback = curItem.callback) === null || _curItem$callback === void 0 ? void 0 : _curItem$callback.call(curItem);
|
|
4848
4784
|
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4785
|
+
// ++++++++++++++++++++
|
|
4786
|
+
// Single selection
|
|
4787
|
+
// ++++++++++++++++++++
|
|
4852
4788
|
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4789
|
+
// clear all active classes of options
|
|
4790
|
+
// (Avoid using the keyboard to select and two actives will appear after clicking on a non-selected option.)
|
|
4791
|
+
if (noCallback) {
|
|
4792
|
+
options.forEach(function (node) {
|
|
4793
|
+
node.classList.remove('active');
|
|
4794
|
+
});
|
|
4795
|
+
}
|
|
4860
4796
|
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4797
|
+
// If there is a callback, delete the activated style
|
|
4798
|
+
if (!noCallback) {
|
|
4799
|
+
setTimeout(function () {
|
|
4800
|
+
curBtn.classList.remove('active', 'disabled');
|
|
4801
|
+
}, 0);
|
|
4802
|
+
}
|
|
4803
|
+
|
|
4804
|
+
//
|
|
4805
|
+
setControlValue(_value2);
|
|
4806
|
+
setControlLabel(formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER));
|
|
4807
|
+
|
|
4808
|
+
// ++++++++++++++++++++
|
|
4809
|
+
// Multiple selection
|
|
4810
|
+
// ++++++++++++++++++++
|
|
4811
|
+
_currentControlValueArr = JSON.parse(JSON.stringify(controlArr.values));
|
|
4812
|
+
_currentControlLabelArr = JSON.parse(JSON.stringify(controlArr.labels));
|
|
4813
|
+
if (MULTI_SEL_VALID) {
|
|
4814
|
+
_$el = el === null ? curBtn : el.currentTarget; // update option checkboxes
|
|
4815
|
+
_selected2 = _$el.dataset.selected;
|
|
4816
|
+
_selectedVal2 = _selected2 == 'true' ? true : false;
|
|
4817
|
+
if (_selectedVal2) {
|
|
4818
|
+
//#########
|
|
4819
|
+
// remove item
|
|
4820
|
+
//#########
|
|
4821
|
+
_$el.dataset.selected = 'false';
|
|
4822
|
+
_$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.add('d-none');
|
|
4823
|
+
_$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.remove('d-none');
|
|
4824
|
+
|
|
4825
|
+
//
|
|
4826
|
+
setControlArr(function (prevState) {
|
|
4827
|
+
// update temporary value
|
|
4828
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4829
|
+
return {
|
|
4830
|
+
labels: removeItemOnce(prevState.labels, formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER)),
|
|
4831
|
+
values: removeItemOnce(prevState.values, _value2)
|
|
4832
|
+
};
|
|
4833
|
+
});
|
|
4834
|
+
_currentControlValueArr = removeItemOnce(_currentControlValueArr, _value2);
|
|
4835
|
+
_currentControlLabelArr = removeItemOnce(_currentControlLabelArr, formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER));
|
|
4836
|
+
} else {
|
|
4837
|
+
//#########
|
|
4838
|
+
// add item
|
|
4839
|
+
//#########
|
|
4840
|
+
|
|
4841
|
+
_$el.dataset.selected = 'true';
|
|
4842
|
+
_$el.querySelector('.custom-select-multi__control-option-checkbox-selected').classList.remove('d-none');
|
|
4843
|
+
_$el.querySelector('.custom-select-multi__control-option-checkbox-placeholder').classList.add('d-none');
|
|
4864
4844
|
|
|
4865
4845
|
//
|
|
4866
|
-
|
|
4846
|
+
setControlArr(function (prevState) {
|
|
4847
|
+
// update temporary value
|
|
4848
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
4849
|
+
return {
|
|
4850
|
+
labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label2, INDENT_LAST_PLACEHOLDER)]),
|
|
4851
|
+
values: [].concat(_toConsumableArray(prevState.values), [_value2])
|
|
4852
|
+
};
|
|
4853
|
+
});
|
|
4854
|
+
_currentControlValueArr.push(_value2);
|
|
4855
|
+
_currentControlLabelArr.push(_label2);
|
|
4856
|
+
}
|
|
4857
|
+
|
|
4858
|
+
// Appropriate multi-item container height
|
|
4859
|
+
// !!!set `false` to prevents the scrollbar position from changing when multi-selecting the option is clicked
|
|
4860
|
+
adjustMultiControlContainerHeight(false);
|
|
4861
|
+
|
|
4862
|
+
// active current option
|
|
4863
|
+
if (noCallback) {
|
|
4864
|
+
setTimeout(function () {
|
|
4865
|
+
_$el.classList.add('active');
|
|
4866
|
+
}, 0);
|
|
4867
4867
|
}
|
|
4868
4868
|
}
|
|
4869
4869
|
|
|
4870
|
+
//
|
|
4871
|
+
if (!(noCallback && typeof onChange === 'function')) {
|
|
4872
|
+
_context3.next = 42;
|
|
4873
|
+
break;
|
|
4874
|
+
}
|
|
4875
|
+
_context3.next = 41;
|
|
4876
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? curItem : multipleSelectionCallback(_currentControlValueArr, _currentControlLabelArr));
|
|
4877
|
+
case 41:
|
|
4878
|
+
//
|
|
4879
|
+
selectInputRef.current.blur();
|
|
4880
|
+
case 42:
|
|
4870
4881
|
// Fixed an out-of-focus issue
|
|
4871
4882
|
fixFocusStatus();
|
|
4872
|
-
case
|
|
4883
|
+
case 43:
|
|
4873
4884
|
case "end":
|
|
4874
|
-
return
|
|
4885
|
+
return _context3.stop();
|
|
4875
4886
|
}
|
|
4876
|
-
},
|
|
4887
|
+
}, _callee3);
|
|
4877
4888
|
}));
|
|
4878
4889
|
return _handleSelect.apply(this, arguments);
|
|
4879
4890
|
}
|
|
@@ -4938,32 +4949,43 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4938
4949
|
adjustMultiControlContainerHeight();
|
|
4939
4950
|
}
|
|
4940
4951
|
;
|
|
4941
|
-
function handleSelectAll(
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4952
|
+
function handleSelectAll(_x6) {
|
|
4953
|
+
return _handleSelectAll.apply(this, arguments);
|
|
4954
|
+
}
|
|
4955
|
+
function _handleSelectAll() {
|
|
4956
|
+
_handleSelectAll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(event) {
|
|
4957
|
+
var _labels, _values, _updateOptionCheckbox, labels, values, _updateOptionCheckbox2, _labels2, _values2;
|
|
4958
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4959
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
4960
|
+
case 0:
|
|
4961
|
+
event.preventDefault();
|
|
4962
|
+
event.stopPropagation(); /* REQUIRED */
|
|
4963
|
+
_labels = [];
|
|
4964
|
+
_values = [];
|
|
4965
|
+
if (controlArr.values.length === optionsData.length) {
|
|
4966
|
+
// selected all items
|
|
4967
|
+
_updateOptionCheckbox = updateOptionCheckboxes('remove'), labels = _updateOptionCheckbox.labels, values = _updateOptionCheckbox.values;
|
|
4968
|
+
selectedSign.current = false;
|
|
4969
|
+
_labels = labels;
|
|
4970
|
+
_values = values;
|
|
4971
|
+
} else {
|
|
4972
|
+
_updateOptionCheckbox2 = updateOptionCheckboxes(selectedSign.current ? 'remove' : 'add'), _labels2 = _updateOptionCheckbox2.labels, _values2 = _updateOptionCheckbox2.values;
|
|
4973
|
+
selectedSign.current = !selectedSign.current;
|
|
4974
|
+
_labels = _labels2;
|
|
4975
|
+
_values = _values2;
|
|
4976
|
+
}
|
|
4977
|
+
_context4.next = 7;
|
|
4978
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, multipleSelectionCallback(_values, _labels));
|
|
4979
|
+
case 7:
|
|
4980
|
+
// Fixed an out-of-focus issue
|
|
4981
|
+
fixFocusStatus();
|
|
4982
|
+
case 8:
|
|
4983
|
+
case "end":
|
|
4984
|
+
return _context4.stop();
|
|
4985
|
+
}
|
|
4986
|
+
}, _callee4);
|
|
4987
|
+
}));
|
|
4988
|
+
return _handleSelectAll.apply(this, arguments);
|
|
4967
4989
|
}
|
|
4968
4990
|
function handleClearValue(event) {
|
|
4969
4991
|
if (typeof event !== 'undefined') {
|
|
@@ -4985,39 +5007,56 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
4985
5007
|
// update filter status
|
|
4986
5008
|
setFilterItemsHasNoMatchData(false);
|
|
4987
5009
|
}
|
|
4988
|
-
function handleMultiControlItemRemove(
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
return
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5010
|
+
function handleMultiControlItemRemove(_x7) {
|
|
5011
|
+
return _handleMultiControlItemRemove.apply(this, arguments);
|
|
5012
|
+
}
|
|
5013
|
+
function _handleMultiControlItemRemove() {
|
|
5014
|
+
_handleMultiControlItemRemove = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(event) {
|
|
5015
|
+
var valueToRemove, getCurrentIndex, currentControlValueArr, currentControlLabelArr, _value, _label;
|
|
5016
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
5017
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5018
|
+
case 0:
|
|
5019
|
+
event.preventDefault();
|
|
5020
|
+
event.stopPropagation(); /* REQUIRED */
|
|
5021
|
+
valueToRemove = String(event.currentTarget.dataset.value);
|
|
5022
|
+
getCurrentIndex = controlArr.values.findIndex(function (item) {
|
|
5023
|
+
return item.toString() === valueToRemove;
|
|
5024
|
+
});
|
|
5025
|
+
currentControlValueArr = JSON.parse(JSON.stringify(controlArr.values));
|
|
5026
|
+
currentControlLabelArr = JSON.parse(JSON.stringify(controlArr.labels));
|
|
5027
|
+
_value = valueToRemove;
|
|
5028
|
+
_label = controlArr.labels[getCurrentIndex];
|
|
5029
|
+
setControlArr(function (prevState) {
|
|
5030
|
+
// update temporary value
|
|
5031
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : VALUE_BY_BRACKETS ? (0,convert.convertArrToValByBrackets)(prevState.labels) : prevState.labels.join(','));
|
|
5032
|
+
return {
|
|
5033
|
+
labels: removeItemOnce(prevState.labels, formatIndentVal(_label, INDENT_LAST_PLACEHOLDER)),
|
|
5034
|
+
values: removeItemOnce(prevState.values, _value)
|
|
5035
|
+
};
|
|
5036
|
+
});
|
|
5037
|
+
currentControlValueArr = removeItemOnce(currentControlValueArr, _value);
|
|
5038
|
+
currentControlLabelArr = removeItemOnce(currentControlLabelArr, formatIndentVal(_label, INDENT_LAST_PLACEHOLDER));
|
|
5013
5039
|
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, multipleSelectionCallback(currentControlValueArr, currentControlLabelArr));
|
|
5040
|
+
// Appropriate multi-item container height
|
|
5041
|
+
adjustMultiControlContainerHeight();
|
|
5017
5042
|
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5043
|
+
//
|
|
5044
|
+
if (!(typeof onChange === 'function')) {
|
|
5045
|
+
_context5.next = 16;
|
|
5046
|
+
break;
|
|
5047
|
+
}
|
|
5048
|
+
_context5.next = 15;
|
|
5049
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, multipleSelectionCallback(currentControlValueArr, currentControlLabelArr));
|
|
5050
|
+
case 15:
|
|
5051
|
+
//
|
|
5052
|
+
selectInputRef.current.blur();
|
|
5053
|
+
case 16:
|
|
5054
|
+
case "end":
|
|
5055
|
+
return _context5.stop();
|
|
5056
|
+
}
|
|
5057
|
+
}, _callee5);
|
|
5058
|
+
}));
|
|
5059
|
+
return _handleMultiControlItemRemove.apply(this, arguments);
|
|
5021
5060
|
}
|
|
5022
5061
|
function handleShowList() {
|
|
5023
5062
|
// Reset the out-of-focus marker
|
|
@@ -5035,33 +5074,33 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5035
5074
|
return _handleFetch.apply(this, arguments);
|
|
5036
5075
|
}
|
|
5037
5076
|
function _handleFetch() {
|
|
5038
|
-
_handleFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5077
|
+
_handleFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
5039
5078
|
var inputVal,
|
|
5040
5079
|
searchStr,
|
|
5041
5080
|
_oparams,
|
|
5042
5081
|
_params,
|
|
5043
5082
|
res,
|
|
5044
|
-
|
|
5045
|
-
return _regeneratorRuntime().wrap(function
|
|
5046
|
-
while (1) switch (
|
|
5083
|
+
_args6 = arguments;
|
|
5084
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
5085
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
5047
5086
|
case 0:
|
|
5048
|
-
inputVal =
|
|
5087
|
+
inputVal = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;
|
|
5049
5088
|
// data init
|
|
5050
5089
|
searchStr = typeof inputVal === 'string' ? inputVal : controlTempValue || controlTempValue === '' ? controlTempValue : '';
|
|
5051
5090
|
_oparams = fetchFuncMethodParams || [];
|
|
5052
5091
|
_params = _oparams.map(function (item) {
|
|
5053
5092
|
return item !== '$QUERY_STRING' ? item : searchStr;
|
|
5054
5093
|
});
|
|
5055
|
-
|
|
5094
|
+
_context6.next = 6;
|
|
5056
5095
|
return fetchData(_params.join(','), '', '', false);
|
|
5057
5096
|
case 6:
|
|
5058
|
-
res =
|
|
5059
|
-
return
|
|
5097
|
+
res = _context6.sent;
|
|
5098
|
+
return _context6.abrupt("return", res);
|
|
5060
5099
|
case 8:
|
|
5061
5100
|
case "end":
|
|
5062
|
-
return
|
|
5101
|
+
return _context6.stop();
|
|
5063
5102
|
}
|
|
5064
|
-
},
|
|
5103
|
+
}, _callee6);
|
|
5065
5104
|
}));
|
|
5066
5105
|
return _handleFetch.apply(this, arguments);
|
|
5067
5106
|
}
|
|
@@ -5069,32 +5108,32 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5069
5108
|
return _handleFirstFetch.apply(this, arguments);
|
|
5070
5109
|
}
|
|
5071
5110
|
function _handleFirstFetch() {
|
|
5072
|
-
_handleFirstFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5111
|
+
_handleFirstFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
5073
5112
|
var inputVal,
|
|
5074
5113
|
_oparams,
|
|
5075
5114
|
_params,
|
|
5076
5115
|
res,
|
|
5077
|
-
|
|
5078
|
-
return _regeneratorRuntime().wrap(function
|
|
5079
|
-
while (1) switch (
|
|
5116
|
+
_args7 = arguments;
|
|
5117
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
5118
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5080
5119
|
case 0:
|
|
5081
|
-
inputVal =
|
|
5120
|
+
inputVal = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : null;
|
|
5082
5121
|
_oparams = fetchFuncMethodParams || [];
|
|
5083
5122
|
_params = _oparams.map(function (item) {
|
|
5084
5123
|
return item !== '$QUERY_STRING' ? item : MANUAL_REQ ? QUERY_STRING_PLACEHOLDER : '';
|
|
5085
5124
|
});
|
|
5086
|
-
|
|
5125
|
+
_context7.next = 5;
|
|
5087
5126
|
return fetchData(_params.join(','), finalRes(inputVal), inputVal);
|
|
5088
5127
|
case 5:
|
|
5089
|
-
res =
|
|
5128
|
+
res = _context7.sent;
|
|
5090
5129
|
// Set an identifier indicating that the first request has been completed
|
|
5091
5130
|
if (!handleFirstFetchCompleted) setHandleFirstFetchCompleted(true);
|
|
5092
|
-
return
|
|
5131
|
+
return _context7.abrupt("return", res);
|
|
5093
5132
|
case 8:
|
|
5094
5133
|
case "end":
|
|
5095
|
-
return
|
|
5134
|
+
return _context7.stop();
|
|
5096
5135
|
}
|
|
5097
|
-
},
|
|
5136
|
+
}, _callee7);
|
|
5098
5137
|
}));
|
|
5099
5138
|
return _handleFirstFetch.apply(this, arguments);
|
|
5100
5139
|
}
|
|
@@ -5194,101 +5233,106 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5194
5233
|
}
|
|
5195
5234
|
});
|
|
5196
5235
|
}
|
|
5197
|
-
function handleKeyPressed(
|
|
5236
|
+
function handleKeyPressed(_x8) {
|
|
5198
5237
|
return _handleKeyPressed.apply(this, arguments);
|
|
5199
5238
|
}
|
|
5200
5239
|
function _handleKeyPressed() {
|
|
5201
|
-
_handleKeyPressed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5240
|
+
_handleKeyPressed = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(event) {
|
|
5202
5241
|
var key, res, currentIndex, currentData, currentControlValueArr, currentControlLabelArr, htmlOptions;
|
|
5203
|
-
return _regeneratorRuntime().wrap(function
|
|
5204
|
-
while (1) switch (
|
|
5242
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
5243
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5205
5244
|
case 0:
|
|
5206
5245
|
key = event.code; //
|
|
5207
5246
|
onKeyPressed === null || onKeyPressed === void 0 ? void 0 : onKeyPressed(event, selectInputRef.current, valueInputRef.current);
|
|
5208
5247
|
if (isOpen) {
|
|
5209
|
-
|
|
5248
|
+
_context8.next = 4;
|
|
5210
5249
|
break;
|
|
5211
5250
|
}
|
|
5212
|
-
return
|
|
5251
|
+
return _context8.abrupt("return");
|
|
5213
5252
|
case 4:
|
|
5214
5253
|
res = null;
|
|
5215
5254
|
if (!(key === 'Enter' || key === 'NumpadEnter')) {
|
|
5216
|
-
|
|
5255
|
+
_context8.next = 26;
|
|
5217
5256
|
break;
|
|
5218
5257
|
}
|
|
5219
5258
|
event.preventDefault();
|
|
5220
5259
|
|
|
5221
5260
|
// Determine the "active" class name to avoid listening to other unused components of the same type
|
|
5222
5261
|
if (!(listRef.current === null || !rootRef.current.classList.contains('active'))) {
|
|
5223
|
-
|
|
5262
|
+
_context8.next = 9;
|
|
5224
5263
|
break;
|
|
5225
5264
|
}
|
|
5226
|
-
return
|
|
5265
|
+
return _context8.abrupt("return");
|
|
5227
5266
|
case 9:
|
|
5228
5267
|
if (!(keyboardSelectedItem.current !== null && keyboardSelectedItem.current.classList.contains('disabled'))) {
|
|
5229
|
-
|
|
5268
|
+
_context8.next = 11;
|
|
5230
5269
|
break;
|
|
5231
5270
|
}
|
|
5232
|
-
return
|
|
5271
|
+
return _context8.abrupt("return");
|
|
5233
5272
|
case 11:
|
|
5234
5273
|
if (!(listRef.current !== null)) {
|
|
5235
|
-
|
|
5274
|
+
_context8.next = 26;
|
|
5236
5275
|
break;
|
|
5237
5276
|
}
|
|
5238
|
-
|
|
5277
|
+
_context8.next = 14;
|
|
5239
5278
|
return listRef.current.dataset.data;
|
|
5240
5279
|
case 14:
|
|
5241
|
-
currentIndex =
|
|
5242
|
-
if (typeof currentIndex !== 'undefined') {
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
//
|
|
5259
|
-
if (typeof onChange === 'function') {
|
|
5260
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? currentData : multipleSelectionCallback(currentControlValueArr, currentControlLabelArr));
|
|
5261
|
-
|
|
5262
|
-
//
|
|
5263
|
-
selectInputRef.current.blur();
|
|
5280
|
+
currentIndex = _context8.sent;
|
|
5281
|
+
if (!(typeof currentIndex !== 'undefined')) {
|
|
5282
|
+
_context8.next = 26;
|
|
5283
|
+
break;
|
|
5284
|
+
}
|
|
5285
|
+
currentData = optionsData[Number(currentIndex)];
|
|
5286
|
+
currentControlValueArr = [];
|
|
5287
|
+
currentControlLabelArr = [];
|
|
5288
|
+
htmlOptions = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.hide):not(.no-match)'));
|
|
5289
|
+
htmlOptions.forEach(function (node) {
|
|
5290
|
+
node.classList.remove('active');
|
|
5291
|
+
|
|
5292
|
+
// multiple options
|
|
5293
|
+
if (node.classList.contains('item-selected')) {
|
|
5294
|
+
currentControlValueArr.push(node.dataset.value);
|
|
5295
|
+
currentControlLabelArr.push(node.dataset.label);
|
|
5264
5296
|
}
|
|
5297
|
+
});
|
|
5298
|
+
handleSelect(null, currentData, currentControlValueArr, currentControlLabelArr);
|
|
5299
|
+
|
|
5300
|
+
//
|
|
5301
|
+
if (!(typeof onChange === 'function')) {
|
|
5302
|
+
_context8.next = 26;
|
|
5303
|
+
break;
|
|
5265
5304
|
}
|
|
5266
|
-
|
|
5305
|
+
_context8.next = 25;
|
|
5306
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? currentData : multipleSelectionCallback(currentControlValueArr, currentControlLabelArr));
|
|
5307
|
+
case 25:
|
|
5308
|
+
//
|
|
5309
|
+
selectInputRef.current.blur();
|
|
5310
|
+
case 26:
|
|
5267
5311
|
if (!(key === 'ArrowUp')) {
|
|
5268
|
-
|
|
5312
|
+
_context8.next = 30;
|
|
5269
5313
|
break;
|
|
5270
5314
|
}
|
|
5271
|
-
|
|
5315
|
+
_context8.next = 29;
|
|
5272
5316
|
return optionFocus('decrease');
|
|
5273
|
-
case
|
|
5274
|
-
res =
|
|
5275
|
-
case
|
|
5317
|
+
case 29:
|
|
5318
|
+
res = _context8.sent;
|
|
5319
|
+
case 30:
|
|
5276
5320
|
if (!(key === 'ArrowDown')) {
|
|
5277
|
-
|
|
5321
|
+
_context8.next = 34;
|
|
5278
5322
|
break;
|
|
5279
5323
|
}
|
|
5280
|
-
|
|
5324
|
+
_context8.next = 33;
|
|
5281
5325
|
return optionFocus('increase');
|
|
5282
|
-
case
|
|
5283
|
-
res =
|
|
5284
|
-
case
|
|
5326
|
+
case 33:
|
|
5327
|
+
res = _context8.sent;
|
|
5328
|
+
case 34:
|
|
5285
5329
|
// temporary data
|
|
5286
5330
|
if (res !== null) listRef.current.dataset.data = res.dataset.index;
|
|
5287
|
-
case
|
|
5331
|
+
case 35:
|
|
5288
5332
|
case "end":
|
|
5289
|
-
return
|
|
5333
|
+
return _context8.stop();
|
|
5290
5334
|
}
|
|
5291
|
-
},
|
|
5335
|
+
}, _callee8);
|
|
5292
5336
|
}));
|
|
5293
5337
|
return _handleKeyPressed.apply(this, arguments);
|
|
5294
5338
|
}
|
|
@@ -5483,16 +5527,35 @@ var Select = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_
|
|
|
5483
5527
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
5484
5528
|
tabIndex: -1,
|
|
5485
5529
|
type: "button",
|
|
5486
|
-
onClick: function
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
|
|
5491
|
-
|
|
5492
|
-
|
|
5493
|
-
|
|
5494
|
-
|
|
5495
|
-
|
|
5530
|
+
onClick: /*#__PURE__*/function () {
|
|
5531
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {
|
|
5532
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5533
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5534
|
+
case 0:
|
|
5535
|
+
e.preventDefault();
|
|
5536
|
+
e.stopPropagation();
|
|
5537
|
+
if (!MULTI_SEL_VALID) {
|
|
5538
|
+
_context.next = 8;
|
|
5539
|
+
break;
|
|
5540
|
+
}
|
|
5541
|
+
updateOptionCheckboxes('remove');
|
|
5542
|
+
_context.next = 6;
|
|
5543
|
+
return onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, multipleSelectionCallback([], []));
|
|
5544
|
+
case 6:
|
|
5545
|
+
_context.next = 9;
|
|
5546
|
+
break;
|
|
5547
|
+
case 8:
|
|
5548
|
+
handleClearValue();
|
|
5549
|
+
case 9:
|
|
5550
|
+
case "end":
|
|
5551
|
+
return _context.stop();
|
|
5552
|
+
}
|
|
5553
|
+
}, _callee);
|
|
5554
|
+
}));
|
|
5555
|
+
return function (_x9) {
|
|
5556
|
+
return _ref.apply(this, arguments);
|
|
5557
|
+
};
|
|
5558
|
+
}()
|
|
5496
5559
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
5497
5560
|
width: "12px",
|
|
5498
5561
|
height: "12px",
|