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,412 @@
|
|
|
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
|
+
/******/ "use strict";
|
|
13
|
+
/******/ var __webpack_modules__ = ({
|
|
14
|
+
|
|
15
|
+
/***/ 787:
|
|
16
|
+
/***/ ((module) => {
|
|
17
|
+
|
|
18
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
19
|
+
|
|
20
|
+
/***/ })
|
|
21
|
+
|
|
22
|
+
/******/ });
|
|
23
|
+
/************************************************************************/
|
|
24
|
+
/******/ // The module cache
|
|
25
|
+
/******/ var __webpack_module_cache__ = {};
|
|
26
|
+
/******/
|
|
27
|
+
/******/ // The require function
|
|
28
|
+
/******/ function __webpack_require__(moduleId) {
|
|
29
|
+
/******/ // Check if module is in cache
|
|
30
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
31
|
+
/******/ if (cachedModule !== undefined) {
|
|
32
|
+
/******/ return cachedModule.exports;
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ // Create a new module (and put it into the cache)
|
|
35
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
36
|
+
/******/ // no module.id needed
|
|
37
|
+
/******/ // no module.loaded needed
|
|
38
|
+
/******/ exports: {}
|
|
39
|
+
/******/ };
|
|
40
|
+
/******/
|
|
41
|
+
/******/ // Execute the module function
|
|
42
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
43
|
+
/******/
|
|
44
|
+
/******/ // Return the exports of the module
|
|
45
|
+
/******/ return module.exports;
|
|
46
|
+
/******/ }
|
|
47
|
+
/******/
|
|
48
|
+
/************************************************************************/
|
|
49
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
50
|
+
/******/ (() => {
|
|
51
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
52
|
+
/******/ __webpack_require__.n = (module) => {
|
|
53
|
+
/******/ var getter = module && module.__esModule ?
|
|
54
|
+
/******/ () => (module['default']) :
|
|
55
|
+
/******/ () => (module);
|
|
56
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
57
|
+
/******/ return getter;
|
|
58
|
+
/******/ };
|
|
59
|
+
/******/ })();
|
|
60
|
+
/******/
|
|
61
|
+
/******/ /* webpack/runtime/define property getters */
|
|
62
|
+
/******/ (() => {
|
|
63
|
+
/******/ // define getter functions for harmony exports
|
|
64
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
65
|
+
/******/ for(var key in definition) {
|
|
66
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
67
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
68
|
+
/******/ }
|
|
69
|
+
/******/ }
|
|
70
|
+
/******/ };
|
|
71
|
+
/******/ })();
|
|
72
|
+
/******/
|
|
73
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
74
|
+
/******/ (() => {
|
|
75
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
76
|
+
/******/ })();
|
|
77
|
+
/******/
|
|
78
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
79
|
+
/******/ (() => {
|
|
80
|
+
/******/ // define __esModule on exports
|
|
81
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
82
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
83
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
84
|
+
/******/ }
|
|
85
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
86
|
+
/******/ };
|
|
87
|
+
/******/ })();
|
|
88
|
+
/******/
|
|
89
|
+
/************************************************************************/
|
|
90
|
+
var __webpack_exports__ = {};
|
|
91
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
92
|
+
(() => {
|
|
93
|
+
__webpack_require__.r(__webpack_exports__);
|
|
94
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
95
|
+
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
96
|
+
/* harmony export */ });
|
|
97
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(787);
|
|
98
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
99
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
100
|
+
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."); }
|
|
101
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
102
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
103
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
104
|
+
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."); }
|
|
105
|
+
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); }
|
|
106
|
+
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; }
|
|
107
|
+
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; } }
|
|
108
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
109
|
+
|
|
110
|
+
var DynamicFields = function DynamicFields(props) {
|
|
111
|
+
var wrapperClassName = props.wrapperClassName,
|
|
112
|
+
value = props.value,
|
|
113
|
+
label = props.label,
|
|
114
|
+
tempHtmlString = props.tempHtmlString,
|
|
115
|
+
maxFields = props.maxFields,
|
|
116
|
+
iconAddBefore = props.iconAddBefore,
|
|
117
|
+
iconAddAfter = props.iconAddAfter,
|
|
118
|
+
iconAdd = props.iconAdd,
|
|
119
|
+
iconRemove = props.iconRemove,
|
|
120
|
+
startFromZero = props.startFromZero,
|
|
121
|
+
id = props.id,
|
|
122
|
+
confirmText = props.confirmText,
|
|
123
|
+
onAdd = props.onAdd,
|
|
124
|
+
onRemove = props.onRemove,
|
|
125
|
+
onComplete = props.onComplete;
|
|
126
|
+
var uniqueID = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)().replace(/\:/g, "-");
|
|
127
|
+
var idRes = id || uniqueID;
|
|
128
|
+
var rootRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
129
|
+
var fieldsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
130
|
+
var addBtnRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
131
|
+
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
132
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
133
|
+
data = _useState2[0],
|
|
134
|
+
setData = _useState2[1];
|
|
135
|
+
var controlRefreshValDelay = 1000;
|
|
136
|
+
|
|
137
|
+
//timer
|
|
138
|
+
var timeoutIdRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
139
|
+
var startTimer = function startTimer() {
|
|
140
|
+
return new Promise(function (resolve, reject) {
|
|
141
|
+
//
|
|
142
|
+
timeoutIdRef.current = setTimeout(function () {
|
|
143
|
+
if (fieldsRef.current !== null) {
|
|
144
|
+
var _val = value ? JSON.parse('[' + value + ']') : [];
|
|
145
|
+
var controls = [].slice.call(document.querySelectorAll("#".concat(fieldsRef.current.id, " > .dynamic-fields__append [name]")));
|
|
146
|
+
var integratedControls = [];
|
|
147
|
+
var hasRadio = false;
|
|
148
|
+
controls.forEach(function (node, i) {
|
|
149
|
+
var controlType = '';
|
|
150
|
+
if (node.tagName == "INPUT" || node.tagName == "TEXTARTA") {
|
|
151
|
+
//not `radio`, `checkbox`
|
|
152
|
+
if (node.type != 'checkbox' && node.type != 'radio') {
|
|
153
|
+
controlType = 'input-textarea';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
//`checkbox`
|
|
157
|
+
if (node.type == 'checkbox') {
|
|
158
|
+
controlType = 'checkbox';
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
//`radio`
|
|
162
|
+
if (node.type == 'radio') {
|
|
163
|
+
controlType = 'radio';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//`select`
|
|
168
|
+
if (node.tagName == "SELECT") {
|
|
169
|
+
controlType = 'select';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//
|
|
173
|
+
if (controlType === 'radio') {
|
|
174
|
+
hasRadio = true;
|
|
175
|
+
}
|
|
176
|
+
integratedControls.push({
|
|
177
|
+
target: node,
|
|
178
|
+
type: controlType
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// replace placeholder string
|
|
182
|
+
replacePlaceholderStr(node);
|
|
183
|
+
});
|
|
184
|
+
if (hasRadio) {
|
|
185
|
+
console.error('<DynamicFields /> cannot use the "radio" type, because it will have multiple duplicate names! \nThe following components are recommended: <Input />, <Textarea />, <Checkbox />, <Switch />, <MultiFuncSelect />, <Select />, <CascadingSelectE2E />, <CascadingSelect />, <TagInput />, <RangeSlider />.');
|
|
186
|
+
return false;
|
|
187
|
+
}
|
|
188
|
+
var resControls = groupByNum(integratedControls, Math.floor(integratedControls.length / _val.length));
|
|
189
|
+
_val.forEach(function (row, i) {
|
|
190
|
+
row.forEach(function (val, j) {
|
|
191
|
+
if (typeof resControls[i] !== 'undefined' && typeof resControls[i][j] !== 'undefined') {
|
|
192
|
+
var _control = resControls[i][j];
|
|
193
|
+
|
|
194
|
+
// set default value
|
|
195
|
+
// It is generally used for `<CascadingSelect />` and cascading `<Select />`
|
|
196
|
+
_control.target.dataset.value = val;
|
|
197
|
+
switch (_control.type) {
|
|
198
|
+
case "input-textarea":
|
|
199
|
+
// normal
|
|
200
|
+
_control.target.value = val;
|
|
201
|
+
|
|
202
|
+
// if it is checkbox
|
|
203
|
+
if (val === true) {
|
|
204
|
+
var _checkbox = _control.target.parentElement.querySelector('[data-checkbox]');
|
|
205
|
+
_checkbox.checked = val == true ? true : false;
|
|
206
|
+
_control.target.value = _checkbox.value;
|
|
207
|
+
}
|
|
208
|
+
break;
|
|
209
|
+
case "checkbox":
|
|
210
|
+
_control.target.checked = val == true ? true : false;
|
|
211
|
+
break;
|
|
212
|
+
case "select":
|
|
213
|
+
_control.target.value = val;
|
|
214
|
+
_control.target.dispatchEvent(new Event('change'));
|
|
215
|
+
break;
|
|
216
|
+
default:
|
|
217
|
+
_control.target.value = val;
|
|
218
|
+
} //end switch
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
//button status
|
|
224
|
+
checkMaxStatus();
|
|
225
|
+
|
|
226
|
+
//
|
|
227
|
+
resolve(timeoutIdRef.current);
|
|
228
|
+
}
|
|
229
|
+
}, controlRefreshValDelay);
|
|
230
|
+
});
|
|
231
|
+
};
|
|
232
|
+
var stopTimer = function stopTimer() {
|
|
233
|
+
clearTimeout(timeoutIdRef.current);
|
|
234
|
+
timeoutIdRef.current = null;
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
//timer add
|
|
238
|
+
var timeoutAddIdRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
239
|
+
var startTimerAdd = function startTimerAdd() {
|
|
240
|
+
timeoutAddIdRef.current = setTimeout(function () {
|
|
241
|
+
if (fieldsRef.current !== null) {
|
|
242
|
+
var controls = [].slice.call(document.querySelectorAll("#".concat(fieldsRef.current.id, " > .dynamic-fields__append [name]")));
|
|
243
|
+
controls.forEach(function (node, i) {
|
|
244
|
+
// replace placeholder string
|
|
245
|
+
replacePlaceholderStr(node);
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}, controlRefreshValDelay);
|
|
249
|
+
};
|
|
250
|
+
var stopTimerAdd = function stopTimerAdd() {
|
|
251
|
+
clearTimeout(timeoutAddIdRef.current);
|
|
252
|
+
timeoutAddIdRef.current = null;
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
//timer onComplete
|
|
256
|
+
var timeoutHandleCompleteIdRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null);
|
|
257
|
+
var startTimerHandleComplete = function startTimerHandleComplete() {
|
|
258
|
+
timeoutHandleCompleteIdRef.current = setTimeout(function () {
|
|
259
|
+
// Call a function when all dynamic components are rendered.
|
|
260
|
+
// It is usually used for cascading asynchronous components (can be triggered by routing updates)
|
|
261
|
+
onComplete === null || onComplete === void 0 ? void 0 : onComplete();
|
|
262
|
+
}, 500);
|
|
263
|
+
};
|
|
264
|
+
var stopTimerHandleComplete = function stopTimerHandleComplete() {
|
|
265
|
+
clearTimeout(timeoutHandleCompleteIdRef.current);
|
|
266
|
+
timeoutHandleCompleteIdRef.current = null;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
//
|
|
270
|
+
function replacePlaceholderStr(node) {
|
|
271
|
+
var _wapper = node.closest('.dynamic-fields__tmpl__wrapper');
|
|
272
|
+
if (_wapper === null) return;
|
|
273
|
+
var perKey = _wapper.dataset.key;
|
|
274
|
+
if (typeof node.id !== 'undefined') node.id = node.id.replace('%i%', perKey);
|
|
275
|
+
if (typeof node.name !== 'undefined') node.name = node.name.replace('%i%', perKey);
|
|
276
|
+
if (typeof node.dataset.id !== 'undefined') node.dataset.id = node.dataset.id.replace('%i%', perKey);
|
|
277
|
+
if (typeof node.dataset.name !== 'undefined') node.dataset.name = node.dataset.name.replace('%i%', perKey);
|
|
278
|
+
}
|
|
279
|
+
function groupByNum(arr, n) {
|
|
280
|
+
if (n === 0 || n === Infinity) return false;
|
|
281
|
+
var result = [];
|
|
282
|
+
for (var i = 0; i < arr.length; i += n) result.push(arr.slice(i, i + n));
|
|
283
|
+
return result;
|
|
284
|
+
}
|
|
285
|
+
function checkMaxStatus() {
|
|
286
|
+
//button status
|
|
287
|
+
if (rootRef.current.querySelector('.dynamic-fields__append').children.length + 1 >= parseFloat(maxFields)) {
|
|
288
|
+
addBtnRef.current.style.setProperty('display', 'none', 'important');
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function handleClickAdd(event) {
|
|
292
|
+
event.preventDefault();
|
|
293
|
+
|
|
294
|
+
//button status
|
|
295
|
+
checkMaxStatus();
|
|
296
|
+
|
|
297
|
+
//
|
|
298
|
+
setData(function (prevState) {
|
|
299
|
+
return [].concat(_toConsumableArray(prevState), [[""]]);
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
//
|
|
303
|
+
onAdd === null || onAdd === void 0 ? void 0 : onAdd();
|
|
304
|
+
|
|
305
|
+
// update placeholder string
|
|
306
|
+
startTimerAdd();
|
|
307
|
+
}
|
|
308
|
+
function handleClickRemove(param) {
|
|
309
|
+
// param is the argument you passed to the function
|
|
310
|
+
return function (e) {
|
|
311
|
+
// e is the event object that returned
|
|
312
|
+
e.preventDefault();
|
|
313
|
+
if (confirm(confirmText || '')) {
|
|
314
|
+
//button status
|
|
315
|
+
if (rootRef.current.querySelector('.dynamic-fields__append').children.length <= parseFloat(maxFields)) {
|
|
316
|
+
addBtnRef.current.style.setProperty('display', 'inline', 'important');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
//
|
|
320
|
+
var newData = _toConsumableArray(data);
|
|
321
|
+
newData.splice(param, 1);
|
|
322
|
+
//console.log(newData); //[[""],[""],[""],[""]]
|
|
323
|
+
setData(newData);
|
|
324
|
+
|
|
325
|
+
//
|
|
326
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
function updateDisplayedControls() {
|
|
331
|
+
// update values for all displayed controls
|
|
332
|
+
// You need to wait for the asynchronous component to render
|
|
333
|
+
startTimer().then(function () {
|
|
334
|
+
startTimerHandleComplete();
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
function generateList() {
|
|
338
|
+
return data.map(function (el, i) {
|
|
339
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
340
|
+
key: i,
|
|
341
|
+
className: "dynamic-fields__tmpl__wrapper position-relative",
|
|
342
|
+
"data-key": i
|
|
343
|
+
}, el.map(function (data, index) {
|
|
344
|
+
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), {
|
|
345
|
+
key: index
|
|
346
|
+
}, tempHtmlString);
|
|
347
|
+
}), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
348
|
+
href: "#",
|
|
349
|
+
tabIndex: -1,
|
|
350
|
+
className: "dynamic-fields__removebtn align-middle",
|
|
351
|
+
onClick: handleClickRemove(i)
|
|
352
|
+
}, iconRemove ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, iconRemove) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
|
|
353
|
+
width: "20px",
|
|
354
|
+
height: "20px",
|
|
355
|
+
viewBox: "0 0 24 24",
|
|
356
|
+
fill: "none"
|
|
357
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
358
|
+
fillRule: "evenodd",
|
|
359
|
+
clipRule: "evenodd",
|
|
360
|
+
d: "M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10ZM8 11a1 1 0 1 0 0 2h8a1 1 0 1 0 0-2H8Z",
|
|
361
|
+
fill: "#000"
|
|
362
|
+
})))));
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
366
|
+
setData(value ? _toConsumableArray(Array(JSON.parse('[' + value + ']').length - (!startFromZero ? 1 : 0))).map(function () {
|
|
367
|
+
return [""];
|
|
368
|
+
}) : []);
|
|
369
|
+
updateDisplayedControls();
|
|
370
|
+
return function () {
|
|
371
|
+
stopTimer();
|
|
372
|
+
stopTimerAdd();
|
|
373
|
+
stopTimerHandleComplete();
|
|
374
|
+
};
|
|
375
|
+
}, [value]);
|
|
376
|
+
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", {
|
|
377
|
+
className: wrapperClassName || wrapperClassName === '' ? wrapperClassName : "mb-3 position-relative",
|
|
378
|
+
ref: rootRef
|
|
379
|
+
}, 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", {
|
|
380
|
+
className: "form-label"
|
|
381
|
+
}, label)) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
382
|
+
ref: fieldsRef,
|
|
383
|
+
className: "dynamic-fields-container",
|
|
384
|
+
"data-max-fields": maxFields || 10,
|
|
385
|
+
id: idRes
|
|
386
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
387
|
+
className: "dynamic-fields__append"
|
|
388
|
+
}, !startFromZero ? tempHtmlString : null, generateList()), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
389
|
+
className: "dynamic-fields__btns"
|
|
390
|
+
}, iconAddBefore ? iconAddBefore : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("a", {
|
|
391
|
+
ref: addBtnRef,
|
|
392
|
+
href: "#",
|
|
393
|
+
tabIndex: -1,
|
|
394
|
+
className: "dynamic-fields__addbtn align-middle",
|
|
395
|
+
onClick: handleClickAdd
|
|
396
|
+
}, iconAdd ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, iconAdd) : /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("svg", {
|
|
397
|
+
width: "20px",
|
|
398
|
+
height: "20px",
|
|
399
|
+
viewBox: "0 0 24 24",
|
|
400
|
+
fill: "none"
|
|
401
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("path", {
|
|
402
|
+
d: "M12 2C6.49 2 2 6.49 2 12C2 17.51 6.49 22 12 22C17.51 22 22 17.51 22 12C22 6.49 17.51 2 12 2ZM16 12.75H12.75V16C12.75 16.41 12.41 16.75 12 16.75C11.59 16.75 11.25 16.41 11.25 16V12.75H8C7.59 12.75 7.25 12.41 7.25 12C7.25 11.59 7.59 11.25 8 11.25H11.25V8C11.25 7.59 11.59 7.25 12 7.25C12.41 7.25 12.75 7.59 12.75 8V11.25H16C16.41 11.25 16.75 11.59 16.75 12C16.75 12.41 16.41 12.75 16 12.75Z",
|
|
403
|
+
fill: "#000"
|
|
404
|
+
})))), iconAddAfter ? iconAddAfter : null))));
|
|
405
|
+
};
|
|
406
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DynamicFields);
|
|
407
|
+
})();
|
|
408
|
+
|
|
409
|
+
/******/ return __webpack_exports__;
|
|
410
|
+
/******/ })()
|
|
411
|
+
;
|
|
412
|
+
});
|
package/File/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare module 'react' {
|
|
3
|
+
interface ReactI18NextChildren<T> {
|
|
4
|
+
children?: any;
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
declare type FileProps = {
|
|
8
|
+
wrapperClassName?: string;
|
|
9
|
+
controlClassName?: string;
|
|
10
|
+
labelClassName?: string;
|
|
11
|
+
labelHoverClassName?: string;
|
|
12
|
+
fetchUrl?: string;
|
|
13
|
+
fetchMethod?: string;
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
submitLabel?: React.ReactNode | string;
|
|
16
|
+
submitClassName?: string;
|
|
17
|
+
value?: string;
|
|
18
|
+
label?: React.ReactNode | string;
|
|
19
|
+
name?: string;
|
|
20
|
+
disabled?: any;
|
|
21
|
+
required?: any;
|
|
22
|
+
/** Incoming data, you can set the third parameter of `onComplete` */
|
|
23
|
+
data?: any;
|
|
24
|
+
/** -- */
|
|
25
|
+
id?: string;
|
|
26
|
+
tabIndex?: number;
|
|
27
|
+
[key: `data-${string}`]: string | undefined;
|
|
28
|
+
fetchFuncAsync?: any;
|
|
29
|
+
fetchFuncMethod?: string;
|
|
30
|
+
fetchFuncMethodParams?: any[];
|
|
31
|
+
onChange?: (e: any, e2: any, value: any) => void;
|
|
32
|
+
onComplete?: (e: any, e2: any, callback: any, incomingData: string | null | undefined) => void;
|
|
33
|
+
onProgress?: (files: any, e2: any) => void;
|
|
34
|
+
};
|
|
35
|
+
declare const File: React.ForwardRefExoticComponent<FileProps & React.RefAttributes<unknown>>;
|
|
36
|
+
export default File;
|