funda-ui 4.7.333 → 4.7.345

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.
Files changed (38) hide show
  1. package/CascadingSelect/index.css +86 -86
  2. package/CascadingSelect/index.d.ts +21 -4
  3. package/CascadingSelect/index.js +209 -53
  4. package/CascadingSelectE2E/index.css +86 -86
  5. package/CascadingSelectE2E/index.d.ts +22 -5
  6. package/CascadingSelectE2E/index.js +233 -69
  7. package/MultipleCheckboxes/index.js +71 -0
  8. package/MultipleSelect/index.js +71 -0
  9. package/Select/index.js +15 -10
  10. package/TagInput/index.js +71 -0
  11. package/Utils/extract.d.ts +39 -1
  12. package/Utils/extract.js +65 -0
  13. package/Utils/useDragDropPosition.d.ts +0 -3
  14. package/Utils/useDragDropPosition.js +0 -3
  15. package/lib/cjs/CascadingSelect/index.d.ts +21 -4
  16. package/lib/cjs/CascadingSelect/index.js +209 -53
  17. package/lib/cjs/CascadingSelectE2E/index.d.ts +22 -5
  18. package/lib/cjs/CascadingSelectE2E/index.js +233 -69
  19. package/lib/cjs/MultipleCheckboxes/index.js +71 -0
  20. package/lib/cjs/MultipleSelect/index.js +71 -0
  21. package/lib/cjs/Select/index.js +15 -10
  22. package/lib/cjs/TagInput/index.js +71 -0
  23. package/lib/cjs/Utils/extract.d.ts +39 -1
  24. package/lib/cjs/Utils/extract.js +65 -0
  25. package/lib/cjs/Utils/useDragDropPosition.d.ts +0 -3
  26. package/lib/cjs/Utils/useDragDropPosition.js +0 -3
  27. package/lib/css/CascadingSelect/index.css +86 -86
  28. package/lib/css/CascadingSelectE2E/index.css +86 -86
  29. package/lib/esm/CascadingSelect/Group.tsx +4 -3
  30. package/lib/esm/CascadingSelect/index.scss +67 -65
  31. package/lib/esm/CascadingSelect/index.tsx +201 -60
  32. package/lib/esm/CascadingSelectE2E/Group.tsx +3 -3
  33. package/lib/esm/CascadingSelectE2E/index.scss +67 -65
  34. package/lib/esm/CascadingSelectE2E/index.tsx +235 -79
  35. package/lib/esm/Select/index.tsx +8 -8
  36. package/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -3
  37. package/lib/esm/Utils/libs/extract.ts +77 -3
  38. package/package.json +1 -1
@@ -664,6 +664,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
664
664
  return (/* binding */_extractContentsOfBrackets
665
665
  );
666
666
  },
667
+ /* harmony export */"extractContentsOfMixedCharactersWithBraces": function extractContentsOfMixedCharactersWithBraces() {
668
+ return (/* binding */_extractContentsOfMixedCharactersWithBraces
669
+ );
670
+ },
671
+ /* harmony export */"extractContentsOfMixedCharactersWithComma": function extractContentsOfMixedCharactersWithComma() {
672
+ return (/* binding */_extractContentsOfMixedCharactersWithComma
673
+ );
674
+ },
667
675
  /* harmony export */"extractContentsOfParentheses": function extractContentsOfParentheses() {
668
676
  return (/* binding */_extractContentsOfParentheses
669
677
  );
@@ -747,6 +755,69 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
747
755
  }
748
756
  }
749
757
 
758
+ /**
759
+ * Parses a braces-separated string of `{label[value]}` pairs into an array of objects.
760
+ *
761
+ * Example:
762
+ * Input: "{Poor[c]}{Sub-option 4[c-2]}{Empty[]}"
763
+ * Input: "{{Poor[c]}{Sub-option 4[c-2]}{Empty[]}[]}"
764
+ *
765
+ * Output: [
766
+ * { label: "Poor", value: "c" },
767
+ * { label: "Sub-option 4", value: "c-2" },
768
+ * { label: "Empty", value: "" }
769
+ * ]
770
+ *
771
+ * @param {string} str - The input string containing one or more `{label[value]}` segments.
772
+ * @returns {Array<{label: string, value: string}>} - An array of extracted label-value objects.
773
+ */
774
+ function _extractContentsOfMixedCharactersWithBraces(str) {
775
+ // Fix the extra '{' at the beginning
776
+ var cleaned = str.replace(/^{{/, '{');
777
+
778
+ // Remove empty {} or {[]} tail
779
+ var trimmed = cleaned.replace(/\{\[\]\}$/, '');
780
+
781
+ // The match is like {label[value]}
782
+ var pattern = /\{(.*?)\[(.*?)\]\}/g;
783
+ var matches = Array.from(trimmed.matchAll(pattern));
784
+ return matches.map(function (match) {
785
+ return {
786
+ label: match[1],
787
+ value: match[2]
788
+ };
789
+ });
790
+ }
791
+
792
+ /**
793
+ * Parses a comma-separated string of `label[value]` pairs into an array of objects.
794
+ *
795
+ * Example:
796
+ * Input: "Poor[c],Sub-option 4[c-2],Empty[]"
797
+ * Output: [
798
+ * { label: "Poor", value: "c" },
799
+ * { label: "Sub-option 4", value: "c-2" },
800
+ * { label: "Empty", value: "" }
801
+ * ]
802
+ *
803
+ * @param {string} str - A string containing label-value pairs in the format `label[value]`, separated by commas.
804
+ * @returns {Array<{ label: string, value: string }>} - An array of parsed objects.
805
+ */
806
+ function _extractContentsOfMixedCharactersWithComma(str) {
807
+ return str.split(",").map(function (item) {
808
+ return item.trim();
809
+ }).map(function (item) {
810
+ var match = item.match(/^(.*?)\[(.*?)\]$/);
811
+ if (match) {
812
+ return {
813
+ label: match[1],
814
+ value: match[2]
815
+ };
816
+ }
817
+ return null;
818
+ }).filter(Boolean);
819
+ }
820
+
750
821
  /******/
751
822
  return __webpack_exports__;
752
823
  /******/
@@ -2112,7 +2183,7 @@ function Group(props) {
2112
2183
  "data-id": item.id,
2113
2184
  "data-value": JSON.stringify(item),
2114
2185
  "data-level": level,
2115
- className: (0,cls.combinedCls)('cas-select__opt', {
2186
+ className: (0,cls.combinedCls)('casc-select__opt', {
2116
2187
  'active': item.current
2117
2188
  }),
2118
2189
  dangerouslySetInnerHTML: {
@@ -2126,13 +2197,13 @@ function Group(props) {
2126
2197
  } else {
2127
2198
  return columnTitle[level] === '' || perColumnHeadersShow === false ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("h3", {
2128
2199
  key: index,
2129
- className: "cas-select__opt-header"
2200
+ className: "casc-select__opt-header"
2130
2201
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
2131
2202
  dangerouslySetInnerHTML: {
2132
2203
  __html: columnTitle[level]
2133
2204
  }
2134
2205
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
2135
- className: "cas-select__opt-header__clean"
2206
+ className: "casc-select__opt-header__clean"
2136
2207
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
2137
2208
  tabIndex: -1,
2138
2209
  href: "#",
@@ -2159,7 +2230,7 @@ function Group(props) {
2159
2230
  }));
2160
2231
  }
2161
2232
  ;// CONCATENATED MODULE: ./src/index.tsx
2162
- var _excluded = ["popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "searchable", "searchPlaceholder", "perColumnHeadersShow", "exceededSidePosOffset", "disabled", "required", "value", "label", "placeholder", "name", "id", "extractValueByBraces", "columnTitle", "depth", "loader", "displayResult", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "cleanNodeBtnClassName", "cleanNodeBtnContent", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur", "onFocus"];
2233
+ var _excluded = ["popupRef", "wrapperClassName", "controlClassName", "controlExClassName", "controlGroupWrapperClassName", "controlGroupTextClassName", "searchable", "searchPlaceholder", "perColumnHeadersShow", "exceededSidePosOffset", "readOnly", "disabled", "required", "requiredLabel", "units", "iconLeft", "iconRight", "minLength", "maxLength", "value", "label", "placeholder", "name", "id", "extractValueByBraces", "columnTitle", "depth", "loader", "inputable", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "cleanNodeBtnClassName", "cleanNodeBtnContent", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur", "onFocus", "formatInputResult"];
2163
2234
  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; }
2164
2235
  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); }
2165
2236
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
@@ -2188,11 +2259,13 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
2188
2259
 
2189
2260
 
2190
2261
 
2191
- var CascadingSelect = function CascadingSelect(props) {
2262
+ var CascadingSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
2192
2263
  var popupRef = props.popupRef,
2193
2264
  wrapperClassName = props.wrapperClassName,
2194
2265
  controlClassName = props.controlClassName,
2195
2266
  controlExClassName = props.controlExClassName,
2267
+ controlGroupWrapperClassName = props.controlGroupWrapperClassName,
2268
+ controlGroupTextClassName = props.controlGroupTextClassName,
2196
2269
  _props$searchable = props.searchable,
2197
2270
  searchable = _props$searchable === void 0 ? false : _props$searchable,
2198
2271
  _props$searchPlacehol = props.searchPlaceholder,
@@ -2200,8 +2273,15 @@ var CascadingSelect = function CascadingSelect(props) {
2200
2273
  _props$perColumnHeade = props.perColumnHeadersShow,
2201
2274
  perColumnHeadersShow = _props$perColumnHeade === void 0 ? true : _props$perColumnHeade,
2202
2275
  exceededSidePosOffset = props.exceededSidePosOffset,
2276
+ readOnly = props.readOnly,
2203
2277
  disabled = props.disabled,
2204
2278
  required = props.required,
2279
+ requiredLabel = props.requiredLabel,
2280
+ units = props.units,
2281
+ iconLeft = props.iconLeft,
2282
+ iconRight = props.iconRight,
2283
+ minLength = props.minLength,
2284
+ maxLength = props.maxLength,
2205
2285
  value = props.value,
2206
2286
  label = props.label,
2207
2287
  placeholder = props.placeholder,
@@ -2211,7 +2291,8 @@ var CascadingSelect = function CascadingSelect(props) {
2211
2291
  columnTitle = props.columnTitle,
2212
2292
  depth = props.depth,
2213
2293
  loader = props.loader,
2214
- displayResult = props.displayResult,
2294
+ _props$inputable = props.inputable,
2295
+ inputable = _props$inputable === void 0 ? false : _props$inputable,
2215
2296
  displayResultArrow = props.displayResultArrow,
2216
2297
  controlArrow = props.controlArrow,
2217
2298
  valueType = props.valueType,
@@ -2230,6 +2311,7 @@ var CascadingSelect = function CascadingSelect(props) {
2230
2311
  onChange = props.onChange,
2231
2312
  onBlur = props.onBlur,
2232
2313
  onFocus = props.onFocus,
2314
+ formatInputResult = props.formatInputResult,
2233
2315
  attributes = _objectWithoutProperties(props, _excluded);
2234
2316
  var DEPTH = depth || 1055; // the default value same as bootstrap
2235
2317
  var POS_OFFSET = 0;
@@ -2238,7 +2320,7 @@ var CascadingSelect = function CascadingSelect(props) {
2238
2320
  var uniqueID = useComId_default()();
2239
2321
  var idRes = id || uniqueID;
2240
2322
  var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2241
- var valRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2323
+ var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2242
2324
  var listRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
2243
2325
 
2244
2326
  // searchable
@@ -2246,6 +2328,22 @@ var CascadingSelect = function CascadingSelect(props) {
2246
2328
  _useState2 = _slicedToArray(_useState, 2),
2247
2329
  columnSearchKeywords = _useState2[0],
2248
2330
  setColumnSearchKeywords = _useState2[1];
2331
+ var propExist = function propExist(p) {
2332
+ return typeof p !== 'undefined' && p !== null && p !== '';
2333
+ };
2334
+ var resultInput = function resultInput(curData, curQueryIdsData) {
2335
+ return VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(curData.map(function (item, i) {
2336
+ return "".concat(item, "[").concat(curQueryIdsData[i], "]");
2337
+ })) : curData.map(function (item, i) {
2338
+ return "".concat(item, "[").concat(curQueryIdsData[i], "]");
2339
+ }).join(',');
2340
+ };
2341
+ var resultInputPureText = function resultInputPureText(inputStr) {
2342
+ return VALUE_BY_BRACES ? "{".concat(inputStr, "[]}") : "".concat(inputStr, "[]");
2343
+
2344
+ // value1: {{curLabel[curValue]}[]}
2345
+ // value2: curLabel[curValue][]
2346
+ };
2249
2347
 
2250
2348
  // exposes the following methods
2251
2349
  (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useImperativeHandle)(popupRef, function () {
@@ -2315,17 +2413,16 @@ var CascadingSelect = function CascadingSelect(props) {
2315
2413
  windowScrollUpdate = _useWindowScroll2[1];
2316
2414
  function popwinPosInit() {
2317
2415
  var showAct = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
2318
- if (rootRef.current === null || valRef.current === null) return;
2416
+ if (rootRef.current === null || inputRef.current === null) return;
2319
2417
 
2320
2418
  // update modal position
2321
- var _modalRef = document.querySelector("#cas-select__items-wrapper-".concat(idRes));
2322
- var _triggerRef = valRef.current;
2323
- var _triggerXaxisRef = rootRef.current;
2419
+ var _modalRef = document.querySelector("#casc-select__items-wrapper-".concat(idRes));
2420
+ var _triggerRef = inputRef.current;
2324
2421
 
2325
2422
  // console.log(getAbsolutePositionOfStage(_triggerRef));
2326
2423
 
2327
2424
  if (_modalRef === null) return;
2328
- var _getAbsolutePositionO = (0,getElementProperty.getAbsolutePositionOfStage)(_triggerXaxisRef),
2425
+ var _getAbsolutePositionO = (0,getElementProperty.getAbsolutePositionOfStage)(_triggerRef),
2329
2426
  x = _getAbsolutePositionO.x;
2330
2427
  var _getAbsolutePositionO2 = (0,getElementProperty.getAbsolutePositionOfStage)(_triggerRef),
2331
2428
  y = _getAbsolutePositionO2.y,
@@ -2391,7 +2488,7 @@ var CascadingSelect = function CascadingSelect(props) {
2391
2488
  }
2392
2489
 
2393
2490
  function popwinPosHide() {
2394
- var _modalRef = document.querySelector("#cas-select__items-wrapper-".concat(idRes));
2491
+ var _modalRef = document.querySelector("#casc-select__items-wrapper-".concat(idRes));
2395
2492
  if (_modalRef !== null) {
2396
2493
  // remove classnames and styles
2397
2494
  _modalRef.classList.remove('active');
@@ -2402,9 +2499,9 @@ var CascadingSelect = function CascadingSelect(props) {
2402
2499
  var level = arguments.length > 2 ? arguments[2] : undefined;
2403
2500
  if (listRef.current === null) return;
2404
2501
  var latestDisplayColIndex = 0;
2405
- var currentItemsInner = listRef.current.querySelector('.cas-select__items-inner');
2502
+ var currentItemsInner = listRef.current.querySelector('.casc-select__items-inner');
2406
2503
  if (currentItemsInner !== null) {
2407
- var colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.cas-select__items-col'));
2504
+ var colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.casc-select__items-col'));
2408
2505
  colItemsWrapper.forEach(function (perCol) {
2409
2506
  perCol.classList.remove('hide-col');
2410
2507
  });
@@ -2549,8 +2646,7 @@ var CascadingSelect = function CascadingSelect(props) {
2549
2646
  }
2550
2647
  function handleDisplayOptions(event) {
2551
2648
  if (event) event.preventDefault();
2552
-
2553
- //
2649
+ if (isShow) return;
2554
2650
  activate();
2555
2651
  }
2556
2652
  function handleClickItem(e, resValue, index, level, curData) {
@@ -2567,7 +2663,9 @@ var CascadingSelect = function CascadingSelect(props) {
2567
2663
  // callback
2568
2664
  //////////////////////////////////////////
2569
2665
  if (typeof onChange === 'function') {
2570
- onChange(valRef.current, resValue, index, level, inputVal, cancel);
2666
+ var curValString = valueType === 'value' ? inputVal[0] : inputVal[1];
2667
+ var curValCallback = typeof formatInputResult === 'function' ? formatInputResult(VALUE_BY_BRACES ? (0,extract.extractContentsOfMixedCharactersWithBraces)(curValString) : (0,extract.extractContentsOfMixedCharactersWithComma)(curValString)) : curValString;
2668
+ onChange(inputRef.current, resValue, index, level, curValCallback, cancel);
2571
2669
  }
2572
2670
 
2573
2671
  // update data
@@ -2577,6 +2675,11 @@ var CascadingSelect = function CascadingSelect(props) {
2577
2675
  // All the elements from start(array.length - start) to the end of the array will be deleted.
2578
2676
  newData.splice(level + 1);
2579
2677
 
2678
+ // When requesting a return asynchronously, a new column is added only under the currently clicked column,
2679
+ // and the previous column cannot be affected.
2680
+ // Make sure that subsequent asynchronous requests will only insert new columns towards the level+1 position.
2681
+ listData.current = _toConsumableArray(newData);
2682
+
2580
2683
  // active status
2581
2684
  if (resValue.children) {
2582
2685
  var childList = resValue.children;
@@ -2598,10 +2701,10 @@ var CascadingSelect = function CascadingSelect(props) {
2598
2701
 
2599
2702
  // active current option with DOM
2600
2703
  //////////////////////////////////////////
2601
- var currentItemsInner = e.currentTarget.closest('.cas-select__items-inner');
2704
+ var currentItemsInner = e.currentTarget.closest('.casc-select__items-inner');
2602
2705
  if (currentItemsInner !== null) {
2603
2706
  curData.forEach(function (v, col) {
2604
- var colItemsWrapper = currentItemsInner.querySelectorAll('.cas-select__items-col');
2707
+ var colItemsWrapper = currentItemsInner.querySelectorAll('.casc-select__items-col');
2605
2708
  colItemsWrapper.forEach(function (perCol) {
2606
2709
  var _col = Number(perCol.dataset.col);
2607
2710
  if (_col >= level) {
@@ -2654,7 +2757,7 @@ var CascadingSelect = function CascadingSelect(props) {
2654
2757
  }
2655
2758
  function updateValue(arr, targetVal) {
2656
2759
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2657
- var inputEl = valRef.current;
2760
+ var inputEl = inputRef.current;
2658
2761
  var _valueData, _labelData;
2659
2762
  if (targetVal.toString().indexOf('$EMPTY_ID_') >= 0) {
2660
2763
  // If clearing the current column
@@ -2695,16 +2798,8 @@ var CascadingSelect = function CascadingSelect(props) {
2695
2798
 
2696
2799
  // update selected data
2697
2800
  //////////////////////////////////////////
2698
- var inputVal_0 = VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(_valueData.map(function (item, i) {
2699
- return "".concat(item, "[").concat(_valueData[i], "]");
2700
- })) : _valueData.map(function (item, i) {
2701
- return "".concat(item, "[").concat(_valueData[i], "]");
2702
- }).join(',');
2703
- var inputVal_1 = VALUE_BY_BRACES ? (0,convert.convertArrToValByBraces)(_labelData.map(function (item, i) {
2704
- return "".concat(item, "[").concat(_valueData[i], "]");
2705
- })) : _labelData.map(function (item, i) {
2706
- return "".concat(item, "[").concat(_valueData[i], "]");
2707
- }).join(',');
2801
+ var inputVal_0 = resultInput(_valueData, _valueData);
2802
+ var inputVal_1 = resultInput(_labelData, _valueData);
2708
2803
  if (valueType === 'value') {
2709
2804
  if (inputEl !== null) setChangedVal(inputVal_0);
2710
2805
  } else {
@@ -3054,9 +3149,9 @@ var CascadingSelect = function CascadingSelect(props) {
3054
3149
  }
3055
3150
  }, [listData.current.length]);
3056
3151
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3057
- className: (0,cls.clsWrite)(wrapperClassName, 'cas-select__wrapper mb-3 position-relative', "cas-select__wrapper ".concat(wrapperClassName)),
3152
+ className: (0,cls.clsWrite)(wrapperClassName, 'casc-select__wrapper mb-3 position-relative', "casc-select__wrapper ".concat(wrapperClassName)),
3058
3153
  ref: rootRef,
3059
- "data-overlay-id": "cas-select__items-wrapper-".concat(idRes)
3154
+ "data-overlay-id": "casc-select__items-wrapper-".concat(idRes)
3060
3155
  }, label ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, typeof label === 'string' ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
3061
3156
  htmlFor: idRes,
3062
3157
  className: "form-label",
@@ -3067,23 +3162,23 @@ var CascadingSelect = function CascadingSelect(props) {
3067
3162
  htmlFor: idRes,
3068
3163
  className: "form-label"
3069
3164
  }, label)) : null, triggerContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3070
- className: (0,cls.clsWrite)(wrapperClassName, 'cas-select__trigger d-inline w-auto', "cas-select__trigger ".concat(triggerClassName)),
3165
+ className: (0,cls.clsWrite)(wrapperClassName, 'casc-select__trigger d-inline w-auto', "casc-select__trigger ".concat(triggerClassName)),
3071
3166
  onClick: handleDisplayOptions
3072
3167
  }, triggerContent)) : null, !hasErr ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
3073
3168
  show: true,
3074
3169
  containerClassName: "CascadingSelect"
3075
3170
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3076
3171
  ref: listRef,
3077
- id: "cas-select__items-wrapper-".concat(idRes),
3078
- className: "cas-select__items-wrapper position-absolute border shadow small",
3172
+ id: "casc-select__items-wrapper-".concat(idRes),
3173
+ className: "casc-select__items-wrapper position-absolute border shadow small",
3079
3174
  style: {
3080
3175
  zIndex: DEPTH,
3081
3176
  display: 'none'
3082
3177
  }
3083
3178
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
3084
- className: "cas-select__items-inner"
3179
+ className: "casc-select__items-inner"
3085
3180
  }, loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3086
- className: "cas-select__items-loader"
3181
+ className: "casc-select__items-loader"
3087
3182
  }, loader || /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
3088
3183
  height: "12px",
3089
3184
  width: "12px",
@@ -3119,7 +3214,7 @@ var CascadingSelect = function CascadingSelect(props) {
3119
3214
  e.preventDefault();
3120
3215
  cancel();
3121
3216
  },
3122
- className: "cas-select__close position-absolute top-0 end-0 mt-0 mx-1"
3217
+ className: "casc-select__close position-absolute top-0 end-0 mt-0 mx-1"
3123
3218
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
3124
3219
  width: "10px",
3125
3220
  height: "10px",
@@ -3140,9 +3235,9 @@ var CascadingSelect = function CascadingSelect(props) {
3140
3235
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
3141
3236
  key: level,
3142
3237
  "data-col": level,
3143
- className: "cas-select__items-col"
3238
+ className: "casc-select__items-col"
3144
3239
  }, searchable && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3145
- className: "cas-select__items-col-searchbox"
3240
+ className: "casc-select__items-col-searchbox"
3146
3241
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", {
3147
3242
  type: "text",
3148
3243
  placeholder: searchPlaceholder,
@@ -3168,28 +3263,89 @@ var CascadingSelect = function CascadingSelect(props) {
3168
3263
  return null;
3169
3264
  }
3170
3265
  })))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3171
- className: "cas-select__val",
3266
+ className: (0,cls.combinedCls)('casc-select__val', {
3267
+ 'inputable': inputable
3268
+ }),
3172
3269
  onClick: handleDisplayOptions
3173
- }, displayResult ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3174
- className: "cas-select__result"
3175
- }, displayInfo()) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
3176
- ref: valRef,
3270
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3271
+ className: (0,cls.combinedCls)('position-relative', (0,cls.clsWrite)(controlGroupWrapperClassName, 'input-group'), {
3272
+ 'has-left-content': propExist(iconLeft),
3273
+ 'has-right-content': propExist(iconRight) || propExist(units)
3274
+ })
3275
+ }, propExist(iconLeft) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3276
+ className: (0,cls.clsWrite)(controlGroupTextClassName, 'input-group-text')
3277
+ }, iconLeft)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3278
+ className: "input-group-control-container flex-fill position-relative"
3279
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
3280
+ ref: function ref(node) {
3281
+ inputRef.current = node;
3282
+ if (typeof externalRef === 'function') {
3283
+ externalRef(node);
3284
+ } else if (externalRef) {
3285
+ externalRef.current = node;
3286
+ }
3287
+ },
3177
3288
  id: idRes,
3178
- "data-overlay-id": "cas-select__items-wrapper-".concat(idRes),
3289
+ "data-overlay-id": "casc-select__items-wrapper-".concat(idRes),
3179
3290
  name: name,
3180
- className: (0,cls.combinedCls)((0,cls.clsWrite)(controlClassName, 'form-control'), controlExClassName),
3291
+ className: (0,cls.combinedCls)((0,cls.clsWrite)(controlClassName, 'form-control'), controlExClassName, {
3292
+ 'rounded': !propExist(iconLeft) && !propExist(iconRight) && !propExist(units),
3293
+ 'rounded-start-0': propExist(iconLeft),
3294
+ 'rounded-end-0': propExist(iconRight) || propExist(units)
3295
+ }),
3181
3296
  placeholder: placeholder,
3182
- value: changedVal // placeholder will not change if defaultValue is used
3297
+ value: function () {
3298
+ var curValForamt = resultInputPureText(changedVal);
3299
+ var curValCallback = curValForamt;
3300
+
3301
+ // STEP 1
3302
+ //============
3303
+ if (typeof formatInputResult === 'function') {
3304
+ return formatInputResult(VALUE_BY_BRACES ? (0,extract.extractContentsOfMixedCharactersWithBraces)(curValCallback) : (0,extract.extractContentsOfMixedCharactersWithComma)(curValCallback));
3305
+ } else {
3306
+ return changedVal;
3307
+ }
3308
+ }()
3309
+ // placeholder will not change if defaultValue is used
3183
3310
  ,
3184
3311
  onFocus: handleFocus,
3185
3312
  onBlur: handleBlur,
3313
+ autoComplete: "off",
3186
3314
  disabled: disabled || null,
3315
+ readOnly: readOnly || null,
3187
3316
  required: required || null,
3317
+ minLength: minLength || null,
3318
+ maxLength: maxLength || null,
3188
3319
  style: style,
3189
3320
  tabIndex: tabIndex || 0,
3190
- readOnly: true
3191
- }, attributes)), isShow ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3192
- className: "cas-select__closemask",
3321
+ onChange: inputable ? function (e) {
3322
+ setChangedVal(e.target.value);
3323
+ if (typeof onChange === 'function') {
3324
+ onChange(e,
3325
+ // input dom event
3326
+ null,
3327
+ // currentData
3328
+ null,
3329
+ // index
3330
+ null,
3331
+ // depth
3332
+ e.target.value,
3333
+ // value
3334
+ cancel);
3335
+ }
3336
+ } : undefined
3337
+ }, attributes)), !inputable ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3338
+ className: "casc-select__result"
3339
+ }, displayInfo()) : null, required ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, requiredLabel || requiredLabel === '' ? requiredLabel : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3340
+ className: "position-absolute end-0 top-0 my-2 mx-2 pe-3"
3341
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3342
+ className: "text-danger"
3343
+ }, "*"))) : ''), propExist(units) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3344
+ className: (0,cls.clsWrite)(controlGroupTextClassName, 'input-group-text')
3345
+ }, units)) : null, propExist(iconRight) ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
3346
+ className: (0,cls.clsWrite)(controlGroupTextClassName, 'input-group-text')
3347
+ }, iconRight)) : null), isShow ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
3348
+ className: "casc-select__closemask",
3193
3349
  onClick: function onClick(e) {
3194
3350
  e.preventDefault();
3195
3351
  cancel();
@@ -3216,7 +3372,7 @@ var CascadingSelect = function CascadingSelect(props) {
3216
3372
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
3217
3373
  d: "M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39"
3218
3374
  })))))))));
3219
- };
3375
+ });
3220
3376
  /* harmony default export */ const src = (CascadingSelect);
3221
3377
  })();
3222
3378