funda-ui 1.0.272
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BackToTop/index.css +34 -0
- package/BackToTop/index.d.ts +11 -0
- package/BackToTop/index.js +458 -0
- package/CascadingSelect/index.css +159 -0
- package/CascadingSelect/index.d.ts +56 -0
- package/CascadingSelect/index.js +958 -0
- package/CascadingSelectE2E/index.css +159 -0
- package/CascadingSelectE2E/index.d.ts +60 -0
- package/CascadingSelectE2E/index.js +1126 -0
- package/Checkbox/index.d.ts +30 -0
- package/Checkbox/index.js +226 -0
- package/ColorPicker/index.css +38 -0
- package/ColorPicker/index.d.ts +27 -0
- package/ColorPicker/index.js +246 -0
- package/DigitalClock/index.d.ts +7 -0
- package/DigitalClock/index.js +208 -0
- package/DropdownMenu/index.css +127 -0
- package/DropdownMenu/index.d.ts +37 -0
- package/DropdownMenu/index.js +237 -0
- package/DynamicFields/index.d.ts +26 -0
- package/DynamicFields/index.js +412 -0
- package/File/index.d.ts +36 -0
- package/File/index.js +473 -0
- package/Input/index.d.ts +42 -0
- package/Input/index.js +286 -0
- package/LiveSearch/index.d.ts +37 -0
- package/LiveSearch/index.js +1195 -0
- package/ModalDialog/index.d.ts +60 -0
- package/ModalDialog/index.js +725 -0
- package/ModeSwitch/index.d.ts +17 -0
- package/ModeSwitch/index.js +202 -0
- package/MultiFuncSelect/index.css +178 -0
- package/MultiFuncSelect/index.d.ts +67 -0
- package/MultiFuncSelect/index.js +1826 -0
- package/MultilevelDropdownMenu/index.css +35 -0
- package/MultilevelDropdownMenu/index.d.ts +25 -0
- package/MultilevelDropdownMenu/index.js +464 -0
- package/Pagination/index.d.ts +49 -0
- package/Pagination/index.js +341 -0
- package/README.md +108 -0
- package/Radio/index.d.ts +31 -0
- package/Radio/index.js +246 -0
- package/RangeSlider/index.css +149 -0
- package/RangeSlider/index.d.ts +21 -0
- package/RangeSlider/index.js +730 -0
- package/ScrollReveal/index.css +23 -0
- package/ScrollReveal/index.d.ts +21 -0
- package/ScrollReveal/index.js +216 -0
- package/Scrollbar/index.css +168 -0
- package/Scrollbar/index.d.ts +15 -0
- package/Scrollbar/index.js +605 -0
- package/SearchBar/index.d.ts +32 -0
- package/SearchBar/index.js +246 -0
- package/Select/index.d.ts +34 -0
- package/Select/index.js +331 -0
- package/ShowMoreLess/index.css +23 -0
- package/ShowMoreLess/index.d.ts +30 -0
- package/ShowMoreLess/index.js +202 -0
- package/Switch/index.d.ts +29 -0
- package/Switch/index.js +211 -0
- package/Table/index.css +533 -0
- package/Table/index.d.ts +25 -0
- package/Table/index.js +2113 -0
- package/Tabs/index.d.ts +3 -0
- package/Tabs/index.js +323 -0
- package/TagInput/index.css +90 -0
- package/TagInput/index.d.ts +28 -0
- package/TagInput/index.js +370 -0
- package/Textarea/index.d.ts +30 -0
- package/Textarea/index.js +242 -0
- package/Toast/index.css +95 -0
- package/Toast/index.d.ts +35 -0
- package/Toast/index.js +340 -0
- package/Tooltip/index.css +240 -0
- package/Tooltip/index.d.ts +19 -0
- package/Tooltip/index.js +200 -0
- package/Tree/index.css +225 -0
- package/Tree/index.d.ts +37 -0
- package/Tree/index.js +1406 -0
- package/all.d.ts +33 -0
- package/all.js +35 -0
- package/lib/cjs/BackToTop/index.d.ts +11 -0
- package/lib/cjs/BackToTop/index.js +458 -0
- package/lib/cjs/CascadingSelect/index.d.ts +56 -0
- package/lib/cjs/CascadingSelect/index.js +958 -0
- package/lib/cjs/CascadingSelectE2E/index.d.ts +60 -0
- package/lib/cjs/CascadingSelectE2E/index.js +1126 -0
- package/lib/cjs/Checkbox/index.d.ts +30 -0
- package/lib/cjs/Checkbox/index.js +226 -0
- package/lib/cjs/ColorPicker/index.d.ts +27 -0
- package/lib/cjs/ColorPicker/index.js +246 -0
- package/lib/cjs/DigitalClock/index.d.ts +7 -0
- package/lib/cjs/DigitalClock/index.js +208 -0
- package/lib/cjs/DropdownMenu/index.d.ts +37 -0
- package/lib/cjs/DropdownMenu/index.js +237 -0
- package/lib/cjs/DynamicFields/index.d.ts +26 -0
- package/lib/cjs/DynamicFields/index.js +412 -0
- package/lib/cjs/File/index.d.ts +36 -0
- package/lib/cjs/File/index.js +473 -0
- package/lib/cjs/Input/index.d.ts +42 -0
- package/lib/cjs/Input/index.js +286 -0
- package/lib/cjs/LiveSearch/index.d.ts +37 -0
- package/lib/cjs/LiveSearch/index.js +1195 -0
- package/lib/cjs/ModalDialog/index.d.ts +60 -0
- package/lib/cjs/ModalDialog/index.js +725 -0
- package/lib/cjs/ModeSwitch/index.d.ts +17 -0
- package/lib/cjs/ModeSwitch/index.js +202 -0
- package/lib/cjs/MultiFuncSelect/index.d.ts +67 -0
- package/lib/cjs/MultiFuncSelect/index.js +1826 -0
- package/lib/cjs/MultilevelDropdownMenu/index.d.ts +25 -0
- package/lib/cjs/MultilevelDropdownMenu/index.js +464 -0
- package/lib/cjs/Pagination/index.d.ts +49 -0
- package/lib/cjs/Pagination/index.js +341 -0
- package/lib/cjs/Radio/index.d.ts +31 -0
- package/lib/cjs/Radio/index.js +246 -0
- package/lib/cjs/RangeSlider/index.d.ts +21 -0
- package/lib/cjs/RangeSlider/index.js +730 -0
- package/lib/cjs/ScrollReveal/index.d.ts +21 -0
- package/lib/cjs/ScrollReveal/index.js +216 -0
- package/lib/cjs/Scrollbar/index.d.ts +15 -0
- package/lib/cjs/Scrollbar/index.js +605 -0
- package/lib/cjs/SearchBar/index.d.ts +32 -0
- package/lib/cjs/SearchBar/index.js +246 -0
- package/lib/cjs/Select/index.d.ts +34 -0
- package/lib/cjs/Select/index.js +331 -0
- package/lib/cjs/ShowMoreLess/index.d.ts +30 -0
- package/lib/cjs/ShowMoreLess/index.js +202 -0
- package/lib/cjs/Switch/index.d.ts +29 -0
- package/lib/cjs/Switch/index.js +211 -0
- package/lib/cjs/Table/index.d.ts +25 -0
- package/lib/cjs/Table/index.js +2113 -0
- package/lib/cjs/Tabs/index.d.ts +3 -0
- package/lib/cjs/Tabs/index.js +323 -0
- package/lib/cjs/TagInput/index.d.ts +28 -0
- package/lib/cjs/TagInput/index.js +370 -0
- package/lib/cjs/Textarea/index.d.ts +30 -0
- package/lib/cjs/Textarea/index.js +242 -0
- package/lib/cjs/Toast/index.d.ts +35 -0
- package/lib/cjs/Toast/index.js +340 -0
- package/lib/cjs/Tooltip/index.d.ts +19 -0
- package/lib/cjs/Tooltip/index.js +200 -0
- package/lib/cjs/Tree/index.d.ts +37 -0
- package/lib/cjs/Tree/index.js +1406 -0
- package/lib/cjs/index.d.ts +33 -0
- package/lib/cjs/index.js +35 -0
- package/lib/css/BackToTop/index.css +34 -0
- package/lib/css/CascadingSelect/index.css +159 -0
- package/lib/css/CascadingSelectE2E/index.css +159 -0
- package/lib/css/ColorPicker/index.css +38 -0
- package/lib/css/DropdownMenu/index.css +127 -0
- package/lib/css/MultiFuncSelect/index.css +178 -0
- package/lib/css/MultilevelDropdownMenu/index.css +35 -0
- package/lib/css/RangeSlider/index.css +149 -0
- package/lib/css/ScrollReveal/index.css +23 -0
- package/lib/css/Scrollbar/index.css +168 -0
- package/lib/css/ShowMoreLess/index.css +23 -0
- package/lib/css/Table/index.css +533 -0
- package/lib/css/TagInput/index.css +90 -0
- package/lib/css/Toast/index.css +95 -0
- package/lib/css/Tooltip/index.css +240 -0
- package/lib/css/Tree/index.css +225 -0
- package/lib/esm/BackToTop/index.scss +47 -0
- package/lib/esm/BackToTop/index.tsx +182 -0
- package/lib/esm/BackToTop/utils/easing.js +200 -0
- package/lib/esm/BackToTop/utils/performance.js +52 -0
- package/lib/esm/CascadingSelect/Group.tsx +39 -0
- package/lib/esm/CascadingSelect/index.scss +214 -0
- package/lib/esm/CascadingSelect/index.tsx +922 -0
- package/lib/esm/CascadingSelect/utils/performance.js +52 -0
- package/lib/esm/CascadingSelectE2E/Group.tsx +39 -0
- package/lib/esm/CascadingSelectE2E/index.scss +214 -0
- package/lib/esm/CascadingSelectE2E/index.tsx +1091 -0
- package/lib/esm/CascadingSelectE2E/utils/performance.js +52 -0
- package/lib/esm/Checkbox/index.tsx +160 -0
- package/lib/esm/ColorPicker/index.scss +48 -0
- package/lib/esm/ColorPicker/index.tsx +187 -0
- package/lib/esm/DigitalClock/index.tsx +72 -0
- package/lib/esm/DigitalClock/utils/useInterval.js +43 -0
- package/lib/esm/DropdownMenu/Option.tsx +27 -0
- package/lib/esm/DropdownMenu/index.scss +180 -0
- package/lib/esm/DropdownMenu/index.tsx +148 -0
- package/lib/esm/DynamicFields/index.tsx +386 -0
- package/lib/esm/File/index.tsx +302 -0
- package/lib/esm/Input/index.tsx +233 -0
- package/lib/esm/LiveSearch/index.tsx +582 -0
- package/lib/esm/LiveSearch/utils/performance.js +52 -0
- package/lib/esm/LiveSearch/utils/useThrottle.js +36 -0
- package/lib/esm/ModalDialog/index.tsx +479 -0
- package/lib/esm/ModalDialog/plugins/BSL/bodyScrollLock.es6.js +262 -0
- package/lib/esm/ModalDialog/plugins/BSL/index.ts +2 -0
- package/lib/esm/ModeSwitch/index.tsx +82 -0
- package/lib/esm/MultiFuncSelect/index.scss +269 -0
- package/lib/esm/MultiFuncSelect/index.tsx +1597 -0
- package/lib/esm/MultiFuncSelect/utils/performance.js +52 -0
- package/lib/esm/MultiFuncSelect/utils/tree.js +103 -0
- package/lib/esm/MultiFuncSelect/utils/useThrottle.js +36 -0
- package/lib/esm/MultilevelDropdownMenu/MenuList.tsx +230 -0
- package/lib/esm/MultilevelDropdownMenu/index.scss +75 -0
- package/lib/esm/MultilevelDropdownMenu/index.tsx +71 -0
- package/lib/esm/MultilevelDropdownMenu/utils/dom.js +81 -0
- package/lib/esm/Pagination/index.tsx +230 -0
- package/lib/esm/Pagination/pagination-navigators.tsx +60 -0
- package/lib/esm/Radio/index.tsx +201 -0
- package/lib/esm/RangeSlider/index.scss +184 -0
- package/lib/esm/RangeSlider/index.tsx +223 -0
- package/lib/esm/ScrollReveal/index.scss +27 -0
- package/lib/esm/ScrollReveal/index.tsx +146 -0
- package/lib/esm/Scrollbar/index.scss +217 -0
- package/lib/esm/Scrollbar/index.tsx +497 -0
- package/lib/esm/Scrollbar/utils/performance.js +52 -0
- package/lib/esm/SearchBar/index.tsx +181 -0
- package/lib/esm/Select/index.tsx +276 -0
- package/lib/esm/ShowMoreLess/index.scss +27 -0
- package/lib/esm/ShowMoreLess/index.tsx +144 -0
- package/lib/esm/Switch/index.tsx +143 -0
- package/lib/esm/Table/TableColgroup.tsx +29 -0
- package/lib/esm/Table/TableField.tsx +40 -0
- package/lib/esm/Table/TableFieldRow.tsx +212 -0
- package/lib/esm/Table/TableHeaders.tsx +146 -0
- package/lib/esm/Table/TableRow.tsx +127 -0
- package/lib/esm/Table/TableSummaries.tsx +36 -0
- package/lib/esm/Table/index.scss +364 -0
- package/lib/esm/Table/index.tsx +576 -0
- package/lib/esm/Table/table-utils.ts +65 -0
- package/lib/esm/Table/utils/dom.js +81 -0
- package/lib/esm/Table/utils/performance.js +52 -0
- package/lib/esm/Tabs/TabList.tsx +42 -0
- package/lib/esm/Tabs/TabPanel.tsx +34 -0
- package/lib/esm/Tabs/Tabs.tsx +232 -0
- package/lib/esm/Tabs/index.tsx +3 -0
- package/lib/esm/TagInput/index.scss +125 -0
- package/lib/esm/TagInput/index.tsx +314 -0
- package/lib/esm/Textarea/index.tsx +178 -0
- package/lib/esm/Toast/Item.tsx +75 -0
- package/lib/esm/Toast/index.scss +120 -0
- package/lib/esm/Toast/index.tsx +249 -0
- package/lib/esm/Tooltip/index.scss +327 -0
- package/lib/esm/Tooltip/index.tsx +142 -0
- package/lib/esm/Tree/TreeList.tsx +503 -0
- package/lib/esm/Tree/index.scss +375 -0
- package/lib/esm/Tree/index.tsx +301 -0
- package/lib/esm/Tree/init-height.tsx +27 -0
- package/lib/esm/Tree/utils/convert-tree.js +29 -0
- package/lib/esm/Tree/utils/dom.js +81 -0
- package/lib/esm/index.js +31 -0
- package/package.json +40 -0
|
@@ -0,0 +1,1826 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory(require("react"));
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define(["react"], factory);
|
|
6
|
+
else if(typeof exports === 'object')
|
|
7
|
+
exports["RPB"] = factory(require("react"));
|
|
8
|
+
else
|
|
9
|
+
root["RPB"] = factory(root["React"]);
|
|
10
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__787__) => {
|
|
11
|
+
return /******/ (() => { // webpackBootstrap
|
|
12
|
+
/******/ var __webpack_modules__ = ({
|
|
13
|
+
|
|
14
|
+
/***/ 342:
|
|
15
|
+
/***/ ((module) => {
|
|
16
|
+
|
|
17
|
+
/*
|
|
18
|
+
* Debounce
|
|
19
|
+
*
|
|
20
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
21
|
+
* @param {Number} limit - Waiting time.
|
|
22
|
+
* @return {Function} - Returns a new function.
|
|
23
|
+
*/
|
|
24
|
+
function debounce(fn) {
|
|
25
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
26
|
+
var timer;
|
|
27
|
+
return function () {
|
|
28
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
29
|
+
clearTimeout(timer);
|
|
30
|
+
|
|
31
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
32
|
+
// Execute fn after another delay milliseconds
|
|
33
|
+
timer = setTimeout(function () {
|
|
34
|
+
fn.apply(this, arguments);
|
|
35
|
+
}, limit);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/*
|
|
40
|
+
* Throttle
|
|
41
|
+
*
|
|
42
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
43
|
+
* @param {Number} limit - Waiting time.
|
|
44
|
+
* @return {Function} - Returns a new function.
|
|
45
|
+
*/
|
|
46
|
+
function throttle(fn) {
|
|
47
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
48
|
+
var waiting = false;
|
|
49
|
+
return function () {
|
|
50
|
+
if (!waiting) {
|
|
51
|
+
fn.apply(this, arguments);
|
|
52
|
+
waiting = true;
|
|
53
|
+
setTimeout(function () {
|
|
54
|
+
waiting = false;
|
|
55
|
+
}, limit);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
module.exports = {
|
|
60
|
+
debounce: debounce,
|
|
61
|
+
throttle: throttle
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/***/ }),
|
|
65
|
+
|
|
66
|
+
/***/ 602:
|
|
67
|
+
/***/ ((module) => {
|
|
68
|
+
|
|
69
|
+
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); }
|
|
70
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
71
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
72
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
73
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
74
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
75
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
76
|
+
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."); }
|
|
77
|
+
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); }
|
|
78
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
79
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
80
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
81
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
|
82
|
+
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); }
|
|
83
|
+
/**
|
|
84
|
+
* Convert Tree
|
|
85
|
+
* @param {Array} arr - Flat array
|
|
86
|
+
* @param {?String | ?Number} parentId - Parent id
|
|
87
|
+
* @param {?String} keyId - Key value of id.
|
|
88
|
+
* @param {?String} keyParentId - Key value of parent id.
|
|
89
|
+
* @returns Array
|
|
90
|
+
*/
|
|
91
|
+
function convertTree(arr) {
|
|
92
|
+
var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
93
|
+
var keyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
94
|
+
var keyParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'parent_id';
|
|
95
|
+
if (!parentId) {
|
|
96
|
+
// If there is no parent id (when recursing for the first time), all parents will be queried
|
|
97
|
+
return arr.filter(function (item) {
|
|
98
|
+
return !item[keyParentId];
|
|
99
|
+
}).map(function (item) {
|
|
100
|
+
// Query all child nodes by parent node ID
|
|
101
|
+
item.children = convertTree(arr, item[keyId], keyId, keyParentId);
|
|
102
|
+
return item;
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
return arr.filter(function (item) {
|
|
106
|
+
return item[keyParentId] === parentId;
|
|
107
|
+
}).map(function (item) {
|
|
108
|
+
// Query all child nodes by parent node ID
|
|
109
|
+
item.children = convertTree(arr, item[keyId], keyId, keyParentId);
|
|
110
|
+
return item;
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Flat tree
|
|
117
|
+
* @param {Array} arr - Hierarchical array
|
|
118
|
+
* @returns Array
|
|
119
|
+
*/
|
|
120
|
+
function flatTree(arr) {
|
|
121
|
+
var flatData = function flatData(_ref) {
|
|
122
|
+
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
123
|
+
var _rest$children = rest.children,
|
|
124
|
+
children = _rest$children === void 0 ? [] : _rest$children;
|
|
125
|
+
return [_objectSpread({}, rest)].concat(_toConsumableArray(children.flatMap(flatData)));
|
|
126
|
+
};
|
|
127
|
+
var result = arr.flatMap(flatData);
|
|
128
|
+
|
|
129
|
+
//remove children from item
|
|
130
|
+
result = result.map(function (item) {
|
|
131
|
+
delete item.children;
|
|
132
|
+
return item;
|
|
133
|
+
});
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Add depth to each item in the tree
|
|
139
|
+
* @param {Array} arr - Hierarchical array
|
|
140
|
+
* @param {?String | ?Number} parentId - Parent id
|
|
141
|
+
* @param {?String} keyId - Key value of id.
|
|
142
|
+
* @param {?String} keyParentId - Key value of parent id.
|
|
143
|
+
* @param {?Number} depth - Depth of the item.
|
|
144
|
+
* @returns
|
|
145
|
+
*/
|
|
146
|
+
function addTreeDepth(arr) {
|
|
147
|
+
var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
148
|
+
var keyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
149
|
+
var keyParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'parent_id';
|
|
150
|
+
var depth = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
151
|
+
arr.forEach(function (item) {
|
|
152
|
+
item.depth = depth;
|
|
153
|
+
// Query all child nodes by parent node ID
|
|
154
|
+
if (item.children && item.children.length > 0) {
|
|
155
|
+
addTreeDepth(item.children, item[keyId], keyId, keyParentId, ++depth);
|
|
156
|
+
} else {
|
|
157
|
+
depth = 0;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Add indent placeholder
|
|
164
|
+
* @param {Array} arr - Flat array
|
|
165
|
+
* @param {?String} placeholder - String of placeholder
|
|
166
|
+
* @param {?String} lastPlaceholder - Last String of placeholder
|
|
167
|
+
* @param {?String} keyName - Key value of name.
|
|
168
|
+
* @returns Array
|
|
169
|
+
*/
|
|
170
|
+
function addTreeIndent(arr) {
|
|
171
|
+
var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
|
|
172
|
+
var lastPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
173
|
+
var keyName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
|
|
174
|
+
arr.forEach(function (item) {
|
|
175
|
+
var indent = '';
|
|
176
|
+
if (item.depth) {
|
|
177
|
+
Array(item.depth).fill(0).forEach(function (k, i) {
|
|
178
|
+
indent += placeholder;
|
|
179
|
+
if (i === item.depth - 1) {
|
|
180
|
+
item[keyName] = indent + lastPlaceholder + item[keyName];
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
module.exports = {
|
|
187
|
+
convertTree: convertTree,
|
|
188
|
+
flatTree: flatTree,
|
|
189
|
+
addTreeDepth: addTreeDepth,
|
|
190
|
+
addTreeIndent: addTreeIndent
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
/***/ }),
|
|
194
|
+
|
|
195
|
+
/***/ 787:
|
|
196
|
+
/***/ ((module) => {
|
|
197
|
+
|
|
198
|
+
"use strict";
|
|
199
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
200
|
+
|
|
201
|
+
/***/ })
|
|
202
|
+
|
|
203
|
+
/******/ });
|
|
204
|
+
/************************************************************************/
|
|
205
|
+
/******/ // The module cache
|
|
206
|
+
/******/ var __webpack_module_cache__ = {};
|
|
207
|
+
/******/
|
|
208
|
+
/******/ // The require function
|
|
209
|
+
/******/ function __webpack_require__(moduleId) {
|
|
210
|
+
/******/ // Check if module is in cache
|
|
211
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
212
|
+
/******/ if (cachedModule !== undefined) {
|
|
213
|
+
/******/ return cachedModule.exports;
|
|
214
|
+
/******/ }
|
|
215
|
+
/******/ // Create a new module (and put it into the cache)
|
|
216
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
217
|
+
/******/ // no module.id needed
|
|
218
|
+
/******/ // no module.loaded needed
|
|
219
|
+
/******/ exports: {}
|
|
220
|
+
/******/ };
|
|
221
|
+
/******/
|
|
222
|
+
/******/ // Execute the module function
|
|
223
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
224
|
+
/******/
|
|
225
|
+
/******/ // Return the exports of the module
|
|
226
|
+
/******/ return module.exports;
|
|
227
|
+
/******/ }
|
|
228
|
+
/******/
|
|
229
|
+
/************************************************************************/
|
|
230
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
231
|
+
/******/ (() => {
|
|
232
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
233
|
+
/******/ __webpack_require__.n = (module) => {
|
|
234
|
+
/******/ var getter = module && module.__esModule ?
|
|
235
|
+
/******/ () => (module['default']) :
|
|
236
|
+
/******/ () => (module);
|
|
237
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
238
|
+
/******/ return getter;
|
|
239
|
+
/******/ };
|
|
240
|
+
/******/ })();
|
|
241
|
+
/******/
|
|
242
|
+
/******/ /* webpack/runtime/define property getters */
|
|
243
|
+
/******/ (() => {
|
|
244
|
+
/******/ // define getter functions for harmony exports
|
|
245
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
246
|
+
/******/ for(var key in definition) {
|
|
247
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
248
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
249
|
+
/******/ }
|
|
250
|
+
/******/ }
|
|
251
|
+
/******/ };
|
|
252
|
+
/******/ })();
|
|
253
|
+
/******/
|
|
254
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
255
|
+
/******/ (() => {
|
|
256
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
257
|
+
/******/ })();
|
|
258
|
+
/******/
|
|
259
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
260
|
+
/******/ (() => {
|
|
261
|
+
/******/ // define __esModule on exports
|
|
262
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
263
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
264
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
265
|
+
/******/ }
|
|
266
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
267
|
+
/******/ };
|
|
268
|
+
/******/ })();
|
|
269
|
+
/******/
|
|
270
|
+
/************************************************************************/
|
|
271
|
+
var __webpack_exports__ = {};
|
|
272
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
273
|
+
(() => {
|
|
274
|
+
"use strict";
|
|
275
|
+
// ESM COMPAT FLAG
|
|
276
|
+
__webpack_require__.r(__webpack_exports__);
|
|
277
|
+
|
|
278
|
+
// EXPORTS
|
|
279
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
280
|
+
"default": () => (/* binding */ src)
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
284
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
|
|
285
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
286
|
+
// EXTERNAL MODULE: ./src/utils/performance.js
|
|
287
|
+
var performance = __webpack_require__(342);
|
|
288
|
+
;// CONCATENATED MODULE: ./src/utils/useThrottle.js
|
|
289
|
+
/**
|
|
290
|
+
* Limiting the rate of execution
|
|
291
|
+
*
|
|
292
|
+
* @usage:
|
|
293
|
+
|
|
294
|
+
const App = () => {
|
|
295
|
+
const [count, setCount] = useState(0);
|
|
296
|
+
const handleClick = useThrottle(() => setCount(count + 1), 500, [count]);
|
|
297
|
+
|
|
298
|
+
return (
|
|
299
|
+
<div className="app">
|
|
300
|
+
<button onClick={handleClick}>click</button>
|
|
301
|
+
<p>click {count} time</p>
|
|
302
|
+
</div>
|
|
303
|
+
);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
*/
|
|
307
|
+
|
|
308
|
+
var useThrottle = function useThrottle(fn, delay, dependence) {
|
|
309
|
+
var ref = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
|
|
310
|
+
lastTime: 0
|
|
311
|
+
});
|
|
312
|
+
return (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
313
|
+
var now = Date.now();
|
|
314
|
+
if (now - ref.current.lastTime >= delay) {
|
|
315
|
+
fn.apply(void 0, arguments);
|
|
316
|
+
ref.current.lastTime = now;
|
|
317
|
+
}
|
|
318
|
+
}, dependence);
|
|
319
|
+
};
|
|
320
|
+
/* harmony default export */ const utils_useThrottle = (useThrottle);
|
|
321
|
+
// EXTERNAL MODULE: ./src/utils/tree.js
|
|
322
|
+
var tree = __webpack_require__(602);
|
|
323
|
+
;// CONCATENATED MODULE: ./src/index.tsx
|
|
324
|
+
var _excluded = ["wrapperClassName", "controlClassName", "multiSelect", "disabled", "required", "value", "label", "name", "readOnly", "placeholder", "id", "options", "hierarchical", "indentation", "doubleIndent", "style", "depth", "controlArrow", "winWidth", "tabIndex", "fetchTrigger", "fetchTriggerForDefaultData", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "data", "fetchCallback", "onFetch", "onLoad", "onSelect", "onChange", "onBlur", "onFocus"];
|
|
325
|
+
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); }
|
|
326
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
327
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
328
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
329
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
330
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
331
|
+
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; }
|
|
332
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
333
|
+
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."); }
|
|
334
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
335
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
336
|
+
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); } }
|
|
337
|
+
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); }); }; }
|
|
338
|
+
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); }
|
|
339
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
340
|
+
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."); }
|
|
341
|
+
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); }
|
|
342
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
343
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
344
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
345
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
346
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, _ref2) {
|
|
352
|
+
var wrapperClassName = props.wrapperClassName,
|
|
353
|
+
controlClassName = props.controlClassName,
|
|
354
|
+
multiSelect = props.multiSelect,
|
|
355
|
+
disabled = props.disabled,
|
|
356
|
+
required = props.required,
|
|
357
|
+
value = props.value,
|
|
358
|
+
label = props.label,
|
|
359
|
+
name = props.name,
|
|
360
|
+
readOnly = props.readOnly,
|
|
361
|
+
placeholder = props.placeholder,
|
|
362
|
+
id = props.id,
|
|
363
|
+
options = props.options,
|
|
364
|
+
hierarchical = props.hierarchical,
|
|
365
|
+
indentation = props.indentation,
|
|
366
|
+
doubleIndent = props.doubleIndent,
|
|
367
|
+
style = props.style,
|
|
368
|
+
depth = props.depth,
|
|
369
|
+
controlArrow = props.controlArrow,
|
|
370
|
+
winWidth = props.winWidth,
|
|
371
|
+
tabIndex = props.tabIndex,
|
|
372
|
+
fetchTrigger = props.fetchTrigger,
|
|
373
|
+
fetchTriggerForDefaultData = props.fetchTriggerForDefaultData,
|
|
374
|
+
fetchNoneInfo = props.fetchNoneInfo,
|
|
375
|
+
fetchUpdate = props.fetchUpdate,
|
|
376
|
+
fetchFuncAsync = props.fetchFuncAsync,
|
|
377
|
+
fetchFuncMethod = props.fetchFuncMethod,
|
|
378
|
+
fetchFuncMethodParams = props.fetchFuncMethodParams,
|
|
379
|
+
data = props.data,
|
|
380
|
+
fetchCallback = props.fetchCallback,
|
|
381
|
+
onFetch = props.onFetch,
|
|
382
|
+
onLoad = props.onLoad,
|
|
383
|
+
onSelect = props.onSelect,
|
|
384
|
+
onChange = props.onChange,
|
|
385
|
+
onBlur = props.onBlur,
|
|
386
|
+
onFocus = props.onFocus,
|
|
387
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
388
|
+
var WIN_WIDTH = typeof winWidth === 'function' ? winWidth() : winWidth ? winWidth : 'auto';
|
|
389
|
+
var INDENT_PLACEHOLDER = doubleIndent ? " " : " ";
|
|
390
|
+
var INDENT_LAST_PLACEHOLDER = "".concat(typeof indentation !== 'undefined' && indentation !== '' ? "".concat(indentation, " ") : '');
|
|
391
|
+
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)().replace(/\:/g, "-");
|
|
392
|
+
var idRes = id || uniqueID;
|
|
393
|
+
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
394
|
+
var rootSingleRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
395
|
+
var rootMultiRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
396
|
+
var selectInputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
397
|
+
var valueInputRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
398
|
+
var listRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
399
|
+
var listContentRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
400
|
+
var optionsRes = options ? isJSON(options) ? JSON.parse(options) : options : [];
|
|
401
|
+
var windowScrollUpdate = (0,performance.debounce)(handleScrollEvent, 500);
|
|
402
|
+
|
|
403
|
+
// return a array of options
|
|
404
|
+
var optionsDataInit = optionsRes;
|
|
405
|
+
|
|
406
|
+
//
|
|
407
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(optionsDataInit),
|
|
408
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
409
|
+
orginalData = _useState2[0],
|
|
410
|
+
setOrginalData = _useState2[1];
|
|
411
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(optionsDataInit),
|
|
412
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
413
|
+
optionsData = _useState4[0],
|
|
414
|
+
setOptionsData = _useState4[1];
|
|
415
|
+
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
416
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
417
|
+
hasErr = _useState6[0],
|
|
418
|
+
setHasErr = _useState6[1];
|
|
419
|
+
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
420
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
421
|
+
controlLabel = _useState8[0],
|
|
422
|
+
setControlLabel = _useState8[1];
|
|
423
|
+
var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(''),
|
|
424
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
425
|
+
controlValue = _useState10[0],
|
|
426
|
+
setControlValue = _useState10[1];
|
|
427
|
+
var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
428
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
429
|
+
controlTempValue = _useState12[0],
|
|
430
|
+
setControlTempValue = _useState12[1];
|
|
431
|
+
var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
432
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
433
|
+
isOpen = _useState14[0],
|
|
434
|
+
setIsOpen = _useState14[1];
|
|
435
|
+
var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
436
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
437
|
+
listContentHeight = _useState16[0],
|
|
438
|
+
setListContentHeight = _useState16[1];
|
|
439
|
+
var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
440
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
441
|
+
incomingData = _useState18[0],
|
|
442
|
+
setIncomingData = _useState18[1];
|
|
443
|
+
|
|
444
|
+
// Multiple selection
|
|
445
|
+
var MULTI_SEL_VALID = multiSelect ? multiSelect.valid : false;
|
|
446
|
+
var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
|
|
447
|
+
labels: [],
|
|
448
|
+
values: []
|
|
449
|
+
}),
|
|
450
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
451
|
+
controlArr = _useState20[0],
|
|
452
|
+
setControlArr = _useState20[1];
|
|
453
|
+
var _useState21 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
454
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
455
|
+
itemSelectedAll = _useState22[0],
|
|
456
|
+
setItemSelectedAll = _useState22[1];
|
|
457
|
+
var multiSelControlOptionExist = function multiSelControlOptionExist(arr, val) {
|
|
458
|
+
return arr.map(function (v) {
|
|
459
|
+
return v.toString();
|
|
460
|
+
}).includes(val.toString());
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
//performance
|
|
464
|
+
var handleChangeFetchSafe = utils_useThrottle(function (val) {
|
|
465
|
+
var _orginalData = [];
|
|
466
|
+
var update = function update(inputData) {
|
|
467
|
+
var filterRes = function filterRes(data) {
|
|
468
|
+
return inputData.filter(function (item) {
|
|
469
|
+
if ((item.queryString.split(',').some(function (l) {
|
|
470
|
+
return l.charAt(0) === val.toLowerCase();
|
|
471
|
+
}) || item.queryString.split(',').some(function (l) {
|
|
472
|
+
return l.replace(/ /g, '').indexOf(val.toLowerCase()) >= 0;
|
|
473
|
+
}) || item.label.toLowerCase().indexOf(val.toLowerCase()) >= 0) && val != '') {
|
|
474
|
+
return true;
|
|
475
|
+
} else {
|
|
476
|
+
return false;
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
};
|
|
480
|
+
setOptionsData(filterRes);
|
|
481
|
+
};
|
|
482
|
+
if (fetchUpdate) {
|
|
483
|
+
handleFetch(val).then(function (response) {
|
|
484
|
+
_orginalData = response;
|
|
485
|
+
update(_orginalData);
|
|
486
|
+
});
|
|
487
|
+
} else {
|
|
488
|
+
_orginalData = orginalData;
|
|
489
|
+
update(_orginalData);
|
|
490
|
+
}
|
|
491
|
+
}, 150, [optionsData]);
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Format indent value
|
|
495
|
+
* @param {String|Array} str
|
|
496
|
+
* @returns {String|Array}
|
|
497
|
+
*/
|
|
498
|
+
function formatIndentVal(str) {
|
|
499
|
+
var reVar = new RegExp(INDENT_LAST_PLACEHOLDER, 'g');
|
|
500
|
+
if (Array.isArray(str)) {
|
|
501
|
+
return str.map(function (s) {
|
|
502
|
+
return s.replace(reVar, '').replace(/\ /ig, '');
|
|
503
|
+
});
|
|
504
|
+
} else {
|
|
505
|
+
return str.replace(reVar, '').replace(/\ /ig, '');
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Array unique
|
|
511
|
+
* @param {Array} str
|
|
512
|
+
* @returns {Array}
|
|
513
|
+
*/
|
|
514
|
+
function unique(arr) {
|
|
515
|
+
return Array.from(new Set(arr));
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Remove html tag content
|
|
520
|
+
* @param {string} str
|
|
521
|
+
* @returns {string}
|
|
522
|
+
*/
|
|
523
|
+
function stripHTML(str) {
|
|
524
|
+
return str.replace(/<\/?[^>]+(>|$)(.*?)<\/?[^>]+(>|$)/ig, '');
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Remove a specific item from an array
|
|
529
|
+
* @param {array} arr
|
|
530
|
+
* @param {string} value
|
|
531
|
+
* @returns {array}
|
|
532
|
+
*/
|
|
533
|
+
function removeItemOnce(arr, value) {
|
|
534
|
+
var arrFormat = arr.map(function (v) {
|
|
535
|
+
return v.toString();
|
|
536
|
+
});
|
|
537
|
+
var index = arrFormat.indexOf(value.toString());
|
|
538
|
+
if (index > -1) {
|
|
539
|
+
arrFormat.splice(index, 1);
|
|
540
|
+
}
|
|
541
|
+
return arrFormat;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Remove multiple items from an array
|
|
546
|
+
* @param {array} arr
|
|
547
|
+
* @param {array} value
|
|
548
|
+
* @returns {array}
|
|
549
|
+
*/
|
|
550
|
+
function removeItems(arr, value) {
|
|
551
|
+
var arrFormat = arr.map(function (v) {
|
|
552
|
+
return v.toString();
|
|
553
|
+
});
|
|
554
|
+
var valueFormat = value.map(function (v) {
|
|
555
|
+
return v.toString();
|
|
556
|
+
});
|
|
557
|
+
return arrFormat.filter(function (v) {
|
|
558
|
+
return !valueFormat.includes(v);
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Check if an element is in the viewport
|
|
564
|
+
* @param {HTMLElement} elem
|
|
565
|
+
* @returns {boolean}
|
|
566
|
+
*/
|
|
567
|
+
function isInViewport(elem) {
|
|
568
|
+
var bounding = elem.getBoundingClientRect();
|
|
569
|
+
return bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
570
|
+
}
|
|
571
|
+
function handleScrollEvent() {
|
|
572
|
+
getPlacement(listRef.current, true);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
//
|
|
576
|
+
function getPlacement(el) {
|
|
577
|
+
var restorePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
578
|
+
if (el === null) return;
|
|
579
|
+
var PLACEMENT_TOP = 'top-0';
|
|
580
|
+
var PLACEMENT_BOTTOMEND = 'bottom-0';
|
|
581
|
+
var PLACEMENT_RIGHT = 'end-0';
|
|
582
|
+
var PLACEMENT_LEFT = 'start-0';
|
|
583
|
+
var elTop = el.getBoundingClientRect().top;
|
|
584
|
+
var elSpacing = 50 + selectInputRef.current.clientHeight * 3;
|
|
585
|
+
var elMinWindowSpacing = selectInputRef.current.clientHeight * 2;
|
|
586
|
+
|
|
587
|
+
//restore position
|
|
588
|
+
if (restorePos) {
|
|
589
|
+
if (isInViewport(el)) {
|
|
590
|
+
el.classList.remove(PLACEMENT_BOTTOMEND);
|
|
591
|
+
el.style.removeProperty('bottom');
|
|
592
|
+
}
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
if (listContentRef.current === null) return;
|
|
596
|
+
|
|
597
|
+
// STEP 0:
|
|
598
|
+
// save content height (Suitable for initial data with unchanged open options)
|
|
599
|
+
var _contentHeight = el.offsetHeight;
|
|
600
|
+
if (listContentHeight === 0) {
|
|
601
|
+
setListContentHeight(el.offsetHeight);
|
|
602
|
+
} else {
|
|
603
|
+
_contentHeight = listContentHeight;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// STEP 1:
|
|
607
|
+
// If the content exceeds the height of the window, first limit height and add scrollbar
|
|
608
|
+
var maxHeight = window.innerHeight - elSpacing;
|
|
609
|
+
if (maxHeight < selectInputRef.current.clientHeight) maxHeight = elMinWindowSpacing;
|
|
610
|
+
if (_contentHeight > 0 && _contentHeight > maxHeight) {
|
|
611
|
+
var newH = maxHeight - (elTop > window.innerHeight / 2 ? 0 : elTop) + elMinWindowSpacing;
|
|
612
|
+
|
|
613
|
+
// default position
|
|
614
|
+
listContentRef.current.style.height = newH + 'px';
|
|
615
|
+
|
|
616
|
+
// if it's on top
|
|
617
|
+
if (newH > maxHeight) {
|
|
618
|
+
listContentRef.current.style.height = elTop - elMinWindowSpacing + 'px';
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// Adjust the overall height to fit the wrapper
|
|
622
|
+
var _displayedItems = listContentRef.current.querySelectorAll('.list-group-item');
|
|
623
|
+
var _displayedHeight = _displayedItems[0].clientHeight * _displayedItems.length;
|
|
624
|
+
if (_displayedHeight < listRef.current.clientHeight) {
|
|
625
|
+
listContentRef.current.style.height = _displayedHeight + 'px';
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
//
|
|
629
|
+
listContentRef.current.style.overflowY = 'auto';
|
|
630
|
+
} else {
|
|
631
|
+
listContentRef.current.style.height = 'auto';
|
|
632
|
+
listContentRef.current.style.overflowY = 'inherit';
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
// STEP 2:
|
|
636
|
+
// Adjust position
|
|
637
|
+
if (!isInViewport(el)) {
|
|
638
|
+
el.classList.add(PLACEMENT_BOTTOMEND);
|
|
639
|
+
el.style.setProperty('bottom', selectInputRef.current.clientHeight + 5 + 'px', "important");
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
// STEP 3:
|
|
643
|
+
// It is on top when no scrollbars have been added
|
|
644
|
+
if (!isInViewport(el)) {
|
|
645
|
+
if (el.getBoundingClientRect().top < 0) {
|
|
646
|
+
listContentRef.current.style.height = _contentHeight + el.getBoundingClientRect().top - elMinWindowSpacing + 'px';
|
|
647
|
+
listContentRef.current.style.overflowY = 'auto';
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// Determine whether it is in JSON format
|
|
653
|
+
function isJSON(str) {
|
|
654
|
+
if (typeof str === 'string' && str.length > 0) {
|
|
655
|
+
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
656
|
+
return false;
|
|
657
|
+
} else {
|
|
658
|
+
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
659
|
+
return true;
|
|
660
|
+
} else {
|
|
661
|
+
return false;
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
} else {
|
|
665
|
+
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
666
|
+
return true;
|
|
667
|
+
} else {
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
function adjustMultiControlContainerHeight() {
|
|
673
|
+
setTimeout(function () {
|
|
674
|
+
rootSingleRef.current.style.height = rootMultiRef.current.clientHeight + 'px';
|
|
675
|
+
selectInputRef.current.style.height = rootMultiRef.current.clientHeight + 'px';
|
|
676
|
+
}, 0);
|
|
677
|
+
}
|
|
678
|
+
function fetchData(_x2, _x3) {
|
|
679
|
+
return _fetchData.apply(this, arguments);
|
|
680
|
+
}
|
|
681
|
+
function _fetchData() {
|
|
682
|
+
_fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params, inputDefaultValue) {
|
|
683
|
+
var init,
|
|
684
|
+
incomingOptionsData,
|
|
685
|
+
defaultValue,
|
|
686
|
+
response,
|
|
687
|
+
_ORGIN_DATA,
|
|
688
|
+
filterRes,
|
|
689
|
+
filterResQueryValue,
|
|
690
|
+
filterResQueryLabel,
|
|
691
|
+
_currentData,
|
|
692
|
+
_values,
|
|
693
|
+
_filterRes2,
|
|
694
|
+
_filterResQueryValue,
|
|
695
|
+
_filterResQueryLabel,
|
|
696
|
+
_currentData2,
|
|
697
|
+
_values2,
|
|
698
|
+
_args2 = arguments;
|
|
699
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
700
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
701
|
+
case 0:
|
|
702
|
+
init = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : true;
|
|
703
|
+
// get incoming options from `data-options` of component
|
|
704
|
+
// It is usually used for complex cascading `<MultiFuncSelect />` components
|
|
705
|
+
incomingOptionsData = valueInputRef.current.dataset.options; // Determine whether the default value is user query input or default input
|
|
706
|
+
defaultValue = init ? inputDefaultValue : '';
|
|
707
|
+
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
708
|
+
_context2.next = 22;
|
|
709
|
+
break;
|
|
710
|
+
}
|
|
711
|
+
_context2.next = 6;
|
|
712
|
+
return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
713
|
+
case 6:
|
|
714
|
+
response = _context2.sent;
|
|
715
|
+
_ORGIN_DATA = response.data; // reset data structure
|
|
716
|
+
if (typeof fetchCallback === 'function') {
|
|
717
|
+
_ORGIN_DATA = fetchCallback(_ORGIN_DATA);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// Determine whether the data structure matches
|
|
721
|
+
if (_ORGIN_DATA.length > 0 && typeof _ORGIN_DATA[0].value === 'undefined') {
|
|
722
|
+
console.warn('The data structure does not match, please refer to the example in the component documentation.');
|
|
723
|
+
setHasErr(true);
|
|
724
|
+
_ORGIN_DATA = [];
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// STEP 1: ===========
|
|
728
|
+
// get incoming options from `data-options` of component
|
|
729
|
+
if (typeof incomingOptionsData !== 'undefined') {
|
|
730
|
+
_ORGIN_DATA = JSON.parse(incomingOptionsData);
|
|
731
|
+
|
|
732
|
+
// set value if the attribute `data-options` of component exists, only valid for single selection (it may be an empty array)
|
|
733
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '') valueInputRef.current.dataset.value = defaultValue;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// STEP 2: ===========
|
|
737
|
+
// Set hierarchical categories ( with sub-categories )
|
|
738
|
+
if (hierarchical) {
|
|
739
|
+
(0,tree.addTreeDepth)(_ORGIN_DATA);
|
|
740
|
+
_ORGIN_DATA = (0,tree.flatTree)(_ORGIN_DATA);
|
|
741
|
+
(0,tree.addTreeIndent)(_ORGIN_DATA, INDENT_PLACEHOLDER, INDENT_LAST_PLACEHOLDER, 'label');
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
// STEP 3: ===========
|
|
745
|
+
// value & label must be initialized
|
|
746
|
+
filterRes = [];
|
|
747
|
+
if (fetchTrigger) {
|
|
748
|
+
// If a manual action is used to trigger the request
|
|
749
|
+
if (typeof fetchTriggerForDefaultData !== 'undefined' && fetchTriggerForDefaultData !== null && typeof (fetchTriggerForDefaultData === null || fetchTriggerForDefaultData === void 0 ? void 0 : fetchTriggerForDefaultData.values[0]) !== 'undefined') {
|
|
750
|
+
filterRes = [{
|
|
751
|
+
value: fetchTriggerForDefaultData === null || fetchTriggerForDefaultData === void 0 ? void 0 : fetchTriggerForDefaultData.values[0],
|
|
752
|
+
label: fetchTriggerForDefaultData === null || fetchTriggerForDefaultData === void 0 ? void 0 : fetchTriggerForDefaultData.labels[0],
|
|
753
|
+
queryString: fetchTriggerForDefaultData === null || fetchTriggerForDefaultData === void 0 ? void 0 : fetchTriggerForDefaultData.queryStrings[0]
|
|
754
|
+
}];
|
|
755
|
+
}
|
|
756
|
+
} else {
|
|
757
|
+
filterResQueryValue = _ORGIN_DATA.filter(function (item) {
|
|
758
|
+
return item.value == defaultValue;
|
|
759
|
+
});
|
|
760
|
+
filterResQueryLabel = _ORGIN_DATA.filter(function (item) {
|
|
761
|
+
return item.label == defaultValue;
|
|
762
|
+
});
|
|
763
|
+
filterRes = filterResQueryValue;
|
|
764
|
+
if (filterResQueryValue.length === 0) filterRes = filterResQueryLabel;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// STEP 4: ===========
|
|
768
|
+
// ++++++++++++++++++++
|
|
769
|
+
// Single selection
|
|
770
|
+
// ++++++++++++++++++++
|
|
771
|
+
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
772
|
+
// Do not use `init`, otherwise the query will revert to the default value if there is no value
|
|
773
|
+
setControlValue('');
|
|
774
|
+
setControlLabel('');
|
|
775
|
+
} else {
|
|
776
|
+
if (filterRes.length > 0) {
|
|
777
|
+
setControlValue(filterRes[0].value);
|
|
778
|
+
setControlLabel(formatIndentVal(filterRes[0].label));
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// ++++++++++++++++++++
|
|
783
|
+
// Multiple selection
|
|
784
|
+
// ++++++++++++++++++++
|
|
785
|
+
if (MULTI_SEL_VALID) {
|
|
786
|
+
if ((typeof defaultValue === 'undefined' || defaultValue === '') && init) {
|
|
787
|
+
setControlArr({
|
|
788
|
+
labels: [],
|
|
789
|
+
values: []
|
|
790
|
+
});
|
|
791
|
+
setItemSelectedAll(false);
|
|
792
|
+
}
|
|
793
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '' && (multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.data) !== null) {
|
|
794
|
+
// initialize default values of Multiple selection
|
|
795
|
+
_currentData = multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.data;
|
|
796
|
+
setControlArr({
|
|
797
|
+
labels: _currentData.labels,
|
|
798
|
+
values: _currentData.values
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
//
|
|
802
|
+
_values = defaultValue.split(',');
|
|
803
|
+
_values.forEach(function (_value, _index) {
|
|
804
|
+
if (!multiSelControlOptionExist(_currentData.values, _value) && typeof _currentData.values[_index] !== 'undefined') {
|
|
805
|
+
var _filterRes = [];
|
|
806
|
+
_filterRes = [{
|
|
807
|
+
value: _currentData.values[_index],
|
|
808
|
+
label: _currentData.labels[_index],
|
|
809
|
+
queryString: _currentData.queryStrings[_index]
|
|
810
|
+
}];
|
|
811
|
+
setControlArr(function (prevState) {
|
|
812
|
+
return {
|
|
813
|
+
labels: unique([].concat(_toConsumableArray(prevState.labels), [typeof _filterRes[0] !== 'undefined' ? _filterRes[0].label : '']).filter(function (v) {
|
|
814
|
+
return v !== '';
|
|
815
|
+
})),
|
|
816
|
+
values: unique([].concat(_toConsumableArray(prevState.values), [typeof _filterRes[0] !== 'undefined' ? _filterRes[0].value : '']).filter(function (v) {
|
|
817
|
+
return v !== '';
|
|
818
|
+
}))
|
|
819
|
+
};
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
|
|
824
|
+
// Appropriate multi-item container height
|
|
825
|
+
adjustMultiControlContainerHeight();
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
// STEP 5: ===========
|
|
830
|
+
//
|
|
831
|
+
setOptionsData(_ORGIN_DATA); // data must be initialized
|
|
832
|
+
|
|
833
|
+
//
|
|
834
|
+
setOrginalData(_ORGIN_DATA);
|
|
835
|
+
|
|
836
|
+
// STEP 6: ===========
|
|
837
|
+
//
|
|
838
|
+
onFetch === null || onFetch === void 0 ? void 0 : onFetch(selectInputRef.current, valueInputRef.current, defaultValue, _ORGIN_DATA, incomingData);
|
|
839
|
+
|
|
840
|
+
//
|
|
841
|
+
return _context2.abrupt("return", _ORGIN_DATA);
|
|
842
|
+
case 22:
|
|
843
|
+
// STEP 1: ===========
|
|
844
|
+
// get incoming options from `data-options` of component
|
|
845
|
+
if (typeof incomingOptionsData !== 'undefined') {
|
|
846
|
+
optionsDataInit = JSON.parse(incomingOptionsData);
|
|
847
|
+
|
|
848
|
+
// set value if the attribute `data-options` of component exists, only valid for single selection (it may be an empty array)
|
|
849
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '') valueInputRef.current.dataset.value = defaultValue;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// STEP 2: ===========
|
|
853
|
+
// Set hierarchical categories ( with sub-categories )
|
|
854
|
+
if (hierarchical) {
|
|
855
|
+
(0,tree.addTreeDepth)(optionsDataInit);
|
|
856
|
+
optionsDataInit = (0,tree.flatTree)(optionsDataInit);
|
|
857
|
+
(0,tree.addTreeIndent)(optionsDataInit, INDENT_PLACEHOLDER, INDENT_LAST_PLACEHOLDER, 'label');
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
// STEP 3: ===========
|
|
861
|
+
// value & label must be initialized
|
|
862
|
+
_filterRes2 = [];
|
|
863
|
+
_filterResQueryValue = optionsDataInit.filter(function (item) {
|
|
864
|
+
return item.value == defaultValue;
|
|
865
|
+
});
|
|
866
|
+
_filterResQueryLabel = optionsDataInit.filter(function (item) {
|
|
867
|
+
return item.label == defaultValue;
|
|
868
|
+
});
|
|
869
|
+
_filterRes2 = _filterResQueryValue;
|
|
870
|
+
if (_filterResQueryValue.length === 0) _filterRes2 = _filterResQueryLabel;
|
|
871
|
+
|
|
872
|
+
// STEP 4: ===========
|
|
873
|
+
// ++++++++++++++++++++
|
|
874
|
+
// Single selection
|
|
875
|
+
// ++++++++++++++++++++
|
|
876
|
+
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
877
|
+
// Do not use `init`, otherwise the query will revert to the default value if there is no value
|
|
878
|
+
setControlValue('');
|
|
879
|
+
setControlLabel('');
|
|
880
|
+
} else {
|
|
881
|
+
if (_filterRes2.length > 0) {
|
|
882
|
+
setControlValue(_filterRes2[0].value);
|
|
883
|
+
setControlLabel(formatIndentVal(_filterRes2[0].label));
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
// ++++++++++++++++++++
|
|
888
|
+
// Multiple selection
|
|
889
|
+
// ++++++++++++++++++++
|
|
890
|
+
if (MULTI_SEL_VALID) {
|
|
891
|
+
if ((typeof defaultValue === 'undefined' || defaultValue === '') && init) {
|
|
892
|
+
setControlArr({
|
|
893
|
+
labels: [],
|
|
894
|
+
values: []
|
|
895
|
+
});
|
|
896
|
+
setItemSelectedAll(false);
|
|
897
|
+
}
|
|
898
|
+
if (typeof defaultValue !== 'undefined' && defaultValue !== '' && (multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.data) !== null) {
|
|
899
|
+
// initialize default values of Multiple selection
|
|
900
|
+
_currentData2 = multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.data;
|
|
901
|
+
setControlArr({
|
|
902
|
+
labels: _currentData2.labels,
|
|
903
|
+
values: _currentData2.values
|
|
904
|
+
});
|
|
905
|
+
|
|
906
|
+
//
|
|
907
|
+
_values2 = typeof defaultValue !== 'undefined' ? defaultValue.split(',') : [];
|
|
908
|
+
_values2.forEach(function (_value, _index) {
|
|
909
|
+
if (!multiSelControlOptionExist(_currentData2.values, _value) && typeof _currentData2.values[_index] !== 'undefined') {
|
|
910
|
+
var _filterRes3 = [];
|
|
911
|
+
_filterRes3 = [{
|
|
912
|
+
value: _currentData2.values[_index],
|
|
913
|
+
label: _currentData2.labels[_index],
|
|
914
|
+
queryString: _currentData2.queryStrings[_index]
|
|
915
|
+
}];
|
|
916
|
+
setControlArr(function (prevState) {
|
|
917
|
+
return {
|
|
918
|
+
labels: unique([].concat(_toConsumableArray(prevState.labels), [typeof _filterRes3[0] !== 'undefined' ? _filterRes3[0].label : '']).filter(function (v) {
|
|
919
|
+
return v !== '';
|
|
920
|
+
})),
|
|
921
|
+
values: unique([].concat(_toConsumableArray(prevState.values), [typeof _filterRes3[0] !== 'undefined' ? _filterRes3[0].value : '']).filter(function (v) {
|
|
922
|
+
return v !== '';
|
|
923
|
+
}))
|
|
924
|
+
};
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
});
|
|
928
|
+
|
|
929
|
+
// Appropriate multi-item container height
|
|
930
|
+
adjustMultiControlContainerHeight();
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// STEP 5: ===========
|
|
935
|
+
//
|
|
936
|
+
setOptionsData(optionsDataInit); // data must be initialized
|
|
937
|
+
|
|
938
|
+
//
|
|
939
|
+
setOrginalData(optionsDataInit);
|
|
940
|
+
|
|
941
|
+
// STEP 6: ===========
|
|
942
|
+
//
|
|
943
|
+
onFetch === null || onFetch === void 0 ? void 0 : onFetch(selectInputRef.current, valueInputRef.current, defaultValue, optionsDataInit, incomingData);
|
|
944
|
+
|
|
945
|
+
//
|
|
946
|
+
return _context2.abrupt("return", optionsDataInit);
|
|
947
|
+
case 35:
|
|
948
|
+
case "end":
|
|
949
|
+
return _context2.stop();
|
|
950
|
+
}
|
|
951
|
+
}, _callee2);
|
|
952
|
+
}));
|
|
953
|
+
return _fetchData.apply(this, arguments);
|
|
954
|
+
}
|
|
955
|
+
function cancel() {
|
|
956
|
+
// hide list
|
|
957
|
+
setIsOpen(false);
|
|
958
|
+
|
|
959
|
+
// restore data
|
|
960
|
+
setOptionsData(orginalData);
|
|
961
|
+
|
|
962
|
+
// update temporary value
|
|
963
|
+
setControlTempValue(null);
|
|
964
|
+
}
|
|
965
|
+
function activate() {
|
|
966
|
+
// show list
|
|
967
|
+
setIsOpen(true);
|
|
968
|
+
|
|
969
|
+
// restore data
|
|
970
|
+
setOptionsData(orginalData);
|
|
971
|
+
|
|
972
|
+
// update temporary value
|
|
973
|
+
setControlTempValue('');
|
|
974
|
+
}
|
|
975
|
+
function rootWrapperSwitch() {
|
|
976
|
+
// remove active styles from the root container and activate current wrapper
|
|
977
|
+
[].slice.call(document.querySelectorAll('.multifunc-select__wrapper')).forEach(function (node) {
|
|
978
|
+
node.classList.remove('active', 'focus');
|
|
979
|
+
});
|
|
980
|
+
rootRef.current.classList.add('active', 'focus');
|
|
981
|
+
}
|
|
982
|
+
function handleSelect(_x4) {
|
|
983
|
+
return _handleSelect.apply(this, arguments);
|
|
984
|
+
}
|
|
985
|
+
function _handleSelect() {
|
|
986
|
+
_handleSelect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(el) {
|
|
987
|
+
var dataInput,
|
|
988
|
+
valueArr,
|
|
989
|
+
labelArr,
|
|
990
|
+
index,
|
|
991
|
+
incomingOptionsData,
|
|
992
|
+
_data,
|
|
993
|
+
_value,
|
|
994
|
+
_label,
|
|
995
|
+
currentControlValueArr,
|
|
996
|
+
currentControlLabelArr,
|
|
997
|
+
_value2,
|
|
998
|
+
_label2,
|
|
999
|
+
_currentControlValueArr,
|
|
1000
|
+
_currentControlLabelArr,
|
|
1001
|
+
_args3 = arguments;
|
|
1002
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
1003
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
1004
|
+
case 0:
|
|
1005
|
+
dataInput = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
|
1006
|
+
valueArr = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : [];
|
|
1007
|
+
labelArr = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : [];
|
|
1008
|
+
if (!(typeof el === 'undefined')) {
|
|
1009
|
+
_context3.next = 5;
|
|
1010
|
+
break;
|
|
1011
|
+
}
|
|
1012
|
+
return _context3.abrupt("return");
|
|
1013
|
+
case 5:
|
|
1014
|
+
// get incoming options from `data-options` of component
|
|
1015
|
+
// It is usually used for complex cascading `<MultiFuncSelect />` components
|
|
1016
|
+
incomingOptionsData = valueInputRef.current.dataset.options; // cancel
|
|
1017
|
+
if (!(MULTI_SEL_VALID && isOpen)) {
|
|
1018
|
+
cancel();
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
//remove focus style
|
|
1022
|
+
if (!(MULTI_SEL_VALID && isOpen)) {
|
|
1023
|
+
rootRef.current.classList.remove('focus');
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
// update value * label
|
|
1027
|
+
if (dataInput) {
|
|
1028
|
+
// using keyboard
|
|
1029
|
+
_data = JSON.parse(dataInput);
|
|
1030
|
+
_value = _data.value;
|
|
1031
|
+
_label = _data.label; // ++++++++++++++++++++
|
|
1032
|
+
// Single selection
|
|
1033
|
+
// ++++++++++++++++++++
|
|
1034
|
+
setControlValue(_value);
|
|
1035
|
+
setControlLabel(formatIndentVal(_label));
|
|
1036
|
+
|
|
1037
|
+
// set value if the attribute `data-options` of component exists, only valid for single selection (it may be an empty array)
|
|
1038
|
+
if (typeof incomingOptionsData !== 'undefined') {
|
|
1039
|
+
valueInputRef.current.dataset.value = _value;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
// ++++++++++++++++++++
|
|
1043
|
+
// Multiple selection
|
|
1044
|
+
// ++++++++++++++++++++
|
|
1045
|
+
currentControlValueArr = JSON.parse(JSON.stringify(valueArr));
|
|
1046
|
+
currentControlLabelArr = JSON.parse(JSON.stringify(labelArr));
|
|
1047
|
+
if (MULTI_SEL_VALID) {
|
|
1048
|
+
if (multiSelControlOptionExist(valueArr, _value)) {
|
|
1049
|
+
setControlArr(function (prevState) {
|
|
1050
|
+
// update temporary value
|
|
1051
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
|
|
1052
|
+
return {
|
|
1053
|
+
labels: removeItemOnce(prevState.labels, formatIndentVal(_label)),
|
|
1054
|
+
values: removeItemOnce(prevState.values, _value)
|
|
1055
|
+
};
|
|
1056
|
+
});
|
|
1057
|
+
currentControlValueArr = removeItemOnce(currentControlValueArr, _value);
|
|
1058
|
+
currentControlLabelArr = removeItemOnce(currentControlLabelArr, formatIndentVal(_label));
|
|
1059
|
+
} else {
|
|
1060
|
+
setControlArr(function (prevState) {
|
|
1061
|
+
// update temporary value
|
|
1062
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
|
|
1063
|
+
return {
|
|
1064
|
+
labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label)]),
|
|
1065
|
+
values: [].concat(_toConsumableArray(prevState.values), [_value])
|
|
1066
|
+
};
|
|
1067
|
+
});
|
|
1068
|
+
currentControlValueArr.push(_value);
|
|
1069
|
+
currentControlLabelArr.push(_label);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// Appropriate multi-item container height
|
|
1073
|
+
adjustMultiControlContainerHeight();
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
//
|
|
1077
|
+
if (typeof onChange === 'function') {
|
|
1078
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? optionsData[index] : {
|
|
1079
|
+
labels: currentControlLabelArr.map(function (v) {
|
|
1080
|
+
return v.toString();
|
|
1081
|
+
}),
|
|
1082
|
+
values: currentControlValueArr.map(function (v) {
|
|
1083
|
+
return v.toString();
|
|
1084
|
+
})
|
|
1085
|
+
});
|
|
1086
|
+
|
|
1087
|
+
//
|
|
1088
|
+
selectInputRef.current.blur();
|
|
1089
|
+
}
|
|
1090
|
+
} else {
|
|
1091
|
+
index = typeof el.currentTarget !== 'undefined' ? el.currentTarget.dataset.index : el.dataset.index;
|
|
1092
|
+
_value2 = optionsData[index].value;
|
|
1093
|
+
_label2 = optionsData[index].label; // ++++++++++++++++++++
|
|
1094
|
+
// Single selection
|
|
1095
|
+
// ++++++++++++++++++++
|
|
1096
|
+
setControlValue(_value2);
|
|
1097
|
+
setControlLabel(formatIndentVal(_label2));
|
|
1098
|
+
|
|
1099
|
+
// set value if the attribute `data-options` of component exists, only valid for single selection (it may be an empty array)
|
|
1100
|
+
if (typeof incomingOptionsData !== 'undefined') {
|
|
1101
|
+
valueInputRef.current.dataset.value = _value2;
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
// ++++++++++++++++++++
|
|
1105
|
+
// Multiple selection
|
|
1106
|
+
// ++++++++++++++++++++
|
|
1107
|
+
_currentControlValueArr = JSON.parse(JSON.stringify(controlArr.values));
|
|
1108
|
+
_currentControlLabelArr = JSON.parse(JSON.stringify(controlArr.labels));
|
|
1109
|
+
if (MULTI_SEL_VALID) {
|
|
1110
|
+
if (multiSelControlOptionExist(controlArr.values, _value2)) {
|
|
1111
|
+
setControlArr(function (prevState) {
|
|
1112
|
+
// update temporary value
|
|
1113
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
|
|
1114
|
+
return {
|
|
1115
|
+
labels: removeItemOnce(prevState.labels, formatIndentVal(_label2)),
|
|
1116
|
+
values: removeItemOnce(prevState.values, _value2)
|
|
1117
|
+
};
|
|
1118
|
+
});
|
|
1119
|
+
_currentControlValueArr = removeItemOnce(_currentControlValueArr, _value2);
|
|
1120
|
+
_currentControlLabelArr = removeItemOnce(_currentControlLabelArr, formatIndentVal(_label2));
|
|
1121
|
+
} else {
|
|
1122
|
+
setControlArr(function (prevState) {
|
|
1123
|
+
// update temporary value
|
|
1124
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
|
|
1125
|
+
return {
|
|
1126
|
+
labels: [].concat(_toConsumableArray(prevState.labels), [formatIndentVal(_label2)]),
|
|
1127
|
+
values: [].concat(_toConsumableArray(prevState.values), [_value2])
|
|
1128
|
+
};
|
|
1129
|
+
});
|
|
1130
|
+
_currentControlValueArr.push(_value2);
|
|
1131
|
+
_currentControlLabelArr.push(_label2);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
// Appropriate multi-item container height
|
|
1135
|
+
adjustMultiControlContainerHeight();
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
//
|
|
1139
|
+
if (typeof onChange === 'function') {
|
|
1140
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, !MULTI_SEL_VALID ? optionsData[index] : {
|
|
1141
|
+
labels: _currentControlLabelArr.map(function (v) {
|
|
1142
|
+
return v.toString();
|
|
1143
|
+
}),
|
|
1144
|
+
values: _currentControlValueArr.map(function (v) {
|
|
1145
|
+
return v.toString();
|
|
1146
|
+
})
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1149
|
+
//
|
|
1150
|
+
selectInputRef.current.blur();
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
case 9:
|
|
1154
|
+
case "end":
|
|
1155
|
+
return _context3.stop();
|
|
1156
|
+
}
|
|
1157
|
+
}, _callee3);
|
|
1158
|
+
}));
|
|
1159
|
+
return _handleSelect.apply(this, arguments);
|
|
1160
|
+
}
|
|
1161
|
+
function handleSelectAll(event) {
|
|
1162
|
+
event.preventDefault();
|
|
1163
|
+
var onChangeSelectAll = function onChangeSelectAll(labelsArr, valuesArr) {
|
|
1164
|
+
if (typeof onChange === 'function') {
|
|
1165
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, {
|
|
1166
|
+
labels: labelsArr.map(function (v) {
|
|
1167
|
+
return v.toString();
|
|
1168
|
+
}),
|
|
1169
|
+
values: valuesArr.map(function (v) {
|
|
1170
|
+
return v.toString();
|
|
1171
|
+
})
|
|
1172
|
+
});
|
|
1173
|
+
|
|
1174
|
+
//
|
|
1175
|
+
selectInputRef.current.blur();
|
|
1176
|
+
}
|
|
1177
|
+
};
|
|
1178
|
+
setItemSelectedAll(function (prevState) {
|
|
1179
|
+
if (!prevState) {
|
|
1180
|
+
setControlArr(function (prevData) {
|
|
1181
|
+
var currentControlValueArr = [].concat(_toConsumableArray(prevData.values), _toConsumableArray(optionsData.map(function (v) {
|
|
1182
|
+
return v.value;
|
|
1183
|
+
}))).filter(function (item, index, arr) {
|
|
1184
|
+
return arr.indexOf(item, 0) === index;
|
|
1185
|
+
});
|
|
1186
|
+
var currentControlLabelArr = [].concat(_toConsumableArray(formatIndentVal(prevData.labels)), _toConsumableArray(formatIndentVal(optionsData.map(function (v) {
|
|
1187
|
+
return v.label;
|
|
1188
|
+
})))).filter(function (item, index, arr) {
|
|
1189
|
+
return arr.indexOf(item, 0) === index;
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
//
|
|
1193
|
+
onChangeSelectAll(currentControlLabelArr, currentControlValueArr);
|
|
1194
|
+
return {
|
|
1195
|
+
labels: currentControlLabelArr,
|
|
1196
|
+
values: currentControlValueArr
|
|
1197
|
+
};
|
|
1198
|
+
});
|
|
1199
|
+
} else {
|
|
1200
|
+
setControlArr(function (prevData) {
|
|
1201
|
+
var currentControlValueArr = removeItems(prevData.values, optionsData.map(function (v) {
|
|
1202
|
+
return v.value;
|
|
1203
|
+
}));
|
|
1204
|
+
var currentControlLabelArr = removeItems(formatIndentVal(prevData.labels), formatIndentVal(optionsData.map(function (v) {
|
|
1205
|
+
return v.label;
|
|
1206
|
+
})));
|
|
1207
|
+
|
|
1208
|
+
//
|
|
1209
|
+
onChangeSelectAll(currentControlLabelArr, currentControlValueArr);
|
|
1210
|
+
return {
|
|
1211
|
+
labels: currentControlLabelArr,
|
|
1212
|
+
values: currentControlValueArr
|
|
1213
|
+
};
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
return !prevState;
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
function handleMultiControlItemRemove(event) {
|
|
1220
|
+
event.preventDefault();
|
|
1221
|
+
var valueToRemove = String(event.currentTarget.dataset.item);
|
|
1222
|
+
var getCurrentIndex = controlArr.values.findIndex(function (item) {
|
|
1223
|
+
return item.toString() === valueToRemove;
|
|
1224
|
+
});
|
|
1225
|
+
var currentControlValueArr = JSON.parse(JSON.stringify(controlArr.values));
|
|
1226
|
+
var currentControlLabelArr = JSON.parse(JSON.stringify(controlArr.labels));
|
|
1227
|
+
var _value = valueToRemove;
|
|
1228
|
+
var _label = controlArr.labels[getCurrentIndex];
|
|
1229
|
+
setControlArr(function (prevState) {
|
|
1230
|
+
// update temporary value
|
|
1231
|
+
setControlTempValue(prevState.labels.length >= 0 ? null : prevState.labels.join(','));
|
|
1232
|
+
return {
|
|
1233
|
+
labels: removeItemOnce(prevState.labels, formatIndentVal(_label)),
|
|
1234
|
+
values: removeItemOnce(prevState.values, _value)
|
|
1235
|
+
};
|
|
1236
|
+
});
|
|
1237
|
+
currentControlValueArr = removeItemOnce(currentControlValueArr, _value);
|
|
1238
|
+
currentControlLabelArr = removeItemOnce(currentControlLabelArr, formatIndentVal(_label));
|
|
1239
|
+
|
|
1240
|
+
// Appropriate multi-item container height
|
|
1241
|
+
adjustMultiControlContainerHeight();
|
|
1242
|
+
|
|
1243
|
+
//
|
|
1244
|
+
if (typeof onChange === 'function') {
|
|
1245
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(selectInputRef.current, valueInputRef.current, {
|
|
1246
|
+
labels: currentControlLabelArr.map(function (v) {
|
|
1247
|
+
return v.toString();
|
|
1248
|
+
}),
|
|
1249
|
+
values: currentControlValueArr.map(function (v) {
|
|
1250
|
+
return v.toString();
|
|
1251
|
+
})
|
|
1252
|
+
});
|
|
1253
|
+
|
|
1254
|
+
//
|
|
1255
|
+
selectInputRef.current.blur();
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
function handleShowList() {
|
|
1259
|
+
//
|
|
1260
|
+
rootWrapperSwitch();
|
|
1261
|
+
|
|
1262
|
+
//
|
|
1263
|
+
if (!isOpen) {
|
|
1264
|
+
activate();
|
|
1265
|
+
|
|
1266
|
+
// window position
|
|
1267
|
+
setTimeout(function () {
|
|
1268
|
+
getPlacement(listRef.current);
|
|
1269
|
+
}, 0);
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
function handleFetch() {
|
|
1273
|
+
return _handleFetch.apply(this, arguments);
|
|
1274
|
+
}
|
|
1275
|
+
function _handleFetch() {
|
|
1276
|
+
_handleFetch = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
1277
|
+
var inputVal,
|
|
1278
|
+
searchStr,
|
|
1279
|
+
_oparams,
|
|
1280
|
+
_params,
|
|
1281
|
+
res,
|
|
1282
|
+
_args4 = arguments;
|
|
1283
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
1284
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
1285
|
+
case 0:
|
|
1286
|
+
inputVal = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : null;
|
|
1287
|
+
// data init
|
|
1288
|
+
searchStr = typeof inputVal === 'string' ? inputVal : controlTempValue || controlTempValue === '' ? controlTempValue : '';
|
|
1289
|
+
_oparams = fetchFuncMethodParams || [];
|
|
1290
|
+
_params = _oparams.map(function (item) {
|
|
1291
|
+
return item !== '$QUERY_STRING' ? item : searchStr;
|
|
1292
|
+
}); // if empty
|
|
1293
|
+
if (!(searchStr.replace(/\s/g, "") === '')) {
|
|
1294
|
+
_context4.next = 6;
|
|
1295
|
+
break;
|
|
1296
|
+
}
|
|
1297
|
+
return _context4.abrupt("return", []);
|
|
1298
|
+
case 6:
|
|
1299
|
+
_context4.next = 8;
|
|
1300
|
+
return fetchData(_params.join(','), value, false);
|
|
1301
|
+
case 8:
|
|
1302
|
+
res = _context4.sent;
|
|
1303
|
+
return _context4.abrupt("return", res);
|
|
1304
|
+
case 10:
|
|
1305
|
+
case "end":
|
|
1306
|
+
return _context4.stop();
|
|
1307
|
+
}
|
|
1308
|
+
}, _callee4);
|
|
1309
|
+
}));
|
|
1310
|
+
return _handleFetch.apply(this, arguments);
|
|
1311
|
+
}
|
|
1312
|
+
function handleComposition(event) {
|
|
1313
|
+
if (event.type === 'compositionstart' || event.type === 'compositionend') {
|
|
1314
|
+
//fire change method to update for Chrome v53
|
|
1315
|
+
handleChange(event);
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
function handleChange(event) {
|
|
1319
|
+
var val = event.target.value;
|
|
1320
|
+
|
|
1321
|
+
// update temporary value
|
|
1322
|
+
setControlTempValue(val);
|
|
1323
|
+
|
|
1324
|
+
//
|
|
1325
|
+
if (val.replace(/\s/g, "") === '') {
|
|
1326
|
+
// No elements found. Consider changing the search query.
|
|
1327
|
+
// restore data
|
|
1328
|
+
setOptionsData(orginalData);
|
|
1329
|
+
} else {
|
|
1330
|
+
handleChangeFetchSafe(val);
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1333
|
+
// window position
|
|
1334
|
+
setTimeout(function () {
|
|
1335
|
+
getPlacement(listRef.current);
|
|
1336
|
+
}, 0);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
//
|
|
1340
|
+
function handleFocus(event) {
|
|
1341
|
+
rootRef.current.classList.add('focus');
|
|
1342
|
+
|
|
1343
|
+
// update temporary value
|
|
1344
|
+
setControlTempValue('');
|
|
1345
|
+
|
|
1346
|
+
//
|
|
1347
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
1348
|
+
}
|
|
1349
|
+
function handleBlur(event) {
|
|
1350
|
+
//remove focus style
|
|
1351
|
+
if (!(MULTI_SEL_VALID && isOpen)) {
|
|
1352
|
+
rootRef.current.classList.remove('focus');
|
|
1353
|
+
}
|
|
1354
|
+
setTimeout(function () {
|
|
1355
|
+
// cancel
|
|
1356
|
+
if (!(MULTI_SEL_VALID && isOpen)) {
|
|
1357
|
+
cancel();
|
|
1358
|
+
}
|
|
1359
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
1360
|
+
}, 300);
|
|
1361
|
+
}
|
|
1362
|
+
function handleClose(event) {
|
|
1363
|
+
if (event.target.closest(".".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'multifunc-select__wrapper')) === null) {
|
|
1364
|
+
// cancel
|
|
1365
|
+
cancel();
|
|
1366
|
+
}
|
|
1367
|
+
}
|
|
1368
|
+
function generateInputFocusStr() {
|
|
1369
|
+
return controlTempValue || controlTempValue === '' ? controlTempValue.length === 0 ? '|' : controlTempValue : placeholder || '';
|
|
1370
|
+
}
|
|
1371
|
+
function optionFocus(type) {
|
|
1372
|
+
return new Promise(function (resolve) {
|
|
1373
|
+
// Determine the "active" class name to avoid listening to other unused components of the same type
|
|
1374
|
+
if (listRef.current === null || !rootRef.current.classList.contains('active')) return;
|
|
1375
|
+
if (fetchTrigger) return;
|
|
1376
|
+
var options = [].slice.call(listRef.current.querySelectorAll('.list-group-item'));
|
|
1377
|
+
var currentIndex = options.findIndex(function (e) {
|
|
1378
|
+
return e === listRef.current.querySelector('.list-group-item.active');
|
|
1379
|
+
});
|
|
1380
|
+
|
|
1381
|
+
// get the next element in the list, "%" will loop around to 0
|
|
1382
|
+
var nextIndex;
|
|
1383
|
+
if (type === 'increase') {
|
|
1384
|
+
nextIndex = currentIndex + 1 % options.length;
|
|
1385
|
+
} else {
|
|
1386
|
+
nextIndex = (currentIndex < 0 ? options.length : currentIndex) - 1 % options.length;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
//only one
|
|
1390
|
+
if (options.length === 1) nextIndex = 0;
|
|
1391
|
+
if (!isNaN(nextIndex)) {
|
|
1392
|
+
options.forEach(function (node, index) {
|
|
1393
|
+
node === null || node === void 0 ? void 0 : node.classList.remove('active');
|
|
1394
|
+
});
|
|
1395
|
+
var targetOption = options[nextIndex];
|
|
1396
|
+
if (typeof targetOption !== 'undefined' && !targetOption.classList.contains('no-match')) {
|
|
1397
|
+
targetOption.classList.add('active');
|
|
1398
|
+
resolve(targetOption);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
}
|
|
1403
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
1404
|
+
// Call a function when the component has been rendered completely
|
|
1405
|
+
//--------------
|
|
1406
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(selectInputRef.current, valueInputRef.current, value);
|
|
1407
|
+
|
|
1408
|
+
// update incoming data
|
|
1409
|
+
//--------------
|
|
1410
|
+
setIncomingData(data);
|
|
1411
|
+
|
|
1412
|
+
// data init
|
|
1413
|
+
//--------------
|
|
1414
|
+
var _oparams = fetchFuncMethodParams || [];
|
|
1415
|
+
var _params = _oparams.map(function (item) {
|
|
1416
|
+
return item !== '$QUERY_STRING' ? item : fetchTrigger ? '-' : '';
|
|
1417
|
+
});
|
|
1418
|
+
fetchData(_params.join(','), value);
|
|
1419
|
+
|
|
1420
|
+
// If you use the dynamic form assignment (such as document.getElementById(xxx).value),
|
|
1421
|
+
// you need to judge the value of the input obtained by using the macrotask "setInterval()"
|
|
1422
|
+
var timer = null;
|
|
1423
|
+
var initTimes = 0;
|
|
1424
|
+
var hasValue = false;
|
|
1425
|
+
timer = setInterval(function () {
|
|
1426
|
+
if (initTimes > 5 || hasValue) {
|
|
1427
|
+
clearInterval(timer);
|
|
1428
|
+
} else {
|
|
1429
|
+
// get value if the attribute `data-value` of component exists
|
|
1430
|
+
// Using `<DynamicFields />` will assign values according to `data-value`
|
|
1431
|
+
var incomingOptionsData = valueInputRef.current.dataset.options;
|
|
1432
|
+
if (valueInputRef.current !== null && typeof incomingOptionsData !== 'undefined' && typeof valueInputRef.current.dataset.value !== 'undefined' && valueInputRef.current.dataset.value !== '') {
|
|
1433
|
+
fetchData(_params.join(','), valueInputRef.current.dataset.value);
|
|
1434
|
+
hasValue = true;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
//
|
|
1438
|
+
if (valueInputRef.current !== null && valueInputRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
|
|
1439
|
+
fetchData(_params.join(','), valueInputRef.current.value);
|
|
1440
|
+
hasValue = true;
|
|
1441
|
+
}
|
|
1442
|
+
initTimes++;
|
|
1443
|
+
}
|
|
1444
|
+
}, 500);
|
|
1445
|
+
|
|
1446
|
+
// keyboard listener
|
|
1447
|
+
//--------------
|
|
1448
|
+
var listener = /*#__PURE__*/function () {
|
|
1449
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
1450
|
+
var res, currentData, currentControlValueArr, currentControlLabelArr, _options;
|
|
1451
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1452
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1453
|
+
case 0:
|
|
1454
|
+
res = null;
|
|
1455
|
+
if (!(event.code === "Enter" || event.code === "NumpadEnter")) {
|
|
1456
|
+
_context.next = 13;
|
|
1457
|
+
break;
|
|
1458
|
+
}
|
|
1459
|
+
if (!(listRef.current === null || !rootRef.current.classList.contains('active'))) {
|
|
1460
|
+
_context.next = 4;
|
|
1461
|
+
break;
|
|
1462
|
+
}
|
|
1463
|
+
return _context.abrupt("return");
|
|
1464
|
+
case 4:
|
|
1465
|
+
if (!fetchTrigger) {
|
|
1466
|
+
_context.next = 7;
|
|
1467
|
+
break;
|
|
1468
|
+
}
|
|
1469
|
+
handleFetch();
|
|
1470
|
+
return _context.abrupt("return");
|
|
1471
|
+
case 7:
|
|
1472
|
+
if (!(listRef.current !== null)) {
|
|
1473
|
+
_context.next = 12;
|
|
1474
|
+
break;
|
|
1475
|
+
}
|
|
1476
|
+
_context.next = 10;
|
|
1477
|
+
return listRef.current.dataset.data;
|
|
1478
|
+
case 10:
|
|
1479
|
+
currentData = _context.sent;
|
|
1480
|
+
if (typeof currentData !== 'undefined') {
|
|
1481
|
+
currentControlValueArr = [];
|
|
1482
|
+
currentControlLabelArr = [];
|
|
1483
|
+
_options = [].slice.call(listRef.current.querySelectorAll('.list-group-item:not(.no-match)'));
|
|
1484
|
+
_options.forEach(function (node) {
|
|
1485
|
+
node.classList.remove('active');
|
|
1486
|
+
if (node.classList.contains('item-selected')) {
|
|
1487
|
+
currentControlValueArr.push(node.dataset.value);
|
|
1488
|
+
currentControlLabelArr.push(node.dataset.label);
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
handleSelect(null, currentData, currentControlValueArr, currentControlLabelArr);
|
|
1492
|
+
}
|
|
1493
|
+
case 12:
|
|
1494
|
+
return _context.abrupt("return");
|
|
1495
|
+
case 13:
|
|
1496
|
+
_context.t0 = event.code;
|
|
1497
|
+
_context.next = _context.t0 === "ArrowLeft" ? 16 : _context.t0 === "ArrowRight" ? 17 : _context.t0 === "ArrowUp" ? 18 : _context.t0 === "ArrowDown" ? 22 : 26;
|
|
1498
|
+
break;
|
|
1499
|
+
case 16:
|
|
1500
|
+
return _context.abrupt("break", 26);
|
|
1501
|
+
case 17:
|
|
1502
|
+
return _context.abrupt("break", 26);
|
|
1503
|
+
case 18:
|
|
1504
|
+
_context.next = 20;
|
|
1505
|
+
return optionFocus('decrease');
|
|
1506
|
+
case 20:
|
|
1507
|
+
res = _context.sent;
|
|
1508
|
+
return _context.abrupt("break", 26);
|
|
1509
|
+
case 22:
|
|
1510
|
+
_context.next = 24;
|
|
1511
|
+
return optionFocus('increase');
|
|
1512
|
+
case 24:
|
|
1513
|
+
res = _context.sent;
|
|
1514
|
+
return _context.abrupt("break", 26);
|
|
1515
|
+
case 26:
|
|
1516
|
+
// temporary data
|
|
1517
|
+
if (res !== null) listRef.current.dataset.data = JSON.stringify({
|
|
1518
|
+
value: res.dataset.value,
|
|
1519
|
+
label: res.dataset.label,
|
|
1520
|
+
queryString: res.dataset.querystring
|
|
1521
|
+
});
|
|
1522
|
+
case 27:
|
|
1523
|
+
case "end":
|
|
1524
|
+
return _context.stop();
|
|
1525
|
+
}
|
|
1526
|
+
}, _callee);
|
|
1527
|
+
}));
|
|
1528
|
+
return function listener(_x5) {
|
|
1529
|
+
return _ref.apply(this, arguments);
|
|
1530
|
+
};
|
|
1531
|
+
}();
|
|
1532
|
+
document.removeEventListener("keydown", listener);
|
|
1533
|
+
document.addEventListener("keydown", listener);
|
|
1534
|
+
|
|
1535
|
+
//--------------
|
|
1536
|
+
document.removeEventListener('pointerdown', handleClose);
|
|
1537
|
+
document.addEventListener('pointerdown', handleClose);
|
|
1538
|
+
|
|
1539
|
+
// Add function to the element that should be used as the scrollable area.
|
|
1540
|
+
//--------------
|
|
1541
|
+
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1542
|
+
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1543
|
+
window.addEventListener('scroll', windowScrollUpdate);
|
|
1544
|
+
window.addEventListener('touchmove', windowScrollUpdate);
|
|
1545
|
+
// windowScrollUpdate();
|
|
1546
|
+
|
|
1547
|
+
return function () {
|
|
1548
|
+
document.removeEventListener("keydown", listener);
|
|
1549
|
+
document.removeEventListener('pointerdown', handleClose);
|
|
1550
|
+
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1551
|
+
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1552
|
+
|
|
1553
|
+
//
|
|
1554
|
+
clearInterval(timer);
|
|
1555
|
+
};
|
|
1556
|
+
}, [value, options, data]);
|
|
1557
|
+
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, 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, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1558
|
+
className: "multifunc-select__label"
|
|
1559
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
|
|
1560
|
+
htmlFor: "label-".concat(idRes),
|
|
1561
|
+
className: "form-label"
|
|
1562
|
+
}, label))) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1563
|
+
id: "multifunc-select__wrapper-".concat(idRes),
|
|
1564
|
+
className: "multifunc-select__wrapper ".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'mb-3 position-relative', " ").concat(MULTI_SEL_VALID ? 'multiple-selection' : '', " ").concat(isOpen ? 'active focus' : ''),
|
|
1565
|
+
ref: rootRef
|
|
1566
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1567
|
+
ref: rootSingleRef,
|
|
1568
|
+
className: "position-relative"
|
|
1569
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
|
|
1570
|
+
ref: function ref(node) {
|
|
1571
|
+
selectInputRef.current = node;
|
|
1572
|
+
if (typeof _ref2 === 'function') {
|
|
1573
|
+
_ref2(node);
|
|
1574
|
+
} else if (_ref2) {
|
|
1575
|
+
_ref2.current = node;
|
|
1576
|
+
}
|
|
1577
|
+
},
|
|
1578
|
+
tabIndex: tabIndex || 0,
|
|
1579
|
+
type: "text",
|
|
1580
|
+
id: "label-".concat(idRes)
|
|
1581
|
+
|
|
1582
|
+
// Don't use "name", it's just a container to display the label
|
|
1583
|
+
,
|
|
1584
|
+
"data-name": name !== null && name !== void 0 && name.match(/(\[.*?\])/gi) ? "".concat(name.split('[')[0], "-label[]") : "".concat(name, "-label"),
|
|
1585
|
+
"data-select": true,
|
|
1586
|
+
placeholder: placeholder || '',
|
|
1587
|
+
className: controlClassName || controlClassName === '' ? controlClassName : "form-control",
|
|
1588
|
+
onFocus: handleFocus,
|
|
1589
|
+
onBlur: handleBlur,
|
|
1590
|
+
onClick: handleShowList,
|
|
1591
|
+
onChange: handleChange,
|
|
1592
|
+
onCompositionStart: handleComposition,
|
|
1593
|
+
onCompositionUpdate: handleComposition,
|
|
1594
|
+
onCompositionEnd: handleComposition,
|
|
1595
|
+
disabled: disabled || null,
|
|
1596
|
+
required: required || null,
|
|
1597
|
+
readOnly: readOnly || null,
|
|
1598
|
+
value: controlTempValue || controlTempValue === '' ? controlTempValue : MULTI_SEL_VALID ? formatIndentVal(controlArr.labels).map(function (v) {
|
|
1599
|
+
return stripHTML(v);
|
|
1600
|
+
}).join(',') : stripHTML(controlLabel) // do not use `defaultValue`
|
|
1601
|
+
,
|
|
1602
|
+
|
|
1603
|
+
style: _objectSpread({
|
|
1604
|
+
cursor: 'pointer',
|
|
1605
|
+
borderBottomWidth: MULTI_SEL_VALID ? '0' : '1px'
|
|
1606
|
+
}, style),
|
|
1607
|
+
autoComplete: "off"
|
|
1608
|
+
}, attributes)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
|
|
1609
|
+
ref: valueInputRef,
|
|
1610
|
+
type: "hidden",
|
|
1611
|
+
id: idRes,
|
|
1612
|
+
name: name,
|
|
1613
|
+
value: MULTI_SEL_VALID ? controlArr.values.join(',') : controlValue // do not use `defaultValue`
|
|
1614
|
+
}, attributes)), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1615
|
+
className: "arrow position-absolute top-0 end-0 me-2 mt-1",
|
|
1616
|
+
style: {
|
|
1617
|
+
translate: 'all .2s',
|
|
1618
|
+
transform: isOpen ? 'rotate(180deg) translateY(-4px)' : 'rotate(0) translateY(0)',
|
|
1619
|
+
pointerEvents: 'none',
|
|
1620
|
+
display: fetchTrigger ? 'none' : 'inline-block'
|
|
1621
|
+
}
|
|
1622
|
+
}, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1623
|
+
width: "10px",
|
|
1624
|
+
height: "10px",
|
|
1625
|
+
viewBox: "0 -4.5 20 20"
|
|
1626
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
|
|
1627
|
+
stroke: "none",
|
|
1628
|
+
strokeWidth: "1",
|
|
1629
|
+
fill: "none"
|
|
1630
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
|
|
1631
|
+
transform: "translate(-180.000000, -6684.000000)",
|
|
1632
|
+
className: "arrow-fill-g",
|
|
1633
|
+
fill: "#a5a5a5"
|
|
1634
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
|
|
1635
|
+
transform: "translate(56.000000, 160.000000)"
|
|
1636
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1637
|
+
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"
|
|
1638
|
+
})))))), fetchTrigger ? /*#__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", {
|
|
1639
|
+
className: "multifunc-select-multi__control-searchbtn position-absolute top-0 end-0"
|
|
1640
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1641
|
+
type: "button",
|
|
1642
|
+
className: 'btn border-end-0 rounded-pill',
|
|
1643
|
+
onClick: handleFetch
|
|
1644
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1645
|
+
width: "1em",
|
|
1646
|
+
height: "1em",
|
|
1647
|
+
fill: "#a5a5a5",
|
|
1648
|
+
viewBox: "0 0 16 16"
|
|
1649
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1650
|
+
d: "M12.027 9.92L16 13.95 14 16l-4.075-3.976A6.465 6.465 0 0 1 6.5 13C2.91 13 0 10.083 0 6.5 0 2.91 2.917 0 6.5 0 10.09 0 13 2.917 13 6.5a6.463 6.463 0 0 1-.973 3.42zM1.997 6.452c0 2.48 2.014 4.5 4.5 4.5 2.48 0 4.5-2.015 4.5-4.5 0-2.48-2.015-4.5-4.5-4.5-2.48 0-4.5 2.014-4.5 4.5z",
|
|
1651
|
+
fillRule: "evenodd"
|
|
1652
|
+
}))))) : null), MULTI_SEL_VALID ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1653
|
+
ref: rootMultiRef,
|
|
1654
|
+
className: "multifunc-select-multi__wrapper"
|
|
1655
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1656
|
+
className: "multifunc-select-multi__control-wrapper"
|
|
1657
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
|
|
1658
|
+
className: "multifunc-select-multi__list"
|
|
1659
|
+
}, controlArr.labels.map(function (item, index) {
|
|
1660
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
1661
|
+
key: index
|
|
1662
|
+
}, stripHTML(item), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
1663
|
+
href: "#",
|
|
1664
|
+
tabIndex: -1,
|
|
1665
|
+
onClick: handleMultiControlItemRemove,
|
|
1666
|
+
"data-item": controlArr.values[index]
|
|
1667
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1668
|
+
width: "10px",
|
|
1669
|
+
height: "10px",
|
|
1670
|
+
viewBox: "0 0 1024 1024"
|
|
1671
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1672
|
+
fill: "#000",
|
|
1673
|
+
d: "M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z"
|
|
1674
|
+
}))));
|
|
1675
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
1676
|
+
className: "multifunc-select-multi__list-item-placeholder ".concat(typeof placeholder === 'undefined' || placeholder === '' ? 'hide' : '')
|
|
1677
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1678
|
+
className: "multifunc-select-multi__control-blinking-cursor ".concat(generateInputFocusStr() === placeholder && placeholder !== '' && typeof placeholder !== 'undefined' ? 'control-placeholder' : '', " ").concat(generateInputFocusStr() === '|' ? 'animated' : '')
|
|
1679
|
+
}, generateInputFocusStr()))))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1680
|
+
className: "arrow position-absolute top-0 end-0 me-2 mt-1",
|
|
1681
|
+
style: {
|
|
1682
|
+
translate: 'all .2s',
|
|
1683
|
+
transform: isOpen ? 'rotate(180deg) translateY(-4px)' : 'rotate(0) translateY(0)',
|
|
1684
|
+
pointerEvents: 'none',
|
|
1685
|
+
display: fetchTrigger ? 'none' : 'inline-block'
|
|
1686
|
+
}
|
|
1687
|
+
}, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1688
|
+
width: "10px",
|
|
1689
|
+
height: "10px",
|
|
1690
|
+
viewBox: "0 -4.5 20 20"
|
|
1691
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
|
|
1692
|
+
stroke: "none",
|
|
1693
|
+
strokeWidth: "1",
|
|
1694
|
+
fill: "none"
|
|
1695
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
|
|
1696
|
+
transform: "translate(-180.000000, -6684.000000)",
|
|
1697
|
+
className: "arrow-fill-g",
|
|
1698
|
+
fill: "#a5a5a5"
|
|
1699
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
|
|
1700
|
+
transform: "translate(56.000000, 160.000000)"
|
|
1701
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1702
|
+
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"
|
|
1703
|
+
})))))), fetchTrigger ? /*#__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", {
|
|
1704
|
+
className: "multifunc-select-multi__control-searchbtn position-absolute top-0 end-0"
|
|
1705
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1706
|
+
type: "button",
|
|
1707
|
+
className: 'btn border-end-0 rounded-pill',
|
|
1708
|
+
onClick: handleFetch
|
|
1709
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1710
|
+
width: "1em",
|
|
1711
|
+
height: "1em",
|
|
1712
|
+
fill: "#a5a5a5",
|
|
1713
|
+
viewBox: "0 0 16 16"
|
|
1714
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1715
|
+
d: "M12.027 9.92L16 13.95 14 16l-4.075-3.976A6.465 6.465 0 0 1 6.5 13C2.91 13 0 10.083 0 6.5 0 2.91 2.917 0 6.5 0 10.09 0 13 2.917 13 6.5a6.463 6.463 0 0 1-.973 3.42zM1.997 6.452c0 2.48 2.014 4.5 4.5 4.5 2.48 0 4.5-2.015 4.5-4.5 0-2.48-2.015-4.5-4.5-4.5-2.48 0-4.5 2.014-4.5 4.5z",
|
|
1716
|
+
fillRule: "evenodd"
|
|
1717
|
+
}))))) : null) : null, optionsData && !hasErr ? /*#__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", {
|
|
1718
|
+
ref: listRef,
|
|
1719
|
+
className: "list-group position-absolute border shadow small ".concat(winWidth ? '' : 'w-100'),
|
|
1720
|
+
style: {
|
|
1721
|
+
marginTop: '0.2rem',
|
|
1722
|
+
zIndex: depth ? depth : 100,
|
|
1723
|
+
width: WIN_WIDTH
|
|
1724
|
+
},
|
|
1725
|
+
role: "tablist"
|
|
1726
|
+
}, controlTempValue !== null && optionsData.length === 0 ? /*#__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("button", {
|
|
1727
|
+
tabIndex: -1,
|
|
1728
|
+
type: "button",
|
|
1729
|
+
className: "list-group-item list-group-item-action no-match",
|
|
1730
|
+
disabled: true
|
|
1731
|
+
}, fetchNoneInfo || 'No match yet')) : /*#__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", {
|
|
1732
|
+
className: "rounded",
|
|
1733
|
+
style: {
|
|
1734
|
+
backgroundColor: 'var(--bs-list-group-bg)'
|
|
1735
|
+
},
|
|
1736
|
+
ref: listContentRef
|
|
1737
|
+
}, MULTI_SEL_VALID ? /*#__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("button", {
|
|
1738
|
+
tabIndex: -1,
|
|
1739
|
+
type: "button",
|
|
1740
|
+
className: "list-group-item list-group-item-action border-start-0 border-end-0 text-secondary bg-light multifunc-select-multi__control-select-all",
|
|
1741
|
+
role: "tab",
|
|
1742
|
+
style: {
|
|
1743
|
+
display: multiSelect !== null && multiSelect !== void 0 && multiSelect.selectAll ? 'block' : 'none'
|
|
1744
|
+
}
|
|
1745
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
1746
|
+
tabIndex: -1,
|
|
1747
|
+
href: "#",
|
|
1748
|
+
onClick: handleSelectAll,
|
|
1749
|
+
className: "btn btn-secondary",
|
|
1750
|
+
dangerouslySetInnerHTML: {
|
|
1751
|
+
__html: "".concat((multiSelect === null || multiSelect === void 0 ? void 0 : multiSelect.selectAllLabel) || 'Select all options')
|
|
1752
|
+
}
|
|
1753
|
+
}))) : null, optionsData ? optionsData.map(function (item, index) {
|
|
1754
|
+
var startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
1755
|
+
var endItemBorder = index === optionsData.length - 1 ? 'border-bottom-0' : '';
|
|
1756
|
+
if (!MULTI_SEL_VALID) {
|
|
1757
|
+
// ++++++++++++++++++++
|
|
1758
|
+
// Single selection
|
|
1759
|
+
// ++++++++++++++++++++
|
|
1760
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1761
|
+
tabIndex: -1,
|
|
1762
|
+
onClick: handleSelect,
|
|
1763
|
+
type: "button",
|
|
1764
|
+
"data-index": index,
|
|
1765
|
+
key: index,
|
|
1766
|
+
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder, " border-bottom-0"),
|
|
1767
|
+
"data-value": "".concat(item.value),
|
|
1768
|
+
"data-label": "".concat(item.label),
|
|
1769
|
+
"data-querystring": "".concat(item.queryString),
|
|
1770
|
+
role: "tab",
|
|
1771
|
+
dangerouslySetInnerHTML: {
|
|
1772
|
+
__html: item.label
|
|
1773
|
+
}
|
|
1774
|
+
});
|
|
1775
|
+
} else {
|
|
1776
|
+
// ++++++++++++++++++++
|
|
1777
|
+
// Multiple selection
|
|
1778
|
+
// ++++++++++++++++++++
|
|
1779
|
+
var itemSelected = multiSelControlOptionExist(controlArr.values, item.value) ? true : false;
|
|
1780
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1781
|
+
tabIndex: -1,
|
|
1782
|
+
onClick: handleSelect,
|
|
1783
|
+
type: "button",
|
|
1784
|
+
"data-index": index,
|
|
1785
|
+
key: index,
|
|
1786
|
+
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder, " border-bottom-0 ").concat(itemSelected ? 'list-group-item-secondary item-selected' : ''),
|
|
1787
|
+
"data-value": "".concat(item.value),
|
|
1788
|
+
"data-label": "".concat(item.label),
|
|
1789
|
+
"data-querystring": "".concat(item.queryString),
|
|
1790
|
+
role: "tab"
|
|
1791
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
1792
|
+
className: "d-inline-block me-1 "
|
|
1793
|
+
}, !itemSelected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1794
|
+
width: "1.2em",
|
|
1795
|
+
height: "1.2em",
|
|
1796
|
+
viewBox: "0 0 24 24",
|
|
1797
|
+
fill: "none"
|
|
1798
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1799
|
+
id: "Vector",
|
|
1800
|
+
d: "M4 7.2002V16.8002C4 17.9203 4 18.4801 4.21799 18.9079C4.40973 19.2842 4.71547 19.5905 5.0918 19.7822C5.5192 20 6.07899 20 7.19691 20H16.8031C17.921 20 18.48 20 18.9074 19.7822C19.2837 19.5905 19.5905 19.2842 19.7822 18.9079C20 18.4805 20 17.9215 20 16.8036V7.19691C20 6.07899 20 5.5192 19.7822 5.0918C19.5905 4.71547 19.2837 4.40973 18.9074 4.21799C18.4796 4 17.9203 4 16.8002 4H7.2002C6.08009 4 5.51962 4 5.0918 4.21799C4.71547 4.40973 4.40973 4.71547 4.21799 5.0918C4 5.51962 4 6.08009 4 7.2002Z",
|
|
1801
|
+
stroke: "#000000",
|
|
1802
|
+
strokeWidth: "2",
|
|
1803
|
+
strokeLinecap: "round",
|
|
1804
|
+
strokeLinejoin: "round"
|
|
1805
|
+
})) : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
1806
|
+
width: "1.2em",
|
|
1807
|
+
height: "1.2em",
|
|
1808
|
+
fill: "#000000",
|
|
1809
|
+
viewBox: "0 0 24 24"
|
|
1810
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
1811
|
+
d: "M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"
|
|
1812
|
+
}))), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1813
|
+
dangerouslySetInnerHTML: {
|
|
1814
|
+
__html: item.label
|
|
1815
|
+
}
|
|
1816
|
+
}));
|
|
1817
|
+
}
|
|
1818
|
+
}) : null)))) : null));
|
|
1819
|
+
});
|
|
1820
|
+
/* harmony default export */ const src = (MultiFuncSelect);
|
|
1821
|
+
})();
|
|
1822
|
+
|
|
1823
|
+
/******/ return __webpack_exports__;
|
|
1824
|
+
/******/ })()
|
|
1825
|
+
;
|
|
1826
|
+
});
|