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.
Files changed (246) hide show
  1. package/BackToTop/index.css +34 -0
  2. package/BackToTop/index.d.ts +11 -0
  3. package/BackToTop/index.js +458 -0
  4. package/CascadingSelect/index.css +159 -0
  5. package/CascadingSelect/index.d.ts +56 -0
  6. package/CascadingSelect/index.js +958 -0
  7. package/CascadingSelectE2E/index.css +159 -0
  8. package/CascadingSelectE2E/index.d.ts +60 -0
  9. package/CascadingSelectE2E/index.js +1126 -0
  10. package/Checkbox/index.d.ts +30 -0
  11. package/Checkbox/index.js +226 -0
  12. package/ColorPicker/index.css +38 -0
  13. package/ColorPicker/index.d.ts +27 -0
  14. package/ColorPicker/index.js +246 -0
  15. package/DigitalClock/index.d.ts +7 -0
  16. package/DigitalClock/index.js +208 -0
  17. package/DropdownMenu/index.css +127 -0
  18. package/DropdownMenu/index.d.ts +37 -0
  19. package/DropdownMenu/index.js +237 -0
  20. package/DynamicFields/index.d.ts +26 -0
  21. package/DynamicFields/index.js +412 -0
  22. package/File/index.d.ts +36 -0
  23. package/File/index.js +473 -0
  24. package/Input/index.d.ts +42 -0
  25. package/Input/index.js +286 -0
  26. package/LiveSearch/index.d.ts +37 -0
  27. package/LiveSearch/index.js +1195 -0
  28. package/ModalDialog/index.d.ts +60 -0
  29. package/ModalDialog/index.js +725 -0
  30. package/ModeSwitch/index.d.ts +17 -0
  31. package/ModeSwitch/index.js +202 -0
  32. package/MultiFuncSelect/index.css +178 -0
  33. package/MultiFuncSelect/index.d.ts +67 -0
  34. package/MultiFuncSelect/index.js +1826 -0
  35. package/MultilevelDropdownMenu/index.css +35 -0
  36. package/MultilevelDropdownMenu/index.d.ts +25 -0
  37. package/MultilevelDropdownMenu/index.js +464 -0
  38. package/Pagination/index.d.ts +49 -0
  39. package/Pagination/index.js +341 -0
  40. package/README.md +108 -0
  41. package/Radio/index.d.ts +31 -0
  42. package/Radio/index.js +246 -0
  43. package/RangeSlider/index.css +149 -0
  44. package/RangeSlider/index.d.ts +21 -0
  45. package/RangeSlider/index.js +730 -0
  46. package/ScrollReveal/index.css +23 -0
  47. package/ScrollReveal/index.d.ts +21 -0
  48. package/ScrollReveal/index.js +216 -0
  49. package/Scrollbar/index.css +168 -0
  50. package/Scrollbar/index.d.ts +15 -0
  51. package/Scrollbar/index.js +605 -0
  52. package/SearchBar/index.d.ts +32 -0
  53. package/SearchBar/index.js +246 -0
  54. package/Select/index.d.ts +34 -0
  55. package/Select/index.js +331 -0
  56. package/ShowMoreLess/index.css +23 -0
  57. package/ShowMoreLess/index.d.ts +30 -0
  58. package/ShowMoreLess/index.js +202 -0
  59. package/Switch/index.d.ts +29 -0
  60. package/Switch/index.js +211 -0
  61. package/Table/index.css +533 -0
  62. package/Table/index.d.ts +25 -0
  63. package/Table/index.js +2113 -0
  64. package/Tabs/index.d.ts +3 -0
  65. package/Tabs/index.js +323 -0
  66. package/TagInput/index.css +90 -0
  67. package/TagInput/index.d.ts +28 -0
  68. package/TagInput/index.js +370 -0
  69. package/Textarea/index.d.ts +30 -0
  70. package/Textarea/index.js +242 -0
  71. package/Toast/index.css +95 -0
  72. package/Toast/index.d.ts +35 -0
  73. package/Toast/index.js +340 -0
  74. package/Tooltip/index.css +240 -0
  75. package/Tooltip/index.d.ts +19 -0
  76. package/Tooltip/index.js +200 -0
  77. package/Tree/index.css +225 -0
  78. package/Tree/index.d.ts +37 -0
  79. package/Tree/index.js +1406 -0
  80. package/all.d.ts +33 -0
  81. package/all.js +35 -0
  82. package/lib/cjs/BackToTop/index.d.ts +11 -0
  83. package/lib/cjs/BackToTop/index.js +458 -0
  84. package/lib/cjs/CascadingSelect/index.d.ts +56 -0
  85. package/lib/cjs/CascadingSelect/index.js +958 -0
  86. package/lib/cjs/CascadingSelectE2E/index.d.ts +60 -0
  87. package/lib/cjs/CascadingSelectE2E/index.js +1126 -0
  88. package/lib/cjs/Checkbox/index.d.ts +30 -0
  89. package/lib/cjs/Checkbox/index.js +226 -0
  90. package/lib/cjs/ColorPicker/index.d.ts +27 -0
  91. package/lib/cjs/ColorPicker/index.js +246 -0
  92. package/lib/cjs/DigitalClock/index.d.ts +7 -0
  93. package/lib/cjs/DigitalClock/index.js +208 -0
  94. package/lib/cjs/DropdownMenu/index.d.ts +37 -0
  95. package/lib/cjs/DropdownMenu/index.js +237 -0
  96. package/lib/cjs/DynamicFields/index.d.ts +26 -0
  97. package/lib/cjs/DynamicFields/index.js +412 -0
  98. package/lib/cjs/File/index.d.ts +36 -0
  99. package/lib/cjs/File/index.js +473 -0
  100. package/lib/cjs/Input/index.d.ts +42 -0
  101. package/lib/cjs/Input/index.js +286 -0
  102. package/lib/cjs/LiveSearch/index.d.ts +37 -0
  103. package/lib/cjs/LiveSearch/index.js +1195 -0
  104. package/lib/cjs/ModalDialog/index.d.ts +60 -0
  105. package/lib/cjs/ModalDialog/index.js +725 -0
  106. package/lib/cjs/ModeSwitch/index.d.ts +17 -0
  107. package/lib/cjs/ModeSwitch/index.js +202 -0
  108. package/lib/cjs/MultiFuncSelect/index.d.ts +67 -0
  109. package/lib/cjs/MultiFuncSelect/index.js +1826 -0
  110. package/lib/cjs/MultilevelDropdownMenu/index.d.ts +25 -0
  111. package/lib/cjs/MultilevelDropdownMenu/index.js +464 -0
  112. package/lib/cjs/Pagination/index.d.ts +49 -0
  113. package/lib/cjs/Pagination/index.js +341 -0
  114. package/lib/cjs/Radio/index.d.ts +31 -0
  115. package/lib/cjs/Radio/index.js +246 -0
  116. package/lib/cjs/RangeSlider/index.d.ts +21 -0
  117. package/lib/cjs/RangeSlider/index.js +730 -0
  118. package/lib/cjs/ScrollReveal/index.d.ts +21 -0
  119. package/lib/cjs/ScrollReveal/index.js +216 -0
  120. package/lib/cjs/Scrollbar/index.d.ts +15 -0
  121. package/lib/cjs/Scrollbar/index.js +605 -0
  122. package/lib/cjs/SearchBar/index.d.ts +32 -0
  123. package/lib/cjs/SearchBar/index.js +246 -0
  124. package/lib/cjs/Select/index.d.ts +34 -0
  125. package/lib/cjs/Select/index.js +331 -0
  126. package/lib/cjs/ShowMoreLess/index.d.ts +30 -0
  127. package/lib/cjs/ShowMoreLess/index.js +202 -0
  128. package/lib/cjs/Switch/index.d.ts +29 -0
  129. package/lib/cjs/Switch/index.js +211 -0
  130. package/lib/cjs/Table/index.d.ts +25 -0
  131. package/lib/cjs/Table/index.js +2113 -0
  132. package/lib/cjs/Tabs/index.d.ts +3 -0
  133. package/lib/cjs/Tabs/index.js +323 -0
  134. package/lib/cjs/TagInput/index.d.ts +28 -0
  135. package/lib/cjs/TagInput/index.js +370 -0
  136. package/lib/cjs/Textarea/index.d.ts +30 -0
  137. package/lib/cjs/Textarea/index.js +242 -0
  138. package/lib/cjs/Toast/index.d.ts +35 -0
  139. package/lib/cjs/Toast/index.js +340 -0
  140. package/lib/cjs/Tooltip/index.d.ts +19 -0
  141. package/lib/cjs/Tooltip/index.js +200 -0
  142. package/lib/cjs/Tree/index.d.ts +37 -0
  143. package/lib/cjs/Tree/index.js +1406 -0
  144. package/lib/cjs/index.d.ts +33 -0
  145. package/lib/cjs/index.js +35 -0
  146. package/lib/css/BackToTop/index.css +34 -0
  147. package/lib/css/CascadingSelect/index.css +159 -0
  148. package/lib/css/CascadingSelectE2E/index.css +159 -0
  149. package/lib/css/ColorPicker/index.css +38 -0
  150. package/lib/css/DropdownMenu/index.css +127 -0
  151. package/lib/css/MultiFuncSelect/index.css +178 -0
  152. package/lib/css/MultilevelDropdownMenu/index.css +35 -0
  153. package/lib/css/RangeSlider/index.css +149 -0
  154. package/lib/css/ScrollReveal/index.css +23 -0
  155. package/lib/css/Scrollbar/index.css +168 -0
  156. package/lib/css/ShowMoreLess/index.css +23 -0
  157. package/lib/css/Table/index.css +533 -0
  158. package/lib/css/TagInput/index.css +90 -0
  159. package/lib/css/Toast/index.css +95 -0
  160. package/lib/css/Tooltip/index.css +240 -0
  161. package/lib/css/Tree/index.css +225 -0
  162. package/lib/esm/BackToTop/index.scss +47 -0
  163. package/lib/esm/BackToTop/index.tsx +182 -0
  164. package/lib/esm/BackToTop/utils/easing.js +200 -0
  165. package/lib/esm/BackToTop/utils/performance.js +52 -0
  166. package/lib/esm/CascadingSelect/Group.tsx +39 -0
  167. package/lib/esm/CascadingSelect/index.scss +214 -0
  168. package/lib/esm/CascadingSelect/index.tsx +922 -0
  169. package/lib/esm/CascadingSelect/utils/performance.js +52 -0
  170. package/lib/esm/CascadingSelectE2E/Group.tsx +39 -0
  171. package/lib/esm/CascadingSelectE2E/index.scss +214 -0
  172. package/lib/esm/CascadingSelectE2E/index.tsx +1091 -0
  173. package/lib/esm/CascadingSelectE2E/utils/performance.js +52 -0
  174. package/lib/esm/Checkbox/index.tsx +160 -0
  175. package/lib/esm/ColorPicker/index.scss +48 -0
  176. package/lib/esm/ColorPicker/index.tsx +187 -0
  177. package/lib/esm/DigitalClock/index.tsx +72 -0
  178. package/lib/esm/DigitalClock/utils/useInterval.js +43 -0
  179. package/lib/esm/DropdownMenu/Option.tsx +27 -0
  180. package/lib/esm/DropdownMenu/index.scss +180 -0
  181. package/lib/esm/DropdownMenu/index.tsx +148 -0
  182. package/lib/esm/DynamicFields/index.tsx +386 -0
  183. package/lib/esm/File/index.tsx +302 -0
  184. package/lib/esm/Input/index.tsx +233 -0
  185. package/lib/esm/LiveSearch/index.tsx +582 -0
  186. package/lib/esm/LiveSearch/utils/performance.js +52 -0
  187. package/lib/esm/LiveSearch/utils/useThrottle.js +36 -0
  188. package/lib/esm/ModalDialog/index.tsx +479 -0
  189. package/lib/esm/ModalDialog/plugins/BSL/bodyScrollLock.es6.js +262 -0
  190. package/lib/esm/ModalDialog/plugins/BSL/index.ts +2 -0
  191. package/lib/esm/ModeSwitch/index.tsx +82 -0
  192. package/lib/esm/MultiFuncSelect/index.scss +269 -0
  193. package/lib/esm/MultiFuncSelect/index.tsx +1597 -0
  194. package/lib/esm/MultiFuncSelect/utils/performance.js +52 -0
  195. package/lib/esm/MultiFuncSelect/utils/tree.js +103 -0
  196. package/lib/esm/MultiFuncSelect/utils/useThrottle.js +36 -0
  197. package/lib/esm/MultilevelDropdownMenu/MenuList.tsx +230 -0
  198. package/lib/esm/MultilevelDropdownMenu/index.scss +75 -0
  199. package/lib/esm/MultilevelDropdownMenu/index.tsx +71 -0
  200. package/lib/esm/MultilevelDropdownMenu/utils/dom.js +81 -0
  201. package/lib/esm/Pagination/index.tsx +230 -0
  202. package/lib/esm/Pagination/pagination-navigators.tsx +60 -0
  203. package/lib/esm/Radio/index.tsx +201 -0
  204. package/lib/esm/RangeSlider/index.scss +184 -0
  205. package/lib/esm/RangeSlider/index.tsx +223 -0
  206. package/lib/esm/ScrollReveal/index.scss +27 -0
  207. package/lib/esm/ScrollReveal/index.tsx +146 -0
  208. package/lib/esm/Scrollbar/index.scss +217 -0
  209. package/lib/esm/Scrollbar/index.tsx +497 -0
  210. package/lib/esm/Scrollbar/utils/performance.js +52 -0
  211. package/lib/esm/SearchBar/index.tsx +181 -0
  212. package/lib/esm/Select/index.tsx +276 -0
  213. package/lib/esm/ShowMoreLess/index.scss +27 -0
  214. package/lib/esm/ShowMoreLess/index.tsx +144 -0
  215. package/lib/esm/Switch/index.tsx +143 -0
  216. package/lib/esm/Table/TableColgroup.tsx +29 -0
  217. package/lib/esm/Table/TableField.tsx +40 -0
  218. package/lib/esm/Table/TableFieldRow.tsx +212 -0
  219. package/lib/esm/Table/TableHeaders.tsx +146 -0
  220. package/lib/esm/Table/TableRow.tsx +127 -0
  221. package/lib/esm/Table/TableSummaries.tsx +36 -0
  222. package/lib/esm/Table/index.scss +364 -0
  223. package/lib/esm/Table/index.tsx +576 -0
  224. package/lib/esm/Table/table-utils.ts +65 -0
  225. package/lib/esm/Table/utils/dom.js +81 -0
  226. package/lib/esm/Table/utils/performance.js +52 -0
  227. package/lib/esm/Tabs/TabList.tsx +42 -0
  228. package/lib/esm/Tabs/TabPanel.tsx +34 -0
  229. package/lib/esm/Tabs/Tabs.tsx +232 -0
  230. package/lib/esm/Tabs/index.tsx +3 -0
  231. package/lib/esm/TagInput/index.scss +125 -0
  232. package/lib/esm/TagInput/index.tsx +314 -0
  233. package/lib/esm/Textarea/index.tsx +178 -0
  234. package/lib/esm/Toast/Item.tsx +75 -0
  235. package/lib/esm/Toast/index.scss +120 -0
  236. package/lib/esm/Toast/index.tsx +249 -0
  237. package/lib/esm/Tooltip/index.scss +327 -0
  238. package/lib/esm/Tooltip/index.tsx +142 -0
  239. package/lib/esm/Tree/TreeList.tsx +503 -0
  240. package/lib/esm/Tree/index.scss +375 -0
  241. package/lib/esm/Tree/index.tsx +301 -0
  242. package/lib/esm/Tree/init-height.tsx +27 -0
  243. package/lib/esm/Tree/utils/convert-tree.js +29 -0
  244. package/lib/esm/Tree/utils/dom.js +81 -0
  245. package/lib/esm/index.js +31 -0
  246. package/package.json +40 -0
@@ -0,0 +1,1126 @@
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
+ /***/ 787:
67
+ /***/ ((module) => {
68
+
69
+ "use strict";
70
+ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
71
+
72
+ /***/ })
73
+
74
+ /******/ });
75
+ /************************************************************************/
76
+ /******/ // The module cache
77
+ /******/ var __webpack_module_cache__ = {};
78
+ /******/
79
+ /******/ // The require function
80
+ /******/ function __webpack_require__(moduleId) {
81
+ /******/ // Check if module is in cache
82
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
83
+ /******/ if (cachedModule !== undefined) {
84
+ /******/ return cachedModule.exports;
85
+ /******/ }
86
+ /******/ // Create a new module (and put it into the cache)
87
+ /******/ var module = __webpack_module_cache__[moduleId] = {
88
+ /******/ // no module.id needed
89
+ /******/ // no module.loaded needed
90
+ /******/ exports: {}
91
+ /******/ };
92
+ /******/
93
+ /******/ // Execute the module function
94
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
95
+ /******/
96
+ /******/ // Return the exports of the module
97
+ /******/ return module.exports;
98
+ /******/ }
99
+ /******/
100
+ /************************************************************************/
101
+ /******/ /* webpack/runtime/compat get default export */
102
+ /******/ (() => {
103
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
104
+ /******/ __webpack_require__.n = (module) => {
105
+ /******/ var getter = module && module.__esModule ?
106
+ /******/ () => (module['default']) :
107
+ /******/ () => (module);
108
+ /******/ __webpack_require__.d(getter, { a: getter });
109
+ /******/ return getter;
110
+ /******/ };
111
+ /******/ })();
112
+ /******/
113
+ /******/ /* webpack/runtime/define property getters */
114
+ /******/ (() => {
115
+ /******/ // define getter functions for harmony exports
116
+ /******/ __webpack_require__.d = (exports, definition) => {
117
+ /******/ for(var key in definition) {
118
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
119
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
120
+ /******/ }
121
+ /******/ }
122
+ /******/ };
123
+ /******/ })();
124
+ /******/
125
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
126
+ /******/ (() => {
127
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
128
+ /******/ })();
129
+ /******/
130
+ /******/ /* webpack/runtime/make namespace object */
131
+ /******/ (() => {
132
+ /******/ // define __esModule on exports
133
+ /******/ __webpack_require__.r = (exports) => {
134
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
135
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
136
+ /******/ }
137
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
138
+ /******/ };
139
+ /******/ })();
140
+ /******/
141
+ /************************************************************************/
142
+ var __webpack_exports__ = {};
143
+ // This entry need to be wrapped in an IIFE because it need to be in strict mode.
144
+ (() => {
145
+ "use strict";
146
+ // ESM COMPAT FLAG
147
+ __webpack_require__.r(__webpack_exports__);
148
+
149
+ // EXPORTS
150
+ __webpack_require__.d(__webpack_exports__, {
151
+ "default": () => (/* binding */ src)
152
+ });
153
+
154
+ // EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
155
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
156
+ var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
157
+ // EXTERNAL MODULE: ./src/utils/performance.js
158
+ var performance = __webpack_require__(342);
159
+ ;// CONCATENATED MODULE: ./src/Group.tsx
160
+
161
+ function Group(props) {
162
+ var level = props.level,
163
+ columnTitle = props.columnTitle,
164
+ data = props.data,
165
+ selectEv = props.selectEv;
166
+ 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, data.map(function (item, index) {
167
+ if (item.id.toString().indexOf('$EMPTY_ID_') < 0) {
168
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
169
+ key: index,
170
+ "data-index": index,
171
+ "data-value": item.id,
172
+ "data-query": item.queryId,
173
+ className: "cascading-select-e2e__opt ".concat(item.current ? 'active' : ''),
174
+ onClick: function onClick(e) {
175
+ return selectEv(e, item, index);
176
+ },
177
+ dangerouslySetInnerHTML: {
178
+ __html: item.name
179
+ }
180
+ });
181
+ } else {
182
+ return columnTitle[level] === '' ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("h3", {
183
+ key: index,
184
+ "data-index": index,
185
+ "data-value": item.id,
186
+ "data-query": item.queryId,
187
+ onClick: function onClick(e) {
188
+ return selectEv(e, item, index);
189
+ },
190
+ className: "cascading-select-e2e__opt-header ".concat(item.current ? 'active' : ''),
191
+ dangerouslySetInnerHTML: {
192
+ __html: columnTitle[level]
193
+ }
194
+ });
195
+ }
196
+ }));
197
+ }
198
+ ;// CONCATENATED MODULE: ./src/index.tsx
199
+ var _excluded = ["wrapperClassName", "controlClassName", "disabled", "required", "value", "label", "placeholder", "name", "id", "columnTitle", "depth", "loader", "displayResult", "displayResultArrow", "controlArrow", "valueType", "showCloseBtn", "style", "tabIndex", "triggerClassName", "triggerContent", "fetchArray", "onFetch", "onChange", "onBlur", "onFocus"];
200
+ 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; }
201
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
202
+ 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."); }
203
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
204
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
205
+ 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); }
206
+ 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); }
207
+ 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); } }
208
+ 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); }); }; }
209
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
210
+ 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."); }
211
+ 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); }
212
+ 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; }
213
+ 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; } }
214
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
215
+ 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; }
216
+ 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; }
217
+
218
+
219
+
220
+ var CascadingSelectE2E = function CascadingSelectE2E(props) {
221
+ var wrapperClassName = props.wrapperClassName,
222
+ controlClassName = props.controlClassName,
223
+ disabled = props.disabled,
224
+ required = props.required,
225
+ value = props.value,
226
+ label = props.label,
227
+ placeholder = props.placeholder,
228
+ name = props.name,
229
+ id = props.id,
230
+ columnTitle = props.columnTitle,
231
+ depth = props.depth,
232
+ loader = props.loader,
233
+ displayResult = props.displayResult,
234
+ displayResultArrow = props.displayResultArrow,
235
+ controlArrow = props.controlArrow,
236
+ valueType = props.valueType,
237
+ showCloseBtn = props.showCloseBtn,
238
+ style = props.style,
239
+ tabIndex = props.tabIndex,
240
+ triggerClassName = props.triggerClassName,
241
+ triggerContent = props.triggerContent,
242
+ fetchArray = props.fetchArray,
243
+ onFetch = props.onFetch,
244
+ onChange = props.onChange,
245
+ onBlur = props.onBlur,
246
+ onFocus = props.onFocus,
247
+ attributes = _objectWithoutProperties(props, _excluded);
248
+ var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)();
249
+ var idRes = id || uniqueID;
250
+ var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
251
+ var valRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
252
+ var listRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
253
+
254
+ // current data depth (GLOBAL)
255
+ var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
256
+ _useState2 = _slicedToArray(_useState, 2),
257
+ currentDataDepth = _useState2[0],
258
+ setCurrentDataDepth = _useState2[1];
259
+
260
+ // all data from fetched data (GLOBAL)
261
+ var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
262
+ _useState4 = _slicedToArray(_useState3, 2),
263
+ allData = _useState4[0],
264
+ setAllData = _useState4[1];
265
+
266
+ // options data (GLOBAL)
267
+ var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
268
+ _useState6 = _slicedToArray(_useState5, 2),
269
+ optData = _useState6[0],
270
+ setOptData = _useState6[1];
271
+ var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
272
+ _useState8 = _slicedToArray(_useState7, 2),
273
+ dictionaryData = _useState8[0],
274
+ setDictionaryData = _useState8[1];
275
+ var _useState9 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
276
+ _useState10 = _slicedToArray(_useState9, 2),
277
+ loading = _useState10[0],
278
+ setLoading = _useState10[1];
279
+ var _useState11 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
280
+ _useState12 = _slicedToArray(_useState11, 2),
281
+ columnTitleData = _useState12[0],
282
+ setColumnTitleData = _useState12[1];
283
+ var _useState13 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
284
+ _useState14 = _slicedToArray(_useState13, 2),
285
+ hasErr = _useState14[0],
286
+ setHasErr = _useState14[1];
287
+ var _useState15 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
288
+ _useState16 = _slicedToArray(_useState15, 2),
289
+ firstDataFeched = _useState16[0],
290
+ setFirstDataFeched = _useState16[1];
291
+ var _useState17 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
292
+ _useState18 = _slicedToArray(_useState17, 2),
293
+ changedVal = _useState18[0],
294
+ setChangedVal = _useState18[1];
295
+ var windowScrollUpdate = (0,performance.debounce)(handleScrollEvent, 500);
296
+
297
+ //for variable
298
+ var _useState19 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
299
+ _useState20 = _slicedToArray(_useState19, 2),
300
+ data = _useState20[0],
301
+ setData = _useState20[1];
302
+ var _useState21 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
303
+ labels: [],
304
+ values: [],
305
+ queryIds: []
306
+ }),
307
+ _useState22 = _slicedToArray(_useState21, 2),
308
+ selectedData = _useState22[0],
309
+ setSelectedData = _useState22[1];
310
+ var _useState23 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
311
+ _useState24 = _slicedToArray(_useState23, 2),
312
+ isShow = _useState24[0],
313
+ setIsShow = _useState24[1];
314
+
315
+ /**
316
+ * Check if an element is in the viewport
317
+ * @param {HTMLElement} elem
318
+ * @returns {boolean}
319
+ */
320
+ function isInViewport(elem) {
321
+ var bounding = elem.getBoundingClientRect();
322
+ return bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth);
323
+ }
324
+ function handleScrollEvent() {
325
+ getPlacement(listRef.current, true);
326
+ }
327
+
328
+ //
329
+ function getPlacement(el) {
330
+ var restorePos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
331
+ if (el === null) return;
332
+ var PLACEMENT_TOP = 'top-0';
333
+ var PLACEMENT_BOTTOMEND = 'bottom-0';
334
+ var PLACEMENT_RIGHT = 'end-0';
335
+ var PLACEMENT_LEFT = 'start-0';
336
+
337
+ //restore position
338
+ if (restorePos) {
339
+ if (isInViewport(el)) {
340
+ el.classList.remove(PLACEMENT_BOTTOMEND);
341
+ el.style.removeProperty('bottom');
342
+ }
343
+ return;
344
+ }
345
+
346
+ // Adjust position
347
+ if (!isInViewport(el)) {
348
+ el.classList.add(PLACEMENT_BOTTOMEND);
349
+ el.style.setProperty('bottom', -1 + 'px', "important");
350
+ }
351
+ }
352
+ function fetchData(_x2, _x3, _x4) {
353
+ return _fetchData.apply(this, arguments);
354
+ } //
355
+ function _fetchData() {
356
+ _fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_fetchArray, params, dataDepth) {
357
+ var parentId,
358
+ fetchFuncAsync,
359
+ fetchFuncMethod,
360
+ fetchCallback,
361
+ response,
362
+ _ORGIN_DATA,
363
+ _TEMP_ALL_DATA,
364
+ _EMPTY_SUPPORTED_DATA,
365
+ _temp_optData,
366
+ childList,
367
+ _args = arguments;
368
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
369
+ while (1) switch (_context.prev = _context.next) {
370
+ case 0:
371
+ parentId = _args.length > 3 && _args[3] !== undefined ? _args[3] : 0;
372
+ fetchFuncAsync = _fetchArray.fetchFuncAsync;
373
+ fetchFuncMethod = _fetchArray.fetchFuncMethod;
374
+ fetchCallback = _fetchArray.fetchCallback;
375
+ if (!(_typeof(fetchFuncAsync) === 'object')) {
376
+ _context.next = 27;
377
+ break;
378
+ }
379
+ //
380
+ setLoading(true);
381
+ _context.next = 8;
382
+ return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
383
+ case 8:
384
+ response = _context.sent;
385
+ _ORGIN_DATA = response.data;
386
+ _TEMP_ALL_DATA = []; // loading
387
+ setLoading(false);
388
+ if (!(typeof _ORGIN_DATA[0] === 'undefined')) {
389
+ _context.next = 14;
390
+ break;
391
+ }
392
+ return _context.abrupt("return");
393
+ case 14:
394
+ // reset data structure
395
+ if (typeof fetchCallback === 'function') {
396
+ _ORGIN_DATA = fetchCallback(_ORGIN_DATA);
397
+ }
398
+
399
+ // Determine whether the data structure matches
400
+ if (_ORGIN_DATA.length > 0 && typeof _ORGIN_DATA[0].id === 'undefined') {
401
+ console.warn('The data structure does not match, please refer to the example in the component documentation.');
402
+ setHasErr(true);
403
+ _ORGIN_DATA = [];
404
+ }
405
+
406
+ // add data depth
407
+ _ORGIN_DATA.forEach(function (item) {
408
+ item.depth = dataDepth;
409
+ });
410
+ if (dataDepth === 0) {
411
+ // STEP 1: ===========
412
+ // all data from fetched data
413
+ _TEMP_ALL_DATA = JSON.parse(JSON.stringify(_ORGIN_DATA));
414
+ setAllData(_TEMP_ALL_DATA);
415
+
416
+ // STEP 2: ===========
417
+ // dictionary data (orginal)
418
+ setDictionaryData(_TEMP_ALL_DATA);
419
+ }
420
+ if (dataDepth > 0) {
421
+ // STEP 1: ===========
422
+ // all data from fetched data
423
+ _TEMP_ALL_DATA = allData;
424
+ addChildrenOpt(_TEMP_ALL_DATA, parentId, _ORGIN_DATA);
425
+
426
+ // STEP 2: ===========
427
+ // dictionary data (orginal)
428
+ setDictionaryData(_TEMP_ALL_DATA);
429
+ }
430
+
431
+ // STEP 3: ===========
432
+ // Add an empty item to each list to support empty item selection
433
+ _EMPTY_SUPPORTED_DATA = JSON.parse(JSON.stringify(_TEMP_ALL_DATA));
434
+ addEmptyOpt(_EMPTY_SUPPORTED_DATA, 0);
435
+
436
+ // STEP 4: ===========
437
+ // Turn the data of each group into an array
438
+
439
+ if (dataDepth === 0) {
440
+ _temp_optData = [_EMPTY_SUPPORTED_DATA];
441
+ setOptData(_temp_optData);
442
+ setData(_temp_optData);
443
+ }
444
+ if (dataDepth > 0) {
445
+ _temp_optData = data;
446
+
447
+ // Add an empty item to each list to support empty item selection
448
+ addEmptyOpt(_ORGIN_DATA, 0);
449
+ childList = _ORGIN_DATA;
450
+ _temp_optData[dataDepth] = childList;
451
+ setOptData(_temp_optData);
452
+ setData(optData);
453
+ }
454
+
455
+ // STEP 5: ===========
456
+ //
457
+ onFetch === null || onFetch === void 0 ? void 0 : onFetch(_EMPTY_SUPPORTED_DATA, _ORGIN_DATA);
458
+ return _context.abrupt("return", [_ORGIN_DATA, _EMPTY_SUPPORTED_DATA]);
459
+ case 27:
460
+ return _context.abrupt("return", []);
461
+ case 28:
462
+ case "end":
463
+ return _context.stop();
464
+ }
465
+ }, _callee);
466
+ }));
467
+ return _fetchData.apply(this, arguments);
468
+ }
469
+ function doFetch(dataDepthMax) {
470
+ var dataDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
471
+ var parentId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
472
+ var emptyAction = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
473
+ // if empty selection is selected
474
+ if (emptyAction) return;
475
+
476
+ // If the depth is max, no more requests
477
+ if (dataDepthMax) return;
478
+
479
+ // other
480
+ if (typeof fetchArray[dataDepth] === 'undefined') return new Promise(function (resolve, reject) {
481
+ return resolve([[], []]);
482
+ });
483
+
484
+ // data fetch action
485
+ var _oparams = fetchArray[dataDepth].fetchFuncMethodParams || [];
486
+ var _params = _oparams.map(function (item) {
487
+ return item !== '$QUERY_ID' ? item : parentId;
488
+ });
489
+ return fetchData(fetchArray[dataDepth], _params.join(','), dataDepth, parentId);
490
+ }
491
+ function handleFocus(event) {
492
+ rootRef.current.classList.add('focus');
493
+
494
+ //
495
+ handleDisplayOptions(null);
496
+
497
+ //
498
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
499
+ }
500
+ function handleBlur(event) {
501
+ //----
502
+ //remove focus style
503
+ rootRef.current.classList.remove('focus');
504
+
505
+ //
506
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
507
+ }
508
+
509
+ /**
510
+ * If clicked on outside of element
511
+ */
512
+ function handleClickOutside(event) {
513
+ // svg element
514
+ if (_typeof(event.target.className) === 'object') return;
515
+ if (event.target.className != '' && event.target.className.indexOf('cascading-select-e2e__wrapper') < 0 && event.target.className.indexOf('form-control') < 0 && event.target.className.indexOf('cascading-select-e2e__trigger') < 0 && event.target.className.indexOf('cascading-select-e2e__items') < 0 && event.target.className.indexOf('cascading-select-e2e__opt') < 0) {
516
+ setIsShow(false);
517
+ }
518
+ }
519
+ function handleDisplayOptions(event) {
520
+ if (event) event.preventDefault();
521
+ setIsShow(true);
522
+
523
+ // Execute the fetch task
524
+ if (!firstDataFeched) {
525
+ setLoading(true);
526
+ setFirstDataFeched(true);
527
+ doFetch(false, currentDataDepth, 0, false);
528
+ }
529
+
530
+ // window position
531
+ setTimeout(function () {
532
+ getPlacement(listRef.current);
533
+ }, 0);
534
+ }
535
+ function handleClickItem(e, resValue, index, level) {
536
+ var dataDepthMax = resValue.depth === fetchArray.length - 1;
537
+ var parentId = e.currentTarget.dataset.query;
538
+ var emptyAction = resValue.id.toString().indexOf('$EMPTY_ID_') < 0 ? false : true;
539
+
540
+ // update data depth
541
+ //////////////////////////////////////////
542
+ setCurrentDataDepth(resValue.depth + 1);
543
+ setCurrentDataDepth(function (prevState) {
544
+ var _currentDataDepth = resValue.depth + 1;
545
+
546
+ // Execute the fetch task
547
+ //////////////////////////////////////////
548
+ doFetch(dataDepthMax, _currentDataDepth, parentId, emptyAction);
549
+ return _currentDataDepth;
550
+ });
551
+
552
+ // update value
553
+ //////////////////////////////////////////
554
+ var inputVal = updateValue(dictionaryData, resValue.id, level);
555
+
556
+ // callback
557
+ //////////////////////////////////////////
558
+ if (typeof onChange === 'function') {
559
+ onChange(valRef.current, resValue, index, level, inputVal);
560
+ }
561
+
562
+ // update data
563
+ //////////////////////////////////////////
564
+ var newData = data; // such as: [Array(6), Array(3)]
565
+
566
+ // All the elements from start(array.length - start) to the end of the array will be deleted.
567
+ newData.splice(level + 1);
568
+
569
+ // active status
570
+ if (resValue.children) {
571
+ var childList = resValue.children;
572
+ markAllItems(childList);
573
+ newData[level + 1] = childList;
574
+ }
575
+ markCurrent(newData[level], index);
576
+
577
+ // close modal
578
+ //////////////////////////////////////////
579
+ if (dataDepthMax && resValue.id.toString().indexOf('$EMPTY_ID_') < 0) {
580
+ setIsShow(false);
581
+
582
+ // update data depth
583
+ setCurrentDataDepth(0);
584
+ }
585
+ }
586
+
587
+ /**
588
+ * Active the selected item
589
+ * @param arr
590
+ * @param index
591
+ * @returns
592
+ */
593
+ function markCurrent(arr, index) {
594
+ // click an item
595
+ //////////////////////////////////////////
596
+ for (var i = 0; i < arr.length; i++) {
597
+ if (i === index) {
598
+ arr[i].current = true;
599
+ } else {
600
+ arr[i].current = false;
601
+ }
602
+ }
603
+
604
+ // return result
605
+ //////////////////////////////////////////
606
+ return arr;
607
+ }
608
+
609
+ /**
610
+ * Deactivate all items
611
+ * @param arr
612
+ * @returns
613
+ */
614
+ function markAllItems(arr) {
615
+ for (var i = 0; i < arr.length; i++) {
616
+ arr[i].current = false;
617
+ if (arr[i].children) markAllItems(arr[i].children);
618
+ }
619
+ }
620
+ function updateValue(arr, targetVal) {
621
+ var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
622
+ var inputEl = valRef.current;
623
+ var _valueData, _labelData, _queryIdsData;
624
+ if (targetVal.toString().indexOf('$EMPTY_ID_') >= 0) {
625
+ // If clearing the current column
626
+ //////////////////////////////////////////
627
+ _valueData = selectedData.values;
628
+ _labelData = selectedData.labels;
629
+ _queryIdsData = selectedData.queryIds;
630
+
631
+ // update result to input
632
+ _valueData.splice(level);
633
+ _labelData.splice(level);
634
+ _queryIdsData.splice(level);
635
+
636
+ //
637
+ setSelectedData({
638
+ labels: _labelData,
639
+ values: _valueData,
640
+ queryIds: _queryIdsData
641
+ });
642
+ } else {
643
+ // click an item
644
+ //////////////////////////////////////////
645
+ //search JSON key that contains specific string
646
+ var _labels = queryResultOfJSON(arr, targetVal, 'value');
647
+ var _values = queryResultOfJSON(arr, targetVal, 'key');
648
+ var _queryIds = queryResultOfJSON(arr, targetVal, 'query');
649
+
650
+ // update result to input
651
+ _valueData = _values ? _values.map(function (item) {
652
+ return item;
653
+ }) : [];
654
+ _labelData = _labels ? _labels.map(function (item) {
655
+ return item;
656
+ }) : [];
657
+ _queryIdsData = _queryIds ? _queryIds.map(function (item) {
658
+ return item;
659
+ }) : [];
660
+
661
+ //
662
+ setSelectedData({
663
+ labels: _labelData,
664
+ values: _valueData,
665
+ queryIds: _queryIdsData
666
+ });
667
+ }
668
+
669
+ // update selected data
670
+ //////////////////////////////////////////
671
+ var inputVal_0 = _valueData.map(function (item, i) {
672
+ return "".concat(item, "[").concat(_queryIdsData[i], "]");
673
+ }).join(',');
674
+ var inputVal_1 = _labelData.map(function (item, i) {
675
+ return "".concat(item, "[").concat(_queryIdsData[i], "]");
676
+ }).join(',');
677
+ if (valueType === 'value') {
678
+ if (inputEl !== null) setChangedVal(inputVal_0);
679
+ } else {
680
+ if (inputEl !== null) setChangedVal(inputVal_1);
681
+ }
682
+ return {
683
+ 0: inputVal_0,
684
+ 1: inputVal_1
685
+ };
686
+ }
687
+ function initDefaultValue(defaultValue) {
688
+ var _doFetch;
689
+ // change the value to trigger component rendering
690
+ if (typeof defaultValue === 'undefined' || defaultValue === '') {
691
+ setSelectedData({
692
+ labels: [],
693
+ values: [],
694
+ queryIds: []
695
+ });
696
+ setAllData([]);
697
+ setDictionaryData([]);
698
+ setOptData([]);
699
+ setData([]);
700
+ setChangedVal('');
701
+ setFirstDataFeched(false);
702
+ return;
703
+ } else {
704
+ setChangedVal(defaultValue);
705
+ }
706
+
707
+ //
708
+ setFirstDataFeched(true);
709
+ (_doFetch = doFetch(false, 0, 0, false)) === null || _doFetch === void 0 ? void 0 : _doFetch.then(function (firstColResponse) {
710
+ var _ORGIN_DATA = firstColResponse[0];
711
+ var _CHILDREN_DATA = firstColResponse[1];
712
+ var activedIndex;
713
+ var allFetch = [];
714
+ var rowQueryAttr = valueType === 'value' ? 'id' : 'name';
715
+ var targetVal = defaultValue.match(/(\[.*?\])/gi).map(function (item, i) {
716
+ return defaultValue.split(',')[i].replace(item, '');
717
+ });
718
+ var queryIds = defaultValue.match(/[^\[]+(?=(\[ \])|\])/gi);
719
+
720
+ //
721
+ var _TEMP_ALL_DATA = [];
722
+
723
+ //
724
+ var _allColumnsData = [];
725
+ var _allLables = [];
726
+ var _allValues = [];
727
+
728
+ // loop over each column
729
+ //////////////////////////////////////////
730
+ var _loop = function _loop(col) {
731
+ if (col === 0) {
732
+ // STEP 1: ===========
733
+ //active item from current column
734
+ var newData = JSON.parse(JSON.stringify(_CHILDREN_DATA));
735
+ activedIndex = _CHILDREN_DATA.findIndex(function (item) {
736
+ return item[rowQueryAttr].toString() === targetVal[col].toString();
737
+ });
738
+ markAllItems(newData);
739
+ markCurrent(newData, activedIndex);
740
+
741
+ // STEP 2: ===========
742
+ // all data from fetched data
743
+ _TEMP_ALL_DATA = _ORGIN_DATA;
744
+
745
+ // STEP 3: ===========
746
+ // dictionary data (orginal)
747
+ // Same as the `STEP 2`
748
+
749
+ // STEP 4: ===========
750
+ // update result data
751
+ if (activedIndex !== -1) {
752
+ _allLables.push(newData[activedIndex].name);
753
+ _allValues.push(newData[activedIndex].id);
754
+ }
755
+ _allColumnsData.push(newData);
756
+ }
757
+ if (col > 0) {
758
+ allFetch.push(doFetch(false, col, queryIds[col - 1], false));
759
+ }
760
+ };
761
+ for (var col = 0; col <= targetVal.length; col++) {
762
+ _loop(col);
763
+ }
764
+
765
+ // fetch all columns except the first
766
+ //////////////////////////////////////////
767
+ Promise.all(allFetch).then(function (values) {
768
+ values.filter(function (v) {
769
+ return typeof v !== 'undefined';
770
+ }).forEach(function (colResponse, i) {
771
+ var _CURRENT_COL_DATA = colResponse[0];
772
+ var curDepth = i + 1;
773
+
774
+ // STEP 1: ===========
775
+ //active item from current column
776
+ var newData = JSON.parse(JSON.stringify(_CURRENT_COL_DATA));
777
+ activedIndex = newData.findIndex(function (item) {
778
+ if (typeof targetVal[curDepth] !== 'undefined') {
779
+ return item[rowQueryAttr].toString() === targetVal[curDepth].toString();
780
+ }
781
+ });
782
+ markAllItems(newData);
783
+ markCurrent(newData, activedIndex);
784
+
785
+ // STEP 2: ===========
786
+ // all data from fetched data
787
+ if (typeof values[curDepth] !== 'undefined') {
788
+ var childList = values[curDepth][0];
789
+ newData[activedIndex].children = childList;
790
+ }
791
+ _TEMP_ALL_DATA.forEach(function (item) {
792
+ if (item.id === queryIds[i]) item.children = newData;
793
+ });
794
+
795
+ // STEP 3: ===========
796
+ // dictionary data (orginal)
797
+ setDictionaryData(newData);
798
+
799
+ // STEP 4: ===========
800
+ // update result data
801
+ if (activedIndex !== -1) {
802
+ _allLables.push(newData[activedIndex].name);
803
+ _allValues.push(newData[activedIndex].id);
804
+ }
805
+ _allColumnsData.push(newData);
806
+ return true;
807
+ });
808
+
809
+ // STEP 5: ===========
810
+ // all data from fetched data
811
+ setAllData(_TEMP_ALL_DATA);
812
+
813
+ // STEP 6: ===========
814
+ // dictionary data (orginal)
815
+ setDictionaryData(_TEMP_ALL_DATA);
816
+
817
+ // STEP 7: ===========
818
+ //update data
819
+ setOptData(_allColumnsData);
820
+ setData(_allColumnsData);
821
+
822
+ // STEP 8: ===========
823
+ //Set a default value
824
+ setSelectedData({
825
+ labels: _allLables,
826
+ values: _allValues,
827
+ queryIds: queryIds
828
+ });
829
+ });
830
+ });
831
+ }
832
+ function fillColumnTitle() {
833
+ var _Array;
834
+ var dataDepth = fetchArray.length;
835
+ var oldColumnTitleData = columnTitle ? columnTitle : [];
836
+ var newColumnTitleData = (_Array = new Array(dataDepth)) === null || _Array === void 0 ? void 0 : _Array.fill('');
837
+ oldColumnTitleData.forEach(function (item, index) {
838
+ newColumnTitleData[index] = item;
839
+ });
840
+
841
+ //
842
+ if (oldColumnTitleData.length > dataDepth) {
843
+ newColumnTitleData.splice(dataDepth, oldColumnTitleData.length - dataDepth);
844
+ }
845
+ setColumnTitleData(newColumnTitleData);
846
+ }
847
+ function addChildrenOpt(obj, parentId, childrenData) {
848
+ obj.forEach(function (item) {
849
+ if (item.id === parentId) item.children = childrenData;
850
+ if (item.children) {
851
+ addChildrenOpt(item.children, parentId, childrenData);
852
+ }
853
+ });
854
+ }
855
+ function addEmptyOpt(obj, index) {
856
+ index++;
857
+ obj.unshift({
858
+ id: "$EMPTY_ID_" + index,
859
+ name: "",
860
+ depth: obj.length === 0 ? 0 : obj[0].depth
861
+ });
862
+ obj.forEach(function (item, depth) {
863
+ if (item.children) {
864
+ addEmptyOpt(item.children, index * (depth + 1));
865
+ }
866
+ });
867
+ }
868
+ function queryResultOfJSON(data, targetVal, returnType) {
869
+ var callbackValueNested = [];
870
+ var lastFirstLevelName = '';
871
+ var loop = true;
872
+ var resDepth = 0;
873
+ var rowQueryAttr = 'id';
874
+ var getIndexOf = function getIndexOf(arr, val) {
875
+ for (var i = 0; i < arr.length; i++) {
876
+ if (arr[i][rowQueryAttr].toString() === val.toString()) return i;
877
+ }
878
+ return -1;
879
+ };
880
+ var searchJsonStr = function searchJsonStr(list, depth) {
881
+ // `depth` is very important, it is used to accurately judge the final result
882
+ if (typeof depth === 'undefined') {
883
+ depth = 0;
884
+ } else {
885
+ depth++;
886
+ }
887
+ for (var i = 0; i < list.length; i++) {
888
+ var row = list[i];
889
+ var callbackValue = void 0;
890
+ if (returnType === 'key') callbackValue = row[rowQueryAttr].toString();
891
+ if (returnType === 'value') callbackValue = row.name.toString();
892
+ if (returnType === 'query') callbackValue = typeof row.queryId !== 'undefined' ? row.queryId.toString() : '';
893
+ if (loop) {
894
+ // get first-level item
895
+ if (getIndexOf(data, row[rowQueryAttr]) !== -1) {
896
+ callbackValueNested.push(callbackValue);
897
+ lastFirstLevelName = callbackValue;
898
+ }
899
+
900
+ // get child-level item
901
+ if (row.children) {
902
+ callbackValueNested.push(callbackValue);
903
+ }
904
+ }
905
+
906
+ //check the value
907
+ if (row[rowQueryAttr].toString() === targetVal.toString()) {
908
+ callbackValueNested.push(callbackValue);
909
+ loop = false;
910
+ resDepth = depth;
911
+ break;
912
+ }
913
+
914
+ // Note: Recursion must be placed here
915
+ if (loop) {
916
+ if (row.children) {
917
+ searchJsonStr(row.children, depth);
918
+ }
919
+ }
920
+ }
921
+ };
922
+ searchJsonStr(data);
923
+
924
+ // (1) Remove duplicate values
925
+ //------------------------------------------
926
+ callbackValueNested = callbackValueNested.filter(function (item, index, arr) {
927
+ return arr.indexOf(item, 0) === index;
928
+ });
929
+
930
+ // (2) Delete needless first-level
931
+ //------------------------------------------
932
+ var resAll = callbackValueNested.slice(callbackValueNested.indexOf(lastFirstLevelName), callbackValueNested.length);
933
+
934
+ // (3) Returns result
935
+ //------------------------------------------
936
+ if (resAll.length > 1) {
937
+ // Get first-level item
938
+ resAll.splice(1);
939
+
940
+ // Get child-level item
941
+ var resChild = callbackValueNested.slice(-resDepth); // Get the last elements in reverse
942
+
943
+ // Combine
944
+ resAll = resAll.concat(resChild);
945
+ }
946
+ return resAll;
947
+ }
948
+ function displayInfo() {
949
+ return selectedData.labels ? selectedData.labels.map(function (item, i, arr) {
950
+ if (arr.length - 1 === i) {
951
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
952
+ key: i
953
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
954
+ dangerouslySetInnerHTML: {
955
+ __html: item
956
+ }
957
+ }));
958
+ } else {
959
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
960
+ key: i
961
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
962
+ dangerouslySetInnerHTML: {
963
+ __html: item
964
+ }
965
+ }), arrowGenerator());
966
+ }
967
+ }) : '';
968
+ }
969
+ function arrowGenerator() {
970
+ return displayResultArrow ? displayResultArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
971
+ viewBox: "0 0 22 22",
972
+ width: "8px"
973
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
974
+ d: "m345.44 248.29l-194.29 194.28c-12.359 12.365-32.397 12.365-44.75 0-12.354-12.354-12.354-32.391 0-44.744l171.91-171.91-171.91-171.9c-12.354-12.359-12.354-32.394 0-44.748 12.354-12.359 32.391-12.359 44.75 0l194.29 194.28c6.177 6.18 9.262 14.271 9.262 22.366 0 8.099-3.091 16.196-9.267 22.373",
975
+ transform: "matrix(.03541-.00013.00013.03541 2.98 3.02)",
976
+ fill: "#a5a5a5"
977
+ }));
978
+ }
979
+ (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
980
+ // column titles
981
+ //--------------
982
+ fillColumnTitle();
983
+
984
+ // Initialize default value (request parameters for each level)
985
+ //--------------
986
+ initDefaultValue(value);
987
+
988
+ // If you use the dynamic form assignment (such as document.getElementById(xxx).value),
989
+ // you need to judge the value of the input obtained by using the macrotask "setInterval()"
990
+ var timer = null;
991
+ var initTimes = 0;
992
+ var hasValue = false;
993
+ timer = setInterval(function () {
994
+ if (initTimes > 5 || hasValue) {
995
+ clearInterval(timer);
996
+ } else {
997
+ if (valRef.current !== null && valRef.current.value !== '' && (typeof value === 'undefined' || value === '')) {
998
+ initDefaultValue(valRef.current.value);
999
+ hasValue = true;
1000
+ }
1001
+ initTimes++;
1002
+ }
1003
+ }, 500);
1004
+
1005
+ //
1006
+ //--------------
1007
+ document.removeEventListener('pointerdown', handleClickOutside);
1008
+ document.addEventListener('pointerdown', handleClickOutside);
1009
+
1010
+ // Add function to the element that should be used as the scrollable area.
1011
+ //--------------
1012
+ window.removeEventListener('scroll', windowScrollUpdate);
1013
+ window.removeEventListener('touchmove', windowScrollUpdate);
1014
+ window.addEventListener('scroll', windowScrollUpdate);
1015
+ window.addEventListener('touchmove', windowScrollUpdate);
1016
+ windowScrollUpdate();
1017
+ return function () {
1018
+ document.removeEventListener('pointerdown', handleClickOutside);
1019
+ window.removeEventListener('scroll', windowScrollUpdate);
1020
+ window.removeEventListener('touchmove', windowScrollUpdate);
1021
+
1022
+ //
1023
+ clearInterval(timer);
1024
+ };
1025
+ }, [value]);
1026
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1027
+ className: wrapperClassName || wrapperClassName === '' ? "cascading-select-e2e__wrapper ".concat(wrapperClassName) : "cascading-select-e2e__wrapper mb-3 position-relative",
1028
+ ref: rootRef
1029
+ }, 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("label", {
1030
+ htmlFor: idRes,
1031
+ className: "form-label"
1032
+ }, label)) : null, triggerContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1033
+ className: triggerClassName ? "cascading-select-e2e__trigger ".concat(triggerClassName) : "cascading-select-e2e__trigger d-inline w-auto",
1034
+ onClick: handleDisplayOptions
1035
+ }, triggerContent)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1036
+ className: "cascading-select-e2e",
1037
+ style: {
1038
+ zIndex: depth ? depth : 100
1039
+ }
1040
+ }, isShow && !hasErr ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1041
+ ref: listRef,
1042
+ className: "cascading-select-e2e__items shadow"
1043
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", null, loading ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1044
+ className: "position-absolute top-0 start-0 mt-1 mx-1"
1045
+ }, loader)) : null, showCloseBtn ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
1046
+ href: "#",
1047
+ tabIndex: -1,
1048
+ onClick: function onClick(e) {
1049
+ e.preventDefault();
1050
+ setIsShow(false);
1051
+ },
1052
+ className: "cascading-select-e2e__close position-absolute top-0 end-0 mt-0 mx-1"
1053
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
1054
+ width: "10px",
1055
+ height: "10px",
1056
+ viewBox: "0 0 1024 1024"
1057
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1058
+ fill: "#000",
1059
+ 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"
1060
+ }))) : null, data.map(function (item, level) {
1061
+ return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
1062
+ key: level
1063
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(Group, {
1064
+ level: level,
1065
+ columnTitle: columnTitleData,
1066
+ data: item,
1067
+ selectEv: function selectEv(e, value, index) {
1068
+ return handleClickItem(e, value, index, level);
1069
+ }
1070
+ }));
1071
+ }))) : null), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1072
+ className: "cascading-select-e2e__val",
1073
+ onClick: handleDisplayOptions
1074
+ }, displayResult ? selectedData.labels && selectedData.labels.length > 0 ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1075
+ className: "cascading-select-e2e__result"
1076
+ }, displayInfo()) : null : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("input", _extends({
1077
+ ref: valRef,
1078
+ id: idRes,
1079
+ name: name,
1080
+ className: controlClassName || controlClassName === '' ? controlClassName : "form-control",
1081
+ placeholder: placeholder,
1082
+ value: changedVal // placeholder will not change if defaultValue is used
1083
+ ,
1084
+ onFocus: handleFocus,
1085
+ onBlur: handleBlur,
1086
+ disabled: disabled || null,
1087
+ required: required || null,
1088
+ style: style,
1089
+ tabIndex: tabIndex || 0,
1090
+ readOnly: true
1091
+ }, attributes)), isShow ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
1092
+ className: "cascading-select-e2e__closemask",
1093
+ onClick: function onClick(e) {
1094
+ e.preventDefault();
1095
+ setIsShow(false);
1096
+ }
1097
+ }) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
1098
+ className: "arrow",
1099
+ style: {
1100
+ pointerEvents: 'none'
1101
+ }
1102
+ }, controlArrow ? controlArrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
1103
+ width: "10px",
1104
+ height: "10px",
1105
+ viewBox: "0 -4.5 20 20"
1106
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
1107
+ stroke: "none",
1108
+ strokeWidth: "1",
1109
+ fill: "none"
1110
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
1111
+ transform: "translate(-180.000000, -6684.000000)",
1112
+ className: "arrow-fill-g",
1113
+ fill: "#a5a5a5"
1114
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", {
1115
+ transform: "translate(56.000000, 160.000000)"
1116
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
1117
+ 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"
1118
+ })))))))));
1119
+ };
1120
+ /* harmony default export */ const src = (CascadingSelectE2E);
1121
+ })();
1122
+
1123
+ /******/ return __webpack_exports__;
1124
+ /******/ })()
1125
+ ;
1126
+ });