funda-ui 4.7.624 → 4.7.701
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/{publish/CascadingSelect → CascadingSelect}/index.js +2 -2
- package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.js +2 -2
- package/{publish/Chatbox → Chatbox}/index.js +3 -17
- package/{publish/lib/cjs/Checkbox → Checkbox}/index.js +3 -3
- package/{publish/lib/cjs/ColorPicker → ColorPicker}/index.js +3 -18
- package/{publish/lib/cjs/Date → Date}/index.js +3 -18
- package/{publish/lib/cjs/EventCalendarTimeline → EventCalendarTimeline}/index.d.ts +1 -1
- package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.js +11 -1
- package/{publish/File → File}/index.d.ts +9 -0
- package/{publish/lib/cjs/File → File}/index.js +245 -93
- package/{publish/lib/cjs/Input → Input}/index.js +3 -18
- package/{publish/lib/cjs/LiveSearch → LiveSearch}/index.js +3 -18
- package/{publish/NativeSelect → NativeSelect}/index.js +3 -3
- package/{publish/NumberInput → NumberInput}/index.js +3 -18
- package/{publish/lib/css/Tooltip → Popover}/index.css +69 -69
- package/Popover/index.d.ts +4 -0
- package/{publish/lib/cjs/Tooltip → Popover}/index.js +301 -271
- package/README.md +3 -116
- package/{publish/lib/cjs/Radio → Radio}/index.js +3 -3
- package/{publish/lib/cjs/RangeSlider → RangeSlider}/index.js +3 -18
- package/{publish/SearchBar → SearchBar}/index.js +3 -18
- package/{publish/Select → Select}/index.js +3 -2
- package/{publish/Switch → Switch}/index.js +3 -3
- package/TagInput/index.css +91 -0
- package/{publish/lib/cjs/TagInput → TagInput}/index.js +12 -23
- package/{publish/lib/cjs/Textarea → Textarea}/index.js +3 -17
- package/Utils/useSSE.d.ts +9 -0
- package/{publish/lib/cjs/Utils/useKeyPress.js → Utils/useSSE.js} +88 -77
- package/{publish/all.d.ts → all.d.ts} +1 -0
- package/{publish/all.js → all.js} +1 -0
- package/lib/cjs/CascadingSelect/index.js +2 -2
- package/lib/cjs/CascadingSelectE2E/index.js +2 -2
- package/lib/cjs/Chatbox/index.js +3 -17
- package/lib/cjs/Checkbox/index.js +3 -3
- package/lib/cjs/ColorPicker/index.js +3 -18
- package/lib/cjs/Date/index.js +3 -18
- package/lib/cjs/EventCalendarTimeline/index.d.ts +1 -1
- package/lib/cjs/EventCalendarTimeline/index.js +11 -1
- package/lib/cjs/File/index.d.ts +9 -0
- package/lib/cjs/File/index.js +245 -93
- package/lib/cjs/Input/index.js +3 -18
- package/lib/cjs/LiveSearch/index.js +3 -18
- package/lib/cjs/NativeSelect/index.js +3 -3
- package/lib/cjs/NumberInput/index.js +3 -18
- package/lib/cjs/Popover/index.d.ts +4 -0
- package/{publish/lib/cjs/DropdownMenu → lib/cjs/Popover}/index.js +553 -252
- package/lib/cjs/Radio/index.js +3 -3
- package/lib/cjs/RangeSlider/index.js +3 -18
- package/lib/cjs/SearchBar/index.js +3 -18
- package/lib/cjs/Select/index.js +3 -2
- package/lib/cjs/Switch/index.js +3 -3
- package/lib/cjs/TagInput/index.js +12 -23
- package/lib/cjs/Textarea/index.js +3 -17
- package/lib/cjs/Utils/useSSE.d.ts +9 -0
- package/{publish/lib/cjs/Utils/useAutosizeTextArea.js → lib/cjs/Utils/useSSE.js} +90 -110
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/css/Popover/index.css +198 -0
- package/lib/css/TagInput/index.css +31 -31
- package/lib/esm/CascadingSelect/index.tsx +2 -2
- package/lib/esm/CascadingSelectE2E/index.tsx +2 -2
- package/lib/esm/Checkbox/index.tsx +3 -3
- package/lib/esm/ColorPicker/index.tsx +4 -15
- package/lib/esm/EventCalendarTimeline/index.tsx +11 -2
- package/lib/esm/File/index.tsx +148 -23
- package/lib/esm/Input/index.tsx +6 -17
- package/lib/esm/NativeSelect/index.tsx +3 -3
- package/lib/esm/NumberInput/index.tsx +7 -15
- package/lib/esm/Popover/Popover.tsx +251 -0
- package/lib/esm/Popover/PopoverClose.tsx +51 -0
- package/lib/esm/Popover/PopoverContent.tsx +72 -0
- package/lib/esm/Popover/PopoverTrigger.tsx +62 -0
- package/{publish/lib/esm/Tooltip → lib/esm/Popover}/index.scss +61 -61
- package/lib/esm/Popover/index.tsx +4 -0
- package/lib/esm/Radio/index.tsx +3 -3
- package/lib/esm/SearchBar/index.tsx +8 -12
- package/lib/esm/Select/index.tsx +2 -2
- package/lib/esm/Switch/index.tsx +3 -3
- package/lib/esm/TagInput/index.scss +24 -24
- package/lib/esm/TagInput/index.tsx +13 -20
- package/lib/esm/Textarea/index.tsx +6 -14
- package/lib/esm/Utils/hooks/useSSE.tsx +109 -0
- package/lib/esm/index.js +1 -0
- package/package.json +1 -591
- package/.gitattributes +0 -2
- package/README_PUBLISH.md +0 -328
- package/logo.png +0 -0
- package/preview.png +0 -0
- package/publish/Checkbox/index.js +0 -673
- package/publish/ColorPicker/index.js +0 -662
- package/publish/Date/index.js +0 -6368
- package/publish/EventCalendarTimeline/index.d.ts +0 -100
- package/publish/File/index.js +0 -1751
- package/publish/Input/index.js +0 -1486
- package/publish/LICENSE +0 -21
- package/publish/LiveSearch/index.js +0 -4180
- package/publish/README.md +0 -328
- package/publish/Radio/index.js +0 -1838
- package/publish/RangeSlider/index.js +0 -2696
- package/publish/TagInput/index.css +0 -91
- package/publish/TagInput/index.js +0 -1227
- package/publish/Textarea/index.js +0 -1795
- package/publish/lib/cjs/Accordion/index.d.ts +0 -2
- package/publish/lib/cjs/Accordion/index.js +0 -667
- package/publish/lib/cjs/BackToTop/index.d.ts +0 -17
- package/publish/lib/cjs/BackToTop/index.js +0 -904
- package/publish/lib/cjs/CascadingSelect/index.d.ts +0 -80
- package/publish/lib/cjs/CascadingSelect/index.js +0 -3383
- package/publish/lib/cjs/CascadingSelectE2E/index.d.ts +0 -91
- package/publish/lib/cjs/CascadingSelectE2E/index.js +0 -3988
- package/publish/lib/cjs/Chatbox/index.d.ts +0 -101
- package/publish/lib/cjs/Chatbox/index.js +0 -7037
- package/publish/lib/cjs/Checkbox/index.d.ts +0 -28
- package/publish/lib/cjs/ColorPicker/index.d.ts +0 -27
- package/publish/lib/cjs/Date/index.d.ts +0 -70
- package/publish/lib/cjs/DigitalClock/index.d.ts +0 -7
- package/publish/lib/cjs/DigitalClock/index.js +0 -402
- package/publish/lib/cjs/DragDropList/index.d.ts +0 -45
- package/publish/lib/cjs/DragDropList/index.js +0 -1586
- package/publish/lib/cjs/DropdownMenu/index.d.ts +0 -38
- package/publish/lib/cjs/DynamicFields/index.d.ts +0 -40
- package/publish/lib/cjs/DynamicFields/index.js +0 -818
- package/publish/lib/cjs/EventCalendar/index.d.ts +0 -61
- package/publish/lib/cjs/EventCalendar/index.js +0 -3789
- package/publish/lib/cjs/EventCalendarTimeline/index.js +0 -6141
- package/publish/lib/cjs/File/index.d.ts +0 -40
- package/publish/lib/cjs/HorizontalScrollContent/index.d.ts +0 -14
- package/publish/lib/cjs/HorizontalScrollContent/index.js +0 -426
- package/publish/lib/cjs/Input/index.d.ts +0 -59
- package/publish/lib/cjs/LiveSearch/index.d.ts +0 -70
- package/publish/lib/cjs/MasonryLayout/index.d.ts +0 -14
- package/publish/lib/cjs/MasonryLayout/index.js +0 -689
- package/publish/lib/cjs/ModalDialog/index.d.ts +0 -83
- package/publish/lib/cjs/ModalDialog/index.js +0 -1719
- package/publish/lib/cjs/ModeSwitch/index.d.ts +0 -17
- package/publish/lib/cjs/ModeSwitch/index.js +0 -202
- package/publish/lib/cjs/MultilevelDropdownMenu/index.d.ts +0 -20
- package/publish/lib/cjs/MultilevelDropdownMenu/index.js +0 -930
- package/publish/lib/cjs/MultipleCheckboxes/index.d.ts +0 -66
- package/publish/lib/cjs/MultipleCheckboxes/index.js +0 -2337
- package/publish/lib/cjs/MultipleSelect/index.d.ts +0 -65
- package/publish/lib/cjs/MultipleSelect/index.js +0 -4197
- package/publish/lib/cjs/NativeSelect/index.d.ts +0 -37
- package/publish/lib/cjs/NativeSelect/index.js +0 -2052
- package/publish/lib/cjs/NumberInput/index.d.ts +0 -40
- package/publish/lib/cjs/NumberInput/index.js +0 -1191
- package/publish/lib/cjs/Pagination/index.d.ts +0 -51
- package/publish/lib/cjs/Pagination/index.js +0 -612
- package/publish/lib/cjs/Radio/index.d.ts +0 -45
- package/publish/lib/cjs/RangeSlider/index.d.ts +0 -22
- package/publish/lib/cjs/Refresher/index.d.ts +0 -22
- package/publish/lib/cjs/Refresher/index.js +0 -564
- package/publish/lib/cjs/RootPortal/index.d.ts +0 -9
- package/publish/lib/cjs/RootPortal/index.js +0 -148
- package/publish/lib/cjs/ScrollReveal/index.d.ts +0 -21
- package/publish/lib/cjs/ScrollReveal/index.js +0 -401
- package/publish/lib/cjs/Scrollbar/index.d.ts +0 -17
- package/publish/lib/cjs/Scrollbar/index.js +0 -1107
- package/publish/lib/cjs/SearchBar/index.d.ts +0 -41
- package/publish/lib/cjs/SearchBar/index.js +0 -701
- package/publish/lib/cjs/Select/index.d.ts +0 -107
- package/publish/lib/cjs/Select/index.js +0 -6540
- package/publish/lib/cjs/ShowMoreLess/index.d.ts +0 -36
- package/publish/lib/cjs/ShowMoreLess/index.js +0 -387
- package/publish/lib/cjs/SplitterPanel/index.d.ts +0 -20
- package/publish/lib/cjs/SplitterPanel/index.js +0 -800
- package/publish/lib/cjs/Stepper/index.d.ts +0 -26
- package/publish/lib/cjs/Stepper/index.js +0 -568
- package/publish/lib/cjs/Switch/index.d.ts +0 -25
- package/publish/lib/cjs/Switch/index.js +0 -630
- package/publish/lib/cjs/Table/index.d.ts +0 -12
- package/publish/lib/cjs/Table/index.js +0 -2311
- package/publish/lib/cjs/Tabs/index.d.ts +0 -3
- package/publish/lib/cjs/Tabs/index.js +0 -771
- package/publish/lib/cjs/TagInput/index.d.ts +0 -37
- package/publish/lib/cjs/Textarea/index.d.ts +0 -50
- package/publish/lib/cjs/Toast/index.d.ts +0 -3
- package/publish/lib/cjs/Toast/index.js +0 -1345
- package/publish/lib/cjs/Tooltip/index.d.ts +0 -38
- package/publish/lib/cjs/Tree/index.d.ts +0 -78
- package/publish/lib/cjs/Tree/index.js +0 -2330
- package/publish/lib/cjs/Utils/anim.d.ts +0 -11
- package/publish/lib/cjs/Utils/anim.js +0 -846
- package/publish/lib/cjs/Utils/bodyScrollLock.d.ts +0 -8
- package/publish/lib/cjs/Utils/bodyScrollLock.js +0 -311
- package/publish/lib/cjs/Utils/buffer.d.ts +0 -67
- package/publish/lib/cjs/Utils/buffer.js +0 -343
- package/publish/lib/cjs/Utils/cls.d.ts +0 -15
- package/publish/lib/cjs/Utils/cls.js +0 -124
- package/publish/lib/cjs/Utils/convert.d.ts +0 -25
- package/publish/lib/cjs/Utils/convert.js +0 -109
- package/publish/lib/cjs/Utils/date.d.ts +0 -227
- package/publish/lib/cjs/Utils/date.js +0 -587
- package/publish/lib/cjs/Utils/dom.d.ts +0 -13
- package/publish/lib/cjs/Utils/dom.js +0 -215
- package/publish/lib/cjs/Utils/easing.d.ts +0 -29
- package/publish/lib/cjs/Utils/easing.js +0 -221
- package/publish/lib/cjs/Utils/extract.d.ts +0 -66
- package/publish/lib/cjs/Utils/extract.js +0 -195
- package/publish/lib/cjs/Utils/format-string.d.ts +0 -65
- package/publish/lib/cjs/Utils/format-string.js +0 -167
- package/publish/lib/cjs/Utils/formdata.d.ts +0 -13
- package/publish/lib/cjs/Utils/formdata.js +0 -131
- package/publish/lib/cjs/Utils/getElementProperty.d.ts +0 -52
- package/publish/lib/cjs/Utils/getElementProperty.js +0 -189
- package/publish/lib/cjs/Utils/guid.d.ts +0 -7
- package/publish/lib/cjs/Utils/guid.js +0 -67
- package/publish/lib/cjs/Utils/initDefaultOptions.d.ts +0 -10
- package/publish/lib/cjs/Utils/initDefaultOptions.js +0 -607
- package/publish/lib/cjs/Utils/inputsCalculation.d.ts +0 -28
- package/publish/lib/cjs/Utils/inputsCalculation.js +0 -188
- package/publish/lib/cjs/Utils/math.d.ts +0 -77
- package/publish/lib/cjs/Utils/math.js +0 -305
- package/publish/lib/cjs/Utils/object.d.ts +0 -18
- package/publish/lib/cjs/Utils/object.js +0 -120
- package/publish/lib/cjs/Utils/os.d.ts +0 -2
- package/publish/lib/cjs/Utils/os.js +0 -104
- package/publish/lib/cjs/Utils/performance.d.ts +0 -3
- package/publish/lib/cjs/Utils/performance.js +0 -94
- package/publish/lib/cjs/Utils/sanitize.d.ts +0 -14
- package/publish/lib/cjs/Utils/sanitize.js +0 -87
- package/publish/lib/cjs/Utils/time.d.ts +0 -40
- package/publish/lib/cjs/Utils/time.js +0 -177
- package/publish/lib/cjs/Utils/tree.d.ts +0 -40
- package/publish/lib/cjs/Utils/tree.js +0 -195
- package/publish/lib/cjs/Utils/useAutosizeTextArea.d.ts +0 -10
- package/publish/lib/cjs/Utils/useBoundedDrag.d.ts +0 -125
- package/publish/lib/cjs/Utils/useBoundedDrag.js +0 -380
- package/publish/lib/cjs/Utils/useClickOutside.d.ts +0 -33
- package/publish/lib/cjs/Utils/useClickOutside.js +0 -166
- package/publish/lib/cjs/Utils/useComId.d.ts +0 -6
- package/publish/lib/cjs/Utils/useComId.js +0 -114
- package/publish/lib/cjs/Utils/useDebounce.d.ts +0 -20
- package/publish/lib/cjs/Utils/useDebounce.js +0 -138
- package/publish/lib/cjs/Utils/useDragDropPosition.d.ts +0 -166
- package/publish/lib/cjs/Utils/useDragDropPosition.js +0 -453
- package/publish/lib/cjs/Utils/useDraggable.d.ts +0 -62
- package/publish/lib/cjs/Utils/useDraggable.js +0 -348
- package/publish/lib/cjs/Utils/useHistoryTracker.d.ts +0 -166
- package/publish/lib/cjs/Utils/useHistoryTracker.js +0 -649
- package/publish/lib/cjs/Utils/useInterval.d.ts +0 -5
- package/publish/lib/cjs/Utils/useInterval.js +0 -168
- package/publish/lib/cjs/Utils/useIsMobile.d.ts +0 -2
- package/publish/lib/cjs/Utils/useIsMobile.js +0 -232
- package/publish/lib/cjs/Utils/useKeyPress.d.ts +0 -44
- package/publish/lib/cjs/Utils/useSessionStorageListener.d.ts +0 -2
- package/publish/lib/cjs/Utils/useSessionStorageListener.js +0 -157
- package/publish/lib/cjs/Utils/useStreamController.d.ts +0 -71
- package/publish/lib/cjs/Utils/useStreamController.js +0 -494
- package/publish/lib/cjs/Utils/useThrottle.d.ts +0 -2
- package/publish/lib/cjs/Utils/useThrottle.js +0 -136
- package/publish/lib/cjs/Utils/useWindowScroll.d.ts +0 -12
- package/publish/lib/cjs/Utils/useWindowScroll.js +0 -217
- package/publish/lib/cjs/Utils/validate.d.ts +0 -53
- package/publish/lib/cjs/Utils/validate.js +0 -536
- package/publish/lib/cjs/Utils/viewport.d.ts +0 -7
- package/publish/lib/cjs/Utils/viewport.js +0 -64
- package/publish/lib/cjs/index.d.ts +0 -49
- package/publish/lib/cjs/index.js +0 -50
- package/publish/lib/css/BackToTop/index.css +0 -34
- package/publish/lib/css/CascadingSelect/index.css +0 -245
- package/publish/lib/css/CascadingSelectE2E/index.css +0 -245
- package/publish/lib/css/Chatbox/index.css +0 -774
- package/publish/lib/css/ColorPicker/index.css +0 -58
- package/publish/lib/css/Date/index.css +0 -434
- package/publish/lib/css/DragDropList/index.css +0 -188
- package/publish/lib/css/DropdownMenu/index.css +0 -151
- package/publish/lib/css/EventCalendar/index.css +0 -300
- package/publish/lib/css/EventCalendarTimeline/index.css +0 -694
- package/publish/lib/css/HorizontalScrollContent/index.css +0 -70
- package/publish/lib/css/LiveSearch/index.css +0 -88
- package/publish/lib/css/MultilevelDropdownMenu/index.css +0 -38
- package/publish/lib/css/MultipleSelect/index.css +0 -313
- package/publish/lib/css/RangeSlider/index.css +0 -150
- package/publish/lib/css/Scrollbar/index.css +0 -176
- package/publish/lib/css/Select/index.css +0 -434
- package/publish/lib/css/ShowMoreLess/index.css +0 -23
- package/publish/lib/css/SplitterPanel/index.css +0 -63
- package/publish/lib/css/Stepper/index.css +0 -250
- package/publish/lib/css/Table/index.css +0 -584
- package/publish/lib/css/TagInput/index.css +0 -91
- package/publish/lib/css/Toast/index.css +0 -149
- package/publish/lib/css/Tree/index.css +0 -237
- package/publish/lib/esm/Accordion/Accordion.tsx +0 -185
- package/publish/lib/esm/Accordion/AccordionItem.tsx +0 -248
- package/publish/lib/esm/Accordion/index.tsx +0 -2
- package/publish/lib/esm/BackToTop/index.scss +0 -47
- package/publish/lib/esm/BackToTop/index.tsx +0 -177
- package/publish/lib/esm/CascadingSelect/Group.tsx +0 -83
- package/publish/lib/esm/CascadingSelect/index.scss +0 -330
- package/publish/lib/esm/CascadingSelect/index.tsx +0 -1397
- package/publish/lib/esm/CascadingSelectE2E/Group.tsx +0 -87
- package/publish/lib/esm/CascadingSelectE2E/index.scss +0 -333
- package/publish/lib/esm/CascadingSelectE2E/index.tsx +0 -1684
- package/publish/lib/esm/Chatbox/PureLoader.tsx +0 -47
- package/publish/lib/esm/Chatbox/TypingEffect.tsx +0 -56
- package/publish/lib/esm/Chatbox/index.scss +0 -966
- package/publish/lib/esm/Chatbox/index.tsx +0 -1742
- package/publish/lib/esm/Chatbox/utils/func.ts +0 -180
- package/publish/lib/esm/Checkbox/index.tsx +0 -206
- package/publish/lib/esm/ColorPicker/index.scss +0 -91
- package/publish/lib/esm/ColorPicker/index.tsx +0 -204
- package/publish/lib/esm/Date/Calendar.tsx +0 -723
- package/publish/lib/esm/Date/index.scss +0 -567
- package/publish/lib/esm/Date/index.tsx +0 -1797
- package/publish/lib/esm/Date/localization/en_US.js +0 -13
- package/publish/lib/esm/Date/localization/zh_CN.js +0 -12
- package/publish/lib/esm/DigitalClock/index.tsx +0 -74
- package/publish/lib/esm/DragDropList/index.scss +0 -245
- package/publish/lib/esm/DragDropList/index.tsx +0 -504
- package/publish/lib/esm/DropdownMenu/Option.tsx +0 -55
- package/publish/lib/esm/DropdownMenu/index.scss +0 -205
- package/publish/lib/esm/DropdownMenu/index.tsx +0 -378
- package/publish/lib/esm/DynamicFields/index.tsx +0 -409
- package/publish/lib/esm/EventCalendar/index.scss +0 -407
- package/publish/lib/esm/EventCalendar/index.tsx +0 -1005
- package/publish/lib/esm/EventCalendarTimeline/index.scss +0 -926
- package/publish/lib/esm/EventCalendarTimeline/index.tsx +0 -2686
- package/publish/lib/esm/File/index.tsx +0 -477
- package/publish/lib/esm/HorizontalScrollContent/index.scss +0 -87
- package/publish/lib/esm/HorizontalScrollContent/index.tsx +0 -171
- package/publish/lib/esm/Input/index.tsx +0 -641
- package/publish/lib/esm/LiveSearch/index.scss +0 -129
- package/publish/lib/esm/LiveSearch/index.tsx +0 -1058
- package/publish/lib/esm/MasonryLayout/index.tsx +0 -326
- package/publish/lib/esm/ModalDialog/index.tsx +0 -572
- package/publish/lib/esm/ModeSwitch/index.tsx +0 -82
- package/publish/lib/esm/MultilevelDropdownMenu/ItemList.tsx +0 -265
- package/publish/lib/esm/MultilevelDropdownMenu/index.scss +0 -79
- package/publish/lib/esm/MultilevelDropdownMenu/index.tsx +0 -77
- package/publish/lib/esm/MultipleCheckboxes/index.tsx +0 -849
- package/publish/lib/esm/MultipleSelect/index.scss +0 -398
- package/publish/lib/esm/MultipleSelect/index.tsx +0 -769
- package/publish/lib/esm/MultipleSelect/utils/func.ts +0 -63
- package/publish/lib/esm/NativeSelect/index.tsx +0 -396
- package/publish/lib/esm/NativeSelect/utils/func.ts +0 -51
- package/publish/lib/esm/NumberInput/index.tsx +0 -425
- package/publish/lib/esm/Pagination/index.tsx +0 -286
- package/publish/lib/esm/Pagination/pagination-navigators.tsx +0 -60
- package/publish/lib/esm/Radio/index.tsx +0 -694
- package/publish/lib/esm/RangeSlider/index.scss +0 -186
- package/publish/lib/esm/RangeSlider/index.tsx +0 -241
- package/publish/lib/esm/Refresher/index.tsx +0 -121
- package/publish/lib/esm/RootPortal/index.tsx +0 -59
- package/publish/lib/esm/ScrollReveal/index.tsx +0 -148
- package/publish/lib/esm/Scrollbar/index.scss +0 -221
- package/publish/lib/esm/Scrollbar/index.tsx +0 -561
- package/publish/lib/esm/SearchBar/index.tsx +0 -252
- package/publish/lib/esm/Select/index.scss +0 -639
- package/publish/lib/esm/Select/index.tsx +0 -3104
- package/publish/lib/esm/Select/utils/func.ts +0 -98
- package/publish/lib/esm/ShowMoreLess/index.scss +0 -27
- package/publish/lib/esm/ShowMoreLess/index.tsx +0 -145
- package/publish/lib/esm/SplitterPanel/index.scss +0 -82
- package/publish/lib/esm/SplitterPanel/index.tsx +0 -174
- package/publish/lib/esm/Stepper/index.scss +0 -315
- package/publish/lib/esm/Stepper/index.tsx +0 -325
- package/publish/lib/esm/Switch/index.tsx +0 -149
- package/publish/lib/esm/Table/Table.tsx +0 -351
- package/publish/lib/esm/Table/TableBody.tsx +0 -41
- package/publish/lib/esm/Table/TableCaption.tsx +0 -34
- package/publish/lib/esm/Table/TableCell.tsx +0 -126
- package/publish/lib/esm/Table/TableColgroup.tsx +0 -38
- package/publish/lib/esm/Table/TableContext.tsx +0 -26
- package/publish/lib/esm/Table/TableFoot.tsx +0 -28
- package/publish/lib/esm/Table/TableHead.tsx +0 -28
- package/publish/lib/esm/Table/TableRow.tsx +0 -76
- package/publish/lib/esm/Table/index.scss +0 -418
- package/publish/lib/esm/Table/index.tsx +0 -14
- package/publish/lib/esm/Table/utils/DragHandleSprite.tsx +0 -46
- package/publish/lib/esm/Table/utils/SortSprite.tsx +0 -63
- package/publish/lib/esm/Table/utils/TableFilter.tsx +0 -56
- package/publish/lib/esm/Table/utils/ToggleSelection.tsx +0 -255
- package/publish/lib/esm/Table/utils/func.ts +0 -182
- package/publish/lib/esm/Table/utils/hooks/useTableDraggable.tsx +0 -342
- package/publish/lib/esm/Table/utils/hooks/useTableKeyPress.tsx +0 -255
- package/publish/lib/esm/Table/utils/hooks/useTableResponsive.tsx +0 -92
- package/publish/lib/esm/Table/utils/hooks/useTableSort.tsx +0 -187
- package/publish/lib/esm/Tabs/TabList.tsx +0 -50
- package/publish/lib/esm/Tabs/TabPanel.tsx +0 -44
- package/publish/lib/esm/Tabs/Tabs.tsx +0 -282
- package/publish/lib/esm/Tabs/index.tsx +0 -3
- package/publish/lib/esm/TagInput/index.scss +0 -126
- package/publish/lib/esm/TagInput/index.tsx +0 -379
- package/publish/lib/esm/Textarea/index.tsx +0 -621
- package/publish/lib/esm/Toast/Item.tsx +0 -165
- package/publish/lib/esm/Toast/Toast.tsx +0 -391
- package/publish/lib/esm/Toast/ToastContext.tsx +0 -104
- package/publish/lib/esm/Toast/__toast.vanilla.js +0 -422
- package/publish/lib/esm/Toast/index.scss +0 -197
- package/publish/lib/esm/Toast/index.tsx +0 -3
- package/publish/lib/esm/Toast/types.ts +0 -60
- package/publish/lib/esm/Toast/useToast.tsx +0 -72
- package/publish/lib/esm/Tooltip/index.tsx +0 -416
- package/publish/lib/esm/Tree/TreeList.tsx +0 -600
- package/publish/lib/esm/Tree/index.scss +0 -384
- package/publish/lib/esm/Tree/index.tsx +0 -661
- package/publish/lib/esm/Tree/init-height.tsx +0 -40
- package/publish/lib/esm/Tree/utils/func.ts +0 -15
- package/publish/lib/esm/Utils/hooks/useAutosizeTextArea.tsx +0 -131
- package/publish/lib/esm/Utils/hooks/useBoundedDrag.tsx +0 -301
- package/publish/lib/esm/Utils/hooks/useClickOutside.tsx +0 -69
- package/publish/lib/esm/Utils/hooks/useComId.tsx +0 -13
- package/publish/lib/esm/Utils/hooks/useDebounce.tsx +0 -40
- package/publish/lib/esm/Utils/hooks/useDragDropPosition.tsx +0 -417
- package/publish/lib/esm/Utils/hooks/useDraggable.tsx +0 -265
- package/publish/lib/esm/Utils/hooks/useHistoryTracker.tsx +0 -554
- package/publish/lib/esm/Utils/hooks/useInterval.tsx +0 -74
- package/publish/lib/esm/Utils/hooks/useIsMobile.tsx +0 -139
- package/publish/lib/esm/Utils/hooks/useKeyPress.tsx +0 -104
- package/publish/lib/esm/Utils/hooks/useSessionStorageListener.tsx +0 -45
- package/publish/lib/esm/Utils/hooks/useStreamController.tsx +0 -277
- package/publish/lib/esm/Utils/hooks/useThrottle.tsx +0 -39
- package/publish/lib/esm/Utils/hooks/useWindowScroll.tsx +0 -83
- package/publish/lib/esm/Utils/libs/anim.ts +0 -96
- package/publish/lib/esm/Utils/libs/buffer.ts +0 -262
- package/publish/lib/esm/Utils/libs/cls.ts +0 -64
- package/publish/lib/esm/Utils/libs/convert.ts +0 -59
- package/publish/lib/esm/Utils/libs/date.ts +0 -598
- package/publish/lib/esm/Utils/libs/dom.ts +0 -150
- package/publish/lib/esm/Utils/libs/easing.ts +0 -201
- package/publish/lib/esm/Utils/libs/extract.ts +0 -160
- package/publish/lib/esm/Utils/libs/format-string.ts +0 -116
- package/publish/lib/esm/Utils/libs/formdata.ts +0 -93
- package/publish/lib/esm/Utils/libs/getElementProperty.ts +0 -150
- package/publish/lib/esm/Utils/libs/guid.ts +0 -16
- package/publish/lib/esm/Utils/libs/initDefaultOptions.ts +0 -43
- package/publish/lib/esm/Utils/libs/inputsCalculation.ts +0 -160
- package/publish/lib/esm/Utils/libs/math.ts +0 -276
- package/publish/lib/esm/Utils/libs/object.ts +0 -68
- package/publish/lib/esm/Utils/libs/os.ts +0 -63
- package/publish/lib/esm/Utils/libs/performance.ts +0 -47
- package/publish/lib/esm/Utils/libs/sanitize.ts +0 -55
- package/publish/lib/esm/Utils/libs/time.ts +0 -139
- package/publish/lib/esm/Utils/libs/tree.ts +0 -119
- package/publish/lib/esm/Utils/libs/validate.ts +0 -434
- package/publish/lib/esm/Utils/libs/viewport.ts +0 -20
- package/publish/lib/esm/Utils/plugins/bodyScrollLock.ts +0 -286
- package/publish/lib/esm/index.js +0 -47
- package/publish/package.json +0 -1
- /package/{publish/Accordion → Accordion}/index.d.ts +0 -0
- /package/{publish/Accordion → Accordion}/index.js +0 -0
- /package/{publish/BackToTop → BackToTop}/index.css +0 -0
- /package/{publish/BackToTop → BackToTop}/index.d.ts +0 -0
- /package/{publish/BackToTop → BackToTop}/index.js +0 -0
- /package/{publish/CascadingSelect → CascadingSelect}/index.css +0 -0
- /package/{publish/CascadingSelect → CascadingSelect}/index.d.ts +0 -0
- /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.css +0 -0
- /package/{publish/CascadingSelectE2E → CascadingSelectE2E}/index.d.ts +0 -0
- /package/{publish/Chatbox → Chatbox}/index.css +0 -0
- /package/{publish/Chatbox → Chatbox}/index.d.ts +0 -0
- /package/{publish/Checkbox → Checkbox}/index.d.ts +0 -0
- /package/{publish/ColorPicker → ColorPicker}/index.css +0 -0
- /package/{publish/ColorPicker → ColorPicker}/index.d.ts +0 -0
- /package/{publish/Date → Date}/index.css +0 -0
- /package/{publish/Date → Date}/index.d.ts +0 -0
- /package/{publish/DigitalClock → DigitalClock}/index.d.ts +0 -0
- /package/{publish/DigitalClock → DigitalClock}/index.js +0 -0
- /package/{publish/DragDropList → DragDropList}/index.css +0 -0
- /package/{publish/DragDropList → DragDropList}/index.d.ts +0 -0
- /package/{publish/DragDropList → DragDropList}/index.js +0 -0
- /package/{publish/DropdownMenu → DropdownMenu}/index.css +0 -0
- /package/{publish/DropdownMenu → DropdownMenu}/index.d.ts +0 -0
- /package/{publish/DropdownMenu → DropdownMenu}/index.js +0 -0
- /package/{publish/DynamicFields → DynamicFields}/index.d.ts +0 -0
- /package/{publish/DynamicFields → DynamicFields}/index.js +0 -0
- /package/{publish/EventCalendar → EventCalendar}/index.css +0 -0
- /package/{publish/EventCalendar → EventCalendar}/index.d.ts +0 -0
- /package/{publish/EventCalendar → EventCalendar}/index.js +0 -0
- /package/{publish/EventCalendarTimeline → EventCalendarTimeline}/index.css +0 -0
- /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.css +0 -0
- /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.d.ts +0 -0
- /package/{publish/HorizontalScrollContent → HorizontalScrollContent}/index.js +0 -0
- /package/{publish/Input → Input}/index.d.ts +0 -0
- /package/{publish/LiveSearch → LiveSearch}/index.css +0 -0
- /package/{publish/LiveSearch → LiveSearch}/index.d.ts +0 -0
- /package/{publish/MasonryLayout → MasonryLayout}/index.d.ts +0 -0
- /package/{publish/MasonryLayout → MasonryLayout}/index.js +0 -0
- /package/{publish/ModalDialog → ModalDialog}/index.d.ts +0 -0
- /package/{publish/ModalDialog → ModalDialog}/index.js +0 -0
- /package/{publish/ModeSwitch → ModeSwitch}/index.d.ts +0 -0
- /package/{publish/ModeSwitch → ModeSwitch}/index.js +0 -0
- /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.css +0 -0
- /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.d.ts +0 -0
- /package/{publish/MultilevelDropdownMenu → MultilevelDropdownMenu}/index.js +0 -0
- /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.d.ts +0 -0
- /package/{publish/MultipleCheckboxes → MultipleCheckboxes}/index.js +0 -0
- /package/{publish/MultipleSelect → MultipleSelect}/index.css +0 -0
- /package/{publish/MultipleSelect → MultipleSelect}/index.d.ts +0 -0
- /package/{publish/MultipleSelect → MultipleSelect}/index.js +0 -0
- /package/{publish/NativeSelect → NativeSelect}/index.d.ts +0 -0
- /package/{publish/NumberInput → NumberInput}/index.d.ts +0 -0
- /package/{publish/Pagination → Pagination}/index.d.ts +0 -0
- /package/{publish/Pagination → Pagination}/index.js +0 -0
- /package/{publish/Radio → Radio}/index.d.ts +0 -0
- /package/{publish/RangeSlider → RangeSlider}/index.css +0 -0
- /package/{publish/RangeSlider → RangeSlider}/index.d.ts +0 -0
- /package/{publish/Refresher → Refresher}/index.d.ts +0 -0
- /package/{publish/Refresher → Refresher}/index.js +0 -0
- /package/{publish/RootPortal → RootPortal}/index.d.ts +0 -0
- /package/{publish/RootPortal → RootPortal}/index.js +0 -0
- /package/{publish/ScrollReveal → ScrollReveal}/index.d.ts +0 -0
- /package/{publish/ScrollReveal → ScrollReveal}/index.js +0 -0
- /package/{publish/Scrollbar → Scrollbar}/index.css +0 -0
- /package/{publish/Scrollbar → Scrollbar}/index.d.ts +0 -0
- /package/{publish/Scrollbar → Scrollbar}/index.js +0 -0
- /package/{publish/SearchBar → SearchBar}/index.d.ts +0 -0
- /package/{publish/Select → Select}/index.css +0 -0
- /package/{publish/Select → Select}/index.d.ts +0 -0
- /package/{publish/ShowMoreLess → ShowMoreLess}/index.css +0 -0
- /package/{publish/ShowMoreLess → ShowMoreLess}/index.d.ts +0 -0
- /package/{publish/ShowMoreLess → ShowMoreLess}/index.js +0 -0
- /package/{publish/SplitterPanel → SplitterPanel}/index.css +0 -0
- /package/{publish/SplitterPanel → SplitterPanel}/index.d.ts +0 -0
- /package/{publish/SplitterPanel → SplitterPanel}/index.js +0 -0
- /package/{publish/Stepper → Stepper}/index.css +0 -0
- /package/{publish/Stepper → Stepper}/index.d.ts +0 -0
- /package/{publish/Stepper → Stepper}/index.js +0 -0
- /package/{publish/Switch → Switch}/index.d.ts +0 -0
- /package/{publish/Table → Table}/index.css +0 -0
- /package/{publish/Table → Table}/index.d.ts +0 -0
- /package/{publish/Table → Table}/index.js +0 -0
- /package/{publish/Tabs → Tabs}/index.d.ts +0 -0
- /package/{publish/Tabs → Tabs}/index.js +0 -0
- /package/{publish/TagInput → TagInput}/index.d.ts +0 -0
- /package/{publish/Textarea → Textarea}/index.d.ts +0 -0
- /package/{publish/Toast → Toast}/index.css +0 -0
- /package/{publish/Toast → Toast}/index.d.ts +0 -0
- /package/{publish/Toast → Toast}/index.js +0 -0
- /package/{publish/Tooltip → Tooltip}/index.css +0 -0
- /package/{publish/Tooltip → Tooltip}/index.d.ts +0 -0
- /package/{publish/Tooltip → Tooltip}/index.js +0 -0
- /package/{publish/Tree → Tree}/index.css +0 -0
- /package/{publish/Tree → Tree}/index.d.ts +0 -0
- /package/{publish/Tree → Tree}/index.js +0 -0
- /package/{publish/Utils → Utils}/anim.d.ts +0 -0
- /package/{publish/Utils → Utils}/anim.js +0 -0
- /package/{publish/Utils → Utils}/bodyScrollLock.d.ts +0 -0
- /package/{publish/Utils → Utils}/bodyScrollLock.js +0 -0
- /package/{publish/Utils → Utils}/buffer.d.ts +0 -0
- /package/{publish/Utils → Utils}/buffer.js +0 -0
- /package/{publish/Utils → Utils}/cls.d.ts +0 -0
- /package/{publish/Utils → Utils}/cls.js +0 -0
- /package/{publish/Utils → Utils}/convert.d.ts +0 -0
- /package/{publish/Utils → Utils}/convert.js +0 -0
- /package/{publish/Utils → Utils}/date.d.ts +0 -0
- /package/{publish/Utils → Utils}/date.js +0 -0
- /package/{publish/Utils → Utils}/dom.d.ts +0 -0
- /package/{publish/Utils → Utils}/dom.js +0 -0
- /package/{publish/Utils → Utils}/easing.d.ts +0 -0
- /package/{publish/Utils → Utils}/easing.js +0 -0
- /package/{publish/Utils → Utils}/extract.d.ts +0 -0
- /package/{publish/Utils → Utils}/extract.js +0 -0
- /package/{publish/Utils → Utils}/format-string.d.ts +0 -0
- /package/{publish/Utils → Utils}/format-string.js +0 -0
- /package/{publish/Utils → Utils}/formdata.d.ts +0 -0
- /package/{publish/Utils → Utils}/formdata.js +0 -0
- /package/{publish/Utils → Utils}/getElementProperty.d.ts +0 -0
- /package/{publish/Utils → Utils}/getElementProperty.js +0 -0
- /package/{publish/Utils → Utils}/guid.d.ts +0 -0
- /package/{publish/Utils → Utils}/guid.js +0 -0
- /package/{publish/Utils → Utils}/initDefaultOptions.d.ts +0 -0
- /package/{publish/Utils → Utils}/initDefaultOptions.js +0 -0
- /package/{publish/Utils → Utils}/inputsCalculation.d.ts +0 -0
- /package/{publish/Utils → Utils}/inputsCalculation.js +0 -0
- /package/{publish/Utils → Utils}/math.d.ts +0 -0
- /package/{publish/Utils → Utils}/math.js +0 -0
- /package/{publish/Utils → Utils}/object.d.ts +0 -0
- /package/{publish/Utils → Utils}/object.js +0 -0
- /package/{publish/Utils → Utils}/os.d.ts +0 -0
- /package/{publish/Utils → Utils}/os.js +0 -0
- /package/{publish/Utils → Utils}/performance.d.ts +0 -0
- /package/{publish/Utils → Utils}/performance.js +0 -0
- /package/{publish/Utils → Utils}/sanitize.d.ts +0 -0
- /package/{publish/Utils → Utils}/sanitize.js +0 -0
- /package/{publish/Utils → Utils}/time.d.ts +0 -0
- /package/{publish/Utils → Utils}/time.js +0 -0
- /package/{publish/Utils → Utils}/tree.d.ts +0 -0
- /package/{publish/Utils → Utils}/tree.js +0 -0
- /package/{publish/Utils → Utils}/useAutosizeTextArea.d.ts +0 -0
- /package/{publish/Utils → Utils}/useAutosizeTextArea.js +0 -0
- /package/{publish/Utils → Utils}/useBoundedDrag.d.ts +0 -0
- /package/{publish/Utils → Utils}/useBoundedDrag.js +0 -0
- /package/{publish/Utils → Utils}/useClickOutside.d.ts +0 -0
- /package/{publish/Utils → Utils}/useClickOutside.js +0 -0
- /package/{publish/Utils → Utils}/useComId.d.ts +0 -0
- /package/{publish/Utils → Utils}/useComId.js +0 -0
- /package/{publish/Utils → Utils}/useDebounce.d.ts +0 -0
- /package/{publish/Utils → Utils}/useDebounce.js +0 -0
- /package/{publish/Utils → Utils}/useDragDropPosition.d.ts +0 -0
- /package/{publish/Utils → Utils}/useDragDropPosition.js +0 -0
- /package/{publish/Utils → Utils}/useDraggable.d.ts +0 -0
- /package/{publish/Utils → Utils}/useDraggable.js +0 -0
- /package/{publish/Utils → Utils}/useHistoryTracker.d.ts +0 -0
- /package/{publish/Utils → Utils}/useHistoryTracker.js +0 -0
- /package/{publish/Utils → Utils}/useInterval.d.ts +0 -0
- /package/{publish/Utils → Utils}/useInterval.js +0 -0
- /package/{publish/Utils → Utils}/useIsMobile.d.ts +0 -0
- /package/{publish/Utils → Utils}/useIsMobile.js +0 -0
- /package/{publish/Utils → Utils}/useKeyPress.d.ts +0 -0
- /package/{publish/Utils → Utils}/useKeyPress.js +0 -0
- /package/{publish/Utils → Utils}/useSessionStorageListener.d.ts +0 -0
- /package/{publish/Utils → Utils}/useSessionStorageListener.js +0 -0
- /package/{publish/Utils → Utils}/useStreamController.d.ts +0 -0
- /package/{publish/Utils → Utils}/useStreamController.js +0 -0
- /package/{publish/Utils → Utils}/useThrottle.d.ts +0 -0
- /package/{publish/Utils → Utils}/useThrottle.js +0 -0
- /package/{publish/Utils → Utils}/useWindowScroll.d.ts +0 -0
- /package/{publish/Utils → Utils}/useWindowScroll.js +0 -0
- /package/{publish/Utils → Utils}/validate.d.ts +0 -0
- /package/{publish/Utils → Utils}/validate.js +0 -0
- /package/{publish/Utils → Utils}/viewport.d.ts +0 -0
- /package/{publish/Utils → Utils}/viewport.js +0 -0
|
@@ -1,1684 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useState, forwardRef, useRef, useImperativeHandle } from 'react';
|
|
2
|
-
|
|
3
|
-
import RootPortal from 'funda-root-portal';
|
|
4
|
-
|
|
5
|
-
import useComId from 'funda-utils/dist/cjs/useComId';
|
|
6
|
-
import useWindowScroll from 'funda-utils/dist/cjs/useWindowScroll';
|
|
7
|
-
import useClickOutside from 'funda-utils/dist/cjs/useClickOutside';
|
|
8
|
-
import {
|
|
9
|
-
extractorExist,
|
|
10
|
-
extractContentsOfBraces,
|
|
11
|
-
extractContentsOfBrackets,
|
|
12
|
-
extractContentsOfMixedCharactersWithBraces,
|
|
13
|
-
extractContentsOfMixedCharactersWithComma
|
|
14
|
-
} from 'funda-utils/dist/cjs/extract';
|
|
15
|
-
import {
|
|
16
|
-
convertArrToValByBraces
|
|
17
|
-
} from 'funda-utils/dist/cjs/convert';
|
|
18
|
-
import {
|
|
19
|
-
getAbsolutePositionOfStage
|
|
20
|
-
} from 'funda-utils/dist/cjs/getElementProperty';
|
|
21
|
-
import {
|
|
22
|
-
addTreeDepth,
|
|
23
|
-
addTreeIndent
|
|
24
|
-
} from 'funda-utils/dist/cjs/tree';
|
|
25
|
-
import {
|
|
26
|
-
htmlToPlain
|
|
27
|
-
} from 'funda-utils/dist/cjs/format-string';
|
|
28
|
-
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
import Group from './Group';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export type CascadingSelectE2EOptionChangeFnType = (input: any, currentData: any, index: any, depth: any, value: string, closeFunc: any) => void;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
export interface fetchArrayConfig {
|
|
40
|
-
fetchFuncAsync?: any | undefined;
|
|
41
|
-
fetchFuncMethod?: string | undefined;
|
|
42
|
-
fetchFuncMethodParams?: any[] | undefined;
|
|
43
|
-
fetchCallback?: (data: any) => void;
|
|
44
|
-
hierarchical?: boolean;
|
|
45
|
-
indentation?: string;
|
|
46
|
-
doubleIndent?: boolean;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export type CascadingSelectE2EProps = {
|
|
50
|
-
popupRef?: React.ForwardedRef<any>; // could use "Array" on popupRef.current, such as popupRef.current[0], popupRef.current[1]
|
|
51
|
-
wrapperClassName?: string;
|
|
52
|
-
controlClassName?: string;
|
|
53
|
-
controlExClassName?: string;
|
|
54
|
-
controlGroupWrapperClassName?: string;
|
|
55
|
-
controlGroupTextClassName?: string;
|
|
56
|
-
searchable?: boolean;
|
|
57
|
-
searchPlaceholder?: string;
|
|
58
|
-
perColumnHeadersShow?: boolean;
|
|
59
|
-
exceededSidePosOffset?: number;
|
|
60
|
-
value?: string;
|
|
61
|
-
label?: React.ReactNode | string;
|
|
62
|
-
name?: string;
|
|
63
|
-
placeholder?: string;
|
|
64
|
-
readOnly?: any;
|
|
65
|
-
disabled?: any;
|
|
66
|
-
required?: any;
|
|
67
|
-
requiredLabel?: React.ReactNode | string;
|
|
68
|
-
units?: React.ReactNode | string;
|
|
69
|
-
iconLeft?: React.ReactNode | string;
|
|
70
|
-
iconRight?: React.ReactNode | string;
|
|
71
|
-
minLength?: any;
|
|
72
|
-
maxLength?: any;
|
|
73
|
-
/** Whether to use curly braces to save result and initialize default value */
|
|
74
|
-
extractValueByBraces?: boolean;
|
|
75
|
-
/** Instead of using `queryId` of response to match child and parent data
|
|
76
|
-
* (very useful for multiple fetch requests with no directly related fields),
|
|
77
|
-
* this operation will directly use the click event to modify the result. */
|
|
78
|
-
destroyParentIdMatch?: boolean;
|
|
79
|
-
/** Set headers for each column group */
|
|
80
|
-
columnTitle?: any[];
|
|
81
|
-
/** Set whether to use "label" or "value" for the value of this form
|
|
82
|
-
* Optional values: `label`, `value`
|
|
83
|
-
*/
|
|
84
|
-
valueType?: string;
|
|
85
|
-
/** Whether to display the close button. */
|
|
86
|
-
showCloseBtn?: boolean;
|
|
87
|
-
/** Set the depth value of the control to control the display of the pop-up layer appear above.
|
|
88
|
-
* Please set it when multiple controls are used at the same time. */
|
|
89
|
-
depth?: number;
|
|
90
|
-
/** Set a loader component to show while the component waits for the next load of data.
|
|
91
|
-
* e.g. `<span>Loading...</span>` or any fancy loader element */
|
|
92
|
-
loader?: React.ReactNode;
|
|
93
|
-
/** Whether it can be modified in the input box */
|
|
94
|
-
inputable?: boolean;
|
|
95
|
-
/** Set an arrow of breadcrumb result */
|
|
96
|
-
displayResultArrow?: React.ReactNode;
|
|
97
|
-
/** Set an arrow of control */
|
|
98
|
-
controlArrow?: React.ReactNode;
|
|
99
|
-
/** Specify a class for trigger. */
|
|
100
|
-
triggerClassName?: string;
|
|
101
|
-
/** Set a piece of text or HTML code for the trigger */
|
|
102
|
-
triggerContent?: React.ReactNode;
|
|
103
|
-
/** Specify a class for clean node button. */
|
|
104
|
-
cleanNodeBtnClassName?: string;
|
|
105
|
-
/** Set a piece of text or HTML code for the clean node button */
|
|
106
|
-
cleanNodeBtnContent?: React.ReactNode;
|
|
107
|
-
/** Configuration for multiple requests */
|
|
108
|
-
fetchArray?: fetchArrayConfig[];
|
|
109
|
-
/** -- */
|
|
110
|
-
id?: string;
|
|
111
|
-
style?: React.CSSProperties;
|
|
112
|
-
tabIndex?: number;
|
|
113
|
-
[key: `data-${string}`]: string | undefined;
|
|
114
|
-
onFetch?: (data: any, childrenData: any) => void;
|
|
115
|
-
onChange?: CascadingSelectE2EOptionChangeFnType | null;
|
|
116
|
-
onBlur?: (e: any) => void;
|
|
117
|
-
onFocus?: (e: any) => void;
|
|
118
|
-
/**
|
|
119
|
-
* Customize the function of formatting the value of the input input box, and the parameters are labels, values, and queryIds
|
|
120
|
-
* Returns a string as the value of the input
|
|
121
|
-
*/
|
|
122
|
-
formatInputResult?: (param: Array<{label: string, value: string | number}>) => string;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const CascadingSelectE2E = forwardRef((props: CascadingSelectE2EProps, externalRef: any) => {
|
|
127
|
-
const {
|
|
128
|
-
popupRef,
|
|
129
|
-
wrapperClassName,
|
|
130
|
-
controlClassName,
|
|
131
|
-
controlExClassName,
|
|
132
|
-
controlGroupWrapperClassName,
|
|
133
|
-
controlGroupTextClassName,
|
|
134
|
-
searchable = false,
|
|
135
|
-
searchPlaceholder = '',
|
|
136
|
-
perColumnHeadersShow = true,
|
|
137
|
-
exceededSidePosOffset,
|
|
138
|
-
readOnly,
|
|
139
|
-
disabled,
|
|
140
|
-
required,
|
|
141
|
-
requiredLabel,
|
|
142
|
-
units,
|
|
143
|
-
iconLeft,
|
|
144
|
-
iconRight,
|
|
145
|
-
minLength,
|
|
146
|
-
maxLength,
|
|
147
|
-
value,
|
|
148
|
-
label,
|
|
149
|
-
placeholder,
|
|
150
|
-
name,
|
|
151
|
-
id,
|
|
152
|
-
extractValueByBraces,
|
|
153
|
-
destroyParentIdMatch,
|
|
154
|
-
columnTitle,
|
|
155
|
-
depth,
|
|
156
|
-
loader,
|
|
157
|
-
inputable = false,
|
|
158
|
-
displayResultArrow,
|
|
159
|
-
controlArrow,
|
|
160
|
-
valueType,
|
|
161
|
-
showCloseBtn,
|
|
162
|
-
style,
|
|
163
|
-
tabIndex,
|
|
164
|
-
triggerClassName,
|
|
165
|
-
triggerContent,
|
|
166
|
-
cleanNodeBtnClassName,
|
|
167
|
-
cleanNodeBtnContent,
|
|
168
|
-
fetchArray,
|
|
169
|
-
onFetch,
|
|
170
|
-
onChange,
|
|
171
|
-
onBlur,
|
|
172
|
-
onFocus,
|
|
173
|
-
formatInputResult,
|
|
174
|
-
...attributes
|
|
175
|
-
} = props;
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const DEPTH = depth || 1055; // the default value same as bootstrap
|
|
179
|
-
const POS_OFFSET = 0;
|
|
180
|
-
const EXCEEDED_SIDE_POS_OFFSET = Number(exceededSidePosOffset) || 15;
|
|
181
|
-
const VALUE_BY_BRACES = typeof extractValueByBraces === 'undefined' ? true : extractValueByBraces;
|
|
182
|
-
const uniqueID = useComId();
|
|
183
|
-
const idRes = id || uniqueID;
|
|
184
|
-
const rootRef = useRef<any>(null);
|
|
185
|
-
const inputRef = useRef<any>(null);
|
|
186
|
-
const listRef = useRef<any>(null);
|
|
187
|
-
const MIN_SPACE_FOR_DROPDOWN = 200; // Minimum space needed to show dropdown below trigger
|
|
188
|
-
|
|
189
|
-
// searchable
|
|
190
|
-
const [columnSearchKeywords, setColumnSearchKeywords] = useState<string[]>([]);
|
|
191
|
-
|
|
192
|
-
const propExist = (p: any) => {
|
|
193
|
-
return typeof p !== 'undefined' && p !== null && p !== '';
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
const resultInput = (curData: string[] | number[], curQueryIdsData: string[] | number[]) => {
|
|
197
|
-
return VALUE_BY_BRACES ? convertArrToValByBraces(curData.map((item: any, i: number) => `${item}[${curQueryIdsData[i]}]`)) : curData.map((item: any, i: number) => `${item}[${curQueryIdsData[i]}]`)!.join(',');
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const resultInputPureText = (inputStr: string) => {
|
|
201
|
-
return VALUE_BY_BRACES ? `{${inputStr}[]}` : `${inputStr}[]`;
|
|
202
|
-
|
|
203
|
-
// value1: {{curLabel[curValue]}[]}
|
|
204
|
-
// value2: curLabel[curValue][]
|
|
205
|
-
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
// exposes the following methods
|
|
209
|
-
useImperativeHandle(
|
|
210
|
-
popupRef,
|
|
211
|
-
() => ({
|
|
212
|
-
close: () => {
|
|
213
|
-
cancel();
|
|
214
|
-
},
|
|
215
|
-
}),
|
|
216
|
-
[popupRef],
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
223
|
-
// DO NOT USE `useState()` for `allData`,, `optData`, `dictionaryData`, `listData`, `selectedData`, `selectedDataByClick`,
|
|
224
|
-
// because the list uses vanilla JS DOM events which will cause the results of useState not to be displayed in real time.
|
|
225
|
-
// @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
// current data depth (GLOBAL)
|
|
229
|
-
const [currentDataDepth, setCurrentDataDepth] = useState<number>(0);
|
|
230
|
-
|
|
231
|
-
// all data from fetched data (GLOBAL)
|
|
232
|
-
const allData = useRef<any[]>([]);
|
|
233
|
-
|
|
234
|
-
// options data (GLOBAL)
|
|
235
|
-
const optData = useRef<any[]>([]);
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
// dictionary data
|
|
239
|
-
const dictionaryData = useRef<any[]>([]);
|
|
240
|
-
|
|
241
|
-
const [loading, setLoading] = useState<boolean>(false);
|
|
242
|
-
const [columnTitleData, setColumnTitleData] = useState<any[]>([]);
|
|
243
|
-
const [hasErr, setHasErr] = useState<boolean>(false);
|
|
244
|
-
const [firstDataFeched, setFirstDataFeched] = useState<boolean>(false);
|
|
245
|
-
const [changedVal, setChangedVal] = useState<string>(value || '');
|
|
246
|
-
|
|
247
|
-
//for variable
|
|
248
|
-
const listData = useRef<any[]>([]);
|
|
249
|
-
const selectedData = useRef<any>({
|
|
250
|
-
labels: [],
|
|
251
|
-
values: [],
|
|
252
|
-
queryIds: []
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
// destroy `queryId` match
|
|
256
|
-
const selectedDataByClick = useRef<any>({
|
|
257
|
-
labels: [],
|
|
258
|
-
values: [],
|
|
259
|
-
queryIds: []
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
const [isShow, setIsShow] = useState<boolean>(false);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
// click outside
|
|
267
|
-
useClickOutside({
|
|
268
|
-
enabled: isShow && rootRef.current && listRef.current,
|
|
269
|
-
isOutside: (event: any) => {
|
|
270
|
-
|
|
271
|
-
// close dropdown when other dropdown is opened
|
|
272
|
-
return (
|
|
273
|
-
(rootRef.current !== event.target && !rootRef.current.contains(event.target as HTMLElement)) &&
|
|
274
|
-
listRef.current !== event.target && !listRef.current.contains(event.target as HTMLElement)
|
|
275
|
-
)
|
|
276
|
-
|
|
277
|
-
},
|
|
278
|
-
handle: (event: any) => {
|
|
279
|
-
cancel();
|
|
280
|
-
}
|
|
281
|
-
}, [isShow, rootRef, listRef]);
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
// Add function to the element that should be used as the scrollable area.
|
|
286
|
-
const [scrollData, windowScrollUpdate] = useWindowScroll({
|
|
287
|
-
performance: ['debounce', 500], // "['debounce', 500]" or "['throttle', 500]"
|
|
288
|
-
handle: (scrollData: any) => {
|
|
289
|
-
popwinPosInit(false);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
function popwinPosInit(showAct: boolean = true) {
|
|
296
|
-
if (rootRef.current === null || inputRef.current === null) return;
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
// update modal position
|
|
300
|
-
const _modalRef: any = document.querySelector(`#casc-menu-e2e__items-wrapper-${idRes}`);
|
|
301
|
-
const _triggerRef: any = inputRef.current;
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
// console.log(getAbsolutePositionOfStage(_triggerRef));
|
|
305
|
-
|
|
306
|
-
if (_modalRef === null) return;
|
|
307
|
-
|
|
308
|
-
const { x } = getAbsolutePositionOfStage(_triggerRef);
|
|
309
|
-
const { y, width, height } = getAbsolutePositionOfStage(_triggerRef);
|
|
310
|
-
const _triggerBox = _triggerRef.getBoundingClientRect();
|
|
311
|
-
let targetPos = '';
|
|
312
|
-
|
|
313
|
-
// STEP 1:
|
|
314
|
-
//-----------
|
|
315
|
-
// display wrapper
|
|
316
|
-
if (showAct) _modalRef.classList.add('active');
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
// STEP 2:
|
|
320
|
-
//-----------
|
|
321
|
-
// Detect position
|
|
322
|
-
if (window.innerHeight - _triggerBox.top > MIN_SPACE_FOR_DROPDOWN) {
|
|
323
|
-
targetPos = 'bottom';
|
|
324
|
-
} else {
|
|
325
|
-
targetPos = 'top';
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
// STEP 3:
|
|
330
|
-
//-----------
|
|
331
|
-
// Adjust position
|
|
332
|
-
if (targetPos === 'top') {
|
|
333
|
-
_modalRef.style.left = x + 'px';
|
|
334
|
-
//_modalRef.style.top = y - POS_OFFSET - (listRef.current.clientHeight) - 2 + 'px';
|
|
335
|
-
_modalRef.style.top = 'auto';
|
|
336
|
-
_modalRef.style.bottom = (window.innerHeight - _triggerBox.top) + POS_OFFSET + 2 + 'px';
|
|
337
|
-
_modalRef.style.setProperty('position', 'fixed', 'important');
|
|
338
|
-
_modalRef.classList.add('pos-top');
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
if (targetPos === 'bottom') {
|
|
342
|
-
_modalRef.style.left = x + 'px';
|
|
343
|
-
_modalRef.style.bottom = 'auto';
|
|
344
|
-
_modalRef.style.top = y + height + POS_OFFSET + 'px';
|
|
345
|
-
_modalRef.style.setProperty('position', 'absolute', 'important');
|
|
346
|
-
_modalRef.classList.remove('pos-top');
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
// STEP 4:
|
|
352
|
-
//-----------
|
|
353
|
-
// Determine whether it exceeds the far right or left side of the screen
|
|
354
|
-
const _modalContent = _modalRef;
|
|
355
|
-
const _modalBox = _modalContent.getBoundingClientRect();
|
|
356
|
-
if (typeof _modalContent.dataset.offset === 'undefined' && _modalBox.left > 0) {
|
|
357
|
-
|
|
358
|
-
// 10 pixels is used to account for some bias in mobile devices
|
|
359
|
-
if ((_modalBox.right + 10) > window.innerWidth) {
|
|
360
|
-
const _modalOffsetPosition = _modalBox.right - window.innerWidth + EXCEEDED_SIDE_POS_OFFSET;
|
|
361
|
-
_modalContent.dataset.offset = _modalOffsetPosition;
|
|
362
|
-
_modalContent.style.marginLeft = `-${_modalOffsetPosition}px`;
|
|
363
|
-
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
if ((_modalBox.left - 10) < 0) {
|
|
368
|
-
const _modalOffsetPosition = Math.abs(_modalBox.left) + EXCEEDED_SIDE_POS_OFFSET;
|
|
369
|
-
_modalContent.dataset.offset = _modalOffsetPosition;
|
|
370
|
-
_modalContent.style.marginLeft = `${_modalOffsetPosition}px`;
|
|
371
|
-
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
function popwinPosHide() {
|
|
384
|
-
|
|
385
|
-
const _modalRef: any = document.querySelector(`#casc-menu-e2e__items-wrapper-${idRes}`);
|
|
386
|
-
|
|
387
|
-
if (_modalRef !== null) {
|
|
388
|
-
// remove classnames and styles
|
|
389
|
-
_modalRef.classList.remove('active');
|
|
390
|
-
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
function updateColDisplay(useFetch: boolean, emptyAction: boolean = false, level: number | undefined) {
|
|
398
|
-
if (listRef.current === null) return;
|
|
399
|
-
|
|
400
|
-
let latestDisplayColIndex: number = 0;
|
|
401
|
-
const currentItemsInner: any = listRef.current.querySelector('.casc-menu-e2e__items-inner');
|
|
402
|
-
if (currentItemsInner !== null) {
|
|
403
|
-
const colItemsWrapper = [].slice.call(currentItemsInner.querySelectorAll('.casc-menu-e2e__items-col'));
|
|
404
|
-
colItemsWrapper.forEach((perCol: any) => {
|
|
405
|
-
perCol.classList.remove('hide-col');
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
colItemsWrapper.some((perCol: any, i: number) => {
|
|
409
|
-
const hasActive = [].slice.call(perCol.querySelectorAll('[data-opt]')).some((el: HTMLElement) => el.classList.contains('active'));
|
|
410
|
-
if (!hasActive) {
|
|
411
|
-
latestDisplayColIndex = i;
|
|
412
|
-
return true;
|
|
413
|
-
}
|
|
414
|
-
return false;
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
// remove columns behind the current empty trigger
|
|
418
|
-
colItemsWrapper.forEach((perCol: any, i: number) => {
|
|
419
|
-
if (!emptyAction) {
|
|
420
|
-
if (useFetch) {
|
|
421
|
-
if (i > latestDisplayColIndex && latestDisplayColIndex > 0) perCol.classList.add('hide-col');
|
|
422
|
-
} else {
|
|
423
|
-
if (i === latestDisplayColIndex && latestDisplayColIndex > 0) perCol.classList.add('hide-col');
|
|
424
|
-
}
|
|
425
|
-
} else {
|
|
426
|
-
if (typeof level !== 'undefined' && Number.isInteger(level)) {
|
|
427
|
-
if (i > level) perCol.classList.add('hide-col');
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
function cancel() {
|
|
442
|
-
// hide list
|
|
443
|
-
setIsShow(false);
|
|
444
|
-
popwinPosHide();
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
function activate() {
|
|
448
|
-
// show list
|
|
449
|
-
setIsShow(true);
|
|
450
|
-
|
|
451
|
-
// update data depth
|
|
452
|
-
setCurrentDataDepth(0);
|
|
453
|
-
|
|
454
|
-
// Execute the fetch task
|
|
455
|
-
if (!firstDataFeched) {
|
|
456
|
-
setLoading(true);
|
|
457
|
-
setFirstDataFeched(true);
|
|
458
|
-
doFetch(false, currentDataDepth, 0, false);
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
// window position
|
|
462
|
-
setTimeout(() => {
|
|
463
|
-
popwinPosInit();
|
|
464
|
-
}, 0);
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
async function fetchData(_fetchArray: any, params: string, dataDepth: number, parentId: number = 0) {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
const fetchFuncAsync = _fetchArray.fetchFuncAsync;
|
|
473
|
-
const fetchFuncMethod = _fetchArray.fetchFuncMethod;
|
|
474
|
-
const fetchCallback = _fetchArray.fetchCallback;
|
|
475
|
-
|
|
476
|
-
//
|
|
477
|
-
const hierarchical = _fetchArray.hierarchical;
|
|
478
|
-
const indentation = _fetchArray.indentation;
|
|
479
|
-
const doubleIndent = _fetchArray.doubleIndent;
|
|
480
|
-
const INDENT_PLACEHOLDER = doubleIndent ? ` ` : ` `;
|
|
481
|
-
const INDENT_LAST_PLACEHOLDER = `${typeof indentation !== 'undefined' && indentation !== '' ? `${indentation} ` : ''}`;
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if (typeof fetchFuncAsync === 'object') {
|
|
486
|
-
|
|
487
|
-
//
|
|
488
|
-
setLoading(true);
|
|
489
|
-
|
|
490
|
-
const response: any = await fetchFuncAsync[`${fetchFuncMethod}`](...params.split(','));
|
|
491
|
-
let _ORGIN_DATA: any[] = response.data;
|
|
492
|
-
let _TEMP_ALL_DATA: any[] = [];
|
|
493
|
-
|
|
494
|
-
// loading
|
|
495
|
-
setLoading(false);
|
|
496
|
-
|
|
497
|
-
if (typeof _ORGIN_DATA[0] === 'undefined') return;
|
|
498
|
-
|
|
499
|
-
// reset data structure
|
|
500
|
-
if (typeof (fetchCallback) === 'function') {
|
|
501
|
-
_ORGIN_DATA = fetchCallback(_ORGIN_DATA);
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
// Determine whether the data structure matches
|
|
506
|
-
if (_ORGIN_DATA.length > 0 && typeof _ORGIN_DATA[0].id === 'undefined') {
|
|
507
|
-
console.warn('The data structure does not match, please refer to the example in the component documentation.');
|
|
508
|
-
setHasErr(true);
|
|
509
|
-
_ORGIN_DATA = [];
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
// STEP 0-1: ===========
|
|
514
|
-
// Set hierarchical categories ( with sub-categories )
|
|
515
|
-
if (hierarchical) {
|
|
516
|
-
_ORGIN_DATA = addTreeDepth(_ORGIN_DATA);
|
|
517
|
-
addTreeIndent(_ORGIN_DATA, INDENT_PLACEHOLDER, INDENT_LAST_PLACEHOLDER, 'label');
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
// STEP 0-2: ===========
|
|
522
|
-
// add data depth
|
|
523
|
-
_ORGIN_DATA.forEach((item: any) => {
|
|
524
|
-
item.itemDepth = dataDepth;
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
if (dataDepth === 0) {
|
|
530
|
-
|
|
531
|
-
// STEP 1: ===========
|
|
532
|
-
// all data from fetched data
|
|
533
|
-
_TEMP_ALL_DATA = JSON.parse(JSON.stringify(_ORGIN_DATA));
|
|
534
|
-
allData.current = _TEMP_ALL_DATA;
|
|
535
|
-
|
|
536
|
-
// STEP 2: ===========
|
|
537
|
-
// dictionary data (orginal)
|
|
538
|
-
dictionaryData.current = _TEMP_ALL_DATA;
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
}
|
|
542
|
-
if (dataDepth > 0) {
|
|
543
|
-
|
|
544
|
-
// STEP 1: ===========
|
|
545
|
-
// all data from fetched data
|
|
546
|
-
_TEMP_ALL_DATA = allData.current;
|
|
547
|
-
addChildrenOpt(_TEMP_ALL_DATA, parentId, _ORGIN_DATA);
|
|
548
|
-
|
|
549
|
-
// STEP 2: ===========
|
|
550
|
-
// dictionary data (orginal)
|
|
551
|
-
dictionaryData.current = _TEMP_ALL_DATA;
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
// STEP 3: ===========
|
|
558
|
-
// Add an empty item to each list to support empty item selection
|
|
559
|
-
const _EMPTY_SUPPORTED_DATA = JSON.parse(JSON.stringify(_TEMP_ALL_DATA));
|
|
560
|
-
addEmptyOpt(_EMPTY_SUPPORTED_DATA, 0);
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
// STEP 4: ===========
|
|
565
|
-
// Turn the data of each group into an array
|
|
566
|
-
let _temp_optData;
|
|
567
|
-
if (dataDepth === 0) {
|
|
568
|
-
|
|
569
|
-
_temp_optData = [_EMPTY_SUPPORTED_DATA];
|
|
570
|
-
optData.current = _temp_optData;
|
|
571
|
-
listData.current = _temp_optData;
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
if (dataDepth > 0) {
|
|
575
|
-
_temp_optData = listData.current;
|
|
576
|
-
|
|
577
|
-
// Add an empty item to each list to support empty item selection
|
|
578
|
-
addEmptyOpt(_ORGIN_DATA, 0);
|
|
579
|
-
|
|
580
|
-
const childList = _ORGIN_DATA;
|
|
581
|
-
_temp_optData[dataDepth] = childList;
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
optData.current = _temp_optData;
|
|
585
|
-
listData.current = optData.current;
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
// STEP 5: ===========
|
|
589
|
-
//
|
|
590
|
-
onFetch?.(_EMPTY_SUPPORTED_DATA, _ORGIN_DATA);
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
// STEP 6: ===========
|
|
595
|
-
// update column display with DOM
|
|
596
|
-
updateColDisplay(true, false, undefined);
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
return [_ORGIN_DATA, _EMPTY_SUPPORTED_DATA];
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
} else {
|
|
604
|
-
return [];
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
}
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
//
|
|
612
|
-
function doFetch(dataDepthMax: boolean, dataDepth: number = 0, parentId: number = 0, emptyAction: boolean = false) {
|
|
613
|
-
|
|
614
|
-
// if empty selection is selected
|
|
615
|
-
if (emptyAction) return;
|
|
616
|
-
|
|
617
|
-
// If the depth is max, no more requests
|
|
618
|
-
if (dataDepthMax) return;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
// other
|
|
622
|
-
if (typeof fetchArray![dataDepth] === 'undefined') return new Promise((resolve, reject) => resolve([[], []]));
|
|
623
|
-
|
|
624
|
-
// data fetch action
|
|
625
|
-
const _oparams: any[] = fetchArray![dataDepth].fetchFuncMethodParams || [];
|
|
626
|
-
const _params: any[] = _oparams.map((item: any) => item !== '$QUERY_ID' ? item : parentId);
|
|
627
|
-
return fetchData(fetchArray![dataDepth], (_params).join(','), dataDepth, parentId);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
function handleFocus(event: any) {
|
|
633
|
-
rootRef.current?.classList.add('focus');
|
|
634
|
-
|
|
635
|
-
//
|
|
636
|
-
handleDisplayOptions(null);
|
|
637
|
-
|
|
638
|
-
//
|
|
639
|
-
onFocus?.(event);
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
function handleBlur(event: any) {
|
|
644
|
-
|
|
645
|
-
//----
|
|
646
|
-
//remove focus style
|
|
647
|
-
rootRef.current?.classList.remove('focus');
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
//
|
|
651
|
-
onBlur?.(event);
|
|
652
|
-
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
function handleDisplayOptions(event: any) {
|
|
657
|
-
if (event) event.preventDefault();
|
|
658
|
-
if (isShow) return;
|
|
659
|
-
activate();
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
function handleClickItem(e: any, resValue: any, index: number, level: number, curData: any[]) {
|
|
664
|
-
e.preventDefault();
|
|
665
|
-
|
|
666
|
-
const maxDepth: number = fetchArray!.length - 1;
|
|
667
|
-
const dataDepthMax: boolean = resValue.itemDepth === maxDepth;
|
|
668
|
-
const parentId: number = e.currentTarget.dataset.query;
|
|
669
|
-
const emptyAction: boolean = resValue.id.toString().indexOf('$EMPTY_ID_') < 0 ? false : true;
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
// update data depth
|
|
673
|
-
//////////////////////////////////////////
|
|
674
|
-
setCurrentDataDepth((prevState) => {
|
|
675
|
-
const _currentDataDepth = resValue.itemDepth + 1;
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
// update column display with DOM
|
|
679
|
-
//////////////////////////////////////////
|
|
680
|
-
updateColDisplay(false, emptyAction, level);
|
|
681
|
-
|
|
682
|
-
// Execute the fetch task
|
|
683
|
-
//////////////////////////////////////////
|
|
684
|
-
doFetch(dataDepthMax, _currentDataDepth, parentId, emptyAction)?.then((res: any) => {
|
|
685
|
-
|
|
686
|
-
// if no data is available with request, close the modal
|
|
687
|
-
if (typeof res === 'undefined') {
|
|
688
|
-
updateColDisplay(false, true, level); // clean rest colums hardhanded
|
|
689
|
-
cancel();
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
return _currentDataDepth > maxDepth ? maxDepth : _currentDataDepth;
|
|
695
|
-
|
|
696
|
-
});
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
//update selected data by clicked item
|
|
700
|
-
//////////////////////////////////////////
|
|
701
|
-
updateValueByClickedItem(resValue, level);
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
// update value
|
|
705
|
-
//////////////////////////////////////////
|
|
706
|
-
const inputVal = updateValue(dictionaryData.current, resValue.id, level);
|
|
707
|
-
|
|
708
|
-
// callback
|
|
709
|
-
//////////////////////////////////////////
|
|
710
|
-
if (typeof onChange === 'function') {
|
|
711
|
-
const curValString = valueType === 'value' ? inputVal[0] : inputVal[1];
|
|
712
|
-
const curValCallback = typeof formatInputResult === 'function' ? formatInputResult(
|
|
713
|
-
VALUE_BY_BRACES
|
|
714
|
-
? extractContentsOfMixedCharactersWithBraces(curValString)
|
|
715
|
-
: extractContentsOfMixedCharactersWithComma(curValString)
|
|
716
|
-
) : curValString;
|
|
717
|
-
|
|
718
|
-
onChange(inputRef.current, resValue, index, level, curValCallback, cancel);
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
// update data
|
|
723
|
-
//////////////////////////////////////////
|
|
724
|
-
let newData: any = curData; // such as: [Array(6), Array(3)]
|
|
725
|
-
|
|
726
|
-
// remove Duplicate objects from JSON Array
|
|
727
|
-
newData = newData.filter((item: any, index: number, self: any) => index === self.findIndex((t: any) => (JSON.stringify(t) === JSON.stringify(item))));
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
// All the elements from start(array.length - start) to the end of the array will be deleted.
|
|
731
|
-
newData.splice(level + 1);
|
|
732
|
-
|
|
733
|
-
// When requesting a return asynchronously, a new column is added only under the currently clicked column,
|
|
734
|
-
// and the previous column cannot be affected.
|
|
735
|
-
// Make sure that subsequent asynchronous requests will only insert new columns towards the level+1 position.
|
|
736
|
-
listData.current = [...newData];
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
// active status
|
|
740
|
-
if (resValue.children) {
|
|
741
|
-
const childList = resValue.children;
|
|
742
|
-
markAllItems(childList);
|
|
743
|
-
newData[level + 1] = childList;
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
markCurrent(newData[level], index);
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
// close modal
|
|
751
|
-
//////////////////////////////////////////
|
|
752
|
-
if (dataDepthMax && resValue.id.toString().indexOf('$EMPTY_ID_') < 0) {
|
|
753
|
-
|
|
754
|
-
//
|
|
755
|
-
cancel();
|
|
756
|
-
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
// active current option with DOM
|
|
760
|
-
//////////////////////////////////////////
|
|
761
|
-
const currentItemsInner: any = e.currentTarget.closest('.casc-menu-e2e__items-inner');
|
|
762
|
-
if (currentItemsInner !== null) {
|
|
763
|
-
curData.forEach((v: any, col: number) => {
|
|
764
|
-
const colItemsWrapper = currentItemsInner.querySelectorAll('.casc-menu-e2e__items-col');
|
|
765
|
-
colItemsWrapper.forEach((perCol: HTMLUListElement) => {
|
|
766
|
-
const _col = Number(perCol.dataset.col);
|
|
767
|
-
|
|
768
|
-
if (_col >= level) {
|
|
769
|
-
[].slice.call(perCol.querySelectorAll('[data-opt]')).forEach((node: HTMLElement) => {
|
|
770
|
-
node.classList.remove('active');
|
|
771
|
-
});
|
|
772
|
-
}
|
|
773
|
-
});
|
|
774
|
-
});
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
// not header option
|
|
778
|
-
if (typeof e.currentTarget.dataset.optHeader === 'undefined') e.currentTarget.classList.add('active');
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
/**
|
|
791
|
-
* Active the selected item
|
|
792
|
-
* @param arr
|
|
793
|
-
* @param index
|
|
794
|
-
* @returns
|
|
795
|
-
*/
|
|
796
|
-
function markCurrent(arr: any[], index: number) {
|
|
797
|
-
if (!Array.isArray(arr)) return;
|
|
798
|
-
|
|
799
|
-
// click an item
|
|
800
|
-
//////////////////////////////////////////
|
|
801
|
-
for (let i = 0; i < arr.length; i++) {
|
|
802
|
-
if (i === index) {
|
|
803
|
-
arr[i].current = true;
|
|
804
|
-
} else {
|
|
805
|
-
arr[i].current = false;
|
|
806
|
-
}
|
|
807
|
-
}
|
|
808
|
-
|
|
809
|
-
// return result
|
|
810
|
-
//////////////////////////////////////////
|
|
811
|
-
return arr;
|
|
812
|
-
}
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* Deactivate all items
|
|
816
|
-
* @param arr
|
|
817
|
-
* @returns
|
|
818
|
-
*/
|
|
819
|
-
function markAllItems(arr: any[]) {
|
|
820
|
-
for (let i = 0; i < arr.length; i++) {
|
|
821
|
-
arr[i].current = false;
|
|
822
|
-
if (arr[i].children) markAllItems(arr[i].children);
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
function updateValue(arr: any[], targetVal: any, level: number | boolean = false) {
|
|
829
|
-
|
|
830
|
-
const inputEl: any = inputRef.current;
|
|
831
|
-
let _valueData: any, _labelData: any, _queryIdsData: any;
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
if (targetVal.toString().indexOf('$EMPTY_ID_') >= 0) {
|
|
835
|
-
|
|
836
|
-
// If clearing the current column
|
|
837
|
-
//////////////////////////////////////////
|
|
838
|
-
_valueData = selectedData.current.values;
|
|
839
|
-
_labelData = selectedData.current.labels;
|
|
840
|
-
_queryIdsData = selectedData.current.queryIds;
|
|
841
|
-
|
|
842
|
-
// update result to input
|
|
843
|
-
_valueData.splice(level);
|
|
844
|
-
_labelData.splice(level);
|
|
845
|
-
_queryIdsData.splice(level);
|
|
846
|
-
|
|
847
|
-
//
|
|
848
|
-
selectedData.current = {
|
|
849
|
-
labels: _labelData,
|
|
850
|
-
values: _valueData,
|
|
851
|
-
queryIds: _queryIdsData,
|
|
852
|
-
};
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
} else {
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
// click an item
|
|
860
|
-
//////////////////////////////////////////
|
|
861
|
-
//search JSON key that contains specific string
|
|
862
|
-
const _labels = queryResultOfJSON(arr, targetVal, 'value');
|
|
863
|
-
const _values = queryResultOfJSON(arr, targetVal, 'key');
|
|
864
|
-
const _queryIds = queryResultOfJSON(arr, targetVal, 'query');
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
// update result to input
|
|
869
|
-
_valueData = _values ? _values.map((item: any) => item) : [];
|
|
870
|
-
_labelData = _labels ? _labels.map((item: any) => item) : [];
|
|
871
|
-
_queryIdsData = _queryIds ? _queryIds.map((item: any) => item) : [];
|
|
872
|
-
|
|
873
|
-
//
|
|
874
|
-
selectedData.current = {
|
|
875
|
-
labels: _labelData,
|
|
876
|
-
values: _valueData,
|
|
877
|
-
queryIds: _queryIdsData,
|
|
878
|
-
};
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
// update selected data
|
|
886
|
-
//////////////////////////////////////////
|
|
887
|
-
if (destroyParentIdMatch) {
|
|
888
|
-
_valueData = selectedDataByClick.current.values;
|
|
889
|
-
_labelData = selectedDataByClick.current.labels;
|
|
890
|
-
_queryIdsData = selectedDataByClick.current.queryIds;
|
|
891
|
-
}
|
|
892
|
-
|
|
893
|
-
const inputVal_0 = resultInput(_valueData, _queryIdsData);
|
|
894
|
-
const inputVal_1 = resultInput(_labelData, _queryIdsData);
|
|
895
|
-
|
|
896
|
-
if (valueType === 'value') {
|
|
897
|
-
if (inputEl !== null) setChangedVal(inputVal_0);
|
|
898
|
-
} else {
|
|
899
|
-
if (inputEl !== null) setChangedVal(inputVal_1);
|
|
900
|
-
}
|
|
901
|
-
|
|
902
|
-
return {
|
|
903
|
-
0: inputVal_0,
|
|
904
|
-
1: inputVal_1
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
}
|
|
908
|
-
|
|
909
|
-
function updateValueByClickedItem(targetData: any, level: number) {
|
|
910
|
-
|
|
911
|
-
//update selected data by clicked item
|
|
912
|
-
//////////////////////////////////////////
|
|
913
|
-
const _valueData = selectedDataByClick.current.values.slice(0, level + 1);
|
|
914
|
-
const _labelData = selectedDataByClick.current.labels.slice(0, level + 1);
|
|
915
|
-
const _queryIdsData = selectedDataByClick.current.queryIds.slice(0, level + 1);
|
|
916
|
-
|
|
917
|
-
_valueData.splice(level, 1, targetData.id);
|
|
918
|
-
_labelData.splice(level, 1, targetData.name);
|
|
919
|
-
if (Array.isArray(_queryIdsData)) _queryIdsData.splice(level, 1, targetData.queryId);
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
selectedDataByClick.current = {
|
|
923
|
-
labels: _labelData.filter((v: any) => v != ''),
|
|
924
|
-
values: _valueData.filter((v: any) => v.toString().indexOf('$EMPTY_ID_') < 0),
|
|
925
|
-
queryIds: Array.isArray(_queryIdsData) ? _queryIdsData.filter((v: any) => v != undefined) : _labelData.filter((v: any) => v != ''),
|
|
926
|
-
};
|
|
927
|
-
|
|
928
|
-
}
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
function cleanValue() {
|
|
932
|
-
selectedData.current = {
|
|
933
|
-
labels: [],
|
|
934
|
-
values: [],
|
|
935
|
-
queryIds: []
|
|
936
|
-
};
|
|
937
|
-
|
|
938
|
-
selectedDataByClick.current = {
|
|
939
|
-
labels: [],
|
|
940
|
-
values: [],
|
|
941
|
-
queryIds: []
|
|
942
|
-
};
|
|
943
|
-
|
|
944
|
-
listData.current = [];
|
|
945
|
-
allData.current = [];
|
|
946
|
-
optData.current = [];
|
|
947
|
-
dictionaryData.current = [];
|
|
948
|
-
|
|
949
|
-
setChangedVal('');
|
|
950
|
-
setFirstDataFeched(false);
|
|
951
|
-
|
|
952
|
-
}
|
|
953
|
-
|
|
954
|
-
function chkValueExist(v: any) {
|
|
955
|
-
return typeof v !== 'undefined' && v !== '';
|
|
956
|
-
}
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
function initDefaultValue(defaultValue: any) {
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
// STEP 1:
|
|
963
|
-
// Determine whether the splicing value of the default value is empty
|
|
964
|
-
//--------------------------------
|
|
965
|
-
if (chkValueExist(defaultValue)) {
|
|
966
|
-
|
|
967
|
-
// if the default value uses the pure string
|
|
968
|
-
if (!extractorExist(defaultValue)) {
|
|
969
|
-
|
|
970
|
-
//Set a default value
|
|
971
|
-
selectedData.current = {
|
|
972
|
-
labels: [defaultValue],
|
|
973
|
-
values: [''],
|
|
974
|
-
queryIds: ['']
|
|
975
|
-
};
|
|
976
|
-
|
|
977
|
-
selectedDataByClick.current = {
|
|
978
|
-
labels: [defaultValue],
|
|
979
|
-
values: [''],
|
|
980
|
-
queryIds: ['']
|
|
981
|
-
};
|
|
982
|
-
setChangedVal(defaultValue);
|
|
983
|
-
|
|
984
|
-
return; // required RETURN
|
|
985
|
-
|
|
986
|
-
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
//
|
|
990
|
-
const formattedDefaultValue = VALUE_BY_BRACES ? extractContentsOfBraces(defaultValue) : defaultValue.split(',');
|
|
991
|
-
const emptyDefaultValueCheck = Array.isArray(formattedDefaultValue) ? formattedDefaultValue.every((item: any, index: number) => {
|
|
992
|
-
if (item !== '[]') {
|
|
993
|
-
return false;
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
return true;
|
|
997
|
-
}) : true;
|
|
998
|
-
|
|
999
|
-
if (emptyDefaultValueCheck) {
|
|
1000
|
-
cleanValue();
|
|
1001
|
-
return; // required RETURN
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
|
|
1005
|
-
// STEP 2:
|
|
1006
|
-
// change the value to trigger component rendering
|
|
1007
|
-
//--------------------------------
|
|
1008
|
-
if (!chkValueExist(defaultValue)) {
|
|
1009
|
-
cleanValue();
|
|
1010
|
-
return; // required RETURN
|
|
1011
|
-
} else {
|
|
1012
|
-
setChangedVal(defaultValue);
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
// STEP 3:
|
|
1017
|
-
// update the status of the first fetch
|
|
1018
|
-
//--------------------------------
|
|
1019
|
-
setFirstDataFeched(true);
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
// STEP 4:
|
|
1023
|
-
// do fetch
|
|
1024
|
-
//--------------------------------
|
|
1025
|
-
doFetch(false, 0, 0, false)?.then((firstColResponse: any) => {
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
const _ORGIN_DATA: any[] = firstColResponse[0];
|
|
1029
|
-
const _CHILDREN_DATA: any[] = firstColResponse[1];
|
|
1030
|
-
let activedIndex: any;
|
|
1031
|
-
const allFetch: any[] = [];
|
|
1032
|
-
|
|
1033
|
-
const rowQueryAttr: string = valueType === 'value' ? 'id' : 'name';
|
|
1034
|
-
const targetVal: any = defaultValue.match(/(\[.*?\])/gi)!.map((item: any, i: number) => VALUE_BY_BRACES ? extractContentsOfBraces(defaultValue)[i].replace(item, '') : defaultValue.split(',')[i].replace(item, ''));
|
|
1035
|
-
const queryIds: any = extractContentsOfBrackets(defaultValue);
|
|
1036
|
-
|
|
1037
|
-
//
|
|
1038
|
-
let _TEMP_ALL_DATA: any[] = [];
|
|
1039
|
-
|
|
1040
|
-
//
|
|
1041
|
-
const _allColumnsData: any[] = [];
|
|
1042
|
-
const _allLables: any[] = [];
|
|
1043
|
-
const _allValues: any[] = [];
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
// loop over each column
|
|
1047
|
-
//////////////////////////////////////////
|
|
1048
|
-
for (let col = 0; col <= targetVal.length; col++) {
|
|
1049
|
-
|
|
1050
|
-
if (col === 0) {
|
|
1051
|
-
|
|
1052
|
-
// STEP 1: ===========
|
|
1053
|
-
//active item from current column
|
|
1054
|
-
const newData: any[] = JSON.parse(JSON.stringify(_CHILDREN_DATA));
|
|
1055
|
-
activedIndex = _CHILDREN_DATA.findIndex((item: any) => {
|
|
1056
|
-
return item[rowQueryAttr].toString() === targetVal[col].toString();
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
markAllItems(newData);
|
|
1060
|
-
markCurrent(newData, activedIndex);
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
// STEP 2: ===========
|
|
1064
|
-
// all data from fetched data
|
|
1065
|
-
_TEMP_ALL_DATA = _ORGIN_DATA;
|
|
1066
|
-
|
|
1067
|
-
// STEP 3: ===========
|
|
1068
|
-
// dictionary data (orginal)
|
|
1069
|
-
// Same as the `STEP 2`
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
// STEP 4: ===========
|
|
1073
|
-
// update result data
|
|
1074
|
-
if (activedIndex !== -1) {
|
|
1075
|
-
_allLables.push(newData[activedIndex].name);
|
|
1076
|
-
_allValues.push(newData[activedIndex].id);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
_allColumnsData.push(newData);
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
}
|
|
1084
|
-
|
|
1085
|
-
if (col > 0) {
|
|
1086
|
-
allFetch.push(doFetch(false, col, queryIds[col - 1], false));
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
// fetch all columns except the first
|
|
1093
|
-
//////////////////////////////////////////
|
|
1094
|
-
Promise.all(allFetch).then((values) => {
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
values.filter((v: any) => typeof v !== 'undefined').forEach((colResponse: any, i: number) => {
|
|
1098
|
-
|
|
1099
|
-
const _CURRENT_COL_DATA: any[] = colResponse[0];
|
|
1100
|
-
const curDepth: number = i + 1;
|
|
1101
|
-
|
|
1102
|
-
// STEP 1: ===========
|
|
1103
|
-
//active item from current column
|
|
1104
|
-
const newData: any[] = JSON.parse(JSON.stringify(_CURRENT_COL_DATA));
|
|
1105
|
-
activedIndex = newData.findIndex((item: any) => {
|
|
1106
|
-
if (typeof targetVal[curDepth] !== 'undefined') {
|
|
1107
|
-
return item[rowQueryAttr].toString() === targetVal[curDepth].toString();
|
|
1108
|
-
}
|
|
1109
|
-
});
|
|
1110
|
-
|
|
1111
|
-
markAllItems(newData);
|
|
1112
|
-
markCurrent(newData, activedIndex);
|
|
1113
|
-
|
|
1114
|
-
// STEP 2: ===========
|
|
1115
|
-
// all data from fetched data
|
|
1116
|
-
if (typeof values[curDepth] !== 'undefined') {
|
|
1117
|
-
const childList = values[curDepth][0];
|
|
1118
|
-
|
|
1119
|
-
// if the value of some column is not fetched
|
|
1120
|
-
if (typeof newData[activedIndex] !== 'undefined') newData[activedIndex].children = childList;
|
|
1121
|
-
|
|
1122
|
-
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
_TEMP_ALL_DATA.forEach((item: any) => {
|
|
1127
|
-
if (item.id === queryIds[i]) item.children = newData;
|
|
1128
|
-
});
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
// STEP 3: ===========
|
|
1132
|
-
// dictionary data (orginal)
|
|
1133
|
-
dictionaryData.current = newData;
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
// STEP 4: ===========
|
|
1137
|
-
// update result data
|
|
1138
|
-
if (activedIndex !== -1) {
|
|
1139
|
-
_allLables.push(newData[activedIndex].name);
|
|
1140
|
-
_allValues.push(newData[activedIndex].id);
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
_allColumnsData.push(newData);
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
return true;
|
|
1147
|
-
|
|
1148
|
-
});
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
// STEP 5: ===========
|
|
1152
|
-
// all data from fetched data
|
|
1153
|
-
allData.current = _TEMP_ALL_DATA;
|
|
1154
|
-
|
|
1155
|
-
// STEP 6: ===========
|
|
1156
|
-
// dictionary data (orginal)
|
|
1157
|
-
dictionaryData.current = _TEMP_ALL_DATA;
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
// STEP 7: ===========
|
|
1161
|
-
//update data
|
|
1162
|
-
optData.current = _allColumnsData;
|
|
1163
|
-
listData.current = _allColumnsData;
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
// STEP 8: ===========
|
|
1167
|
-
//Set a default value
|
|
1168
|
-
selectedData.current = {
|
|
1169
|
-
labels: _allLables,
|
|
1170
|
-
values: _allValues,
|
|
1171
|
-
queryIds: queryIds,
|
|
1172
|
-
};
|
|
1173
|
-
|
|
1174
|
-
selectedDataByClick.current = {
|
|
1175
|
-
labels: _allLables,
|
|
1176
|
-
values: _allValues,
|
|
1177
|
-
queryIds: queryIds,
|
|
1178
|
-
};
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
});
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
});
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
function fillColumnTitle() {
|
|
1195
|
-
|
|
1196
|
-
const dataDepth = fetchArray!.length;
|
|
1197
|
-
const oldColumnTitleData = columnTitle ? columnTitle : [];
|
|
1198
|
-
const newColumnTitleData = new Array(dataDepth)?.fill('');
|
|
1199
|
-
oldColumnTitleData!.forEach((item: any, index: number) => {
|
|
1200
|
-
newColumnTitleData[index] = item;
|
|
1201
|
-
});
|
|
1202
|
-
|
|
1203
|
-
//
|
|
1204
|
-
if (oldColumnTitleData.length > dataDepth) {
|
|
1205
|
-
newColumnTitleData.splice(dataDepth, oldColumnTitleData.length - dataDepth);
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
setColumnTitleData(newColumnTitleData);
|
|
1209
|
-
}
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
function addChildrenOpt(obj: any[], parentId: number, childrenData: any[]) {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
// Traverse the results obtained by all fetch
|
|
1216
|
-
obj.forEach((item: any) => {
|
|
1217
|
-
|
|
1218
|
-
// !!!IMPORTANT:
|
|
1219
|
-
// You need to put the contents of other columns after fetch into the "children" attribute
|
|
1220
|
-
if (item.id === parentId) item.children = childrenData;
|
|
1221
|
-
|
|
1222
|
-
if (item.children) {
|
|
1223
|
-
addChildrenOpt(item.children, parentId, childrenData);
|
|
1224
|
-
}
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
function addEmptyOpt(obj: any[], index: number) {
|
|
1230
|
-
|
|
1231
|
-
index++;
|
|
1232
|
-
|
|
1233
|
-
obj.unshift({
|
|
1234
|
-
id: "$EMPTY_ID_" + index,
|
|
1235
|
-
name: "",
|
|
1236
|
-
itemDepth: obj.length === 0 ? 0 : obj[0].itemDepth
|
|
1237
|
-
});
|
|
1238
|
-
|
|
1239
|
-
obj.forEach((item: any, depth: number) => {
|
|
1240
|
-
if (item.children) {
|
|
1241
|
-
addEmptyOpt(item.children, index * (depth + 1));
|
|
1242
|
-
}
|
|
1243
|
-
});
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
function queryResultOfJSON(data: any[], targetVal: any, returnType: string) {
|
|
1247
|
-
|
|
1248
|
-
let callbackValueNested: any[] = [];
|
|
1249
|
-
let lastFirstLevelName = '';
|
|
1250
|
-
let loop = true;
|
|
1251
|
-
let resDepth = 0;
|
|
1252
|
-
const rowQueryAttr = 'id';
|
|
1253
|
-
|
|
1254
|
-
const getIndexOf = function (arr: any[], val: any) {
|
|
1255
|
-
for (let i = 0; i < arr.length; i++) {
|
|
1256
|
-
if (arr[i][rowQueryAttr].toString() === val.toString()) return i;
|
|
1257
|
-
}
|
|
1258
|
-
return -1;
|
|
1259
|
-
};
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
const searchJsonStr = function (list: any[], depth?: any) {
|
|
1263
|
-
|
|
1264
|
-
// `depth` is very important, it is used to accurately judge the final result
|
|
1265
|
-
if (typeof (depth) === 'undefined') {
|
|
1266
|
-
depth = 0;
|
|
1267
|
-
} else {
|
|
1268
|
-
depth++;
|
|
1269
|
-
}
|
|
1270
|
-
|
|
1271
|
-
for (let i = 0; i < list.length; i++) {
|
|
1272
|
-
|
|
1273
|
-
const row = list[i];
|
|
1274
|
-
let callbackValue: any;
|
|
1275
|
-
|
|
1276
|
-
if (returnType === 'key') callbackValue = row[rowQueryAttr].toString();
|
|
1277
|
-
if (returnType === 'value') callbackValue = row.name.toString();
|
|
1278
|
-
if (returnType === 'query') callbackValue = typeof row.queryId !== 'undefined' ? row.queryId.toString() : '';
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
if (loop) {
|
|
1282
|
-
// get first-level item
|
|
1283
|
-
if (getIndexOf(data, row[rowQueryAttr]) !== -1) {
|
|
1284
|
-
callbackValueNested.push(callbackValue as never);
|
|
1285
|
-
lastFirstLevelName = callbackValue;
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
// get child-level item
|
|
1289
|
-
if (row.children) {
|
|
1290
|
-
callbackValueNested.push(callbackValue as never);
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
}
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
//check the value
|
|
1297
|
-
if (row[rowQueryAttr].toString() === targetVal.toString()) {
|
|
1298
|
-
callbackValueNested.push(callbackValue as never);
|
|
1299
|
-
loop = false;
|
|
1300
|
-
resDepth = depth;
|
|
1301
|
-
break;
|
|
1302
|
-
}
|
|
1303
|
-
|
|
1304
|
-
// Note: Recursion must be placed here
|
|
1305
|
-
if (loop) {
|
|
1306
|
-
if (row.children) {
|
|
1307
|
-
searchJsonStr(row.children, depth);
|
|
1308
|
-
}
|
|
1309
|
-
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
}
|
|
1316
|
-
searchJsonStr(data);
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
// (1) Remove duplicate values
|
|
1320
|
-
//------------------------------------------
|
|
1321
|
-
callbackValueNested = callbackValueNested.filter(function (item, index, arr) {
|
|
1322
|
-
return arr.indexOf(item, 0) === index;
|
|
1323
|
-
});
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
// (2) Delete needless first-level
|
|
1327
|
-
//------------------------------------------
|
|
1328
|
-
let resAll = callbackValueNested.slice(callbackValueNested.indexOf(lastFirstLevelName as never), callbackValueNested.length)
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
// (3) Returns result
|
|
1332
|
-
//------------------------------------------
|
|
1333
|
-
if (resAll.length > 1) {
|
|
1334
|
-
// Get first-level item
|
|
1335
|
-
resAll.splice(1);
|
|
1336
|
-
|
|
1337
|
-
// Get child-level item
|
|
1338
|
-
let resChild = callbackValueNested.slice(-resDepth); // Get the last elements in reverse
|
|
1339
|
-
|
|
1340
|
-
// Combine
|
|
1341
|
-
resAll = resAll.concat(resChild);
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
return resAll;
|
|
1346
|
-
|
|
1347
|
-
}
|
|
1348
|
-
|
|
1349
|
-
function displayInfo(destroyParentId: boolean) {
|
|
1350
|
-
|
|
1351
|
-
const _data = destroyParentId ? selectedDataByClick.current : selectedData.current;
|
|
1352
|
-
let formattedDefaultValue: any = changedVal !== '' ? VALUE_BY_BRACES ? extractContentsOfBraces(changedVal) : changedVal.split(',') : [];
|
|
1353
|
-
let _labels = Array.isArray(_data.labels) && _data.labels.length > 0 ? _data.labels : [];
|
|
1354
|
-
|
|
1355
|
-
// Prevent value from being a pure string that does not include "[]"
|
|
1356
|
-
if (formattedDefaultValue === '') formattedDefaultValue = [];
|
|
1357
|
-
|
|
1358
|
-
// Sometimes the array may be empty due to rendering speed
|
|
1359
|
-
if (_labels.length === 0) {
|
|
1360
|
-
_labels = formattedDefaultValue.map((s: string | number) => s.toString().replace(/[\w\s]/gi, '').replace(/\[\]/g, ''));
|
|
1361
|
-
}
|
|
1362
|
-
|
|
1363
|
-
return _labels.length > 0 ? _labels.map((item: any, i: number, arr: any[]) => {
|
|
1364
|
-
if (arr.length - 1 === i) {
|
|
1365
|
-
return (
|
|
1366
|
-
<div key={i}>
|
|
1367
|
-
<span dangerouslySetInnerHTML={{
|
|
1368
|
-
__html: item
|
|
1369
|
-
}}></span>
|
|
1370
|
-
</div>
|
|
1371
|
-
)
|
|
1372
|
-
} else {
|
|
1373
|
-
return (
|
|
1374
|
-
<div key={i}>
|
|
1375
|
-
<span dangerouslySetInnerHTML={{
|
|
1376
|
-
__html: item
|
|
1377
|
-
}}></span>
|
|
1378
|
-
{arrowGenerator()}
|
|
1379
|
-
</div>
|
|
1380
|
-
)
|
|
1381
|
-
}
|
|
1382
|
-
}) : '';
|
|
1383
|
-
|
|
1384
|
-
}
|
|
1385
|
-
|
|
1386
|
-
function arrowGenerator() {
|
|
1387
|
-
return displayResultArrow ? displayResultArrow : <svg viewBox="0 0 22 22" width="8px"><path d="m345.44 248.29l-194.29 194.28c-12.359 12.365-32.397 12.365-44.75 0-12.354-12.354-12.354-32.391 0-44.744l171.91-171.91-171.91-171.9c-12.354-12.359-12.354-32.394 0-44.748 12.354-12.359 32.391-12.359 44.75 0l194.29 194.28c6.177 6.18 9.262 14.271 9.262 22.366 0 8.099-3.091 16.196-9.267 22.373" transform="matrix(.03541-.00013.00013.03541 2.98 3.02)" fill="#a5a5a5" /></svg>;
|
|
1388
|
-
}
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
useEffect(() => {
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
// column titles
|
|
1395
|
-
//--------------
|
|
1396
|
-
fillColumnTitle();
|
|
1397
|
-
|
|
1398
|
-
// Initialize default value (request parameters for each level)
|
|
1399
|
-
//--------------
|
|
1400
|
-
initDefaultValue(value);
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
}, [value]);
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
// Automatically complete and truncate column Search Keywords each time the number of columns changes
|
|
1407
|
-
useEffect(() => {
|
|
1408
|
-
if (listData.current.length !== columnSearchKeywords.length) {
|
|
1409
|
-
setColumnSearchKeywords(
|
|
1410
|
-
Array(listData.current.length).fill('').map((v, i) => columnSearchKeywords[i] || '')
|
|
1411
|
-
);
|
|
1412
|
-
}
|
|
1413
|
-
}, [listData.current.length]);
|
|
1414
|
-
|
|
1415
|
-
useEffect(() => {
|
|
1416
|
-
return () => {
|
|
1417
|
-
// update data depth
|
|
1418
|
-
setCurrentDataDepth(0);
|
|
1419
|
-
}
|
|
1420
|
-
}, []);
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
return (
|
|
1425
|
-
<>
|
|
1426
|
-
|
|
1427
|
-
<div
|
|
1428
|
-
className={clsWrite(wrapperClassName, 'casc-menu-e2e__wrapper mb-3 position-relative', `casc-menu-e2e__wrapper ${wrapperClassName}`)}
|
|
1429
|
-
ref={rootRef}
|
|
1430
|
-
data-overlay-id={`casc-menu-e2e__items-wrapper-${idRes}`}
|
|
1431
|
-
>
|
|
1432
|
-
{label ? <>{typeof label === 'string' ? <label htmlFor={idRes} className="form-label" dangerouslySetInnerHTML={{ __html: `${label}` }}></label> : <label htmlFor={idRes} className="form-label" >{label}</label>}</> : null}
|
|
1433
|
-
|
|
1434
|
-
{triggerContent ? <>
|
|
1435
|
-
<div className={clsWrite(triggerClassName, 'casc-menu-e2e__trigger d-inline w-auto', `casc-menu-e2e__trigger ${triggerClassName}`)} onClick={handleDisplayOptions}>{triggerContent}</div>
|
|
1436
|
-
</> : null}
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
{!hasErr ? (
|
|
1440
|
-
<RootPortal show={true} containerClassName="CascadingSelectE2E">
|
|
1441
|
-
<div
|
|
1442
|
-
ref={listRef}
|
|
1443
|
-
id={`casc-menu-e2e__items-wrapper-${idRes}`}
|
|
1444
|
-
className="casc-menu-e2e__items-wrapper position-absolute border shadow small"
|
|
1445
|
-
style={{ zIndex: DEPTH, display: 'none' }}
|
|
1446
|
-
>
|
|
1447
|
-
<ul className="casc-menu-e2e__items-inner">
|
|
1448
|
-
{loading ? <><div className="casc-menu-e2e__items-loader">{loader || <svg height="12px" width="12px" viewBox="0 0 512 512"><g><path fill="inherit" d="M256,0c-23.357,0-42.297,18.932-42.297,42.288c0,23.358,18.94,42.288,42.297,42.288c23.357,0,42.279-18.93,42.279-42.288C298.279,18.932,279.357,0,256,0z" /><path fill="inherit" d="M256,427.424c-23.357,0-42.297,18.931-42.297,42.288C213.703,493.07,232.643,512,256,512c23.357,0,42.279-18.93,42.279-42.288C298.279,446.355,279.357,427.424,256,427.424z" /><path fill="inherit" d="M74.974,74.983c-16.52,16.511-16.52,43.286,0,59.806c16.52,16.52,43.287,16.52,59.806,0c16.52-16.511,16.52-43.286,0-59.806C118.261,58.463,91.494,58.463,74.974,74.983z" /><path fill="inherit" d="M377.203,377.211c-16.503,16.52-16.503,43.296,0,59.815c16.519,16.52,43.304,16.52,59.806,0c16.52-16.51,16.52-43.295,0-59.815C420.489,360.692,393.722,360.7,377.203,377.211z" /><path fill="inherit" d="M84.567,256c0.018-23.348-18.922-42.279-42.279-42.279c-23.357-0.009-42.297,18.932-42.279,42.288c-0.018,23.348,18.904,42.279,42.279,42.279C65.645,298.288,84.567,279.358,84.567,256z" /><path fill="inherit" d="M469.712,213.712c-23.357,0-42.279,18.941-42.297,42.288c0,23.358,18.94,42.288,42.297,42.297c23.357,0,42.297-18.94,42.279-42.297C512.009,232.652,493.069,213.712,469.712,213.712z" /><path fill="inherit" d="M74.991,377.22c-16.519,16.511-16.519,43.296,0,59.806c16.503,16.52,43.27,16.52,59.789,0c16.52-16.519,16.52-43.295,0-59.815C118.278,360.692,91.511,360.692,74.991,377.22z" /><path fill="inherit" d="M437.026,134.798c16.52-16.52,16.52-43.304,0-59.824c-16.519-16.511-43.304-16.52-59.823,0c-16.52,16.52-16.503,43.295,0,59.815C393.722,151.309,420.507,151.309,437.026,134.798z" /></g></svg>}</div></> : null}
|
|
1449
|
-
{showCloseBtn ? <a href="#" tabIndex={-1} onClick={(e) => {
|
|
1450
|
-
e.preventDefault();
|
|
1451
|
-
cancel();
|
|
1452
|
-
}} className="casc-menu-e2e__close position-absolute top-0 end-0 mt-0 mx-1"><svg width="10px" height="10px" viewBox="0 0 1024 1024"><path fill="#000" d="M195.2 195.2a64 64 0 0 1 90.496 0L512 421.504 738.304 195.2a64 64 0 0 1 90.496 90.496L602.496 512 828.8 738.304a64 64 0 0 1-90.496 90.496L512 602.496 285.696 828.8a64 64 0 0 1-90.496-90.496L421.504 512 195.2 285.696a64 64 0 0 1 0-90.496z" /></svg></a> : null}
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
{listData.current.map((item: any, level: number) => {
|
|
1457
|
-
|
|
1458
|
-
if (item.length > 0) {
|
|
1459
|
-
|
|
1460
|
-
// filter data
|
|
1461
|
-
let filteredItem = item;
|
|
1462
|
-
if (searchable && columnSearchKeywords[level]) {
|
|
1463
|
-
const keyword = columnSearchKeywords[level].toLowerCase();
|
|
1464
|
-
filteredItem = item.filter((opt: any) =>
|
|
1465
|
-
(htmlToPlain(opt.name) || '').toLowerCase().includes(keyword)
|
|
1466
|
-
);
|
|
1467
|
-
}
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
return (
|
|
1471
|
-
<li key={level} data-col={level} className="casc-menu-e2e__items-col">
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
{/* SEARCH BOX */}
|
|
1475
|
-
{searchable && (
|
|
1476
|
-
<div className="casc-menu-e2e__items-col-searchbox">
|
|
1477
|
-
<input
|
|
1478
|
-
type="text"
|
|
1479
|
-
placeholder={searchPlaceholder}
|
|
1480
|
-
value={columnSearchKeywords[level] || ''}
|
|
1481
|
-
onChange={e => {
|
|
1482
|
-
const newKeywords = [...columnSearchKeywords];
|
|
1483
|
-
newKeywords[level] = e.target.value;
|
|
1484
|
-
setColumnSearchKeywords(newKeywords);
|
|
1485
|
-
}}
|
|
1486
|
-
/>
|
|
1487
|
-
</div>
|
|
1488
|
-
)}
|
|
1489
|
-
{/* /SEARCH BOX */}
|
|
1490
|
-
|
|
1491
|
-
<Group
|
|
1492
|
-
perColumnHeadersShow={perColumnHeadersShow}
|
|
1493
|
-
level={level}
|
|
1494
|
-
columnTitle={columnTitleData}
|
|
1495
|
-
data={filteredItem} // filter result
|
|
1496
|
-
cleanNodeBtnClassName={cleanNodeBtnClassName}
|
|
1497
|
-
cleanNodeBtnContent={cleanNodeBtnContent}
|
|
1498
|
-
selectEv={(e, value, index) => handleClickItem(e, value, index, level, listData.current)}
|
|
1499
|
-
/>
|
|
1500
|
-
</li>
|
|
1501
|
-
)
|
|
1502
|
-
} else {
|
|
1503
|
-
return null;
|
|
1504
|
-
}
|
|
1505
|
-
|
|
1506
|
-
})}
|
|
1507
|
-
</ul>
|
|
1508
|
-
|
|
1509
|
-
</div>
|
|
1510
|
-
|
|
1511
|
-
</RootPortal>
|
|
1512
|
-
|
|
1513
|
-
) : null}
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
<div className={combinedCls(
|
|
1518
|
-
'casc-menu-e2e__val',
|
|
1519
|
-
{
|
|
1520
|
-
'inputable': inputable,
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
)}
|
|
1524
|
-
onClick={handleDisplayOptions}
|
|
1525
|
-
>
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
{/* INPIT */}
|
|
1529
|
-
<div className={combinedCls(
|
|
1530
|
-
'position-relative',
|
|
1531
|
-
clsWrite(controlGroupWrapperClassName, 'input-group'),
|
|
1532
|
-
{
|
|
1533
|
-
'has-left-content': propExist(iconLeft),
|
|
1534
|
-
'has-right-content': propExist(iconRight) || propExist(units)
|
|
1535
|
-
}
|
|
1536
|
-
|
|
1537
|
-
)}>
|
|
1538
|
-
|
|
1539
|
-
{propExist(iconLeft) ? <><span className={clsWrite(controlGroupTextClassName, 'input-group-text')}>{iconLeft}</span></> : null}
|
|
1540
|
-
|
|
1541
|
-
<div className="input-group-control-container flex-fill position-relative">
|
|
1542
|
-
<input
|
|
1543
|
-
ref={(node) => {
|
|
1544
|
-
inputRef.current = node;
|
|
1545
|
-
if (typeof externalRef === 'function') {
|
|
1546
|
-
externalRef(node);
|
|
1547
|
-
} else if (externalRef) {
|
|
1548
|
-
externalRef.current = node;
|
|
1549
|
-
}
|
|
1550
|
-
}}
|
|
1551
|
-
id={idRes}
|
|
1552
|
-
data-overlay-id={`casc-menu-e2e__items-wrapper-${idRes}`}
|
|
1553
|
-
name={name}
|
|
1554
|
-
className={combinedCls(
|
|
1555
|
-
clsWrite(controlClassName, 'form-control'),
|
|
1556
|
-
controlExClassName,
|
|
1557
|
-
{
|
|
1558
|
-
'rounded': !propExist(iconLeft) && !propExist(iconRight) && !propExist(units),
|
|
1559
|
-
'rounded-start-0': propExist(iconLeft),
|
|
1560
|
-
'rounded-end-0': propExist(iconRight) || propExist(units)
|
|
1561
|
-
}
|
|
1562
|
-
)}
|
|
1563
|
-
|
|
1564
|
-
placeholder={placeholder}
|
|
1565
|
-
value={(() => {
|
|
1566
|
-
const curValForamt: string = resultInputPureText(changedVal);
|
|
1567
|
-
let curValCallback: string = '';
|
|
1568
|
-
|
|
1569
|
-
// STEP 1
|
|
1570
|
-
//============
|
|
1571
|
-
|
|
1572
|
-
if (inputable) {
|
|
1573
|
-
curValCallback = curValForamt;
|
|
1574
|
-
} else {
|
|
1575
|
-
curValCallback = destroyParentIdMatch ? (valueType === 'value'
|
|
1576
|
-
? resultInput(selectedDataByClick.current.values, selectedDataByClick.current.queryIds)
|
|
1577
|
-
: resultInput(selectedDataByClick.current.labels, selectedDataByClick.current.queryIds)
|
|
1578
|
-
) : curValForamt;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
// STEP 2
|
|
1583
|
-
//============
|
|
1584
|
-
if (typeof formatInputResult === 'function') {
|
|
1585
|
-
|
|
1586
|
-
return formatInputResult(
|
|
1587
|
-
VALUE_BY_BRACES
|
|
1588
|
-
? extractContentsOfMixedCharactersWithBraces(curValCallback)
|
|
1589
|
-
: extractContentsOfMixedCharactersWithComma(curValCallback)
|
|
1590
|
-
);
|
|
1591
|
-
|
|
1592
|
-
} else {
|
|
1593
|
-
return changedVal;
|
|
1594
|
-
}
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
})()
|
|
1598
|
-
}
|
|
1599
|
-
// placeholder will not change if defaultValue is used
|
|
1600
|
-
onFocus={handleFocus}
|
|
1601
|
-
onBlur={handleBlur}
|
|
1602
|
-
autoComplete="off"
|
|
1603
|
-
disabled={disabled || null}
|
|
1604
|
-
readOnly={readOnly || null}
|
|
1605
|
-
required={required || null}
|
|
1606
|
-
minLength={minLength || null}
|
|
1607
|
-
maxLength={maxLength || null}
|
|
1608
|
-
style={style}
|
|
1609
|
-
tabIndex={tabIndex || 0}
|
|
1610
|
-
onChange={inputable ? (e) => {
|
|
1611
|
-
setChangedVal(e.target.value);
|
|
1612
|
-
if (typeof onChange === 'function') {
|
|
1613
|
-
onChange(
|
|
1614
|
-
e, // input dom event
|
|
1615
|
-
null, // currentData
|
|
1616
|
-
null, // index
|
|
1617
|
-
null, // depth
|
|
1618
|
-
e.target.value, // value
|
|
1619
|
-
cancel
|
|
1620
|
-
);
|
|
1621
|
-
}
|
|
1622
|
-
} : undefined}
|
|
1623
|
-
{...attributes}
|
|
1624
|
-
|
|
1625
|
-
/>
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
{/** REVIEW RESULT */}
|
|
1630
|
-
{destroyParentIdMatch ? <>
|
|
1631
|
-
{!inputable ? <div className="casc-menu-e2e__result">{displayInfo(true)}</div> : null}
|
|
1632
|
-
</> : <>
|
|
1633
|
-
{!inputable ? <div className="casc-menu-e2e__result">{displayInfo(false)}</div> : null}
|
|
1634
|
-
</>}
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
{/* Required marking */}
|
|
1638
|
-
{required ? <>{requiredLabel || requiredLabel === '' ? requiredLabel : <span className="position-absolute end-0 top-0 my-2 mx-2 pe-3"><span className="text-danger">*</span></span>}</> : ''}
|
|
1639
|
-
|
|
1640
|
-
</div>
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
{propExist(units) ? <><span className={clsWrite(controlGroupTextClassName, 'input-group-text')}>{units}</span></> : null}
|
|
1644
|
-
{propExist(iconRight) ? <><span className={clsWrite(controlGroupTextClassName, 'input-group-text')}>{iconRight}</span></> : null}
|
|
1645
|
-
|
|
1646
|
-
</div>
|
|
1647
|
-
{/* /INPIT */}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
{isShow ? <div
|
|
1651
|
-
className="casc-menu-e2e__closemask"
|
|
1652
|
-
onClick={(e) => {
|
|
1653
|
-
e.preventDefault();
|
|
1654
|
-
cancel();
|
|
1655
|
-
}}></div> : null}
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
<span className="arrow" style={{ pointerEvents: 'none' }}>
|
|
1659
|
-
{controlArrow ? controlArrow : <svg width="10px" height="10px" viewBox="0 -4.5 20 20">
|
|
1660
|
-
<g stroke="none" strokeWidth="1" fill="none">
|
|
1661
|
-
<g transform="translate(-180.000000, -6684.000000)" className="arrow-fill-g" fill="#a5a5a5">
|
|
1662
|
-
<g transform="translate(56.000000, 160.000000)">
|
|
1663
|
-
<path d="M144,6525.39 L142.594,6524 L133.987,6532.261 L133.069,6531.38 L133.074,6531.385 L125.427,6524.045 L124,6525.414 C126.113,6527.443 132.014,6533.107 133.987,6535 C135.453,6533.594 134.024,6534.965 144,6525.39">
|
|
1664
|
-
</path>
|
|
1665
|
-
</g>
|
|
1666
|
-
</g>
|
|
1667
|
-
</g>
|
|
1668
|
-
</svg>}
|
|
1669
|
-
</span>
|
|
1670
|
-
|
|
1671
|
-
</div>
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
</div>
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
</>
|
|
1681
|
-
)
|
|
1682
|
-
});
|
|
1683
|
-
|
|
1684
|
-
export default CascadingSelectE2E;
|