funda-ui 4.2.445 → 4.2.611
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 +289 -3897
- package/BackToTop/index.d.ts +7 -1
- package/BackToTop/index.js +483 -3904
- package/CascadingSelect/index.d.ts +2 -2
- package/CascadingSelect/index.js +1074 -3837
- package/CascadingSelectE2E/index.d.ts +2 -2
- package/CascadingSelectE2E/index.js +1415 -3821
- package/Checkbox/index.d.ts +3 -2
- package/Checkbox/index.js +49 -3963
- package/ColorPicker/index.d.ts +1 -1
- package/ColorPicker/index.js +46 -3961
- package/Date/index.d.ts +1 -1
- package/Date/index.js +1934 -8657
- package/DigitalClock/index.d.ts +1 -1
- package/DigitalClock/index.js +156 -4014
- package/DropdownMenu/index.d.ts +2 -2
- package/DropdownMenu/index.js +521 -3943
- package/DynamicFields/index.d.ts +2 -2
- package/DynamicFields/index.js +47 -3962
- package/EventCalendar/index.d.ts +1 -1
- package/EventCalendar/index.js +636 -3720
- package/EventCalendarTimeline/index.d.ts +1 -1
- package/EventCalendarTimeline/index.js +2167 -8675
- package/File/index.d.ts +1 -1
- package/File/index.js +798 -3962
- package/HorizontalScrollContent/index.d.ts +1 -1
- package/HorizontalScrollContent/index.js +46 -3961
- package/Input/index.d.ts +1 -1
- package/Input/index.js +46 -3961
- package/LiveSearch/index.d.ts +1 -1
- package/LiveSearch/index.js +1583 -8220
- package/MasonryLayout/index.d.ts +1 -6
- package/MasonryLayout/index.js +246 -4025
- package/ModalDialog/index.d.ts +1 -6
- package/ModalDialog/index.js +601 -3699
- package/ModeSwitch/index.d.ts +1 -1
- package/MultilevelDropdownMenu/index.d.ts +1 -1
- package/MultilevelDropdownMenu/index.js +410 -3969
- package/MultipleCheckboxes/index.d.ts +2 -1
- package/MultipleCheckboxes/index.js +743 -3965
- package/MultipleSelect/index.d.ts +2 -1
- package/MultipleSelect/index.js +1426 -3912
- package/NativeSelect/index.d.ts +2 -2
- package/NativeSelect/index.js +740 -3941
- package/Pagination/index.d.ts +1 -1
- package/README.md +4 -0
- package/Radio/index.d.ts +3 -2
- package/Radio/index.js +425 -3982
- package/RangeSlider/index.d.ts +1 -1
- package/RangeSlider/index.js +666 -8496
- package/RootPortal/index.d.ts +1 -1
- package/ScrollReveal/index.d.ts +1 -6
- package/ScrollReveal/index.js +46 -3961
- package/Scrollbar/index.d.ts +1 -6
- package/Scrollbar/index.js +246 -4025
- package/SearchBar/index.d.ts +1 -1
- package/SearchBar/index.js +46 -3961
- package/Select/index.css +9 -0
- package/Select/index.d.ts +4 -2
- package/Select/index.js +2524 -3767
- package/ShowMoreLess/index.d.ts +6 -5
- package/ShowMoreLess/index.js +93 -4006
- package/Switch/index.d.ts +3 -2
- package/Switch/index.js +49 -3963
- package/Table/index.js +47 -3961
- package/Tabs/index.js +47 -3961
- package/TagInput/index.d.ts +1 -1
- package/TagInput/index.js +407 -3987
- package/Textarea/index.d.ts +1 -1
- package/Textarea/index.js +260 -3882
- package/Toast/index.d.ts +1 -1
- package/Toast/index.js +50 -3964
- package/Tooltip/index.d.ts +1 -6
- package/Tooltip/index.js +519 -3943
- package/Tree/index.d.ts +1 -1
- package/Tree/index.js +584 -3970
- package/Utils/anim.d.ts +11 -0
- package/Utils/anim.js +400 -0
- package/Utils/bodyScrollLock.d.ts +8 -0
- package/Utils/bodyScrollLock.js +311 -0
- package/Utils/buffer.d.ts +67 -0
- package/Utils/buffer.js +343 -0
- package/Utils/convert.d.ts +25 -0
- package/Utils/convert.js +109 -0
- package/Utils/date.d.ts +197 -0
- package/Utils/date.js +485 -0
- package/Utils/dom.d.ts +13 -0
- package/Utils/dom.js +215 -0
- package/Utils/easing.d.ts +29 -0
- package/Utils/easing.js +221 -0
- package/Utils/extract.d.ts +28 -0
- package/Utils/extract.js +130 -0
- package/Utils/getElementProperty.d.ts +52 -0
- package/Utils/getElementProperty.js +189 -0
- package/Utils/guid.d.ts +7 -0
- package/Utils/guid.js +67 -0
- package/Utils/initDefaultOptions.d.ts +21 -0
- package/Utils/initDefaultOptions.js +131 -0
- package/Utils/inputsCalculation.d.ts +10 -0
- package/Utils/inputsCalculation.js +161 -0
- package/Utils/object.d.ts +18 -0
- package/Utils/object.js +120 -0
- package/Utils/performance.d.ts +3 -0
- package/Utils/performance.js +94 -0
- package/Utils/tree.d.ts +40 -0
- package/Utils/tree.js +195 -0
- package/Utils/useAutosizeTextArea.d.ts +7 -0
- package/Utils/useAutosizeTextArea.js +192 -0
- package/Utils/useClickOutside.d.ts +33 -0
- package/Utils/useClickOutside.js +166 -0
- package/Utils/useComId.d.ts +6 -0
- package/Utils/useComId.js +114 -0
- package/Utils/useDebounce.d.ts +20 -0
- package/Utils/useDebounce.js +138 -0
- package/Utils/useDraggable.d.ts +62 -0
- package/Utils/useDraggable.js +348 -0
- package/Utils/useInterval.d.ts +5 -0
- package/Utils/useInterval.js +168 -0
- package/Utils/useKeyPress.d.ts +44 -0
- package/Utils/useKeyPress.js +200 -0
- package/Utils/useThrottle.d.ts +2 -0
- package/Utils/useThrottle.js +136 -0
- package/Utils/useWindowScroll.d.ts +12 -0
- package/Utils/useWindowScroll.js +217 -0
- package/Utils/viewport.d.ts +7 -0
- package/Utils/viewport.js +64 -0
- package/lib/cjs/Accordion/index.js +289 -3897
- package/lib/cjs/BackToTop/index.d.ts +7 -1
- package/lib/cjs/BackToTop/index.js +483 -3904
- package/lib/cjs/CascadingSelect/index.d.ts +2 -2
- package/lib/cjs/CascadingSelect/index.js +1074 -3837
- package/lib/cjs/CascadingSelectE2E/index.d.ts +2 -2
- package/lib/cjs/CascadingSelectE2E/index.js +1415 -3821
- package/lib/cjs/Checkbox/index.d.ts +3 -2
- package/lib/cjs/Checkbox/index.js +49 -3963
- package/lib/cjs/ColorPicker/index.d.ts +1 -1
- package/lib/cjs/ColorPicker/index.js +46 -3961
- package/lib/cjs/Date/index.d.ts +1 -1
- package/lib/cjs/Date/index.js +1934 -8657
- package/lib/cjs/DigitalClock/index.d.ts +1 -1
- package/lib/cjs/DigitalClock/index.js +156 -4014
- package/lib/cjs/DropdownMenu/index.d.ts +2 -2
- package/lib/cjs/DropdownMenu/index.js +521 -3943
- package/lib/cjs/DynamicFields/index.d.ts +2 -2
- package/lib/cjs/DynamicFields/index.js +47 -3962
- package/lib/cjs/EventCalendar/index.d.ts +1 -1
- package/lib/cjs/EventCalendar/index.js +636 -3720
- package/lib/cjs/EventCalendarTimeline/index.d.ts +1 -1
- package/lib/cjs/EventCalendarTimeline/index.js +2167 -8675
- package/lib/cjs/File/index.d.ts +1 -1
- package/lib/cjs/File/index.js +798 -3962
- package/lib/cjs/HorizontalScrollContent/index.d.ts +1 -1
- package/lib/cjs/HorizontalScrollContent/index.js +46 -3961
- package/lib/cjs/Input/index.d.ts +1 -1
- package/lib/cjs/Input/index.js +46 -3961
- package/lib/cjs/LiveSearch/index.d.ts +1 -1
- package/lib/cjs/LiveSearch/index.js +1583 -8220
- package/lib/cjs/MasonryLayout/index.d.ts +1 -6
- package/lib/cjs/MasonryLayout/index.js +246 -4025
- package/lib/cjs/ModalDialog/index.d.ts +1 -6
- package/lib/cjs/ModalDialog/index.js +601 -3699
- package/lib/cjs/ModeSwitch/index.d.ts +1 -1
- package/lib/cjs/MultilevelDropdownMenu/index.d.ts +1 -1
- package/lib/cjs/MultilevelDropdownMenu/index.js +410 -3969
- package/lib/cjs/MultipleCheckboxes/index.d.ts +2 -1
- package/lib/cjs/MultipleCheckboxes/index.js +743 -3965
- package/lib/cjs/MultipleSelect/index.d.ts +2 -1
- package/lib/cjs/MultipleSelect/index.js +1426 -3912
- package/lib/cjs/NativeSelect/index.d.ts +2 -2
- package/lib/cjs/NativeSelect/index.js +740 -3941
- package/lib/cjs/Pagination/index.d.ts +1 -1
- package/lib/cjs/Radio/index.d.ts +3 -2
- package/lib/cjs/Radio/index.js +425 -3982
- package/lib/cjs/RangeSlider/index.d.ts +1 -1
- package/lib/cjs/RangeSlider/index.js +666 -8496
- package/lib/cjs/RootPortal/index.d.ts +1 -1
- package/lib/cjs/ScrollReveal/index.d.ts +1 -6
- package/lib/cjs/ScrollReveal/index.js +46 -3961
- package/lib/cjs/Scrollbar/index.d.ts +1 -6
- package/lib/cjs/Scrollbar/index.js +246 -4025
- package/lib/cjs/SearchBar/index.d.ts +1 -1
- package/lib/cjs/SearchBar/index.js +46 -3961
- package/lib/cjs/Select/index.d.ts +4 -2
- package/lib/cjs/Select/index.js +2524 -3767
- package/lib/cjs/ShowMoreLess/index.d.ts +6 -5
- package/lib/cjs/ShowMoreLess/index.js +93 -4006
- package/lib/cjs/Switch/index.d.ts +3 -2
- package/lib/cjs/Switch/index.js +49 -3963
- package/lib/cjs/Table/index.js +47 -3961
- package/lib/cjs/Tabs/index.js +47 -3961
- package/lib/cjs/TagInput/index.d.ts +1 -1
- package/lib/cjs/TagInput/index.js +407 -3987
- package/lib/cjs/Textarea/index.d.ts +1 -1
- package/lib/cjs/Textarea/index.js +260 -3882
- package/lib/cjs/Toast/index.d.ts +1 -1
- package/lib/cjs/Toast/index.js +50 -3964
- package/lib/cjs/Tooltip/index.d.ts +1 -6
- package/lib/cjs/Tooltip/index.js +519 -3943
- package/lib/cjs/Tree/index.d.ts +1 -1
- package/lib/cjs/Tree/index.js +584 -3970
- package/lib/cjs/Utils/anim.d.ts +11 -0
- package/lib/cjs/Utils/anim.js +400 -0
- package/lib/cjs/Utils/bodyScrollLock.d.ts +8 -0
- package/lib/cjs/Utils/bodyScrollLock.js +311 -0
- package/lib/cjs/Utils/buffer.d.ts +67 -0
- package/lib/cjs/Utils/buffer.js +343 -0
- package/lib/cjs/Utils/convert.d.ts +25 -0
- package/lib/cjs/Utils/convert.js +109 -0
- package/lib/cjs/Utils/date.d.ts +197 -0
- package/lib/cjs/Utils/date.js +485 -0
- package/lib/cjs/Utils/dom.d.ts +13 -0
- package/lib/cjs/Utils/dom.js +215 -0
- package/lib/cjs/Utils/easing.d.ts +29 -0
- package/lib/cjs/Utils/easing.js +221 -0
- package/lib/cjs/Utils/extract.d.ts +28 -0
- package/lib/cjs/Utils/extract.js +130 -0
- package/lib/cjs/Utils/getElementProperty.d.ts +52 -0
- package/lib/cjs/Utils/getElementProperty.js +189 -0
- package/lib/cjs/Utils/guid.d.ts +7 -0
- package/lib/cjs/Utils/guid.js +67 -0
- package/lib/cjs/Utils/initDefaultOptions.d.ts +21 -0
- package/lib/cjs/Utils/initDefaultOptions.js +131 -0
- package/lib/cjs/Utils/inputsCalculation.d.ts +10 -0
- package/lib/cjs/Utils/inputsCalculation.js +161 -0
- package/lib/cjs/Utils/object.d.ts +18 -0
- package/lib/cjs/Utils/object.js +120 -0
- package/lib/cjs/Utils/performance.d.ts +3 -0
- package/lib/cjs/Utils/performance.js +94 -0
- package/lib/cjs/Utils/tree.d.ts +40 -0
- package/lib/cjs/Utils/tree.js +195 -0
- package/lib/cjs/Utils/useAutosizeTextArea.d.ts +7 -0
- package/lib/cjs/Utils/useAutosizeTextArea.js +192 -0
- package/lib/cjs/Utils/useClickOutside.d.ts +33 -0
- package/lib/cjs/Utils/useClickOutside.js +166 -0
- package/lib/cjs/Utils/useComId.d.ts +6 -0
- package/lib/cjs/Utils/useComId.js +114 -0
- package/lib/cjs/Utils/useDebounce.d.ts +20 -0
- package/lib/cjs/Utils/useDebounce.js +138 -0
- package/lib/cjs/Utils/useDraggable.d.ts +62 -0
- package/lib/cjs/Utils/useDraggable.js +348 -0
- package/lib/cjs/Utils/useInterval.d.ts +5 -0
- package/lib/cjs/Utils/useInterval.js +168 -0
- package/lib/cjs/Utils/useKeyPress.d.ts +44 -0
- package/lib/cjs/Utils/useKeyPress.js +200 -0
- package/lib/cjs/Utils/useThrottle.d.ts +2 -0
- package/lib/cjs/Utils/useThrottle.js +136 -0
- package/lib/cjs/Utils/useWindowScroll.d.ts +12 -0
- package/lib/cjs/Utils/useWindowScroll.js +217 -0
- package/lib/cjs/Utils/viewport.d.ts +7 -0
- package/lib/cjs/Utils/viewport.js +64 -0
- package/lib/css/Select/index.css +9 -0
- package/lib/esm/Accordion/Accordion.tsx +4 -11
- package/lib/esm/Accordion/AccordionItem.tsx +1 -1
- package/lib/esm/BackToTop/index.tsx +4 -6
- package/lib/esm/CascadingSelect/Group.tsx +2 -2
- package/lib/esm/CascadingSelect/index.tsx +12 -7
- package/lib/esm/CascadingSelectE2E/Group.tsx +2 -2
- package/lib/esm/CascadingSelectE2E/index.tsx +15 -8
- package/lib/esm/Checkbox/index.tsx +6 -8
- package/lib/esm/ColorPicker/index.tsx +4 -4
- package/lib/esm/Date/Calendar.tsx +2 -2
- package/lib/esm/Date/index.tsx +9 -7
- package/lib/esm/DigitalClock/index.tsx +3 -5
- package/lib/esm/DropdownMenu/Option.tsx +1 -1
- package/lib/esm/DropdownMenu/index.tsx +6 -5
- package/lib/esm/DynamicFields/index.tsx +7 -6
- package/lib/esm/EventCalendar/index.tsx +1 -1
- package/lib/esm/EventCalendarTimeline/index.tsx +5 -5
- package/lib/esm/File/index.tsx +4 -3
- package/lib/esm/HorizontalScrollContent/index.tsx +5 -4
- package/lib/esm/Input/index.tsx +4 -4
- package/lib/esm/LiveSearch/index.tsx +10 -9
- package/lib/esm/MasonryLayout/index.tsx +4 -10
- package/lib/esm/ModalDialog/index.tsx +9 -24
- package/lib/esm/ModeSwitch/index.tsx +1 -1
- package/lib/esm/MultilevelDropdownMenu/ItemList.tsx +3 -4
- package/lib/esm/MultilevelDropdownMenu/index.tsx +4 -4
- package/lib/esm/MultipleCheckboxes/index.tsx +17 -9
- package/lib/esm/MultipleSelect/ItemList.tsx +3 -2
- package/lib/esm/MultipleSelect/index.tsx +36 -11
- package/lib/esm/MultipleSelect/multiple-select-utils/func.ts +12 -0
- package/lib/esm/NativeSelect/index.tsx +11 -6
- package/lib/esm/Pagination/index.tsx +1 -1
- package/lib/esm/Radio/index.tsx +11 -8
- package/lib/esm/RangeSlider/index.tsx +5 -4
- package/lib/esm/RootPortal/index.tsx +1 -1
- package/lib/esm/ScrollReveal/index.tsx +2 -11
- package/lib/esm/Scrollbar/index.tsx +4 -9
- package/lib/esm/SearchBar/index.tsx +3 -4
- package/lib/esm/Select/index.scss +9 -1
- package/lib/esm/Select/index.tsx +53 -26
- package/lib/esm/Select/select-utils/func.ts +30 -0
- package/lib/esm/ShowMoreLess/index.tsx +3 -12
- package/lib/esm/Switch/index.tsx +7 -6
- package/lib/esm/Table/Table.tsx +2 -4
- package/lib/esm/Table/TableBody.tsx +1 -1
- package/lib/esm/Table/TableCaption.tsx +1 -1
- package/lib/esm/Table/TableCell.tsx +1 -1
- package/lib/esm/Table/TableColgroup.tsx +1 -1
- package/lib/esm/Table/TableContext.tsx +1 -1
- package/lib/esm/Table/TableFoot.tsx +1 -1
- package/lib/esm/Table/TableHead.tsx +1 -1
- package/lib/esm/Table/TableRow.tsx +1 -1
- package/lib/esm/Table/index.tsx +0 -1
- package/lib/esm/Table/table-utils/DragHandleSprite.tsx +1 -1
- package/lib/esm/Table/table-utils/SortSprite.tsx +1 -1
- package/lib/esm/Table/table-utils/TableFilter.tsx +1 -1
- package/lib/esm/Table/table-utils/ToggleSelection.tsx +1 -1
- package/lib/esm/Table/table-utils/hooks/useTableDraggable.tsx +1 -1
- package/lib/esm/Table/table-utils/hooks/useTableKeyPress.tsx +1 -1
- package/lib/esm/Table/table-utils/hooks/useTableResponsive.tsx +1 -1
- package/lib/esm/Table/table-utils/hooks/useTableSort.tsx +1 -1
- package/lib/esm/Tabs/TabList.tsx +1 -8
- package/lib/esm/Tabs/TabPanel.tsx +1 -1
- package/lib/esm/Tabs/Tabs.tsx +2 -5
- package/lib/esm/TagInput/index.tsx +7 -4
- package/lib/esm/Textarea/index.tsx +4 -5
- package/lib/esm/Toast/Item.tsx +1 -1
- package/lib/esm/Toast/index.tsx +3 -5
- package/lib/esm/Tooltip/index.tsx +5 -11
- package/lib/esm/Tree/TreeList.tsx +4 -3
- package/lib/esm/Tree/index.tsx +4 -5
- package/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +1 -1
- package/lib/esm/Utils/hooks/useClickOutside.tsx +1 -1
- package/lib/esm/Utils/hooks/useDraggable.tsx +2 -2
- package/lib/esm/Utils/hooks/useInterval.tsx +44 -13
- package/lib/esm/Utils/hooks/useKeyPress.tsx +1 -1
- package/lib/esm/Utils/hooks/useWindowScroll.tsx +3 -3
- package/lib/esm/Utils/libs/anim.ts +1 -1
- package/lib/esm/Utils/plugins/{BSL/bodyScrollLock.ts → bodyScrollLock.ts} +1 -1
- package/package.json +1 -1
- package/Utils/index.d.ts +0 -26
- package/Utils/index.js +0 -2946
- package/lib/cjs/Utils/index.d.ts +0 -26
- package/lib/cjs/Utils/index.js +0 -2946
- package/lib/esm/Utils/index.tsx +0 -319
- /package/lib/esm/Utils/libs/{get-element-property.ts → getElementProperty.ts} +0 -0
- /package/lib/esm/Utils/libs/{init-default-options.ts → initDefaultOptions.ts} +0 -0
- /package/lib/esm/Utils/libs/{inputs-calculation.ts → inputsCalculation.ts} +0 -0
package/Accordion/index.js
CHANGED
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
return /******/ (() => { // webpackBootstrap
|
|
12
12
|
/******/ var __webpack_modules__ = ({
|
|
13
13
|
|
|
14
|
-
/***/
|
|
14
|
+
/***/ 993:
|
|
15
15
|
/***/ (function(module, exports, __webpack_require__) {
|
|
16
16
|
|
|
17
17
|
/* module decorator */ module = __webpack_require__.nmd(module);
|
|
18
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
19
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
20
|
-
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory(
|
|
20
|
+
if (( false ? 0 : _typeof2(exports)) === 'object' && ( false ? 0 : _typeof2(module)) === 'object') module.exports = factory();else if (true) !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
|
|
21
21
|
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
|
|
22
22
|
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
|
|
23
23
|
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else {}
|
|
24
|
-
})(this, function (
|
|
24
|
+
})(this, function () {
|
|
25
25
|
return (/******/function () {
|
|
26
26
|
// webpackBootstrap
|
|
27
27
|
/******/
|
|
@@ -29,8 +29,261 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
29
29
|
|
|
30
30
|
/******/
|
|
31
31
|
var __webpack_modules__ = {
|
|
32
|
-
/***/
|
|
33
|
-
|
|
32
|
+
/***/357: /***/function _(__unused_webpack_module, __webpack_exports__, __nested_webpack_require_1061__) {
|
|
33
|
+
/* harmony export */__nested_webpack_require_1061__.d(__webpack_exports__, {
|
|
34
|
+
/* harmony export */"easeInOutQuad": function easeInOutQuad() {
|
|
35
|
+
return (/* binding */_easeInOutQuad
|
|
36
|
+
);
|
|
37
|
+
},
|
|
38
|
+
/* harmony export */"easeInQuad": function easeInQuad() {
|
|
39
|
+
return (/* binding */_easeInQuad
|
|
40
|
+
);
|
|
41
|
+
},
|
|
42
|
+
/* harmony export */"easeLinear": function easeLinear() {
|
|
43
|
+
return (/* binding */_easeLinear
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
/* harmony export */"easeOutQuad": function easeOutQuad() {
|
|
47
|
+
return (/* binding */_easeOutQuad
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
/* harmony export */
|
|
51
|
+
});
|
|
52
|
+
/* unused harmony exports easeInSine, easeOutSine, easeInOutSine, easeInExpo, easeOutExpo, easeInOutExpo, easeInCirc, easeOutCirc, easeInOutCirc, easeInCubic, easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, easeInQuint, easeOutQuint, easeInOutQuint, easeInElastic, easeOutElastic, easeInOutElastic, easeInBack, easeOutBack, easeInOutBack */
|
|
53
|
+
/*
|
|
54
|
+
* All easing functions
|
|
55
|
+
* @link: https://easings.net
|
|
56
|
+
* @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.)
|
|
57
|
+
* @param {number} b - beginning value (The starting point of the animation. Usually it's a static value, you can start at 0 for example.)
|
|
58
|
+
* @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.)
|
|
59
|
+
* @param {number} d - duration (Amount of time the animation will take. Usually a static value aswell.)
|
|
60
|
+
* @return {number}
|
|
61
|
+
*/
|
|
62
|
+
function _easeLinear(t, b, c, d) {
|
|
63
|
+
return c * t / d + b;
|
|
64
|
+
}
|
|
65
|
+
function _easeInQuad(t, b, c, d) {
|
|
66
|
+
return c * (t /= d) * t + b;
|
|
67
|
+
}
|
|
68
|
+
function _easeOutQuad(t, b, c, d) {
|
|
69
|
+
return -c * (t /= d) * (t - 2) + b;
|
|
70
|
+
}
|
|
71
|
+
function _easeInOutQuad(t, b, c, d) {
|
|
72
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t + b;
|
|
73
|
+
return -c / 2 * (--t * (t - 2) - 1) + b;
|
|
74
|
+
}
|
|
75
|
+
function easeInSine(t, b, c, d) {
|
|
76
|
+
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
|
|
77
|
+
}
|
|
78
|
+
function easeOutSine(t, b, c, d) {
|
|
79
|
+
return c * Math.sin(t / d * (Math.PI / 2)) + b;
|
|
80
|
+
}
|
|
81
|
+
function easeInOutSine(t, b, c, d) {
|
|
82
|
+
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
|
|
83
|
+
}
|
|
84
|
+
function easeInExpo(t, b, c, d) {
|
|
85
|
+
return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
|
|
86
|
+
}
|
|
87
|
+
function easeOutExpo(t, b, c, d) {
|
|
88
|
+
return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
|
|
89
|
+
}
|
|
90
|
+
function easeInOutExpo(t, b, c, d) {
|
|
91
|
+
if (t == 0) return b;
|
|
92
|
+
if (t == d) return b + c;
|
|
93
|
+
if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
94
|
+
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
95
|
+
}
|
|
96
|
+
function easeInCirc(t, b, c, d) {
|
|
97
|
+
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
|
|
98
|
+
}
|
|
99
|
+
function easeOutCirc(t, b, c, d) {
|
|
100
|
+
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
|
|
101
|
+
}
|
|
102
|
+
function easeInOutCirc(t, b, c, d) {
|
|
103
|
+
if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
|
|
104
|
+
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
|
|
105
|
+
}
|
|
106
|
+
function easeInCubic(t, b, c, d) {
|
|
107
|
+
return c * (t /= d) * t * t + b;
|
|
108
|
+
}
|
|
109
|
+
function easeOutCubic(t, b, c, d) {
|
|
110
|
+
return c * ((t = t / d - 1) * t * t + 1) + b;
|
|
111
|
+
}
|
|
112
|
+
function easeInOutCubic(t, b, c, d) {
|
|
113
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
|
|
114
|
+
return c / 2 * ((t -= 2) * t * t + 2) + b;
|
|
115
|
+
}
|
|
116
|
+
function easeInQuart(t, b, c, d) {
|
|
117
|
+
return c * (t /= d) * t * t * t + b;
|
|
118
|
+
}
|
|
119
|
+
function easeOutQuart(t, b, c, d) {
|
|
120
|
+
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
|
|
121
|
+
}
|
|
122
|
+
function easeInOutQuart(t, b, c, d) {
|
|
123
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
|
|
124
|
+
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
|
|
125
|
+
}
|
|
126
|
+
function easeInQuint(t, b, c, d) {
|
|
127
|
+
return c * (t /= d) * t * t * t * t + b;
|
|
128
|
+
}
|
|
129
|
+
function easeOutQuint(t, b, c, d) {
|
|
130
|
+
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
|
|
131
|
+
}
|
|
132
|
+
function easeInOutQuint(t, b, c, d) {
|
|
133
|
+
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
|
|
134
|
+
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
|
|
135
|
+
}
|
|
136
|
+
function easeInElastic(t, b, c, d) {
|
|
137
|
+
var s = 1.70158;
|
|
138
|
+
var p = 0;
|
|
139
|
+
var a = c;
|
|
140
|
+
if (t == 0) return b;
|
|
141
|
+
if ((t /= d) == 1) return b + c;
|
|
142
|
+
if (!p) p = d * .3;
|
|
143
|
+
if (a < Math.abs(c)) {
|
|
144
|
+
a = c;
|
|
145
|
+
var s = p / 4;
|
|
146
|
+
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
147
|
+
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
148
|
+
}
|
|
149
|
+
function easeOutElastic(t, b, c, d) {
|
|
150
|
+
var s = 1.70158;
|
|
151
|
+
var p = 0;
|
|
152
|
+
var a = c;
|
|
153
|
+
if (t == 0) return b;
|
|
154
|
+
if ((t /= d) == 1) return b + c;
|
|
155
|
+
if (!p) p = d * .3;
|
|
156
|
+
if (a < Math.abs(c)) {
|
|
157
|
+
a = c;
|
|
158
|
+
var s = p / 4;
|
|
159
|
+
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
160
|
+
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
|
|
161
|
+
}
|
|
162
|
+
function easeInOutElastic(t, b, c, d) {
|
|
163
|
+
var s = 1.70158;
|
|
164
|
+
var p = 0;
|
|
165
|
+
var a = c;
|
|
166
|
+
if (t == 0) return b;
|
|
167
|
+
if ((t /= d / 2) == 2) return b + c;
|
|
168
|
+
if (!p) p = d * (.3 * 1.5);
|
|
169
|
+
if (a < Math.abs(c)) {
|
|
170
|
+
a = c;
|
|
171
|
+
var s = p / 4;
|
|
172
|
+
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
173
|
+
if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
174
|
+
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
|
|
175
|
+
}
|
|
176
|
+
function easeInBack(t, b, c, d) {
|
|
177
|
+
var s = 1.70158;
|
|
178
|
+
if (s == undefined) s = 1.70158;
|
|
179
|
+
return c * (t /= d) * t * ((s + 1) * t - s) + b;
|
|
180
|
+
}
|
|
181
|
+
function easeOutBack(t, b, c, d) {
|
|
182
|
+
var s = 1.70158;
|
|
183
|
+
if (s == undefined) s = 1.70158;
|
|
184
|
+
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
|
|
185
|
+
}
|
|
186
|
+
function easeInOutBack(t, b, c, d) {
|
|
187
|
+
var s = 1.70158;
|
|
188
|
+
if (s == undefined) s = 1.70158;
|
|
189
|
+
if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
|
|
190
|
+
return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/***/
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
/***/65: /***/function _(__unused_webpack_module, __webpack_exports__, __nested_webpack_require_8432__) {
|
|
197
|
+
/* harmony export */__nested_webpack_require_8432__.d(__webpack_exports__, {
|
|
198
|
+
/* harmony export */"setDefaultOptions": function setDefaultOptions() {
|
|
199
|
+
return (/* binding */_setDefaultOptions
|
|
200
|
+
);
|
|
201
|
+
}
|
|
202
|
+
/* harmony export */
|
|
203
|
+
});
|
|
204
|
+
/* unused harmony exports isJSON, isValidNumeric */
|
|
205
|
+
function _typeof(obj) {
|
|
206
|
+
"@babel/helpers - typeof";
|
|
207
|
+
|
|
208
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
209
|
+
return typeof obj;
|
|
210
|
+
} : function (obj) {
|
|
211
|
+
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
212
|
+
}, _typeof(obj);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Set a default JSON format configuration
|
|
216
|
+
*
|
|
217
|
+
* @param {*} props - Set some default keys and values.
|
|
218
|
+
* @param {*} options - A JSON variable passed in from outside, including key and value.
|
|
219
|
+
* @return {JSON} - Merge the new and old values.
|
|
220
|
+
*/
|
|
221
|
+
function _setDefaultOptions(props, options) {
|
|
222
|
+
if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
|
|
223
|
+
//Set a default configuration
|
|
224
|
+
if (isJSON(props)) {
|
|
225
|
+
var defaultConfigValues = Object.values(props);
|
|
226
|
+
Object.keys(props).forEach(function (prop, index) {
|
|
227
|
+
// Well-formed string type
|
|
228
|
+
Object.keys(options).forEach(function (prop2, index2) {
|
|
229
|
+
if (prop2 === prop) {
|
|
230
|
+
var _v = options[prop2];
|
|
231
|
+
if (_v == 'true') _v = true;
|
|
232
|
+
if (_v == 'false') _v = false;
|
|
233
|
+
if (isValidNumeric(_v)) _v = parseFloat(_v);
|
|
234
|
+
if (isJSON(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
|
|
235
|
+
options[prop2] = _v;
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
//
|
|
240
|
+
if (_typeof(options[prop]) === ( true ? "undefined" : 0) || options[prop] === null) options[prop] = defaultConfigValues[index];
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return options;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Check if a string is a valid number
|
|
248
|
+
* @param {*} str
|
|
249
|
+
* @returns
|
|
250
|
+
*/
|
|
251
|
+
function isValidNumeric(str) {
|
|
252
|
+
if (typeof str != "string") return false; // we only process strings!
|
|
253
|
+
if (!isNaN(Number(str)) &&
|
|
254
|
+
// use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)
|
|
255
|
+
!isNaN(parseFloat(str)) // ensure strings of whitespace fail
|
|
256
|
+
) {
|
|
257
|
+
return true;
|
|
258
|
+
} else {
|
|
259
|
+
return false;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Determine whether it is in JSON format
|
|
265
|
+
* @param {*} str
|
|
266
|
+
* @returns
|
|
267
|
+
*/
|
|
268
|
+
function isJSON(str) {
|
|
269
|
+
if (typeof str === 'string' && str.length > 0) {
|
|
270
|
+
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
271
|
+
return false;
|
|
272
|
+
} else {
|
|
273
|
+
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
274
|
+
return true;
|
|
275
|
+
} else {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
} else {
|
|
280
|
+
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
281
|
+
return true;
|
|
282
|
+
} else {
|
|
283
|
+
return false;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
34
287
|
|
|
35
288
|
/***/
|
|
36
289
|
}
|
|
@@ -44,7 +297,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
44
297
|
/******/
|
|
45
298
|
/******/ // The require function
|
|
46
299
|
/******/
|
|
47
|
-
function
|
|
300
|
+
function __nested_webpack_require_12605__(moduleId) {
|
|
48
301
|
/******/ // Check if module is in cache
|
|
49
302
|
/******/var cachedModule = __webpack_module_cache__[moduleId];
|
|
50
303
|
/******/
|
|
@@ -63,7 +316,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
63
316
|
/******/
|
|
64
317
|
/******/ // Execute the module function
|
|
65
318
|
/******/
|
|
66
|
-
__webpack_modules__[moduleId](module, module.exports,
|
|
319
|
+
__webpack_modules__[moduleId](module, module.exports, __nested_webpack_require_12605__);
|
|
67
320
|
/******/
|
|
68
321
|
/******/ // Return the exports of the module
|
|
69
322
|
/******/
|
|
@@ -76,9 +329,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
76
329
|
/******/
|
|
77
330
|
(function () {
|
|
78
331
|
/******/ // define getter functions for harmony exports
|
|
79
|
-
/******/
|
|
332
|
+
/******/__nested_webpack_require_12605__.d = function (exports, definition) {
|
|
80
333
|
/******/for (var key in definition) {
|
|
81
|
-
/******/if (
|
|
334
|
+
/******/if (__nested_webpack_require_12605__.o(definition, key) && !__nested_webpack_require_12605__.o(exports, key)) {
|
|
82
335
|
/******/Object.defineProperty(exports, key, {
|
|
83
336
|
enumerable: true,
|
|
84
337
|
get: definition[key]
|
|
@@ -95,7 +348,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
95
348
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
96
349
|
/******/
|
|
97
350
|
(function () {
|
|
98
|
-
/******/
|
|
351
|
+
/******/__nested_webpack_require_12605__.o = function (obj, prop) {
|
|
99
352
|
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
100
353
|
};
|
|
101
354
|
/******/
|
|
@@ -105,7 +358,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
105
358
|
/******/
|
|
106
359
|
(function () {
|
|
107
360
|
/******/ // define __esModule on exports
|
|
108
|
-
/******/
|
|
361
|
+
/******/__nested_webpack_require_12605__.r = function (exports) {
|
|
109
362
|
/******/if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
110
363
|
/******/Object.defineProperty(exports, Symbol.toStringTag, {
|
|
111
364
|
value: 'Module'
|
|
@@ -125,664 +378,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
125
378
|
var __webpack_exports__ = {};
|
|
126
379
|
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
127
380
|
(function () {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
"clearAllBodyScrollLocks": function clearAllBodyScrollLocks() {
|
|
170
|
-
return (/* reexport */_clearAllBodyScrollLocks
|
|
171
|
-
);
|
|
172
|
-
},
|
|
173
|
-
"convertArrToValByBraces": function convertArrToValByBraces() {
|
|
174
|
-
return (/* reexport */_convertArrToValByBraces
|
|
175
|
-
);
|
|
176
|
-
},
|
|
177
|
-
"convertArrToValByBrackets": function convertArrToValByBrackets() {
|
|
178
|
-
return (/* reexport */_convertArrToValByBrackets
|
|
179
|
-
);
|
|
180
|
-
},
|
|
181
|
-
"convertStringByCommaToValByBraces": function convertStringByCommaToValByBraces() {
|
|
182
|
-
return (/* reexport */_convertStringByCommaToValByBraces
|
|
183
|
-
);
|
|
184
|
-
},
|
|
185
|
-
"convertStringByCommaToValByBrackets": function convertStringByCommaToValByBrackets() {
|
|
186
|
-
return (/* reexport */_convertStringByCommaToValByBrackets
|
|
187
|
-
);
|
|
188
|
-
},
|
|
189
|
-
"convertTree": function convertTree() {
|
|
190
|
-
return (/* reexport */_convertTree
|
|
191
|
-
);
|
|
192
|
-
},
|
|
193
|
-
"dateFormat": function dateFormat() {
|
|
194
|
-
return (/* reexport */_dateFormat
|
|
195
|
-
);
|
|
196
|
-
},
|
|
197
|
-
"debounce": function debounce() {
|
|
198
|
-
return (/* reexport */_debounce
|
|
199
|
-
);
|
|
200
|
-
},
|
|
201
|
-
"decodeBase64Str": function decodeBase64Str() {
|
|
202
|
-
return (/* reexport */_decodeBase64Str
|
|
203
|
-
);
|
|
204
|
-
},
|
|
205
|
-
"deepClone": function deepClone() {
|
|
206
|
-
return (/* reexport */_deepClone
|
|
207
|
-
);
|
|
208
|
-
},
|
|
209
|
-
"disableBodyScroll": function disableBodyScroll() {
|
|
210
|
-
return (/* reexport */_disableBodyScroll
|
|
211
|
-
);
|
|
212
|
-
},
|
|
213
|
-
"easeInBack": function easeInBack() {
|
|
214
|
-
return (/* reexport */_easeInBack
|
|
215
|
-
);
|
|
216
|
-
},
|
|
217
|
-
"easeInCirc": function easeInCirc() {
|
|
218
|
-
return (/* reexport */_easeInCirc
|
|
219
|
-
);
|
|
220
|
-
},
|
|
221
|
-
"easeInCubic": function easeInCubic() {
|
|
222
|
-
return (/* reexport */_easeInCubic
|
|
223
|
-
);
|
|
224
|
-
},
|
|
225
|
-
"easeInElastic": function easeInElastic() {
|
|
226
|
-
return (/* reexport */_easeInElastic
|
|
227
|
-
);
|
|
228
|
-
},
|
|
229
|
-
"easeInExpo": function easeInExpo() {
|
|
230
|
-
return (/* reexport */_easeInExpo
|
|
231
|
-
);
|
|
232
|
-
},
|
|
233
|
-
"easeInOutBack": function easeInOutBack() {
|
|
234
|
-
return (/* reexport */_easeInOutBack
|
|
235
|
-
);
|
|
236
|
-
},
|
|
237
|
-
"easeInOutCirc": function easeInOutCirc() {
|
|
238
|
-
return (/* reexport */_easeInOutCirc
|
|
239
|
-
);
|
|
240
|
-
},
|
|
241
|
-
"easeInOutCubic": function easeInOutCubic() {
|
|
242
|
-
return (/* reexport */_easeInOutCubic
|
|
243
|
-
);
|
|
244
|
-
},
|
|
245
|
-
"easeInOutElastic": function easeInOutElastic() {
|
|
246
|
-
return (/* reexport */_easeInOutElastic
|
|
247
|
-
);
|
|
248
|
-
},
|
|
249
|
-
"easeInOutExpo": function easeInOutExpo() {
|
|
250
|
-
return (/* reexport */_easeInOutExpo
|
|
251
|
-
);
|
|
252
|
-
},
|
|
253
|
-
"easeInOutQuad": function easeInOutQuad() {
|
|
254
|
-
return (/* reexport */_easeInOutQuad
|
|
255
|
-
);
|
|
256
|
-
},
|
|
257
|
-
"easeInOutQuart": function easeInOutQuart() {
|
|
258
|
-
return (/* reexport */_easeInOutQuart
|
|
259
|
-
);
|
|
260
|
-
},
|
|
261
|
-
"easeInOutQuint": function easeInOutQuint() {
|
|
262
|
-
return (/* reexport */_easeInOutQuint
|
|
263
|
-
);
|
|
264
|
-
},
|
|
265
|
-
"easeInOutSine": function easeInOutSine() {
|
|
266
|
-
return (/* reexport */_easeInOutSine
|
|
267
|
-
);
|
|
268
|
-
},
|
|
269
|
-
"easeInQuad": function easeInQuad() {
|
|
270
|
-
return (/* reexport */_easeInQuad
|
|
271
|
-
);
|
|
272
|
-
},
|
|
273
|
-
"easeInQuart": function easeInQuart() {
|
|
274
|
-
return (/* reexport */_easeInQuart
|
|
275
|
-
);
|
|
276
|
-
},
|
|
277
|
-
"easeInQuint": function easeInQuint() {
|
|
278
|
-
return (/* reexport */_easeInQuint
|
|
279
|
-
);
|
|
280
|
-
},
|
|
281
|
-
"easeInSine": function easeInSine() {
|
|
282
|
-
return (/* reexport */_easeInSine
|
|
283
|
-
);
|
|
284
|
-
},
|
|
285
|
-
"easeLinear": function easeLinear() {
|
|
286
|
-
return (/* reexport */_easeLinear
|
|
287
|
-
);
|
|
288
|
-
},
|
|
289
|
-
"easeOutBack": function easeOutBack() {
|
|
290
|
-
return (/* reexport */_easeOutBack
|
|
291
|
-
);
|
|
292
|
-
},
|
|
293
|
-
"easeOutCirc": function easeOutCirc() {
|
|
294
|
-
return (/* reexport */_easeOutCirc
|
|
295
|
-
);
|
|
296
|
-
},
|
|
297
|
-
"easeOutCubic": function easeOutCubic() {
|
|
298
|
-
return (/* reexport */_easeOutCubic
|
|
299
|
-
);
|
|
300
|
-
},
|
|
301
|
-
"easeOutElastic": function easeOutElastic() {
|
|
302
|
-
return (/* reexport */_easeOutElastic
|
|
303
|
-
);
|
|
304
|
-
},
|
|
305
|
-
"easeOutExpo": function easeOutExpo() {
|
|
306
|
-
return (/* reexport */_easeOutExpo
|
|
307
|
-
);
|
|
308
|
-
},
|
|
309
|
-
"easeOutQuad": function easeOutQuad() {
|
|
310
|
-
return (/* reexport */_easeOutQuad
|
|
311
|
-
);
|
|
312
|
-
},
|
|
313
|
-
"easeOutQuart": function easeOutQuart() {
|
|
314
|
-
return (/* reexport */_easeOutQuart
|
|
315
|
-
);
|
|
316
|
-
},
|
|
317
|
-
"easeOutQuint": function easeOutQuint() {
|
|
318
|
-
return (/* reexport */_easeOutQuint
|
|
319
|
-
);
|
|
320
|
-
},
|
|
321
|
-
"easeOutSine": function easeOutSine() {
|
|
322
|
-
return (/* reexport */_easeOutSine
|
|
323
|
-
);
|
|
324
|
-
},
|
|
325
|
-
"enableBodyScroll": function enableBodyScroll() {
|
|
326
|
-
return (/* reexport */_enableBodyScroll
|
|
327
|
-
);
|
|
328
|
-
},
|
|
329
|
-
"extractContentsOfBraces": function extractContentsOfBraces() {
|
|
330
|
-
return (/* reexport */_extractContentsOfBraces
|
|
331
|
-
);
|
|
332
|
-
},
|
|
333
|
-
"extractContentsOfBrackets": function extractContentsOfBrackets() {
|
|
334
|
-
return (/* reexport */_extractContentsOfBrackets
|
|
335
|
-
);
|
|
336
|
-
},
|
|
337
|
-
"extractContentsOfParentheses": function extractContentsOfParentheses() {
|
|
338
|
-
return (/* reexport */_extractContentsOfParentheses
|
|
339
|
-
);
|
|
340
|
-
},
|
|
341
|
-
"extractorExist": function extractorExist() {
|
|
342
|
-
return (/* reexport */_extractorExist
|
|
343
|
-
);
|
|
344
|
-
},
|
|
345
|
-
"flatData": function flatData() {
|
|
346
|
-
return (/* reexport */_flatData
|
|
347
|
-
);
|
|
348
|
-
},
|
|
349
|
-
"flatTree": function flatTree() {
|
|
350
|
-
return (/* reexport */_flatTree
|
|
351
|
-
);
|
|
352
|
-
},
|
|
353
|
-
"getAbsoluteCoordinates": function getAbsoluteCoordinates() {
|
|
354
|
-
return (/* reexport */_getAbsoluteCoordinates
|
|
355
|
-
);
|
|
356
|
-
},
|
|
357
|
-
"getAbsolutePositionOfStage": function getAbsolutePositionOfStage() {
|
|
358
|
-
return (/* reexport */_getAbsolutePositionOfStage
|
|
359
|
-
);
|
|
360
|
-
},
|
|
361
|
-
"getAllDepth": function getAllDepth() {
|
|
362
|
-
return (/* reexport */_getAllDepth
|
|
363
|
-
);
|
|
364
|
-
},
|
|
365
|
-
"getAllSiblings": function getAllSiblings() {
|
|
366
|
-
return (/* reexport */_getAllSiblings
|
|
367
|
-
);
|
|
368
|
-
},
|
|
369
|
-
"getCalendarDate": function getCalendarDate() {
|
|
370
|
-
return (/* reexport */_getCalendarDate
|
|
371
|
-
);
|
|
372
|
-
},
|
|
373
|
-
"getChildren": function getChildren() {
|
|
374
|
-
return (/* reexport */_getChildren
|
|
375
|
-
);
|
|
376
|
-
},
|
|
377
|
-
"getCurrentDate": function getCurrentDate() {
|
|
378
|
-
return (/* reexport */_getCurrentDate
|
|
379
|
-
);
|
|
380
|
-
},
|
|
381
|
-
"getCurrentDay": function getCurrentDay() {
|
|
382
|
-
return (/* reexport */_getCurrentDay
|
|
383
|
-
);
|
|
384
|
-
},
|
|
385
|
-
"getCurrentMonth": function getCurrentMonth() {
|
|
386
|
-
return (/* reexport */_getCurrentMonth
|
|
387
|
-
);
|
|
388
|
-
},
|
|
389
|
-
"getCurrentYear": function getCurrentYear() {
|
|
390
|
-
return (/* reexport */_getCurrentYear
|
|
391
|
-
);
|
|
392
|
-
},
|
|
393
|
-
"getDocument": function getDocument() {
|
|
394
|
-
return (/* reexport */_getDocument
|
|
395
|
-
);
|
|
396
|
-
},
|
|
397
|
-
"getFirstAndLastMonthDay": function getFirstAndLastMonthDay() {
|
|
398
|
-
return (/* reexport */_getFirstAndLastMonthDay
|
|
399
|
-
);
|
|
400
|
-
},
|
|
401
|
-
"getFullTime": function getFullTime() {
|
|
402
|
-
return (/* reexport */_getFullTime
|
|
403
|
-
);
|
|
404
|
-
},
|
|
405
|
-
"getLastDayInMonth": function getLastDayInMonth() {
|
|
406
|
-
return (/* reexport */_getLastDayInMonth
|
|
407
|
-
);
|
|
408
|
-
},
|
|
409
|
-
"getNextMonthDate": function getNextMonthDate() {
|
|
410
|
-
return (/* reexport */_getNextMonthDate
|
|
411
|
-
);
|
|
412
|
-
},
|
|
413
|
-
"getNextSiblings": function getNextSiblings() {
|
|
414
|
-
return (/* reexport */_getNextSiblings
|
|
415
|
-
);
|
|
416
|
-
},
|
|
417
|
-
"getNextYearDate": function getNextYearDate() {
|
|
418
|
-
return (/* reexport */_getNextYearDate
|
|
419
|
-
);
|
|
420
|
-
},
|
|
421
|
-
"getNow": function getNow() {
|
|
422
|
-
return (/* reexport */_getNow
|
|
423
|
-
);
|
|
424
|
-
},
|
|
425
|
-
"getOffset": function getOffset() {
|
|
426
|
-
return (/* reexport */_getOffset
|
|
427
|
-
);
|
|
428
|
-
},
|
|
429
|
-
"getParents": function getParents() {
|
|
430
|
-
return (/* reexport */_getParents
|
|
431
|
-
);
|
|
432
|
-
},
|
|
433
|
-
"getPosition": function getPosition() {
|
|
434
|
-
return (/* reexport */_getPosition
|
|
435
|
-
);
|
|
436
|
-
},
|
|
437
|
-
"getPrevMonthDate": function getPrevMonthDate() {
|
|
438
|
-
return (/* reexport */_getPrevMonthDate
|
|
439
|
-
);
|
|
440
|
-
},
|
|
441
|
-
"getPrevYearDate": function getPrevYearDate() {
|
|
442
|
-
return (/* reexport */_getPrevYearDate
|
|
443
|
-
);
|
|
444
|
-
},
|
|
445
|
-
"getPreviousSiblings": function getPreviousSiblings() {
|
|
446
|
-
return (/* reexport */_getPreviousSiblings
|
|
447
|
-
);
|
|
448
|
-
},
|
|
449
|
-
"getSpecifiedDate": function getSpecifiedDate() {
|
|
450
|
-
return (/* reexport */_getSpecifiedDate
|
|
451
|
-
);
|
|
452
|
-
},
|
|
453
|
-
"getTextWidth": function getTextWidth() {
|
|
454
|
-
return (/* reexport */_getTextWidth
|
|
455
|
-
);
|
|
456
|
-
},
|
|
457
|
-
"getTodayDate": function getTodayDate() {
|
|
458
|
-
return (/* reexport */_getTodayDate
|
|
459
|
-
);
|
|
460
|
-
},
|
|
461
|
-
"getTomorrowDate": function getTomorrowDate() {
|
|
462
|
-
return (/* reexport */_getTomorrowDate
|
|
463
|
-
);
|
|
464
|
-
},
|
|
465
|
-
"getTransitionDuration": function getTransitionDuration() {
|
|
466
|
-
return (/* reexport */_getTransitionDuration
|
|
467
|
-
);
|
|
468
|
-
},
|
|
469
|
-
"getYesterdayDate": function getYesterdayDate() {
|
|
470
|
-
return (/* reexport */_getYesterdayDate
|
|
471
|
-
);
|
|
472
|
-
},
|
|
473
|
-
"guid": function guid() {
|
|
474
|
-
return (/* reexport */libs_guid
|
|
475
|
-
);
|
|
476
|
-
},
|
|
477
|
-
"isElement": function isElement() {
|
|
478
|
-
return (/* reexport */_isElement
|
|
479
|
-
);
|
|
480
|
-
},
|
|
481
|
-
"isHTMLElement": function isHTMLElement() {
|
|
482
|
-
return (/* reexport */_isHTMLElement
|
|
483
|
-
);
|
|
484
|
-
},
|
|
485
|
-
"isInViewport": function isInViewport() {
|
|
486
|
-
return (/* reexport */_isInViewport
|
|
487
|
-
);
|
|
488
|
-
},
|
|
489
|
-
"isJSON": function isJSON() {
|
|
490
|
-
return (/* reexport */_isJSON
|
|
491
|
-
);
|
|
492
|
-
},
|
|
493
|
-
"isNode": function isNode() {
|
|
494
|
-
return (/* reexport */_isNode
|
|
495
|
-
);
|
|
496
|
-
},
|
|
497
|
-
"isNumeric": function isNumeric() {
|
|
498
|
-
return (/* reexport */_isNumeric
|
|
499
|
-
);
|
|
500
|
-
},
|
|
501
|
-
"isRootElement": function isRootElement() {
|
|
502
|
-
return (/* reexport */_isRootElement
|
|
503
|
-
);
|
|
504
|
-
},
|
|
505
|
-
"isShadowRoot": function isShadowRoot() {
|
|
506
|
-
return (/* reexport */_isShadowRoot
|
|
507
|
-
);
|
|
508
|
-
},
|
|
509
|
-
"isTimeString": function isTimeString() {
|
|
510
|
-
return (/* reexport */_isTimeString
|
|
511
|
-
);
|
|
512
|
-
},
|
|
513
|
-
"isValidDate": function isValidDate() {
|
|
514
|
-
return (/* reexport */_isValidDate
|
|
515
|
-
);
|
|
516
|
-
},
|
|
517
|
-
"isValidDay": function isValidDay() {
|
|
518
|
-
return (/* reexport */_isValidDay
|
|
519
|
-
);
|
|
520
|
-
},
|
|
521
|
-
"isValidHours": function isValidHours() {
|
|
522
|
-
return (/* reexport */_isValidHours
|
|
523
|
-
);
|
|
524
|
-
},
|
|
525
|
-
"isValidMinutesAndSeconds": function isValidMinutesAndSeconds() {
|
|
526
|
-
return (/* reexport */_isValidMinutesAndSeconds
|
|
527
|
-
);
|
|
528
|
-
},
|
|
529
|
-
"isValidMonth": function isValidMonth() {
|
|
530
|
-
return (/* reexport */_isValidMonth
|
|
531
|
-
);
|
|
532
|
-
},
|
|
533
|
-
"isValidNumeric": function isValidNumeric() {
|
|
534
|
-
return (/* reexport */_isValidNumeric
|
|
535
|
-
);
|
|
536
|
-
},
|
|
537
|
-
"isValidYear": function isValidYear() {
|
|
538
|
-
return (/* reexport */_isValidYear
|
|
539
|
-
);
|
|
540
|
-
},
|
|
541
|
-
"nodeContains": function nodeContains() {
|
|
542
|
-
return (/* reexport */_nodeContains
|
|
543
|
-
);
|
|
544
|
-
},
|
|
545
|
-
"padZero": function padZero() {
|
|
546
|
-
return (/* reexport */_padZero
|
|
547
|
-
);
|
|
548
|
-
},
|
|
549
|
-
"readStream": function readStream() {
|
|
550
|
-
return (/* reexport */_readStream2
|
|
551
|
-
);
|
|
552
|
-
},
|
|
553
|
-
"removeArrDuplicateItems": function removeArrDuplicateItems() {
|
|
554
|
-
return (/* reexport */_removeArrDuplicateItems
|
|
555
|
-
);
|
|
556
|
-
},
|
|
557
|
-
"setDateDays": function setDateDays() {
|
|
558
|
-
return (/* reexport */_setDateDays
|
|
559
|
-
);
|
|
560
|
-
},
|
|
561
|
-
"setDateHours": function setDateHours() {
|
|
562
|
-
return (/* reexport */_setDateHours
|
|
563
|
-
);
|
|
564
|
-
},
|
|
565
|
-
"setDateMinutes": function setDateMinutes() {
|
|
566
|
-
return (/* reexport */_setDateMinutes
|
|
567
|
-
);
|
|
568
|
-
},
|
|
569
|
-
"setDefaultOptions": function setDefaultOptions() {
|
|
570
|
-
return (/* reexport */_setDefaultOptions
|
|
571
|
-
);
|
|
572
|
-
},
|
|
573
|
-
"throttle": function throttle() {
|
|
574
|
-
return (/* reexport */_throttle
|
|
575
|
-
);
|
|
576
|
-
},
|
|
577
|
-
"timestampToDate": function timestampToDate() {
|
|
578
|
-
return (/* reexport */_timestampToDate
|
|
579
|
-
);
|
|
580
|
-
},
|
|
581
|
-
"toBinary": function toBinary() {
|
|
582
|
-
return (/* reexport */_toBinary
|
|
583
|
-
);
|
|
584
|
-
},
|
|
585
|
-
"uint8arrayToArr": function uint8arrayToArr() {
|
|
586
|
-
return (/* reexport */_uint8arrayToArr
|
|
587
|
-
);
|
|
588
|
-
},
|
|
589
|
-
"uint8arrayToBase64Str": function uint8arrayToBase64Str() {
|
|
590
|
-
return (/* reexport */_uint8arrayToBase64Str
|
|
591
|
-
);
|
|
592
|
-
},
|
|
593
|
-
"useAutosizeTextArea": function useAutosizeTextArea() {
|
|
594
|
-
return (/* reexport */hooks_useAutosizeTextArea
|
|
595
|
-
);
|
|
596
|
-
},
|
|
597
|
-
"useClickOutside": function useClickOutside() {
|
|
598
|
-
return (/* reexport */hooks_useClickOutside
|
|
599
|
-
);
|
|
600
|
-
},
|
|
601
|
-
"useComId": function useComId() {
|
|
602
|
-
return (/* reexport */hooks_useComId
|
|
603
|
-
);
|
|
604
|
-
},
|
|
605
|
-
"useDebounce": function useDebounce() {
|
|
606
|
-
return (/* reexport */hooks_useDebounce
|
|
607
|
-
);
|
|
608
|
-
},
|
|
609
|
-
"useDraggable": function useDraggable() {
|
|
610
|
-
return (/* reexport */hooks_useDraggable
|
|
611
|
-
);
|
|
612
|
-
},
|
|
613
|
-
"useInterval": function useInterval() {
|
|
614
|
-
return (/* reexport */hooks_useInterval
|
|
615
|
-
);
|
|
616
|
-
},
|
|
617
|
-
"useKeyPress": function useKeyPress() {
|
|
618
|
-
return (/* reexport */hooks_useKeyPress
|
|
619
|
-
);
|
|
620
|
-
},
|
|
621
|
-
"useThrottle": function useThrottle() {
|
|
622
|
-
return (/* reexport */hooks_useThrottle
|
|
623
|
-
);
|
|
624
|
-
},
|
|
625
|
-
"useWindowScroll": function useWindowScroll() {
|
|
626
|
-
return (/* reexport */hooks_useWindowScroll
|
|
627
|
-
);
|
|
381
|
+
__nested_webpack_require_12605__.r(__webpack_exports__);
|
|
382
|
+
/* harmony export */
|
|
383
|
+
__nested_webpack_require_12605__.d(__webpack_exports__, {
|
|
384
|
+
/* harmony export */"default": function _default() {
|
|
385
|
+
return __WEBPACK_DEFAULT_EXPORT__;
|
|
628
386
|
}
|
|
387
|
+
/* harmony export */
|
|
629
388
|
});
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
* @returns {String} - The globally-unique identifiers.
|
|
635
|
-
*/
|
|
636
|
-
function guid() {
|
|
637
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
|
638
|
-
var r = Math.random() * 16 | 0,
|
|
639
|
-
v = c == 'x' ? r : r & 0x3 | 0x8;
|
|
640
|
-
return v.toString(16);
|
|
641
|
-
}).toLocaleUpperCase();
|
|
642
|
-
}
|
|
643
|
-
/* harmony default export */
|
|
644
|
-
var libs_guid = guid;
|
|
645
|
-
; // CONCATENATED MODULE: ./src/libs/easing.ts
|
|
646
|
-
/*
|
|
647
|
-
* All easing functions
|
|
648
|
-
* @link: https://easings.net
|
|
649
|
-
* @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.)
|
|
650
|
-
* @param {number} b - beginning value (The starting point of the animation. Usually it's a static value, you can start at 0 for example.)
|
|
651
|
-
* @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.)
|
|
652
|
-
* @param {number} d - duration (Amount of time the animation will take. Usually a static value aswell.)
|
|
653
|
-
* @return {number}
|
|
654
|
-
*/
|
|
655
|
-
function _easeLinear(t, b, c, d) {
|
|
656
|
-
return c * t / d + b;
|
|
657
|
-
}
|
|
658
|
-
function _easeInQuad(t, b, c, d) {
|
|
659
|
-
return c * (t /= d) * t + b;
|
|
660
|
-
}
|
|
661
|
-
function _easeOutQuad(t, b, c, d) {
|
|
662
|
-
return -c * (t /= d) * (t - 2) + b;
|
|
663
|
-
}
|
|
664
|
-
function _easeInOutQuad(t, b, c, d) {
|
|
665
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t + b;
|
|
666
|
-
return -c / 2 * (--t * (t - 2) - 1) + b;
|
|
667
|
-
}
|
|
668
|
-
function _easeInSine(t, b, c, d) {
|
|
669
|
-
return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
|
|
670
|
-
}
|
|
671
|
-
function _easeOutSine(t, b, c, d) {
|
|
672
|
-
return c * Math.sin(t / d * (Math.PI / 2)) + b;
|
|
673
|
-
}
|
|
674
|
-
function _easeInOutSine(t, b, c, d) {
|
|
675
|
-
return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
|
|
676
|
-
}
|
|
677
|
-
function _easeInExpo(t, b, c, d) {
|
|
678
|
-
return t == 0 ? b : c * Math.pow(2, 10 * (t / d - 1)) + b;
|
|
679
|
-
}
|
|
680
|
-
function _easeOutExpo(t, b, c, d) {
|
|
681
|
-
return t == d ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
|
|
682
|
-
}
|
|
683
|
-
function _easeInOutExpo(t, b, c, d) {
|
|
684
|
-
if (t == 0) return b;
|
|
685
|
-
if (t == d) return b + c;
|
|
686
|
-
if ((t /= d / 2) < 1) return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
687
|
-
return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
688
|
-
}
|
|
689
|
-
function _easeInCirc(t, b, c, d) {
|
|
690
|
-
return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
|
|
691
|
-
}
|
|
692
|
-
function _easeOutCirc(t, b, c, d) {
|
|
693
|
-
return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
|
|
694
|
-
}
|
|
695
|
-
function _easeInOutCirc(t, b, c, d) {
|
|
696
|
-
if ((t /= d / 2) < 1) return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
|
|
697
|
-
return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
|
|
698
|
-
}
|
|
699
|
-
function _easeInCubic(t, b, c, d) {
|
|
700
|
-
return c * (t /= d) * t * t + b;
|
|
701
|
-
}
|
|
702
|
-
function _easeOutCubic(t, b, c, d) {
|
|
703
|
-
return c * ((t = t / d - 1) * t * t + 1) + b;
|
|
704
|
-
}
|
|
705
|
-
function _easeInOutCubic(t, b, c, d) {
|
|
706
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t * t + b;
|
|
707
|
-
return c / 2 * ((t -= 2) * t * t + 2) + b;
|
|
708
|
-
}
|
|
709
|
-
function _easeInQuart(t, b, c, d) {
|
|
710
|
-
return c * (t /= d) * t * t * t + b;
|
|
711
|
-
}
|
|
712
|
-
function _easeOutQuart(t, b, c, d) {
|
|
713
|
-
return -c * ((t = t / d - 1) * t * t * t - 1) + b;
|
|
714
|
-
}
|
|
715
|
-
function _easeInOutQuart(t, b, c, d) {
|
|
716
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t + b;
|
|
717
|
-
return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
|
|
718
|
-
}
|
|
719
|
-
function _easeInQuint(t, b, c, d) {
|
|
720
|
-
return c * (t /= d) * t * t * t * t + b;
|
|
721
|
-
}
|
|
722
|
-
function _easeOutQuint(t, b, c, d) {
|
|
723
|
-
return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
|
|
724
|
-
}
|
|
725
|
-
function _easeInOutQuint(t, b, c, d) {
|
|
726
|
-
if ((t /= d / 2) < 1) return c / 2 * t * t * t * t * t + b;
|
|
727
|
-
return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
|
|
728
|
-
}
|
|
729
|
-
function _easeInElastic(t, b, c, d) {
|
|
730
|
-
var s = 1.70158;
|
|
731
|
-
var p = 0;
|
|
732
|
-
var a = c;
|
|
733
|
-
if (t == 0) return b;
|
|
734
|
-
if ((t /= d) == 1) return b + c;
|
|
735
|
-
if (!p) p = d * .3;
|
|
736
|
-
if (a < Math.abs(c)) {
|
|
737
|
-
a = c;
|
|
738
|
-
var s = p / 4;
|
|
739
|
-
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
740
|
-
return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
741
|
-
}
|
|
742
|
-
function _easeOutElastic(t, b, c, d) {
|
|
743
|
-
var s = 1.70158;
|
|
744
|
-
var p = 0;
|
|
745
|
-
var a = c;
|
|
746
|
-
if (t == 0) return b;
|
|
747
|
-
if ((t /= d) == 1) return b + c;
|
|
748
|
-
if (!p) p = d * .3;
|
|
749
|
-
if (a < Math.abs(c)) {
|
|
750
|
-
a = c;
|
|
751
|
-
var s = p / 4;
|
|
752
|
-
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
753
|
-
return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
|
|
754
|
-
}
|
|
755
|
-
function _easeInOutElastic(t, b, c, d) {
|
|
756
|
-
var s = 1.70158;
|
|
757
|
-
var p = 0;
|
|
758
|
-
var a = c;
|
|
759
|
-
if (t == 0) return b;
|
|
760
|
-
if ((t /= d / 2) == 2) return b + c;
|
|
761
|
-
if (!p) p = d * (.3 * 1.5);
|
|
762
|
-
if (a < Math.abs(c)) {
|
|
763
|
-
a = c;
|
|
764
|
-
var s = p / 4;
|
|
765
|
-
} else var s = p / (2 * Math.PI) * Math.asin(c / a);
|
|
766
|
-
if (t < 1) return -.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
|
|
767
|
-
return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * .5 + c + b;
|
|
768
|
-
}
|
|
769
|
-
function _easeInBack(t, b, c, d) {
|
|
770
|
-
var s = 1.70158;
|
|
771
|
-
if (s == undefined) s = 1.70158;
|
|
772
|
-
return c * (t /= d) * t * ((s + 1) * t - s) + b;
|
|
773
|
-
}
|
|
774
|
-
function _easeOutBack(t, b, c, d) {
|
|
775
|
-
var s = 1.70158;
|
|
776
|
-
if (s == undefined) s = 1.70158;
|
|
777
|
-
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
|
|
778
|
-
}
|
|
779
|
-
function _easeInOutBack(t, b, c, d) {
|
|
780
|
-
var s = 1.70158;
|
|
781
|
-
if (s == undefined) s = 1.70158;
|
|
782
|
-
if ((t /= d / 2) < 1) return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
|
|
783
|
-
return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
|
|
784
|
-
}
|
|
785
|
-
; // CONCATENATED MODULE: ./src/libs/init-default-options.ts
|
|
389
|
+
/* harmony import */
|
|
390
|
+
var _easing__WEBPACK_IMPORTED_MODULE_1__ = __nested_webpack_require_12605__(357);
|
|
391
|
+
/* harmony import */
|
|
392
|
+
var _initDefaultOptions__WEBPACK_IMPORTED_MODULE_0__ = __nested_webpack_require_12605__(65);
|
|
786
393
|
function _typeof(obj) {
|
|
787
394
|
"@babel/helpers - typeof";
|
|
788
395
|
|
|
@@ -792,89 +399,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
792
399
|
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
793
400
|
}, _typeof(obj);
|
|
794
401
|
}
|
|
795
|
-
/**
|
|
796
|
-
* Set a default JSON format configuration
|
|
797
|
-
*
|
|
798
|
-
* @param {*} props - Set some default keys and values.
|
|
799
|
-
* @param {*} options - A JSON variable passed in from outside, including key and value.
|
|
800
|
-
* @return {JSON} - Merge the new and old values.
|
|
801
|
-
*/
|
|
802
|
-
function _setDefaultOptions(props, options) {
|
|
803
|
-
if (_typeof(options) === ( true ? "undefined" : 0) || options === null || options === false) options = {};
|
|
804
|
-
//Set a default configuration
|
|
805
|
-
if (_isJSON(props)) {
|
|
806
|
-
var defaultConfigValues = Object.values(props);
|
|
807
|
-
Object.keys(props).forEach(function (prop, index) {
|
|
808
|
-
// Well-formed string type
|
|
809
|
-
Object.keys(options).forEach(function (prop2, index2) {
|
|
810
|
-
if (prop2 === prop) {
|
|
811
|
-
var _v = options[prop2];
|
|
812
|
-
if (_v == 'true') _v = true;
|
|
813
|
-
if (_v == 'false') _v = false;
|
|
814
|
-
if (_isValidNumeric(_v)) _v = parseFloat(_v);
|
|
815
|
-
if (_isJSON(_v)) _v = Object.prototype.toString.call(_v) === '[object Object]' ? _v : JSON.parse(_v);
|
|
816
|
-
options[prop2] = _v;
|
|
817
|
-
}
|
|
818
|
-
});
|
|
819
|
-
|
|
820
|
-
//
|
|
821
|
-
if (_typeof(options[prop]) === ( true ? "undefined" : 0) || options[prop] === null) options[prop] = defaultConfigValues[index];
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
return options;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
/**
|
|
828
|
-
* Check if a string is a valid number
|
|
829
|
-
* @param {*} str
|
|
830
|
-
* @returns
|
|
831
|
-
*/
|
|
832
|
-
function _isValidNumeric(str) {
|
|
833
|
-
if (typeof str != "string") return false; // we only process strings!
|
|
834
|
-
if (!isNaN(Number(str)) &&
|
|
835
|
-
// use type coercion to parse the _entirety_ of the string (`parseFloat` alone does not do this)
|
|
836
|
-
!isNaN(parseFloat(str)) // ensure strings of whitespace fail
|
|
837
|
-
) {
|
|
838
|
-
return true;
|
|
839
|
-
} else {
|
|
840
|
-
return false;
|
|
841
|
-
}
|
|
842
|
-
}
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* Determine whether it is in JSON format
|
|
846
|
-
* @param {*} str
|
|
847
|
-
* @returns
|
|
848
|
-
*/
|
|
849
|
-
function _isJSON(str) {
|
|
850
|
-
if (typeof str === 'string' && str.length > 0) {
|
|
851
|
-
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
852
|
-
return false;
|
|
853
|
-
} else {
|
|
854
|
-
if (/^[\],:{}\s]*$/.test(str.replace(/\\["\\\/bfnrtu]/g, '@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']').replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
|
|
855
|
-
return true;
|
|
856
|
-
} else {
|
|
857
|
-
return false;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
} else {
|
|
861
|
-
if (_typeof(str) === 'object' && Object.prototype.toString.call(str) === '[object Object]' && !str.length) {
|
|
862
|
-
return true;
|
|
863
|
-
} else {
|
|
864
|
-
return false;
|
|
865
|
-
}
|
|
866
|
-
}
|
|
867
|
-
}
|
|
868
|
-
; // CONCATENATED MODULE: ./src/libs/anim.ts
|
|
869
|
-
function anim_typeof(obj) {
|
|
870
|
-
"@babel/helpers - typeof";
|
|
871
|
-
|
|
872
|
-
return anim_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
873
|
-
return typeof obj;
|
|
874
|
-
} : function (obj) {
|
|
875
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
876
|
-
}, anim_typeof(obj);
|
|
877
|
-
}
|
|
878
402
|
|
|
879
403
|
/**
|
|
880
404
|
* Element Animate
|
|
@@ -888,10 +412,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
888
412
|
function animateStyles(curElement, config) {
|
|
889
413
|
var easeType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'linear';
|
|
890
414
|
var callback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : function () {};
|
|
891
|
-
if (
|
|
415
|
+
if (_typeof(curElement) === ( true ? "undefined" : 0)) return;
|
|
892
416
|
|
|
893
417
|
// Set a default configuration
|
|
894
|
-
config =
|
|
418
|
+
config = (0, _initDefaultOptions__WEBPACK_IMPORTED_MODULE_0__.setDefaultOptions)({
|
|
895
419
|
"startHeight": 0,
|
|
896
420
|
// node.scrollHeight
|
|
897
421
|
"endHeight": 0,
|
|
@@ -911,19 +435,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
911
435
|
var val;
|
|
912
436
|
switch (easeType) {
|
|
913
437
|
case "linear":
|
|
914
|
-
val =
|
|
438
|
+
val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeLinear)(time, from, to - from, duration);
|
|
915
439
|
break;
|
|
916
440
|
case "ease-in":
|
|
917
|
-
val =
|
|
441
|
+
val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeInQuad)(time, from, to - from, duration);
|
|
918
442
|
break;
|
|
919
443
|
case "ease-out":
|
|
920
|
-
val =
|
|
444
|
+
val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeOutQuad)(time, from, to - from, duration);
|
|
921
445
|
break;
|
|
922
446
|
case "ease-in-out":
|
|
923
|
-
val =
|
|
447
|
+
val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeInOutQuad)(time, from, to - from, duration);
|
|
924
448
|
break;
|
|
925
449
|
default:
|
|
926
|
-
val =
|
|
450
|
+
val = (0, _easing__WEBPACK_IMPORTED_MODULE_1__.easeLinear)(time, from, to - from, duration);
|
|
927
451
|
}
|
|
928
452
|
|
|
929
453
|
// Elapsed time in miliseconds
|
|
@@ -949,3140 +473,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
949
473
|
requestId = window.requestAnimationFrame(loop);
|
|
950
474
|
}
|
|
951
475
|
/* harmony default export */
|
|
952
|
-
var
|
|
953
|
-
; // CONCATENATED MODULE: ./src/libs/performance.ts
|
|
954
|
-
/*
|
|
955
|
-
* Debounce
|
|
956
|
-
*
|
|
957
|
-
* @param {Function} fn - A function to be executed within the time limit.
|
|
958
|
-
* @param {Number} limit - Waiting time.
|
|
959
|
-
* @return {*} - Returns a new function.
|
|
960
|
-
*/
|
|
961
|
-
function _debounce(fn) {
|
|
962
|
-
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
963
|
-
var timer;
|
|
964
|
-
return function () {
|
|
965
|
-
clearTimeout(timer);
|
|
966
|
-
timer = setTimeout(function () {
|
|
967
|
-
fn.apply(this, arguments);
|
|
968
|
-
}, limit);
|
|
969
|
-
};
|
|
970
|
-
}
|
|
971
|
-
|
|
972
|
-
/*
|
|
973
|
-
* Throttle
|
|
974
|
-
*
|
|
975
|
-
* @param {Function} fn - A function to be executed within the time limit.
|
|
976
|
-
* @param {Number} limit - Waiting time.
|
|
977
|
-
* @return {*} - Returns a new function.
|
|
978
|
-
*/
|
|
979
|
-
function _throttle(fn) {
|
|
980
|
-
var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 300;
|
|
981
|
-
var waiting = false;
|
|
982
|
-
return function () {
|
|
983
|
-
if (!waiting) {
|
|
984
|
-
fn.apply(this, arguments);
|
|
985
|
-
waiting = true;
|
|
986
|
-
setTimeout(function () {
|
|
987
|
-
waiting = false;
|
|
988
|
-
}, limit);
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
}
|
|
992
|
-
; // CONCATENATED MODULE: ./src/libs/dom.ts
|
|
993
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
994
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
995
|
-
if (!it) {
|
|
996
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
997
|
-
if (it) o = it;
|
|
998
|
-
var i = 0;
|
|
999
|
-
var F = function F() {};
|
|
1000
|
-
return {
|
|
1001
|
-
s: F,
|
|
1002
|
-
n: function n() {
|
|
1003
|
-
if (i >= o.length) return {
|
|
1004
|
-
done: true
|
|
1005
|
-
};
|
|
1006
|
-
return {
|
|
1007
|
-
done: false,
|
|
1008
|
-
value: o[i++]
|
|
1009
|
-
};
|
|
1010
|
-
},
|
|
1011
|
-
e: function e(_e) {
|
|
1012
|
-
throw _e;
|
|
1013
|
-
},
|
|
1014
|
-
f: F
|
|
1015
|
-
};
|
|
1016
|
-
}
|
|
1017
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1018
|
-
}
|
|
1019
|
-
var normalCompletion = true,
|
|
1020
|
-
didErr = false,
|
|
1021
|
-
err;
|
|
1022
|
-
return {
|
|
1023
|
-
s: function s() {
|
|
1024
|
-
it = it.call(o);
|
|
1025
|
-
},
|
|
1026
|
-
n: function n() {
|
|
1027
|
-
var step = it.next();
|
|
1028
|
-
normalCompletion = step.done;
|
|
1029
|
-
return step;
|
|
1030
|
-
},
|
|
1031
|
-
e: function e(_e2) {
|
|
1032
|
-
didErr = true;
|
|
1033
|
-
err = _e2;
|
|
1034
|
-
},
|
|
1035
|
-
f: function f() {
|
|
1036
|
-
try {
|
|
1037
|
-
if (!normalCompletion && it["return"] != null) it["return"]();
|
|
1038
|
-
} finally {
|
|
1039
|
-
if (didErr) throw err;
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
};
|
|
1043
|
-
}
|
|
1044
|
-
function _toConsumableArray(arr) {
|
|
1045
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
1046
|
-
}
|
|
1047
|
-
function _nonIterableSpread() {
|
|
1048
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1049
|
-
}
|
|
1050
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
1051
|
-
if (!o) return;
|
|
1052
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
1053
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1054
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1055
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1056
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
1057
|
-
}
|
|
1058
|
-
function _iterableToArray(iter) {
|
|
1059
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1060
|
-
}
|
|
1061
|
-
function _arrayWithoutHoles(arr) {
|
|
1062
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
1063
|
-
}
|
|
1064
|
-
function _arrayLikeToArray(arr, len) {
|
|
1065
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1066
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1067
|
-
return arr2;
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Dom Utilities
|
|
1071
|
-
* @param {HTMLElement} el - Element
|
|
1072
|
-
* @param {?String} filter - A filter string
|
|
1073
|
-
* @returns HtmlElementCollection
|
|
1074
|
-
*/
|
|
1075
|
-
function matches(el, filter) {
|
|
1076
|
-
if (el && el.nodeType === 1) {
|
|
1077
|
-
if (filter) {
|
|
1078
|
-
return el.matches(filter);
|
|
1079
|
-
}
|
|
1080
|
-
return true;
|
|
1081
|
-
}
|
|
1082
|
-
return false;
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
// the next siblings
|
|
1086
|
-
function _getNextSiblings(el) {
|
|
1087
|
-
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1088
|
-
var sibs = [];
|
|
1089
|
-
while (el = el.nextSibling) {
|
|
1090
|
-
if (matches(el, filter)) {
|
|
1091
|
-
sibs.push(el);
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
return sibs;
|
|
1095
|
-
}
|
|
1096
|
-
|
|
1097
|
-
// previous siblings
|
|
1098
|
-
function _getPreviousSiblings(el) {
|
|
1099
|
-
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1100
|
-
var sibs = [];
|
|
1101
|
-
while (el = el.previousSibling) {
|
|
1102
|
-
if (matches(el, filter)) {
|
|
1103
|
-
sibs.push(el);
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
return sibs;
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
// parent and get all the siblings
|
|
1110
|
-
function _getAllSiblings(el) {
|
|
1111
|
-
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1112
|
-
var sibs = [];
|
|
1113
|
-
el = el.parentNode.firstChild;
|
|
1114
|
-
while (el = el.nextSibling) {
|
|
1115
|
-
if (matches(el, filter)) {
|
|
1116
|
-
sibs.push(el);
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
return sibs;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
// all parent nodes
|
|
1123
|
-
function _getParents(el) {
|
|
1124
|
-
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1125
|
-
var parents = [];
|
|
1126
|
-
while (el = el.parentNode) {
|
|
1127
|
-
if (matches(el, filter)) {
|
|
1128
|
-
parents.push(el);
|
|
1129
|
-
}
|
|
1130
|
-
}
|
|
1131
|
-
return parents;
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
// all child nodes
|
|
1135
|
-
function _getChildren(el) {
|
|
1136
|
-
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1137
|
-
var all = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
1138
|
-
all.push.apply(all, _toConsumableArray(el.childNodes));
|
|
1139
|
-
var _iterator = _createForOfIteratorHelper(el.childNodes),
|
|
1140
|
-
_step;
|
|
1141
|
-
try {
|
|
1142
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
1143
|
-
var child = _step.value;
|
|
1144
|
-
_getChildren(child, filter, all);
|
|
1145
|
-
}
|
|
1146
|
-
} catch (err) {
|
|
1147
|
-
_iterator.e(err);
|
|
1148
|
-
} finally {
|
|
1149
|
-
_iterator.f();
|
|
1150
|
-
}
|
|
1151
|
-
var res = all.filter(function (item) {
|
|
1152
|
-
return matches(item, filter);
|
|
1153
|
-
});
|
|
1154
|
-
return res;
|
|
1155
|
-
}
|
|
1156
|
-
function _isRootElement(element) {
|
|
1157
|
-
return element.matches('html,body');
|
|
1158
|
-
}
|
|
1159
|
-
function _getDocument(node) {
|
|
1160
|
-
if (typeof node === 'undefined') {
|
|
1161
|
-
return document;
|
|
1162
|
-
} else {
|
|
1163
|
-
return node.ownerDocument;
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
function _isNode(value) {
|
|
1167
|
-
return value instanceof Node;
|
|
1168
|
-
}
|
|
1169
|
-
function _isElement(value) {
|
|
1170
|
-
return value instanceof Element;
|
|
1171
|
-
}
|
|
1172
|
-
function _isHTMLElement(value) {
|
|
1173
|
-
return value instanceof HTMLElement;
|
|
1174
|
-
}
|
|
1175
|
-
function _isShadowRoot(value) {
|
|
1176
|
-
// Browsers without `ShadowRoot` support.
|
|
1177
|
-
if (typeof ShadowRoot === 'undefined') {
|
|
1178
|
-
return false;
|
|
1179
|
-
}
|
|
1180
|
-
return value instanceof ShadowRoot;
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
/* console.log(nodeContains(document.body, document.getElementById('obj'))) */
|
|
1184
|
-
function _nodeContains(parent, child) {
|
|
1185
|
-
var _child$getRootNode;
|
|
1186
|
-
if (!parent || !child) {
|
|
1187
|
-
return false;
|
|
1188
|
-
}
|
|
1189
|
-
var rootNode = (_child$getRootNode = child.getRootNode) === null || _child$getRootNode === void 0 ? void 0 : _child$getRootNode.call(child);
|
|
1190
|
-
|
|
1191
|
-
// First, attempt with faster native method
|
|
1192
|
-
if (parent.contains(child)) {
|
|
1193
|
-
return true;
|
|
1194
|
-
}
|
|
1195
|
-
|
|
1196
|
-
// then fallback to custom implementation with Shadow DOM support
|
|
1197
|
-
if (rootNode && _isShadowRoot(rootNode)) {
|
|
1198
|
-
var next = child;
|
|
1199
|
-
while (next) {
|
|
1200
|
-
if (parent === next) {
|
|
1201
|
-
return true;
|
|
1202
|
-
}
|
|
1203
|
-
// @ts-ignore
|
|
1204
|
-
next = next.parentNode || next.host;
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
// Give up, the result is false
|
|
1209
|
-
return false;
|
|
1210
|
-
}
|
|
1211
|
-
; // CONCATENATED MODULE: ./src/libs/get-element-property.ts
|
|
1212
|
-
function get_element_property_typeof(obj) {
|
|
1213
|
-
"@babel/helpers - typeof";
|
|
1214
|
-
|
|
1215
|
-
return get_element_property_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1216
|
-
return typeof obj;
|
|
1217
|
-
} : function (obj) {
|
|
1218
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1219
|
-
}, get_element_property_typeof(obj);
|
|
1220
|
-
}
|
|
1221
|
-
/**
|
|
1222
|
-
* Get the -webkit-transition-duration property
|
|
1223
|
-
*
|
|
1224
|
-
* @param {HTMLElement} el - A DOM node containing one selector to match against.
|
|
1225
|
-
* @return {number} - Returns a pure number.
|
|
1226
|
-
*/
|
|
1227
|
-
function _getTransitionDuration(el) {
|
|
1228
|
-
if (get_element_property_typeof(el) === ( true ? "undefined" : 0)) {
|
|
1229
|
-
return 0;
|
|
1230
|
-
}
|
|
1231
|
-
var style = window.getComputedStyle(el),
|
|
1232
|
-
duration = style.webkitTransitionDuration,
|
|
1233
|
-
delay = style.webkitTransitionDelay;
|
|
1234
|
-
if (get_element_property_typeof(duration) != ( true ? "undefined" : 0)) {
|
|
1235
|
-
// fix miliseconds vs seconds
|
|
1236
|
-
duration = duration.indexOf("ms") > -1 ? parseFloat(duration) : parseFloat(duration) * 1000;
|
|
1237
|
-
delay = delay.indexOf("ms") > -1 ? parseFloat(delay) : parseFloat(delay) * 1000;
|
|
1238
|
-
return duration;
|
|
1239
|
-
} else {
|
|
1240
|
-
return 0;
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
/**
|
|
1245
|
-
* Get an object's absolute position on the page
|
|
1246
|
-
*
|
|
1247
|
-
* @param {HTMLElement} el - A DOM node containing one selector to match against.
|
|
1248
|
-
* @return {Json} - An object containing the properties top and left.
|
|
1249
|
-
*/
|
|
1250
|
-
function _getAbsoluteCoordinates(el) {
|
|
1251
|
-
var windowWidth = window.innerWidth,
|
|
1252
|
-
leftPos = null,
|
|
1253
|
-
topPos = null;
|
|
1254
|
-
var pEl = el.parentElement;
|
|
1255
|
-
if (!document.getElementsByTagName('body')[0].className.match(/rtl/)) {
|
|
1256
|
-
leftPos = el.offsetLeft == 0 ? pEl.offsetLeft : el.offsetLeft;
|
|
1257
|
-
topPos = el.offsetTop == 0 ? pEl.offsetTop : el.offsetTop;
|
|
1258
|
-
} else {
|
|
1259
|
-
// width and height in pixels, including padding and border
|
|
1260
|
-
// Corresponds to outerWidth(), outerHeight()
|
|
1261
|
-
leftPos = el.offsetLeft == 0 ? windowWidth - (pEl.offsetLeft + pEl.offsetWidth) : windowWidth - (el.offsetLeft + el.offsetWidth);
|
|
1262
|
-
topPos = el.offsetTop == 0 ? windowWidth - (pEl.offsetTop + pEl.offsetHeight) : windowWidth - (el.offsetTop + el.offsetHeight);
|
|
1263
|
-
}
|
|
1264
|
-
return {
|
|
1265
|
-
'left': leftPos,
|
|
1266
|
-
'top': topPos
|
|
1267
|
-
};
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
/**
|
|
1271
|
-
* Get the current coordinates of the first element in the set of matched elements, relative to the document.
|
|
1272
|
-
*
|
|
1273
|
-
* @param {Element} el - A DOM node containing one selector to match against.
|
|
1274
|
-
* @return {Json} - An object containing the properties top and left.
|
|
1275
|
-
*/
|
|
1276
|
-
function _getOffset(el) {
|
|
1277
|
-
var res = {
|
|
1278
|
-
top: 0,
|
|
1279
|
-
left: 0
|
|
1280
|
-
};
|
|
1281
|
-
var box = el.getBoundingClientRect();
|
|
1282
|
-
var top = 0,
|
|
1283
|
-
left = 0;
|
|
1284
|
-
|
|
1285
|
-
//Include scrollbar and border
|
|
1286
|
-
top = box.top + window.pageYOffset - document.documentElement.clientTop;
|
|
1287
|
-
left = box.left + window.pageXOffset - document.documentElement.clientLeft;
|
|
1288
|
-
res = {
|
|
1289
|
-
top: top,
|
|
1290
|
-
left: left
|
|
1291
|
-
};
|
|
1292
|
-
return res;
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
/**
|
|
1296
|
-
* Get the current coordinates of the first element in the set of matched elements, relative to the offset parent.
|
|
1297
|
-
*
|
|
1298
|
-
* @param {HTMLElement} el - A DOM node containing one selector to match against.
|
|
1299
|
-
* @return {Json} - An object containing the properties top and left.
|
|
1300
|
-
*/
|
|
1301
|
-
function _getPosition(el) {
|
|
1302
|
-
var res = {
|
|
1303
|
-
top: 0,
|
|
1304
|
-
left: 0
|
|
1305
|
-
};
|
|
1306
|
-
var top = el.offsetTop ? el.offsetTop : 0,
|
|
1307
|
-
left = el.offsetLeft ? el.offsetLeft : 0;
|
|
1308
|
-
res = {
|
|
1309
|
-
top: top,
|
|
1310
|
-
left: left
|
|
1311
|
-
};
|
|
1312
|
-
return res;
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
/**
|
|
1316
|
-
* Get the absolute position of the stage element
|
|
1317
|
-
*
|
|
1318
|
-
* @param {HTMLElement} domElement - A DOM node
|
|
1319
|
-
* @param {number | string} left - left offset
|
|
1320
|
-
* @param {number | string} top - top offset
|
|
1321
|
-
* @returns
|
|
1322
|
-
*/
|
|
1323
|
-
function _getAbsolutePositionOfStage(domElement) {
|
|
1324
|
-
var left = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
1325
|
-
var top = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
|
|
1326
|
-
if (!parseInt(left)) {
|
|
1327
|
-
left = 0;
|
|
1328
|
-
} else {
|
|
1329
|
-
left = parseInt(left);
|
|
1330
|
-
}
|
|
1331
|
-
if (!parseInt(top)) {
|
|
1332
|
-
top = 0;
|
|
1333
|
-
} else {
|
|
1334
|
-
top = parseInt(top);
|
|
1335
|
-
}
|
|
1336
|
-
var box = domElement.getBoundingClientRect();
|
|
1337
|
-
var body = document.body;
|
|
1338
|
-
var docElem = document.documentElement;
|
|
1339
|
-
var scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop;
|
|
1340
|
-
var scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft;
|
|
1341
|
-
var clientTop = docElem.clientTop || body.clientTop || 0;
|
|
1342
|
-
var clientLeft = docElem.clientLeft || body.clientLeft || 0;
|
|
1343
|
-
var attr = {};
|
|
1344
|
-
attr.y = box.top + scrollTop - clientTop + top;
|
|
1345
|
-
attr.x = box.left + scrollLeft - clientLeft + left;
|
|
1346
|
-
attr.width = box.width;
|
|
1347
|
-
attr.height = box.height;
|
|
1348
|
-
return attr;
|
|
1349
|
-
}
|
|
1350
|
-
; // CONCATENATED MODULE: ./src/libs/tree.ts
|
|
1351
|
-
function tree_typeof(obj) {
|
|
1352
|
-
"@babel/helpers - typeof";
|
|
1353
|
-
|
|
1354
|
-
return tree_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1355
|
-
return typeof obj;
|
|
1356
|
-
} : function (obj) {
|
|
1357
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1358
|
-
}, tree_typeof(obj);
|
|
1359
|
-
}
|
|
1360
|
-
var _excluded = ["children"];
|
|
1361
|
-
function _objectWithoutProperties(source, excluded) {
|
|
1362
|
-
if (source == null) return {};
|
|
1363
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
1364
|
-
var key, i;
|
|
1365
|
-
if (Object.getOwnPropertySymbols) {
|
|
1366
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
1367
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
1368
|
-
key = sourceSymbolKeys[i];
|
|
1369
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1370
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
1371
|
-
target[key] = source[key];
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
|
-
return target;
|
|
1375
|
-
}
|
|
1376
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
1377
|
-
if (source == null) return {};
|
|
1378
|
-
var target = {};
|
|
1379
|
-
var sourceKeys = Object.keys(source);
|
|
1380
|
-
var key, i;
|
|
1381
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
1382
|
-
key = sourceKeys[i];
|
|
1383
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
1384
|
-
target[key] = source[key];
|
|
1385
|
-
}
|
|
1386
|
-
return target;
|
|
1387
|
-
}
|
|
1388
|
-
function ownKeys(object, enumerableOnly) {
|
|
1389
|
-
var keys = Object.keys(object);
|
|
1390
|
-
if (Object.getOwnPropertySymbols) {
|
|
1391
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
1392
|
-
enumerableOnly && (symbols = symbols.filter(function (sym) {
|
|
1393
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
1394
|
-
})), keys.push.apply(keys, symbols);
|
|
1395
|
-
}
|
|
1396
|
-
return keys;
|
|
1397
|
-
}
|
|
1398
|
-
function _objectSpread(target) {
|
|
1399
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1400
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
1401
|
-
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
|
|
1402
|
-
_defineProperty(target, key, source[key]);
|
|
1403
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
|
|
1404
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
1405
|
-
});
|
|
1406
|
-
}
|
|
1407
|
-
return target;
|
|
1408
|
-
}
|
|
1409
|
-
function _defineProperty(obj, key, value) {
|
|
1410
|
-
key = _toPropertyKey(key);
|
|
1411
|
-
if (key in obj) {
|
|
1412
|
-
Object.defineProperty(obj, key, {
|
|
1413
|
-
value: value,
|
|
1414
|
-
enumerable: true,
|
|
1415
|
-
configurable: true,
|
|
1416
|
-
writable: true
|
|
1417
|
-
});
|
|
1418
|
-
} else {
|
|
1419
|
-
obj[key] = value;
|
|
1420
|
-
}
|
|
1421
|
-
return obj;
|
|
1422
|
-
}
|
|
1423
|
-
function _toPropertyKey(arg) {
|
|
1424
|
-
var key = _toPrimitive(arg, "string");
|
|
1425
|
-
return tree_typeof(key) === "symbol" ? key : String(key);
|
|
1426
|
-
}
|
|
1427
|
-
function _toPrimitive(input, hint) {
|
|
1428
|
-
if (tree_typeof(input) !== "object" || input === null) return input;
|
|
1429
|
-
var prim = input[Symbol.toPrimitive];
|
|
1430
|
-
if (prim !== undefined) {
|
|
1431
|
-
var res = prim.call(input, hint || "default");
|
|
1432
|
-
if (tree_typeof(res) !== "object") return res;
|
|
1433
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1434
|
-
}
|
|
1435
|
-
return (hint === "string" ? String : Number)(input);
|
|
1436
|
-
}
|
|
1437
|
-
function tree_toConsumableArray(arr) {
|
|
1438
|
-
return tree_arrayWithoutHoles(arr) || tree_iterableToArray(arr) || tree_unsupportedIterableToArray(arr) || tree_nonIterableSpread();
|
|
1439
|
-
}
|
|
1440
|
-
function tree_nonIterableSpread() {
|
|
1441
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1442
|
-
}
|
|
1443
|
-
function tree_unsupportedIterableToArray(o, minLen) {
|
|
1444
|
-
if (!o) return;
|
|
1445
|
-
if (typeof o === "string") return tree_arrayLikeToArray(o, minLen);
|
|
1446
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
1447
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
1448
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
1449
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return tree_arrayLikeToArray(o, minLen);
|
|
1450
|
-
}
|
|
1451
|
-
function tree_iterableToArray(iter) {
|
|
1452
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
1453
|
-
}
|
|
1454
|
-
function tree_arrayWithoutHoles(arr) {
|
|
1455
|
-
if (Array.isArray(arr)) return tree_arrayLikeToArray(arr);
|
|
1456
|
-
}
|
|
1457
|
-
function tree_arrayLikeToArray(arr, len) {
|
|
1458
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
1459
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
1460
|
-
return arr2;
|
|
1461
|
-
}
|
|
1462
|
-
function _objectDestructuringEmpty(obj) {
|
|
1463
|
-
if (obj == null) throw new TypeError("Cannot destructure " + obj);
|
|
1464
|
-
}
|
|
1465
|
-
function _extends() {
|
|
1466
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1467
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
1468
|
-
var source = arguments[i];
|
|
1469
|
-
for (var key in source) {
|
|
1470
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1471
|
-
target[key] = source[key];
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
}
|
|
1475
|
-
return target;
|
|
1476
|
-
};
|
|
1477
|
-
return _extends.apply(this, arguments);
|
|
1478
|
-
}
|
|
1479
|
-
/**
|
|
1480
|
-
* Convert Tree
|
|
1481
|
-
* @param {Array} arr - Flat array
|
|
1482
|
-
* @param {?string | ?number} parentId - Parent id
|
|
1483
|
-
* @param {?string} keyId - Key value of id.
|
|
1484
|
-
* @param {?string} keyParentId - Key value of parent id.
|
|
1485
|
-
* @returns Array
|
|
1486
|
-
*/
|
|
1487
|
-
function _convertTree(arr) {
|
|
1488
|
-
var parentId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
1489
|
-
var keyId = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'id';
|
|
1490
|
-
var keyParentId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'parent_id';
|
|
1491
|
-
if (!parentId) {
|
|
1492
|
-
// If there is no parent id (when recursing for the first time), all parents will be queried
|
|
1493
|
-
return arr.filter(function (item) {
|
|
1494
|
-
return !item[keyParentId];
|
|
1495
|
-
}).map(function (item) {
|
|
1496
|
-
// Query all child nodes by parent node ID
|
|
1497
|
-
item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
|
|
1498
|
-
return item;
|
|
1499
|
-
});
|
|
1500
|
-
} else {
|
|
1501
|
-
return arr.filter(function (item) {
|
|
1502
|
-
return item[keyParentId] === parentId;
|
|
1503
|
-
}).map(function (item) {
|
|
1504
|
-
// Query all child nodes by parent node ID
|
|
1505
|
-
item.children = _convertTree(arr, item[keyId], keyId, keyParentId);
|
|
1506
|
-
return item;
|
|
1507
|
-
});
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
|
|
1511
|
-
/**
|
|
1512
|
-
* Flat tree
|
|
1513
|
-
* @param {Array} arr - Hierarchical array
|
|
1514
|
-
* @returns Array
|
|
1515
|
-
*/
|
|
1516
|
-
function _flatTree(arr) {
|
|
1517
|
-
var flatData = function flatData(_ref) {
|
|
1518
|
-
var rest = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
|
|
1519
|
-
var _rest$children = rest.children,
|
|
1520
|
-
children = _rest$children === void 0 ? [] : _rest$children;
|
|
1521
|
-
return [_objectSpread({}, rest)].concat(tree_toConsumableArray(children.flatMap(flatData)));
|
|
1522
|
-
};
|
|
1523
|
-
var result = arr.flatMap(flatData);
|
|
1524
|
-
|
|
1525
|
-
//remove children from item
|
|
1526
|
-
result = result.map(function (item) {
|
|
1527
|
-
delete item.children;
|
|
1528
|
-
return item;
|
|
1529
|
-
});
|
|
1530
|
-
return result;
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
/**
|
|
1534
|
-
* Get all depth
|
|
1535
|
-
* @param {Object} node
|
|
1536
|
-
* @returns Number
|
|
1537
|
-
*/
|
|
1538
|
-
function _getAllDepth(arr) {
|
|
1539
|
-
var count = function count(children) {
|
|
1540
|
-
return children.reduce(function (depth, child) {
|
|
1541
|
-
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
|
|
1542
|
-
}, 0); //default value 0 that's returned if there are no children
|
|
1543
|
-
};
|
|
1544
|
-
|
|
1545
|
-
return count(arr);
|
|
1546
|
-
}
|
|
1547
|
-
|
|
1548
|
-
/**
|
|
1549
|
-
* Add depth to each item in the tree
|
|
1550
|
-
* @param {Array} arr - Hierarchical array
|
|
1551
|
-
* @param {?string} keyId - Key value of id.
|
|
1552
|
-
* @param {?string} keyParentId - Key value of parent id.
|
|
1553
|
-
* @param {?number} depth - Depth of the item.
|
|
1554
|
-
* @returns Number
|
|
1555
|
-
*/
|
|
1556
|
-
function _addTreeDepth(arr) {
|
|
1557
|
-
var keyId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'id';
|
|
1558
|
-
var parentItem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
1559
|
-
var depth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
1560
|
-
return arr.reduce(function (acc, el) {
|
|
1561
|
-
var children = el.children,
|
|
1562
|
-
otherProps = _objectWithoutProperties(el, _excluded);
|
|
1563
|
-
acc.push(_objectSpread(_objectSpread({}, otherProps), {}, {
|
|
1564
|
-
parentItem: parentItem,
|
|
1565
|
-
depth: depth
|
|
1566
|
-
}));
|
|
1567
|
-
if (children) {
|
|
1568
|
-
return acc.concat(_addTreeDepth(children, keyId, el[keyId], depth + 1));
|
|
1569
|
-
}
|
|
1570
|
-
return acc;
|
|
1571
|
-
}, []);
|
|
1572
|
-
}
|
|
1573
|
-
|
|
1574
|
-
/**
|
|
1575
|
-
* Add indent placeholder
|
|
1576
|
-
* @param {Array} arr - Flat array
|
|
1577
|
-
* @param {?string} placeholder - String of placeholder
|
|
1578
|
-
* @param {?string} lastPlaceholder - Last String of placeholder
|
|
1579
|
-
* @param {?string} keyName - Key value of name.
|
|
1580
|
-
* @returns Array
|
|
1581
|
-
*/
|
|
1582
|
-
function _addTreeIndent(arr) {
|
|
1583
|
-
var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ' ';
|
|
1584
|
-
var lastPlaceholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
1585
|
-
var keyName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
|
|
1586
|
-
arr.forEach(function (item) {
|
|
1587
|
-
var indent = '';
|
|
1588
|
-
if (item.depth) {
|
|
1589
|
-
Array(item.depth).fill(0).forEach(function (k, i) {
|
|
1590
|
-
indent += placeholder;
|
|
1591
|
-
if (i === item.depth - 1) {
|
|
1592
|
-
item[keyName] = indent + lastPlaceholder + item[keyName];
|
|
1593
|
-
}
|
|
1594
|
-
});
|
|
1595
|
-
}
|
|
1596
|
-
});
|
|
1597
|
-
}
|
|
1598
|
-
; // CONCATENATED MODULE: ./src/libs/buffer.ts
|
|
1599
|
-
function _regeneratorRuntime() {
|
|
1600
|
-
"use strict";
|
|
1601
|
-
|
|
1602
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1603
|
-
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
1604
|
-
return exports;
|
|
1605
|
-
};
|
|
1606
|
-
var exports = {},
|
|
1607
|
-
Op = Object.prototype,
|
|
1608
|
-
hasOwn = Op.hasOwnProperty,
|
|
1609
|
-
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
1610
|
-
obj[key] = desc.value;
|
|
1611
|
-
},
|
|
1612
|
-
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
1613
|
-
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
1614
|
-
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
1615
|
-
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
1616
|
-
function define(obj, key, value) {
|
|
1617
|
-
return Object.defineProperty(obj, key, {
|
|
1618
|
-
value: value,
|
|
1619
|
-
enumerable: !0,
|
|
1620
|
-
configurable: !0,
|
|
1621
|
-
writable: !0
|
|
1622
|
-
}), obj[key];
|
|
1623
|
-
}
|
|
1624
|
-
try {
|
|
1625
|
-
define({}, "");
|
|
1626
|
-
} catch (err) {
|
|
1627
|
-
define = function define(obj, key, value) {
|
|
1628
|
-
return obj[key] = value;
|
|
1629
|
-
};
|
|
1630
|
-
}
|
|
1631
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
1632
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
1633
|
-
generator = Object.create(protoGenerator.prototype),
|
|
1634
|
-
context = new Context(tryLocsList || []);
|
|
1635
|
-
return defineProperty(generator, "_invoke", {
|
|
1636
|
-
value: makeInvokeMethod(innerFn, self, context)
|
|
1637
|
-
}), generator;
|
|
1638
|
-
}
|
|
1639
|
-
function tryCatch(fn, obj, arg) {
|
|
1640
|
-
try {
|
|
1641
|
-
return {
|
|
1642
|
-
type: "normal",
|
|
1643
|
-
arg: fn.call(obj, arg)
|
|
1644
|
-
};
|
|
1645
|
-
} catch (err) {
|
|
1646
|
-
return {
|
|
1647
|
-
type: "throw",
|
|
1648
|
-
arg: err
|
|
1649
|
-
};
|
|
1650
|
-
}
|
|
1651
|
-
}
|
|
1652
|
-
exports.wrap = wrap;
|
|
1653
|
-
var ContinueSentinel = {};
|
|
1654
|
-
function Generator() {}
|
|
1655
|
-
function GeneratorFunction() {}
|
|
1656
|
-
function GeneratorFunctionPrototype() {}
|
|
1657
|
-
var IteratorPrototype = {};
|
|
1658
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
1659
|
-
return this;
|
|
1660
|
-
});
|
|
1661
|
-
var getProto = Object.getPrototypeOf,
|
|
1662
|
-
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
1663
|
-
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
1664
|
-
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
1665
|
-
function defineIteratorMethods(prototype) {
|
|
1666
|
-
["next", "throw", "return"].forEach(function (method) {
|
|
1667
|
-
define(prototype, method, function (arg) {
|
|
1668
|
-
return this._invoke(method, arg);
|
|
1669
|
-
});
|
|
1670
|
-
});
|
|
1671
|
-
}
|
|
1672
|
-
function AsyncIterator(generator, PromiseImpl) {
|
|
1673
|
-
function invoke(method, arg, resolve, reject) {
|
|
1674
|
-
var record = tryCatch(generator[method], generator, arg);
|
|
1675
|
-
if ("throw" !== record.type) {
|
|
1676
|
-
var result = record.arg,
|
|
1677
|
-
value = result.value;
|
|
1678
|
-
return value && "object" == buffer_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
1679
|
-
invoke("next", value, resolve, reject);
|
|
1680
|
-
}, function (err) {
|
|
1681
|
-
invoke("throw", err, resolve, reject);
|
|
1682
|
-
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
1683
|
-
result.value = unwrapped, resolve(result);
|
|
1684
|
-
}, function (error) {
|
|
1685
|
-
return invoke("throw", error, resolve, reject);
|
|
1686
|
-
});
|
|
1687
|
-
}
|
|
1688
|
-
reject(record.arg);
|
|
1689
|
-
}
|
|
1690
|
-
var previousPromise;
|
|
1691
|
-
defineProperty(this, "_invoke", {
|
|
1692
|
-
value: function value(method, arg) {
|
|
1693
|
-
function callInvokeWithMethodAndArg() {
|
|
1694
|
-
return new PromiseImpl(function (resolve, reject) {
|
|
1695
|
-
invoke(method, arg, resolve, reject);
|
|
1696
|
-
});
|
|
1697
|
-
}
|
|
1698
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
1699
|
-
}
|
|
1700
|
-
});
|
|
1701
|
-
}
|
|
1702
|
-
function makeInvokeMethod(innerFn, self, context) {
|
|
1703
|
-
var state = "suspendedStart";
|
|
1704
|
-
return function (method, arg) {
|
|
1705
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
1706
|
-
if ("completed" === state) {
|
|
1707
|
-
if ("throw" === method) throw arg;
|
|
1708
|
-
return doneResult();
|
|
1709
|
-
}
|
|
1710
|
-
for (context.method = method, context.arg = arg;;) {
|
|
1711
|
-
var delegate = context.delegate;
|
|
1712
|
-
if (delegate) {
|
|
1713
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
1714
|
-
if (delegateResult) {
|
|
1715
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
1716
|
-
return delegateResult;
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
1720
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
1721
|
-
context.dispatchException(context.arg);
|
|
1722
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
1723
|
-
state = "executing";
|
|
1724
|
-
var record = tryCatch(innerFn, self, context);
|
|
1725
|
-
if ("normal" === record.type) {
|
|
1726
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
1727
|
-
return {
|
|
1728
|
-
value: record.arg,
|
|
1729
|
-
done: context.done
|
|
1730
|
-
};
|
|
1731
|
-
}
|
|
1732
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
1733
|
-
}
|
|
1734
|
-
};
|
|
1735
|
-
}
|
|
1736
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
1737
|
-
var methodName = context.method,
|
|
1738
|
-
method = delegate.iterator[methodName];
|
|
1739
|
-
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;
|
|
1740
|
-
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
1741
|
-
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
1742
|
-
var info = record.arg;
|
|
1743
|
-
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);
|
|
1744
|
-
}
|
|
1745
|
-
function pushTryEntry(locs) {
|
|
1746
|
-
var entry = {
|
|
1747
|
-
tryLoc: locs[0]
|
|
1748
|
-
};
|
|
1749
|
-
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
1750
|
-
}
|
|
1751
|
-
function resetTryEntry(entry) {
|
|
1752
|
-
var record = entry.completion || {};
|
|
1753
|
-
record.type = "normal", delete record.arg, entry.completion = record;
|
|
1754
|
-
}
|
|
1755
|
-
function Context(tryLocsList) {
|
|
1756
|
-
this.tryEntries = [{
|
|
1757
|
-
tryLoc: "root"
|
|
1758
|
-
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
1759
|
-
}
|
|
1760
|
-
function values(iterable) {
|
|
1761
|
-
if (iterable) {
|
|
1762
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
1763
|
-
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
1764
|
-
if ("function" == typeof iterable.next) return iterable;
|
|
1765
|
-
if (!isNaN(iterable.length)) {
|
|
1766
|
-
var i = -1,
|
|
1767
|
-
next = function next() {
|
|
1768
|
-
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
1769
|
-
return next.value = undefined, next.done = !0, next;
|
|
1770
|
-
};
|
|
1771
|
-
return next.next = next;
|
|
1772
|
-
}
|
|
1773
|
-
}
|
|
1774
|
-
return {
|
|
1775
|
-
next: doneResult
|
|
1776
|
-
};
|
|
1777
|
-
}
|
|
1778
|
-
function doneResult() {
|
|
1779
|
-
return {
|
|
1780
|
-
value: undefined,
|
|
1781
|
-
done: !0
|
|
1782
|
-
};
|
|
1783
|
-
}
|
|
1784
|
-
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
1785
|
-
value: GeneratorFunctionPrototype,
|
|
1786
|
-
configurable: !0
|
|
1787
|
-
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
1788
|
-
value: GeneratorFunction,
|
|
1789
|
-
configurable: !0
|
|
1790
|
-
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
1791
|
-
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
1792
|
-
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
1793
|
-
}, exports.mark = function (genFun) {
|
|
1794
|
-
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
1795
|
-
}, exports.awrap = function (arg) {
|
|
1796
|
-
return {
|
|
1797
|
-
__await: arg
|
|
1798
|
-
};
|
|
1799
|
-
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
1800
|
-
return this;
|
|
1801
|
-
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
1802
|
-
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
1803
|
-
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
1804
|
-
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
1805
|
-
return result.done ? result.value : iter.next();
|
|
1806
|
-
});
|
|
1807
|
-
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
1808
|
-
return this;
|
|
1809
|
-
}), define(Gp, "toString", function () {
|
|
1810
|
-
return "[object Generator]";
|
|
1811
|
-
}), exports.keys = function (val) {
|
|
1812
|
-
var object = Object(val),
|
|
1813
|
-
keys = [];
|
|
1814
|
-
for (var key in object) keys.push(key);
|
|
1815
|
-
return keys.reverse(), function next() {
|
|
1816
|
-
for (; keys.length;) {
|
|
1817
|
-
var key = keys.pop();
|
|
1818
|
-
if (key in object) return next.value = key, next.done = !1, next;
|
|
1819
|
-
}
|
|
1820
|
-
return next.done = !0, next;
|
|
1821
|
-
};
|
|
1822
|
-
}, exports.values = values, Context.prototype = {
|
|
1823
|
-
constructor: Context,
|
|
1824
|
-
reset: function reset(skipTempReset) {
|
|
1825
|
-
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);
|
|
1826
|
-
},
|
|
1827
|
-
stop: function stop() {
|
|
1828
|
-
this.done = !0;
|
|
1829
|
-
var rootRecord = this.tryEntries[0].completion;
|
|
1830
|
-
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
1831
|
-
return this.rval;
|
|
1832
|
-
},
|
|
1833
|
-
dispatchException: function dispatchException(exception) {
|
|
1834
|
-
if (this.done) throw exception;
|
|
1835
|
-
var context = this;
|
|
1836
|
-
function handle(loc, caught) {
|
|
1837
|
-
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
1838
|
-
}
|
|
1839
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1840
|
-
var entry = this.tryEntries[i],
|
|
1841
|
-
record = entry.completion;
|
|
1842
|
-
if ("root" === entry.tryLoc) return handle("end");
|
|
1843
|
-
if (entry.tryLoc <= this.prev) {
|
|
1844
|
-
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
1845
|
-
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
1846
|
-
if (hasCatch && hasFinally) {
|
|
1847
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1848
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1849
|
-
} else if (hasCatch) {
|
|
1850
|
-
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
1851
|
-
} else {
|
|
1852
|
-
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
1853
|
-
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
1854
|
-
}
|
|
1855
|
-
}
|
|
1856
|
-
}
|
|
1857
|
-
},
|
|
1858
|
-
abrupt: function abrupt(type, arg) {
|
|
1859
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1860
|
-
var entry = this.tryEntries[i];
|
|
1861
|
-
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
1862
|
-
var finallyEntry = entry;
|
|
1863
|
-
break;
|
|
1864
|
-
}
|
|
1865
|
-
}
|
|
1866
|
-
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
1867
|
-
var record = finallyEntry ? finallyEntry.completion : {};
|
|
1868
|
-
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
1869
|
-
},
|
|
1870
|
-
complete: function complete(record, afterLoc) {
|
|
1871
|
-
if ("throw" === record.type) throw record.arg;
|
|
1872
|
-
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;
|
|
1873
|
-
},
|
|
1874
|
-
finish: function finish(finallyLoc) {
|
|
1875
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1876
|
-
var entry = this.tryEntries[i];
|
|
1877
|
-
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
1878
|
-
}
|
|
1879
|
-
},
|
|
1880
|
-
"catch": function _catch(tryLoc) {
|
|
1881
|
-
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
1882
|
-
var entry = this.tryEntries[i];
|
|
1883
|
-
if (entry.tryLoc === tryLoc) {
|
|
1884
|
-
var record = entry.completion;
|
|
1885
|
-
if ("throw" === record.type) {
|
|
1886
|
-
var thrown = record.arg;
|
|
1887
|
-
resetTryEntry(entry);
|
|
1888
|
-
}
|
|
1889
|
-
return thrown;
|
|
1890
|
-
}
|
|
1891
|
-
}
|
|
1892
|
-
throw new Error("illegal catch attempt");
|
|
1893
|
-
},
|
|
1894
|
-
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
1895
|
-
return this.delegate = {
|
|
1896
|
-
iterator: values(iterable),
|
|
1897
|
-
resultName: resultName,
|
|
1898
|
-
nextLoc: nextLoc
|
|
1899
|
-
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
1900
|
-
}
|
|
1901
|
-
}, exports;
|
|
1902
|
-
}
|
|
1903
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1904
|
-
try {
|
|
1905
|
-
var info = gen[key](arg);
|
|
1906
|
-
var value = info.value;
|
|
1907
|
-
} catch (error) {
|
|
1908
|
-
reject(error);
|
|
1909
|
-
return;
|
|
1910
|
-
}
|
|
1911
|
-
if (info.done) {
|
|
1912
|
-
resolve(value);
|
|
1913
|
-
} else {
|
|
1914
|
-
Promise.resolve(value).then(_next, _throw);
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
function _asyncToGenerator(fn) {
|
|
1918
|
-
return function () {
|
|
1919
|
-
var self = this,
|
|
1920
|
-
args = arguments;
|
|
1921
|
-
return new Promise(function (resolve, reject) {
|
|
1922
|
-
var gen = fn.apply(self, args);
|
|
1923
|
-
function _next(value) {
|
|
1924
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
1925
|
-
}
|
|
1926
|
-
function _throw(err) {
|
|
1927
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1928
|
-
}
|
|
1929
|
-
_next(undefined);
|
|
1930
|
-
});
|
|
1931
|
-
};
|
|
1932
|
-
}
|
|
1933
|
-
function buffer_typeof(obj) {
|
|
1934
|
-
"@babel/helpers - typeof";
|
|
1935
|
-
|
|
1936
|
-
return buffer_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
1937
|
-
return typeof obj;
|
|
1938
|
-
} : function (obj) {
|
|
1939
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
1940
|
-
}, buffer_typeof(obj);
|
|
1941
|
-
}
|
|
1942
|
-
/**
|
|
1943
|
-
* base64 to ArrayBuffer
|
|
1944
|
-
* @param {String} data
|
|
1945
|
-
* @returns {ArrayBuffer}
|
|
1946
|
-
*/
|
|
1947
|
-
/*
|
|
1948
|
-
@returns:
|
|
1949
|
-
|
|
1950
|
-
ArrayBuffer(522240)
|
|
1951
|
-
|
|
1952
|
-
byteLength: 522240
|
|
1953
|
-
detached: false
|
|
1954
|
-
maxByteLength: 522240
|
|
1955
|
-
resizable: false
|
|
1956
|
-
[[Prototype]]: ArrayBuffer
|
|
1957
|
-
[[Int8Array]]: Int8Array(522240)
|
|
1958
|
-
[[Uint8Array]]: Uint8Array(522240)
|
|
1959
|
-
[[Int16Array]]: Int16Array(261120)
|
|
1960
|
-
[[Int32Array]]: Int32Array(130560)
|
|
1961
|
-
[[ArrayBufferByteLength]]: 522240
|
|
1962
|
-
[[ArrayBufferData]]: 673
|
|
1963
|
-
*/
|
|
1964
|
-
function _base64ToArrayBuffer(data) {
|
|
1965
|
-
var res = data;
|
|
1966
|
-
if (data.indexOf('base64,') >= 0) {
|
|
1967
|
-
res = data.split('base64,')[1];
|
|
1968
|
-
}
|
|
1969
|
-
var binaryString = atob(res);
|
|
1970
|
-
var bytes = new Uint8Array(binaryString.length);
|
|
1971
|
-
for (var i = 0; i < binaryString.length; i++) {
|
|
1972
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
1973
|
-
}
|
|
1974
|
-
return bytes.buffer;
|
|
1975
|
-
}
|
|
1976
|
-
|
|
1977
|
-
/**
|
|
1978
|
-
* ArrayBuffer to Uint8Array
|
|
1979
|
-
* @param {ArrayBuffer} data
|
|
1980
|
-
* @returns {Uint8Array}
|
|
1981
|
-
*/
|
|
1982
|
-
/*
|
|
1983
|
-
@returns:
|
|
1984
|
-
|
|
1985
|
-
Uint8Array(522240) [208, 207, 17, 224, 161, 177, 26, 225, 0, 0, ......]
|
|
1986
|
-
*/
|
|
1987
|
-
function _arrayBufferToUint8Array(data) {
|
|
1988
|
-
return new Uint8Array(data);
|
|
1989
|
-
}
|
|
1990
|
-
|
|
1991
|
-
/**
|
|
1992
|
-
* uint8array to array
|
|
1993
|
-
* @param {Uint8Array} data
|
|
1994
|
-
* @returns {Array}
|
|
1995
|
-
*/
|
|
1996
|
-
function _uint8arrayToArr(data) {
|
|
1997
|
-
return Array.from(data);
|
|
1998
|
-
}
|
|
1999
|
-
|
|
2000
|
-
/**
|
|
2001
|
-
* array to uint8array
|
|
2002
|
-
* @param {Array} data
|
|
2003
|
-
* @returns {Uint8Array}
|
|
2004
|
-
*/
|
|
2005
|
-
/* Example:
|
|
2006
|
-
|
|
2007
|
-
axios({
|
|
2008
|
-
method: 'get',
|
|
2009
|
-
url: 'http://xxxx',
|
|
2010
|
-
responseType: 'arraybuffer'
|
|
2011
|
-
})
|
|
2012
|
-
.then(function (res) {
|
|
2013
|
-
//res.data ==> ArrayBuffer(xxxx)
|
|
2014
|
-
const b64string = uint8arrayToBase64Str(res.data);
|
|
2015
|
-
const uint8ArrayData = arrayToUint8array(res.data);
|
|
2016
|
-
|
|
2017
|
-
// do something
|
|
2018
|
-
|
|
2019
|
-
});
|
|
2020
|
-
*/
|
|
2021
|
-
function _arrayToUint8array(data) {
|
|
2022
|
-
return new Uint8Array(data);
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
/**
|
|
2026
|
-
* uint8array to base64 string
|
|
2027
|
-
* @param {Uint8Array|Array} data
|
|
2028
|
-
* @returns {String}
|
|
2029
|
-
*/
|
|
2030
|
-
function _uint8arrayToBase64Str(data) {
|
|
2031
|
-
if ((typeof Buffer === "undefined" ? "undefined" : buffer_typeof(Buffer)) !== ( true ? "undefined" : 0)) {
|
|
2032
|
-
return Buffer.from(data, 'binary').toString('base64'); // node.js too
|
|
2033
|
-
} else {
|
|
2034
|
-
var binary = '';
|
|
2035
|
-
var bytes = new Uint8Array(data);
|
|
2036
|
-
var len = bytes.byteLength;
|
|
2037
|
-
for (var i = 0; i < len; i++) {
|
|
2038
|
-
binary += String.fromCharCode(bytes[i]);
|
|
2039
|
-
}
|
|
2040
|
-
return window.btoa(binary);
|
|
2041
|
-
}
|
|
2042
|
-
}
|
|
2043
|
-
|
|
2044
|
-
/**
|
|
2045
|
-
* decode base64 string
|
|
2046
|
-
* @param {String} data
|
|
2047
|
-
* @returns {String}
|
|
2048
|
-
*/
|
|
2049
|
-
function _decodeBase64Str(data) {
|
|
2050
|
-
// avoid messy code
|
|
2051
|
-
// especially for Chinese, avoid using encodeURIComponent() and encodeURI()
|
|
2052
|
-
var decoded = decodeURIComponent(escape(atob(data)));
|
|
2053
|
-
return decoded;
|
|
2054
|
-
}
|
|
2055
|
-
|
|
2056
|
-
/**
|
|
2057
|
-
* integer to binary
|
|
2058
|
-
* @param {Number} data
|
|
2059
|
-
* @returns {String}
|
|
2060
|
-
*/
|
|
2061
|
-
function _toBinary(data) {
|
|
2062
|
-
if (!Number.isSafeInteger(data)) {
|
|
2063
|
-
throw new TypeError('value must be a safe integer');
|
|
2064
|
-
}
|
|
2065
|
-
return (data >>> 0).toString(2);
|
|
2066
|
-
}
|
|
2067
|
-
|
|
2068
|
-
/**
|
|
2069
|
-
* array to blob
|
|
2070
|
-
* @param {Uint8Array} uint8ArrayData
|
|
2071
|
-
* @returns {Blob}
|
|
2072
|
-
*/
|
|
2073
|
-
function _arrayToBlob(uint8ArrayData) {
|
|
2074
|
-
return new Blob([uint8ArrayData], {
|
|
2075
|
-
type: "text/plain"
|
|
2076
|
-
});
|
|
2077
|
-
}
|
|
2078
|
-
|
|
2079
|
-
/**
|
|
2080
|
-
* blob to uint8array
|
|
2081
|
-
* @param {Blob} data
|
|
2082
|
-
* @returns {Uint8Array}
|
|
2083
|
-
*/
|
|
2084
|
-
function _blobToUint8array(data) {
|
|
2085
|
-
return new Promise(function (resolve, reject) {
|
|
2086
|
-
var reader = new FileReader();
|
|
2087
|
-
reader.addEventListener("loadend", function () {
|
|
2088
|
-
resolve(reader.result);
|
|
2089
|
-
});
|
|
2090
|
-
reader.readAsArrayBuffer(data);
|
|
2091
|
-
});
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
/**
|
|
2095
|
-
* array to stream
|
|
2096
|
-
* @param {Array<Uint8Array>} data
|
|
2097
|
-
* @returns {ReadableStream }
|
|
2098
|
-
*/
|
|
2099
|
-
/* Example:
|
|
2100
|
-
|
|
2101
|
-
const uint8ArrayDataArr = [
|
|
2102
|
-
[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]
|
|
2103
|
-
];
|
|
2104
|
-
const readableStream = arrayToStream(uint8ArrayDataArr);
|
|
2105
|
-
|
|
2106
|
-
*/
|
|
2107
|
-
function _arrayToStream(data) {
|
|
2108
|
-
// @return --> ReadableStream {locked: false}
|
|
2109
|
-
return new ReadableStream({
|
|
2110
|
-
start: function start(controller) {
|
|
2111
|
-
// push a chunk
|
|
2112
|
-
data.forEach(function (chunk) {
|
|
2113
|
-
controller.enqueue(new Uint8Array(chunk));
|
|
2114
|
-
});
|
|
2115
|
-
},
|
|
2116
|
-
pull: function pull(controller) {
|
|
2117
|
-
// Called `read()` when the controller's queue is empty.
|
|
2118
|
-
//controller.enqueue(...);
|
|
2119
|
-
controller.close();
|
|
2120
|
-
},
|
|
2121
|
-
cancel: function cancel(reason) {
|
|
2122
|
-
// Called when the stream is canceled.
|
|
2123
|
-
}
|
|
2124
|
-
});
|
|
2125
|
-
}
|
|
2126
|
-
|
|
2127
|
-
/**
|
|
2128
|
-
* read stream
|
|
2129
|
-
* @param {ReadableStream } data
|
|
2130
|
-
* @returns {Promise}
|
|
2131
|
-
*/
|
|
2132
|
-
/* Example:
|
|
2133
|
-
|
|
2134
|
-
readStream(readableStream).then((value) => {
|
|
2135
|
-
console.log(value);
|
|
2136
|
-
// iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAYAAAA7MK6iAAAA3ElEQVRIx+3WUQ7CIAwAUDyA19sxHFt2CjfYNbyEiScTR4JLRSqUwkx0H/1ZKG/paJkwxohvhNjh/4aPl6ZUHJaYlxiez7aCLWpcDFvBEF3x2nAItXGuCaPoWuqC3zKGji+HCyTYtzkxUR1DfXh0C+4MPAmF8OQttHhbC4VwH0iwuGSiE5YDS52Lk9HQ4eqIuMpBsXaSyGayFPqpjzG8K4HGBoh0ZfY3vyGoonRBbHJhOAtNHZltBFc5wyZ1Vl9LohQ4VHLNmemU2wnimnuDUa9FySnvG7z/3v40/ADq/bpZ3uFJ/AAAAABJRU5ErkJggg==
|
|
2137
|
-
|
|
2138
|
-
// test: <img src="data:image/png;base64,iVBORw0KGgo..." >
|
|
2139
|
-
|
|
2140
|
-
});
|
|
2141
|
-
*/
|
|
2142
|
-
function _readStream2(_x) {
|
|
2143
|
-
return _readStream.apply(this, arguments);
|
|
2144
|
-
}
|
|
2145
|
-
function _readStream() {
|
|
2146
|
-
_readStream = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
2147
|
-
var resReceived, stream, readInto;
|
|
2148
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2149
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
2150
|
-
case 0:
|
|
2151
|
-
resReceived = '';
|
|
2152
|
-
stream = data; // ReadableStream {locked: false}
|
|
2153
|
-
readInto = /*#__PURE__*/function () {
|
|
2154
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(stream) {
|
|
2155
|
-
var reader, pump, _pump;
|
|
2156
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2157
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
2158
|
-
case 0:
|
|
2159
|
-
_pump = function _pump3() {
|
|
2160
|
-
_pump = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2161
|
-
var _yield$reader$read, done, value, base64String;
|
|
2162
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2163
|
-
while (1) switch (_context.prev = _context.next) {
|
|
2164
|
-
case 0:
|
|
2165
|
-
_context.next = 2;
|
|
2166
|
-
return reader.read();
|
|
2167
|
-
case 2:
|
|
2168
|
-
_yield$reader$read = _context.sent;
|
|
2169
|
-
done = _yield$reader$read.done;
|
|
2170
|
-
value = _yield$reader$read.value;
|
|
2171
|
-
if (!done) {
|
|
2172
|
-
_context.next = 7;
|
|
2173
|
-
break;
|
|
2174
|
-
}
|
|
2175
|
-
return _context.abrupt("return");
|
|
2176
|
-
case 7:
|
|
2177
|
-
// value for fetch streams is a Uint8Array
|
|
2178
|
-
base64String = _uint8arrayToBase64Str(value);
|
|
2179
|
-
resReceived += base64String;
|
|
2180
|
-
return _context.abrupt("return", pump());
|
|
2181
|
-
case 10:
|
|
2182
|
-
case "end":
|
|
2183
|
-
return _context.stop();
|
|
2184
|
-
}
|
|
2185
|
-
}, _callee);
|
|
2186
|
-
}));
|
|
2187
|
-
return _pump.apply(this, arguments);
|
|
2188
|
-
};
|
|
2189
|
-
pump = function _pump2() {
|
|
2190
|
-
return _pump.apply(this, arguments);
|
|
2191
|
-
};
|
|
2192
|
-
reader = stream.getReader();
|
|
2193
|
-
return _context2.abrupt("return", pump());
|
|
2194
|
-
case 4:
|
|
2195
|
-
case "end":
|
|
2196
|
-
return _context2.stop();
|
|
2197
|
-
}
|
|
2198
|
-
}, _callee2);
|
|
2199
|
-
}));
|
|
2200
|
-
return function readInto(_x2) {
|
|
2201
|
-
return _ref.apply(this, arguments);
|
|
2202
|
-
};
|
|
2203
|
-
}();
|
|
2204
|
-
_context3.next = 5;
|
|
2205
|
-
return readInto(stream);
|
|
2206
|
-
case 5:
|
|
2207
|
-
return _context3.abrupt("return", resReceived);
|
|
2208
|
-
case 6:
|
|
2209
|
-
case "end":
|
|
2210
|
-
return _context3.stop();
|
|
2211
|
-
}
|
|
2212
|
-
}, _callee3);
|
|
2213
|
-
}));
|
|
2214
|
-
return _readStream.apply(this, arguments);
|
|
2215
|
-
}
|
|
2216
|
-
; // CONCATENATED MODULE: ./src/libs/convert.ts
|
|
2217
|
-
/**
|
|
2218
|
-
* Convert value to string separated by square brackets
|
|
2219
|
-
* @param {string} str such as: 1,2,3
|
|
2220
|
-
* @returns {string} such as: [1][2][3]
|
|
2221
|
-
*/
|
|
2222
|
-
function _convertStringByCommaToValByBrackets(str) {
|
|
2223
|
-
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2224
|
-
return '';
|
|
2225
|
-
}
|
|
2226
|
-
return str.split(',').map(function (v) {
|
|
2227
|
-
return v.toString().includes('[') && v.toString().includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
2228
|
-
}).join('');
|
|
2229
|
-
}
|
|
2230
|
-
|
|
2231
|
-
/**
|
|
2232
|
-
* Convert array value to string separated by square brackets
|
|
2233
|
-
* @param {string[]} arr such as: ['1','2','3']
|
|
2234
|
-
* @returns {string} such as: [1][2][3]
|
|
2235
|
-
*/
|
|
2236
|
-
function _convertArrToValByBrackets(arr) {
|
|
2237
|
-
if (!Array.isArray(arr)) return '';
|
|
2238
|
-
return arr.map(function (v) {
|
|
2239
|
-
return v.toString().includes('[') && v.toString().includes(']') ? "".concat(v) : "[".concat(v, "]");
|
|
2240
|
-
}).join('');
|
|
2241
|
-
}
|
|
2242
|
-
|
|
2243
|
-
/**
|
|
2244
|
-
* Convert value to string separated by curly braces
|
|
2245
|
-
* @param {string} str such as: 1,2,3
|
|
2246
|
-
* @returns {string} such as: {1}{2}{3}
|
|
2247
|
-
*/
|
|
2248
|
-
function _convertStringByCommaToValByBraces(str) {
|
|
2249
|
-
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2250
|
-
return '';
|
|
2251
|
-
}
|
|
2252
|
-
return str.split(',').map(function (v) {
|
|
2253
|
-
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
2254
|
-
}).join('');
|
|
2255
|
-
}
|
|
2256
|
-
|
|
2257
|
-
/**
|
|
2258
|
-
* Convert array value to string separated by curly braces
|
|
2259
|
-
* @param {string[]} arr such as: ['1','2','3']
|
|
2260
|
-
* @returns {string} such as: {1}{2}{3}
|
|
2261
|
-
*/
|
|
2262
|
-
function _convertArrToValByBraces(arr) {
|
|
2263
|
-
if (!Array.isArray(arr)) return '';
|
|
2264
|
-
return arr.map(function (v) {
|
|
2265
|
-
return v.toString().includes('{') && v.toString().includes('}') ? "".concat(v) : "{".concat(v, "}");
|
|
2266
|
-
}).join('');
|
|
2267
|
-
}
|
|
2268
|
-
; // CONCATENATED MODULE: ./src/libs/extract.ts
|
|
2269
|
-
/**
|
|
2270
|
-
* Determine whether an extractor is included
|
|
2271
|
-
* @param {string} str => input string. such as 'a[1], b[2]', '{a[1]}'
|
|
2272
|
-
* @returns {boolean}
|
|
2273
|
-
*/
|
|
2274
|
-
function _extractorExist(str) {
|
|
2275
|
-
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2276
|
-
return false;
|
|
2277
|
-
}
|
|
2278
|
-
var res = false;
|
|
2279
|
-
if (str !== null && str !== void 0 && str.match(/(\[.*?\])/gi)) {
|
|
2280
|
-
res = true;
|
|
2281
|
-
}
|
|
2282
|
-
return res;
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
/**
|
|
2286
|
-
* Extract the contents of square brackets
|
|
2287
|
-
* @param {string} str => input string. such as '[1,2] [f][c]'
|
|
2288
|
-
* @param {boolean} commaSeparated => flag to determine if the result should be comma separated or not
|
|
2289
|
-
* @returns {Array<string>|string} such as: ['1,2','f','c']
|
|
2290
|
-
*/
|
|
2291
|
-
function _extractContentsOfBrackets(str) {
|
|
2292
|
-
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2293
|
-
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2294
|
-
return !commaSeparated ? [] : '';
|
|
2295
|
-
}
|
|
2296
|
-
var res = str.match(/[^\[]+(?=(\[ \])|\])/g);
|
|
2297
|
-
if (commaSeparated) {
|
|
2298
|
-
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
2299
|
-
} else {
|
|
2300
|
-
return res === null ? '' : res;
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
|
-
|
|
2304
|
-
/**
|
|
2305
|
-
* Extract the contents of curly braces
|
|
2306
|
-
* @param {string} str => input string. such as '{1,2} {f}{c}'
|
|
2307
|
-
* @param {boolean} commaSeparated => flag to determine if the result should be comma separated or not
|
|
2308
|
-
* @returns {Array<string>|string} such as: ['1,2','f','c']
|
|
2309
|
-
*/
|
|
2310
|
-
function _extractContentsOfBraces(str) {
|
|
2311
|
-
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2312
|
-
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2313
|
-
return !commaSeparated ? [] : '';
|
|
2314
|
-
}
|
|
2315
|
-
var res = str.match(/[^\{]+(?=(\{ \})|\})/g);
|
|
2316
|
-
if (commaSeparated) {
|
|
2317
|
-
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
2318
|
-
} else {
|
|
2319
|
-
return res === null ? '' : res;
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
|
|
2323
|
-
/**
|
|
2324
|
-
* Extract the contents of parentheses
|
|
2325
|
-
* @param {string} str => input string. such as '(1,2) (f)(c)'
|
|
2326
|
-
* @param {boolean} commaSeparated => flag to determine if the result should be comma separated or not
|
|
2327
|
-
* @returns {Array<string>|string} such as: ['1,2','f','c']
|
|
2328
|
-
*/
|
|
2329
|
-
function _extractContentsOfParentheses(str) {
|
|
2330
|
-
var commaSeparated = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
2331
|
-
if (typeof str === 'undefined' || str === null || str === '') {
|
|
2332
|
-
return !commaSeparated ? [] : '';
|
|
2333
|
-
}
|
|
2334
|
-
var res = str.match(/[^\(]+(?=(\( \))|\))/g);
|
|
2335
|
-
if (commaSeparated) {
|
|
2336
|
-
return res === null ? '' : res.join(',').replace(/\,+$/, '');
|
|
2337
|
-
} else {
|
|
2338
|
-
return res === null ? '' : res;
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
; // CONCATENATED MODULE: ./src/libs/date.ts
|
|
2342
|
-
/**
|
|
2343
|
-
* The check string contains only hours, minutes, and seconds
|
|
2344
|
-
* @returns {Boolean}
|
|
2345
|
-
*/
|
|
2346
|
-
function _isTimeString(str) {
|
|
2347
|
-
// match "HH:mm:ss"
|
|
2348
|
-
var timePattern = /^([01]\d|2[0-3]):([0-5]\d):([0-5]\d)$/;
|
|
2349
|
-
return timePattern.test(str);
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
/**
|
|
2353
|
-
* Get now
|
|
2354
|
-
* @returns {Date} // Wed Apr 17 2024 14:31:36 GMT+0800 (China Standard Time)
|
|
2355
|
-
*/
|
|
2356
|
-
var _getNow = function getNow() {
|
|
2357
|
-
return new Date(Date.now());
|
|
2358
|
-
};
|
|
2359
|
-
|
|
2360
|
-
/**
|
|
2361
|
-
* Zero Padding
|
|
2362
|
-
* @param {Number} num
|
|
2363
|
-
* @param {Boolean} padZeroEnabled
|
|
2364
|
-
* @returns {String} '01', '05', '12'
|
|
2365
|
-
*/
|
|
2366
|
-
var _padZero = function padZero(num) {
|
|
2367
|
-
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2368
|
-
if (padZeroEnabled) {
|
|
2369
|
-
return num < 10 ? '0' + num : num.toString();
|
|
2370
|
-
} else {
|
|
2371
|
-
return num.toString();
|
|
2372
|
-
}
|
|
2373
|
-
};
|
|
2374
|
-
|
|
2375
|
-
/**
|
|
2376
|
-
* Number validation
|
|
2377
|
-
* @param {*} v
|
|
2378
|
-
* @returns {Boolean}
|
|
2379
|
-
*/
|
|
2380
|
-
var _isNumeric = function isNumeric(v) {
|
|
2381
|
-
return !isNaN(parseFloat(v)) && isFinite(v);
|
|
2382
|
-
};
|
|
2383
|
-
|
|
2384
|
-
/**
|
|
2385
|
-
* Hours validation
|
|
2386
|
-
* @param {*} v
|
|
2387
|
-
* @returns {Boolean}
|
|
2388
|
-
*/
|
|
2389
|
-
var _isValidHours = function isValidHours(v) {
|
|
2390
|
-
return /^([01]?[0-9]|2[0-3])$/.test(v); // 0~23, 00~23
|
|
2391
|
-
};
|
|
2392
|
-
|
|
2393
|
-
/**
|
|
2394
|
-
* Minutes and Seconds validation
|
|
2395
|
-
* @param {*} v
|
|
2396
|
-
* @returns {Boolean}
|
|
2397
|
-
*/
|
|
2398
|
-
var _isValidMinutesAndSeconds = function isValidMinutesAndSeconds(v) {
|
|
2399
|
-
return /^([01]?[0-9]|[0-5][0-9])$/.test(v); // 0~59, 00~59
|
|
2400
|
-
};
|
|
2401
|
-
|
|
2402
|
-
/**
|
|
2403
|
-
* Year validation
|
|
2404
|
-
* @param {*} v
|
|
2405
|
-
* @returns {Boolean}
|
|
2406
|
-
*/
|
|
2407
|
-
var _isValidYear = function isValidYear(v) {
|
|
2408
|
-
return /^([1-9][0-9])\d{2}$/.test(v); // 1000 ~ 9999
|
|
2409
|
-
};
|
|
2410
|
-
|
|
2411
|
-
/**
|
|
2412
|
-
* Month validation
|
|
2413
|
-
* @param {*} v
|
|
2414
|
-
* @returns {Boolean}
|
|
2415
|
-
*/
|
|
2416
|
-
var _isValidMonth = function isValidMonth(v) {
|
|
2417
|
-
return /^(0?[1-9]|1[0-2])$/.test(v); // 01~12, 1~12
|
|
2418
|
-
};
|
|
2419
|
-
|
|
2420
|
-
/**
|
|
2421
|
-
* Day validation
|
|
2422
|
-
* @param {*} v
|
|
2423
|
-
* @returns {Boolean}
|
|
2424
|
-
*/
|
|
2425
|
-
var _isValidDay = function isValidDay(v) {
|
|
2426
|
-
return /^(0?[1-9]|[1-2][0-9]|3[0-1])$/.test(v); // 01~31, 1~31
|
|
2427
|
-
};
|
|
2428
|
-
|
|
2429
|
-
/**
|
|
2430
|
-
* Check if the string is legitimate
|
|
2431
|
-
* @param {String} v
|
|
2432
|
-
* @returns {Boolean}
|
|
2433
|
-
*/
|
|
2434
|
-
var _isValidDate = function isValidDate(v) {
|
|
2435
|
-
return !(String(new Date(v)).toLowerCase() === 'invalid date');
|
|
2436
|
-
};
|
|
2437
|
-
|
|
2438
|
-
/**
|
|
2439
|
-
* Get calendar date
|
|
2440
|
-
* @param {Date | String} v
|
|
2441
|
-
* @returns {Date | String} yyyy-MM-dd
|
|
2442
|
-
*/
|
|
2443
|
-
function _dateFormat(v) {
|
|
2444
|
-
var date = typeof v === 'string' ? new Date(v.replace(/-/g, "/")) : v; // fix "Invalid date in safari"
|
|
2445
|
-
return date;
|
|
2446
|
-
}
|
|
2447
|
-
|
|
2448
|
-
/**
|
|
2449
|
-
* Get calendar date
|
|
2450
|
-
* @param {Date | String} v
|
|
2451
|
-
* @param {Boolean} padZeroEnabled
|
|
2452
|
-
* @returns {String} yyyy-MM-dd
|
|
2453
|
-
*/
|
|
2454
|
-
function _getCalendarDate(v) {
|
|
2455
|
-
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2456
|
-
var date = _dateFormat(v);
|
|
2457
|
-
var year = date.getFullYear();
|
|
2458
|
-
var month = _padZero(date.getMonth() + 1, padZeroEnabled);
|
|
2459
|
-
var day = _padZero(date.getDate(), padZeroEnabled);
|
|
2460
|
-
var hours = _padZero(date.getHours(), padZeroEnabled);
|
|
2461
|
-
var minutes = _padZero(date.getMinutes(), padZeroEnabled);
|
|
2462
|
-
var seconds = _padZero(date.getSeconds(), padZeroEnabled);
|
|
2463
|
-
var res = "".concat(year, "-").concat(month, "-").concat(day);
|
|
2464
|
-
return res;
|
|
2465
|
-
}
|
|
2466
|
-
|
|
2467
|
-
/**
|
|
2468
|
-
* Get today date
|
|
2469
|
-
* @returns {String} yyyy-MM-dd
|
|
2470
|
-
*/
|
|
2471
|
-
function _getTodayDate() {
|
|
2472
|
-
return _getCalendarDate(new Date());
|
|
2473
|
-
}
|
|
2474
|
-
|
|
2475
|
-
/**
|
|
2476
|
-
* Get tomorrow date
|
|
2477
|
-
* @param {Date | String} v
|
|
2478
|
-
* @returns {String} yyyy-MM-dd
|
|
2479
|
-
*/
|
|
2480
|
-
function _getTomorrowDate(v) {
|
|
2481
|
-
var today = _dateFormat(v);
|
|
2482
|
-
var _tomorrow = today;
|
|
2483
|
-
_tomorrow.setDate(_tomorrow.getDate() + 1);
|
|
2484
|
-
var tomorrow = _getCalendarDate(_tomorrow);
|
|
2485
|
-
return tomorrow;
|
|
2486
|
-
}
|
|
2487
|
-
|
|
2488
|
-
/**
|
|
2489
|
-
* Get yesterday date
|
|
2490
|
-
* @param {Date | String} v
|
|
2491
|
-
* @returns {String} yyyy-MM-dd
|
|
2492
|
-
*/
|
|
2493
|
-
function _getYesterdayDate(v) {
|
|
2494
|
-
var today = _dateFormat(v);
|
|
2495
|
-
var _yesterday = today;
|
|
2496
|
-
_yesterday.setDate(_yesterday.getDate() - 1);
|
|
2497
|
-
var yesterday = _getCalendarDate(_yesterday);
|
|
2498
|
-
return yesterday;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
/**
|
|
2502
|
-
* Get specified date
|
|
2503
|
-
* @param {Date | String} v
|
|
2504
|
-
* @param {Number} days The number of days forward or backward, which can be a negative number
|
|
2505
|
-
* @returns {String} yyyy-MM-dd
|
|
2506
|
-
*/
|
|
2507
|
-
/* console.log(getSpecifiedDate(getTodayDate(), -180)); // 2023-08-27 (180 days before February 23, 202) */
|
|
2508
|
-
function _getSpecifiedDate(v, days) {
|
|
2509
|
-
var today = _dateFormat(v);
|
|
2510
|
-
var _specifiedDay = today;
|
|
2511
|
-
_specifiedDay.setDate(_specifiedDay.getDate() + days);
|
|
2512
|
-
var specifiedDay = _getCalendarDate(_specifiedDay);
|
|
2513
|
-
return specifiedDay;
|
|
2514
|
-
}
|
|
2515
|
-
|
|
2516
|
-
/**
|
|
2517
|
-
* Get next month date
|
|
2518
|
-
* @param {Date | String} v
|
|
2519
|
-
* @returns {String} yyyy-MM-dd
|
|
2520
|
-
*/
|
|
2521
|
-
function _getNextMonthDate(v) {
|
|
2522
|
-
var today = _dateFormat(v);
|
|
2523
|
-
today.setMonth(today.getMonth() + 1);
|
|
2524
|
-
return _getCalendarDate(today);
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
/**
|
|
2528
|
-
* Get previous month date
|
|
2529
|
-
* @param {Date | String} v
|
|
2530
|
-
* @returns {String} yyyy-MM-dd
|
|
2531
|
-
*/
|
|
2532
|
-
function _getPrevMonthDate(v) {
|
|
2533
|
-
var today = _dateFormat(v);
|
|
2534
|
-
today.setMonth(today.getMonth() - 1);
|
|
2535
|
-
return _getCalendarDate(today);
|
|
2536
|
-
}
|
|
2537
|
-
|
|
2538
|
-
/**
|
|
2539
|
-
* Get next year date
|
|
2540
|
-
* @param {Date | String} v
|
|
2541
|
-
* @returns {String} yyyy-MM-dd
|
|
2542
|
-
*/
|
|
2543
|
-
function _getNextYearDate(v) {
|
|
2544
|
-
var today = _dateFormat(v);
|
|
2545
|
-
var current = new Date(today);
|
|
2546
|
-
current.setFullYear(current.getFullYear() + 1);
|
|
2547
|
-
return _getCalendarDate(current);
|
|
2548
|
-
}
|
|
2549
|
-
|
|
2550
|
-
/**
|
|
2551
|
-
* Get previous year date
|
|
2552
|
-
* @param {Date | String} v
|
|
2553
|
-
* @returns {String} yyyy-MM-dd
|
|
2554
|
-
*/
|
|
2555
|
-
function _getPrevYearDate(v) {
|
|
2556
|
-
var today = _dateFormat(v);
|
|
2557
|
-
var current = new Date(today);
|
|
2558
|
-
current.setFullYear(current.getFullYear() - 1);
|
|
2559
|
-
return _getCalendarDate(current);
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
/**
|
|
2563
|
-
* Get last day in month
|
|
2564
|
-
* @param {Date | String} v
|
|
2565
|
-
* @param {?Number} targetMonth
|
|
2566
|
-
* @returns {String | Number} yyyy-MM-dd
|
|
2567
|
-
*/
|
|
2568
|
-
/*
|
|
2569
|
-
Example: Get last day in next month
|
|
2570
|
-
|
|
2571
|
-
const _day = '2024-01-01';
|
|
2572
|
-
const y = new Date(getNextMonthDate(_day)).getFullYear();
|
|
2573
|
-
const m = String(new Date(getNextMonthDate(_day)).getMonth() + 1).padStart(2, '0');
|
|
2574
|
-
const d = getLastDayInMonth(getNextMonthDate(_day), new Date(getNextMonthDate(_day)).getMonth() + 1);
|
|
2575
|
-
|
|
2576
|
-
const lastDayOfNextMonth = `${y}-${m}-${d}`; // 2024-02-29
|
|
2577
|
-
|
|
2578
|
-
*/
|
|
2579
|
-
function _getLastDayInMonth(v) {
|
|
2580
|
-
var targetMonth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
2581
|
-
var date = _dateFormat(v);
|
|
2582
|
-
return new Date(date.getFullYear(), typeof targetMonth !== 'undefined' ? targetMonth : date.getMonth() - 1, 0).getDate();
|
|
2583
|
-
}
|
|
2584
|
-
|
|
2585
|
-
/**
|
|
2586
|
-
* Get current year
|
|
2587
|
-
* @returns {Number}
|
|
2588
|
-
*/
|
|
2589
|
-
function _getCurrentYear() {
|
|
2590
|
-
return new Date().getFullYear();
|
|
2591
|
-
}
|
|
2592
|
-
|
|
2593
|
-
/**
|
|
2594
|
-
* Get current month
|
|
2595
|
-
* @param {Boolean} padZeroEnabled
|
|
2596
|
-
* @returns {Number}
|
|
2597
|
-
*/
|
|
2598
|
-
function _getCurrentMonth() {
|
|
2599
|
-
var padZeroEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2600
|
-
var m = new Date().getMonth() + 1;
|
|
2601
|
-
return padZeroEnabled ? String(m).padStart(2, '0') : m;
|
|
2602
|
-
}
|
|
2603
|
-
|
|
2604
|
-
/**
|
|
2605
|
-
* Get current day
|
|
2606
|
-
* @param {Boolean} padZeroEnabled
|
|
2607
|
-
* @returns {Number}
|
|
2608
|
-
*/
|
|
2609
|
-
function _getCurrentDay() {
|
|
2610
|
-
var padZeroEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2611
|
-
var d = new Date().getDate();
|
|
2612
|
-
return padZeroEnabled ? String(d).padStart(2, '0') : d;
|
|
2613
|
-
}
|
|
2614
|
-
|
|
2615
|
-
/**
|
|
2616
|
-
* Get first and last month day
|
|
2617
|
-
* @param {Number} v
|
|
2618
|
-
* @param {Boolean} padZeroEnabled
|
|
2619
|
-
* @returns {Array}
|
|
2620
|
-
*/
|
|
2621
|
-
function _getFirstAndLastMonthDay(year) {
|
|
2622
|
-
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2623
|
-
var theFirst = new Date(year, 0, 1).getDate();
|
|
2624
|
-
var theLast = new Date(year, 11, 31).getDate();
|
|
2625
|
-
var padZero = function padZero(num) {
|
|
2626
|
-
if (padZeroEnabled) {
|
|
2627
|
-
return num < 10 ? '0' + num : num.toString();
|
|
2628
|
-
} else {
|
|
2629
|
-
return num.toString();
|
|
2630
|
-
}
|
|
2631
|
-
};
|
|
2632
|
-
return [padZero(theFirst), padZero(theLast)];
|
|
2633
|
-
}
|
|
2634
|
-
|
|
2635
|
-
/**
|
|
2636
|
-
* Get current date
|
|
2637
|
-
* @param {Boolean} padZeroEnabled
|
|
2638
|
-
* @typedef {String} JSON
|
|
2639
|
-
*/
|
|
2640
|
-
function _getCurrentDate() {
|
|
2641
|
-
var padZeroEnabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
2642
|
-
var date = new Date();
|
|
2643
|
-
var padZero = function padZero(num) {
|
|
2644
|
-
if (padZeroEnabled) {
|
|
2645
|
-
return num < 10 ? '0' + num : num.toString();
|
|
2646
|
-
} else {
|
|
2647
|
-
return num.toString();
|
|
2648
|
-
}
|
|
2649
|
-
};
|
|
2650
|
-
var year = date.getFullYear();
|
|
2651
|
-
var month = padZero(date.getMonth() + 1);
|
|
2652
|
-
var day = padZero(date.getDate());
|
|
2653
|
-
var hours = padZero(date.getHours());
|
|
2654
|
-
var minutes = padZero(date.getMinutes());
|
|
2655
|
-
return {
|
|
2656
|
-
today: "".concat(year, "-").concat(month, "-").concat(day),
|
|
2657
|
-
yearStart: "".concat(year, "-01-01"),
|
|
2658
|
-
yearEnd: "".concat(year, "-12-").concat(_getLastDayInMonth(date, 12))
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
|
|
2662
|
-
/**
|
|
2663
|
-
* Get full time
|
|
2664
|
-
* @param {Date | String} v
|
|
2665
|
-
* @param {Boolean} padZeroEnabled
|
|
2666
|
-
* @param {Boolean} hasSeconds
|
|
2667
|
-
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2668
|
-
*/
|
|
2669
|
-
function _getFullTime(v) {
|
|
2670
|
-
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2671
|
-
var hasSeconds = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2672
|
-
var date = _dateFormat(v);
|
|
2673
|
-
var padZero = function padZero(num) {
|
|
2674
|
-
if (padZeroEnabled) {
|
|
2675
|
-
return num < 10 ? '0' + num : num.toString();
|
|
2676
|
-
} else {
|
|
2677
|
-
return num.toString();
|
|
2678
|
-
}
|
|
2679
|
-
};
|
|
2680
|
-
var year = date.getFullYear();
|
|
2681
|
-
var month = padZero(date.getMonth() + 1);
|
|
2682
|
-
var day = padZero(date.getDate());
|
|
2683
|
-
var hours = padZero(date.getHours());
|
|
2684
|
-
var minutes = padZero(date.getMinutes());
|
|
2685
|
-
var seconds = padZero(date.getSeconds());
|
|
2686
|
-
var res = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes, ":").concat(seconds);
|
|
2687
|
-
var res2 = "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hours, ":").concat(minutes);
|
|
2688
|
-
return hasSeconds ? res : res2;
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
|
-
/**
|
|
2692
|
-
* Add hours
|
|
2693
|
-
* @param {Date | String} v
|
|
2694
|
-
* @param {Number} offset
|
|
2695
|
-
* @param {Boolean} padZeroEnabled
|
|
2696
|
-
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2697
|
-
*/
|
|
2698
|
-
function _setDateHours(v, offset) {
|
|
2699
|
-
var padZeroEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2700
|
-
var date = _dateFormat(v);
|
|
2701
|
-
var _cur = new Date(date).setTime(new Date(date).getTime() + offset * 60 * 60 * 1000);
|
|
2702
|
-
return _getFullTime(new Date(_cur), padZeroEnabled);
|
|
2703
|
-
}
|
|
2704
|
-
|
|
2705
|
-
/**
|
|
2706
|
-
* Add minutes
|
|
2707
|
-
* @param {Date | String} v
|
|
2708
|
-
* @param {Number} offset
|
|
2709
|
-
* @param {Boolean} padZeroEnabled
|
|
2710
|
-
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2711
|
-
*/
|
|
2712
|
-
function _setDateMinutes(v, offset) {
|
|
2713
|
-
var padZeroEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2714
|
-
var date = _dateFormat(v);
|
|
2715
|
-
var _cur = new Date(date).setTime(new Date(date).getTime() + offset * 60 * 1000);
|
|
2716
|
-
return _getFullTime(new Date(_cur), padZeroEnabled);
|
|
2717
|
-
}
|
|
2718
|
-
/**
|
|
2719
|
-
* Add days
|
|
2720
|
-
* @param {Date | String} v
|
|
2721
|
-
* @param {Number} offset
|
|
2722
|
-
* @param {Boolean} padZeroEnabled
|
|
2723
|
-
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2724
|
-
*/
|
|
2725
|
-
function _setDateDays(v, offset) {
|
|
2726
|
-
var padZeroEnabled = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
2727
|
-
var date = _dateFormat(v);
|
|
2728
|
-
var _cur = new Date(date).setTime(new Date(date).getTime() + offset * 24 * 60 * 60 * 1000);
|
|
2729
|
-
return _getFullTime(new Date(_cur), padZeroEnabled);
|
|
2730
|
-
}
|
|
2731
|
-
|
|
2732
|
-
/**
|
|
2733
|
-
* Convert timestamp to date
|
|
2734
|
-
* @param {Number} v
|
|
2735
|
-
* @param {Boolean} padZeroEnabled
|
|
2736
|
-
* @returns {String} yyyy-MM-dd HH:mm:ss
|
|
2737
|
-
*/
|
|
2738
|
-
function _timestampToDate(v) {
|
|
2739
|
-
var padZeroEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
2740
|
-
return _getFullTime(new Date(v), padZeroEnabled);
|
|
2741
|
-
}
|
|
2742
|
-
; // CONCATENATED MODULE: ./src/libs/object.ts
|
|
2743
|
-
function object_typeof(obj) {
|
|
2744
|
-
"@babel/helpers - typeof";
|
|
2745
|
-
|
|
2746
|
-
return object_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
|
|
2747
|
-
return typeof obj;
|
|
2748
|
-
} : function (obj) {
|
|
2749
|
-
return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
2750
|
-
}, object_typeof(obj);
|
|
2751
|
-
}
|
|
2752
|
-
/**
|
|
2753
|
-
* Remove Duplicate objects from JSON Array
|
|
2754
|
-
* @param {Array} obj
|
|
2755
|
-
* @param {String} fieldName
|
|
2756
|
-
*/
|
|
2757
|
-
function _removeArrDuplicateItems(obj, fieldName) {
|
|
2758
|
-
if (!Array.isArray(obj)) return [];
|
|
2759
|
-
var clean = obj.filter(function (item, index, self) {
|
|
2760
|
-
return index === self.findIndex(function (t) {
|
|
2761
|
-
return t[fieldName] === item[fieldName];
|
|
2762
|
-
});
|
|
2763
|
-
});
|
|
2764
|
-
return clean;
|
|
2765
|
-
}
|
|
2766
|
-
;
|
|
2767
|
-
|
|
2768
|
-
/**
|
|
2769
|
-
* Deep clone
|
|
2770
|
-
* @param {*} obj
|
|
2771
|
-
*/
|
|
2772
|
-
function _deepClone(obj) {
|
|
2773
|
-
if (Array.isArray(obj)) {
|
|
2774
|
-
return obj.map(function (item) {
|
|
2775
|
-
return _deepClone(item);
|
|
2776
|
-
});
|
|
2777
|
-
} else if (object_typeof(obj) === 'object' && obj !== null) {
|
|
2778
|
-
var clone = {};
|
|
2779
|
-
for (var key in obj) {
|
|
2780
|
-
if (obj.hasOwnProperty(key)) {
|
|
2781
|
-
clone[key] = _deepClone(obj[key]);
|
|
2782
|
-
}
|
|
2783
|
-
}
|
|
2784
|
-
return clone;
|
|
2785
|
-
} else {
|
|
2786
|
-
return obj;
|
|
2787
|
-
}
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
/**
|
|
2791
|
-
* Flat Data
|
|
2792
|
-
* @param {*} data
|
|
2793
|
-
* @returns
|
|
2794
|
-
*/
|
|
2795
|
-
function _flatData(data) {
|
|
2796
|
-
var result = [];
|
|
2797
|
-
var iterate = function iterate(obj) {
|
|
2798
|
-
if (!obj) {
|
|
2799
|
-
return;
|
|
2800
|
-
}
|
|
2801
|
-
obj.forEach(function (item) {
|
|
2802
|
-
result.push(item);
|
|
2803
|
-
if (item.children) {
|
|
2804
|
-
iterate(item.children);
|
|
2805
|
-
}
|
|
2806
|
-
|
|
2807
|
-
// delete current item children
|
|
2808
|
-
delete item.children;
|
|
2809
|
-
});
|
|
2810
|
-
};
|
|
2811
|
-
iterate(data);
|
|
2812
|
-
return result;
|
|
2813
|
-
}
|
|
2814
|
-
; // CONCATENATED MODULE: ./src/libs/viewport.ts
|
|
2815
|
-
/**
|
|
2816
|
-
* Check if an element is in the viewport
|
|
2817
|
-
* @param {HTMLElement} elem
|
|
2818
|
-
* @returns {boolean}
|
|
2819
|
-
*/
|
|
2820
|
-
function _isInViewport(elem) {
|
|
2821
|
-
var bounding = elem.getBoundingClientRect();
|
|
2822
|
-
return bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth);
|
|
2823
|
-
}
|
|
2824
|
-
; // CONCATENATED MODULE: ./src/libs/inputs-calculation.ts
|
|
2825
|
-
/**
|
|
2826
|
-
* Get the actual value with user specific methed
|
|
2827
|
-
* it can be 'width', 'height', 'outerWidth', 'outerHeight'
|
|
2828
|
-
* @private
|
|
2829
|
-
* @param {Element} el - A DOM node containing one selector to match against.
|
|
2830
|
-
* @param {String} prop - A string naming the property of style.
|
|
2831
|
-
* @param {?Json} config - Whether or not margin is included. The key `includeMargin`
|
|
2832
|
-
takes effect when set to true
|
|
2833
|
-
* @return {Number} - Returns a pure number.
|
|
2834
|
-
*/
|
|
2835
|
-
function actualPropertyValue(el, prop) {
|
|
2836
|
-
var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
2837
|
-
if (el === null) return 0;
|
|
2838
|
-
var style = window.getComputedStyle ? window.getComputedStyle(el) : el.currentStyle,
|
|
2839
|
-
display = style.display,
|
|
2840
|
-
position = style.position,
|
|
2841
|
-
visibility = style.visibility;
|
|
2842
|
-
var marginWidth = 0;
|
|
2843
|
-
var marginHeight = 0;
|
|
2844
|
-
var maxVal;
|
|
2845
|
-
var actualVal;
|
|
2846
|
-
if (config && config.includeMargin === true) {
|
|
2847
|
-
marginWidth = parseFloat(style.marginLeft) + parseFloat(style.marginRight);
|
|
2848
|
-
marginHeight = parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
|
2849
|
-
}
|
|
2850
|
-
if (prop === 'width') {
|
|
2851
|
-
maxVal = parseFloat(style.maxWidth);
|
|
2852
|
-
|
|
2853
|
-
// if its not hidden we just return normal height
|
|
2854
|
-
if (display !== 'none' && maxVal !== 0) {
|
|
2855
|
-
return el.clientWidth;
|
|
2856
|
-
}
|
|
2857
|
-
}
|
|
2858
|
-
if (prop === 'height') {
|
|
2859
|
-
maxVal = parseFloat(style.maxHeight);
|
|
2860
|
-
if (display !== 'none' && maxVal !== 0) {
|
|
2861
|
-
return el.clientHeight;
|
|
2862
|
-
}
|
|
2863
|
-
}
|
|
2864
|
-
if (prop === 'outerWidth') {
|
|
2865
|
-
maxVal = parseFloat(style.maxWidth);
|
|
2866
|
-
if (display !== 'none' && maxVal !== 0) {
|
|
2867
|
-
return el.offsetWidth + marginWidth;
|
|
2868
|
-
}
|
|
2869
|
-
}
|
|
2870
|
-
if (prop === 'outerHeight') {
|
|
2871
|
-
maxVal = parseFloat(style.maxHeight);
|
|
2872
|
-
if (display !== 'none' && maxVal !== 0) {
|
|
2873
|
-
return el.offsetHeight + marginHeight;
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
|
|
2877
|
-
// the element is hidden so:
|
|
2878
|
-
// making the el block so we can meassure its height but still be hidden
|
|
2879
|
-
el.style.position = 'absolute';
|
|
2880
|
-
el.style.visibility = 'hidden';
|
|
2881
|
-
el.style.display = 'block';
|
|
2882
|
-
if (prop === 'width') actualVal = el.clientWidth;
|
|
2883
|
-
if (prop === 'height') actualVal = el.clientHeight;
|
|
2884
|
-
if (prop === 'outerWidth') actualVal = el.offsetWidth + marginWidth;
|
|
2885
|
-
if (prop === 'outerHeight') actualVal = el.offsetHeight + marginHeight;
|
|
2886
|
-
|
|
2887
|
-
// reverting to the original values
|
|
2888
|
-
el.style.display = display;
|
|
2889
|
-
el.style.position = position;
|
|
2890
|
-
el.style.visibility = visibility;
|
|
2891
|
-
return actualVal;
|
|
2892
|
-
}
|
|
2893
|
-
function getElCSS(input, prop, isNumber) {
|
|
2894
|
-
var _document$defaultView;
|
|
2895
|
-
var val = (_document$defaultView = document.defaultView) === null || _document$defaultView === void 0 ? void 0 : _document$defaultView.getComputedStyle(input, null).getPropertyValue(prop);
|
|
2896
|
-
return isNumber ? isNaN(parseFloat(val)) ? 0 : parseFloat(val) : val;
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
|
-
/**
|
|
2900
|
-
* Get cursor or text position in pixels for input element
|
|
2901
|
-
*
|
|
2902
|
-
* @param {HTMLInputElement} input Required HTMLElement with `value` attribute
|
|
2903
|
-
* @param {HTMLSpanElement} fauxContainer Container of faux.
|
|
2904
|
-
* @param {HTMLElement} rawTextContainer The raw text container for the comparison
|
|
2905
|
-
* @returns {Number}
|
|
2906
|
-
*/
|
|
2907
|
-
|
|
2908
|
-
function _getTextWidth(input, fauxContainer, rawTextContainer) {
|
|
2909
|
-
if (input === null || fauxContainer === null || rawTextContainer === null) return 0;
|
|
2910
|
-
var _off = input.selectionStart;
|
|
2911
|
-
var _faux = fauxContainer;
|
|
2912
|
-
var _fauxContainer = rawTextContainer;
|
|
2913
|
-
if (_faux && _fauxContainer) {
|
|
2914
|
-
// Styles to simulate a node in an input field
|
|
2915
|
-
// use pre-wrap instead of wrap for white-space to support wrapping in textareas
|
|
2916
|
-
var listOfModifiers = ['direction', 'font-family', 'font-size', 'font-size-adjust', 'font-variant', 'font-weight', 'font-style', 'letter-spacing', 'line-height', 'text-align', 'text-indent', 'text-transform', 'word-wrap', 'word-spacing'];
|
|
2917
|
-
|
|
2918
|
-
// default styles
|
|
2919
|
-
_faux.style.setProperty('white-space', 'pre-wrap');
|
|
2920
|
-
_faux.style.setProperty('padding', '0');
|
|
2921
|
-
_faux.style.setProperty('margin', '0');
|
|
2922
|
-
_faux.style.setProperty('display', 'none');
|
|
2923
|
-
for (var i = 0; i < listOfModifiers.length; i++) {
|
|
2924
|
-
var propertyValue = getElCSS(_fauxContainer, listOfModifiers[i], false);
|
|
2925
|
-
_faux.style.setProperty(listOfModifiers[i], propertyValue);
|
|
2926
|
-
}
|
|
2927
|
-
_faux.textContent = input.value.substring(0, _off).replace(/\s/g, "\xA0");
|
|
2928
|
-
return actualPropertyValue(_faux, 'outerWidth');
|
|
2929
|
-
}
|
|
2930
|
-
}
|
|
2931
|
-
|
|
2932
|
-
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
2933
|
-
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __nested_webpack_require_1471__(787);
|
|
2934
|
-
; // CONCATENATED MODULE: ./src/hooks/useComId.tsx
|
|
2935
|
-
/**
|
|
2936
|
-
* Create an available ID
|
|
2937
|
-
*
|
|
2938
|
-
*/
|
|
2939
|
-
|
|
2940
|
-
var useComId = function useComId() {
|
|
2941
|
-
return "ID-".concat((0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)().replace(/\:/g, "-"));
|
|
2942
|
-
};
|
|
2943
|
-
/* harmony default export */
|
|
2944
|
-
var hooks_useComId = useComId;
|
|
2945
|
-
; // CONCATENATED MODULE: ./src/hooks/useThrottle.tsx
|
|
2946
|
-
/**
|
|
2947
|
-
* Limiting the rate of execution
|
|
2948
|
-
*
|
|
2949
|
-
* @usage:
|
|
2950
|
-
|
|
2951
|
-
const App = () => {
|
|
2952
|
-
const [count, setCount] = useState(0);
|
|
2953
|
-
const handleClick = useThrottle(() => setCount(count + 1), 500, [count]);
|
|
2954
|
-
|
|
2955
|
-
return (
|
|
2956
|
-
<div className="app">
|
|
2957
|
-
<button onClick={handleClick}>click</button>
|
|
2958
|
-
<p>click {count} time</p>
|
|
2959
|
-
</div>
|
|
2960
|
-
);
|
|
2961
|
-
};
|
|
2962
|
-
|
|
2963
|
-
*/
|
|
2964
|
-
|
|
2965
|
-
var useThrottle = function useThrottle(fn, delay, dependence) {
|
|
2966
|
-
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)({
|
|
2967
|
-
lastTime: 0
|
|
2968
|
-
});
|
|
2969
|
-
return (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
2970
|
-
var now = Date.now();
|
|
2971
|
-
if (now - ref.current.lastTime >= delay) {
|
|
2972
|
-
fn.apply(void 0, arguments);
|
|
2973
|
-
ref.current.lastTime = now;
|
|
2974
|
-
}
|
|
2975
|
-
}, dependence);
|
|
2976
|
-
};
|
|
2977
|
-
/* harmony default export */
|
|
2978
|
-
var hooks_useThrottle = useThrottle;
|
|
2979
|
-
; // CONCATENATED MODULE: ./src/hooks/useDebounce.tsx
|
|
2980
|
-
/**
|
|
2981
|
-
* Delay the execution of function or state update
|
|
2982
|
-
*
|
|
2983
|
-
* @usage:
|
|
2984
|
-
|
|
2985
|
-
const App = () => {
|
|
2986
|
-
const [count, setCount] = useState(0);
|
|
2987
|
-
const handleClick = useDebounce(() => setCount(count + 1), 500, [count]);
|
|
2988
|
-
|
|
2989
|
-
return (
|
|
2990
|
-
<div className="app">
|
|
2991
|
-
<button onClick={handleClick}>click</button>
|
|
2992
|
-
<p>click {count} time</p>
|
|
2993
|
-
</div>
|
|
2994
|
-
);
|
|
2995
|
-
};
|
|
2996
|
-
|
|
2997
|
-
*/
|
|
2998
|
-
|
|
2999
|
-
var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
3000
|
-
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3001
|
-
return (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function () {
|
|
3002
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3003
|
-
args[_key] = arguments[_key];
|
|
3004
|
-
}
|
|
3005
|
-
clearTimeout(ref.current);
|
|
3006
|
-
ref.current = null;
|
|
3007
|
-
ref.current = setTimeout(function () {
|
|
3008
|
-
fn.apply(void 0, args);
|
|
3009
|
-
}, delay);
|
|
3010
|
-
}, dependence);
|
|
3011
|
-
};
|
|
3012
|
-
/* harmony default export */
|
|
3013
|
-
var hooks_useDebounce = useDebounce;
|
|
3014
|
-
; // CONCATENATED MODULE: ./src/hooks/useAutosizeTextArea.tsx
|
|
3015
|
-
function _slicedToArray(arr, i) {
|
|
3016
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || useAutosizeTextArea_unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
3017
|
-
}
|
|
3018
|
-
function _nonIterableRest() {
|
|
3019
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3020
|
-
}
|
|
3021
|
-
function useAutosizeTextArea_unsupportedIterableToArray(o, minLen) {
|
|
3022
|
-
if (!o) return;
|
|
3023
|
-
if (typeof o === "string") return useAutosizeTextArea_arrayLikeToArray(o, minLen);
|
|
3024
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3025
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3026
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3027
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useAutosizeTextArea_arrayLikeToArray(o, minLen);
|
|
3028
|
-
}
|
|
3029
|
-
function useAutosizeTextArea_arrayLikeToArray(arr, len) {
|
|
3030
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3031
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3032
|
-
return arr2;
|
|
3033
|
-
}
|
|
3034
|
-
function _iterableToArrayLimit(arr, i) {
|
|
3035
|
-
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3036
|
-
if (null != _i) {
|
|
3037
|
-
var _s,
|
|
3038
|
-
_e,
|
|
3039
|
-
_x,
|
|
3040
|
-
_r,
|
|
3041
|
-
_arr = [],
|
|
3042
|
-
_n = !0,
|
|
3043
|
-
_d = !1;
|
|
3044
|
-
try {
|
|
3045
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3046
|
-
if (Object(_i) !== _i) return;
|
|
3047
|
-
_n = !1;
|
|
3048
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3049
|
-
} catch (err) {
|
|
3050
|
-
_d = !0, _e = err;
|
|
3051
|
-
} finally {
|
|
3052
|
-
try {
|
|
3053
|
-
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
3054
|
-
} finally {
|
|
3055
|
-
if (_d) throw _e;
|
|
3056
|
-
}
|
|
3057
|
-
}
|
|
3058
|
-
return _arr;
|
|
3059
|
-
}
|
|
3060
|
-
}
|
|
3061
|
-
function _arrayWithHoles(arr) {
|
|
3062
|
-
if (Array.isArray(arr)) return arr;
|
|
3063
|
-
}
|
|
3064
|
-
/**
|
|
3065
|
-
* Creating a Textarea with dynamic height
|
|
3066
|
-
*
|
|
3067
|
-
* @usage:
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
const App = () => {
|
|
3071
|
-
const [value, setValue] = useState("");
|
|
3072
|
-
const el = useRef<HTMLTextAreaElement>(null);
|
|
3073
|
-
|
|
3074
|
-
useAutosizeTextArea({
|
|
3075
|
-
el: el.current,
|
|
3076
|
-
value: value,
|
|
3077
|
-
cb: (res) => {
|
|
3078
|
-
console.log('dimensions: ', res);
|
|
3079
|
-
}
|
|
3080
|
-
});
|
|
3081
|
-
|
|
3082
|
-
const handleChange = (evt: React.ChangeEvent<HTMLTextAreaElement>) => {
|
|
3083
|
-
const val = evt.target?.value;
|
|
3084
|
-
setValue(val);
|
|
3085
|
-
};
|
|
3086
|
-
|
|
3087
|
-
return (
|
|
3088
|
-
<div className="App">
|
|
3089
|
-
<textarea
|
|
3090
|
-
onChange={handleChange}
|
|
3091
|
-
ref={el}
|
|
3092
|
-
rows={3}
|
|
3093
|
-
value={value}
|
|
3094
|
-
/>
|
|
3095
|
-
</div>
|
|
3096
|
-
);
|
|
3097
|
-
};
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
*/
|
|
3102
|
-
|
|
3103
|
-
var useAutosizeTextArea = function useAutosizeTextArea(_ref) {
|
|
3104
|
-
var el = _ref.el,
|
|
3105
|
-
value = _ref.value,
|
|
3106
|
-
cb = _ref.cb;
|
|
3107
|
-
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(0),
|
|
3108
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3109
|
-
defaultRowHeight = _useState2[0],
|
|
3110
|
-
setDefaultRowHeight = _useState2[1];
|
|
3111
|
-
var _useState3 = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3112
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
3113
|
-
defaultRowHeightInit = _useState4[0],
|
|
3114
|
-
setDefaultRowHeightInit = _useState4[1];
|
|
3115
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3116
|
-
if (el) {
|
|
3117
|
-
var style = el.currentStyle || window.getComputedStyle(el);
|
|
3118
|
-
var _controlWidth = el.scrollWidth + parseInt(style.borderLeftWidth) + parseInt(style.borderRightWidth);
|
|
3119
|
-
|
|
3120
|
-
// initialize default row height
|
|
3121
|
-
if (el.scrollHeight > 0 && !defaultRowHeightInit) {
|
|
3122
|
-
setDefaultRowHeight(el.scrollHeight + parseInt(style.borderTopWidth) + parseInt(style.borderBottomWidth));
|
|
3123
|
-
setDefaultRowHeightInit(true);
|
|
3124
|
-
}
|
|
3125
|
-
|
|
3126
|
-
// restore default row height
|
|
3127
|
-
if (defaultRowHeight > 0) {
|
|
3128
|
-
el.style.height = defaultRowHeight + "px";
|
|
3129
|
-
}
|
|
3130
|
-
|
|
3131
|
-
// reset the height momentarily to get the correct scrollHeight for the textarea
|
|
3132
|
-
var scrollHeight = el.scrollHeight;
|
|
3133
|
-
|
|
3134
|
-
// then set the height directly, outside of the render loop
|
|
3135
|
-
// Trying to set this with state or a ref will product an incorrect value.
|
|
3136
|
-
|
|
3137
|
-
// !!! Compare initial height and changed height
|
|
3138
|
-
if (scrollHeight > defaultRowHeight && defaultRowHeight > 0) {
|
|
3139
|
-
el.style.height = scrollHeight + "px";
|
|
3140
|
-
}
|
|
3141
|
-
cb === null || cb === void 0 ? void 0 : cb([_controlWidth, scrollHeight]);
|
|
3142
|
-
}
|
|
3143
|
-
}, [el, value]);
|
|
3144
|
-
};
|
|
3145
|
-
/* harmony default export */
|
|
3146
|
-
var hooks_useAutosizeTextArea = useAutosizeTextArea;
|
|
3147
|
-
; // CONCATENATED MODULE: ./src/hooks/useInterval.tsx
|
|
3148
|
-
/**
|
|
3149
|
-
* Provides a convenient way to create and manage intervals
|
|
3150
|
-
*
|
|
3151
|
-
* @usage:
|
|
3152
|
-
|
|
3153
|
-
const App = () => {
|
|
3154
|
-
const [count, setCount] = useState(0);
|
|
3155
|
-
|
|
3156
|
-
useInterval(() => {
|
|
3157
|
-
setCount(count + 1);
|
|
3158
|
-
}, 1000);
|
|
3159
|
-
|
|
3160
|
-
return (
|
|
3161
|
-
<div className="app"></div>
|
|
3162
|
-
);
|
|
3163
|
-
};
|
|
3164
|
-
|
|
3165
|
-
*/
|
|
3166
|
-
|
|
3167
|
-
var useInterval = function useInterval(fn, delay) {
|
|
3168
|
-
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
3169
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3170
|
-
ref.current = fn;
|
|
3171
|
-
}, [fn]);
|
|
3172
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3173
|
-
function tick() {
|
|
3174
|
-
ref.current && ref.current();
|
|
3175
|
-
}
|
|
3176
|
-
if (delay !== null && delay > 0) {
|
|
3177
|
-
var id = setInterval(tick, delay);
|
|
3178
|
-
return function () {
|
|
3179
|
-
return clearInterval(id);
|
|
3180
|
-
};
|
|
3181
|
-
} else {
|
|
3182
|
-
tick();
|
|
3183
|
-
}
|
|
3184
|
-
}, [delay]);
|
|
3185
|
-
};
|
|
3186
|
-
/* harmony default export */
|
|
3187
|
-
var hooks_useInterval = useInterval;
|
|
3188
|
-
; // CONCATENATED MODULE: ./src/hooks/useClickOutside.tsx
|
|
3189
|
-
function useClickOutside_toConsumableArray(arr) {
|
|
3190
|
-
return useClickOutside_arrayWithoutHoles(arr) || useClickOutside_iterableToArray(arr) || useClickOutside_unsupportedIterableToArray(arr) || useClickOutside_nonIterableSpread();
|
|
3191
|
-
}
|
|
3192
|
-
function useClickOutside_nonIterableSpread() {
|
|
3193
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3194
|
-
}
|
|
3195
|
-
function useClickOutside_unsupportedIterableToArray(o, minLen) {
|
|
3196
|
-
if (!o) return;
|
|
3197
|
-
if (typeof o === "string") return useClickOutside_arrayLikeToArray(o, minLen);
|
|
3198
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3199
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3200
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3201
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useClickOutside_arrayLikeToArray(o, minLen);
|
|
3202
|
-
}
|
|
3203
|
-
function useClickOutside_iterableToArray(iter) {
|
|
3204
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3205
|
-
}
|
|
3206
|
-
function useClickOutside_arrayWithoutHoles(arr) {
|
|
3207
|
-
if (Array.isArray(arr)) return useClickOutside_arrayLikeToArray(arr);
|
|
3208
|
-
}
|
|
3209
|
-
function useClickOutside_arrayLikeToArray(arr, len) {
|
|
3210
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3211
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3212
|
-
return arr2;
|
|
3213
|
-
}
|
|
3214
|
-
/**
|
|
3215
|
-
* Handles the event of clicking outside of the wrapped component
|
|
3216
|
-
*
|
|
3217
|
-
* @usage:
|
|
3218
|
-
|
|
3219
|
-
const App = () => {
|
|
3220
|
-
|
|
3221
|
-
const [show, setShow] = useState<boolean>(false);
|
|
3222
|
-
const dropdownRef = useRef<HTMLDivElement>(null);
|
|
3223
|
-
|
|
3224
|
-
useClickOutside({
|
|
3225
|
-
enabled: show && dropdownRef.current,
|
|
3226
|
-
isOutside: (event: any) => {
|
|
3227
|
-
return event.target.closest(`.test__wrapper`) === null && event.target.closest(`.test__wrapper2`) === null;
|
|
3228
|
-
},
|
|
3229
|
-
handle: (event: any) => {
|
|
3230
|
-
// do something
|
|
3231
|
-
//...
|
|
3232
|
-
},
|
|
3233
|
-
spyElement: document
|
|
3234
|
-
}, [show, dropdownRef]);
|
|
3235
|
-
};
|
|
3236
|
-
|
|
3237
|
-
*/
|
|
3238
|
-
|
|
3239
|
-
function useClickOutside(_ref, deps) {
|
|
3240
|
-
var enabled = _ref.enabled,
|
|
3241
|
-
isOutside = _ref.isOutside,
|
|
3242
|
-
handle = _ref.handle,
|
|
3243
|
-
_ref$spyElement = _ref.spyElement,
|
|
3244
|
-
spyElement = _ref$spyElement === void 0 ? typeof document === 'undefined' ? null : document : _ref$spyElement;
|
|
3245
|
-
var isOutsideRef = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(isOutside);
|
|
3246
|
-
var handleRef = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(handle);
|
|
3247
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3248
|
-
isOutsideRef.current = isOutside;
|
|
3249
|
-
|
|
3250
|
-
// fix possible issue if clicking on a focusable element
|
|
3251
|
-
handleRef.current = handle;
|
|
3252
|
-
}, [isOutside, handle]);
|
|
3253
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3254
|
-
if (enabled) {
|
|
3255
|
-
var eventHandler = function eventHandler(event) {
|
|
3256
|
-
var _isOutsideRef$current;
|
|
3257
|
-
if ((_isOutsideRef$current = isOutsideRef.current) !== null && _isOutsideRef$current !== void 0 && _isOutsideRef$current.call(isOutsideRef, event)) {
|
|
3258
|
-
var _handleRef$current;
|
|
3259
|
-
(_handleRef$current = handleRef.current) === null || _handleRef$current === void 0 ? void 0 : _handleRef$current.call(handleRef, event);
|
|
3260
|
-
}
|
|
3261
|
-
};
|
|
3262
|
-
spyElement === null || spyElement === void 0 ? void 0 : spyElement.addEventListener('pointerdown', eventHandler);
|
|
3263
|
-
return function () {
|
|
3264
|
-
spyElement === null || spyElement === void 0 ? void 0 : spyElement.removeEventListener('pointerdown', eventHandler);
|
|
3265
|
-
};
|
|
3266
|
-
}
|
|
3267
|
-
}, [enabled].concat(useClickOutside_toConsumableArray(deps)));
|
|
3268
|
-
}
|
|
3269
|
-
/* harmony default export */
|
|
3270
|
-
var hooks_useClickOutside = useClickOutside;
|
|
3271
|
-
; // CONCATENATED MODULE: ./src/hooks/useKeyPress.tsx
|
|
3272
|
-
function useKeyPress_slicedToArray(arr, i) {
|
|
3273
|
-
return useKeyPress_arrayWithHoles(arr) || useKeyPress_iterableToArrayLimit(arr, i) || useKeyPress_unsupportedIterableToArray(arr, i) || useKeyPress_nonIterableRest();
|
|
3274
|
-
}
|
|
3275
|
-
function useKeyPress_nonIterableRest() {
|
|
3276
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3277
|
-
}
|
|
3278
|
-
function useKeyPress_unsupportedIterableToArray(o, minLen) {
|
|
3279
|
-
if (!o) return;
|
|
3280
|
-
if (typeof o === "string") return useKeyPress_arrayLikeToArray(o, minLen);
|
|
3281
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3282
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3283
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3284
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useKeyPress_arrayLikeToArray(o, minLen);
|
|
3285
|
-
}
|
|
3286
|
-
function useKeyPress_arrayLikeToArray(arr, len) {
|
|
3287
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3288
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3289
|
-
return arr2;
|
|
3290
|
-
}
|
|
3291
|
-
function useKeyPress_iterableToArrayLimit(arr, i) {
|
|
3292
|
-
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3293
|
-
if (null != _i) {
|
|
3294
|
-
var _s,
|
|
3295
|
-
_e,
|
|
3296
|
-
_x,
|
|
3297
|
-
_r,
|
|
3298
|
-
_arr = [],
|
|
3299
|
-
_n = !0,
|
|
3300
|
-
_d = !1;
|
|
3301
|
-
try {
|
|
3302
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3303
|
-
if (Object(_i) !== _i) return;
|
|
3304
|
-
_n = !1;
|
|
3305
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3306
|
-
} catch (err) {
|
|
3307
|
-
_d = !0, _e = err;
|
|
3308
|
-
} finally {
|
|
3309
|
-
try {
|
|
3310
|
-
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
3311
|
-
} finally {
|
|
3312
|
-
if (_d) throw _e;
|
|
3313
|
-
}
|
|
3314
|
-
}
|
|
3315
|
-
return _arr;
|
|
3316
|
-
}
|
|
3317
|
-
}
|
|
3318
|
-
function useKeyPress_arrayWithHoles(arr) {
|
|
3319
|
-
if (Array.isArray(arr)) return arr;
|
|
3320
|
-
}
|
|
3321
|
-
/**
|
|
3322
|
-
* Listens for changes in the pressed state of a given key
|
|
3323
|
-
*
|
|
3324
|
-
* @usage:
|
|
3325
|
-
|
|
3326
|
-
const App = () => {
|
|
3327
|
-
const escPressed = useKeyPress({
|
|
3328
|
-
keyCode: 'Escape',
|
|
3329
|
-
handleUp: (key, event) => { },
|
|
3330
|
-
handleDown: async (key, event) => {
|
|
3331
|
-
// do something
|
|
3332
|
-
event.preventDefault();
|
|
3333
|
-
// await xxxxx();
|
|
3334
|
-
console.log(key);
|
|
3335
|
-
},
|
|
3336
|
-
spyElement: window,
|
|
3337
|
-
}, []);
|
|
3338
|
-
|
|
3339
|
-
const multiplePressed = useKeyPress({
|
|
3340
|
-
keyCode: ['ArrowUp', 'ArrowDown', 'Enter', 'NumpadEnter'],
|
|
3341
|
-
handleUp: (key, event) => { },
|
|
3342
|
-
handleDown: (key, event) => {
|
|
3343
|
-
// do something
|
|
3344
|
-
event.preventDefault();
|
|
3345
|
-
console.log(key);
|
|
3346
|
-
},
|
|
3347
|
-
spyElement: window
|
|
3348
|
-
}, [myDep1, myDep2]);
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
return (
|
|
3352
|
-
<div className="app">{escPressed ? 'Escape' : null}</div>
|
|
3353
|
-
);
|
|
3354
|
-
};
|
|
3355
|
-
|
|
3356
|
-
*/
|
|
3357
|
-
|
|
3358
|
-
var useKeyPress = function useKeyPress(_ref, deps) {
|
|
3359
|
-
var keyCode = _ref.keyCode,
|
|
3360
|
-
handleDown = _ref.handleDown,
|
|
3361
|
-
handleUp = _ref.handleUp,
|
|
3362
|
-
_ref$spyElement = _ref.spyElement,
|
|
3363
|
-
spyElement = _ref$spyElement === void 0 ? typeof window === 'undefined' ? null : window : _ref$spyElement;
|
|
3364
|
-
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
3365
|
-
_useState2 = useKeyPress_slicedToArray(_useState, 2),
|
|
3366
|
-
keyPressed = _useState2[0],
|
|
3367
|
-
setKeyPressed = _useState2[1];
|
|
3368
|
-
var multipleKeys = Array.isArray(keyCode);
|
|
3369
|
-
|
|
3370
|
-
// `Escape`, `Enter`, `Alt`, `Control`, `CapsLock`, `Shift`, `ArrowUp`, `ArrowDown`, `ArrowLeft`, `ArrowRight` `w`, `e`, ...
|
|
3371
|
-
var eventHandlerDown = function eventHandlerDown(event) {
|
|
3372
|
-
var key = event.code;
|
|
3373
|
-
if (multipleKeys) {
|
|
3374
|
-
if (keyCode.includes(key)) {
|
|
3375
|
-
setKeyPressed(true);
|
|
3376
|
-
if (typeof handleDown === 'function') handleDown(key, event);
|
|
3377
|
-
}
|
|
3378
|
-
} else {
|
|
3379
|
-
if (key === keyCode) {
|
|
3380
|
-
setKeyPressed(true);
|
|
3381
|
-
if (typeof handleDown === 'function') handleDown(key, event);
|
|
3382
|
-
}
|
|
3383
|
-
}
|
|
3384
|
-
};
|
|
3385
|
-
var eventHandlerUp = function eventHandlerUp(event) {
|
|
3386
|
-
var key = event.code;
|
|
3387
|
-
if (multipleKeys) {
|
|
3388
|
-
if (keyCode.includes(key)) {
|
|
3389
|
-
setKeyPressed(false);
|
|
3390
|
-
if (typeof handleUp === 'function') handleUp(key, event);
|
|
3391
|
-
}
|
|
3392
|
-
} else {
|
|
3393
|
-
if (key === keyCode) {
|
|
3394
|
-
setKeyPressed(false);
|
|
3395
|
-
if (typeof handleUp === 'function') handleUp(key, event);
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
};
|
|
3399
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3400
|
-
spyElement === null || spyElement === void 0 ? void 0 : spyElement.addEventListener('keydown', eventHandlerDown);
|
|
3401
|
-
spyElement === null || spyElement === void 0 ? void 0 : spyElement.addEventListener('keyup', eventHandlerUp);
|
|
3402
|
-
return function () {
|
|
3403
|
-
spyElement === null || spyElement === void 0 ? void 0 : spyElement.removeEventListener('keydown', eventHandlerDown);
|
|
3404
|
-
spyElement === null || spyElement === void 0 ? void 0 : spyElement.removeEventListener('keyup', eventHandlerUp);
|
|
3405
|
-
};
|
|
3406
|
-
}, deps);
|
|
3407
|
-
return keyPressed;
|
|
3408
|
-
};
|
|
3409
|
-
/* harmony default export */
|
|
3410
|
-
var hooks_useKeyPress = useKeyPress;
|
|
3411
|
-
; // CONCATENATED MODULE: ./src/hooks/useWindowScroll.tsx
|
|
3412
|
-
function useWindowScroll_slicedToArray(arr, i) {
|
|
3413
|
-
return useWindowScroll_arrayWithHoles(arr) || useWindowScroll_iterableToArrayLimit(arr, i) || useWindowScroll_unsupportedIterableToArray(arr, i) || useWindowScroll_nonIterableRest();
|
|
3414
|
-
}
|
|
3415
|
-
function useWindowScroll_nonIterableRest() {
|
|
3416
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3417
|
-
}
|
|
3418
|
-
function useWindowScroll_unsupportedIterableToArray(o, minLen) {
|
|
3419
|
-
if (!o) return;
|
|
3420
|
-
if (typeof o === "string") return useWindowScroll_arrayLikeToArray(o, minLen);
|
|
3421
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3422
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3423
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3424
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useWindowScroll_arrayLikeToArray(o, minLen);
|
|
3425
|
-
}
|
|
3426
|
-
function useWindowScroll_arrayLikeToArray(arr, len) {
|
|
3427
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3428
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3429
|
-
return arr2;
|
|
3430
|
-
}
|
|
3431
|
-
function useWindowScroll_iterableToArrayLimit(arr, i) {
|
|
3432
|
-
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3433
|
-
if (null != _i) {
|
|
3434
|
-
var _s,
|
|
3435
|
-
_e,
|
|
3436
|
-
_x,
|
|
3437
|
-
_r,
|
|
3438
|
-
_arr = [],
|
|
3439
|
-
_n = !0,
|
|
3440
|
-
_d = !1;
|
|
3441
|
-
try {
|
|
3442
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3443
|
-
if (Object(_i) !== _i) return;
|
|
3444
|
-
_n = !1;
|
|
3445
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3446
|
-
} catch (err) {
|
|
3447
|
-
_d = !0, _e = err;
|
|
3448
|
-
} finally {
|
|
3449
|
-
try {
|
|
3450
|
-
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
3451
|
-
} finally {
|
|
3452
|
-
if (_d) throw _e;
|
|
3453
|
-
}
|
|
3454
|
-
}
|
|
3455
|
-
return _arr;
|
|
3456
|
-
}
|
|
3457
|
-
}
|
|
3458
|
-
function useWindowScroll_arrayWithHoles(arr) {
|
|
3459
|
-
if (Array.isArray(arr)) return arr;
|
|
3460
|
-
}
|
|
3461
|
-
/**
|
|
3462
|
-
* Listens for scrolls the window to a particular place in the document
|
|
3463
|
-
*
|
|
3464
|
-
* @usage:
|
|
3465
|
-
|
|
3466
|
-
const App = () => {
|
|
3467
|
-
const [scrollData, windowScrollUpdate] = useWindowScroll({
|
|
3468
|
-
performance: ['debounce', 500], // "['debounce', 500]" or "['throttle', 500]"
|
|
3469
|
-
handle: (scrollData) => {
|
|
3470
|
-
// do something
|
|
3471
|
-
console.log(scrollData);
|
|
3472
|
-
}
|
|
3473
|
-
});
|
|
3474
|
-
};
|
|
3475
|
-
|
|
3476
|
-
*/
|
|
3477
|
-
|
|
3478
|
-
var useWindowScroll = function useWindowScroll(_ref) {
|
|
3479
|
-
var enabled = _ref.enabled,
|
|
3480
|
-
performance = _ref.performance,
|
|
3481
|
-
handle = _ref.handle;
|
|
3482
|
-
var windowScrollUpdate;
|
|
3483
|
-
var _performance = useWindowScroll_slicedToArray(performance, 2),
|
|
3484
|
-
performanceName = _performance[0],
|
|
3485
|
-
performanceLimit = _performance[1];
|
|
3486
|
-
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
|
|
3487
|
-
x: 0,
|
|
3488
|
-
y: 0
|
|
3489
|
-
}),
|
|
3490
|
-
_useState2 = useWindowScroll_slicedToArray(_useState, 2),
|
|
3491
|
-
scrollData = _useState2[0],
|
|
3492
|
-
setScrollData = _useState2[1];
|
|
3493
|
-
var eventHandlerScroll = function eventHandlerScroll(e) {
|
|
3494
|
-
var doc = document.documentElement;
|
|
3495
|
-
var left = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);
|
|
3496
|
-
var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);
|
|
3497
|
-
var res = {
|
|
3498
|
-
x: left,
|
|
3499
|
-
y: top
|
|
3500
|
-
};
|
|
3501
|
-
setScrollData(res);
|
|
3502
|
-
if (typeof handle === "function") handle(res);
|
|
3503
|
-
};
|
|
3504
|
-
if (performanceName === "debounce") windowScrollUpdate = _debounce(eventHandlerScroll, parseFloat(performanceLimit));
|
|
3505
|
-
if (performanceName === "throttle") windowScrollUpdate = _throttle(eventHandlerScroll, parseFloat(performanceLimit));
|
|
3506
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3507
|
-
window.addEventListener("scroll", windowScrollUpdate);
|
|
3508
|
-
window.addEventListener("touchmove", windowScrollUpdate);
|
|
3509
|
-
return function () {
|
|
3510
|
-
window.removeEventListener("scroll", windowScrollUpdate);
|
|
3511
|
-
window.removeEventListener("touchmove", windowScrollUpdate);
|
|
3512
|
-
};
|
|
3513
|
-
}, []);
|
|
3514
|
-
return [scrollData, windowScrollUpdate];
|
|
3515
|
-
};
|
|
3516
|
-
/* harmony default export */
|
|
3517
|
-
var hooks_useWindowScroll = useWindowScroll;
|
|
3518
|
-
; // CONCATENATED MODULE: ./src/hooks/useDraggable.tsx
|
|
3519
|
-
function useDraggable_slicedToArray(arr, i) {
|
|
3520
|
-
return useDraggable_arrayWithHoles(arr) || useDraggable_iterableToArrayLimit(arr, i) || useDraggable_unsupportedIterableToArray(arr, i) || useDraggable_nonIterableRest();
|
|
3521
|
-
}
|
|
3522
|
-
function useDraggable_nonIterableRest() {
|
|
3523
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3524
|
-
}
|
|
3525
|
-
function useDraggable_unsupportedIterableToArray(o, minLen) {
|
|
3526
|
-
if (!o) return;
|
|
3527
|
-
if (typeof o === "string") return useDraggable_arrayLikeToArray(o, minLen);
|
|
3528
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3529
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3530
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3531
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return useDraggable_arrayLikeToArray(o, minLen);
|
|
3532
|
-
}
|
|
3533
|
-
function useDraggable_arrayLikeToArray(arr, len) {
|
|
3534
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3535
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3536
|
-
return arr2;
|
|
3537
|
-
}
|
|
3538
|
-
function useDraggable_iterableToArrayLimit(arr, i) {
|
|
3539
|
-
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
|
|
3540
|
-
if (null != _i) {
|
|
3541
|
-
var _s,
|
|
3542
|
-
_e,
|
|
3543
|
-
_x,
|
|
3544
|
-
_r,
|
|
3545
|
-
_arr = [],
|
|
3546
|
-
_n = !0,
|
|
3547
|
-
_d = !1;
|
|
3548
|
-
try {
|
|
3549
|
-
if (_x = (_i = _i.call(arr)).next, 0 === i) {
|
|
3550
|
-
if (Object(_i) !== _i) return;
|
|
3551
|
-
_n = !1;
|
|
3552
|
-
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
|
|
3553
|
-
} catch (err) {
|
|
3554
|
-
_d = !0, _e = err;
|
|
3555
|
-
} finally {
|
|
3556
|
-
try {
|
|
3557
|
-
if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return;
|
|
3558
|
-
} finally {
|
|
3559
|
-
if (_d) throw _e;
|
|
3560
|
-
}
|
|
3561
|
-
}
|
|
3562
|
-
return _arr;
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3565
|
-
function useDraggable_arrayWithHoles(arr) {
|
|
3566
|
-
if (Array.isArray(arr)) return arr;
|
|
3567
|
-
}
|
|
3568
|
-
/**
|
|
3569
|
-
* Drag & Drop Element
|
|
3570
|
-
*
|
|
3571
|
-
* @usage:
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
const App = () => {
|
|
3575
|
-
const {
|
|
3576
|
-
dragContentHandle,
|
|
3577
|
-
dragHandle,
|
|
3578
|
-
resetPosition
|
|
3579
|
-
}: any = useDraggable({
|
|
3580
|
-
enabled: true, // if `false`, drag and drop is disabled
|
|
3581
|
-
preventOutsideScreen: {
|
|
3582
|
-
xAxis: true,
|
|
3583
|
-
yAxis: true
|
|
3584
|
-
},
|
|
3585
|
-
onStart: (coordinates: Record<string, number>, handleEl: HTMLElement | null, contentEl: HTMLElement | null) => {
|
|
3586
|
-
|
|
3587
|
-
},
|
|
3588
|
-
onDrag: (coordinates: Record<string, number>, handleEl: HTMLElement | null, contentEl: HTMLElement | null) => {
|
|
3589
|
-
console.log(coordinates); // {dx: -164, dy: -37}
|
|
3590
|
-
|
|
3591
|
-
},
|
|
3592
|
-
onStop: (coordinates: Record<string, number>, handleEl: HTMLElement | null, contentEl: HTMLElement | null) => {
|
|
3593
|
-
|
|
3594
|
-
}
|
|
3595
|
-
});
|
|
3596
|
-
|
|
3597
|
-
const resetModal = () => {
|
|
3598
|
-
resetPosition?.();
|
|
3599
|
-
};
|
|
3600
|
-
|
|
3601
|
-
return (
|
|
3602
|
-
<div className="container" ref={dragContentHandle}>
|
|
3603
|
-
<div ref={dragHandle} className="handle">Drag me</div>
|
|
3604
|
-
<div className="content">
|
|
3605
|
-
content...
|
|
3606
|
-
</div>
|
|
3607
|
-
</div>
|
|
3608
|
-
);
|
|
3609
|
-
};
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
*/
|
|
3613
|
-
|
|
3614
|
-
var useDraggable = function useDraggable(_ref) {
|
|
3615
|
-
var enabled = _ref.enabled,
|
|
3616
|
-
preventOutsideScreen = _ref.preventOutsideScreen,
|
|
3617
|
-
onStart = _ref.onStart,
|
|
3618
|
-
onStop = _ref.onStop,
|
|
3619
|
-
onDrag = _ref.onDrag;
|
|
3620
|
-
var DRAG_DISABLED = typeof enabled === "undefined" || enabled === false;
|
|
3621
|
-
var dragging = false; // DO NOT USE 'useState()'
|
|
3622
|
-
var _useState = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
3623
|
-
_useState2 = useDraggable_slicedToArray(_useState, 2),
|
|
3624
|
-
node = _useState2[0],
|
|
3625
|
-
setNode = _useState2[1];
|
|
3626
|
-
var _useState3 = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(null),
|
|
3627
|
-
_useState4 = useDraggable_slicedToArray(_useState3, 2),
|
|
3628
|
-
targetNode = _useState4[0],
|
|
3629
|
-
setTargetNode = _useState4[1];
|
|
3630
|
-
var _useState5 = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)({
|
|
3631
|
-
dx: 0,
|
|
3632
|
-
dy: 0
|
|
3633
|
-
}),
|
|
3634
|
-
_useState6 = useDraggable_slicedToArray(_useState5, 2),
|
|
3635
|
-
_useState6$ = _useState6[0],
|
|
3636
|
-
dx = _useState6$.dx,
|
|
3637
|
-
dy = _useState6$.dy,
|
|
3638
|
-
setOffset = _useState6[1];
|
|
3639
|
-
var ref = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (nodeEle) {
|
|
3640
|
-
setNode(nodeEle);
|
|
3641
|
-
}, []);
|
|
3642
|
-
var targetRef = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (nodeEle) {
|
|
3643
|
-
setTargetNode(nodeEle);
|
|
3644
|
-
}, []);
|
|
3645
|
-
var withoutViewport = function withoutViewport(startPos, e, targetEl) {
|
|
3646
|
-
if (!targetEl || typeof preventOutsideScreen === 'undefined') return null;
|
|
3647
|
-
|
|
3648
|
-
// latest mouse coordinates
|
|
3649
|
-
var mouseX = e.clientX;
|
|
3650
|
-
var mouseY = e.clientY;
|
|
3651
|
-
|
|
3652
|
-
// the size of the parent element
|
|
3653
|
-
var parentWidth = window.innerWidth;
|
|
3654
|
-
var parentHeight = window.innerHeight;
|
|
3655
|
-
|
|
3656
|
-
// the size of the child element
|
|
3657
|
-
var childrenWidth = targetEl.clientWidth;
|
|
3658
|
-
var childrenHight = targetEl.clientHeight;
|
|
3659
|
-
var minLeft = -(parentWidth - childrenWidth) / 2;
|
|
3660
|
-
var maxLeft = (parentWidth - childrenWidth) / 2;
|
|
3661
|
-
var minTop = -(parentHeight - childrenHight) / 2;
|
|
3662
|
-
var maxTop = (parentHeight - childrenHight) / 2;
|
|
3663
|
-
|
|
3664
|
-
// calculates the left and top offsets after the move
|
|
3665
|
-
var nLeft = mouseX - startPos.x;
|
|
3666
|
-
var nTop = mouseY - startPos.y;
|
|
3667
|
-
|
|
3668
|
-
// Determine whether the left or right distance is out of bounds
|
|
3669
|
-
if (preventOutsideScreen.xAxis) {
|
|
3670
|
-
nLeft = nLeft <= minLeft ? minLeft : nLeft;
|
|
3671
|
-
nLeft = nLeft >= maxLeft ? maxLeft : nLeft;
|
|
3672
|
-
}
|
|
3673
|
-
if (preventOutsideScreen.yAxis) {
|
|
3674
|
-
nTop = nTop <= minTop ? minTop : nTop;
|
|
3675
|
-
nTop = nTop >= maxTop ? maxTop : nTop;
|
|
3676
|
-
}
|
|
3677
|
-
return [nLeft, nTop];
|
|
3678
|
-
};
|
|
3679
|
-
var handleMouseDown = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
|
|
3680
|
-
dragging = true;
|
|
3681
|
-
onStart === null || onStart === void 0 ? void 0 : onStart({
|
|
3682
|
-
dx: dx,
|
|
3683
|
-
dy: dy
|
|
3684
|
-
}, targetNode, node);
|
|
3685
|
-
var startPos = {
|
|
3686
|
-
x: e.clientX - dx,
|
|
3687
|
-
y: e.clientY - dy
|
|
3688
|
-
};
|
|
3689
|
-
var handleMouseMove = function handleMouseMove(e) {
|
|
3690
|
-
if (!dragging) return;
|
|
3691
|
-
var dx = e.clientX - startPos.x;
|
|
3692
|
-
var dy = e.clientY - startPos.y;
|
|
3693
|
-
|
|
3694
|
-
// prevent dragged item to be dragged outside of screen
|
|
3695
|
-
if (preventOutsideScreen && node) {
|
|
3696
|
-
var _data = withoutViewport(startPos, e, node);
|
|
3697
|
-
if (_data !== null) {
|
|
3698
|
-
dx = _data[0];
|
|
3699
|
-
dy = _data[1];
|
|
3700
|
-
}
|
|
3701
|
-
}
|
|
3702
|
-
setOffset({
|
|
3703
|
-
dx: dx,
|
|
3704
|
-
dy: dy
|
|
3705
|
-
});
|
|
3706
|
-
onDrag === null || onDrag === void 0 ? void 0 : onDrag({
|
|
3707
|
-
dx: dx,
|
|
3708
|
-
dy: dy
|
|
3709
|
-
}, targetNode, node);
|
|
3710
|
-
e.stopPropagation();
|
|
3711
|
-
e.preventDefault();
|
|
3712
|
-
};
|
|
3713
|
-
var handleMouseUp = function handleMouseUp() {
|
|
3714
|
-
dragging = false;
|
|
3715
|
-
onStop === null || onStop === void 0 ? void 0 : onStop({
|
|
3716
|
-
dx: dx,
|
|
3717
|
-
dy: dy
|
|
3718
|
-
}, targetNode, node);
|
|
3719
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
3720
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
3721
|
-
};
|
|
3722
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
3723
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
3724
|
-
}, [dx, dy, node]);
|
|
3725
|
-
var handleTouchStart = (0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(function (e) {
|
|
3726
|
-
dragging = true;
|
|
3727
|
-
onStart === null || onStart === void 0 ? void 0 : onStart({
|
|
3728
|
-
dx: dx,
|
|
3729
|
-
dy: dy
|
|
3730
|
-
}, targetNode, node);
|
|
3731
|
-
var touch = e.touches[0];
|
|
3732
|
-
var startPos = {
|
|
3733
|
-
x: touch.clientX - dx,
|
|
3734
|
-
y: touch.clientY - dy
|
|
3735
|
-
};
|
|
3736
|
-
var handleTouchMove = function handleTouchMove(e) {
|
|
3737
|
-
if (!dragging) return;
|
|
3738
|
-
var touch = e.touches[0];
|
|
3739
|
-
var dx = touch.clientX - startPos.x;
|
|
3740
|
-
var dy = touch.clientY - startPos.y;
|
|
3741
|
-
|
|
3742
|
-
// prevent dragged item to be dragged outside of screen
|
|
3743
|
-
if (preventOutsideScreen && node) {
|
|
3744
|
-
var _data = withoutViewport(startPos, touch, node);
|
|
3745
|
-
if (_data !== null) {
|
|
3746
|
-
dx = _data[0];
|
|
3747
|
-
dy = _data[1];
|
|
3748
|
-
}
|
|
3749
|
-
}
|
|
3750
|
-
setOffset({
|
|
3751
|
-
dx: dx,
|
|
3752
|
-
dy: dy
|
|
3753
|
-
});
|
|
3754
|
-
onDrag === null || onDrag === void 0 ? void 0 : onDrag({
|
|
3755
|
-
dx: dx,
|
|
3756
|
-
dy: dy
|
|
3757
|
-
}, targetNode, node);
|
|
3758
|
-
e.stopPropagation();
|
|
3759
|
-
e.preventDefault();
|
|
3760
|
-
};
|
|
3761
|
-
var handleTouchEnd = function handleTouchEnd() {
|
|
3762
|
-
dragging = false;
|
|
3763
|
-
onStop === null || onStop === void 0 ? void 0 : onStop({
|
|
3764
|
-
dx: dx,
|
|
3765
|
-
dy: dy
|
|
3766
|
-
}, targetNode, node);
|
|
3767
|
-
document.removeEventListener('touchmove', handleTouchMove);
|
|
3768
|
-
document.removeEventListener('touchend', handleTouchEnd);
|
|
3769
|
-
};
|
|
3770
|
-
document.addEventListener('touchmove', handleTouchMove);
|
|
3771
|
-
document.addEventListener('touchend', handleTouchEnd);
|
|
3772
|
-
}, [dx, dy, node]);
|
|
3773
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3774
|
-
if (node) {
|
|
3775
|
-
node.style.transform = "translate3d(".concat(dx, "px, ").concat(dy, "px, 0)");
|
|
3776
|
-
}
|
|
3777
|
-
}, [node, dx, dy]);
|
|
3778
|
-
(0, external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
3779
|
-
if (DRAG_DISABLED) {
|
|
3780
|
-
return;
|
|
3781
|
-
}
|
|
3782
|
-
if (!targetNode) {
|
|
3783
|
-
return;
|
|
3784
|
-
}
|
|
3785
|
-
targetNode.addEventListener("mousedown", handleMouseDown);
|
|
3786
|
-
targetNode.addEventListener("touchstart", handleTouchStart);
|
|
3787
|
-
return function () {
|
|
3788
|
-
targetNode.removeEventListener("mousedown", handleMouseDown);
|
|
3789
|
-
targetNode.removeEventListener("touchstart", handleTouchStart);
|
|
3790
|
-
};
|
|
3791
|
-
}, [targetNode, dx, dy]);
|
|
3792
|
-
return {
|
|
3793
|
-
dragContentHandle: ref,
|
|
3794
|
-
dragHandle: targetRef,
|
|
3795
|
-
resetPosition: function resetPosition() {
|
|
3796
|
-
// reset position
|
|
3797
|
-
setOffset({
|
|
3798
|
-
dx: 0,
|
|
3799
|
-
dy: 0
|
|
3800
|
-
});
|
|
3801
|
-
}
|
|
3802
|
-
};
|
|
3803
|
-
};
|
|
3804
|
-
/* harmony default export */
|
|
3805
|
-
var hooks_useDraggable = useDraggable;
|
|
3806
|
-
; // CONCATENATED MODULE: ./src/plugins/BSL/bodyScrollLock.ts
|
|
3807
|
-
function bodyScrollLock_toConsumableArray(arr) {
|
|
3808
|
-
return bodyScrollLock_arrayWithoutHoles(arr) || bodyScrollLock_iterableToArray(arr) || bodyScrollLock_unsupportedIterableToArray(arr) || bodyScrollLock_nonIterableSpread();
|
|
3809
|
-
}
|
|
3810
|
-
function bodyScrollLock_nonIterableSpread() {
|
|
3811
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3812
|
-
}
|
|
3813
|
-
function bodyScrollLock_unsupportedIterableToArray(o, minLen) {
|
|
3814
|
-
if (!o) return;
|
|
3815
|
-
if (typeof o === "string") return bodyScrollLock_arrayLikeToArray(o, minLen);
|
|
3816
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3817
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3818
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3819
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return bodyScrollLock_arrayLikeToArray(o, minLen);
|
|
3820
|
-
}
|
|
3821
|
-
function bodyScrollLock_iterableToArray(iter) {
|
|
3822
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
3823
|
-
}
|
|
3824
|
-
function bodyScrollLock_arrayWithoutHoles(arr) {
|
|
3825
|
-
if (Array.isArray(arr)) return bodyScrollLock_arrayLikeToArray(arr);
|
|
3826
|
-
}
|
|
3827
|
-
function bodyScrollLock_arrayLikeToArray(arr, len) {
|
|
3828
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3829
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3830
|
-
return arr2;
|
|
3831
|
-
}
|
|
3832
|
-
// =================================================================
|
|
3833
|
-
// based on https://github.com/willmcpo/body-scroll-lock
|
|
3834
|
-
// =================================================================
|
|
3835
|
-
|
|
3836
|
-
// @flow
|
|
3837
|
-
// Adopted and modified solution from Bohdan Didukh (2017)
|
|
3838
|
-
// https://stackoverflow.com/questions/41594997/ios-10-safari-prevent-scrolling-behind-a-fixed-overlay-and-maintain-scroll-posi
|
|
3839
|
-
|
|
3840
|
-
// Older browsers don't support event options, feature detect it.
|
|
3841
|
-
var hasPassiveEvents = false;
|
|
3842
|
-
if (typeof window !== 'undefined') {
|
|
3843
|
-
var passiveTestOptions = {
|
|
3844
|
-
get passive() {
|
|
3845
|
-
hasPassiveEvents = true;
|
|
3846
|
-
return undefined;
|
|
3847
|
-
}
|
|
3848
|
-
};
|
|
3849
|
-
window.addEventListener('testPassive', null, passiveTestOptions);
|
|
3850
|
-
window.removeEventListener('testPassive', null, passiveTestOptions);
|
|
3851
|
-
}
|
|
3852
|
-
var isIosDevice = typeof window !== 'undefined' && window.navigator && window.navigator.platform && (/iP(ad|hone|od)/.test(window.navigator.platform) || window.navigator.platform === 'MacIntel' && window.navigator.maxTouchPoints > 1);
|
|
3853
|
-
var locks = [];
|
|
3854
|
-
var documentListenerAdded = false;
|
|
3855
|
-
var initialClientY = -1;
|
|
3856
|
-
var previousBodyOverflowSetting;
|
|
3857
|
-
var previousBodyPosition;
|
|
3858
|
-
var previousBodyPaddingRight;
|
|
3859
|
-
|
|
3860
|
-
// returns true if `el` should be allowed to receive touchmove events.
|
|
3861
|
-
var allowTouchMove = function allowTouchMove(el) {
|
|
3862
|
-
return locks.some(function (lock) {
|
|
3863
|
-
if (lock.options.allowTouchMove && lock.options.allowTouchMove(el)) {
|
|
3864
|
-
return true;
|
|
3865
|
-
}
|
|
3866
|
-
return false;
|
|
3867
|
-
});
|
|
3868
|
-
};
|
|
3869
|
-
var preventDefault = function preventDefault(rawEvent) {
|
|
3870
|
-
var e = rawEvent || window.event;
|
|
3871
|
-
|
|
3872
|
-
// For the case whereby consumers adds a touchmove event listener to document.
|
|
3873
|
-
// Recall that we do document.addEventListener('touchmove', preventDefault, { passive: false })
|
|
3874
|
-
// in disableBodyScroll - so if we provide this opportunity to allowTouchMove, then
|
|
3875
|
-
// the touchmove event on document will break.
|
|
3876
|
-
if (allowTouchMove(e.target)) {
|
|
3877
|
-
return true;
|
|
3878
|
-
}
|
|
3879
|
-
|
|
3880
|
-
// Do not prevent if the event has more than one touch (usually meaning this is a multi touch gesture like pinch to zoom).
|
|
3881
|
-
if (e.touches.length > 1) return true;
|
|
3882
|
-
if (e.preventDefault) e.preventDefault();
|
|
3883
|
-
return false;
|
|
3884
|
-
};
|
|
3885
|
-
var setOverflowHidden = function setOverflowHidden(options) {
|
|
3886
|
-
// If previousBodyPaddingRight is already set, don't set it again.
|
|
3887
|
-
if (previousBodyPaddingRight === undefined) {
|
|
3888
|
-
var reserveScrollBarGap = !!options && options.reserveScrollBarGap === true;
|
|
3889
|
-
var scrollBarGap = window.innerWidth - document.documentElement.clientWidth;
|
|
3890
|
-
if (reserveScrollBarGap && scrollBarGap > 0) {
|
|
3891
|
-
var computedBodyPaddingRight = parseInt(window.getComputedStyle(document.body).getPropertyValue('padding-right'), 10);
|
|
3892
|
-
previousBodyPaddingRight = document.body.style.paddingRight;
|
|
3893
|
-
document.body.style.paddingRight = "".concat(computedBodyPaddingRight + scrollBarGap, "px");
|
|
3894
|
-
}
|
|
3895
|
-
}
|
|
3896
|
-
|
|
3897
|
-
// If previousBodyOverflowSetting is already set, don't set it again.
|
|
3898
|
-
if (previousBodyOverflowSetting === undefined) {
|
|
3899
|
-
previousBodyOverflowSetting = document.body.style.overflow;
|
|
3900
|
-
document.body.style.overflow = 'hidden';
|
|
3901
|
-
}
|
|
3902
|
-
};
|
|
3903
|
-
var restoreOverflowSetting = function restoreOverflowSetting() {
|
|
3904
|
-
if (previousBodyPaddingRight !== undefined) {
|
|
3905
|
-
document.body.style.paddingRight = previousBodyPaddingRight;
|
|
3906
|
-
|
|
3907
|
-
// Restore previousBodyPaddingRight to undefined so setOverflowHidden knows it
|
|
3908
|
-
// can be set again.
|
|
3909
|
-
previousBodyPaddingRight = undefined;
|
|
3910
|
-
}
|
|
3911
|
-
if (previousBodyOverflowSetting !== undefined) {
|
|
3912
|
-
document.body.style.overflow = previousBodyOverflowSetting;
|
|
3913
|
-
|
|
3914
|
-
// Restore previousBodyOverflowSetting to undefined
|
|
3915
|
-
// so setOverflowHidden knows it can be set again.
|
|
3916
|
-
previousBodyOverflowSetting = undefined;
|
|
3917
|
-
}
|
|
3918
|
-
};
|
|
3919
|
-
var setPositionFixed = function setPositionFixed() {
|
|
3920
|
-
return window.requestAnimationFrame(function () {
|
|
3921
|
-
// If previousBodyPosition is already set, don't set it again.
|
|
3922
|
-
if (previousBodyPosition === undefined) {
|
|
3923
|
-
previousBodyPosition = {
|
|
3924
|
-
position: document.body.style.position,
|
|
3925
|
-
top: document.body.style.top,
|
|
3926
|
-
left: document.body.style.left
|
|
3927
|
-
};
|
|
3928
|
-
|
|
3929
|
-
// Update the dom inside an animation frame
|
|
3930
|
-
var _window = window,
|
|
3931
|
-
scrollY = _window.scrollY,
|
|
3932
|
-
scrollX = _window.scrollX,
|
|
3933
|
-
innerHeight = _window.innerHeight;
|
|
3934
|
-
document.body.style.position = 'fixed';
|
|
3935
|
-
document.body.style.top = "".concat(-scrollY, "px");
|
|
3936
|
-
document.body.style.left = "".concat(-scrollX, "px");
|
|
3937
|
-
setTimeout(function () {
|
|
3938
|
-
return window.requestAnimationFrame(function () {
|
|
3939
|
-
// Attempt to check if the bottom bar appeared due to the position change
|
|
3940
|
-
var bottomBarHeight = innerHeight - window.innerHeight;
|
|
3941
|
-
if (bottomBarHeight && scrollY >= innerHeight) {
|
|
3942
|
-
// Move the content further up so that the bottom bar doesn't hide it
|
|
3943
|
-
document.body.style.top = "".concat(-(scrollY + bottomBarHeight));
|
|
3944
|
-
}
|
|
3945
|
-
});
|
|
3946
|
-
}, 300);
|
|
3947
|
-
}
|
|
3948
|
-
});
|
|
3949
|
-
};
|
|
3950
|
-
var restorePositionSetting = function restorePositionSetting() {
|
|
3951
|
-
if (previousBodyPosition !== undefined) {
|
|
3952
|
-
// Convert the position from "px" to Int
|
|
3953
|
-
var y = -parseInt(document.body.style.top, 10);
|
|
3954
|
-
var x = -parseInt(document.body.style.left, 10);
|
|
3955
|
-
|
|
3956
|
-
// Restore styles
|
|
3957
|
-
document.body.style.position = previousBodyPosition.position;
|
|
3958
|
-
document.body.style.top = previousBodyPosition.top;
|
|
3959
|
-
document.body.style.left = previousBodyPosition.left;
|
|
3960
|
-
|
|
3961
|
-
// Restore scroll
|
|
3962
|
-
window.scrollTo(x, y);
|
|
3963
|
-
previousBodyPosition = undefined;
|
|
3964
|
-
}
|
|
3965
|
-
};
|
|
3966
|
-
|
|
3967
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
|
|
3968
|
-
var isTargetElementTotallyScrolled = function isTargetElementTotallyScrolled(targetElement) {
|
|
3969
|
-
return targetElement ? targetElement.scrollHeight - targetElement.scrollTop <= targetElement.clientHeight : false;
|
|
3970
|
-
};
|
|
3971
|
-
var handleScroll = function handleScroll(event, targetElement) {
|
|
3972
|
-
var clientY = event.targetTouches[0].clientY - initialClientY;
|
|
3973
|
-
if (allowTouchMove(event.target)) {
|
|
3974
|
-
return false;
|
|
3975
|
-
}
|
|
3976
|
-
if (targetElement && targetElement.scrollTop === 0 && clientY > 0) {
|
|
3977
|
-
// element is at the top of its scroll.
|
|
3978
|
-
return preventDefault(event);
|
|
3979
|
-
}
|
|
3980
|
-
if (isTargetElementTotallyScrolled(targetElement) && clientY < 0) {
|
|
3981
|
-
// element is at the bottom of its scroll.
|
|
3982
|
-
return preventDefault(event);
|
|
3983
|
-
}
|
|
3984
|
-
event.stopPropagation();
|
|
3985
|
-
return true;
|
|
3986
|
-
};
|
|
3987
|
-
var _disableBodyScroll = function disableBodyScroll(targetElement, options) {
|
|
3988
|
-
// targetElement must be provided
|
|
3989
|
-
if (!targetElement) {
|
|
3990
|
-
// eslint-disable-next-line no-console
|
|
3991
|
-
console.error('disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.');
|
|
3992
|
-
return;
|
|
3993
|
-
}
|
|
3994
|
-
|
|
3995
|
-
// disableBodyScroll must not have been called on this targetElement before
|
|
3996
|
-
if (locks.some(function (lock) {
|
|
3997
|
-
return lock.targetElement === targetElement;
|
|
3998
|
-
})) {
|
|
3999
|
-
return;
|
|
4000
|
-
}
|
|
4001
|
-
var lock = {
|
|
4002
|
-
targetElement: targetElement,
|
|
4003
|
-
options: options || {}
|
|
4004
|
-
};
|
|
4005
|
-
locks = [].concat(bodyScrollLock_toConsumableArray(locks), [lock]);
|
|
4006
|
-
if (isIosDevice) {
|
|
4007
|
-
setPositionFixed();
|
|
4008
|
-
} else {
|
|
4009
|
-
setOverflowHidden(options);
|
|
4010
|
-
}
|
|
4011
|
-
if (isIosDevice) {
|
|
4012
|
-
targetElement.ontouchstart = function (event) {
|
|
4013
|
-
if (event.targetTouches.length === 1) {
|
|
4014
|
-
// detect single touch.
|
|
4015
|
-
initialClientY = event.targetTouches[0].clientY;
|
|
4016
|
-
}
|
|
4017
|
-
};
|
|
4018
|
-
targetElement.ontouchmove = function (event) {
|
|
4019
|
-
if (event.targetTouches.length === 1) {
|
|
4020
|
-
// detect single touch.
|
|
4021
|
-
handleScroll(event, targetElement);
|
|
4022
|
-
}
|
|
4023
|
-
};
|
|
4024
|
-
if (!documentListenerAdded) {
|
|
4025
|
-
document.addEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
4026
|
-
passive: false
|
|
4027
|
-
} : undefined);
|
|
4028
|
-
documentListenerAdded = true;
|
|
4029
|
-
}
|
|
4030
|
-
}
|
|
4031
|
-
};
|
|
4032
|
-
var _clearAllBodyScrollLocks = function clearAllBodyScrollLocks() {
|
|
4033
|
-
if (isIosDevice) {
|
|
4034
|
-
// Clear all locks ontouchstart/ontouchmove handlers, and the references.
|
|
4035
|
-
locks.forEach(function (lock) {
|
|
4036
|
-
lock.targetElement.ontouchstart = null;
|
|
4037
|
-
lock.targetElement.ontouchmove = null;
|
|
4038
|
-
});
|
|
4039
|
-
if (documentListenerAdded) {
|
|
4040
|
-
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
4041
|
-
passive: false
|
|
4042
|
-
} : undefined);
|
|
4043
|
-
documentListenerAdded = false;
|
|
4044
|
-
}
|
|
4045
|
-
|
|
4046
|
-
// Reset initial clientY.
|
|
4047
|
-
initialClientY = -1;
|
|
4048
|
-
}
|
|
4049
|
-
if (isIosDevice) {
|
|
4050
|
-
restorePositionSetting();
|
|
4051
|
-
} else {
|
|
4052
|
-
restoreOverflowSetting();
|
|
4053
|
-
}
|
|
4054
|
-
locks = [];
|
|
4055
|
-
};
|
|
4056
|
-
var _enableBodyScroll = function enableBodyScroll(targetElement) {
|
|
4057
|
-
if (!targetElement) {
|
|
4058
|
-
// eslint-disable-next-line no-console
|
|
4059
|
-
console.error('enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.');
|
|
4060
|
-
return;
|
|
4061
|
-
}
|
|
4062
|
-
locks = locks.filter(function (lock) {
|
|
4063
|
-
return lock.targetElement !== targetElement;
|
|
4064
|
-
});
|
|
4065
|
-
if (isIosDevice) {
|
|
4066
|
-
targetElement.ontouchstart = null;
|
|
4067
|
-
targetElement.ontouchmove = null;
|
|
4068
|
-
if (documentListenerAdded && locks.length === 0) {
|
|
4069
|
-
document.removeEventListener('touchmove', preventDefault, hasPassiveEvents ? {
|
|
4070
|
-
passive: false
|
|
4071
|
-
} : undefined);
|
|
4072
|
-
documentListenerAdded = false;
|
|
4073
|
-
}
|
|
4074
|
-
}
|
|
4075
|
-
if (isIosDevice) {
|
|
4076
|
-
restorePositionSetting();
|
|
4077
|
-
} else {
|
|
4078
|
-
restoreOverflowSetting();
|
|
4079
|
-
}
|
|
4080
|
-
};
|
|
4081
|
-
; // CONCATENATED MODULE: ./src/index.tsx
|
|
4082
|
-
|
|
4083
|
-
// hooks
|
|
4084
|
-
|
|
4085
|
-
// plugins
|
|
476
|
+
var __WEBPACK_DEFAULT_EXPORT__ = animateStyles;
|
|
4086
477
|
})();
|
|
4087
478
|
|
|
4088
479
|
/******/
|
|
@@ -4270,8 +661,9 @@ var AccordionItem = function AccordionItem(props) {
|
|
|
4270
661
|
}, children))));
|
|
4271
662
|
};
|
|
4272
663
|
/* harmony default export */ const src_AccordionItem = (AccordionItem);
|
|
4273
|
-
// EXTERNAL MODULE: ../Utils/dist/cjs/
|
|
4274
|
-
var
|
|
664
|
+
// EXTERNAL MODULE: ../Utils/dist/cjs/anim.js
|
|
665
|
+
var anim = __webpack_require__(993);
|
|
666
|
+
var anim_default = /*#__PURE__*/__webpack_require__.n(anim);
|
|
4275
667
|
;// CONCATENATED MODULE: ./src/Accordion.tsx
|
|
4276
668
|
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); }
|
|
4277
669
|
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); }
|
|
@@ -4297,7 +689,7 @@ var EasingList = /*#__PURE__*/function (EasingList) {
|
|
|
4297
689
|
EasingList["easeOut"] = "ease-out";
|
|
4298
690
|
EasingList["easeInOut"] = "ease-in-out";
|
|
4299
691
|
return EasingList;
|
|
4300
|
-
}(
|
|
692
|
+
}({});
|
|
4301
693
|
var Accordion = function Accordion(props) {
|
|
4302
694
|
var wrapperClassName = props.wrapperClassName,
|
|
4303
695
|
triggerType = props.triggerType,
|
|
@@ -4347,7 +739,7 @@ var Accordion = function Accordion(props) {
|
|
|
4347
739
|
//Hide other all sibling <dt> of the selected element
|
|
4348
740
|
Array.prototype.forEach.call($allContent, function (node) {
|
|
4349
741
|
if (node.clientHeight > 0) {
|
|
4350
|
-
(
|
|
742
|
+
anim_default()(node, {
|
|
4351
743
|
startHeight: node.scrollHeight,
|
|
4352
744
|
endHeight: 0,
|
|
4353
745
|
speed: animSpeed
|
|
@@ -4369,7 +761,7 @@ var Accordion = function Accordion(props) {
|
|
|
4369
761
|
(_reactDomEl$querySele2 = reactDomEl.querySelector('.custom-accordion-trigger')) === null || _reactDomEl$querySele2 === void 0 ? void 0 : _reactDomEl$querySele2.classList.remove('collapsed');
|
|
4370
762
|
reactDomEl.setAttribute('aria-expanded', true);
|
|
4371
763
|
// When the height of the element is 0, the value of `offsetHeight` and `clientHeight` will be 0
|
|
4372
|
-
(
|
|
764
|
+
anim_default()($curContent, {
|
|
4373
765
|
startHeight: 0,
|
|
4374
766
|
endHeight: $curContent.scrollHeight,
|
|
4375
767
|
speed: animSpeed
|
|
@@ -4385,7 +777,7 @@ var Accordion = function Accordion(props) {
|
|
|
4385
777
|
(_reactDomEl$querySele3 = reactDomEl.querySelector('.custom-accordion-trigger')) === null || _reactDomEl$querySele3 === void 0 ? void 0 : _reactDomEl$querySele3.classList.remove('active');
|
|
4386
778
|
(_reactDomEl$querySele4 = reactDomEl.querySelector('.custom-accordion-trigger')) === null || _reactDomEl$querySele4 === void 0 ? void 0 : _reactDomEl$querySele4.classList.add('collapsed');
|
|
4387
779
|
reactDomEl.setAttribute('aria-expanded', false);
|
|
4388
|
-
(
|
|
780
|
+
anim_default()($curContent, {
|
|
4389
781
|
startHeight: $curContent.scrollHeight,
|
|
4390
782
|
endHeight: 0,
|
|
4391
783
|
speed: animSpeed
|