funda-ui 2.5.105 → 2.7.105

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.
@@ -1,4 +1,11 @@
1
1
  import React from 'react';
2
+ interface OptionConfig {
3
+ disabled?: boolean;
4
+ label: any;
5
+ listItemLabel?: any;
6
+ value: any;
7
+ queryString: string | number;
8
+ }
2
9
  declare type LiveSearchProps = {
3
10
  wrapperClassName?: string;
4
11
  controlClassName?: string;
@@ -9,9 +16,11 @@ declare type LiveSearchProps = {
9
16
  label?: React.ReactNode | string;
10
17
  name?: string;
11
18
  maxLength?: any;
19
+ readOnly?: any;
12
20
  disabled?: any;
13
21
  required?: any;
14
22
  placeholder?: string;
23
+ options?: OptionConfig[] | string;
15
24
  winWidth?: string | Function;
16
25
  icon?: React.ReactNode | string;
17
26
  btnId?: string;
@@ -547,7 +547,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
547
547
  var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
548
548
  /* harmony import */
549
549
  var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
550
- var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
550
+ var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "readOnly", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
551
551
  function _extends() {
552
552
  _extends = Object.assign ? Object.assign.bind() : function (target) {
553
553
  for (var i = 1; i < arguments.length; i++) {
@@ -643,6 +643,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
643
643
  controlClassName = props.controlClassName,
644
644
  appearance = props.appearance,
645
645
  isSearchInput = props.isSearchInput,
646
+ readOnly = props.readOnly,
646
647
  disabled = props.disabled,
647
648
  required = props.required,
648
649
  placeholder = props.placeholder,
@@ -757,6 +758,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
757
758
  onCompositionUpdate: handleComposition,
758
759
  onCompositionEnd: handleComposition,
759
760
  disabled: disabled || null,
761
+ readOnly: readOnly || null,
760
762
  required: required || null,
761
763
  style: style
762
764
  }, attributes)), icon || icon !== '' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
@@ -953,16 +955,16 @@ var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
953
955
  var dist_cjs = __webpack_require__(962);
954
956
  var dist_cjs_default = /*#__PURE__*/__webpack_require__.n(dist_cjs);
955
957
  ;// CONCATENATED MODULE: ./src/index.tsx
956
- var _excluded = ["wrapperClassName", "controlClassName", "exceededSidePosOffset", "appearance", "isSearchInput", "disabled", "required", "placeholder", "value", "label", "name", "id", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "maxLength", "style", "winWidth", "tabIndex", "data", "fetchAutoShow", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur"];
958
+ var _excluded = ["wrapperClassName", "controlClassName", "exceededSidePosOffset", "appearance", "isSearchInput", "readOnly", "disabled", "required", "placeholder", "options", "value", "label", "name", "id", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "maxLength", "style", "winWidth", "tabIndex", "data", "fetchAutoShow", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur"];
957
959
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
958
960
  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."); }
959
961
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
960
962
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
961
- 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); }
962
963
  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); }
963
964
  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; }
964
965
  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); } }
965
966
  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); }); }; }
967
+ 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); }
966
968
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
967
969
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
968
970
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -983,9 +985,11 @@ var LiveSearch = function LiveSearch(props) {
983
985
  exceededSidePosOffset = props.exceededSidePosOffset,
984
986
  appearance = props.appearance,
985
987
  isSearchInput = props.isSearchInput,
988
+ readOnly = props.readOnly,
986
989
  disabled = props.disabled,
987
990
  required = props.required,
988
991
  placeholder = props.placeholder,
992
+ options = props.options,
989
993
  value = props.value,
990
994
  label = props.label,
991
995
  name = props.name,
@@ -1021,14 +1025,18 @@ var LiveSearch = function LiveSearch(props) {
1021
1025
  var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1022
1026
  var listRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1023
1027
  var listContentRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1028
+ var optionsRes = options ? isJSON(options) ? JSON.parse(options) : options : [];
1024
1029
  var windowScrollUpdate = (0,performance.debounce)(handleScrollEvent, 500);
1025
1030
 
1031
+ // return a array of options
1032
+ var staticOptionsData = optionsRes;
1033
+
1026
1034
  //
1027
1035
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1028
1036
  _useState2 = _slicedToArray(_useState, 2),
1029
1037
  firstFetch = _useState2[0],
1030
1038
  setFirstFetch = _useState2[1];
1031
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
1039
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
1032
1040
  _useState4 = _slicedToArray(_useState3, 2),
1033
1041
  dataInit = _useState4[0],
1034
1042
  setOrginalDataInit = _useState4[1];
@@ -1058,6 +1066,27 @@ var LiveSearch = function LiveSearch(props) {
1058
1066
  handleChange(e);
1059
1067
  }, 350, [dataInit]);
1060
1068
 
1069
+ // Determine whether it is in JSON format
1070
+ function isJSON(str) {
1071
+ if (typeof str === 'string' && str.length > 0) {
1072
+ if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
1073
+ return false;
1074
+ } else {
1075
+ if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
1076
+ return true;
1077
+ } else {
1078
+ return false;
1079
+ }
1080
+ }
1081
+ } else {
1082
+ if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
1083
+ return true;
1084
+ } else {
1085
+ return false;
1086
+ }
1087
+ }
1088
+ }
1089
+
1061
1090
  /**
1062
1091
  * Check if an element is in the viewport
1063
1092
  * @param {HTMLElement} elem
@@ -1260,9 +1289,6 @@ var LiveSearch = function LiveSearch(props) {
1260
1289
  function handleChange(e) {
1261
1290
  var val = e.target.value;
1262
1291
  setChangedVal(val);
1263
-
1264
- // detect string which contains only spaces
1265
- if (!val.replace(/\s/g, '').length === true) return;
1266
1292
  if (INPUT_MATCH_ENABLED) {
1267
1293
  //
1268
1294
  if (!fetchTrigger) {
@@ -1545,7 +1571,7 @@ var LiveSearch = function LiveSearch(props) {
1545
1571
  //--------------
1546
1572
  var listener = /*#__PURE__*/function () {
1547
1573
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
1548
- var res, currentData, options;
1574
+ var res, currentData, _options;
1549
1575
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1550
1576
  while (1) switch (_context.prev = _context.next) {
1551
1577
  case 0:
@@ -1566,13 +1592,13 @@ var LiveSearch = function LiveSearch(props) {
1566
1592
  handleSelect(null, currentData);
1567
1593
 
1568
1594
  //
1569
- options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.no-match)'));
1570
- options.forEach(function (node) {
1595
+ _options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.no-match)'));
1596
+ _options.forEach(function (node) {
1571
1597
  node.classList.remove('active');
1572
1598
  });
1573
1599
 
1574
1600
  //
1575
- onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, options.map(function (node) {
1601
+ onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, _options.map(function (node) {
1576
1602
  return JSON.parse(node.dataset.itemdata);
1577
1603
  }), JSON.parse(currentData));
1578
1604
  }
@@ -1667,6 +1693,7 @@ var LiveSearch = function LiveSearch(props) {
1667
1693
  maxLength: maxLength,
1668
1694
  disabled: disabled,
1669
1695
  required: required,
1696
+ readOnly: readOnly,
1670
1697
  style: style,
1671
1698
  appearance: appearance,
1672
1699
  onChange: function onChange(e) {
@@ -1232,10 +1232,6 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1232
1232
  _useState16 = _slicedToArray(_useState15, 2),
1233
1233
  incomingData = _useState16[0],
1234
1234
  setIncomingData = _useState16[1];
1235
- var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1236
- _useState18 = _slicedToArray(_useState17, 2),
1237
- firstDataFeched = _useState18[0],
1238
- setFirstDataFeched = _useState18[1];
1239
1235
  var selectedSign = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
1240
1236
  var MULTI_SEL_VALID = multiSelect ? multiSelect.valid : false;
1241
1237
  var MULTI_SEL_LABEL = multiSelect ? multiSelect.selectAllLabel : 'Select all options';
@@ -1244,13 +1240,13 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1244
1240
  allItemsLabel: 'All Content',
1245
1241
  noneLabel: 'No items selected'
1246
1242
  };
1247
- var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
1243
+ var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
1248
1244
  labels: [],
1249
1245
  values: []
1250
1246
  }),
1251
- _useState20 = _slicedToArray(_useState19, 2),
1252
- controlArr = _useState20[0],
1253
- setControlArr = _useState20[1];
1247
+ _useState18 = _slicedToArray(_useState17, 2),
1248
+ controlArr = _useState18[0],
1249
+ setControlArr = _useState18[1];
1254
1250
  var multiSelControlOptionExist = function multiSelControlOptionExist(arr, val) {
1255
1251
  var _data = arr.filter(Boolean);
1256
1252
  return _data.map(function (v) {
@@ -13,6 +13,7 @@ declare type SearchBarProps = {
13
13
  label?: React.ReactNode | string;
14
14
  name?: string;
15
15
  maxLength?: any;
16
+ readOnly?: any;
16
17
  disabled?: any;
17
18
  required?: any;
18
19
  placeholder?: string;
@@ -96,7 +96,7 @@ __webpack_require__.r(__webpack_exports__);
96
96
  /* harmony export */ });
97
97
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
98
98
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
99
- var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
99
+ var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "readOnly", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
100
100
  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); }
101
101
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
102
102
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -112,6 +112,7 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
112
112
  controlClassName = props.controlClassName,
113
113
  appearance = props.appearance,
114
114
  isSearchInput = props.isSearchInput,
115
+ readOnly = props.readOnly,
115
116
  disabled = props.disabled,
116
117
  required = props.required,
117
118
  placeholder = props.placeholder,
@@ -226,6 +227,7 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
226
227
  onCompositionUpdate: handleComposition,
227
228
  onCompositionEnd: handleComposition,
228
229
  disabled: disabled || null,
230
+ readOnly: readOnly || null,
229
231
  required: required || null,
230
232
  style: style
231
233
  }, attributes)), icon || icon !== '' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
@@ -1,4 +1,11 @@
1
1
  import React from 'react';
2
+ interface OptionConfig {
3
+ disabled?: boolean;
4
+ label: any;
5
+ listItemLabel?: any;
6
+ value: any;
7
+ queryString: string | number;
8
+ }
2
9
  declare type LiveSearchProps = {
3
10
  wrapperClassName?: string;
4
11
  controlClassName?: string;
@@ -9,9 +16,11 @@ declare type LiveSearchProps = {
9
16
  label?: React.ReactNode | string;
10
17
  name?: string;
11
18
  maxLength?: any;
19
+ readOnly?: any;
12
20
  disabled?: any;
13
21
  required?: any;
14
22
  placeholder?: string;
23
+ options?: OptionConfig[] | string;
15
24
  winWidth?: string | Function;
16
25
  icon?: React.ReactNode | string;
17
26
  btnId?: string;
@@ -547,7 +547,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
547
547
  var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1465__(787);
548
548
  /* harmony import */
549
549
  var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1465__.n(react__WEBPACK_IMPORTED_MODULE_0__);
550
- var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
550
+ var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "readOnly", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
551
551
  function _extends() {
552
552
  _extends = Object.assign ? Object.assign.bind() : function (target) {
553
553
  for (var i = 1; i < arguments.length; i++) {
@@ -643,6 +643,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
643
643
  controlClassName = props.controlClassName,
644
644
  appearance = props.appearance,
645
645
  isSearchInput = props.isSearchInput,
646
+ readOnly = props.readOnly,
646
647
  disabled = props.disabled,
647
648
  required = props.required,
648
649
  placeholder = props.placeholder,
@@ -757,6 +758,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
757
758
  onCompositionUpdate: handleComposition,
758
759
  onCompositionEnd: handleComposition,
759
760
  disabled: disabled || null,
761
+ readOnly: readOnly || null,
760
762
  required: required || null,
761
763
  style: style
762
764
  }, attributes)), icon || icon !== '' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
@@ -953,16 +955,16 @@ var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
953
955
  var dist_cjs = __webpack_require__(962);
954
956
  var dist_cjs_default = /*#__PURE__*/__webpack_require__.n(dist_cjs);
955
957
  ;// CONCATENATED MODULE: ./src/index.tsx
956
- var _excluded = ["wrapperClassName", "controlClassName", "exceededSidePosOffset", "appearance", "isSearchInput", "disabled", "required", "placeholder", "value", "label", "name", "id", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "maxLength", "style", "winWidth", "tabIndex", "data", "fetchAutoShow", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur"];
958
+ var _excluded = ["wrapperClassName", "controlClassName", "exceededSidePosOffset", "appearance", "isSearchInput", "readOnly", "disabled", "required", "placeholder", "options", "value", "label", "name", "id", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "maxLength", "style", "winWidth", "tabIndex", "data", "fetchAutoShow", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange", "onBlur"];
957
959
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
958
960
  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."); }
959
961
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
960
962
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
961
- 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); }
962
963
  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); }
963
964
  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; }
964
965
  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); } }
965
966
  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); }); }; }
967
+ 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); }
966
968
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
967
969
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
968
970
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -983,9 +985,11 @@ var LiveSearch = function LiveSearch(props) {
983
985
  exceededSidePosOffset = props.exceededSidePosOffset,
984
986
  appearance = props.appearance,
985
987
  isSearchInput = props.isSearchInput,
988
+ readOnly = props.readOnly,
986
989
  disabled = props.disabled,
987
990
  required = props.required,
988
991
  placeholder = props.placeholder,
992
+ options = props.options,
989
993
  value = props.value,
990
994
  label = props.label,
991
995
  name = props.name,
@@ -1021,14 +1025,18 @@ var LiveSearch = function LiveSearch(props) {
1021
1025
  var inputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1022
1026
  var listRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1023
1027
  var listContentRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
1028
+ var optionsRes = options ? isJSON(options) ? JSON.parse(options) : options : [];
1024
1029
  var windowScrollUpdate = (0,performance.debounce)(handleScrollEvent, 500);
1025
1030
 
1031
+ // return a array of options
1032
+ var staticOptionsData = optionsRes;
1033
+
1026
1034
  //
1027
1035
  var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1028
1036
  _useState2 = _slicedToArray(_useState, 2),
1029
1037
  firstFetch = _useState2[0],
1030
1038
  setFirstFetch = _useState2[1];
1031
- var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
1039
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(staticOptionsData),
1032
1040
  _useState4 = _slicedToArray(_useState3, 2),
1033
1041
  dataInit = _useState4[0],
1034
1042
  setOrginalDataInit = _useState4[1];
@@ -1058,6 +1066,27 @@ var LiveSearch = function LiveSearch(props) {
1058
1066
  handleChange(e);
1059
1067
  }, 350, [dataInit]);
1060
1068
 
1069
+ // Determine whether it is in JSON format
1070
+ function isJSON(str) {
1071
+ if (typeof str === 'string' && str.length > 0) {
1072
+ if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
1073
+ return false;
1074
+ } else {
1075
+ if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
1076
+ return true;
1077
+ } else {
1078
+ return false;
1079
+ }
1080
+ }
1081
+ } else {
1082
+ if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
1083
+ return true;
1084
+ } else {
1085
+ return false;
1086
+ }
1087
+ }
1088
+ }
1089
+
1061
1090
  /**
1062
1091
  * Check if an element is in the viewport
1063
1092
  * @param {HTMLElement} elem
@@ -1260,9 +1289,6 @@ var LiveSearch = function LiveSearch(props) {
1260
1289
  function handleChange(e) {
1261
1290
  var val = e.target.value;
1262
1291
  setChangedVal(val);
1263
-
1264
- // detect string which contains only spaces
1265
- if (!val.replace(/\s/g, '').length === true) return;
1266
1292
  if (INPUT_MATCH_ENABLED) {
1267
1293
  //
1268
1294
  if (!fetchTrigger) {
@@ -1545,7 +1571,7 @@ var LiveSearch = function LiveSearch(props) {
1545
1571
  //--------------
1546
1572
  var listener = /*#__PURE__*/function () {
1547
1573
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
1548
- var res, currentData, options;
1574
+ var res, currentData, _options;
1549
1575
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1550
1576
  while (1) switch (_context.prev = _context.next) {
1551
1577
  case 0:
@@ -1566,13 +1592,13 @@ var LiveSearch = function LiveSearch(props) {
1566
1592
  handleSelect(null, currentData);
1567
1593
 
1568
1594
  //
1569
- options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.no-match)'));
1570
- options.forEach(function (node) {
1595
+ _options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.no-match)'));
1596
+ _options.forEach(function (node) {
1571
1597
  node.classList.remove('active');
1572
1598
  });
1573
1599
 
1574
1600
  //
1575
- onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, options.map(function (node) {
1601
+ onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, _options.map(function (node) {
1576
1602
  return JSON.parse(node.dataset.itemdata);
1577
1603
  }), JSON.parse(currentData));
1578
1604
  }
@@ -1667,6 +1693,7 @@ var LiveSearch = function LiveSearch(props) {
1667
1693
  maxLength: maxLength,
1668
1694
  disabled: disabled,
1669
1695
  required: required,
1696
+ readOnly: readOnly,
1670
1697
  style: style,
1671
1698
  appearance: appearance,
1672
1699
  onChange: function onChange(e) {
@@ -1232,10 +1232,6 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1232
1232
  _useState16 = _slicedToArray(_useState15, 2),
1233
1233
  incomingData = _useState16[0],
1234
1234
  setIncomingData = _useState16[1];
1235
- var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
1236
- _useState18 = _slicedToArray(_useState17, 2),
1237
- firstDataFeched = _useState18[0],
1238
- setFirstDataFeched = _useState18[1];
1239
1235
  var selectedSign = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(false);
1240
1236
  var MULTI_SEL_VALID = multiSelect ? multiSelect.valid : false;
1241
1237
  var MULTI_SEL_LABEL = multiSelect ? multiSelect.selectAllLabel : 'Select all options';
@@ -1244,13 +1240,13 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
1244
1240
  allItemsLabel: 'All Content',
1245
1241
  noneLabel: 'No items selected'
1246
1242
  };
1247
- var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
1243
+ var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
1248
1244
  labels: [],
1249
1245
  values: []
1250
1246
  }),
1251
- _useState20 = _slicedToArray(_useState19, 2),
1252
- controlArr = _useState20[0],
1253
- setControlArr = _useState20[1];
1247
+ _useState18 = _slicedToArray(_useState17, 2),
1248
+ controlArr = _useState18[0],
1249
+ setControlArr = _useState18[1];
1254
1250
  var multiSelControlOptionExist = function multiSelControlOptionExist(arr, val) {
1255
1251
  var _data = arr.filter(Boolean);
1256
1252
  return _data.map(function (v) {
@@ -13,6 +13,7 @@ declare type SearchBarProps = {
13
13
  label?: React.ReactNode | string;
14
14
  name?: string;
15
15
  maxLength?: any;
16
+ readOnly?: any;
16
17
  disabled?: any;
17
18
  required?: any;
18
19
  placeholder?: string;
@@ -96,7 +96,7 @@ __webpack_require__.r(__webpack_exports__);
96
96
  /* harmony export */ });
97
97
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
98
98
  /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
99
- var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
99
+ var _excluded = ["wrapperClassName", "controlClassName", "appearance", "isSearchInput", "readOnly", "disabled", "required", "placeholder", "value", "label", "name", "btnId", "id", "maxLength", "icon", "autoComplete", "style", "tabIndex", "onClick", "onSubmit", "onChange", "onBlur", "onFocus"];
100
100
  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); }
101
101
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
102
102
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -112,6 +112,7 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
112
112
  controlClassName = props.controlClassName,
113
113
  appearance = props.appearance,
114
114
  isSearchInput = props.isSearchInput,
115
+ readOnly = props.readOnly,
115
116
  disabled = props.disabled,
116
117
  required = props.required,
117
118
  placeholder = props.placeholder,
@@ -226,6 +227,7 @@ var SearchBar = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(f
226
227
  onCompositionUpdate: handleComposition,
227
228
  onCompositionEnd: handleComposition,
228
229
  disabled: disabled || null,
230
+ readOnly: readOnly || null,
229
231
  required: required || null,
230
232
  style: style
231
233
  }, attributes)), icon || icon !== '' ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
@@ -9,6 +9,16 @@ import RootPortal from 'funda-root-portal';
9
9
  import SearchBar from 'funda-searchbar';
10
10
 
11
11
 
12
+
13
+ interface OptionConfig {
14
+ disabled?: boolean;
15
+ label: any;
16
+ listItemLabel?: any;
17
+ value: any;
18
+ queryString: string | number;
19
+ }
20
+
21
+
12
22
  type LiveSearchProps = {
13
23
  wrapperClassName?: string;
14
24
  controlClassName?: string;
@@ -19,9 +29,11 @@ type LiveSearchProps = {
19
29
  label?: React.ReactNode | string;
20
30
  name?: string;
21
31
  maxLength?: any;
32
+ readOnly?: any;
22
33
  disabled?: any;
23
34
  required?: any;
24
35
  placeholder?: string;
36
+ options?: OptionConfig[] | string;
25
37
  winWidth?: string | Function;
26
38
  icon?: React.ReactNode | string;
27
39
  btnId?: string;
@@ -57,9 +69,11 @@ const LiveSearch = (props: LiveSearchProps) => {
57
69
  exceededSidePosOffset,
58
70
  appearance,
59
71
  isSearchInput,
72
+ readOnly,
60
73
  disabled,
61
74
  required,
62
75
  placeholder,
76
+ options,
63
77
  value,
64
78
  label,
65
79
  name,
@@ -98,13 +112,15 @@ const LiveSearch = (props: LiveSearchProps) => {
98
112
  const inputRef = useRef<any>(null);
99
113
  const listRef = useRef<any>(null);
100
114
  const listContentRef = useRef<any>(null);
115
+ const optionsRes = options ? (isJSON(options) ? JSON.parse(options as string) : options) : [];
101
116
  const windowScrollUpdate = debounce(handleScrollEvent, 500);
102
117
 
103
-
118
+ // return a array of options
119
+ let staticOptionsData: OptionConfig[] = optionsRes;
104
120
 
105
121
  //
106
122
  const [firstFetch, setFirstFetch] = useState<boolean>(false);
107
- const [dataInit, setOrginalDataInit] = useState<any[]>([]);
123
+ const [dataInit, setOrginalDataInit] = useState<any[]>(staticOptionsData);
108
124
  const [orginalData, setOrginalData] = useState<any[]>([]);
109
125
  const [changedVal, setChangedVal] = useState<string>(value || '');
110
126
  const [isOpen, setIsOpen] = useState<boolean>(false);
@@ -118,7 +134,42 @@ const LiveSearch = (props: LiveSearchProps) => {
118
134
  }, 350, [dataInit]);
119
135
 
120
136
 
137
+ // Determine whether it is in JSON format
138
+ function isJSON(str: any) {
139
+
140
+ if (typeof (str) === 'string' && str.length > 0) {
141
+
142
+ if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
143
+ return false;
144
+ } else {
145
+
146
+ if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').
147
+ replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').
148
+ replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
149
+
150
+ return true;
151
+
152
+ } else {
153
+ return false;
154
+ }
155
+
156
+ }
157
+
158
+ } else {
121
159
 
160
+ if (
161
+ typeof (str) === 'object' &&
162
+ Object.prototype.toString.call(str) === '[object Object]' &&
163
+ !str.length
164
+ ) {
165
+ return true;
166
+ } else {
167
+ return false;
168
+ }
169
+
170
+ }
171
+
172
+ }
122
173
 
123
174
  /**
124
175
  * Check if an element is in the viewport
@@ -352,10 +403,6 @@ const LiveSearch = (props: LiveSearchProps) => {
352
403
 
353
404
  setChangedVal(val);
354
405
 
355
- // detect string which contains only spaces
356
- if (!val.replace(/\s/g, '').length === true) return;
357
-
358
-
359
406
  if (INPUT_MATCH_ENABLED) {
360
407
 
361
408
  //
@@ -472,6 +519,7 @@ const LiveSearch = (props: LiveSearchProps) => {
472
519
 
473
520
  } else {
474
521
  const _curData = typeof el.target !== 'undefined' ? el.target.dataset.itemdata : el.dataset.itemdata;
522
+
475
523
  const _data = JSON.parse(_curData);
476
524
 
477
525
  let res: any = [];
@@ -741,6 +789,7 @@ const LiveSearch = (props: LiveSearchProps) => {
741
789
  maxLength={maxLength}
742
790
  disabled={disabled}
743
791
  required={required}
792
+ readOnly={readOnly}
744
793
  style={style}
745
794
  appearance={appearance}
746
795
  onChange={(e: any) => {
@@ -204,8 +204,6 @@ const MultiFuncSelect = forwardRef((props: MultiFuncSelectProps, ref: any) => {
204
204
  const [controlTempValue, setControlTempValue] = useState<string | null>(null);
205
205
  const [isOpen, setIsOpen] = useState<boolean>(false);
206
206
  const [incomingData, setIncomingData] = useState<string | null | undefined>(null);
207
- const [firstDataFeched, setFirstDataFeched] = useState<boolean>(false);
208
-
209
207
 
210
208
 
211
209
  const selectedSign = useRef<boolean>(false);
@@ -15,6 +15,7 @@ type SearchBarProps = {
15
15
  label?: React.ReactNode | string;
16
16
  name?: string;
17
17
  maxLength?: any;
18
+ readOnly?: any;
18
19
  disabled?: any;
19
20
  required?: any;
20
21
  placeholder?: string;
@@ -39,6 +40,7 @@ const SearchBar = forwardRef((props: SearchBarProps, ref: any) => {
39
40
  controlClassName,
40
41
  appearance,
41
42
  isSearchInput,
43
+ readOnly,
42
44
  disabled,
43
45
  required,
44
46
  placeholder,
@@ -162,6 +164,7 @@ const SearchBar = forwardRef((props: SearchBarProps, ref: any) => {
162
164
  onCompositionUpdate={handleComposition}
163
165
  onCompositionEnd={handleComposition}
164
166
  disabled={disabled || null}
167
+ readOnly={readOnly || null}
165
168
  required={required || null}
166
169
  style={style}
167
170
  {...attributes}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "UIUX Lab",
3
3
  "email": "uiuxlab@gmail.com",
4
4
  "name": "funda-ui",
5
- "version": "2.5.105",
5
+ "version": "2.7.105",
6
6
  "description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
7
7
  "repository": {
8
8
  "type": "git",