funda-ui 3.9.410 → 3.9.555
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/Accordion/index.js +3276 -337
- package/BackToTop/index.js +3304 -248
- package/CascadingSelect/index.js +3448 -515
- package/CascadingSelectE2E/index.js +3441 -660
- package/Date/index.js +3502 -874
- package/DigitalClock/index.js +3302 -61
- package/DropdownMenu/index.js +3443 -315
- package/EventCalendarTimeline/index.js +3356 -223
- package/LiveSearch/index.js +3509 -509
- package/MasonryLayout/index.js +3286 -54
- package/MultiFuncSelect/index.js +3447 -723
- package/MultilevelDropdownMenu/index.js +3283 -106
- package/MultipleCheckboxes/index.js +3289 -154
- package/MultipleSelect/index.js +3286 -303
- package/Radio/index.js +3296 -29
- package/Scrollbar/index.js +3286 -54
- package/Select/index.js +3294 -179
- package/Table/index.js +3286 -164
- package/TagInput/index.js +3286 -132
- package/Textarea/index.js +3318 -128
- package/Tooltip/index.js +3282 -147
- package/Tree/index.js +3290 -150
- package/Utils/index.d.ts +20 -0
- package/Utils/index.js +2245 -0
- package/all.d.ts +1 -0
- package/all.js +1 -0
- package/lib/cjs/Accordion/index.js +3276 -337
- package/lib/cjs/BackToTop/index.js +3304 -248
- package/lib/cjs/CascadingSelect/index.js +3448 -515
- package/lib/cjs/CascadingSelectE2E/index.js +3441 -660
- package/lib/cjs/Date/index.js +3502 -874
- package/lib/cjs/DigitalClock/index.js +3302 -61
- package/lib/cjs/DropdownMenu/index.js +3443 -315
- package/lib/cjs/EventCalendarTimeline/index.js +3356 -223
- package/lib/cjs/LiveSearch/index.js +3509 -509
- package/lib/cjs/MasonryLayout/index.js +3286 -54
- package/lib/cjs/MultiFuncSelect/index.js +3447 -723
- package/lib/cjs/MultilevelDropdownMenu/index.js +3283 -106
- package/lib/cjs/MultipleCheckboxes/index.js +3289 -154
- package/lib/cjs/MultipleSelect/index.js +3286 -303
- package/lib/cjs/Radio/index.js +3296 -29
- package/lib/cjs/Scrollbar/index.js +3286 -54
- package/lib/cjs/Select/index.js +3294 -179
- package/lib/cjs/Table/index.js +3286 -164
- package/lib/cjs/TagInput/index.js +3286 -132
- package/lib/cjs/Textarea/index.js +3318 -128
- package/lib/cjs/Tooltip/index.js +3282 -147
- package/lib/cjs/Tree/index.js +3290 -150
- package/lib/cjs/Utils/index.d.ts +20 -0
- package/lib/cjs/Utils/index.js +2245 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/esm/Accordion/Accordion.tsx +2 -1
- package/lib/esm/BackToTop/index.tsx +17 -20
- package/lib/esm/CascadingSelect/index.tsx +42 -59
- package/lib/esm/CascadingSelectE2E/index.tsx +43 -64
- package/lib/esm/Date/Calendar.tsx +4 -2
- package/lib/esm/Date/index.tsx +47 -63
- package/lib/esm/DigitalClock/index.tsx +5 -1
- package/lib/esm/DropdownMenu/index.tsx +18 -24
- package/lib/esm/EventCalendarTimeline/index.tsx +20 -13
- package/lib/esm/LiveSearch/index.tsx +82 -140
- package/lib/esm/MasonryLayout/index.tsx +4 -1
- package/lib/esm/MultiFuncSelect/index.tsx +122 -192
- package/lib/esm/MultilevelDropdownMenu/MenuList.tsx +5 -1
- package/lib/esm/MultipleCheckboxes/index.tsx +6 -41
- package/lib/esm/MultipleSelect/index.tsx +6 -40
- package/lib/esm/Radio/index.tsx +6 -37
- package/lib/esm/Scrollbar/index.tsx +4 -1
- package/lib/esm/Select/index.tsx +2 -40
- package/lib/esm/Table/TableFieldRow.tsx +5 -1
- package/lib/esm/Table/TableHeaders.tsx +3 -2
- package/lib/esm/Table/index.tsx +4 -2
- package/lib/esm/Table/table-utils.ts +5 -1
- package/lib/esm/TagInput/index.tsx +6 -2
- package/lib/esm/Textarea/index.tsx +5 -1
- package/lib/esm/Tooltip/index.tsx +17 -15
- package/lib/esm/Tree/TreeList.tsx +6 -1
- package/lib/esm/Tree/index.tsx +9 -3
- package/lib/esm/Tree/tree-utils.ts +0 -41
- package/lib/esm/Utils/hooks/useClickOutside.js +61 -0
- package/lib/esm/Utils/hooks/useKeyPress.js +95 -0
- package/lib/esm/Utils/hooks/useWindowScroll.js +69 -0
- package/lib/esm/Utils/index.tsx +293 -0
- package/lib/esm/{Accordion/utils → Utils/libs}/anim.js +7 -5
- package/lib/esm/{File/utils → Utils/libs}/buffer.js +16 -5
- package/lib/esm/{MultiFuncSelect/utils → Utils/libs}/convert.js +1 -1
- package/lib/esm/{Date/utils → Utils/libs}/date.js +1 -3
- package/lib/esm/Utils/libs/dom.js +166 -0
- package/lib/esm/{BackToTop/utils → Utils/libs}/easing.js +1 -1
- package/lib/esm/{CascadingSelectE2E/utils → Utils/libs}/extract.js +1 -1
- package/lib/esm/{DropdownMenu/utils → Utils/libs}/get-element-property.js +2 -4
- package/lib/esm/{Accordion/utils → Utils/libs}/init-default-options.js +5 -2
- package/lib/esm/Utils/libs/object.js +54 -0
- package/lib/esm/{Accordion/utils → Utils/libs}/performance.js +1 -1
- package/lib/esm/{Select/utils → Utils/libs}/tree.js +1 -1
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
- package/ScrollReveal/index.css +0 -23
- package/lib/css/ScrollReveal/index.css +0 -23
- package/lib/esm/Accordion/utils/easing.js +0 -200
- package/lib/esm/BackToTop/utils/performance.js +0 -52
- package/lib/esm/CascadingSelect/utils/convert.js +0 -59
- package/lib/esm/CascadingSelect/utils/extract.js +0 -63
- package/lib/esm/CascadingSelect/utils/get-element-property.js +0 -154
- package/lib/esm/CascadingSelect/utils/performance.js +0 -52
- package/lib/esm/CascadingSelectE2E/utils/convert.js +0 -59
- package/lib/esm/CascadingSelectE2E/utils/get-element-property.js +0 -154
- package/lib/esm/CascadingSelectE2E/utils/performance.js +0 -52
- package/lib/esm/CascadingSelectE2E/utils/tree.js +0 -119
- package/lib/esm/Date/utils/get-element-property.js +0 -153
- package/lib/esm/Date/utils/performance.js +0 -52
- package/lib/esm/EventCalendarTimeline/utils/get-element-property.js +0 -153
- package/lib/esm/HorizontalScrollContent/utils/performance.js +0 -52
- package/lib/esm/LiveSearch/utils/get-element-property.js +0 -153
- package/lib/esm/LiveSearch/utils/performance.js +0 -52
- package/lib/esm/MasonryLayout/utils/performance.js +0 -52
- package/lib/esm/MultiFuncSelect/utils/extract.js +0 -63
- package/lib/esm/MultiFuncSelect/utils/get-element-property.js +0 -154
- package/lib/esm/MultiFuncSelect/utils/performance.js +0 -52
- package/lib/esm/MultiFuncSelect/utils/tree.js +0 -119
- package/lib/esm/MultiFuncSelect/utils/useDebounce.js +0 -42
- package/lib/esm/MultiFuncSelect/utils/useThrottle.js +0 -36
- package/lib/esm/MultilevelDropdownMenu/utils/dom.js +0 -81
- package/lib/esm/MultipleCheckboxes/utils/convert.js +0 -59
- package/lib/esm/MultipleCheckboxes/utils/extract.js +0 -63
- package/lib/esm/MultipleSelect/utils/convert.js +0 -59
- package/lib/esm/MultipleSelect/utils/extract.js +0 -63
- package/lib/esm/MultipleSelect/utils/tree.js +0 -119
- package/lib/esm/ScrollReveal/index.scss +0 -27
- package/lib/esm/ScrollReveal/utils/performance.js +0 -52
- package/lib/esm/Scrollbar/utils/performance.js +0 -52
- package/lib/esm/Table/utils/dom.js +0 -81
- package/lib/esm/Table/utils/performance.js +0 -52
- package/lib/esm/TagInput/utils/convert.js +0 -59
- package/lib/esm/TagInput/utils/extract.js +0 -63
- package/lib/esm/Tooltip/utils/get-element-property.js +0 -153
- package/lib/esm/Tree/utils/convert-tree.js +0 -29
- package/lib/esm/Tree/utils/dom.js +0 -81
- /package/lib/esm/{Textarea/utils → Utils/hooks}/useAutosizeTextArea.js +0 -0
- /package/lib/esm/{LiveSearch/utils → Utils/hooks}/useDebounce.js +0 -0
- /package/lib/esm/{DigitalClock/utils → Utils/hooks}/useInterval.js +0 -0
- /package/lib/esm/{LiveSearch/utils → Utils/hooks}/useThrottle.js +0 -0
package/Accordion/index.js
CHANGED
|
@@ -11,347 +11,3275 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/
|
|
15
|
-
/***/ ((module,
|
|
14
|
+
/***/ 456:
|
|
15
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* @param {HTMLElement} curElement - Element of animation.
|
|
30
|
-
* @param {?JSON} config - Configuration of animation
|
|
31
|
-
* @param {?string} easeType - Types of easing animation.
|
|
32
|
-
* @param {?Function} callback - Callback after animation ends
|
|
33
|
-
*/
|
|
34
|
-
function animateStyles(curElement, config) {
|
|
35
|
-
var easeType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'linear';
|
|
36
|
-
var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};
|
|
37
|
-
if (_typeof(curElement) === ( true ? "undefined" : 0)) return;
|
|
38
|
-
|
|
39
|
-
// Set a default configuration
|
|
40
|
-
config = setDefaultOptions({
|
|
41
|
-
"startHeight": 0,
|
|
42
|
-
// node.scrollHeight
|
|
43
|
-
"endHeight": 0,
|
|
44
|
-
"speed": 200 //ms
|
|
45
|
-
}, config);
|
|
46
|
-
|
|
47
|
-
//
|
|
48
|
-
var _endHeight = config.endHeight,
|
|
49
|
-
_speed = config.speed;
|
|
50
|
-
var _startHeight = config.startHeight;
|
|
51
|
-
var duration = _speed;
|
|
52
|
-
var start = new Date().getTime();
|
|
53
|
-
var from = 0;
|
|
54
|
-
var to = 100;
|
|
55
|
-
var requestId;
|
|
56
|
-
var loop = function loop() {
|
|
57
|
-
//easing
|
|
58
|
-
var time = new Date().getTime() - start; //Work out the elapsed time
|
|
59
|
-
var val;
|
|
60
|
-
switch (easeType) {
|
|
61
|
-
case "linear":
|
|
62
|
-
val = easeLinear(time, from, to - from, duration);
|
|
63
|
-
break;
|
|
64
|
-
case "ease-in":
|
|
65
|
-
val = easeInQuad(time, from, to - from, duration);
|
|
66
|
-
break;
|
|
67
|
-
case "ease-out":
|
|
68
|
-
val = easeOutQuad(time, from, to - from, duration);
|
|
69
|
-
break;
|
|
70
|
-
case "ease-in-out":
|
|
71
|
-
val = easeInOutQuad(time, from, to - from, duration);
|
|
72
|
-
break;
|
|
73
|
-
default:
|
|
74
|
-
val = easeLinear(time, from, to - from, duration);
|
|
75
|
-
}
|
|
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";
|
|
76
29
|
|
|
77
|
-
|
|
78
|
-
|
|
30
|
+
/******/
|
|
31
|
+
var __webpack_modules__ = {
|
|
32
|
+
/***/787: /***/function _(module) {
|
|
33
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
79
34
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
curElement.style.height = _endHeight * percent + 'px';
|
|
83
|
-
} else {
|
|
84
|
-
if (_startHeight > 0) curElement.style.height = _startHeight - _startHeight * percent + 'px';
|
|
85
|
-
}
|
|
35
|
+
/***/
|
|
36
|
+
}
|
|
86
37
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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/define property getters */
|
|
76
|
+
/******/
|
|
77
|
+
(function () {
|
|
78
|
+
/******/ // define getter functions for harmony exports
|
|
79
|
+
/******/__nested_webpack_require_1471__.d = function (exports, definition) {
|
|
80
|
+
/******/for (var key in definition) {
|
|
81
|
+
/******/if (__nested_webpack_require_1471__.o(definition, key) && !__nested_webpack_require_1471__.o(exports, key)) {
|
|
82
|
+
/******/Object.defineProperty(exports, key, {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: definition[key]
|
|
85
|
+
});
|
|
86
|
+
/******/
|
|
87
|
+
}
|
|
88
|
+
/******/
|
|
89
|
+
}
|
|
90
|
+
/******/
|
|
91
|
+
};
|
|
92
|
+
/******/
|
|
93
|
+
})();
|
|
94
|
+
/******/
|
|
95
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
96
|
+
/******/
|
|
97
|
+
(function () {
|
|
98
|
+
/******/__nested_webpack_require_1471__.o = function (obj, prop) {
|
|
99
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
100
|
+
};
|
|
101
|
+
/******/
|
|
102
|
+
})();
|
|
103
|
+
/******/
|
|
104
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
105
|
+
/******/
|
|
106
|
+
(function () {
|
|
107
|
+
/******/ // define __esModule on exports
|
|
108
|
+
/******/__nested_webpack_require_1471__.r = function (exports) {
|
|
109
|
+
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
110
|
+
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
111
|
+
value: 'Module'
|
|
112
|
+
});
|
|
113
|
+
/******/
|
|
114
|
+
}
|
|
115
|
+
/******/
|
|
116
|
+
Object.defineProperty(exports, '__esModule', {
|
|
117
|
+
value: true
|
|
118
|
+
});
|
|
119
|
+
/******/
|
|
120
|
+
};
|
|
121
|
+
/******/
|
|
122
|
+
})();
|
|
123
|
+
/******/
|
|
124
|
+
/************************************************************************/
|
|
125
|
+
var __webpack_exports__ = {};
|
|
126
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
127
|
+
(function () {
|
|
128
|
+
// ESM COMPAT FLAG
|
|
129
|
+
__nested_webpack_require_1471__.r(__webpack_exports__);
|
|
95
130
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
|
|
131
|
+
// EXPORTS
|
|
132
|
+
__nested_webpack_require_1471__.d(__webpack_exports__, {
|
|
133
|
+
"addTreeDepth": function addTreeDepth() {
|
|
134
|
+
return (/* reexport */_addTreeDepth
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
"addTreeIndent": function addTreeIndent() {
|
|
138
|
+
return (/* reexport */_addTreeIndent
|
|
139
|
+
);
|
|
140
|
+
},
|
|
141
|
+
"animateStyles": function animateStyles() {
|
|
142
|
+
return (/* reexport */anim
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
"arrayBufferToUint8Array": function arrayBufferToUint8Array() {
|
|
146
|
+
return (/* reexport */_arrayBufferToUint8Array
|
|
147
|
+
);
|
|
148
|
+
},
|
|
149
|
+
"arrayToBlob": function arrayToBlob() {
|
|
150
|
+
return (/* reexport */_arrayToBlob
|
|
151
|
+
);
|
|
152
|
+
},
|
|
153
|
+
"arrayToStream": function arrayToStream() {
|
|
154
|
+
return (/* reexport */_arrayToStream
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
"arrayToUint8array": function arrayToUint8array() {
|
|
158
|
+
return (/* reexport */_arrayToUint8array
|
|
159
|
+
);
|
|
160
|
+
},
|
|
161
|
+
"base64ToArrayBuffer": function base64ToArrayBuffer() {
|
|
162
|
+
return (/* reexport */_base64ToArrayBuffer
|
|
163
|
+
);
|
|
164
|
+
},
|
|
165
|
+
"blobToUint8array": function blobToUint8array() {
|
|
166
|
+
return (/* reexport */_blobToUint8array
|
|
167
|
+
);
|
|
168
|
+
},
|
|
169
|
+
"convertArrToValByBraces": function convertArrToValByBraces() {
|
|
170
|
+
return (/* reexport */_convertArrToValByBraces
|
|
171
|
+
);
|
|
172
|
+
},
|
|
173
|
+
"convertArrToValByBrackets": function convertArrToValByBrackets() {
|
|
174
|
+
return (/* reexport */_convertArrToValByBrackets
|
|
175
|
+
);
|
|
176
|
+
},
|
|
177
|
+
"convertStringByCommaToValByBraces": function convertStringByCommaToValByBraces() {
|
|
178
|
+
return (/* reexport */_convertStringByCommaToValByBraces
|
|
179
|
+
);
|
|
180
|
+
},
|
|
181
|
+
"convertStringByCommaToValByBrackets": function convertStringByCommaToValByBrackets() {
|
|
182
|
+
return (/* reexport */_convertStringByCommaToValByBrackets
|
|
183
|
+
);
|
|
184
|
+
},
|
|
185
|
+
"convertTree": function convertTree() {
|
|
186
|
+
return (/* reexport */_convertTree
|
|
187
|
+
);
|
|
188
|
+
},
|
|
189
|
+
"dateFormat": function dateFormat() {
|
|
190
|
+
return (/* reexport */_dateFormat
|
|
191
|
+
);
|
|
192
|
+
},
|
|
193
|
+
"debounce": function debounce() {
|
|
194
|
+
return (/* reexport */_debounce
|
|
195
|
+
);
|
|
196
|
+
},
|
|
197
|
+
"decodeBase64Str": function decodeBase64Str() {
|
|
198
|
+
return (/* reexport */_decodeBase64Str
|
|
199
|
+
);
|
|
200
|
+
},
|
|
201
|
+
"deepClone": function deepClone() {
|
|
202
|
+
return (/* reexport */_deepClone
|
|
203
|
+
);
|
|
204
|
+
},
|
|
205
|
+
"easeInBack": function easeInBack() {
|
|
206
|
+
return (/* reexport */_easeInBack
|
|
207
|
+
);
|
|
208
|
+
},
|
|
209
|
+
"easeInCirc": function easeInCirc() {
|
|
210
|
+
return (/* reexport */_easeInCirc
|
|
211
|
+
);
|
|
212
|
+
},
|
|
213
|
+
"easeInCubic": function easeInCubic() {
|
|
214
|
+
return (/* reexport */_easeInCubic
|
|
215
|
+
);
|
|
216
|
+
},
|
|
217
|
+
"easeInElastic": function easeInElastic() {
|
|
218
|
+
return (/* reexport */_easeInElastic
|
|
219
|
+
);
|
|
220
|
+
},
|
|
221
|
+
"easeInExpo": function easeInExpo() {
|
|
222
|
+
return (/* reexport */_easeInExpo
|
|
223
|
+
);
|
|
224
|
+
},
|
|
225
|
+
"easeInOutBack": function easeInOutBack() {
|
|
226
|
+
return (/* reexport */_easeInOutBack
|
|
227
|
+
);
|
|
228
|
+
},
|
|
229
|
+
"easeInOutCirc": function easeInOutCirc() {
|
|
230
|
+
return (/* reexport */_easeInOutCirc
|
|
231
|
+
);
|
|
232
|
+
},
|
|
233
|
+
"easeInOutCubic": function easeInOutCubic() {
|
|
234
|
+
return (/* reexport */_easeInOutCubic
|
|
235
|
+
);
|
|
236
|
+
},
|
|
237
|
+
"easeInOutElastic": function easeInOutElastic() {
|
|
238
|
+
return (/* reexport */_easeInOutElastic
|
|
239
|
+
);
|
|
240
|
+
},
|
|
241
|
+
"easeInOutExpo": function easeInOutExpo() {
|
|
242
|
+
return (/* reexport */_easeInOutExpo
|
|
243
|
+
);
|
|
244
|
+
},
|
|
245
|
+
"easeInOutQuad": function easeInOutQuad() {
|
|
246
|
+
return (/* reexport */_easeInOutQuad
|
|
247
|
+
);
|
|
248
|
+
},
|
|
249
|
+
"easeInOutQuart": function easeInOutQuart() {
|
|
250
|
+
return (/* reexport */_easeInOutQuart
|
|
251
|
+
);
|
|
252
|
+
},
|
|
253
|
+
"easeInOutQuint": function easeInOutQuint() {
|
|
254
|
+
return (/* reexport */_easeInOutQuint
|
|
255
|
+
);
|
|
256
|
+
},
|
|
257
|
+
"easeInOutSine": function easeInOutSine() {
|
|
258
|
+
return (/* reexport */_easeInOutSine
|
|
259
|
+
);
|
|
260
|
+
},
|
|
261
|
+
"easeInQuad": function easeInQuad() {
|
|
262
|
+
return (/* reexport */_easeInQuad
|
|
263
|
+
);
|
|
264
|
+
},
|
|
265
|
+
"easeInQuart": function easeInQuart() {
|
|
266
|
+
return (/* reexport */_easeInQuart
|
|
267
|
+
);
|
|
268
|
+
},
|
|
269
|
+
"easeInQuint": function easeInQuint() {
|
|
270
|
+
return (/* reexport */_easeInQuint
|
|
271
|
+
);
|
|
272
|
+
},
|
|
273
|
+
"easeInSine": function easeInSine() {
|
|
274
|
+
return (/* reexport */_easeInSine
|
|
275
|
+
);
|
|
276
|
+
},
|
|
277
|
+
"easeLinear": function easeLinear() {
|
|
278
|
+
return (/* reexport */_easeLinear
|
|
279
|
+
);
|
|
280
|
+
},
|
|
281
|
+
"easeOutBack": function easeOutBack() {
|
|
282
|
+
return (/* reexport */_easeOutBack
|
|
283
|
+
);
|
|
284
|
+
},
|
|
285
|
+
"easeOutCirc": function easeOutCirc() {
|
|
286
|
+
return (/* reexport */_easeOutCirc
|
|
287
|
+
);
|
|
288
|
+
},
|
|
289
|
+
"easeOutCubic": function easeOutCubic() {
|
|
290
|
+
return (/* reexport */_easeOutCubic
|
|
291
|
+
);
|
|
292
|
+
},
|
|
293
|
+
"easeOutElastic": function easeOutElastic() {
|
|
294
|
+
return (/* reexport */_easeOutElastic
|
|
295
|
+
);
|
|
296
|
+
},
|
|
297
|
+
"easeOutExpo": function easeOutExpo() {
|
|
298
|
+
return (/* reexport */_easeOutExpo
|
|
299
|
+
);
|
|
300
|
+
},
|
|
301
|
+
"easeOutQuad": function easeOutQuad() {
|
|
302
|
+
return (/* reexport */_easeOutQuad
|
|
303
|
+
);
|
|
304
|
+
},
|
|
305
|
+
"easeOutQuart": function easeOutQuart() {
|
|
306
|
+
return (/* reexport */_easeOutQuart
|
|
307
|
+
);
|
|
308
|
+
},
|
|
309
|
+
"easeOutQuint": function easeOutQuint() {
|
|
310
|
+
return (/* reexport */_easeOutQuint
|
|
311
|
+
);
|
|
312
|
+
},
|
|
313
|
+
"easeOutSine": function easeOutSine() {
|
|
314
|
+
return (/* reexport */_easeOutSine
|
|
315
|
+
);
|
|
316
|
+
},
|
|
317
|
+
"extractContentsOfBraces": function extractContentsOfBraces() {
|
|
318
|
+
return (/* reexport */_extractContentsOfBraces
|
|
319
|
+
);
|
|
320
|
+
},
|
|
321
|
+
"extractContentsOfBrackets": function extractContentsOfBrackets() {
|
|
322
|
+
return (/* reexport */_extractContentsOfBrackets
|
|
323
|
+
);
|
|
324
|
+
},
|
|
325
|
+
"extractContentsOfParentheses": function extractContentsOfParentheses() {
|
|
326
|
+
return (/* reexport */_extractContentsOfParentheses
|
|
327
|
+
);
|
|
328
|
+
},
|
|
329
|
+
"flatData": function flatData() {
|
|
330
|
+
return (/* reexport */_flatData
|
|
331
|
+
);
|
|
332
|
+
},
|
|
333
|
+
"flatTree": function flatTree() {
|
|
334
|
+
return (/* reexport */_flatTree
|
|
335
|
+
);
|
|
336
|
+
},
|
|
337
|
+
"getAbsoluteCoordinates": function getAbsoluteCoordinates() {
|
|
338
|
+
return (/* reexport */_getAbsoluteCoordinates
|
|
339
|
+
);
|
|
340
|
+
},
|
|
341
|
+
"getAbsolutePositionOfStage": function getAbsolutePositionOfStage() {
|
|
342
|
+
return (/* reexport */_getAbsolutePositionOfStage
|
|
343
|
+
);
|
|
344
|
+
},
|
|
345
|
+
"getAllDepth": function getAllDepth() {
|
|
346
|
+
return (/* reexport */_getAllDepth
|
|
347
|
+
);
|
|
348
|
+
},
|
|
349
|
+
"getAllSiblings": function getAllSiblings() {
|
|
350
|
+
return (/* reexport */_getAllSiblings
|
|
351
|
+
);
|
|
352
|
+
},
|
|
353
|
+
"getCalendarDate": function getCalendarDate() {
|
|
354
|
+
return (/* reexport */_getCalendarDate
|
|
355
|
+
);
|
|
356
|
+
},
|
|
357
|
+
"getChildren": function getChildren() {
|
|
358
|
+
return (/* reexport */_getChildren
|
|
359
|
+
);
|
|
360
|
+
},
|
|
361
|
+
"getCurrentDate": function getCurrentDate() {
|
|
362
|
+
return (/* reexport */_getCurrentDate
|
|
363
|
+
);
|
|
364
|
+
},
|
|
365
|
+
"getCurrentDay": function getCurrentDay() {
|
|
366
|
+
return (/* reexport */_getCurrentDay
|
|
367
|
+
);
|
|
368
|
+
},
|
|
369
|
+
"getCurrentMonth": function getCurrentMonth() {
|
|
370
|
+
return (/* reexport */_getCurrentMonth
|
|
371
|
+
);
|
|
372
|
+
},
|
|
373
|
+
"getCurrentYear": function getCurrentYear() {
|
|
374
|
+
return (/* reexport */_getCurrentYear
|
|
375
|
+
);
|
|
376
|
+
},
|
|
377
|
+
"getDocument": function getDocument() {
|
|
378
|
+
return (/* reexport */_getDocument
|
|
379
|
+
);
|
|
380
|
+
},
|
|
381
|
+
"getFirstAndLastMonthDay": function getFirstAndLastMonthDay() {
|
|
382
|
+
return (/* reexport */_getFirstAndLastMonthDay
|
|
383
|
+
);
|
|
384
|
+
},
|
|
385
|
+
"getFullTime": function getFullTime() {
|
|
386
|
+
return (/* reexport */_getFullTime
|
|
387
|
+
);
|
|
388
|
+
},
|
|
389
|
+
"getLastDayInMonth": function getLastDayInMonth() {
|
|
390
|
+
return (/* reexport */_getLastDayInMonth
|
|
391
|
+
);
|
|
392
|
+
},
|
|
393
|
+
"getNextMonthDate": function getNextMonthDate() {
|
|
394
|
+
return (/* reexport */_getNextMonthDate
|
|
395
|
+
);
|
|
396
|
+
},
|
|
397
|
+
"getNextSiblings": function getNextSiblings() {
|
|
398
|
+
return (/* reexport */_getNextSiblings
|
|
399
|
+
);
|
|
400
|
+
},
|
|
401
|
+
"getNextYearDate": function getNextYearDate() {
|
|
402
|
+
return (/* reexport */_getNextYearDate
|
|
403
|
+
);
|
|
404
|
+
},
|
|
405
|
+
"getNow": function getNow() {
|
|
406
|
+
return (/* reexport */_getNow
|
|
407
|
+
);
|
|
408
|
+
},
|
|
409
|
+
"getOffset": function getOffset() {
|
|
410
|
+
return (/* reexport */_getOffset
|
|
411
|
+
);
|
|
412
|
+
},
|
|
413
|
+
"getParents": function getParents() {
|
|
414
|
+
return (/* reexport */_getParents
|
|
415
|
+
);
|
|
416
|
+
},
|
|
417
|
+
"getPosition": function getPosition() {
|
|
418
|
+
return (/* reexport */_getPosition
|
|
419
|
+
);
|
|
420
|
+
},
|
|
421
|
+
"getPrevMonthDate": function getPrevMonthDate() {
|
|
422
|
+
return (/* reexport */_getPrevMonthDate
|
|
423
|
+
);
|
|
424
|
+
},
|
|
425
|
+
"getPrevYearDate": function getPrevYearDate() {
|
|
426
|
+
return (/* reexport */_getPrevYearDate
|
|
427
|
+
);
|
|
428
|
+
},
|
|
429
|
+
"getPreviousSiblings": function getPreviousSiblings() {
|
|
430
|
+
return (/* reexport */_getPreviousSiblings
|
|
431
|
+
);
|
|
432
|
+
},
|
|
433
|
+
"getSpecifiedDate": function getSpecifiedDate() {
|
|
434
|
+
return (/* reexport */_getSpecifiedDate
|
|
435
|
+
);
|
|
436
|
+
},
|
|
437
|
+
"getTodayDate": function getTodayDate() {
|
|
438
|
+
return (/* reexport */_getTodayDate
|
|
439
|
+
);
|
|
440
|
+
},
|
|
441
|
+
"getTomorrowDate": function getTomorrowDate() {
|
|
442
|
+
return (/* reexport */_getTomorrowDate
|
|
443
|
+
);
|
|
444
|
+
},
|
|
445
|
+
"getTransitionDuration": function getTransitionDuration() {
|
|
446
|
+
return (/* reexport */_getTransitionDuration
|
|
447
|
+
);
|
|
448
|
+
},
|
|
449
|
+
"getYesterdayDate": function getYesterdayDate() {
|
|
450
|
+
return (/* reexport */_getYesterdayDate
|
|
451
|
+
);
|
|
452
|
+
},
|
|
453
|
+
"isElement": function isElement() {
|
|
454
|
+
return (/* reexport */_isElement
|
|
455
|
+
);
|
|
456
|
+
},
|
|
457
|
+
"isHTMLElement": function isHTMLElement() {
|
|
458
|
+
return (/* reexport */_isHTMLElement
|
|
459
|
+
);
|
|
460
|
+
},
|
|
461
|
+
"isJSON": function isJSON() {
|
|
462
|
+
return (/* reexport */_isJSON
|
|
463
|
+
);
|
|
464
|
+
},
|
|
465
|
+
"isNode": function isNode() {
|
|
466
|
+
return (/* reexport */_isNode
|
|
467
|
+
);
|
|
468
|
+
},
|
|
469
|
+
"isNumeric": function isNumeric() {
|
|
470
|
+
return (/* reexport */_isNumeric
|
|
471
|
+
);
|
|
472
|
+
},
|
|
473
|
+
"isRootElement": function isRootElement() {
|
|
474
|
+
return (/* reexport */_isRootElement
|
|
475
|
+
);
|
|
476
|
+
},
|
|
477
|
+
"isShadowRoot": function isShadowRoot() {
|
|
478
|
+
return (/* reexport */_isShadowRoot
|
|
479
|
+
);
|
|
480
|
+
},
|
|
481
|
+
"isValidDate": function isValidDate() {
|
|
482
|
+
return (/* reexport */_isValidDate
|
|
483
|
+
);
|
|
484
|
+
},
|
|
485
|
+
"isValidDay": function isValidDay() {
|
|
486
|
+
return (/* reexport */_isValidDay
|
|
487
|
+
);
|
|
488
|
+
},
|
|
489
|
+
"isValidHours": function isValidHours() {
|
|
490
|
+
return (/* reexport */_isValidHours
|
|
491
|
+
);
|
|
492
|
+
},
|
|
493
|
+
"isValidMinutesAndSeconds": function isValidMinutesAndSeconds() {
|
|
494
|
+
return (/* reexport */_isValidMinutesAndSeconds
|
|
495
|
+
);
|
|
496
|
+
},
|
|
497
|
+
"isValidMonth": function isValidMonth() {
|
|
498
|
+
return (/* reexport */_isValidMonth
|
|
499
|
+
);
|
|
500
|
+
},
|
|
501
|
+
"isValidNumeric": function isValidNumeric() {
|
|
502
|
+
return (/* reexport */_isValidNumeric
|
|
503
|
+
);
|
|
504
|
+
},
|
|
505
|
+
"isValidYear": function isValidYear() {
|
|
506
|
+
return (/* reexport */_isValidYear
|
|
507
|
+
);
|
|
508
|
+
},
|
|
509
|
+
"nodeContains": function nodeContains() {
|
|
510
|
+
return (/* reexport */_nodeContains
|
|
511
|
+
);
|
|
512
|
+
},
|
|
513
|
+
"padZero": function padZero() {
|
|
514
|
+
return (/* reexport */_padZero
|
|
515
|
+
);
|
|
516
|
+
},
|
|
517
|
+
"readStream": function readStream() {
|
|
518
|
+
return (/* reexport */_readStream2
|
|
519
|
+
);
|
|
520
|
+
},
|
|
521
|
+
"setDateDays": function setDateDays() {
|
|
522
|
+
return (/* reexport */_setDateDays
|
|
523
|
+
);
|
|
524
|
+
},
|
|
525
|
+
"setDateHours": function setDateHours() {
|
|
526
|
+
return (/* reexport */_setDateHours
|
|
527
|
+
);
|
|
528
|
+
},
|
|
529
|
+
"setDateMinutes": function setDateMinutes() {
|
|
530
|
+
return (/* reexport */_setDateMinutes
|
|
531
|
+
);
|
|
532
|
+
},
|
|
533
|
+
"setDefaultOptions": function setDefaultOptions() {
|
|
534
|
+
return (/* reexport */_setDefaultOptions
|
|
535
|
+
);
|
|
536
|
+
},
|
|
537
|
+
"throttle": function throttle() {
|
|
538
|
+
return (/* reexport */_throttle
|
|
539
|
+
);
|
|
540
|
+
},
|
|
541
|
+
"timestampToDate": function timestampToDate() {
|
|
542
|
+
return (/* reexport */_timestampToDate
|
|
543
|
+
);
|
|
544
|
+
},
|
|
545
|
+
"toBinary": function toBinary() {
|
|
546
|
+
return (/* reexport */_toBinary
|
|
547
|
+
);
|
|
548
|
+
},
|
|
549
|
+
"uint8arrayToArr": function uint8arrayToArr() {
|
|
550
|
+
return (/* reexport */_uint8arrayToArr
|
|
551
|
+
);
|
|
552
|
+
},
|
|
553
|
+
"uint8arrayToBase64Str": function uint8arrayToBase64Str() {
|
|
554
|
+
return (/* reexport */_uint8arrayToBase64Str
|
|
555
|
+
);
|
|
556
|
+
},
|
|
557
|
+
"useAutosizeTextArea": function useAutosizeTextArea() {
|
|
558
|
+
return (/* reexport */hooks_useAutosizeTextArea
|
|
559
|
+
);
|
|
560
|
+
},
|
|
561
|
+
"useClickOutside": function useClickOutside() {
|
|
562
|
+
return (/* reexport */hooks_useClickOutside
|
|
563
|
+
);
|
|
564
|
+
},
|
|
565
|
+
"useDebounce": function useDebounce() {
|
|
566
|
+
return (/* reexport */hooks_useDebounce
|
|
567
|
+
);
|
|
568
|
+
},
|
|
569
|
+
"useInterval": function useInterval() {
|
|
570
|
+
return (/* reexport */hooks_useInterval
|
|
571
|
+
);
|
|
572
|
+
},
|
|
573
|
+
"useKeyPress": function useKeyPress() {
|
|
574
|
+
return (/* reexport */hooks_useKeyPress
|
|
575
|
+
);
|
|
576
|
+
},
|
|
577
|
+
"useThrottle": function useThrottle() {
|
|
578
|
+
return (/* reexport */hooks_useThrottle
|
|
579
|
+
);
|
|
580
|
+
},
|
|
581
|
+
"useWindowScroll": function useWindowScroll() {
|
|
582
|
+
return (/* reexport */hooks_useWindowScroll
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
});
|
|
586
|
+
; // CONCATENATED MODULE: ./src/libs/easing.js
|
|
587
|
+
/*
|
|
588
|
+
* All easing functions
|
|
589
|
+
* @link: https://easings.net
|
|
590
|
+
* @param {Number} t - time (Amount of time that has passed since the beginning of the animation. Usually starts at 0 and is slowly increased using a game loop or other update function.)
|
|
591
|
+
* @param {Number} b - beginning value (The starting point of the animation. Usually it's a static value, you can start at 0 for example.)
|
|
592
|
+
* @param {Number} c - change in value (The amount of change needed to go from starting point to end point. It's also usually a static value.)
|
|
593
|
+
* @param {Number} d - duration (Amount of time the animation will take. Usually a static value aswell.)
|
|
594
|
+
* @return {Number}
|
|
595
|
+
*/
|
|
596
|
+
function _easeLinear(t, b, c, d) {
|
|
597
|
+
return c * t / d + b;
|
|
598
|
+
}
|
|
599
|
+
function _easeInQuad(t, b, c, d) {
|
|
600
|
+
return c * (t /= d) * t + b;
|
|
601
|
+
}
|
|
602
|
+
function _easeOutQuad(t, b, c, d) {
|
|
603
|
+
return -c * (t /= d) * (t - 2) + b;
|
|
604
|
+
}
|
|
605
|
+
function _easeInOutQuad(t, b, c, d) {
|
|
606
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t + b;
|
|
607
|
+
return -c / 2 * (--t * (t - 2) - 1) + b;
|
|
608
|
+
}
|
|
609
|
+
function _easeInSine(t, b, c, d) {
|
|
610
|
+
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
|
|
611
|
+
}
|
|
612
|
+
function _easeOutSine(t, b, c, d) {
|
|
613
|
+
return c * Math.sin(t / d * (Math.PI / 2)) + b;
|
|
614
|
+
}
|
|
615
|
+
function _easeInOutSine(t, b, c, d) {
|
|
616
|
+
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
|
|
617
|
+
}
|
|
618
|
+
function _easeInExpo(t, b, c, d) {
|
|
619
|
+
return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
|
|
620
|
+
}
|
|
621
|
+
function _easeOutExpo(t, b, c, d) {
|
|
622
|
+
return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
|
|
623
|
+
}
|
|
624
|
+
function _easeInOutExpo(t, b, c, d) {
|
|
625
|
+
if (t == 0) return b;
|
|
626
|
+
if (t == d) return b + c;
|
|
627
|
+
if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
628
|
+
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
629
|
+
}
|
|
630
|
+
function _easeInCirc(t, b, c, d) {
|
|
631
|
+
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
|
|
632
|
+
}
|
|
633
|
+
function _easeOutCirc(t, b, c, d) {
|
|
634
|
+
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
|
|
635
|
+
}
|
|
636
|
+
function _easeInOutCirc(t, b, c, d) {
|
|
637
|
+
if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
|
|
638
|
+
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
|
|
639
|
+
}
|
|
640
|
+
function _easeInCubic(t, b, c, d) {
|
|
641
|
+
return c * (t /= d) * t * t + b;
|
|
642
|
+
}
|
|
643
|
+
function _easeOutCubic(t, b, c, d) {
|
|
644
|
+
return c * ((t = t / d - 1) * t * t + 1) + b;
|
|
645
|
+
}
|
|
646
|
+
function _easeInOutCubic(t, b, c, d) {
|
|
647
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
|
|
648
|
+
return c / 2 * ((t -= 2) * t * t + 2) + b;
|
|
649
|
+
}
|
|
650
|
+
function _easeInQuart(t, b, c, d) {
|
|
651
|
+
return c * (t /= d) * t * t * t + b;
|
|
652
|
+
}
|
|
653
|
+
function _easeOutQuart(t, b, c, d) {
|
|
654
|
+
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
|
|
655
|
+
}
|
|
656
|
+
function _easeInOutQuart(t, b, c, d) {
|
|
657
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
|
|
658
|
+
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
|
|
659
|
+
}
|
|
660
|
+
function _easeInQuint(t, b, c, d) {
|
|
661
|
+
return c * (t /= d) * t * t * t * t + b;
|
|
662
|
+
}
|
|
663
|
+
function _easeOutQuint(t, b, c, d) {
|
|
664
|
+
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
|
|
665
|
+
}
|
|
666
|
+
function _easeInOutQuint(t, b, c, d) {
|
|
667
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
|
|
668
|
+
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
|
|
669
|
+
}
|
|
670
|
+
function _easeInElastic(t, b, c, d) {
|
|
671
|
+
var s = 1.70158;
|
|
672
|
+
var p = 0;
|
|
673
|
+
var a = c;
|
|
674
|
+
if (t == 0) return b;
|
|
675
|
+
if ((t /= d) == 1) return b + c;
|
|
676
|
+
if (!p) p = d * .3;
|
|
677
|
+
if (a < Math.abs(c)) {
|
|
678
|
+
a = c;
|
|
679
|
+
var s = p / 4;
|
|
680
|
+
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
681
|
+
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
682
|
+
}
|
|
683
|
+
function _easeOutElastic(t, b, c, d) {
|
|
684
|
+
var s = 1.70158;
|
|
685
|
+
var p = 0;
|
|
686
|
+
var a = c;
|
|
687
|
+
if (t == 0) return b;
|
|
688
|
+
if ((t /= d) == 1) return b + c;
|
|
689
|
+
if (!p) p = d * .3;
|
|
690
|
+
if (a < Math.abs(c)) {
|
|
691
|
+
a = c;
|
|
692
|
+
var s = p / 4;
|
|
693
|
+
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
694
|
+
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
|
|
695
|
+
}
|
|
696
|
+
function _easeInOutElastic(t, b, c, d) {
|
|
697
|
+
var s = 1.70158;
|
|
698
|
+
var p = 0;
|
|
699
|
+
var a = c;
|
|
700
|
+
if (t == 0) return b;
|
|
701
|
+
if ((t /= d / 2) == 2) return b + c;
|
|
702
|
+
if (!p) p = d * (.3 * 1.5);
|
|
703
|
+
if (a < Math.abs(c)) {
|
|
704
|
+
a = c;
|
|
705
|
+
var s = p / 4;
|
|
706
|
+
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
707
|
+
if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
708
|
+
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
|
|
709
|
+
}
|
|
710
|
+
function _easeInBack(t, b, c, d) {
|
|
711
|
+
if (s == undefined) s = 1.70158;
|
|
712
|
+
return c * (t /= d) * t * ((s + 1) * t - s) + b;
|
|
713
|
+
}
|
|
714
|
+
function _easeOutBack(t, b, c, d) {
|
|
715
|
+
if (s == undefined) s = 1.70158;
|
|
716
|
+
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
|
|
717
|
+
}
|
|
718
|
+
function _easeInOutBack(t, b, c, d) {
|
|
719
|
+
if (s == undefined) s = 1.70158;
|
|
720
|
+
if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
|
|
721
|
+
return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
|
|
722
|
+
}
|
|
723
|
+
; // CONCATENATED MODULE: ./src/libs/init-default-options.js
|
|
724
|
+
function _typeof(obj) {
|
|
725
|
+
"@babel/helpers - typeof";
|
|
103
726
|
|
|
104
|
-
|
|
727
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
728
|
+
return typeof obj;
|
|
729
|
+
} : function (obj) {
|
|
730
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
731
|
+
}, _typeof(obj);
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Set a default JSON format configuration
|
|
735
|
+
* @public
|
|
736
|
+
*
|
|
737
|
+
* @param {JSON} props - Set some default keys and values.
|
|
738
|
+
* @param {JSON} options - A JSON variable passed in from outside, including key and value.
|
|
739
|
+
* @return {JSON} - Merge the new and old values.
|
|
740
|
+
*/
|
|
741
|
+
function _setDefaultOptions(props, options) {
|
|
742
|
+
if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
|
|
743
|
+
//Set a default configuration
|
|
744
|
+
if (_isJSON(props)) {
|
|
745
|
+
var defaultConfigValues = Object.values(props);
|
|
746
|
+
Object.keys(props).forEach(function (prop, index) {
|
|
747
|
+
// Well-formed string type
|
|
748
|
+
Object.keys(options).forEach(function (prop2, index2) {
|
|
749
|
+
if (prop2 === prop) {
|
|
750
|
+
var _v = options[prop2];
|
|
751
|
+
if (_v == 'true') _v = true;
|
|
752
|
+
if (_v == 'false') _v = false;
|
|
753
|
+
if (_isValidNumeric(_v)) _v = parseFloat(_v);
|
|
754
|
+
if (_isJSON(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
|
|
755
|
+
options[prop2] = _v;
|
|
756
|
+
}
|
|
757
|
+
});
|
|
105
758
|
|
|
106
|
-
|
|
107
|
-
|
|
759
|
+
//
|
|
760
|
+
if (_typeof(options[prop]) === ( true ? "undefined" : 0) || options[prop] === null) options[prop] = defaultConfigValues[index];
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
return options;
|
|
764
|
+
}
|
|
108
765
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
124
|
-
function easeOutQuad(t, b, c, d) {
|
|
125
|
-
return -c * (t /= d) * (t - 2) + b;
|
|
126
|
-
}
|
|
127
|
-
function easeInOutQuad(t, b, c, d) {
|
|
128
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t + b;
|
|
129
|
-
return -c / 2 * (--t * (t - 2) - 1) + b;
|
|
130
|
-
}
|
|
131
|
-
function easeInSine(t, b, c, d) {
|
|
132
|
-
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
|
|
133
|
-
}
|
|
134
|
-
function easeOutSine(t, b, c, d) {
|
|
135
|
-
return c * Math.sin(t / d * (Math.PI / 2)) + b;
|
|
136
|
-
}
|
|
137
|
-
function easeInOutSine(t, b, c, d) {
|
|
138
|
-
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
|
|
139
|
-
}
|
|
140
|
-
function easeInExpo(t, b, c, d) {
|
|
141
|
-
return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
|
|
142
|
-
}
|
|
143
|
-
function easeOutExpo(t, b, c, d) {
|
|
144
|
-
return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
|
|
145
|
-
}
|
|
146
|
-
function easeInOutExpo(t, b, c, d) {
|
|
147
|
-
if (t == 0) return b;
|
|
148
|
-
if (t == d) return b + c;
|
|
149
|
-
if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
150
|
-
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
151
|
-
}
|
|
152
|
-
function easeInCirc(t, b, c, d) {
|
|
153
|
-
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
|
|
154
|
-
}
|
|
155
|
-
function easeOutCirc(t, b, c, d) {
|
|
156
|
-
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
|
|
157
|
-
}
|
|
158
|
-
function easeInOutCirc(t, b, c, d) {
|
|
159
|
-
if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
|
|
160
|
-
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
|
|
161
|
-
}
|
|
162
|
-
function easeInCubic(t, b, c, d) {
|
|
163
|
-
return c * (t /= d) * t * t + b;
|
|
164
|
-
}
|
|
165
|
-
function easeOutCubic(t, b, c, d) {
|
|
166
|
-
return c * ((t = t / d - 1) * t * t + 1) + b;
|
|
167
|
-
}
|
|
168
|
-
function easeInOutCubic(t, b, c, d) {
|
|
169
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
|
|
170
|
-
return c / 2 * ((t -= 2) * t * t + 2) + b;
|
|
171
|
-
}
|
|
172
|
-
function easeInQuart(t, b, c, d) {
|
|
173
|
-
return c * (t /= d) * t * t * t + b;
|
|
174
|
-
}
|
|
175
|
-
function easeOutQuart(t, b, c, d) {
|
|
176
|
-
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
|
|
177
|
-
}
|
|
178
|
-
function easeInOutQuart(t, b, c, d) {
|
|
179
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
|
|
180
|
-
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
|
|
181
|
-
}
|
|
182
|
-
function easeInQuint(t, b, c, d) {
|
|
183
|
-
return c * (t /= d) * t * t * t * t + b;
|
|
184
|
-
}
|
|
185
|
-
function easeOutQuint(t, b, c, d) {
|
|
186
|
-
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
|
|
187
|
-
}
|
|
188
|
-
function easeInOutQuint(t, b, c, d) {
|
|
189
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
|
|
190
|
-
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
|
|
191
|
-
}
|
|
192
|
-
function easeInElastic(t, b, c, d) {
|
|
193
|
-
var s = 1.70158;
|
|
194
|
-
var p = 0;
|
|
195
|
-
var a = c;
|
|
196
|
-
if (t == 0) return b;
|
|
197
|
-
if ((t /= d) == 1) return b + c;
|
|
198
|
-
if (!p) p = d * .3;
|
|
199
|
-
if (a < Math.abs(c)) {
|
|
200
|
-
a = c;
|
|
201
|
-
var s = p / 4;
|
|
202
|
-
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
203
|
-
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
204
|
-
}
|
|
205
|
-
function easeOutElastic(t, b, c, d) {
|
|
206
|
-
var s = 1.70158;
|
|
207
|
-
var p = 0;
|
|
208
|
-
var a = c;
|
|
209
|
-
if (t == 0) return b;
|
|
210
|
-
if ((t /= d) == 1) return b + c;
|
|
211
|
-
if (!p) p = d * .3;
|
|
212
|
-
if (a < Math.abs(c)) {
|
|
213
|
-
a = c;
|
|
214
|
-
var s = p / 4;
|
|
215
|
-
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
216
|
-
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
|
|
217
|
-
}
|
|
218
|
-
function easeInOutElastic(t, b, c, d) {
|
|
219
|
-
var s = 1.70158;
|
|
220
|
-
var p = 0;
|
|
221
|
-
var a = c;
|
|
222
|
-
if (t == 0) return b;
|
|
223
|
-
if ((t /= d / 2) == 2) return b + c;
|
|
224
|
-
if (!p) p = d * (.3 * 1.5);
|
|
225
|
-
if (a < Math.abs(c)) {
|
|
226
|
-
a = c;
|
|
227
|
-
var s = p / 4;
|
|
228
|
-
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
229
|
-
if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
230
|
-
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
|
|
231
|
-
}
|
|
232
|
-
function easeInBack(t, b, c, d) {
|
|
233
|
-
if (s == undefined) s = 1.70158;
|
|
234
|
-
return c * (t /= d) * t * ((s + 1) * t - s) + b;
|
|
235
|
-
}
|
|
236
|
-
function easeOutBack(t, b, c, d) {
|
|
237
|
-
if (s == undefined) s = 1.70158;
|
|
238
|
-
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
|
|
239
|
-
}
|
|
240
|
-
function easeInOutBack(t, b, c, d) {
|
|
241
|
-
if (s == undefined) s = 1.70158;
|
|
242
|
-
if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
|
|
243
|
-
return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
|
|
244
|
-
}
|
|
245
|
-
module.exports = {
|
|
246
|
-
easeLinear: easeLinear,
|
|
247
|
-
easeInQuad: easeInQuad,
|
|
248
|
-
easeOutQuad: easeOutQuad,
|
|
249
|
-
easeInOutQuad: easeInOutQuad,
|
|
250
|
-
easeInSine: easeInSine,
|
|
251
|
-
easeOutSine: easeOutSine,
|
|
252
|
-
easeInOutSine: easeInOutSine,
|
|
253
|
-
easeInExpo: easeInExpo,
|
|
254
|
-
easeOutExpo: easeOutExpo,
|
|
255
|
-
easeInOutExpo: easeInOutExpo,
|
|
256
|
-
easeInCirc: easeInCirc,
|
|
257
|
-
easeOutCirc: easeOutCirc,
|
|
258
|
-
easeInOutCirc: easeInOutCirc,
|
|
259
|
-
easeInCubic: easeInCubic,
|
|
260
|
-
easeOutCubic: easeOutCubic,
|
|
261
|
-
easeInOutCubic: easeInOutCubic,
|
|
262
|
-
easeInQuart: easeInQuart,
|
|
263
|
-
easeOutQuart: easeOutQuart,
|
|
264
|
-
easeInOutQuart: easeInOutQuart,
|
|
265
|
-
easeInQuint: easeInQuint,
|
|
266
|
-
easeOutQuint: easeOutQuint,
|
|
267
|
-
easeInOutQuint: easeInOutQuint,
|
|
268
|
-
easeInElastic: easeInElastic,
|
|
269
|
-
easeOutElastic: easeOutElastic,
|
|
270
|
-
easeInOutElastic: easeInOutElastic,
|
|
271
|
-
easeInBack: easeInBack,
|
|
272
|
-
easeOutBack: easeOutBack,
|
|
273
|
-
easeInOutBack: easeInOutBack
|
|
274
|
-
};
|
|
766
|
+
/**
|
|
767
|
+
* Check if a string is a valid number
|
|
768
|
+
* @private
|
|
769
|
+
*/
|
|
770
|
+
function _isValidNumeric(str) {
|
|
771
|
+
if (typeof str != "string") return false; // we only process strings!
|
|
772
|
+
if (!isNaN(str) &&
|
|
773
|
+
// use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)
|
|
774
|
+
!isNaN(parseFloat(str)) // ensure strings of whitespace fail
|
|
775
|
+
) {
|
|
776
|
+
return true;
|
|
777
|
+
} else {
|
|
778
|
+
return false;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
275
781
|
|
|
276
|
-
|
|
782
|
+
/**
|
|
783
|
+
* Determine whether it is in JSON format
|
|
784
|
+
* @private
|
|
785
|
+
*/
|
|
786
|
+
function _isJSON(str) {
|
|
787
|
+
if (typeof str === 'string' && str.length > 0) {
|
|
788
|
+
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
789
|
+
return false;
|
|
790
|
+
} else {
|
|
791
|
+
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
792
|
+
return true;
|
|
793
|
+
} else {
|
|
794
|
+
return false;
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
} else {
|
|
798
|
+
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
799
|
+
return true;
|
|
800
|
+
} else {
|
|
801
|
+
return false;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
; // CONCATENATED MODULE: ./src/libs/anim.js
|
|
806
|
+
function anim_typeof(obj) {
|
|
807
|
+
"@babel/helpers - typeof";
|
|
277
808
|
|
|
278
|
-
|
|
279
|
-
|
|
809
|
+
return anim_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
810
|
+
return typeof obj;
|
|
811
|
+
} : function (obj) {
|
|
812
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
813
|
+
}, anim_typeof(obj);
|
|
814
|
+
}
|
|
280
815
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
816
|
+
/**
|
|
817
|
+
* Element Animate
|
|
818
|
+
* @public
|
|
819
|
+
*
|
|
820
|
+
* @param {HTMLElement} curElement - Element of animation.
|
|
821
|
+
* @param {?JSON} config - Configuration of animation
|
|
822
|
+
* @param {?string} easeType - Types of easing animation.
|
|
823
|
+
* @param {?Function} callback - Callback after animation ends
|
|
824
|
+
*/
|
|
825
|
+
function animateStyles(curElement, config) {
|
|
826
|
+
var easeType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'linear';
|
|
827
|
+
var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};
|
|
828
|
+
if (anim_typeof(curElement) === ( true ? "undefined" : 0)) return;
|
|
829
|
+
|
|
830
|
+
// Set a default configuration
|
|
831
|
+
config = _setDefaultOptions({
|
|
832
|
+
"startHeight": 0,
|
|
833
|
+
// node.scrollHeight
|
|
834
|
+
"endHeight": 0,
|
|
835
|
+
"speed": 200 //ms
|
|
836
|
+
}, config);
|
|
837
|
+
|
|
838
|
+
//
|
|
839
|
+
var _endHeight = config.endHeight,
|
|
840
|
+
_speed = config.speed;
|
|
841
|
+
var _startHeight = config.startHeight;
|
|
842
|
+
var duration = _speed;
|
|
843
|
+
var start = new Date().getTime();
|
|
844
|
+
var from = 0;
|
|
845
|
+
var to = 100;
|
|
846
|
+
var requestId;
|
|
847
|
+
var loop = function loop() {
|
|
848
|
+
//easing
|
|
849
|
+
var time = new Date().getTime() - start; //Work out the elapsed time
|
|
850
|
+
var val;
|
|
851
|
+
switch (easeType) {
|
|
852
|
+
case "linear":
|
|
853
|
+
val = _easeLinear(time, from, to - from, duration);
|
|
854
|
+
break;
|
|
855
|
+
case "ease-in":
|
|
856
|
+
val = _easeInQuad(time, from, to - from, duration);
|
|
857
|
+
break;
|
|
858
|
+
case "ease-out":
|
|
859
|
+
val = _easeOutQuad(time, from, to - from, duration);
|
|
860
|
+
break;
|
|
861
|
+
case "ease-in-out":
|
|
862
|
+
val = _easeInOutQuad(time, from, to - from, duration);
|
|
863
|
+
break;
|
|
864
|
+
default:
|
|
865
|
+
val = _easeLinear(time, from, to - from, duration);
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
// Elapsed time in miliseconds
|
|
869
|
+
var percent = val / 100;
|
|
870
|
+
|
|
871
|
+
// change height
|
|
872
|
+
if (curElement.clientHeight < _endHeight) {
|
|
873
|
+
curElement.style.height = _endHeight * percent + 'px';
|
|
874
|
+
} else {
|
|
875
|
+
if (_startHeight > 0) curElement.style.height = _startHeight - _startHeight * percent + 'px';
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
//If the elapsed time is less than the speed (ms)
|
|
879
|
+
if (time < duration) {
|
|
880
|
+
//
|
|
881
|
+
requestId = window.requestAnimationFrame(loop);
|
|
882
|
+
} else {
|
|
883
|
+
// change height
|
|
884
|
+
curElement.style.height = _endHeight + 'px';
|
|
885
|
+
if (typeof callback === 'function') callback();
|
|
886
|
+
|
|
887
|
+
//
|
|
888
|
+
window.cancelAnimationFrame(requestId);
|
|
889
|
+
}
|
|
890
|
+
};
|
|
891
|
+
requestId = window.requestAnimationFrame(loop);
|
|
305
892
|
}
|
|
306
|
-
|
|
893
|
+
/* harmony default export */
|
|
894
|
+
var anim = animateStyles;
|
|
895
|
+
; // CONCATENATED MODULE: ./src/libs/performance.js
|
|
896
|
+
/*
|
|
897
|
+
* Debounce
|
|
898
|
+
*
|
|
899
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
900
|
+
* @param {Number} limit - Waiting time.
|
|
901
|
+
* @return {Function} - Returns a new function.
|
|
902
|
+
*/
|
|
903
|
+
function _debounce(fn) {
|
|
904
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
905
|
+
var timer;
|
|
906
|
+
return function () {
|
|
907
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
908
|
+
clearTimeout(timer);
|
|
307
909
|
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
*
|
|
318
|
-
|
|
319
|
-
function
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
}
|
|
354
|
-
|
|
910
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
911
|
+
// Execute fn after another delay milliseconds
|
|
912
|
+
timer = setTimeout(function () {
|
|
913
|
+
fn.apply(this, arguments);
|
|
914
|
+
}, limit);
|
|
915
|
+
};
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/*
|
|
919
|
+
* Throttle
|
|
920
|
+
*
|
|
921
|
+
* @param {Function} fn - A function to be executed within the time limit.
|
|
922
|
+
* @param {Number} limit - Waiting time.
|
|
923
|
+
* @return {Function} - Returns a new function.
|
|
924
|
+
*/
|
|
925
|
+
function _throttle(fn) {
|
|
926
|
+
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
927
|
+
var waiting = false;
|
|
928
|
+
return function () {
|
|
929
|
+
if (!waiting) {
|
|
930
|
+
fn.apply(this, arguments);
|
|
931
|
+
waiting = true;
|
|
932
|
+
setTimeout(function () {
|
|
933
|
+
waiting = false;
|
|
934
|
+
}, limit);
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
; // CONCATENATED MODULE: ./src/libs/dom.js
|
|
939
|
+
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
940
|
+
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
941
|
+
if (!it) {
|
|
942
|
+
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
943
|
+
if (it) o = it;
|
|
944
|
+
var i = 0;
|
|
945
|
+
var F = function F() {};
|
|
946
|
+
return {
|
|
947
|
+
s: F,
|
|
948
|
+
n: function n() {
|
|
949
|
+
if (i >= o.length) return {
|
|
950
|
+
done: true
|
|
951
|
+
};
|
|
952
|
+
return {
|
|
953
|
+
done: false,
|
|
954
|
+
value: o[i++]
|
|
955
|
+
};
|
|
956
|
+
},
|
|
957
|
+
e: function e(_e) {
|
|
958
|
+
throw _e;
|
|
959
|
+
},
|
|
960
|
+
f: F
|
|
961
|
+
};
|
|
962
|
+
}
|
|
963
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
964
|
+
}
|
|
965
|
+
var normalCompletion = true,
|
|
966
|
+
didErr = false,
|
|
967
|
+
err;
|
|
968
|
+
return {
|
|
969
|
+
s: function s() {
|
|
970
|
+
it = it.call(o);
|
|
971
|
+
},
|
|
972
|
+
n: function n() {
|
|
973
|
+
var step = it.next();
|
|
974
|
+
normalCompletion = step.done;
|
|
975
|
+
return step;
|
|
976
|
+
},
|
|
977
|
+
e: function e(_e2) {
|
|
978
|
+
didErr = true;
|
|
979
|
+
err = _e2;
|
|
980
|
+
},
|
|
981
|
+
f: function f() {
|
|
982
|
+
try {
|
|
983
|
+
if (!normalCompletion && it["return"] != null) it["return"]();
|
|
984
|
+
} finally {
|
|
985
|
+
if (didErr) throw err;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
function _toConsumableArray(arr) {
|
|
991
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
992
|
+
}
|
|
993
|
+
function _nonIterableSpread() {
|
|
994
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
995
|
+
}
|
|
996
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
997
|
+
if (!o) return;
|
|
998
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
999
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1000
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1001
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1002
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1003
|
+
}
|
|
1004
|
+
function _iterableToArray(iter) {
|
|
1005
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1006
|
+
}
|
|
1007
|
+
function _arrayWithoutHoles(arr) {
|
|
1008
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1009
|
+
}
|
|
1010
|
+
function _arrayLikeToArray(arr, len) {
|
|
1011
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1012
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1013
|
+
return arr2;
|
|
1014
|
+
}
|
|
1015
|
+
/**
|
|
1016
|
+
* Dom Utilities
|
|
1017
|
+
* @param {HTMLElement} el - Element
|
|
1018
|
+
* @param {?String} filter - A filter string
|
|
1019
|
+
* @returns HtmlElementCollection
|
|
1020
|
+
*/
|
|
1021
|
+
function matches(el, filter) {
|
|
1022
|
+
if (el && el.nodeType === 1) {
|
|
1023
|
+
if (filter) {
|
|
1024
|
+
return el.matches(filter);
|
|
1025
|
+
}
|
|
1026
|
+
return true;
|
|
1027
|
+
}
|
|
1028
|
+
return false;
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
// the next siblings
|
|
1032
|
+
function _getNextSiblings(el) {
|
|
1033
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
1034
|
+
var sibs = [];
|
|
1035
|
+
while (el = el.nextSibling) {
|
|
1036
|
+
if (matches(el, filter)) {
|
|
1037
|
+
sibs.push(el);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return sibs;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
// previous siblings
|
|
1044
|
+
function _getPreviousSiblings(el) {
|
|
1045
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
1046
|
+
var sibs = [];
|
|
1047
|
+
while (el = el.previousSibling) {
|
|
1048
|
+
if (matches(el, filter)) {
|
|
1049
|
+
sibs.push(el);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
return sibs;
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
// parent and get all the siblings
|
|
1056
|
+
function _getAllSiblings(el) {
|
|
1057
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
1058
|
+
var sibs = [];
|
|
1059
|
+
el = el.parentNode.firstChild;
|
|
1060
|
+
while (el = el.nextSibling) {
|
|
1061
|
+
if (matches(el, filter)) {
|
|
1062
|
+
sibs.push(el);
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
return sibs;
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
// all parent nodes
|
|
1069
|
+
function _getParents(el) {
|
|
1070
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
1071
|
+
var parents = [];
|
|
1072
|
+
while (el = el.parentNode) {
|
|
1073
|
+
if (matches(el, filter)) {
|
|
1074
|
+
parents.push(el);
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
return parents;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// all child nodes
|
|
1081
|
+
function _getChildren(el) {
|
|
1082
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false || '';
|
|
1083
|
+
var all = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1084
|
+
all.push.apply(all, _toConsumableArray(el.childNodes));
|
|
1085
|
+
var _iterator = _createForOfIteratorHelper(el.childNodes),
|
|
1086
|
+
_step;
|
|
1087
|
+
try {
|
|
1088
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1089
|
+
var child = _step.value;
|
|
1090
|
+
_getChildren(child, filter, all);
|
|
1091
|
+
}
|
|
1092
|
+
} catch (err) {
|
|
1093
|
+
_iterator.e(err);
|
|
1094
|
+
} finally {
|
|
1095
|
+
_iterator.f();
|
|
1096
|
+
}
|
|
1097
|
+
var res = all.filter(function (item) {
|
|
1098
|
+
return matches(item, filter);
|
|
1099
|
+
});
|
|
1100
|
+
return res;
|
|
1101
|
+
}
|
|
1102
|
+
function _isRootElement(element) {
|
|
1103
|
+
return element.matches('html,body');
|
|
1104
|
+
}
|
|
1105
|
+
function _getDocument(node) {
|
|
1106
|
+
if (typeof node === 'undefined') {
|
|
1107
|
+
return document;
|
|
1108
|
+
} else {
|
|
1109
|
+
return node.ownerDocument;
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
function getWindow(node) {
|
|
1113
|
+
if (typeof node === 'undefined') {
|
|
1114
|
+
return window;
|
|
1115
|
+
} else {
|
|
1116
|
+
return node.ownerDocument.defaultView;
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
function _isNode(value) {
|
|
1120
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
1121
|
+
}
|
|
1122
|
+
function _isElement(value) {
|
|
1123
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
1124
|
+
}
|
|
1125
|
+
function _isHTMLElement(value) {
|
|
1126
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
1127
|
+
}
|
|
1128
|
+
function _isShadowRoot(value) {
|
|
1129
|
+
// Browsers without `ShadowRoot` support.
|
|
1130
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
1131
|
+
return false;
|
|
1132
|
+
}
|
|
1133
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
/* console.log(nodeContains(document.body, document.getElementById('obj'))) */
|
|
1137
|
+
function _nodeContains(parent, child) {
|
|
1138
|
+
var _child$getRootNode;
|
|
1139
|
+
if (!parent || !child) {
|
|
1140
|
+
return false;
|
|
1141
|
+
}
|
|
1142
|
+
var rootNode = (_child$getRootNode = child.getRootNode) === null || _child$getRootNode === void 0 ? void 0 : _child$getRootNode.call(child);
|
|
1143
|
+
|
|
1144
|
+
// First, attempt with faster native method
|
|
1145
|
+
if (parent.contains(child)) {
|
|
1146
|
+
return true;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
// then fallback to custom implementation with Shadow DOM support
|
|
1150
|
+
if (rootNode && _isShadowRoot(rootNode)) {
|
|
1151
|
+
var next = child;
|
|
1152
|
+
while (next) {
|
|
1153
|
+
if (parent === next) {
|
|
1154
|
+
return true;
|
|
1155
|
+
}
|
|
1156
|
+
// @ts-ignore
|
|
1157
|
+
next = next.parentNode || next.host;
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
// Give up, the result is false
|
|
1162
|
+
return false;
|
|
1163
|
+
}
|
|
1164
|
+
; // CONCATENATED MODULE: ./src/libs/get-element-property.js
|
|
1165
|
+
function get_element_property_typeof(obj) {
|
|
1166
|
+
"@babel/helpers - typeof";
|
|
1167
|
+
|
|
1168
|
+
return get_element_property_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1169
|
+
return typeof obj;
|
|
1170
|
+
} : function (obj) {
|
|
1171
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1172
|
+
}, get_element_property_typeof(obj);
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Get the -webkit-transition-duration property
|
|
1176
|
+
*
|
|
1177
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
1178
|
+
* @return {Number} - Returns a pure number.
|
|
1179
|
+
*/
|
|
1180
|
+
function _getTransitionDuration(el) {
|
|
1181
|
+
if (get_element_property_typeof(el) === ( true ? "undefined" : 0)) {
|
|
1182
|
+
return 0;
|
|
1183
|
+
}
|
|
1184
|
+
var style = window.getComputedStyle(el),
|
|
1185
|
+
duration = style.webkitTransitionDuration,
|
|
1186
|
+
delay = style.webkitTransitionDelay;
|
|
1187
|
+
if (get_element_property_typeof(duration) != ( true ? "undefined" : 0)) {
|
|
1188
|
+
// fix miliseconds vs seconds
|
|
1189
|
+
duration = duration.indexOf("ms") > -1 ? parseFloat(duration) : parseFloat(duration) * 1000;
|
|
1190
|
+
delay = delay.indexOf("ms") > -1 ? parseFloat(delay) : parseFloat(delay) * 1000;
|
|
1191
|
+
return duration;
|
|
1192
|
+
} else {
|
|
1193
|
+
return 0;
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
/**
|
|
1198
|
+
* Get an object's absolute position on the page
|
|
1199
|
+
*
|
|
1200
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
1201
|
+
* @return {Json} - An object containing the properties top and left.
|
|
1202
|
+
*/
|
|
1203
|
+
function _getAbsoluteCoordinates(el) {
|
|
1204
|
+
var windowWidth = window.innerWidth,
|
|
1205
|
+
leftPos = null,
|
|
1206
|
+
topPos = null;
|
|
1207
|
+
if (!document.getElementsByTagName('body')[0].className.match(/rtl/)) {
|
|
1208
|
+
leftPos = el.offsetLeft == 0 ? el.parentElement.offsetLeft : el.offsetLeft;
|
|
1209
|
+
topPos = el.offsetTop == 0 ? el.parentElement.offsetTop : el.offsetTop;
|
|
1210
|
+
} else {
|
|
1211
|
+
// width and height in pixels, including padding and border
|
|
1212
|
+
// Corresponds to outerWidth(), outerHeight()
|
|
1213
|
+
leftPos = el.offsetLeft == 0 ? windowWidth - (el.parentElement.offsetLeft + el.parentElement.offsetWidth) : windowWidth - (el.offsetLeft + el.offsetWidth);
|
|
1214
|
+
topPos = el.offsetTop == 0 ? windowWidth - (el.parentElement.offsetTop + el.parentElement.offsetHeight) : windowWidth - (el.offsetTop + el.offsetHeight);
|
|
1215
|
+
}
|
|
1216
|
+
return {
|
|
1217
|
+
'left': leftPos,
|
|
1218
|
+
'top': topPos
|
|
1219
|
+
};
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/**
|
|
1223
|
+
* Get the current coordinates of the first element in the set of matched elements, relative to the document.
|
|
1224
|
+
*
|
|
1225
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
1226
|
+
* @return {Json} - An object containing the properties top and left.
|
|
1227
|
+
*/
|
|
1228
|
+
function _getOffset(el) {
|
|
1229
|
+
var res = {
|
|
1230
|
+
top: 0,
|
|
1231
|
+
left: 0
|
|
1232
|
+
};
|
|
1233
|
+
var box = el.getBoundingClientRect();
|
|
1234
|
+
var top = 0,
|
|
1235
|
+
left = 0;
|
|
1236
|
+
|
|
1237
|
+
//Include scrollbar and border
|
|
1238
|
+
top = box.top + window.pageYOffset - document.documentElement.clientTop;
|
|
1239
|
+
left = box.left + window.pageXOffset - document.documentElement.clientLeft;
|
|
1240
|
+
res = {
|
|
1241
|
+
top: top,
|
|
1242
|
+
left: left
|
|
1243
|
+
};
|
|
1244
|
+
return res;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
/**
|
|
1248
|
+
* Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
|
|
1249
|
+
*
|
|
1250
|
+
* @param {Element} el - A DOM node containing one selector to match against.
|
|
1251
|
+
* @return {Json} - An object containing the properties top and left.
|
|
1252
|
+
*/
|
|
1253
|
+
function _getPosition(el) {
|
|
1254
|
+
var res = {
|
|
1255
|
+
top: 0,
|
|
1256
|
+
left: 0
|
|
1257
|
+
};
|
|
1258
|
+
var top = el.offsetTop ? el.offsetTop : 0,
|
|
1259
|
+
left = el.offsetLeft ? el.offsetLeft : 0;
|
|
1260
|
+
res = {
|
|
1261
|
+
top: top,
|
|
1262
|
+
left: left
|
|
1263
|
+
};
|
|
1264
|
+
return res;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
/**
|
|
1268
|
+
* Get the absolute position of the stage element
|
|
1269
|
+
*
|
|
1270
|
+
* @param {Element} domElement - A DOM node
|
|
1271
|
+
* @param {Number | String} left - left offset
|
|
1272
|
+
* @param {Number | String} top - top offset
|
|
1273
|
+
* @returns
|
|
1274
|
+
*/
|
|
1275
|
+
function _getAbsolutePositionOfStage(domElement) {
|
|
1276
|
+
var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1277
|
+
var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1278
|
+
if (!parseInt(left)) {
|
|
1279
|
+
left = 0;
|
|
1280
|
+
} else {
|
|
1281
|
+
left = parseInt(left);
|
|
1282
|
+
}
|
|
1283
|
+
if (!parseInt(top)) {
|
|
1284
|
+
top = 0;
|
|
1285
|
+
} else {
|
|
1286
|
+
top = parseInt(top);
|
|
1287
|
+
}
|
|
1288
|
+
var box = domElement.getBoundingClientRect();
|
|
1289
|
+
var body = document.body;
|
|
1290
|
+
var docElem = document.documentElement;
|
|
1291
|
+
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
|
|
1292
|
+
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
|
|
1293
|
+
var clientTop = docElem.clientTop || body.clientTop || 0;
|
|
1294
|
+
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
|
|
1295
|
+
var attr = {};
|
|
1296
|
+
attr.y = box.top + scrollTop - clientTop + top;
|
|
1297
|
+
attr.x = box.left + scrollLeft - clientLeft + left;
|
|
1298
|
+
attr.width = box.width;
|
|
1299
|
+
attr.height = box.height;
|
|
1300
|
+
return attr;
|
|
1301
|
+
}
|
|
1302
|
+
; // CONCATENATED MODULE: ./src/libs/tree.js
|
|
1303
|
+
function tree_typeof(obj) {
|
|
1304
|
+
"@babel/helpers - typeof";
|
|
1305
|
+
|
|
1306
|
+
return tree_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1307
|
+
return typeof obj;
|
|
1308
|
+
} : function (obj) {
|
|
1309
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1310
|
+
}, tree_typeof(obj);
|
|
1311
|
+
}
|
|
1312
|
+
var _excluded = ["children"];
|
|
1313
|
+
function _objectWithoutProperties(source, excluded) {
|
|
1314
|
+
if (source == null) return {};
|
|
1315
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
1316
|
+
var key, i;
|
|
1317
|
+
if (Object.getOwnPropertySymbols) {
|
|
1318
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
1319
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
1320
|
+
key = sourceSymbolKeys[i];
|
|
1321
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1322
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1323
|
+
target[key] = source[key];
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
return target;
|
|
1327
|
+
}
|
|
1328
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1329
|
+
if (source == null) return {};
|
|
1330
|
+
var target = {};
|
|
1331
|
+
var sourceKeys = Object.keys(source);
|
|
1332
|
+
var key, i;
|
|
1333
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
1334
|
+
key = sourceKeys[i];
|
|
1335
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1336
|
+
target[key] = source[key];
|
|
1337
|
+
}
|
|
1338
|
+
return target;
|
|
1339
|
+
}
|
|
1340
|
+
function ownKeys(object, enumerableOnly) {
|
|
1341
|
+
var keys = Object.keys(object);
|
|
1342
|
+
if (Object.getOwnPropertySymbols) {
|
|
1343
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
1344
|
+
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1345
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1346
|
+
})), keys.push.apply(keys, symbols);
|
|
1347
|
+
}
|
|
1348
|
+
return keys;
|
|
1349
|
+
}
|
|
1350
|
+
function _objectSpread(target) {
|
|
1351
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1352
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
1353
|
+
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1354
|
+
_defineProperty(target, key, source[key]);
|
|
1355
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1356
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
return target;
|
|
1360
|
+
}
|
|
1361
|
+
function _defineProperty(obj, key, value) {
|
|
1362
|
+
key = _toPropertyKey(key);
|
|
1363
|
+
if (key in obj) {
|
|
1364
|
+
Object.defineProperty(obj, key, {
|
|
1365
|
+
value: value,
|
|
1366
|
+
enumerable: true,
|
|
1367
|
+
configurable: true,
|
|
1368
|
+
writable: true
|
|
1369
|
+
});
|
|
1370
|
+
} else {
|
|
1371
|
+
obj[key] = value;
|
|
1372
|
+
}
|
|
1373
|
+
return obj;
|
|
1374
|
+
}
|
|
1375
|
+
function _toPropertyKey(arg) {
|
|
1376
|
+
var key = _toPrimitive(arg, "string");
|
|
1377
|
+
return tree_typeof(key) === "symbol" ? key : String(key);
|
|
1378
|
+
}
|
|
1379
|
+
function _toPrimitive(input, hint) {
|
|
1380
|
+
if (tree_typeof(input) !== "object" || input === null) return input;
|
|
1381
|
+
var prim = input[Symbol.toPrimitive];
|
|
1382
|
+
if (prim !== undefined) {
|
|
1383
|
+
var res = prim.call(input, hint || "default");
|
|
1384
|
+
if (tree_typeof(res) !== "object") return res;
|
|
1385
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1386
|
+
}
|
|
1387
|
+
return (hint === "string" ? String : Number)(input);
|
|
1388
|
+
}
|
|
1389
|
+
function tree_toConsumableArray(arr) {
|
|
1390
|
+
return tree_arrayWithoutHoles(arr) || tree_iterableToArray(arr) || tree_unsupportedIterableToArray(arr) || tree_nonIterableSpread();
|
|
1391
|
+
}
|
|
1392
|
+
function tree_nonIterableSpread() {
|
|
1393
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1394
|
+
}
|
|
1395
|
+
function tree_unsupportedIterableToArray(o, minLen) {
|
|
1396
|
+
if (!o) return;
|
|
1397
|
+
if (typeof o === "string") return tree_arrayLikeToArray(o, minLen);
|
|
1398
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1399
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1400
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1401
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return tree_arrayLikeToArray(o, minLen);
|
|
1402
|
+
}
|
|
1403
|
+
function tree_iterableToArray(iter) {
|
|
1404
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1405
|
+
}
|
|
1406
|
+
function tree_arrayWithoutHoles(arr) {
|
|
1407
|
+
if (Array.isArray(arr)) return tree_arrayLikeToArray(arr);
|
|
1408
|
+
}
|
|
1409
|
+
function tree_arrayLikeToArray(arr, len) {
|
|
1410
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
1411
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1412
|
+
return arr2;
|
|
1413
|
+
}
|
|
1414
|
+
function _objectDestructuringEmpty(obj) {
|
|
1415
|
+
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
1416
|
+
}
|
|
1417
|
+
function _extends() {
|
|
1418
|
+
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1419
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1420
|
+
var source = arguments[i];
|
|
1421
|
+
for (var key in source) {
|
|
1422
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1423
|
+
target[key] = source[key];
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
return target;
|
|
1428
|
+
};
|
|
1429
|
+
return _extends.apply(this, arguments);
|
|
1430
|
+
}
|
|
1431
|
+
/**
|
|
1432
|
+
* Convert Tree
|
|
1433
|
+
* @param {Array} arr - Flat array
|
|
1434
|
+
* @param {?String | ?Number} parentId - Parent id
|
|
1435
|
+
* @param {?String} keyId - Key value of id.
|
|
1436
|
+
* @param {?String} keyParentId - Key value of parent id.
|
|
1437
|
+
* @returns Array
|
|
1438
|
+
*/
|
|
1439
|
+
function _convertTree(arr) {
|
|
1440
|
+
var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1441
|
+
var keyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
1442
|
+
var keyParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'parent_id';
|
|
1443
|
+
if (!parentId) {
|
|
1444
|
+
// If there is no parent id (when recursing for the first time), all parents will be queried
|
|
1445
|
+
return arr.filter(function (item) {
|
|
1446
|
+
return !item[keyParentId];
|
|
1447
|
+
}).map(function (item) {
|
|
1448
|
+
// Query all child nodes by parent node ID
|
|
1449
|
+
item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
|
|
1450
|
+
return item;
|
|
1451
|
+
});
|
|
1452
|
+
} else {
|
|
1453
|
+
return arr.filter(function (item) {
|
|
1454
|
+
return item[keyParentId] === parentId;
|
|
1455
|
+
}).map(function (item) {
|
|
1456
|
+
// Query all child nodes by parent node ID
|
|
1457
|
+
item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
|
|
1458
|
+
return item;
|
|
1459
|
+
});
|
|
1460
|
+
}
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* Flat tree
|
|
1465
|
+
* @param {Array} arr - Hierarchical array
|
|
1466
|
+
* @returns Array
|
|
1467
|
+
*/
|
|
1468
|
+
function _flatTree(arr) {
|
|
1469
|
+
var flatData = function flatData(_ref) {
|
|
1470
|
+
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
1471
|
+
var _rest$children = rest.children,
|
|
1472
|
+
children = _rest$children === void 0 ? [] : _rest$children;
|
|
1473
|
+
return [_objectSpread({}, rest)].concat(tree_toConsumableArray(children.flatMap(flatData)));
|
|
1474
|
+
};
|
|
1475
|
+
var result = arr.flatMap(flatData);
|
|
1476
|
+
|
|
1477
|
+
//remove children from item
|
|
1478
|
+
result = result.map(function (item) {
|
|
1479
|
+
delete item.children;
|
|
1480
|
+
return item;
|
|
1481
|
+
});
|
|
1482
|
+
return result;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/**
|
|
1486
|
+
* Get all depth
|
|
1487
|
+
* @param {Object} node
|
|
1488
|
+
* @returns Number
|
|
1489
|
+
*/
|
|
1490
|
+
function _getAllDepth(arr) {
|
|
1491
|
+
var count = function count(children) {
|
|
1492
|
+
return children.reduce(function (depth, child) {
|
|
1493
|
+
return Math.max(depth, 1 + count(child.children)); // increment depth of children by 1, and compare it with accumulated depth of other children within the same element
|
|
1494
|
+
}, 0); //default value 0 that's returned if there are no children
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
return count(arr);
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* Add depth to each item in the tree
|
|
1502
|
+
* @param {Array} arr - Hierarchical array
|
|
1503
|
+
* @param {?String} keyId - Key value of id.
|
|
1504
|
+
* @param {?String} keyParentId - Key value of parent id.
|
|
1505
|
+
* @param {?Number} depth - Depth of the item.
|
|
1506
|
+
* @returns Number
|
|
1507
|
+
*/
|
|
1508
|
+
function _addTreeDepth(arr) {
|
|
1509
|
+
var keyId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
|
1510
|
+
var parentItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
1511
|
+
var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1512
|
+
return arr.reduce(function (acc, el) {
|
|
1513
|
+
var children = el.children,
|
|
1514
|
+
otherProps = _objectWithoutProperties(el, _excluded);
|
|
1515
|
+
acc.push(_objectSpread(_objectSpread({}, otherProps), {}, {
|
|
1516
|
+
parentItem: parentItem,
|
|
1517
|
+
depth: depth
|
|
1518
|
+
}));
|
|
1519
|
+
if (children) {
|
|
1520
|
+
return acc.concat(_addTreeDepth(children, keyId, el[keyId], depth + 1));
|
|
1521
|
+
}
|
|
1522
|
+
return acc;
|
|
1523
|
+
}, []);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Add indent placeholder
|
|
1528
|
+
* @param {Array} arr - Flat array
|
|
1529
|
+
* @param {?String} placeholder - String of placeholder
|
|
1530
|
+
* @param {?String} lastPlaceholder - Last String of placeholder
|
|
1531
|
+
* @param {?String} keyName - Key value of name.
|
|
1532
|
+
* @returns Array
|
|
1533
|
+
*/
|
|
1534
|
+
function _addTreeIndent(arr) {
|
|
1535
|
+
var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
|
|
1536
|
+
var lastPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
1537
|
+
var keyName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
|
|
1538
|
+
arr.forEach(function (item) {
|
|
1539
|
+
var indent = '';
|
|
1540
|
+
if (item.depth) {
|
|
1541
|
+
Array(item.depth).fill(0).forEach(function (k, i) {
|
|
1542
|
+
indent += placeholder;
|
|
1543
|
+
if (i === item.depth - 1) {
|
|
1544
|
+
item[keyName] = indent + lastPlaceholder + item[keyName];
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
; // CONCATENATED MODULE: ./src/libs/buffer.js
|
|
1551
|
+
function _regeneratorRuntime() {
|
|
1552
|
+
"use strict";
|
|
1553
|
+
|
|
1554
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1555
|
+
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
1556
|
+
return exports;
|
|
1557
|
+
};
|
|
1558
|
+
var exports = {},
|
|
1559
|
+
Op = Object.prototype,
|
|
1560
|
+
hasOwn = Op.hasOwnProperty,
|
|
1561
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
1562
|
+
obj[key] = desc.value;
|
|
1563
|
+
},
|
|
1564
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1565
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1566
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1567
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1568
|
+
function define(obj, key, value) {
|
|
1569
|
+
return Object.defineProperty(obj, key, {
|
|
1570
|
+
value: value,
|
|
1571
|
+
enumerable: !0,
|
|
1572
|
+
configurable: !0,
|
|
1573
|
+
writable: !0
|
|
1574
|
+
}), obj[key];
|
|
1575
|
+
}
|
|
1576
|
+
try {
|
|
1577
|
+
define({}, "");
|
|
1578
|
+
} catch (err) {
|
|
1579
|
+
define = function define(obj, key, value) {
|
|
1580
|
+
return obj[key] = value;
|
|
1581
|
+
};
|
|
1582
|
+
}
|
|
1583
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1584
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1585
|
+
generator = Object.create(protoGenerator.prototype),
|
|
1586
|
+
context = new Context(tryLocsList || []);
|
|
1587
|
+
return defineProperty(generator, "_invoke", {
|
|
1588
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
1589
|
+
}), generator;
|
|
1590
|
+
}
|
|
1591
|
+
function tryCatch(fn, obj, arg) {
|
|
1592
|
+
try {
|
|
1593
|
+
return {
|
|
1594
|
+
type: "normal",
|
|
1595
|
+
arg: fn.call(obj, arg)
|
|
1596
|
+
};
|
|
1597
|
+
} catch (err) {
|
|
1598
|
+
return {
|
|
1599
|
+
type: "throw",
|
|
1600
|
+
arg: err
|
|
1601
|
+
};
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
exports.wrap = wrap;
|
|
1605
|
+
var ContinueSentinel = {};
|
|
1606
|
+
function Generator() {}
|
|
1607
|
+
function GeneratorFunction() {}
|
|
1608
|
+
function GeneratorFunctionPrototype() {}
|
|
1609
|
+
var IteratorPrototype = {};
|
|
1610
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1611
|
+
return this;
|
|
1612
|
+
});
|
|
1613
|
+
var getProto = Object.getPrototypeOf,
|
|
1614
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1615
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1616
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1617
|
+
function defineIteratorMethods(prototype) {
|
|
1618
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
1619
|
+
define(prototype, method, function (arg) {
|
|
1620
|
+
return this._invoke(method, arg);
|
|
1621
|
+
});
|
|
1622
|
+
});
|
|
1623
|
+
}
|
|
1624
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
1625
|
+
function invoke(method, arg, resolve, reject) {
|
|
1626
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
1627
|
+
if ("throw" !== record.type) {
|
|
1628
|
+
var result = record.arg,
|
|
1629
|
+
value = result.value;
|
|
1630
|
+
return value && "object" == buffer_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1631
|
+
invoke("next", value, resolve, reject);
|
|
1632
|
+
}, function (err) {
|
|
1633
|
+
invoke("throw", err, resolve, reject);
|
|
1634
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1635
|
+
result.value = unwrapped, resolve(result);
|
|
1636
|
+
}, function (error) {
|
|
1637
|
+
return invoke("throw", error, resolve, reject);
|
|
1638
|
+
});
|
|
1639
|
+
}
|
|
1640
|
+
reject(record.arg);
|
|
1641
|
+
}
|
|
1642
|
+
var previousPromise;
|
|
1643
|
+
defineProperty(this, "_invoke", {
|
|
1644
|
+
value: function value(method, arg) {
|
|
1645
|
+
function callInvokeWithMethodAndArg() {
|
|
1646
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
1647
|
+
invoke(method, arg, resolve, reject);
|
|
1648
|
+
});
|
|
1649
|
+
}
|
|
1650
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1651
|
+
}
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1654
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
1655
|
+
var state = "suspendedStart";
|
|
1656
|
+
return function (method, arg) {
|
|
1657
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
1658
|
+
if ("completed" === state) {
|
|
1659
|
+
if ("throw" === method) throw arg;
|
|
1660
|
+
return doneResult();
|
|
1661
|
+
}
|
|
1662
|
+
for (context.method = method, context.arg = arg;;) {
|
|
1663
|
+
var delegate = context.delegate;
|
|
1664
|
+
if (delegate) {
|
|
1665
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1666
|
+
if (delegateResult) {
|
|
1667
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
1668
|
+
return delegateResult;
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1672
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1673
|
+
context.dispatchException(context.arg);
|
|
1674
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1675
|
+
state = "executing";
|
|
1676
|
+
var record = tryCatch(innerFn, self, context);
|
|
1677
|
+
if ("normal" === record.type) {
|
|
1678
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1679
|
+
return {
|
|
1680
|
+
value: record.arg,
|
|
1681
|
+
done: context.done
|
|
1682
|
+
};
|
|
1683
|
+
}
|
|
1684
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1685
|
+
}
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
1689
|
+
var methodName = context.method,
|
|
1690
|
+
method = delegate.iterator[methodName];
|
|
1691
|
+
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;
|
|
1692
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1693
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1694
|
+
var info = record.arg;
|
|
1695
|
+
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);
|
|
1696
|
+
}
|
|
1697
|
+
function pushTryEntry(locs) {
|
|
1698
|
+
var entry = {
|
|
1699
|
+
tryLoc: locs[0]
|
|
1700
|
+
};
|
|
1701
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1702
|
+
}
|
|
1703
|
+
function resetTryEntry(entry) {
|
|
1704
|
+
var record = entry.completion || {};
|
|
1705
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1706
|
+
}
|
|
1707
|
+
function Context(tryLocsList) {
|
|
1708
|
+
this.tryEntries = [{
|
|
1709
|
+
tryLoc: "root"
|
|
1710
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1711
|
+
}
|
|
1712
|
+
function values(iterable) {
|
|
1713
|
+
if (iterable) {
|
|
1714
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
1715
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1716
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
1717
|
+
if (!isNaN(iterable.length)) {
|
|
1718
|
+
var i = -1,
|
|
1719
|
+
next = function next() {
|
|
1720
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1721
|
+
return next.value = undefined, next.done = !0, next;
|
|
1722
|
+
};
|
|
1723
|
+
return next.next = next;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
return {
|
|
1727
|
+
next: doneResult
|
|
1728
|
+
};
|
|
1729
|
+
}
|
|
1730
|
+
function doneResult() {
|
|
1731
|
+
return {
|
|
1732
|
+
value: undefined,
|
|
1733
|
+
done: !0
|
|
1734
|
+
};
|
|
1735
|
+
}
|
|
1736
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
1737
|
+
value: GeneratorFunctionPrototype,
|
|
1738
|
+
configurable: !0
|
|
1739
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
1740
|
+
value: GeneratorFunction,
|
|
1741
|
+
configurable: !0
|
|
1742
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
1743
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1744
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1745
|
+
}, exports.mark = function (genFun) {
|
|
1746
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
1747
|
+
}, exports.awrap = function (arg) {
|
|
1748
|
+
return {
|
|
1749
|
+
__await: arg
|
|
1750
|
+
};
|
|
1751
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1752
|
+
return this;
|
|
1753
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1754
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
1755
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1756
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
1757
|
+
return result.done ? result.value : iter.next();
|
|
1758
|
+
});
|
|
1759
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
1760
|
+
return this;
|
|
1761
|
+
}), define(Gp, "toString", function () {
|
|
1762
|
+
return "[object Generator]";
|
|
1763
|
+
}), exports.keys = function (val) {
|
|
1764
|
+
var object = Object(val),
|
|
1765
|
+
keys = [];
|
|
1766
|
+
for (var key in object) keys.push(key);
|
|
1767
|
+
return keys.reverse(), function next() {
|
|
1768
|
+
for (; keys.length;) {
|
|
1769
|
+
var key = keys.pop();
|
|
1770
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
1771
|
+
}
|
|
1772
|
+
return next.done = !0, next;
|
|
1773
|
+
};
|
|
1774
|
+
}, exports.values = values, Context.prototype = {
|
|
1775
|
+
constructor: Context,
|
|
1776
|
+
reset: function reset(skipTempReset) {
|
|
1777
|
+
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);
|
|
1778
|
+
},
|
|
1779
|
+
stop: function stop() {
|
|
1780
|
+
this.done = !0;
|
|
1781
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
1782
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
1783
|
+
return this.rval;
|
|
1784
|
+
},
|
|
1785
|
+
dispatchException: function dispatchException(exception) {
|
|
1786
|
+
if (this.done) throw exception;
|
|
1787
|
+
var context = this;
|
|
1788
|
+
function handle(loc, caught) {
|
|
1789
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1790
|
+
}
|
|
1791
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1792
|
+
var entry = this.tryEntries[i],
|
|
1793
|
+
record = entry.completion;
|
|
1794
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
1795
|
+
if (entry.tryLoc <= this.prev) {
|
|
1796
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1797
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1798
|
+
if (hasCatch && hasFinally) {
|
|
1799
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1800
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1801
|
+
} else if (hasCatch) {
|
|
1802
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1803
|
+
} else {
|
|
1804
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
1805
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1806
|
+
}
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1810
|
+
abrupt: function abrupt(type, arg) {
|
|
1811
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1812
|
+
var entry = this.tryEntries[i];
|
|
1813
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1814
|
+
var finallyEntry = entry;
|
|
1815
|
+
break;
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
1819
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1820
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
1821
|
+
},
|
|
1822
|
+
complete: function complete(record, afterLoc) {
|
|
1823
|
+
if ("throw" === record.type) throw record.arg;
|
|
1824
|
+
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;
|
|
1825
|
+
},
|
|
1826
|
+
finish: function finish(finallyLoc) {
|
|
1827
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1828
|
+
var entry = this.tryEntries[i];
|
|
1829
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
1830
|
+
}
|
|
1831
|
+
},
|
|
1832
|
+
"catch": function _catch(tryLoc) {
|
|
1833
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1834
|
+
var entry = this.tryEntries[i];
|
|
1835
|
+
if (entry.tryLoc === tryLoc) {
|
|
1836
|
+
var record = entry.completion;
|
|
1837
|
+
if ("throw" === record.type) {
|
|
1838
|
+
var thrown = record.arg;
|
|
1839
|
+
resetTryEntry(entry);
|
|
1840
|
+
}
|
|
1841
|
+
return thrown;
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
throw new Error("illegal catch attempt");
|
|
1845
|
+
},
|
|
1846
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1847
|
+
return this.delegate = {
|
|
1848
|
+
iterator: values(iterable),
|
|
1849
|
+
resultName: resultName,
|
|
1850
|
+
nextLoc: nextLoc
|
|
1851
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
1852
|
+
}
|
|
1853
|
+
}, exports;
|
|
1854
|
+
}
|
|
1855
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1856
|
+
try {
|
|
1857
|
+
var info = gen[key](arg);
|
|
1858
|
+
var value = info.value;
|
|
1859
|
+
} catch (error) {
|
|
1860
|
+
reject(error);
|
|
1861
|
+
return;
|
|
1862
|
+
}
|
|
1863
|
+
if (info.done) {
|
|
1864
|
+
resolve(value);
|
|
1865
|
+
} else {
|
|
1866
|
+
Promise.resolve(value).then(_next, _throw);
|
|
1867
|
+
}
|
|
1868
|
+
}
|
|
1869
|
+
function _asyncToGenerator(fn) {
|
|
1870
|
+
return function () {
|
|
1871
|
+
var self = this,
|
|
1872
|
+
args = arguments;
|
|
1873
|
+
return new Promise(function (resolve, reject) {
|
|
1874
|
+
var gen = fn.apply(self, args);
|
|
1875
|
+
function _next(value) {
|
|
1876
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1877
|
+
}
|
|
1878
|
+
function _throw(err) {
|
|
1879
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1880
|
+
}
|
|
1881
|
+
_next(undefined);
|
|
1882
|
+
});
|
|
1883
|
+
};
|
|
1884
|
+
}
|
|
1885
|
+
function buffer_typeof(obj) {
|
|
1886
|
+
"@babel/helpers - typeof";
|
|
1887
|
+
|
|
1888
|
+
return buffer_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1889
|
+
return typeof obj;
|
|
1890
|
+
} : function (obj) {
|
|
1891
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1892
|
+
}, buffer_typeof(obj);
|
|
1893
|
+
}
|
|
1894
|
+
/**
|
|
1895
|
+
* base64 to ArrayBuffer
|
|
1896
|
+
* @param {String} data
|
|
1897
|
+
* @returns {ArrayBuffer}
|
|
1898
|
+
*/
|
|
1899
|
+
/*
|
|
1900
|
+
@returns:
|
|
1901
|
+
|
|
1902
|
+
ArrayBuffer(522240)
|
|
1903
|
+
|
|
1904
|
+
byteLength: 522240
|
|
1905
|
+
detached: false
|
|
1906
|
+
maxByteLength: 522240
|
|
1907
|
+
resizable: false
|
|
1908
|
+
[[Prototype]]: ArrayBuffer
|
|
1909
|
+
[[Int8Array]]: Int8Array(522240)
|
|
1910
|
+
[[Uint8Array]]: Uint8Array(522240)
|
|
1911
|
+
[[Int16Array]]: Int16Array(261120)
|
|
1912
|
+
[[Int32Array]]: Int32Array(130560)
|
|
1913
|
+
[[ArrayBufferByteLength]]: 522240
|
|
1914
|
+
[[ArrayBufferData]]: 673
|
|
1915
|
+
*/
|
|
1916
|
+
function _base64ToArrayBuffer(data) {
|
|
1917
|
+
var res = data;
|
|
1918
|
+
if (data.indexOf('base64,') >= 0) {
|
|
1919
|
+
res = data.split('base64,')[1];
|
|
1920
|
+
}
|
|
1921
|
+
|
|
1922
|
+
//
|
|
1923
|
+
var binaryString = atob(res);
|
|
1924
|
+
var bytes = new Uint8Array(binaryString.length);
|
|
1925
|
+
for (var i = 0; i < binaryString.length; i++) {
|
|
1926
|
+
bytes[i] = binaryString.charCodeAt(i);
|
|
1927
|
+
}
|
|
1928
|
+
return bytes.buffer;
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
/**
|
|
1932
|
+
* ArrayBuffer to Uint8Array
|
|
1933
|
+
* @param {ArrayBuffer} data
|
|
1934
|
+
* @returns {Uint8Array}
|
|
1935
|
+
*/
|
|
1936
|
+
/*
|
|
1937
|
+
@returns:
|
|
1938
|
+
|
|
1939
|
+
Uint8Array(522240) [208, 207, 17, 224, 161, 177, 26, 225, 0, 0, ......]
|
|
1940
|
+
*/
|
|
1941
|
+
function _arrayBufferToUint8Array(data) {
|
|
1942
|
+
var bytes = new Uint8Array(data);
|
|
1943
|
+
return bytes;
|
|
1944
|
+
}
|
|
1945
|
+
|
|
1946
|
+
/**
|
|
1947
|
+
* uint8array to array
|
|
1948
|
+
* @param {Uint8Array} data
|
|
1949
|
+
* @returns {Array}
|
|
1950
|
+
*/
|
|
1951
|
+
function _uint8arrayToArr(data) {
|
|
1952
|
+
return Array.from(data);
|
|
1953
|
+
}
|
|
1954
|
+
|
|
1955
|
+
/**
|
|
1956
|
+
* array to uint8array
|
|
1957
|
+
* @param {Array} data
|
|
1958
|
+
* @returns {Uint8Array}
|
|
1959
|
+
*/
|
|
1960
|
+
/* Example:
|
|
1961
|
+
|
|
1962
|
+
axios({
|
|
1963
|
+
method: 'get',
|
|
1964
|
+
url: 'http://xxxx',
|
|
1965
|
+
responseType: 'arraybuffer'
|
|
1966
|
+
})
|
|
1967
|
+
.then(function (res) {
|
|
1968
|
+
//res.data ==> ArrayBuffer(xxxx)
|
|
1969
|
+
const b64string = uint8arrayToBase64Str(res.data);
|
|
1970
|
+
const uint8ArrayData = arrayToUint8array(res.data);
|
|
1971
|
+
|
|
1972
|
+
// do something
|
|
1973
|
+
|
|
1974
|
+
});
|
|
1975
|
+
*/
|
|
1976
|
+
function _arrayToUint8array(data) {
|
|
1977
|
+
return new Uint8Array(data);
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
/**
|
|
1981
|
+
* uint8array to base64 string
|
|
1982
|
+
* @param {Uint8Array|Array} data
|
|
1983
|
+
* @returns {String}
|
|
1984
|
+
*/
|
|
1985
|
+
function _uint8arrayToBase64Str(data) {
|
|
1986
|
+
if ((typeof Buffer === "undefined" ? "undefined" : buffer_typeof(Buffer)) !== ( true ? "undefined" : 0)) {
|
|
1987
|
+
return Buffer.from(data, 'binary').toString('base64'); // node.js too
|
|
1988
|
+
} else {
|
|
1989
|
+
// prevent ERROR: RangeError: Maximum call stack size exceeded
|
|
1990
|
+
//!!!!!!!!!
|
|
1991
|
+
var binary = '';
|
|
1992
|
+
var bytes = new Uint8Array(data);
|
|
1993
|
+
var len = bytes.byteLength;
|
|
1994
|
+
for (var i = 0; i < len; i++) {
|
|
1995
|
+
binary += String.fromCharCode(bytes[i]);
|
|
1996
|
+
}
|
|
1997
|
+
return window.btoa(binary);
|
|
1998
|
+
}
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
/**
|
|
2002
|
+
* decode base64 string
|
|
2003
|
+
* @param {String} data
|
|
2004
|
+
* @returns {String}
|
|
2005
|
+
*/
|
|
2006
|
+
function _decodeBase64Str(data) {
|
|
2007
|
+
// avoid messy code
|
|
2008
|
+
// especially for Chinese, avoid using encodeURIComponent() and encodeURI()
|
|
2009
|
+
var decoded = decodeURIComponent(escape(atob(data)));
|
|
2010
|
+
return decoded;
|
|
2011
|
+
}
|
|
2012
|
+
|
|
2013
|
+
/**
|
|
2014
|
+
* integer to binary
|
|
2015
|
+
* @param {Number} data
|
|
2016
|
+
* @returns {String}
|
|
2017
|
+
*/
|
|
2018
|
+
function _toBinary(data) {
|
|
2019
|
+
if (!Number.isSafeInteger(data)) {
|
|
2020
|
+
throw new TypeError('value must be a safe integer');
|
|
2021
|
+
}
|
|
2022
|
+
return (data >>> 0).toString(2);
|
|
2023
|
+
}
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* array to blob
|
|
2027
|
+
* @param {Uint8Array} uint8ArrayData
|
|
2028
|
+
* @returns {Blob}
|
|
2029
|
+
*/
|
|
2030
|
+
function _arrayToBlob(uint8ArrayData) {
|
|
2031
|
+
return new Blob(uint8ArrayData, {
|
|
2032
|
+
type: "text/plain"
|
|
2033
|
+
});
|
|
2034
|
+
}
|
|
2035
|
+
|
|
2036
|
+
/**
|
|
2037
|
+
* blob to uint8array
|
|
2038
|
+
* @param {Blob} data
|
|
2039
|
+
* @returns {Uint8Array}
|
|
2040
|
+
*/
|
|
2041
|
+
function _blobToUint8array(data) {
|
|
2042
|
+
return new Promise(function (resolve, reject) {
|
|
2043
|
+
var reader = new FileReader();
|
|
2044
|
+
reader.addEventListener("loadend", function () {
|
|
2045
|
+
resolve(reader.result); // ArrayBuffer(xxxx)
|
|
2046
|
+
});
|
|
2047
|
+
|
|
2048
|
+
reader.readAsArrayBuffer(data);
|
|
2049
|
+
});
|
|
2050
|
+
}
|
|
2051
|
+
|
|
2052
|
+
/**
|
|
2053
|
+
* array to stream
|
|
2054
|
+
* @param {Array<Uint8Array>} data
|
|
2055
|
+
* @returns {ReadableStream }
|
|
2056
|
+
*/
|
|
2057
|
+
/* Example:
|
|
2058
|
+
|
|
2059
|
+
const uint8ArrayDataArr = [
|
|
2060
|
+
[137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,30,0,0,0,30,8,6,0,0,0,59,48,174,162,0,0,0,220,73,68,65,84,72,199,237,214,81,14,194,32,12,0,80,60,128,215,219,49,28,91,118,10,55,216,53,188,132,137,39,19,71,130,75,69,42,148,194,76,116,31,253,89,40,111,233,104,153,48,198,136,111,132,216,225,255,134,143,151,166,84,28,150,152,151,24,158,207,182,130,45,106,92,12,91,193,16,93,241,218,112,8,181,113,174,9,163,232,90,234,130,223,50,134,142,47,135,11,36,216,183,57,49,81,29,67,125,120,116,11,238,12,60,9,133,240,228,45,180,120,91,11,133,112,31,72,176,184,100,162,19,150,3,75,157,139,147,209,208,225,234,136,184,202,65,177,118,146,200,102,178,20,250,169,143,49,188,43,129,198,6,136,116,101,246,55,191,33,168,162,116,65,108,114,97,56,11,77,29,153,109,4,87,57,195,38,117,86,95,75,162,20,56,84,114,205,153,233,148,219,9,226,154,123,131,81,175,69,201,41,239,27,188,255,222,254,52,252,0,234,253,186,89,222,225,73,252,0,0,0,0,73,69,78,68,174,66,96,130]
|
|
2061
|
+
];
|
|
2062
|
+
const readableStream = arrayToStream(uint8ArrayDataArr);
|
|
2063
|
+
|
|
2064
|
+
*/
|
|
2065
|
+
function _arrayToStream(data) {
|
|
2066
|
+
// @return --> ReadableStream {locked: false}
|
|
2067
|
+
return new ReadableStream({
|
|
2068
|
+
start: function start(controller) {
|
|
2069
|
+
// push a chunk
|
|
2070
|
+
data.forEach(function (chunk) {
|
|
2071
|
+
controller.enqueue(new Uint8Array(chunk));
|
|
2072
|
+
});
|
|
2073
|
+
},
|
|
2074
|
+
pull: function pull(controller) {
|
|
2075
|
+
// Called `read()` when the controller's queue is empty.
|
|
2076
|
+
//controller.enqueue(...);
|
|
2077
|
+
controller.close();
|
|
2078
|
+
},
|
|
2079
|
+
cancel: function cancel(reason) {
|
|
2080
|
+
// Called when the stream is canceled.
|
|
2081
|
+
}
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* read stream
|
|
2087
|
+
* @param {ReadableStream } data
|
|
2088
|
+
* @returns {Promise}
|
|
2089
|
+
*/
|
|
2090
|
+
/* Example:
|
|
2091
|
+
|
|
2092
|
+
readStream(readableStream).then((value) => {
|
|
2093
|
+
console.log(value);
|
|
2094
|
+
// iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAA3ElEQVRIx+3WUQ7CIAwAUDyA19sxHFt2CjfYNbyEiScTR4JLRSqUwkx0H/1ZKG/paJkwxohvhNjh/4aPl6ZUHJaYlxiez7aCLWpcDFvBEF3x2nAItXGuCaPoWuqC3zKGji+HCyTYtzkxUR1DfXh0C+4MPAmF8OQttHhbC4VwH0iwuGSiE5YDS52Lk9HQ4eqIuMpBsXaSyGayFPqpjzG8K4HGBoh0ZfY3vyGoonRBbHJhOAtNHZltBFc5wyZ1Vl9LohQ4VHLNmemU2wnimnuDUa9FySnvG7z/3v40/ADq/bpZ3uFJ/AAAAABJRU5ErkJggg==
|
|
2095
|
+
|
|
2096
|
+
// test: <img src="data:image/png;base64,iVBORw0KGgo..." >
|
|
2097
|
+
|
|
2098
|
+
});
|
|
2099
|
+
*/
|
|
2100
|
+
function _readStream2(_x) {
|
|
2101
|
+
return _readStream.apply(this, arguments);
|
|
2102
|
+
}
|
|
2103
|
+
function _readStream() {
|
|
2104
|
+
_readStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
2105
|
+
var resReceived, stream, readInto;
|
|
2106
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2107
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
2108
|
+
case 0:
|
|
2109
|
+
resReceived = '';
|
|
2110
|
+
stream = data; // ReadableStream {locked: false}
|
|
2111
|
+
readInto = /*#__PURE__*/function () {
|
|
2112
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
|
|
2113
|
+
var reader, pump, _pump;
|
|
2114
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2115
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2116
|
+
case 0:
|
|
2117
|
+
_pump = function _pump3() {
|
|
2118
|
+
_pump = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2119
|
+
var _yield$reader$read, done, value, base64String;
|
|
2120
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2121
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2122
|
+
case 0:
|
|
2123
|
+
_context.next = 2;
|
|
2124
|
+
return reader.read();
|
|
2125
|
+
case 2:
|
|
2126
|
+
_yield$reader$read = _context.sent;
|
|
2127
|
+
done = _yield$reader$read.done;
|
|
2128
|
+
value = _yield$reader$read.value;
|
|
2129
|
+
if (!done) {
|
|
2130
|
+
_context.next = 7;
|
|
2131
|
+
break;
|
|
2132
|
+
}
|
|
2133
|
+
return _context.abrupt("return");
|
|
2134
|
+
case 7:
|
|
2135
|
+
// value for fetch streams is a Uint8Array
|
|
2136
|
+
base64String = _uint8arrayToBase64Str(value);
|
|
2137
|
+
resReceived += base64String;
|
|
2138
|
+
return _context.abrupt("return", pump());
|
|
2139
|
+
case 10:
|
|
2140
|
+
case "end":
|
|
2141
|
+
return _context.stop();
|
|
2142
|
+
}
|
|
2143
|
+
}, _callee);
|
|
2144
|
+
}));
|
|
2145
|
+
return _pump.apply(this, arguments);
|
|
2146
|
+
};
|
|
2147
|
+
pump = function _pump2() {
|
|
2148
|
+
return _pump.apply(this, arguments);
|
|
2149
|
+
};
|
|
2150
|
+
reader = stream.getReader();
|
|
2151
|
+
return _context2.abrupt("return", pump());
|
|
2152
|
+
case 4:
|
|
2153
|
+
case "end":
|
|
2154
|
+
return _context2.stop();
|
|
2155
|
+
}
|
|
2156
|
+
}, _callee2);
|
|
2157
|
+
}));
|
|
2158
|
+
return function readInto(_x2) {
|
|
2159
|
+
return _ref.apply(this, arguments);
|
|
2160
|
+
};
|
|
2161
|
+
}();
|
|
2162
|
+
_context3.next = 5;
|
|
2163
|
+
return readInto(stream);
|
|
2164
|
+
case 5:
|
|
2165
|
+
return _context3.abrupt("return", resReceived);
|
|
2166
|
+
case 6:
|
|
2167
|
+
case "end":
|
|
2168
|
+
return _context3.stop();
|
|
2169
|
+
}
|
|
2170
|
+
}, _callee3);
|
|
2171
|
+
}));
|
|
2172
|
+
return _readStream.apply(this, arguments);
|
|
2173
|
+
}
|
|
2174
|
+
; // CONCATENATED MODULE: ./src/libs/convert.js
|
|
2175
|
+
/**
|
|
2176
|
+
* Convert value to string separated by square brackets
|
|
2177
|
+
* @param {String} str such as: 1,2,3
|
|
2178
|
+
* @returns {String} such as: [1][2][3]
|
|
2179
|
+
*/
|
|
2180
|
+
function _convertStringByCommaToValByBrackets(str) {
|
|
2181
|
+
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2182
|
+
return '';
|
|
2183
|
+
}
|
|
2184
|
+
return str.split(',').map(function (v) {
|
|
2185
|
+
return v.toString().includes('[') && v.toString().includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
2186
|
+
}).join('');
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
/**
|
|
2190
|
+
* Convert array value to string separated by square brackets
|
|
2191
|
+
* @param {Array} arr such as: ['1','2','3']
|
|
2192
|
+
* @returns {String} such as: [1][2][3]
|
|
2193
|
+
*/
|
|
2194
|
+
function _convertArrToValByBrackets(arr) {
|
|
2195
|
+
if (!Array.isArray(arr)) return '';
|
|
2196
|
+
return arr.map(function (v) {
|
|
2197
|
+
return v.toString().includes('[') && v.toString().includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
2198
|
+
}).join('');
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
/**
|
|
2202
|
+
* Convert value to string separated by curly braces
|
|
2203
|
+
* @param {String} str such as: 1,2,3
|
|
2204
|
+
* @returns {String} such as: {1}{2}{3}
|
|
2205
|
+
*/
|
|
2206
|
+
function _convertStringByCommaToValByBraces(str) {
|
|
2207
|
+
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2208
|
+
return '';
|
|
2209
|
+
}
|
|
2210
|
+
return str.split(',').map(function (v) {
|
|
2211
|
+
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
2212
|
+
}).join('');
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
/**
|
|
2216
|
+
* Convert array value to string separated by curly braces
|
|
2217
|
+
* @param {Array} arr such as: ['1','2','3']
|
|
2218
|
+
* @returns {String} such as: {1}{2}{3}
|
|
2219
|
+
*/
|
|
2220
|
+
function _convertArrToValByBraces(arr) {
|
|
2221
|
+
if (!Array.isArray(arr)) return '';
|
|
2222
|
+
return arr.map(function (v) {
|
|
2223
|
+
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
2224
|
+
}).join('');
|
|
2225
|
+
}
|
|
2226
|
+
; // CONCATENATED MODULE: ./src/libs/extract.js
|
|
2227
|
+
/**
|
|
2228
|
+
* Extract the contents of square brackets
|
|
2229
|
+
* @param {String} str => input string. such as '[1,2] [f][c]'
|
|
2230
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
2231
|
+
*/
|
|
2232
|
+
function _extractContentsOfBrackets(str) {
|
|
2233
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2234
|
+
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2235
|
+
return !commaSeparated ? [] : '';
|
|
2236
|
+
}
|
|
2237
|
+
var res = str.match(/[^\[]+(?=(\[ \])|\])/g);
|
|
2238
|
+
if (commaSeparated) {
|
|
2239
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
2240
|
+
} else {
|
|
2241
|
+
return res === null ? '' : res;
|
|
2242
|
+
}
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
/**
|
|
2246
|
+
* Extract the contents of curly braces
|
|
2247
|
+
* @param {String} str => input string. such as '{1,2} {f}{c}'
|
|
2248
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
2249
|
+
*/
|
|
2250
|
+
function _extractContentsOfBraces(str) {
|
|
2251
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2252
|
+
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2253
|
+
return !commaSeparated ? [] : '';
|
|
2254
|
+
}
|
|
2255
|
+
var res = str.match(/[^\{]+(?=(\{ \})|\})/g);
|
|
2256
|
+
if (commaSeparated) {
|
|
2257
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
2258
|
+
} else {
|
|
2259
|
+
return res === null ? '' : res;
|
|
2260
|
+
}
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
/**
|
|
2264
|
+
* Extract the contents of parentheses
|
|
2265
|
+
* @param {String} str => input string. such as '(1,2) (f)(c)'
|
|
2266
|
+
* @returns {Array|String} such as: ['1,2','f','c']
|
|
2267
|
+
*/
|
|
2268
|
+
function _extractContentsOfParentheses(str) {
|
|
2269
|
+
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2270
|
+
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2271
|
+
return !commaSeparated ? [] : '';
|
|
2272
|
+
}
|
|
2273
|
+
var res = str.match(/[^\(]+(?=(\( \))|\))/g);
|
|
2274
|
+
if (commaSeparated) {
|
|
2275
|
+
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
2276
|
+
} else {
|
|
2277
|
+
return res === null ? '' : res;
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
; // CONCATENATED MODULE: ./src/libs/date.js
|
|
2281
|
+
/**
|
|
2282
|
+
* Get now
|
|
2283
|
+
* @returns {Date} // Wed Apr 17 2024 14:31:36 GMT+0800 (China Standard Time)
|
|
2284
|
+
*/
|
|
2285
|
+
var _getNow = function getNow() {
|
|
2286
|
+
return new Date(Date.now());
|
|
2287
|
+
};
|
|
2288
|
+
|
|
2289
|
+
/**
|
|
2290
|
+
* Zero Padding
|
|
2291
|
+
* @param {Number} num
|
|
2292
|
+
* @param {Boolean} padZeroEnabled
|
|
2293
|
+
* @returns {String} '01', '05', '12'
|
|
2294
|
+
*/
|
|
2295
|
+
var _padZero = function padZero(num) {
|
|
2296
|
+
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2297
|
+
if (padZeroEnabled) {
|
|
2298
|
+
return num < 10 ? '0' + num : num.toString();
|
|
2299
|
+
} else {
|
|
2300
|
+
return num.toString();
|
|
2301
|
+
}
|
|
2302
|
+
};
|
|
2303
|
+
|
|
2304
|
+
/**
|
|
2305
|
+
* Number validation
|
|
2306
|
+
* @param {*} v
|
|
2307
|
+
* @returns {Boolean}
|
|
2308
|
+
*/
|
|
2309
|
+
var _isNumeric = function isNumeric(v) {
|
|
2310
|
+
return !isNaN(parseFloat(v)) && isFinite(v);
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
/**
|
|
2314
|
+
* Hours validation
|
|
2315
|
+
* @param {*} v
|
|
2316
|
+
* @returns {Boolean}
|
|
2317
|
+
*/
|
|
2318
|
+
var _isValidHours = function isValidHours(v) {
|
|
2319
|
+
return /^([01]?[0-9]|2[0-3])$/.test(v); // 0~23, 00~23
|
|
2320
|
+
};
|
|
2321
|
+
|
|
2322
|
+
/**
|
|
2323
|
+
* Minutes and Seconds validation
|
|
2324
|
+
* @param {*} v
|
|
2325
|
+
* @returns {Boolean}
|
|
2326
|
+
*/
|
|
2327
|
+
var _isValidMinutesAndSeconds = function isValidMinutesAndSeconds(v) {
|
|
2328
|
+
return /^([01]?[0-9]|[0-5][0-9])$/.test(v); // 0~59, 00~59
|
|
2329
|
+
};
|
|
2330
|
+
|
|
2331
|
+
/**
|
|
2332
|
+
* Year validation
|
|
2333
|
+
* @param {*} v
|
|
2334
|
+
* @returns {Boolean}
|
|
2335
|
+
*/
|
|
2336
|
+
var _isValidYear = function isValidYear(v) {
|
|
2337
|
+
return /^([1-9][0-9])\d{2}$/.test(v); // 1000 ~ 9999
|
|
2338
|
+
};
|
|
2339
|
+
|
|
2340
|
+
/**
|
|
2341
|
+
* Month validation
|
|
2342
|
+
* @param {*} v
|
|
2343
|
+
* @returns {Boolean}
|
|
2344
|
+
*/
|
|
2345
|
+
var _isValidMonth = function isValidMonth(v) {
|
|
2346
|
+
return /^(0?[1-9]|1[0-2])$/.test(v); // 01~12, 1~12
|
|
2347
|
+
};
|
|
2348
|
+
|
|
2349
|
+
/**
|
|
2350
|
+
* Day validation
|
|
2351
|
+
* @param {*} v
|
|
2352
|
+
* @returns {Boolean}
|
|
2353
|
+
*/
|
|
2354
|
+
var _isValidDay = function isValidDay(v) {
|
|
2355
|
+
return /^(0?[1-9]|[1-2][0-9]|3[0-1])$/.test(v); // 01~31, 1~31
|
|
2356
|
+
};
|
|
2357
|
+
|
|
2358
|
+
/**
|
|
2359
|
+
* Check if the string is legitimate
|
|
2360
|
+
* @param {String} v
|
|
2361
|
+
* @returns {Boolean}
|
|
2362
|
+
*/
|
|
2363
|
+
var _isValidDate = function isValidDate(v) {
|
|
2364
|
+
return !(String(new Date(v)).toLowerCase() === 'invalid date');
|
|
2365
|
+
};
|
|
2366
|
+
|
|
2367
|
+
/**
|
|
2368
|
+
* Get calendar date
|
|
2369
|
+
* @param {Date | String} v
|
|
2370
|
+
* @returns {String} yyyy-MM-dd
|
|
2371
|
+
*/
|
|
2372
|
+
function _dateFormat(v) {
|
|
2373
|
+
var date = typeof v === 'string' ? new Date(v.replace(/-/g, "/")) : v; // fix "Invalid date in safari"
|
|
2374
|
+
return date;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
/**
|
|
2378
|
+
* Get calendar date
|
|
2379
|
+
* @param {Date | String} v
|
|
2380
|
+
* @param {Boolean} padZeroEnabled
|
|
2381
|
+
* @returns {String} yyyy-MM-dd
|
|
2382
|
+
*/
|
|
2383
|
+
function _getCalendarDate(v) {
|
|
2384
|
+
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2385
|
+
var date = _dateFormat(v);
|
|
2386
|
+
var year = date.getFullYear();
|
|
2387
|
+
var month = _padZero(date.getMonth() + 1, padZeroEnabled);
|
|
2388
|
+
var day = _padZero(date.getDate(), padZeroEnabled);
|
|
2389
|
+
var hours = _padZero(date.getHours(), padZeroEnabled);
|
|
2390
|
+
var minutes = _padZero(date.getMinutes(), padZeroEnabled);
|
|
2391
|
+
var seconds = _padZero(date.getSeconds(), padZeroEnabled);
|
|
2392
|
+
var res = "".concat(year, "-").concat(month, "-").concat(day);
|
|
2393
|
+
return res;
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
/**
|
|
2397
|
+
* Get today date
|
|
2398
|
+
* @returns {String} yyyy-MM-dd
|
|
2399
|
+
*/
|
|
2400
|
+
function _getTodayDate() {
|
|
2401
|
+
return _getCalendarDate(new Date());
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
/**
|
|
2405
|
+
* Get tomorrow date
|
|
2406
|
+
* @param {Date | String} v
|
|
2407
|
+
* @returns {String} yyyy-MM-dd
|
|
2408
|
+
*/
|
|
2409
|
+
function _getTomorrowDate(v) {
|
|
2410
|
+
var today = _dateFormat(v);
|
|
2411
|
+
var _tomorrow = today;
|
|
2412
|
+
_tomorrow.setDate(_tomorrow.getDate() + 1);
|
|
2413
|
+
var tomorrow = _getCalendarDate(_tomorrow);
|
|
2414
|
+
return tomorrow;
|
|
2415
|
+
}
|
|
2416
|
+
|
|
2417
|
+
/**
|
|
2418
|
+
* Get yesterday date
|
|
2419
|
+
* @param {Date | String} v
|
|
2420
|
+
* @returns {String} yyyy-MM-dd
|
|
2421
|
+
*/
|
|
2422
|
+
function _getYesterdayDate(v) {
|
|
2423
|
+
var today = _dateFormat(v);
|
|
2424
|
+
var _yesterday = today;
|
|
2425
|
+
_yesterday.setDate(_yesterday.getDate() - 1);
|
|
2426
|
+
var yesterday = _getCalendarDate(_yesterday);
|
|
2427
|
+
return yesterday;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* Get specified date
|
|
2432
|
+
* @param {Date | String} v
|
|
2433
|
+
* @param {Number} days The number of days forward or backward, which can be a negative number
|
|
2434
|
+
* @returns {String} yyyy-MM-dd
|
|
2435
|
+
*/
|
|
2436
|
+
/* console.log(getSpecifiedDate(getTodayDate(), -180)); // 2023-08-27 (180 days before February 23, 202) */
|
|
2437
|
+
function _getSpecifiedDate(v, days) {
|
|
2438
|
+
var today = _dateFormat(v);
|
|
2439
|
+
var _specifiedDay = today;
|
|
2440
|
+
_specifiedDay.setDate(_specifiedDay.getDate() + days);
|
|
2441
|
+
var specifiedDay = _getCalendarDate(_specifiedDay);
|
|
2442
|
+
return specifiedDay;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
/**
|
|
2446
|
+
* Get next month date
|
|
2447
|
+
* @param {Date | String} v
|
|
2448
|
+
* @returns {String} yyyy-MM-dd
|
|
2449
|
+
*/
|
|
2450
|
+
function _getNextMonthDate(v) {
|
|
2451
|
+
var today = _dateFormat(v);
|
|
2452
|
+
today.setMonth(today.getMonth() + 1);
|
|
2453
|
+
return _getCalendarDate(today);
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
/**
|
|
2457
|
+
* Get previous month date
|
|
2458
|
+
* @param {Date | String} v
|
|
2459
|
+
* @returns {String} yyyy-MM-dd
|
|
2460
|
+
*/
|
|
2461
|
+
function _getPrevMonthDate(v) {
|
|
2462
|
+
var today = _dateFormat(v);
|
|
2463
|
+
today.setMonth(today.getMonth() - 1);
|
|
2464
|
+
return _getCalendarDate(today);
|
|
2465
|
+
}
|
|
2466
|
+
|
|
2467
|
+
/**
|
|
2468
|
+
* Get next year date
|
|
2469
|
+
* @param {Date | String} v
|
|
2470
|
+
* @returns {String} yyyy-MM-dd
|
|
2471
|
+
*/
|
|
2472
|
+
function _getNextYearDate(v) {
|
|
2473
|
+
var today = _dateFormat(v);
|
|
2474
|
+
var current = new Date(today);
|
|
2475
|
+
current.setFullYear(current.getFullYear() + 1);
|
|
2476
|
+
return _getCalendarDate(current);
|
|
2477
|
+
}
|
|
2478
|
+
|
|
2479
|
+
/**
|
|
2480
|
+
* Get previous year date
|
|
2481
|
+
* @param {Date | String} v
|
|
2482
|
+
* @returns {String} yyyy-MM-dd
|
|
2483
|
+
*/
|
|
2484
|
+
function _getPrevYearDate(v) {
|
|
2485
|
+
var today = _dateFormat(v);
|
|
2486
|
+
var current = new Date(today);
|
|
2487
|
+
current.setFullYear(current.getFullYear() - 1);
|
|
2488
|
+
return _getCalendarDate(current);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
/**
|
|
2492
|
+
* Get last day in month
|
|
2493
|
+
* @param {Date | String} v
|
|
2494
|
+
* @param {?Number} targetMonth
|
|
2495
|
+
* @returns {String} yyyy-MM-dd
|
|
2496
|
+
*/
|
|
2497
|
+
/*
|
|
2498
|
+
Example: Get last day in next month
|
|
2499
|
+
|
|
2500
|
+
const _day = '2024-01-01';
|
|
2501
|
+
const y = new Date(getNextMonthDate(_day)).getFullYear();
|
|
2502
|
+
const m = String(new Date(getNextMonthDate(_day)).getMonth() + 1).padStart(2, '0');
|
|
2503
|
+
const d = getLastDayInMonth(getNextMonthDate(_day), new Date(getNextMonthDate(_day)).getMonth() + 1);
|
|
2504
|
+
|
|
2505
|
+
const lastDayOfNextMonth = `${y}-${m}-${d}`; // 2024-02-29
|
|
2506
|
+
|
|
2507
|
+
*/
|
|
2508
|
+
function _getLastDayInMonth(v) {
|
|
2509
|
+
var targetMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
2510
|
+
var date = _dateFormat(v);
|
|
2511
|
+
return new Date(date.getFullYear(), typeof targetMonth !== 'undefined' ? targetMonth : date.getMonth() - 1, 0).getDate();
|
|
2512
|
+
}
|
|
2513
|
+
|
|
2514
|
+
/**
|
|
2515
|
+
* Get current year
|
|
2516
|
+
* @returns {Number}
|
|
2517
|
+
*/
|
|
2518
|
+
function _getCurrentYear() {
|
|
2519
|
+
return new Date().getFullYear();
|
|
2520
|
+
}
|
|
2521
|
+
|
|
2522
|
+
/**
|
|
2523
|
+
* Get current month
|
|
2524
|
+
* @param {Boolean} padZeroEnabled
|
|
2525
|
+
* @returns {Number}
|
|
2526
|
+
*/
|
|
2527
|
+
function _getCurrentMonth() {
|
|
2528
|
+
var padZeroEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2529
|
+
var m = new Date().getMonth() + 1;
|
|
2530
|
+
return padZeroEnabled ? String(m).padStart(2, '0') : m;
|
|
2531
|
+
}
|
|
2532
|
+
|
|
2533
|
+
/**
|
|
2534
|
+
* Get current day
|
|
2535
|
+
* @param {Boolean} padZeroEnabled
|
|
2536
|
+
* @returns {Number}
|
|
2537
|
+
*/
|
|
2538
|
+
function _getCurrentDay() {
|
|
2539
|
+
var padZeroEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2540
|
+
var d = new Date().getDate();
|
|
2541
|
+
return padZeroEnabled ? String(d).padStart(2, '0') : d;
|
|
2542
|
+
}
|
|
2543
|
+
|
|
2544
|
+
/**
|
|
2545
|
+
* Get first and last month day
|
|
2546
|
+
* @param {Number} v
|
|
2547
|
+
* @param {Boolean} padZeroEnabled
|
|
2548
|
+
* @returns {Array}
|
|
2549
|
+
*/
|
|
2550
|
+
function _getFirstAndLastMonthDay(year) {
|
|
2551
|
+
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2552
|
+
var theFirst = new Date(year, 0, 1).getDate();
|
|
2553
|
+
var theLast = new Date(year, 11, 31).getDate();
|
|
2554
|
+
var padZero = function padZero(num) {
|
|
2555
|
+
if (padZeroEnabled) {
|
|
2556
|
+
return num < 10 ? '0' + num : num.toString();
|
|
2557
|
+
} else {
|
|
2558
|
+
return num.toString();
|
|
2559
|
+
}
|
|
2560
|
+
};
|
|
2561
|
+
return [padZero(theFirst), padZero(theLast)];
|
|
2562
|
+
}
|
|
2563
|
+
|
|
2564
|
+
/**
|
|
2565
|
+
* Get current date
|
|
2566
|
+
* @param {Boolean} padZeroEnabled
|
|
2567
|
+
* @typedef {String} JSON
|
|
2568
|
+
*/
|
|
2569
|
+
function _getCurrentDate() {
|
|
2570
|
+
var padZeroEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2571
|
+
var date = new Date();
|
|
2572
|
+
var padZero = function padZero(num) {
|
|
2573
|
+
if (padZeroEnabled) {
|
|
2574
|
+
return num < 10 ? '0' + num : num.toString();
|
|
2575
|
+
} else {
|
|
2576
|
+
return num.toString();
|
|
2577
|
+
}
|
|
2578
|
+
};
|
|
2579
|
+
var year = date.getFullYear();
|
|
2580
|
+
var month = padZero(date.getMonth() + 1);
|
|
2581
|
+
var day = padZero(date.getDate());
|
|
2582
|
+
var hours = padZero(date.getHours());
|
|
2583
|
+
var minutes = padZero(date.getMinutes());
|
|
2584
|
+
return {
|
|
2585
|
+
today: "".concat(year, "-").concat(month, "-").concat(day),
|
|
2586
|
+
yearStart: "".concat(year, "-01-01"),
|
|
2587
|
+
yearEnd: "".concat(year, "-12-").concat(_getLastDayInMonth(date, 12))
|
|
2588
|
+
};
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
/**
|
|
2592
|
+
* Get full time
|
|
2593
|
+
* @param {Date | String} v
|
|
2594
|
+
* @param {Boolean} padZeroEnabled
|
|
2595
|
+
* @param {Boolean} hasSeconds
|
|
2596
|
+
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2597
|
+
*/
|
|
2598
|
+
function _getFullTime(v) {
|
|
2599
|
+
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2600
|
+
var hasSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2601
|
+
var date = _dateFormat(v);
|
|
2602
|
+
var padZero = function padZero(num) {
|
|
2603
|
+
if (padZeroEnabled) {
|
|
2604
|
+
return num < 10 ? '0' + num : num.toString();
|
|
2605
|
+
} else {
|
|
2606
|
+
return num.toString();
|
|
2607
|
+
}
|
|
2608
|
+
};
|
|
2609
|
+
var year = date.getFullYear();
|
|
2610
|
+
var month = padZero(date.getMonth() + 1);
|
|
2611
|
+
var day = padZero(date.getDate());
|
|
2612
|
+
var hours = padZero(date.getHours());
|
|
2613
|
+
var minutes = padZero(date.getMinutes());
|
|
2614
|
+
var seconds = padZero(date.getSeconds());
|
|
2615
|
+
var res = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
2616
|
+
var res2 = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes);
|
|
2617
|
+
return hasSeconds ? res : res2;
|
|
2618
|
+
}
|
|
2619
|
+
|
|
2620
|
+
/**
|
|
2621
|
+
* Add hours
|
|
2622
|
+
* @param {Date | String} v
|
|
2623
|
+
* @param {Number} offset
|
|
2624
|
+
* @param {Boolean} padZeroEnabled
|
|
2625
|
+
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2626
|
+
*/
|
|
2627
|
+
function _setDateHours(v, offset) {
|
|
2628
|
+
var padZeroEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2629
|
+
var date = _dateFormat(v);
|
|
2630
|
+
var _cur = new Date(date).setTime(new Date(date).getTime() + offset * 60 * 60 * 1000);
|
|
2631
|
+
return _getFullTime(new Date(_cur), padZeroEnabled);
|
|
2632
|
+
}
|
|
2633
|
+
|
|
2634
|
+
/**
|
|
2635
|
+
* Add minutes
|
|
2636
|
+
* @param {Date | String} v
|
|
2637
|
+
* @param {Number} offset
|
|
2638
|
+
* @param {Boolean} padZeroEnabled
|
|
2639
|
+
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2640
|
+
*/
|
|
2641
|
+
function _setDateMinutes(v, offset) {
|
|
2642
|
+
var padZeroEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2643
|
+
var date = _dateFormat(v);
|
|
2644
|
+
var _cur = new Date(date).setTime(new Date(date).getTime() + offset * 60 * 1000);
|
|
2645
|
+
return _getFullTime(new Date(_cur), padZeroEnabled);
|
|
2646
|
+
}
|
|
2647
|
+
/**
|
|
2648
|
+
* Add days
|
|
2649
|
+
* @param {Date | String} v
|
|
2650
|
+
* @param {Number} offset
|
|
2651
|
+
* @param {Boolean} padZeroEnabled
|
|
2652
|
+
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2653
|
+
*/
|
|
2654
|
+
function _setDateDays(v, offset) {
|
|
2655
|
+
var padZeroEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2656
|
+
var date = _dateFormat(v);
|
|
2657
|
+
var _cur = new Date(date).setTime(new Date(date).getTime() + offset * 24 * 60 * 60 * 1000);
|
|
2658
|
+
return _getFullTime(new Date(_cur), padZeroEnabled);
|
|
2659
|
+
}
|
|
2660
|
+
|
|
2661
|
+
/**
|
|
2662
|
+
* Convert timestamp to date
|
|
2663
|
+
* @param {Number} v
|
|
2664
|
+
* @param {Boolean} padZeroEnabled
|
|
2665
|
+
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2666
|
+
*/
|
|
2667
|
+
function _timestampToDate(v) {
|
|
2668
|
+
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2669
|
+
return _getFullTime(new Date(v), padZeroEnabled);
|
|
2670
|
+
}
|
|
2671
|
+
; // CONCATENATED MODULE: ./src/libs/object.js
|
|
2672
|
+
function object_typeof(obj) {
|
|
2673
|
+
"@babel/helpers - typeof";
|
|
2674
|
+
|
|
2675
|
+
return object_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2676
|
+
return typeof obj;
|
|
2677
|
+
} : function (obj) {
|
|
2678
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2679
|
+
}, object_typeof(obj);
|
|
2680
|
+
}
|
|
2681
|
+
/**
|
|
2682
|
+
* Deep clone
|
|
2683
|
+
* @param {*} obj
|
|
2684
|
+
*/
|
|
2685
|
+
function _deepClone(obj) {
|
|
2686
|
+
if (Array.isArray(obj)) {
|
|
2687
|
+
return obj.map(function (item) {
|
|
2688
|
+
return _deepClone(item);
|
|
2689
|
+
});
|
|
2690
|
+
} else if (object_typeof(obj) === 'object' && obj !== null) {
|
|
2691
|
+
var clone = {};
|
|
2692
|
+
for (var key in obj) {
|
|
2693
|
+
if (obj.hasOwnProperty(key)) {
|
|
2694
|
+
clone[key] = _deepClone(obj[key]);
|
|
2695
|
+
}
|
|
2696
|
+
}
|
|
2697
|
+
return clone;
|
|
2698
|
+
} else {
|
|
2699
|
+
return obj;
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
;
|
|
2703
|
+
|
|
2704
|
+
/**
|
|
2705
|
+
* Flat Data
|
|
2706
|
+
* @param {*} data
|
|
2707
|
+
* @returns
|
|
2708
|
+
*/
|
|
2709
|
+
function _flatData(data) {
|
|
2710
|
+
var result = [];
|
|
2711
|
+
var iterate = function iterate(obj) {
|
|
2712
|
+
if (!obj) {
|
|
2713
|
+
return;
|
|
2714
|
+
}
|
|
2715
|
+
obj.forEach(function (item) {
|
|
2716
|
+
result.push(item);
|
|
2717
|
+
if (item.children) {
|
|
2718
|
+
iterate(item.children);
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
// delete current item children
|
|
2722
|
+
delete item.children;
|
|
2723
|
+
});
|
|
2724
|
+
};
|
|
2725
|
+
iterate(data);
|
|
2726
|
+
return result;
|
|
2727
|
+
}
|
|
2728
|
+
;
|
|
2729
|
+
|
|
2730
|
+
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
2731
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __nested_webpack_require_1471__(787);
|
|
2732
|
+
; // CONCATENATED MODULE: ./src/hooks/useThrottle.js
|
|
2733
|
+
/**
|
|
2734
|
+
* Limiting the rate of execution
|
|
2735
|
+
*
|
|
2736
|
+
* @usage:
|
|
2737
|
+
|
|
2738
|
+
const App = () => {
|
|
2739
|
+
const [count, setCount] = useState(0);
|
|
2740
|
+
const handleClick = useThrottle(() => setCount(count + 1), 500, [count]);
|
|
2741
|
+
|
|
2742
|
+
return (
|
|
2743
|
+
<div className="app">
|
|
2744
|
+
<button onClick={handleClick}>click</button>
|
|
2745
|
+
<p>click {count} time</p>
|
|
2746
|
+
</div>
|
|
2747
|
+
);
|
|
2748
|
+
};
|
|
2749
|
+
|
|
2750
|
+
*/
|
|
2751
|
+
|
|
2752
|
+
var useThrottle = function useThrottle(fn, delay, dependence) {
|
|
2753
|
+
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
|
|
2754
|
+
lastTime: 0
|
|
2755
|
+
});
|
|
2756
|
+
return (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
2757
|
+
var now = Date.now();
|
|
2758
|
+
if (now - ref.current.lastTime >= delay) {
|
|
2759
|
+
fn.apply(void 0, arguments);
|
|
2760
|
+
ref.current.lastTime = now;
|
|
2761
|
+
}
|
|
2762
|
+
}, dependence);
|
|
2763
|
+
};
|
|
2764
|
+
/* harmony default export */
|
|
2765
|
+
var hooks_useThrottle = useThrottle;
|
|
2766
|
+
; // CONCATENATED MODULE: ./src/hooks/useDebounce.js
|
|
2767
|
+
/**
|
|
2768
|
+
* Delay the execution of function or state update
|
|
2769
|
+
*
|
|
2770
|
+
* @usage:
|
|
2771
|
+
|
|
2772
|
+
const App = () => {
|
|
2773
|
+
const [count, setCount] = useState(0);
|
|
2774
|
+
const handleClick = useDebounce(() => setCount(count + 1), 500, [count]);
|
|
2775
|
+
|
|
2776
|
+
return (
|
|
2777
|
+
<div className="app">
|
|
2778
|
+
<button onClick={handleClick}>click</button>
|
|
2779
|
+
<p>click {count} time</p>
|
|
2780
|
+
</div>
|
|
2781
|
+
);
|
|
2782
|
+
};
|
|
2783
|
+
|
|
2784
|
+
*/
|
|
2785
|
+
|
|
2786
|
+
var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
2787
|
+
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2788
|
+
return (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
2789
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2790
|
+
args[_key] = arguments[_key];
|
|
2791
|
+
}
|
|
2792
|
+
//Every time this returned function is called, the timer is cleared to ensure that fn is not executed
|
|
2793
|
+
clearTimeout(ref.current);
|
|
2794
|
+
ref.current = null;
|
|
2795
|
+
|
|
2796
|
+
// When the returned function is called for the last time (that is the user stops a continuous operation)
|
|
2797
|
+
// Execute fn after another delay milliseconds
|
|
2798
|
+
ref.current = setTimeout(function () {
|
|
2799
|
+
fn.apply(void 0, args);
|
|
2800
|
+
}, delay);
|
|
2801
|
+
}, dependence);
|
|
2802
|
+
};
|
|
2803
|
+
/* harmony default export */
|
|
2804
|
+
var hooks_useDebounce = useDebounce;
|
|
2805
|
+
; // CONCATENATED MODULE: ./src/hooks/useAutosizeTextArea.js
|
|
2806
|
+
function _slicedToArray(arr, i) {
|
|
2807
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || useAutosizeTextArea_unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
2808
|
+
}
|
|
2809
|
+
function _nonIterableRest() {
|
|
2810
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
2811
|
+
}
|
|
2812
|
+
function useAutosizeTextArea_unsupportedIterableToArray(o, minLen) {
|
|
2813
|
+
if (!o) return;
|
|
2814
|
+
if (typeof o === "string") return useAutosizeTextArea_arrayLikeToArray(o, minLen);
|
|
2815
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
2816
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
2817
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
2818
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useAutosizeTextArea_arrayLikeToArray(o, minLen);
|
|
2819
|
+
}
|
|
2820
|
+
function useAutosizeTextArea_arrayLikeToArray(arr, len) {
|
|
2821
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
2822
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
2823
|
+
return arr2;
|
|
2824
|
+
}
|
|
2825
|
+
function _iterableToArrayLimit(arr, i) {
|
|
2826
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
2827
|
+
if (null != _i) {
|
|
2828
|
+
var _s,
|
|
2829
|
+
_e,
|
|
2830
|
+
_x,
|
|
2831
|
+
_r,
|
|
2832
|
+
_arr = [],
|
|
2833
|
+
_n = !0,
|
|
2834
|
+
_d = !1;
|
|
2835
|
+
try {
|
|
2836
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
2837
|
+
if (Object(_i) !== _i) return;
|
|
2838
|
+
_n = !1;
|
|
2839
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
2840
|
+
} catch (err) {
|
|
2841
|
+
_d = !0, _e = err;
|
|
2842
|
+
} finally {
|
|
2843
|
+
try {
|
|
2844
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
2845
|
+
} finally {
|
|
2846
|
+
if (_d) throw _e;
|
|
2847
|
+
}
|
|
2848
|
+
}
|
|
2849
|
+
return _arr;
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2852
|
+
function _arrayWithHoles(arr) {
|
|
2853
|
+
if (Array.isArray(arr)) return arr;
|
|
2854
|
+
}
|
|
2855
|
+
/**
|
|
2856
|
+
* Creating a Textarea with dynamic height
|
|
2857
|
+
*
|
|
2858
|
+
* @usage:
|
|
2859
|
+
|
|
2860
|
+
|
|
2861
|
+
const App = () => {
|
|
2862
|
+
const [value, setValue] = useState("");
|
|
2863
|
+
const el = useRef<HTMLTextAreaElement>(null);
|
|
2864
|
+
|
|
2865
|
+
useAutosizeTextArea(
|
|
2866
|
+
el.current,
|
|
2867
|
+
value,
|
|
2868
|
+
(res) => {
|
|
2869
|
+
onResize?.(event, valRef.current, res);
|
|
2870
|
+
}
|
|
2871
|
+
);
|
|
2872
|
+
|
|
2873
|
+
const handleChange = (evt: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
2874
|
+
const val = evt.target?.value;
|
|
2875
|
+
setValue(val);
|
|
2876
|
+
};
|
|
2877
|
+
|
|
2878
|
+
return (
|
|
2879
|
+
<div className="App">
|
|
2880
|
+
<textarea
|
|
2881
|
+
onChange={handleChange}
|
|
2882
|
+
ref={el}
|
|
2883
|
+
rows={3}
|
|
2884
|
+
value={value}
|
|
2885
|
+
/>
|
|
2886
|
+
</div>
|
|
2887
|
+
);
|
|
2888
|
+
};
|
|
2889
|
+
|
|
2890
|
+
|
|
2891
|
+
|
|
2892
|
+
*/
|
|
2893
|
+
|
|
2894
|
+
// Updates the height of a <textarea> when the value changes.
|
|
2895
|
+
var useAutosizeTextArea = function useAutosizeTextArea(el, value, cb) {
|
|
2896
|
+
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
2897
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2898
|
+
defaultRowHeight = _useState2[0],
|
|
2899
|
+
setDefaultRowHeight = _useState2[1];
|
|
2900
|
+
var _useState3 = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
2901
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2902
|
+
defaultRowHeightInit = _useState4[0],
|
|
2903
|
+
setDefaultRowHeightInit = _useState4[1];
|
|
2904
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
2905
|
+
if (el) {
|
|
2906
|
+
var style = el.currentStyle || window.getComputedStyle(el);
|
|
2907
|
+
var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
|
|
2908
|
+
|
|
2909
|
+
// initialize default row height
|
|
2910
|
+
if (el.scrollHeight > 0 && !defaultRowHeightInit) {
|
|
2911
|
+
setDefaultRowHeight(el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth));
|
|
2912
|
+
setDefaultRowHeightInit(true);
|
|
2913
|
+
}
|
|
2914
|
+
|
|
2915
|
+
// restore default row height
|
|
2916
|
+
if (defaultRowHeight > 0) {
|
|
2917
|
+
el.style.height = defaultRowHeight + "px";
|
|
2918
|
+
}
|
|
2919
|
+
|
|
2920
|
+
// reset the height momentarily to get the correct scrollHeight for the textarea
|
|
2921
|
+
var scrollHeight = el.scrollHeight;
|
|
2922
|
+
|
|
2923
|
+
// then set the height directly, outside of the render loop
|
|
2924
|
+
// Trying to set this with state or a ref will product an incorrect value.
|
|
2925
|
+
|
|
2926
|
+
// !!! Compare initial height and changed height
|
|
2927
|
+
if (scrollHeight > defaultRowHeight && defaultRowHeight > 0) {
|
|
2928
|
+
el.style.height = scrollHeight + "px";
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
//
|
|
2932
|
+
cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
|
|
2933
|
+
}
|
|
2934
|
+
}, [el, value]);
|
|
2935
|
+
};
|
|
2936
|
+
/* harmony default export */
|
|
2937
|
+
var hooks_useAutosizeTextArea = useAutosizeTextArea;
|
|
2938
|
+
; // CONCATENATED MODULE: ./src/hooks/useInterval.js
|
|
2939
|
+
/**
|
|
2940
|
+
* Provides a convenient way to create and manage intervals
|
|
2941
|
+
*
|
|
2942
|
+
* @usage:
|
|
2943
|
+
|
|
2944
|
+
const App = () => {
|
|
2945
|
+
const [count, setCount] = useState(0);
|
|
2946
|
+
|
|
2947
|
+
useInterval(() => {
|
|
2948
|
+
setCount(count + 1);
|
|
2949
|
+
}, 1000);
|
|
2950
|
+
|
|
2951
|
+
return (
|
|
2952
|
+
<div className="app"></div>
|
|
2953
|
+
);
|
|
2954
|
+
};
|
|
2955
|
+
|
|
2956
|
+
*/
|
|
2957
|
+
|
|
2958
|
+
var useInterval = function useInterval(fn, delay) {
|
|
2959
|
+
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
2960
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
2961
|
+
ref.current = fn;
|
|
2962
|
+
}, [fn]);
|
|
2963
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
2964
|
+
function tick() {
|
|
2965
|
+
ref.current && ref.current();
|
|
2966
|
+
}
|
|
2967
|
+
if (delay !== null && delay > 0) {
|
|
2968
|
+
var id = setInterval(tick, delay);
|
|
2969
|
+
return function () {
|
|
2970
|
+
return clearInterval(id);
|
|
2971
|
+
};
|
|
2972
|
+
} else {
|
|
2973
|
+
tick();
|
|
2974
|
+
}
|
|
2975
|
+
}, [delay]);
|
|
2976
|
+
};
|
|
2977
|
+
/* harmony default export */
|
|
2978
|
+
var hooks_useInterval = useInterval;
|
|
2979
|
+
; // CONCATENATED MODULE: ./src/hooks/useClickOutside.js
|
|
2980
|
+
/**
|
|
2981
|
+
* Handles the event of clicking outside of the wrapped component
|
|
2982
|
+
*
|
|
2983
|
+
* @usage:
|
|
2984
|
+
|
|
2985
|
+
const App = () => {
|
|
2986
|
+
useClickOutside({
|
|
2987
|
+
enabled: true,
|
|
2988
|
+
isOutside: (event: any) => {
|
|
2989
|
+
return event.target.closest(`.test__wrapper`) === null && event.target.closest(`.test__wrapper2`) === null;
|
|
2990
|
+
},
|
|
2991
|
+
handle: (event: any) => {
|
|
2992
|
+
// do something
|
|
2993
|
+
//...
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
};
|
|
2997
|
+
|
|
2998
|
+
*/
|
|
2999
|
+
|
|
3000
|
+
function useClickOutside(_ref) {
|
|
3001
|
+
var enabled = _ref.enabled,
|
|
3002
|
+
isOutside = _ref.isOutside,
|
|
3003
|
+
handle = _ref.handle;
|
|
3004
|
+
var isOutsideRef = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(isOutside);
|
|
3005
|
+
var handleRef = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(handle);
|
|
3006
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3007
|
+
isOutsideRef.current = isOutside;
|
|
3008
|
+
|
|
3009
|
+
// fix possible issue if clicking on a focusable element
|
|
3010
|
+
handleRef.current = handle;
|
|
3011
|
+
}, [isOutside, handle]);
|
|
3012
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3013
|
+
if (enabled) {
|
|
3014
|
+
var eventHandler = function eventHandler(event) {
|
|
3015
|
+
var _isOutsideRef;
|
|
3016
|
+
if ((_isOutsideRef = isOutsideRef.current) !== null && _isOutsideRef !== void 0 && _isOutsideRef.call(isOutsideRef, event)) {
|
|
3017
|
+
var _handleRef;
|
|
3018
|
+
(_handleRef = handleRef.current) === null || _handleRef === void 0 || _handleRef.call(handleRef, event);
|
|
3019
|
+
}
|
|
3020
|
+
};
|
|
3021
|
+
document.addEventListener('pointerdown', eventHandler);
|
|
3022
|
+
return function () {
|
|
3023
|
+
document.removeEventListener('pointerdown', eventHandler);
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
}, [enabled]);
|
|
3027
|
+
}
|
|
3028
|
+
/* harmony default export */
|
|
3029
|
+
var hooks_useClickOutside = useClickOutside;
|
|
3030
|
+
; // CONCATENATED MODULE: ./src/hooks/useKeyPress.js
|
|
3031
|
+
function useKeyPress_slicedToArray(arr, i) {
|
|
3032
|
+
return useKeyPress_arrayWithHoles(arr) || useKeyPress_iterableToArrayLimit(arr, i) || useKeyPress_unsupportedIterableToArray(arr, i) || useKeyPress_nonIterableRest();
|
|
3033
|
+
}
|
|
3034
|
+
function useKeyPress_nonIterableRest() {
|
|
3035
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3036
|
+
}
|
|
3037
|
+
function useKeyPress_unsupportedIterableToArray(o, minLen) {
|
|
3038
|
+
if (!o) return;
|
|
3039
|
+
if (typeof o === "string") return useKeyPress_arrayLikeToArray(o, minLen);
|
|
3040
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3041
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3042
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3043
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useKeyPress_arrayLikeToArray(o, minLen);
|
|
3044
|
+
}
|
|
3045
|
+
function useKeyPress_arrayLikeToArray(arr, len) {
|
|
3046
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3047
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3048
|
+
return arr2;
|
|
3049
|
+
}
|
|
3050
|
+
function useKeyPress_iterableToArrayLimit(arr, i) {
|
|
3051
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3052
|
+
if (null != _i) {
|
|
3053
|
+
var _s,
|
|
3054
|
+
_e,
|
|
3055
|
+
_x,
|
|
3056
|
+
_r,
|
|
3057
|
+
_arr = [],
|
|
3058
|
+
_n = !0,
|
|
3059
|
+
_d = !1;
|
|
3060
|
+
try {
|
|
3061
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3062
|
+
if (Object(_i) !== _i) return;
|
|
3063
|
+
_n = !1;
|
|
3064
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3065
|
+
} catch (err) {
|
|
3066
|
+
_d = !0, _e = err;
|
|
3067
|
+
} finally {
|
|
3068
|
+
try {
|
|
3069
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
3070
|
+
} finally {
|
|
3071
|
+
if (_d) throw _e;
|
|
3072
|
+
}
|
|
3073
|
+
}
|
|
3074
|
+
return _arr;
|
|
3075
|
+
}
|
|
3076
|
+
}
|
|
3077
|
+
function useKeyPress_arrayWithHoles(arr) {
|
|
3078
|
+
if (Array.isArray(arr)) return arr;
|
|
3079
|
+
}
|
|
3080
|
+
/**
|
|
3081
|
+
* Listens for changes in the pressed state of a given key
|
|
3082
|
+
*
|
|
3083
|
+
* @usage:
|
|
3084
|
+
|
|
3085
|
+
const App = () => {
|
|
3086
|
+
const escPressed = useKeyPress({
|
|
3087
|
+
keyCode: 'Escape',
|
|
3088
|
+
handleUp: (key, event) => { },
|
|
3089
|
+
handleDown: async (key, event) => {
|
|
3090
|
+
// do something
|
|
3091
|
+
event.preventDefault();
|
|
3092
|
+
// await xxxxx();
|
|
3093
|
+
console.log(key);
|
|
3094
|
+
}
|
|
3095
|
+
});
|
|
3096
|
+
|
|
3097
|
+
const multiplePressed = useKeyPress({
|
|
3098
|
+
keyCode: ['ArrowUp', 'ArrowDown', 'Enter', 'NumpadEnter'],
|
|
3099
|
+
handleUp: (key, event) => { },
|
|
3100
|
+
handleDown: (key, event) => {
|
|
3101
|
+
// do something
|
|
3102
|
+
event.preventDefault();
|
|
3103
|
+
console.log(key);
|
|
3104
|
+
}
|
|
3105
|
+
});
|
|
3106
|
+
|
|
3107
|
+
|
|
3108
|
+
return (
|
|
3109
|
+
<div className="app">{escPressed ? 'Escape' : null}</div>
|
|
3110
|
+
);
|
|
3111
|
+
};
|
|
3112
|
+
|
|
3113
|
+
*/
|
|
3114
|
+
|
|
3115
|
+
var useKeyPress = function useKeyPress(_ref) {
|
|
3116
|
+
var keyCode = _ref.keyCode,
|
|
3117
|
+
handleDown = _ref.handleDown,
|
|
3118
|
+
handleUp = _ref.handleUp;
|
|
3119
|
+
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3120
|
+
_useState2 = useKeyPress_slicedToArray(_useState, 2),
|
|
3121
|
+
keyPressed = _useState2[0],
|
|
3122
|
+
setKeyPressed = _useState2[1];
|
|
3123
|
+
var multipleKeys = Array.isArray(keyCode);
|
|
3124
|
+
|
|
3125
|
+
// `Escape`, `Enter`, `Alt`, `Control`, `CapsLock`, `Shift`, `ArrowUp`, `ArrowDown`, `ArrowLeft`, `ArrowRight` `w`, `e`, ...
|
|
3126
|
+
var eventHandlerDown = function eventHandlerDown(event) {
|
|
3127
|
+
var key = event.code;
|
|
3128
|
+
if (multipleKeys) {
|
|
3129
|
+
if (keyCode.includes(key)) {
|
|
3130
|
+
setKeyPressed(true);
|
|
3131
|
+
if (typeof handleDown === 'function') handleDown(key, event);
|
|
3132
|
+
}
|
|
3133
|
+
} else {
|
|
3134
|
+
if (key === keyCode) {
|
|
3135
|
+
setKeyPressed(true);
|
|
3136
|
+
if (typeof handleDown === 'function') handleDown(key, event);
|
|
3137
|
+
}
|
|
3138
|
+
}
|
|
3139
|
+
};
|
|
3140
|
+
var eventHandlerUp = function eventHandlerUp(event) {
|
|
3141
|
+
var key = event.code;
|
|
3142
|
+
if (multipleKeys) {
|
|
3143
|
+
if (keyCode.includes(key)) {
|
|
3144
|
+
setKeyPressed(false);
|
|
3145
|
+
if (typeof handleUp === 'function') handleUp(key, event);
|
|
3146
|
+
}
|
|
3147
|
+
} else {
|
|
3148
|
+
if (key === keyCode) {
|
|
3149
|
+
setKeyPressed(false);
|
|
3150
|
+
if (typeof handleUp === 'function') handleUp(key, event);
|
|
3151
|
+
}
|
|
3152
|
+
}
|
|
3153
|
+
};
|
|
3154
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3155
|
+
window.addEventListener('keydown', eventHandlerDown);
|
|
3156
|
+
window.addEventListener('keyup', eventHandlerUp);
|
|
3157
|
+
return function () {
|
|
3158
|
+
window.removeEventListener('keydown', eventHandlerDown);
|
|
3159
|
+
window.removeEventListener('keyup', eventHandlerUp);
|
|
3160
|
+
};
|
|
3161
|
+
}, []);
|
|
3162
|
+
return keyPressed;
|
|
3163
|
+
};
|
|
3164
|
+
/* harmony default export */
|
|
3165
|
+
var hooks_useKeyPress = useKeyPress;
|
|
3166
|
+
; // CONCATENATED MODULE: ./src/hooks/useWindowScroll.js
|
|
3167
|
+
function useWindowScroll_slicedToArray(arr, i) {
|
|
3168
|
+
return useWindowScroll_arrayWithHoles(arr) || useWindowScroll_iterableToArrayLimit(arr, i) || useWindowScroll_unsupportedIterableToArray(arr, i) || useWindowScroll_nonIterableRest();
|
|
3169
|
+
}
|
|
3170
|
+
function useWindowScroll_nonIterableRest() {
|
|
3171
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3172
|
+
}
|
|
3173
|
+
function useWindowScroll_unsupportedIterableToArray(o, minLen) {
|
|
3174
|
+
if (!o) return;
|
|
3175
|
+
if (typeof o === "string") return useWindowScroll_arrayLikeToArray(o, minLen);
|
|
3176
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3177
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3178
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3179
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useWindowScroll_arrayLikeToArray(o, minLen);
|
|
3180
|
+
}
|
|
3181
|
+
function useWindowScroll_arrayLikeToArray(arr, len) {
|
|
3182
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3183
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3184
|
+
return arr2;
|
|
3185
|
+
}
|
|
3186
|
+
function useWindowScroll_iterableToArrayLimit(arr, i) {
|
|
3187
|
+
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3188
|
+
if (null != _i) {
|
|
3189
|
+
var _s,
|
|
3190
|
+
_e,
|
|
3191
|
+
_x,
|
|
3192
|
+
_r,
|
|
3193
|
+
_arr = [],
|
|
3194
|
+
_n = !0,
|
|
3195
|
+
_d = !1;
|
|
3196
|
+
try {
|
|
3197
|
+
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3198
|
+
if (Object(_i) !== _i) return;
|
|
3199
|
+
_n = !1;
|
|
3200
|
+
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3201
|
+
} catch (err) {
|
|
3202
|
+
_d = !0, _e = err;
|
|
3203
|
+
} finally {
|
|
3204
|
+
try {
|
|
3205
|
+
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
3206
|
+
} finally {
|
|
3207
|
+
if (_d) throw _e;
|
|
3208
|
+
}
|
|
3209
|
+
}
|
|
3210
|
+
return _arr;
|
|
3211
|
+
}
|
|
3212
|
+
}
|
|
3213
|
+
function useWindowScroll_arrayWithHoles(arr) {
|
|
3214
|
+
if (Array.isArray(arr)) return arr;
|
|
3215
|
+
}
|
|
3216
|
+
/**
|
|
3217
|
+
* Listens for scrolls the window to a particular place in the document
|
|
3218
|
+
*
|
|
3219
|
+
* @usage:
|
|
3220
|
+
|
|
3221
|
+
const App = () => {
|
|
3222
|
+
const [scrollData, windowScrollUpdate] = useWindowScroll({
|
|
3223
|
+
performance: ['debounce', 500], // "['debounce', 500]" or "['throttle', 500]"
|
|
3224
|
+
handle: (scrollData) => {
|
|
3225
|
+
// do something
|
|
3226
|
+
console.log(scrollData);
|
|
3227
|
+
}
|
|
3228
|
+
});
|
|
3229
|
+
};
|
|
3230
|
+
|
|
3231
|
+
*/
|
|
3232
|
+
|
|
3233
|
+
var useWindowScroll = function useWindowScroll(_ref) {
|
|
3234
|
+
var performance = _ref.performance,
|
|
3235
|
+
handle = _ref.handle;
|
|
3236
|
+
var windowScrollUpdate;
|
|
3237
|
+
var _performance = useWindowScroll_slicedToArray(performance, 2),
|
|
3238
|
+
performanceName = _performance[0],
|
|
3239
|
+
performanceLimit = _performance[1];
|
|
3240
|
+
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
|
|
3241
|
+
x: 0,
|
|
3242
|
+
y: 0
|
|
3243
|
+
}),
|
|
3244
|
+
_useState2 = useWindowScroll_slicedToArray(_useState, 2),
|
|
3245
|
+
scrollData = _useState2[0],
|
|
3246
|
+
setScrollData = _useState2[1];
|
|
3247
|
+
var eventHandlerScroll = function eventHandlerScroll(e) {
|
|
3248
|
+
var doc = document.documentElement;
|
|
3249
|
+
var left = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
3250
|
+
var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
3251
|
+
var res = {
|
|
3252
|
+
x: left,
|
|
3253
|
+
y: top
|
|
3254
|
+
};
|
|
3255
|
+
setScrollData(res);
|
|
3256
|
+
if (typeof handle === 'function') handle(res);
|
|
3257
|
+
};
|
|
3258
|
+
if (performanceName === 'debounce') windowScrollUpdate = _debounce(eventHandlerScroll, parseFloat(performanceLimit));
|
|
3259
|
+
if (performanceName === 'throttle') windowScrollUpdate = _throttle(eventHandlerScroll, parseFloat(performanceLimit));
|
|
3260
|
+
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3261
|
+
window.addEventListener('scroll', windowScrollUpdate);
|
|
3262
|
+
window.addEventListener('touchmove', windowScrollUpdate);
|
|
3263
|
+
return function () {
|
|
3264
|
+
window.removeEventListener('scroll', windowScrollUpdate);
|
|
3265
|
+
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
3266
|
+
};
|
|
3267
|
+
}, []);
|
|
3268
|
+
return [scrollData, windowScrollUpdate];
|
|
3269
|
+
};
|
|
3270
|
+
/* harmony default export */
|
|
3271
|
+
var hooks_useWindowScroll = useWindowScroll;
|
|
3272
|
+
; // CONCATENATED MODULE: ./src/index.tsx
|
|
3273
|
+
|
|
3274
|
+
// hooks
|
|
3275
|
+
})();
|
|
3276
|
+
|
|
3277
|
+
/******/
|
|
3278
|
+
return __webpack_exports__;
|
|
3279
|
+
/******/
|
|
3280
|
+
}()
|
|
3281
|
+
);
|
|
3282
|
+
});
|
|
355
3283
|
|
|
356
3284
|
/***/ }),
|
|
357
3285
|
|
|
@@ -377,13 +3305,16 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
|
377
3305
|
/******/ }
|
|
378
3306
|
/******/ // Create a new module (and put it into the cache)
|
|
379
3307
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
380
|
-
/******/
|
|
381
|
-
/******/
|
|
3308
|
+
/******/ id: moduleId,
|
|
3309
|
+
/******/ loaded: false,
|
|
382
3310
|
/******/ exports: {}
|
|
383
3311
|
/******/ };
|
|
384
3312
|
/******/
|
|
385
3313
|
/******/ // Execute the module function
|
|
386
|
-
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
3314
|
+
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
3315
|
+
/******/
|
|
3316
|
+
/******/ // Flag the module as loaded
|
|
3317
|
+
/******/ module.loaded = true;
|
|
387
3318
|
/******/
|
|
388
3319
|
/******/ // Return the exports of the module
|
|
389
3320
|
/******/ return module.exports;
|
|
@@ -430,6 +3361,15 @@ module.exports = __WEBPACK_EXTERNAL_MODULE__787__;
|
|
|
430
3361
|
/******/ };
|
|
431
3362
|
/******/ })();
|
|
432
3363
|
/******/
|
|
3364
|
+
/******/ /* webpack/runtime/node module decorator */
|
|
3365
|
+
/******/ (() => {
|
|
3366
|
+
/******/ __webpack_require__.nmd = (module) => {
|
|
3367
|
+
/******/ module.paths = [];
|
|
3368
|
+
/******/ if (!module.children) module.children = [];
|
|
3369
|
+
/******/ return module;
|
|
3370
|
+
/******/ };
|
|
3371
|
+
/******/ })();
|
|
3372
|
+
/******/
|
|
433
3373
|
/************************************************************************/
|
|
434
3374
|
var __webpack_exports__ = {};
|
|
435
3375
|
// This entry need to be wrapped in an IIFE because it need to be in strict mode.
|
|
@@ -519,9 +3459,8 @@ var AccordionItem = function AccordionItem(props) {
|
|
|
519
3459
|
}, children))));
|
|
520
3460
|
};
|
|
521
3461
|
/* harmony default export */ const src_AccordionItem = (AccordionItem);
|
|
522
|
-
// EXTERNAL MODULE:
|
|
523
|
-
var
|
|
524
|
-
var anim_default = /*#__PURE__*/__webpack_require__.n(anim);
|
|
3462
|
+
// EXTERNAL MODULE: ../Utils/dist/cjs/index.js
|
|
3463
|
+
var cjs = __webpack_require__(456);
|
|
525
3464
|
;// CONCATENATED MODULE: ./src/Accordion.tsx
|
|
526
3465
|
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); }
|
|
527
3466
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
@@ -597,7 +3536,7 @@ var Accordion = function Accordion(props) {
|
|
|
597
3536
|
//Hide other all sibling <dt> of the selected element
|
|
598
3537
|
Array.prototype.forEach.call($allContent, function (node) {
|
|
599
3538
|
if (node.clientHeight > 0) {
|
|
600
|
-
|
|
3539
|
+
(0,cjs.animateStyles)(node, {
|
|
601
3540
|
startHeight: node.scrollHeight,
|
|
602
3541
|
endHeight: 0,
|
|
603
3542
|
speed: animSpeed
|
|
@@ -619,7 +3558,7 @@ var Accordion = function Accordion(props) {
|
|
|
619
3558
|
(_reactDomEl$querySele2 = reactDomEl.querySelector('.custom-accordion-trigger')) === null || _reactDomEl$querySele2 === void 0 ? void 0 : _reactDomEl$querySele2.classList.remove('collapsed');
|
|
620
3559
|
reactDomEl.setAttribute('aria-expanded', true);
|
|
621
3560
|
// When the height of the element is 0, the value of `offsetHeight` and `clientHeight` will be 0
|
|
622
|
-
|
|
3561
|
+
(0,cjs.animateStyles)($curContent, {
|
|
623
3562
|
startHeight: 0,
|
|
624
3563
|
endHeight: $curContent.scrollHeight,
|
|
625
3564
|
speed: animSpeed
|
|
@@ -635,7 +3574,7 @@ var Accordion = function Accordion(props) {
|
|
|
635
3574
|
(_reactDomEl$querySele3 = reactDomEl.querySelector('.custom-accordion-trigger')) === null || _reactDomEl$querySele3 === void 0 ? void 0 : _reactDomEl$querySele3.classList.remove('active');
|
|
636
3575
|
(_reactDomEl$querySele4 = reactDomEl.querySelector('.custom-accordion-trigger')) === null || _reactDomEl$querySele4 === void 0 ? void 0 : _reactDomEl$querySele4.classList.add('collapsed');
|
|
637
3576
|
reactDomEl.setAttribute('aria-expanded', false);
|
|
638
|
-
|
|
3577
|
+
(0,cjs.animateStyles)($curContent, {
|
|
639
3578
|
startHeight: $curContent.scrollHeight,
|
|
640
3579
|
endHeight: 0,
|
|
641
3580
|
speed: animSpeed
|