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,1406 @@
|
|
|
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
|
+
/***/ 109:
|
|
15
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
16
|
+
|
|
17
|
+
/* module decorator */ module = __webpack_require__.nmd(module);
|
|
18
|
+
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof2(obj) { "@babel/helpers - typeof"; return _typeof2 = "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; }, _typeof2(obj); }
|
|
19
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
20
|
+
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory(__webpack_require__(787));else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(787)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
21
|
+
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
22
|
+
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
23
|
+
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
|
|
24
|
+
})(this, function (__WEBPACK_EXTERNAL_MODULE__787__) {
|
|
25
|
+
return (/******/function () {
|
|
26
|
+
// webpackBootstrap
|
|
27
|
+
/******/
|
|
28
|
+
"use strict";
|
|
29
|
+
|
|
30
|
+
/******/
|
|
31
|
+
var __webpack_modules__ = {
|
|
32
|
+
/***/787: /***/function _(module) {
|
|
33
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
34
|
+
|
|
35
|
+
/***/
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/******/
|
|
39
|
+
};
|
|
40
|
+
/************************************************************************/
|
|
41
|
+
/******/ // The module cache
|
|
42
|
+
/******/
|
|
43
|
+
var __webpack_module_cache__ = {};
|
|
44
|
+
/******/
|
|
45
|
+
/******/ // The require function
|
|
46
|
+
/******/
|
|
47
|
+
function __nested_webpack_require_1471__(moduleId) {
|
|
48
|
+
/******/ // Check if module is in cache
|
|
49
|
+
/******/var cachedModule = __webpack_module_cache__[moduleId];
|
|
50
|
+
/******/
|
|
51
|
+
if (cachedModule !== undefined) {
|
|
52
|
+
/******/return cachedModule.exports;
|
|
53
|
+
/******/
|
|
54
|
+
}
|
|
55
|
+
/******/ // Create a new module (and put it into the cache)
|
|
56
|
+
/******/
|
|
57
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
58
|
+
/******/ // no module.id needed
|
|
59
|
+
/******/ // no module.loaded needed
|
|
60
|
+
/******/exports: {}
|
|
61
|
+
/******/
|
|
62
|
+
};
|
|
63
|
+
/******/
|
|
64
|
+
/******/ // Execute the module function
|
|
65
|
+
/******/
|
|
66
|
+
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_1471__);
|
|
67
|
+
/******/
|
|
68
|
+
/******/ // Return the exports of the module
|
|
69
|
+
/******/
|
|
70
|
+
return module.exports;
|
|
71
|
+
/******/
|
|
72
|
+
}
|
|
73
|
+
/******/
|
|
74
|
+
/************************************************************************/
|
|
75
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
76
|
+
/******/
|
|
77
|
+
(function () {
|
|
78
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
79
|
+
/******/__nested_webpack_require_1471__.n = function (module) {
|
|
80
|
+
/******/var getter = module && module.__esModule ? /******/function () {
|
|
81
|
+
return module['default'];
|
|
82
|
+
} : /******/function () {
|
|
83
|
+
return module;
|
|
84
|
+
};
|
|
85
|
+
/******/
|
|
86
|
+
__nested_webpack_require_1471__.d(getter, {
|
|
87
|
+
a: getter
|
|
88
|
+
});
|
|
89
|
+
/******/
|
|
90
|
+
return getter;
|
|
91
|
+
/******/
|
|
92
|
+
};
|
|
93
|
+
/******/
|
|
94
|
+
})();
|
|
95
|
+
/******/
|
|
96
|
+
/******/ /* webpack/runtime/define property getters */
|
|
97
|
+
/******/
|
|
98
|
+
(function () {
|
|
99
|
+
/******/ // define getter functions for harmony exports
|
|
100
|
+
/******/__nested_webpack_require_1471__.d = function (exports, definition) {
|
|
101
|
+
/******/for (var key in definition) {
|
|
102
|
+
/******/if (__nested_webpack_require_1471__.o(definition, key) && !__nested_webpack_require_1471__.o(exports, key)) {
|
|
103
|
+
/******/Object.defineProperty(exports, key, {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: definition[key]
|
|
106
|
+
});
|
|
107
|
+
/******/
|
|
108
|
+
}
|
|
109
|
+
/******/
|
|
110
|
+
}
|
|
111
|
+
/******/
|
|
112
|
+
};
|
|
113
|
+
/******/
|
|
114
|
+
})();
|
|
115
|
+
/******/
|
|
116
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
117
|
+
/******/
|
|
118
|
+
(function () {
|
|
119
|
+
/******/__nested_webpack_require_1471__.o = function (obj, prop) {
|
|
120
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
121
|
+
};
|
|
122
|
+
/******/
|
|
123
|
+
})();
|
|
124
|
+
/******/
|
|
125
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
126
|
+
/******/
|
|
127
|
+
(function () {
|
|
128
|
+
/******/ // define __esModule on exports
|
|
129
|
+
/******/__nested_webpack_require_1471__.r = function (exports) {
|
|
130
|
+
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
131
|
+
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
132
|
+
value: 'Module'
|
|
133
|
+
});
|
|
134
|
+
/******/
|
|
135
|
+
}
|
|
136
|
+
/******/
|
|
137
|
+
Object.defineProperty(exports, '__esModule', {
|
|
138
|
+
value: true
|
|
139
|
+
});
|
|
140
|
+
/******/
|
|
141
|
+
};
|
|
142
|
+
/******/
|
|
143
|
+
})();
|
|
144
|
+
/******/
|
|
145
|
+
/************************************************************************/
|
|
146
|
+
var __webpack_exports__ = {};
|
|
147
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
148
|
+
(function () {
|
|
149
|
+
__nested_webpack_require_1471__.r(__webpack_exports__);
|
|
150
|
+
/* harmony export */
|
|
151
|
+
__nested_webpack_require_1471__.d(__webpack_exports__, {
|
|
152
|
+
/* harmony export */"default": function _default() {
|
|
153
|
+
return __WEBPACK_DEFAULT_EXPORT__;
|
|
154
|
+
}
|
|
155
|
+
/* harmony export */
|
|
156
|
+
});
|
|
157
|
+
/* harmony import */
|
|
158
|
+
var react__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_1471__(787);
|
|
159
|
+
/* harmony import */
|
|
160
|
+
var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__nested_webpack_require_1471__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
161
|
+
function _typeof(obj) {
|
|
162
|
+
"@babel/helpers - typeof";
|
|
163
|
+
|
|
164
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
165
|
+
return typeof obj;
|
|
166
|
+
} : function (obj) {
|
|
167
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
168
|
+
}, _typeof(obj);
|
|
169
|
+
}
|
|
170
|
+
var _excluded = ["wrapperClassName", "disabled", "required", "value", "label", "name", "id", "checked", "indeterminate", "style", "tabIndex", "onChange", "onBlur", "onFocus"];
|
|
171
|
+
function _extends() {
|
|
172
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
173
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
174
|
+
var source = arguments[i];
|
|
175
|
+
for (var key in source) {
|
|
176
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
177
|
+
target[key] = source[key];
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return target;
|
|
182
|
+
};
|
|
183
|
+
return _extends.apply(this, arguments);
|
|
184
|
+
}
|
|
185
|
+
function ownKeys(object, enumerableOnly) {
|
|
186
|
+
var keys = Object.keys(object);
|
|
187
|
+
if (Object.getOwnPropertySymbols) {
|
|
188
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
189
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
190
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
191
|
+
})), keys.push.apply(keys, symbols);
|
|
192
|
+
}
|
|
193
|
+
return keys;
|
|
194
|
+
}
|
|
195
|
+
function _objectSpread(target) {
|
|
196
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
197
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
198
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
199
|
+
_defineProperty(target, key, source[key]);
|
|
200
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
201
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
return target;
|
|
205
|
+
}
|
|
206
|
+
function _defineProperty(obj, key, value) {
|
|
207
|
+
key = _toPropertyKey(key);
|
|
208
|
+
if (key in obj) {
|
|
209
|
+
Object.defineProperty(obj, key, {
|
|
210
|
+
value: value,
|
|
211
|
+
enumerable: true,
|
|
212
|
+
configurable: true,
|
|
213
|
+
writable: true
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
obj[key] = value;
|
|
217
|
+
}
|
|
218
|
+
return obj;
|
|
219
|
+
}
|
|
220
|
+
function _toPropertyKey(arg) {
|
|
221
|
+
var key = _toPrimitive(arg, "string");
|
|
222
|
+
return _typeof(key) === "symbol" ? key : String(key);
|
|
223
|
+
}
|
|
224
|
+
function _toPrimitive(input, hint) {
|
|
225
|
+
if (_typeof(input) !== "object" || input === null) return input;
|
|
226
|
+
var prim = input[Symbol.toPrimitive];
|
|
227
|
+
if (prim !== undefined) {
|
|
228
|
+
var res = prim.call(input, hint || "default");
|
|
229
|
+
if (_typeof(res) !== "object") return res;
|
|
230
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
231
|
+
}
|
|
232
|
+
return (hint === "string" ? String : Number)(input);
|
|
233
|
+
}
|
|
234
|
+
function _slicedToArray(arr, i) {
|
|
235
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
236
|
+
}
|
|
237
|
+
function _nonIterableRest() {
|
|
238
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
239
|
+
}
|
|
240
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
241
|
+
if (!o) return;
|
|
242
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
243
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
244
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
245
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
246
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
247
|
+
}
|
|
248
|
+
function _arrayLikeToArray(arr, len) {
|
|
249
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
250
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
251
|
+
return arr2;
|
|
252
|
+
}
|
|
253
|
+
function _iterableToArrayLimit(arr, i) {
|
|
254
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
255
|
+
if (null != _i) {
|
|
256
|
+
var _s,
|
|
257
|
+
_e,
|
|
258
|
+
_x,
|
|
259
|
+
_r,
|
|
260
|
+
_arr = [],
|
|
261
|
+
_n = !0,
|
|
262
|
+
_d = !1;
|
|
263
|
+
try {
|
|
264
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
265
|
+
if (Object(_i) !== _i) return;
|
|
266
|
+
_n = !1;
|
|
267
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
268
|
+
} catch (err) {
|
|
269
|
+
_d = !0, _e = err;
|
|
270
|
+
} finally {
|
|
271
|
+
try {
|
|
272
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
273
|
+
} finally {
|
|
274
|
+
if (_d) throw _e;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return _arr;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
function _arrayWithHoles(arr) {
|
|
281
|
+
if (Array.isArray(arr)) return arr;
|
|
282
|
+
}
|
|
283
|
+
function _objectWithoutProperties(source, excluded) {
|
|
284
|
+
if (source == null) return {};
|
|
285
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
286
|
+
var key, i;
|
|
287
|
+
if (Object.getOwnPropertySymbols) {
|
|
288
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
289
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
290
|
+
key = sourceSymbolKeys[i];
|
|
291
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
292
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
293
|
+
target[key] = source[key];
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
return target;
|
|
297
|
+
}
|
|
298
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
299
|
+
if (source == null) return {};
|
|
300
|
+
var target = {};
|
|
301
|
+
var sourceKeys = Object.keys(source);
|
|
302
|
+
var key, i;
|
|
303
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
304
|
+
key = sourceKeys[i];
|
|
305
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
306
|
+
target[key] = source[key];
|
|
307
|
+
}
|
|
308
|
+
return target;
|
|
309
|
+
}
|
|
310
|
+
var Checkbox = /*#__PURE__*/(0, react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function (props, _ref) {
|
|
311
|
+
var wrapperClassName = props.wrapperClassName,
|
|
312
|
+
disabled = props.disabled,
|
|
313
|
+
required = props.required,
|
|
314
|
+
value = props.value,
|
|
315
|
+
label = props.label,
|
|
316
|
+
name = props.name,
|
|
317
|
+
id = props.id,
|
|
318
|
+
checked = props.checked,
|
|
319
|
+
indeterminate = props.indeterminate,
|
|
320
|
+
style = props.style,
|
|
321
|
+
tabIndex = props.tabIndex,
|
|
322
|
+
onChange = props.onChange,
|
|
323
|
+
onBlur = props.onBlur,
|
|
324
|
+
onFocus = props.onFocus,
|
|
325
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
326
|
+
var uniqueID = (0, react__WEBPACK_IMPORTED_MODULE_0__.useId)();
|
|
327
|
+
var idRes = id || uniqueID;
|
|
328
|
+
var rootRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
329
|
+
var valRef = (0, react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
330
|
+
var _useState = (0, react__WEBPACK_IMPORTED_MODULE_0__.useState)(null),
|
|
331
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
332
|
+
val = _useState2[0],
|
|
333
|
+
setVal = _useState2[1];
|
|
334
|
+
function handleFocus(event) {
|
|
335
|
+
rootRef.current.classList.add('focus');
|
|
336
|
+
|
|
337
|
+
//
|
|
338
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
339
|
+
}
|
|
340
|
+
function handleChange(event) {
|
|
341
|
+
var _val = event.target.checked;
|
|
342
|
+
setVal(_val);
|
|
343
|
+
|
|
344
|
+
//----
|
|
345
|
+
//remove focus style
|
|
346
|
+
rootRef.current.classList.remove('focus');
|
|
347
|
+
|
|
348
|
+
//
|
|
349
|
+
if (typeof onChange === 'function') {
|
|
350
|
+
onChange(event, _val);
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function handleBlur(event) {
|
|
354
|
+
//----
|
|
355
|
+
//remove focus style
|
|
356
|
+
rootRef.current.classList.remove('focus');
|
|
357
|
+
|
|
358
|
+
//
|
|
359
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
360
|
+
}
|
|
361
|
+
(0, react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
362
|
+
// default value
|
|
363
|
+
setVal(checked);
|
|
364
|
+
|
|
365
|
+
// Set a checkbox to indeterminate state
|
|
366
|
+
if (typeof indeterminate !== 'undefined') {
|
|
367
|
+
valRef.current.indeterminate = indeterminate;
|
|
368
|
+
}
|
|
369
|
+
}, [checked, indeterminate]);
|
|
370
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
371
|
+
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
|
372
|
+
ref: rootRef
|
|
373
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
374
|
+
className: "form-check"
|
|
375
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
376
|
+
ref: function ref(node) {
|
|
377
|
+
valRef.current = node;
|
|
378
|
+
if (typeof _ref === 'function') {
|
|
379
|
+
_ref(node);
|
|
380
|
+
} else if (_ref) {
|
|
381
|
+
_ref.current = node;
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
tabIndex: tabIndex || 0,
|
|
385
|
+
type: "checkbox",
|
|
386
|
+
className: "form-check-input",
|
|
387
|
+
id: "label-".concat(idRes)
|
|
388
|
+
|
|
389
|
+
// Don't use "name", it's just a container to display the label
|
|
390
|
+
,
|
|
391
|
+
|
|
392
|
+
"data-name": name !== null && name !== void 0 && name.match(/(\[.*?\])/gi) ? "".concat(name.split('[')[0], "-label[]") : "".concat(name, "-label"),
|
|
393
|
+
"data-checkbox": true,
|
|
394
|
+
disabled: disabled || null,
|
|
395
|
+
required: required || null,
|
|
396
|
+
onChange: handleChange,
|
|
397
|
+
onFocus: handleFocus,
|
|
398
|
+
onBlur: handleBlur,
|
|
399
|
+
defaultValue: value || '',
|
|
400
|
+
checked: val // component status will not change if defaultChecked is used
|
|
401
|
+
,
|
|
402
|
+
|
|
403
|
+
style: _objectSpread({
|
|
404
|
+
cursor: 'pointer'
|
|
405
|
+
}, style)
|
|
406
|
+
}, attributes)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
|
407
|
+
type: "hidden",
|
|
408
|
+
id: idRes,
|
|
409
|
+
name: name,
|
|
410
|
+
value: val ? value || '' : '' // do not use `defaultValue`
|
|
411
|
+
}), label ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react__WEBPACK_IMPORTED_MODULE_0___default().Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("label", {
|
|
412
|
+
htmlFor: "label-".concat(idRes),
|
|
413
|
+
className: "form-check-label"
|
|
414
|
+
}, label)) : null)));
|
|
415
|
+
});
|
|
416
|
+
/* harmony default export */
|
|
417
|
+
var __WEBPACK_DEFAULT_EXPORT__ = Checkbox;
|
|
418
|
+
})();
|
|
419
|
+
|
|
420
|
+
/******/
|
|
421
|
+
return __webpack_exports__;
|
|
422
|
+
/******/
|
|
423
|
+
}()
|
|
424
|
+
);
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
/***/ }),
|
|
428
|
+
|
|
429
|
+
/***/ 426:
|
|
430
|
+
/***/ ((module) => {
|
|
431
|
+
|
|
432
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
433
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
434
|
+
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."); }
|
|
435
|
+
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); }
|
|
436
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
437
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
438
|
+
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; }
|
|
439
|
+
/**
|
|
440
|
+
* Dom Utilities
|
|
441
|
+
* @param {HTMLElement} el - Element
|
|
442
|
+
* @param {?String} filter - A filter string
|
|
443
|
+
* @returns HtmlElementCollection
|
|
444
|
+
*/
|
|
445
|
+
function matches(el, filter) {
|
|
446
|
+
if (el && el.nodeType === 1) {
|
|
447
|
+
if (filter) {
|
|
448
|
+
return el.matches(filter);
|
|
449
|
+
}
|
|
450
|
+
return true;
|
|
451
|
+
}
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// the next siblings
|
|
456
|
+
function getNextSiblings(el) {
|
|
457
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
458
|
+
var sibs = [];
|
|
459
|
+
while (el = el.nextSibling) {
|
|
460
|
+
if (matches(el, filter)) {
|
|
461
|
+
sibs.push(el);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return sibs;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// previous siblings
|
|
468
|
+
function getPreviousSiblings(el) {
|
|
469
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
470
|
+
var sibs = [];
|
|
471
|
+
while (el = el.previousSibling) {
|
|
472
|
+
if (matches(el, filter)) {
|
|
473
|
+
sibs.push(el);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
return sibs;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
// parent and get all the siblings
|
|
480
|
+
function getAllSiblings(el) {
|
|
481
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
482
|
+
var sibs = [];
|
|
483
|
+
el = el.parentNode.firstChild;
|
|
484
|
+
while (el = el.nextSibling) {
|
|
485
|
+
if (matches(el, filter)) {
|
|
486
|
+
sibs.push(el);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return sibs;
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// all parent nodes
|
|
493
|
+
function getParents(el) {
|
|
494
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
495
|
+
var parents = [];
|
|
496
|
+
while (el = el.parentNode) {
|
|
497
|
+
if (matches(el, filter)) {
|
|
498
|
+
parents.push(el);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return parents;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
// all child nodes
|
|
505
|
+
function getChildren(el) {
|
|
506
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
507
|
+
var all = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
508
|
+
all.push.apply(all, _toConsumableArray(el.childNodes));
|
|
509
|
+
var _iterator = _createForOfIteratorHelper(el.childNodes),
|
|
510
|
+
_step;
|
|
511
|
+
try {
|
|
512
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
513
|
+
var child = _step.value;
|
|
514
|
+
getChildren(child, filter, all);
|
|
515
|
+
}
|
|
516
|
+
} catch (err) {
|
|
517
|
+
_iterator.e(err);
|
|
518
|
+
} finally {
|
|
519
|
+
_iterator.f();
|
|
520
|
+
}
|
|
521
|
+
var res = all.filter(function (item) {
|
|
522
|
+
return matches(item, filter);
|
|
523
|
+
});
|
|
524
|
+
return res;
|
|
525
|
+
}
|
|
526
|
+
module.exports = {
|
|
527
|
+
getNextSiblings: getNextSiblings,
|
|
528
|
+
getPreviousSiblings: getPreviousSiblings,
|
|
529
|
+
getAllSiblings: getAllSiblings,
|
|
530
|
+
getParents: getParents,
|
|
531
|
+
getChildren: getChildren
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
/***/ }),
|
|
535
|
+
|
|
536
|
+
/***/ 787:
|
|
537
|
+
/***/ ((module) => {
|
|
538
|
+
|
|
539
|
+
"use strict";
|
|
540
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
541
|
+
|
|
542
|
+
/***/ })
|
|
543
|
+
|
|
544
|
+
/******/ });
|
|
545
|
+
/************************************************************************/
|
|
546
|
+
/******/ // The module cache
|
|
547
|
+
/******/ var __webpack_module_cache__ = {};
|
|
548
|
+
/******/
|
|
549
|
+
/******/ // The require function
|
|
550
|
+
/******/ function __webpack_require__(moduleId) {
|
|
551
|
+
/******/ // Check if module is in cache
|
|
552
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
553
|
+
/******/ if (cachedModule !== undefined) {
|
|
554
|
+
/******/ return cachedModule.exports;
|
|
555
|
+
/******/ }
|
|
556
|
+
/******/ // Create a new module (and put it into the cache)
|
|
557
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
558
|
+
/******/ id: moduleId,
|
|
559
|
+
/******/ loaded: false,
|
|
560
|
+
/******/ exports: {}
|
|
561
|
+
/******/ };
|
|
562
|
+
/******/
|
|
563
|
+
/******/ // Execute the module function
|
|
564
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
565
|
+
/******/
|
|
566
|
+
/******/ // Flag the module as loaded
|
|
567
|
+
/******/ module.loaded = true;
|
|
568
|
+
/******/
|
|
569
|
+
/******/ // Return the exports of the module
|
|
570
|
+
/******/ return module.exports;
|
|
571
|
+
/******/ }
|
|
572
|
+
/******/
|
|
573
|
+
/************************************************************************/
|
|
574
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
575
|
+
/******/ (() => {
|
|
576
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
577
|
+
/******/ __webpack_require__.n = (module) => {
|
|
578
|
+
/******/ var getter = module && module.__esModule ?
|
|
579
|
+
/******/ () => (module['default']) :
|
|
580
|
+
/******/ () => (module);
|
|
581
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
582
|
+
/******/ return getter;
|
|
583
|
+
/******/ };
|
|
584
|
+
/******/ })();
|
|
585
|
+
/******/
|
|
586
|
+
/******/ /* webpack/runtime/define property getters */
|
|
587
|
+
/******/ (() => {
|
|
588
|
+
/******/ // define getter functions for harmony exports
|
|
589
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
590
|
+
/******/ for(var key in definition) {
|
|
591
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
592
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
593
|
+
/******/ }
|
|
594
|
+
/******/ }
|
|
595
|
+
/******/ };
|
|
596
|
+
/******/ })();
|
|
597
|
+
/******/
|
|
598
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
599
|
+
/******/ (() => {
|
|
600
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
601
|
+
/******/ })();
|
|
602
|
+
/******/
|
|
603
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
604
|
+
/******/ (() => {
|
|
605
|
+
/******/ // define __esModule on exports
|
|
606
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
607
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
608
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
609
|
+
/******/ }
|
|
610
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
611
|
+
/******/ };
|
|
612
|
+
/******/ })();
|
|
613
|
+
/******/
|
|
614
|
+
/******/ /* webpack/runtime/node module decorator */
|
|
615
|
+
/******/ (() => {
|
|
616
|
+
/******/ __webpack_require__.nmd = (module) => {
|
|
617
|
+
/******/ module.paths = [];
|
|
618
|
+
/******/ if (!module.children) module.children = [];
|
|
619
|
+
/******/ return module;
|
|
620
|
+
/******/ };
|
|
621
|
+
/******/ })();
|
|
622
|
+
/******/
|
|
623
|
+
/************************************************************************/
|
|
624
|
+
var __webpack_exports__ = {};
|
|
625
|
+
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
626
|
+
(() => {
|
|
627
|
+
"use strict";
|
|
628
|
+
// ESM COMPAT FLAG
|
|
629
|
+
__webpack_require__.r(__webpack_exports__);
|
|
630
|
+
|
|
631
|
+
// EXPORTS
|
|
632
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
633
|
+
"default": () => (/* binding */ src)
|
|
634
|
+
});
|
|
635
|
+
|
|
636
|
+
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
637
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__(787);
|
|
638
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
639
|
+
// EXTERNAL MODULE: ../Checkbox/dist/cjs/index.js
|
|
640
|
+
var cjs = __webpack_require__(109);
|
|
641
|
+
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
642
|
+
// EXTERNAL MODULE: ./src/utils/dom.js
|
|
643
|
+
var dom = __webpack_require__(426);
|
|
644
|
+
;// CONCATENATED MODULE: ./src/init-height.tsx
|
|
645
|
+
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); }
|
|
646
|
+
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; }
|
|
647
|
+
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); } }
|
|
648
|
+
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); }); }; }
|
|
649
|
+
var initUlHeight = function initUlHeight(inputUl) {
|
|
650
|
+
[].slice.call(inputUl).forEach(function (el) {
|
|
651
|
+
if (typeof el.dataset.maxwidth === 'undefined') {
|
|
652
|
+
var _li = [].slice.call(el.querySelectorAll('li'));
|
|
653
|
+
var _allHeight = 0;
|
|
654
|
+
_li.forEach(function (li) {
|
|
655
|
+
_allHeight += li.scrollHeight;
|
|
656
|
+
});
|
|
657
|
+
el.dataset.maxwidth = "".concat(_allHeight, "px");
|
|
658
|
+
el.style.maxHeight = "".concat(_allHeight, "px");
|
|
659
|
+
} else {
|
|
660
|
+
el.style.maxHeight = el.dataset.maxwidth;
|
|
661
|
+
}
|
|
662
|
+
});
|
|
663
|
+
};
|
|
664
|
+
var initAsyncItems = /*#__PURE__*/function () {
|
|
665
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(inputUl) {
|
|
666
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
667
|
+
while (1) switch (_context.prev = _context.next) {
|
|
668
|
+
case 0:
|
|
669
|
+
[].slice.call(inputUl).forEach(function (el) {
|
|
670
|
+
el.removeAttribute('data-maxwidth');
|
|
671
|
+
});
|
|
672
|
+
case 1:
|
|
673
|
+
case "end":
|
|
674
|
+
return _context.stop();
|
|
675
|
+
}
|
|
676
|
+
}, _callee);
|
|
677
|
+
}));
|
|
678
|
+
return function initAsyncItems(_x) {
|
|
679
|
+
return _ref.apply(this, arguments);
|
|
680
|
+
};
|
|
681
|
+
}();
|
|
682
|
+
|
|
683
|
+
;// CONCATENATED MODULE: ./src/TreeList.tsx
|
|
684
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
685
|
+
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."); }
|
|
686
|
+
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); }
|
|
687
|
+
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; }
|
|
688
|
+
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; } }
|
|
689
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
function TreeList(props) {
|
|
695
|
+
var rootNode = props.rootNode,
|
|
696
|
+
checkboxNamePrefix = props.checkboxNamePrefix,
|
|
697
|
+
alternateCollapse = props.alternateCollapse,
|
|
698
|
+
first = props.first,
|
|
699
|
+
disableArrow = props.disableArrow,
|
|
700
|
+
disableCollapse = props.disableCollapse,
|
|
701
|
+
arrow = props.arrow,
|
|
702
|
+
arrowIcons = props.arrowIcons,
|
|
703
|
+
childClassName = props.childClassName,
|
|
704
|
+
data = props.data,
|
|
705
|
+
getCheckedPrint = props.getCheckedPrint,
|
|
706
|
+
updateCheckedPrint = props.updateCheckedPrint,
|
|
707
|
+
getCheckedData = props.getCheckedData,
|
|
708
|
+
updategetCheckedData = props.updategetCheckedData,
|
|
709
|
+
onSelect = props.onSelect,
|
|
710
|
+
onCollapse = props.onCollapse,
|
|
711
|
+
onCheck = props.onCheck,
|
|
712
|
+
evInitValue = props.evInitValue;
|
|
713
|
+
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
714
|
+
var customIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
715
|
+
className: "default-icon"
|
|
716
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
717
|
+
width: "0.75em",
|
|
718
|
+
height: "0.75em",
|
|
719
|
+
viewBox: "0 0 20 20",
|
|
720
|
+
fill: "none"
|
|
721
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
722
|
+
d: "M15.795 11.272L7.795 16.272C6.79593 16.8964 5.5 16.1782 5.5 15L5.5 5.00002C5.5 3.82186 6.79593 3.1036 7.795 3.72802L15.795 8.72802C16.735 9.31552 16.735 10.6845 15.795 11.272Z",
|
|
723
|
+
fill: "currentColor"
|
|
724
|
+
})));
|
|
725
|
+
var loadingIcon = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
726
|
+
className: "loading-icon"
|
|
727
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("svg", {
|
|
728
|
+
width: "1em",
|
|
729
|
+
height: "1em",
|
|
730
|
+
viewBox: "0 0 512 512"
|
|
731
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("g", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
732
|
+
fill: "currentColor",
|
|
733
|
+
d: "M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z"
|
|
734
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
735
|
+
fill: "currentColor",
|
|
736
|
+
d: "M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z"
|
|
737
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
738
|
+
fill: "currentColor",
|
|
739
|
+
d: "M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z"
|
|
740
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
741
|
+
fill: "currentColor",
|
|
742
|
+
d: "M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z"
|
|
743
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
744
|
+
fill: "currentColor",
|
|
745
|
+
d: "M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z"
|
|
746
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
747
|
+
fill: "currentColor",
|
|
748
|
+
d: "M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z"
|
|
749
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
750
|
+
fill: "currentColor",
|
|
751
|
+
d: "M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z"
|
|
752
|
+
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("path", {
|
|
753
|
+
fill: "currentColor",
|
|
754
|
+
d: "M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z"
|
|
755
|
+
}))));
|
|
756
|
+
var removeItemOnce = function removeItemOnce(arr, key) {
|
|
757
|
+
return arr.filter(function (item) {
|
|
758
|
+
return item.key !== key;
|
|
759
|
+
});
|
|
760
|
+
};
|
|
761
|
+
var formatCheckboxControlVal = function formatCheckboxControlVal(el) {
|
|
762
|
+
var _el$dataset$name;
|
|
763
|
+
return {
|
|
764
|
+
name: (_el$dataset$name = el.dataset.name) === null || _el$dataset$name === void 0 ? void 0 : _el$dataset$name.replace(/-label$/, ''),
|
|
765
|
+
key: el.dataset.key,
|
|
766
|
+
slug: el.value,
|
|
767
|
+
link: el.dataset.link
|
|
768
|
+
};
|
|
769
|
+
};
|
|
770
|
+
var setCheckboxCheckedData = function setCheckboxCheckedData(arr, key, val) {
|
|
771
|
+
arr.forEach(function (item, index) {
|
|
772
|
+
if (item.key === key) arr[index].checked = val;
|
|
773
|
+
});
|
|
774
|
+
};
|
|
775
|
+
var setCheckboxIndeterminateData = function setCheckboxIndeterminateData(arr, key, val) {
|
|
776
|
+
arr.forEach(function (item, index) {
|
|
777
|
+
if (item.key === key) arr[index].indeterminate = val;
|
|
778
|
+
});
|
|
779
|
+
};
|
|
780
|
+
var setCheckboxIndeterminateStatus = function setCheckboxIndeterminateStatus(checkedData, printData, el) {
|
|
781
|
+
var _parentsLi = [];
|
|
782
|
+
if (el !== null) {
|
|
783
|
+
_parentsLi = [].slice.call((0,dom.getParents)(el, 'li'));
|
|
784
|
+
_parentsLi.splice(0, 1);
|
|
785
|
+
} else {
|
|
786
|
+
_parentsLi = [].slice.call(document.querySelectorAll("#".concat(checkboxNamePrefix, " li")));
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
//---
|
|
790
|
+
_parentsLi.forEach(function (node) {
|
|
791
|
+
var _checkboxes = (0,dom.getChildren)(node, '[type="checkbox"]');
|
|
792
|
+
var parentKey = _checkboxes[0].dataset.key;
|
|
793
|
+
|
|
794
|
+
//
|
|
795
|
+
var _checkedLengthCalcArr = [];
|
|
796
|
+
checkedData.forEach(function (oitem, oindex) {
|
|
797
|
+
_checkboxes.forEach(function (el) {
|
|
798
|
+
if (el.dataset.key === oitem.key) _checkedLengthCalcArr.push(oitem);
|
|
799
|
+
});
|
|
800
|
+
});
|
|
801
|
+
_checkedLengthCalcArr = _checkedLengthCalcArr.filter(function (el) {
|
|
802
|
+
return el.key !== parentKey;
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
//
|
|
806
|
+
var _checkedLength = _checkedLengthCalcArr.filter(function (el) {
|
|
807
|
+
return el.checked === true;
|
|
808
|
+
}).length;
|
|
809
|
+
if (_checkedLength === 0) {
|
|
810
|
+
setCheckboxIndeterminateData(checkedData, parentKey, false);
|
|
811
|
+
} else {
|
|
812
|
+
if (_checkedLength === _checkboxes.length - 1) {
|
|
813
|
+
setCheckboxIndeterminateData(checkedData, parentKey, false);
|
|
814
|
+
setCheckboxCheckedData(checkedData, parentKey, true);
|
|
815
|
+
printData.push(formatCheckboxControlVal(_checkboxes[0]));
|
|
816
|
+
}
|
|
817
|
+
if (_checkedLength < _checkboxes.length - 1) {
|
|
818
|
+
setCheckboxIndeterminateData(checkedData, parentKey, true);
|
|
819
|
+
setCheckboxCheckedData(checkedData, parentKey, false);
|
|
820
|
+
printData = removeItemOnce(printData, parentKey);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
});
|
|
824
|
+
return [checkedData, printData];
|
|
825
|
+
};
|
|
826
|
+
var activeClass = function activeClass(el, mode) {
|
|
827
|
+
var classname = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'active';
|
|
828
|
+
if (mode === 'add') {
|
|
829
|
+
el.classList.add(classname);
|
|
830
|
+
} else {
|
|
831
|
+
el.classList.remove(classname);
|
|
832
|
+
}
|
|
833
|
+
};
|
|
834
|
+
var closeChild = function closeChild(hyperlink, ul) {
|
|
835
|
+
if (ul.length === 0) return;
|
|
836
|
+
activeClass(hyperlink, 'remove');
|
|
837
|
+
hyperlink.setAttribute('aria-expanded', 'false');
|
|
838
|
+
activeClass(hyperlink.parentNode, 'remove');
|
|
839
|
+
|
|
840
|
+
//to close
|
|
841
|
+
[].slice.call(ul).forEach(function (element) {
|
|
842
|
+
element.style.maxHeight = 0;
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
var openChild = function openChild(hyperlink, ul) {
|
|
846
|
+
if (ul.length === 0) return;
|
|
847
|
+
activeClass(hyperlink, 'add');
|
|
848
|
+
hyperlink.setAttribute('aria-expanded', 'true');
|
|
849
|
+
activeClass(hyperlink.parentNode, 'add');
|
|
850
|
+
|
|
851
|
+
// init <ul> height
|
|
852
|
+
initUlHeight(ul);
|
|
853
|
+
};
|
|
854
|
+
function handleCollapse(e) {
|
|
855
|
+
if (disableCollapse) return;
|
|
856
|
+
e.preventDefault();
|
|
857
|
+
var hyperlink = e.currentTarget;
|
|
858
|
+
var url = hyperlink.getAttribute('href');
|
|
859
|
+
var subElement = (0,dom.getNextSiblings)(hyperlink, 'ul');
|
|
860
|
+
|
|
861
|
+
// loading
|
|
862
|
+
//=====================
|
|
863
|
+
if (hyperlink.classList.contains('async-ready')) {
|
|
864
|
+
activeClass(hyperlink, 'add', 'loading');
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// calback
|
|
868
|
+
//=====================
|
|
869
|
+
var fetchFunc = hyperlink.classList.contains('async-ready') ? typeof evInitValue !== 'function' ? function () {
|
|
870
|
+
return void 0;
|
|
871
|
+
} : evInitValue : function () {
|
|
872
|
+
return void 0;
|
|
873
|
+
};
|
|
874
|
+
onCollapse === null || onCollapse === void 0 ? void 0 : onCollapse(e, {
|
|
875
|
+
key: hyperlink.dataset.key,
|
|
876
|
+
slug: hyperlink.dataset.slug,
|
|
877
|
+
link: hyperlink.dataset.link
|
|
878
|
+
}, fetchFunc);
|
|
879
|
+
|
|
880
|
+
// hide child if expandedLink doesn't exist, on the contrary
|
|
881
|
+
//=====================
|
|
882
|
+
if (hyperlink.classList.contains('loading')) return;
|
|
883
|
+
if (hyperlink.getAttribute('aria-expanded') === 'false' || hyperlink.getAttribute('aria-expanded') === null) {
|
|
884
|
+
//Hide all other siblings of the selected <ul>
|
|
885
|
+
if (alternateCollapse) {
|
|
886
|
+
[].slice.call(rootRef.current.children).forEach(function (li) {
|
|
887
|
+
activeClass(li, 'remove');
|
|
888
|
+
var _li = li.firstChild;
|
|
889
|
+
activeClass(_li, 'remove');
|
|
890
|
+
_li.setAttribute('aria-expanded', false);
|
|
891
|
+
[].slice.call((0,dom.getNextSiblings)(_li, 'ul')).forEach(function (element) {
|
|
892
|
+
element.style.maxHeight = 0;
|
|
893
|
+
});
|
|
894
|
+
});
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
//open current
|
|
898
|
+
openChild(hyperlink, subElement);
|
|
899
|
+
} else {
|
|
900
|
+
//close current
|
|
901
|
+
closeChild(hyperlink, subElement);
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
function handleSelect(e) {
|
|
905
|
+
e.preventDefault();
|
|
906
|
+
var hyperlink = e.currentTarget;
|
|
907
|
+
if (hyperlink.classList.contains('selected')) {
|
|
908
|
+
activeClass(hyperlink, 'remove', 'selected');
|
|
909
|
+
} else {
|
|
910
|
+
[].slice.call(hyperlink.closest('.tree-diagram__wrapper').querySelectorAll('li > a')).forEach(function (node) {
|
|
911
|
+
activeClass(node, 'remove', 'selected');
|
|
912
|
+
});
|
|
913
|
+
activeClass(hyperlink, 'add', 'selected');
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// Note: that component re-rendering (such as routing changes) will cause collapsing problems
|
|
917
|
+
// with `onSelect()`, please use `useMemo()` to wrap `<Tree />`, like this:
|
|
918
|
+
/*
|
|
919
|
+
function TreeMemo(props: any) {
|
|
920
|
+
const {t, callback, data} = props;
|
|
921
|
+
const dependencies = props.data !== null && props.data.length === 0 ? props.data : '';
|
|
922
|
+
return useMemo(() => {
|
|
923
|
+
return <Tree
|
|
924
|
+
data={data}
|
|
925
|
+
showLine={true}
|
|
926
|
+
onSelect={callback}
|
|
927
|
+
/>
|
|
928
|
+
}, [dependencies]);
|
|
929
|
+
}
|
|
930
|
+
*/
|
|
931
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(e, {
|
|
932
|
+
key: hyperlink.dataset.key,
|
|
933
|
+
slug: hyperlink.dataset.slug,
|
|
934
|
+
link: hyperlink.dataset.link
|
|
935
|
+
}, typeof evInitValue !== 'function' ? function () {
|
|
936
|
+
return void 0;
|
|
937
|
+
} : evInitValue);
|
|
938
|
+
if (disableArrow) {
|
|
939
|
+
handleCollapse(e);
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function titleArrowGenerator() {
|
|
943
|
+
return disableArrow ? loadingIcon : null;
|
|
944
|
+
}
|
|
945
|
+
function arrowGenerator() {
|
|
946
|
+
if (arrowIcons && Array.isArray(arrowIcons)) {
|
|
947
|
+
return arrowIcons.length > 1 ? /*#__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("var", {
|
|
948
|
+
className: "default-icon"
|
|
949
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, arrowIcons[0]), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, arrowIcons[1])), loadingIcon) : /*#__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("var", {
|
|
950
|
+
className: "default-icon"
|
|
951
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, arrowIcons[0]), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, arrowIcons[0])), loadingIcon);
|
|
952
|
+
} else {
|
|
953
|
+
return arrow ? arrow : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, customIcon, loadingIcon);
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
957
|
+
// Activate current item
|
|
958
|
+
//=====================
|
|
959
|
+
var allItems = rootRef.current ? [].slice.call(document.querySelectorAll(".".concat(childClassName, " a"))).map(function (item) {
|
|
960
|
+
var _item$parentNode$clas;
|
|
961
|
+
return {
|
|
962
|
+
href: item.getAttribute('href'),
|
|
963
|
+
el: item,
|
|
964
|
+
actived: (_item$parentNode$clas = item.parentNode.classList) !== null && _item$parentNode$clas !== void 0 && _item$parentNode$clas.contains('active') ? true : false,
|
|
965
|
+
expandedLink: document.body.contains(item.parentNode.parentNode.previousSibling) ? item.parentNode.parentNode.previousSibling : false
|
|
966
|
+
};
|
|
967
|
+
}) : [];
|
|
968
|
+
allItems.forEach(function (hyperlink) {
|
|
969
|
+
// Expand the currently active item by default
|
|
970
|
+
if (hyperlink.actived) {
|
|
971
|
+
hyperlink.el.setAttribute('aria-expanded', 'true');
|
|
972
|
+
if (hyperlink.expandedLink) {
|
|
973
|
+
var expandedLink = hyperlink.expandedLink; // <a>
|
|
974
|
+
activeClass(expandedLink.parentNode, 'add');
|
|
975
|
+
expandedLink.setAttribute('aria-expanded', true);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// init <ul> height
|
|
979
|
+
var ul = (0,dom.getNextSiblings)(hyperlink.el, 'ul');
|
|
980
|
+
initUlHeight(ul);
|
|
981
|
+
}
|
|
982
|
+
});
|
|
983
|
+
|
|
984
|
+
// Initialize indeterminate status of all checkboxes
|
|
985
|
+
//=====================
|
|
986
|
+
setCheckboxIndeterminateStatus(getCheckedData, getCheckedPrint, null);
|
|
987
|
+
}, [data]);
|
|
988
|
+
if (data) {
|
|
989
|
+
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("ul", {
|
|
990
|
+
className: childClassName,
|
|
991
|
+
ref: rootRef,
|
|
992
|
+
style: !first ? {
|
|
993
|
+
maxHeight: '0px'
|
|
994
|
+
} : {}
|
|
995
|
+
}, data.map(function (item, i) {
|
|
996
|
+
var _filter$, _filter$2;
|
|
997
|
+
var _async = item.childrenAsync ? 'async-ready' : '';
|
|
998
|
+
var _cusIcons = arrowIcons ? 'custom-icons' : '';
|
|
999
|
+
if (item.heading) return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
1000
|
+
className: "nav-item",
|
|
1001
|
+
key: item.key
|
|
1002
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
1003
|
+
tabIndex: -1,
|
|
1004
|
+
className: "nav-link disabled",
|
|
1005
|
+
href: "#",
|
|
1006
|
+
"aria-disabled": "true",
|
|
1007
|
+
"data-link": item.link,
|
|
1008
|
+
"data-slug": item.slug,
|
|
1009
|
+
"data-key": item.key
|
|
1010
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, item.icon ? item.icon.indexOf('</svg>') < 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("i", {
|
|
1011
|
+
className: item.icon
|
|
1012
|
+
}), " ") : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
1013
|
+
dangerouslySetInnerHTML: {
|
|
1014
|
+
__html: "".concat(item.icon)
|
|
1015
|
+
}
|
|
1016
|
+
}) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", {
|
|
1017
|
+
dangerouslySetInnerHTML: {
|
|
1018
|
+
__html: "".concat(item.title)
|
|
1019
|
+
}
|
|
1020
|
+
}))));
|
|
1021
|
+
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
1022
|
+
className: item.active ? 'nav-item active' : 'nav-item',
|
|
1023
|
+
key: item.key
|
|
1024
|
+
}, item.children && item.children.length || item.childrenAsync ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1025
|
+
"aria-expanded": item.active ? 'true' : 'false',
|
|
1026
|
+
className: item.active ? "arrow active ".concat(_async, " ").concat(_cusIcons) : "arrow ".concat(_async, " ").concat(_cusIcons),
|
|
1027
|
+
onClick: handleCollapse,
|
|
1028
|
+
"data-link": item.link,
|
|
1029
|
+
"data-slug": item.slug,
|
|
1030
|
+
"data-key": item.key
|
|
1031
|
+
}, arrowGenerator()) : '', /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1032
|
+
className: "checkbox-trigger"
|
|
1033
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
|
|
1034
|
+
wrapperClassName: "",
|
|
1035
|
+
name: "checkbox-".concat(checkboxNamePrefix, "-").concat(item.key),
|
|
1036
|
+
tabIndex: -1,
|
|
1037
|
+
"data-key": item.key,
|
|
1038
|
+
"data-link": item.link,
|
|
1039
|
+
value: item.slug,
|
|
1040
|
+
indeterminate: (_filter$ = getCheckedData.filter(function (cur) {
|
|
1041
|
+
return cur.key === item.key;
|
|
1042
|
+
})[0]) === null || _filter$ === void 0 ? void 0 : _filter$.indeterminate,
|
|
1043
|
+
checked: (_filter$2 = getCheckedData.filter(function (cur) {
|
|
1044
|
+
return cur.key === item.key;
|
|
1045
|
+
})[0]) === null || _filter$2 === void 0 ? void 0 : _filter$2.checked,
|
|
1046
|
+
onChange: function onChange(e, val) {
|
|
1047
|
+
var _curKey = e.target.dataset.key;
|
|
1048
|
+
var _checkedData = getCheckedData;
|
|
1049
|
+
var _res = getCheckedPrint;
|
|
1050
|
+
|
|
1051
|
+
// STEP 1:
|
|
1052
|
+
// Current checkbox
|
|
1053
|
+
//-----------
|
|
1054
|
+
if (val === true) {
|
|
1055
|
+
_res.push(formatCheckboxControlVal(e.target));
|
|
1056
|
+
setCheckboxIndeterminateData(_checkedData, _curKey, false);
|
|
1057
|
+
setCheckboxCheckedData(_checkedData, _curKey, true);
|
|
1058
|
+
} else {
|
|
1059
|
+
setCheckboxCheckedData(_checkedData, _curKey, false);
|
|
1060
|
+
_res = removeItemOnce(_res, _curKey);
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
// STEP 2:
|
|
1064
|
+
// All child checkboxes
|
|
1065
|
+
//-----------
|
|
1066
|
+
[].slice.call((0,dom.getChildren)(e.target.closest('li'), '[type="checkbox"]')).forEach(function (node) {
|
|
1067
|
+
if (val === true) {
|
|
1068
|
+
if (node.dataset.key !== _curKey) {
|
|
1069
|
+
setCheckboxIndeterminateData(_checkedData, node.dataset.key, false);
|
|
1070
|
+
setCheckboxCheckedData(_checkedData, node.dataset.key, true);
|
|
1071
|
+
_res.push(formatCheckboxControlVal(node));
|
|
1072
|
+
}
|
|
1073
|
+
} else {
|
|
1074
|
+
setCheckboxCheckedData(_checkedData, node.dataset.key, false);
|
|
1075
|
+
_res = removeItemOnce(_res, node.dataset.key);
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
|
|
1079
|
+
// STEP 3:
|
|
1080
|
+
// ALl parent checkboxes
|
|
1081
|
+
//-----------
|
|
1082
|
+
var _setCheckboxIndetermi = setCheckboxIndeterminateStatus(_checkedData, _res, e.target),
|
|
1083
|
+
_setCheckboxIndetermi2 = _slicedToArray(_setCheckboxIndetermi, 2),
|
|
1084
|
+
updatedCheckedData = _setCheckboxIndetermi2[0],
|
|
1085
|
+
updatedPrintData = _setCheckboxIndetermi2[1];
|
|
1086
|
+
var _updatedCheckedData = updatedCheckedData;
|
|
1087
|
+
var _updatedPrintData = updatedPrintData;
|
|
1088
|
+
|
|
1089
|
+
// STEP 4:
|
|
1090
|
+
// Update checked data
|
|
1091
|
+
//-----------
|
|
1092
|
+
updategetCheckedData(_updatedCheckedData);
|
|
1093
|
+
|
|
1094
|
+
// STEP 5:
|
|
1095
|
+
// Array deduplication
|
|
1096
|
+
//-----------
|
|
1097
|
+
_updatedPrintData = _updatedPrintData.filter(function (item, index, self) {
|
|
1098
|
+
return index === self.findIndex(function (t) {
|
|
1099
|
+
return t.key === item.key;
|
|
1100
|
+
});
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
// STEP 6:
|
|
1104
|
+
// Update checked print
|
|
1105
|
+
//-----------
|
|
1106
|
+
updateCheckedPrint(_updatedPrintData);
|
|
1107
|
+
|
|
1108
|
+
// STEP 7:
|
|
1109
|
+
// callback
|
|
1110
|
+
//-----------
|
|
1111
|
+
onCheck === null || onCheck === void 0 ? void 0 : onCheck(_updatedPrintData);
|
|
1112
|
+
}
|
|
1113
|
+
})), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("a", {
|
|
1114
|
+
tabIndex: -1,
|
|
1115
|
+
className: item.active ? "nav-link active ".concat(_async) : "nav-link ".concat(_async),
|
|
1116
|
+
href: item.link === '#' ? "".concat(item.link, "-").concat(i) : item.link,
|
|
1117
|
+
"aria-expanded": "false",
|
|
1118
|
+
onClick: handleSelect,
|
|
1119
|
+
"data-link": item.link,
|
|
1120
|
+
"data-slug": item.slug,
|
|
1121
|
+
"data-key": item.key
|
|
1122
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", null, item.icon ? item.icon.indexOf('</svg>') < 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("i", {
|
|
1123
|
+
className: item.icon
|
|
1124
|
+
}), " ") : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("var", {
|
|
1125
|
+
dangerouslySetInnerHTML: {
|
|
1126
|
+
__html: "".concat(item.icon)
|
|
1127
|
+
}
|
|
1128
|
+
}) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", {
|
|
1129
|
+
dangerouslySetInnerHTML: {
|
|
1130
|
+
__html: "".concat(item.title)
|
|
1131
|
+
}
|
|
1132
|
+
}), titleArrowGenerator())), item.children && item.children.length > 0 && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TreeList, {
|
|
1133
|
+
rootNode: rootNode,
|
|
1134
|
+
checkboxNamePrefix: checkboxNamePrefix,
|
|
1135
|
+
data: item.children,
|
|
1136
|
+
first: false,
|
|
1137
|
+
arrow: arrow,
|
|
1138
|
+
onSelect: onSelect,
|
|
1139
|
+
onCollapse: onCollapse,
|
|
1140
|
+
onCheck: onCheck,
|
|
1141
|
+
disableArrow: disableArrow,
|
|
1142
|
+
disableCollapse: disableCollapse,
|
|
1143
|
+
arrowIcons: arrowIcons,
|
|
1144
|
+
evInitValue: evInitValue,
|
|
1145
|
+
getCheckedPrint: getCheckedPrint,
|
|
1146
|
+
updateCheckedPrint: updateCheckedPrint,
|
|
1147
|
+
getCheckedData: getCheckedData,
|
|
1148
|
+
updategetCheckedData: updategetCheckedData
|
|
1149
|
+
}));
|
|
1150
|
+
})));
|
|
1151
|
+
} else {
|
|
1152
|
+
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);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
;// CONCATENATED MODULE: ./src/index.tsx
|
|
1156
|
+
function src_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ src_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" == src_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; }
|
|
1157
|
+
function src_typeof(obj) { "@babel/helpers - typeof"; return src_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; }, src_typeof(obj); }
|
|
1158
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || src_unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
1159
|
+
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."); }
|
|
1160
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
1161
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return src_arrayLikeToArray(arr); }
|
|
1162
|
+
function src_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); } }
|
|
1163
|
+
function src_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { src_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
1164
|
+
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; }
|
|
1165
|
+
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; }
|
|
1166
|
+
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; }
|
|
1167
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return src_typeof(key) === "symbol" ? key : String(key); }
|
|
1168
|
+
function _toPrimitive(input, hint) { if (src_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (src_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
1169
|
+
function src_slicedToArray(arr, i) { return src_arrayWithHoles(arr) || src_iterableToArrayLimit(arr, i) || src_unsupportedIterableToArray(arr, i) || src_nonIterableRest(); }
|
|
1170
|
+
function src_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."); }
|
|
1171
|
+
function src_unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return src_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 src_arrayLikeToArray(o, minLen); }
|
|
1172
|
+
function src_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; }
|
|
1173
|
+
function src_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; } }
|
|
1174
|
+
function src_arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1175
|
+
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
var Tree = function Tree(props) {
|
|
1179
|
+
var id = props.id,
|
|
1180
|
+
checkable = props.checkable,
|
|
1181
|
+
showLine = props.showLine,
|
|
1182
|
+
lineStyle = props.lineStyle,
|
|
1183
|
+
alternateCollapse = props.alternateCollapse,
|
|
1184
|
+
disableArrow = props.disableArrow,
|
|
1185
|
+
disableCollapse = props.disableCollapse,
|
|
1186
|
+
arrow = props.arrow,
|
|
1187
|
+
arrowIcons = props.arrowIcons,
|
|
1188
|
+
treeClassName = props.treeClassName,
|
|
1189
|
+
childClassName = props.childClassName,
|
|
1190
|
+
data = props.data,
|
|
1191
|
+
onSelect = props.onSelect,
|
|
1192
|
+
onCollapse = props.onCollapse,
|
|
1193
|
+
onCheck = props.onCheck;
|
|
1194
|
+
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)().replace(/\:/g, "-");
|
|
1195
|
+
var idRes = id || uniqueID;
|
|
1196
|
+
var rootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
1197
|
+
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
1198
|
+
_useState2 = src_slicedToArray(_useState, 2),
|
|
1199
|
+
val = _useState2[0],
|
|
1200
|
+
setVal = _useState2[1];
|
|
1201
|
+
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
1202
|
+
_useState4 = src_slicedToArray(_useState3, 2),
|
|
1203
|
+
checkedPrint = _useState4[0],
|
|
1204
|
+
setCheckedPrint = _useState4[1];
|
|
1205
|
+
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
1206
|
+
_useState6 = src_slicedToArray(_useState5, 2),
|
|
1207
|
+
checkedData = _useState6[0],
|
|
1208
|
+
setCheckedData = _useState6[1];
|
|
1209
|
+
var expandClassName = "".concat(showLine ? 'show-line' : '', " ").concat(disableArrow ? 'hide-arrow' : '', " ").concat(disableCollapse ? 'collapse-disabled' : '', " ").concat(lineStyle ? "line--".concat(lineStyle) : '', " ").concat(checkable ? 'has-checkbox' : '');
|
|
1210
|
+
var updateTreeData = function updateTreeData(list, key, children) {
|
|
1211
|
+
return list ? list.map(function (node) {
|
|
1212
|
+
if (node.key === key) {
|
|
1213
|
+
return _objectSpread(_objectSpread({}, node), {}, {
|
|
1214
|
+
children: children
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
if (node.children) {
|
|
1218
|
+
return _objectSpread(_objectSpread({}, node), {}, {
|
|
1219
|
+
children: updateTreeData(node.children, key, children)
|
|
1220
|
+
});
|
|
1221
|
+
}
|
|
1222
|
+
return node;
|
|
1223
|
+
}) : [];
|
|
1224
|
+
};
|
|
1225
|
+
function fetchData(_x2, _x3) {
|
|
1226
|
+
return _fetchData.apply(this, arguments);
|
|
1227
|
+
}
|
|
1228
|
+
function _fetchData() {
|
|
1229
|
+
_fetchData = src_asyncToGenerator( /*#__PURE__*/src_regeneratorRuntime().mark(function _callee(fetch, params) {
|
|
1230
|
+
var _fetch$fetchFuncAsync, response, _ORGIN_DATA;
|
|
1231
|
+
return src_regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1232
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1233
|
+
case 0:
|
|
1234
|
+
if (!(src_typeof(fetch.fetchFuncAsync) === 'object')) {
|
|
1235
|
+
_context.next = 14;
|
|
1236
|
+
break;
|
|
1237
|
+
}
|
|
1238
|
+
_context.next = 3;
|
|
1239
|
+
return (_fetch$fetchFuncAsync = fetch.fetchFuncAsync)["".concat(fetch.fetchFuncMethod)].apply(_fetch$fetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
1240
|
+
case 3:
|
|
1241
|
+
response = _context.sent;
|
|
1242
|
+
_ORGIN_DATA = response.data;
|
|
1243
|
+
if (!(Array.isArray(_ORGIN_DATA) && _ORGIN_DATA.length > 0)) {
|
|
1244
|
+
_context.next = 11;
|
|
1245
|
+
break;
|
|
1246
|
+
}
|
|
1247
|
+
// reset data structure
|
|
1248
|
+
if (typeof fetch.fetchCallback === 'function') {
|
|
1249
|
+
_ORGIN_DATA = fetch.fetchCallback(_ORGIN_DATA);
|
|
1250
|
+
}
|
|
1251
|
+
|
|
1252
|
+
// Determine whether the data structure matches
|
|
1253
|
+
if (_ORGIN_DATA.length > 0 && typeof _ORGIN_DATA[0].title === 'undefined') {
|
|
1254
|
+
console.warn('The data structure does not match, please refer to the example in the component documentation.');
|
|
1255
|
+
_ORGIN_DATA = [];
|
|
1256
|
+
}
|
|
1257
|
+
return _context.abrupt("return", _ORGIN_DATA);
|
|
1258
|
+
case 11:
|
|
1259
|
+
return _context.abrupt("return", []);
|
|
1260
|
+
case 12:
|
|
1261
|
+
_context.next = 15;
|
|
1262
|
+
break;
|
|
1263
|
+
case 14:
|
|
1264
|
+
return _context.abrupt("return", []);
|
|
1265
|
+
case 15:
|
|
1266
|
+
case "end":
|
|
1267
|
+
return _context.stop();
|
|
1268
|
+
}
|
|
1269
|
+
}, _callee);
|
|
1270
|
+
}));
|
|
1271
|
+
return _fetchData.apply(this, arguments);
|
|
1272
|
+
}
|
|
1273
|
+
function addKey(obj, depth, init) {
|
|
1274
|
+
obj.forEach(function (item, index) {
|
|
1275
|
+
item.key = "".concat(depth, "-").concat(index).substring(1);
|
|
1276
|
+
if (item.children) {
|
|
1277
|
+
addKey(item.children, "".concat(depth, "-").concat(index), init + 1);
|
|
1278
|
+
}
|
|
1279
|
+
});
|
|
1280
|
+
}
|
|
1281
|
+
function initCheckboxesVal(obj) {
|
|
1282
|
+
obj.forEach(function (item) {
|
|
1283
|
+
if (item.checked === true) setCheckedPrint(function (prevState) {
|
|
1284
|
+
return [{
|
|
1285
|
+
name: "checkbox-".concat(idRes, "-").concat(item.key),
|
|
1286
|
+
key: item.key,
|
|
1287
|
+
slug: item.slug,
|
|
1288
|
+
link: item.link
|
|
1289
|
+
}].concat(_toConsumableArray(prevState));
|
|
1290
|
+
});
|
|
1291
|
+
if (item.children) {
|
|
1292
|
+
initCheckboxesVal(item.children);
|
|
1293
|
+
}
|
|
1294
|
+
});
|
|
1295
|
+
}
|
|
1296
|
+
function initCheckboxesData(obj) {
|
|
1297
|
+
obj.forEach(function (item) {
|
|
1298
|
+
setCheckedData(function (prevState) {
|
|
1299
|
+
return [{
|
|
1300
|
+
key: item.key,
|
|
1301
|
+
checked: item.checked === true,
|
|
1302
|
+
indeterminate: false
|
|
1303
|
+
}].concat(_toConsumableArray(prevState));
|
|
1304
|
+
});
|
|
1305
|
+
if (item.children) {
|
|
1306
|
+
initCheckboxesData(item.children);
|
|
1307
|
+
}
|
|
1308
|
+
});
|
|
1309
|
+
}
|
|
1310
|
+
function initDefaultValue(key) {
|
|
1311
|
+
var fetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1312
|
+
var firstRender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1313
|
+
if (firstRender) {
|
|
1314
|
+
addKey(data, '', 0);
|
|
1315
|
+
setVal(data);
|
|
1316
|
+
|
|
1317
|
+
// Initialize default value of checkboxes
|
|
1318
|
+
if (checkable) {
|
|
1319
|
+
initCheckboxesVal(data);
|
|
1320
|
+
initCheckboxesData(data);
|
|
1321
|
+
}
|
|
1322
|
+
return;
|
|
1323
|
+
}
|
|
1324
|
+
if (fetch && src_typeof(fetch.fetchFuncAsync) === 'object') {
|
|
1325
|
+
//
|
|
1326
|
+
var _params = fetch.fetchFuncMethodParams || [];
|
|
1327
|
+
fetchData(fetch, _params.join(',')).then(function (response) {
|
|
1328
|
+
var _childrenData = response;
|
|
1329
|
+
if (_childrenData.length > 0) {
|
|
1330
|
+
// add children to node
|
|
1331
|
+
var _newData = updateTreeData(val, key ? key : '', _childrenData);
|
|
1332
|
+
|
|
1333
|
+
// update data
|
|
1334
|
+
addKey(_newData, '', 0);
|
|
1335
|
+
setVal(_newData);
|
|
1336
|
+
|
|
1337
|
+
// Initialize default value of checkboxes
|
|
1338
|
+
if (checkable) {
|
|
1339
|
+
_childrenData.forEach(function (newitem) {
|
|
1340
|
+
setCheckedData(function (prevState) {
|
|
1341
|
+
return [{
|
|
1342
|
+
key: newitem.key,
|
|
1343
|
+
checked: newitem.checked === true,
|
|
1344
|
+
indeterminate: false
|
|
1345
|
+
}].concat(_toConsumableArray(prevState));
|
|
1346
|
+
});
|
|
1347
|
+
});
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
// loading status
|
|
1352
|
+
setTimeout(function () {
|
|
1353
|
+
[].slice.call(rootRef.current.querySelectorAll('.arrow.async-ready, .nav-link.async-ready')).forEach(function (node) {
|
|
1354
|
+
node.classList.remove('loading');
|
|
1355
|
+
if (node.parentElement.querySelector('ul') !== null) {
|
|
1356
|
+
node.classList.remove('async-ready');
|
|
1357
|
+
node.click();
|
|
1358
|
+
}
|
|
1359
|
+
});
|
|
1360
|
+
|
|
1361
|
+
// init <ul> height
|
|
1362
|
+
// Initialize async items
|
|
1363
|
+
var ul = [].slice.call(rootRef.current.querySelectorAll('ul'));
|
|
1364
|
+
initAsyncItems(ul).then(function () {
|
|
1365
|
+
initUlHeight(ul);
|
|
1366
|
+
});
|
|
1367
|
+
}, 500);
|
|
1368
|
+
});
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
1372
|
+
initDefaultValue(null, null, true);
|
|
1373
|
+
}, [data]);
|
|
1374
|
+
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("nav", {
|
|
1375
|
+
tabIndex: 0,
|
|
1376
|
+
id: idRes,
|
|
1377
|
+
ref: rootRef,
|
|
1378
|
+
className: treeClassName ? "tree-diagram__wrapper ".concat(treeClassName, " ").concat(expandClassName) : "tree-diagram__wrapper tree-diagram-default ".concat(expandClassName)
|
|
1379
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(TreeList, {
|
|
1380
|
+
rootNode: rootRef,
|
|
1381
|
+
checkboxNamePrefix: idRes,
|
|
1382
|
+
alternateCollapse: alternateCollapse,
|
|
1383
|
+
first: true,
|
|
1384
|
+
disableArrow: disableArrow,
|
|
1385
|
+
disableCollapse: disableCollapse,
|
|
1386
|
+
arrow: arrow,
|
|
1387
|
+
arrowIcons: arrowIcons,
|
|
1388
|
+
data: val,
|
|
1389
|
+
childClassName: childClassName || 'tree-diagram-default-nav',
|
|
1390
|
+
onSelect: onSelect,
|
|
1391
|
+
onCollapse: onCollapse,
|
|
1392
|
+
onCheck: onCheck,
|
|
1393
|
+
evInitValue: initDefaultValue,
|
|
1394
|
+
updateCheckedPrint: setCheckedPrint,
|
|
1395
|
+
getCheckedPrint: checkedPrint,
|
|
1396
|
+
updategetCheckedData: setCheckedData,
|
|
1397
|
+
getCheckedData: checkedData
|
|
1398
|
+
})));
|
|
1399
|
+
};
|
|
1400
|
+
/* harmony default export */ const src = (Tree);
|
|
1401
|
+
})();
|
|
1402
|
+
|
|
1403
|
+
/******/ return __webpack_exports__;
|
|
1404
|
+
/******/ })()
|
|
1405
|
+
;
|
|
1406
|
+
});
|