@qsxy/element-plus-react 1.0.2 → 2.0.0
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/dist/Affix/Affix.d.ts +4 -0
- package/dist/Affix/Affix.js +301 -0
- package/dist/Affix/index.d.ts +2 -0
- package/dist/Affix/index.js +1 -0
- package/dist/Affix/typings.d.ts +50 -0
- package/dist/Affix/typings.js +1 -0
- package/dist/Alert/Alert.d.ts +7 -0
- package/dist/Alert/Alert.js +98 -0
- package/dist/Alert/index.d.ts +2 -0
- package/dist/Alert/index.js +1 -0
- package/dist/Alert/typings.d.ts +45 -0
- package/dist/Alert/typings.js +1 -0
- package/dist/Anchor/Anchor.d.ts +6 -0
- package/dist/Anchor/Anchor.js +258 -0
- package/dist/Anchor/AnchorLink.d.ts +4 -0
- package/dist/Anchor/AnchorLink.js +77 -0
- package/dist/Anchor/element.d.ts +4 -0
- package/dist/Anchor/element.js +17 -0
- package/dist/Anchor/index.d.ts +3 -0
- package/dist/Anchor/index.js +2 -0
- package/dist/Anchor/typings.d.ts +101 -0
- package/dist/Anchor/typings.js +1 -0
- package/dist/Backtop/Backtop.d.ts +7 -0
- package/dist/Backtop/Backtop.js +153 -0
- package/dist/Backtop/index.d.ts +2 -0
- package/dist/Backtop/index.js +1 -0
- package/dist/Backtop/typings.d.ts +31 -0
- package/dist/Backtop/typings.js +1 -0
- package/dist/Button/Button.d.ts +2 -11
- package/dist/Button/Button.js +2 -6
- package/dist/Button/index.d.ts +1 -1
- package/dist/Calendar/Calendar.js +12 -8
- package/dist/Calendar/YearRangePanel.js +1 -1
- package/dist/Card/Card.js +5 -3
- package/dist/Carousel/typings.d.ts +1 -1
- package/dist/Cascader/Cascader.d.ts +3 -3
- package/dist/Cascader/Cascader.js +238 -166
- package/dist/Cascader/CascaderContext.d.ts +9 -3
- package/dist/Cascader/CascaderContext.js +3 -1
- package/dist/Cascader/CascaderDropdown.d.ts +4 -3
- package/dist/Cascader/CascaderDropdown.js +21 -10
- package/dist/Cascader/CascaderMenu.d.ts +2 -2
- package/dist/Cascader/CascaderMenu.js +56 -14
- package/dist/Cascader/CascaderPanel.d.ts +4 -0
- package/dist/Cascader/CascaderPanel.js +11 -0
- package/dist/Cascader/index.d.ts +4 -1
- package/dist/Cascader/index.js +2 -1
- package/dist/Cascader/typings.d.ts +45 -31
- package/dist/Cascader/useCascader.d.ts +14 -27
- package/dist/Cascader/useCascader.js +153 -59
- package/dist/Checkbox/Checkbox.js +3 -2
- package/dist/CheckboxGroup/CheckboxGroup.d.ts +11 -1
- package/dist/CheckboxGroup/CheckboxGroup.js +78 -19
- package/dist/Collapse/Collapse.d.ts +3 -3
- package/dist/Collapse/Collapse.js +71 -16
- package/dist/Collapse/CollapseContext.d.ts +3 -6
- package/dist/Collapse/CollapseContext.js +2 -4
- package/dist/Collapse/CollapseItem.d.ts +3 -3
- package/dist/Collapse/CollapseItem.js +93 -51
- package/dist/Collapse/CollapseTransition.js +11 -7
- package/dist/Collapse/index.d.ts +1 -1
- package/dist/Collapse/typings.d.ts +20 -5
- package/dist/ColorPicker/typings.d.ts +1 -1
- package/dist/ConfigProvider/ConfigProvider.js +2 -24
- package/dist/ConfigProvider/ConfigProviderContext.js +1 -1
- package/dist/ConfigProvider/typings.d.ts +1 -1
- package/dist/Container/Main.d.ts +1 -1
- package/dist/Container/typings.d.ts +1 -1
- package/dist/Countdown/Countdown.d.ts +4 -0
- package/dist/Countdown/Countdown.js +121 -0
- package/dist/Countdown/index.d.ts +2 -0
- package/dist/Countdown/index.js +1 -0
- package/dist/Countdown/typings.d.ts +52 -0
- package/dist/Countdown/typings.js +1 -0
- package/dist/Countdown/util.d.ts +14 -0
- package/dist/Countdown/util.js +58 -0
- package/dist/DatePicker/DatePicker.js +9 -6
- package/dist/DatePicker/DateRangePicker.js +7 -6
- package/dist/DatePicker/typings.d.ts +0 -13
- package/dist/DateTimePicker/DateTimePicker.js +29 -19
- package/dist/Dialog/Dialog.d.ts +2 -13
- package/dist/Dialog/Dialog.js +143 -160
- package/dist/Dialog/DialogBody.js +3 -38
- package/dist/Dialog/DialogContext.d.ts +0 -7
- package/dist/Dialog/DialogContext.js +1 -5
- package/dist/Dialog/DialogHeader.js +2 -2
- package/dist/Dialog/typings.d.ts +43 -28
- package/dist/Dialog/useDraggable.d.ts +2 -1
- package/dist/Dialog/useDraggable.js +34 -9
- package/dist/Drawer/Drawer.d.ts +2 -13
- package/dist/Drawer/Drawer.js +115 -137
- package/dist/Drawer/DrawerBody.js +7 -8
- package/dist/Drawer/DrawerFooter.js +7 -7
- package/dist/Drawer/DrawerHeader.js +11 -8
- package/dist/Drawer/typings.d.ts +22 -6
- package/dist/Dropdown/Dropdown.js +5 -3
- package/dist/Dropdown/typings.d.ts +2 -1
- package/dist/Empty/Empty.js +16 -4
- package/dist/Form/Form.d.ts +4 -21
- package/dist/Form/Form.js +53 -25
- package/dist/Form/FormItem.d.ts +4 -52
- package/dist/Form/FormItem.js +633 -650
- package/dist/Form/FormItemContext.d.ts +10 -1
- package/dist/Form/FormItemContext.js +9 -1
- package/dist/Form/FormLabelWrap.d.ts +8 -0
- package/dist/Form/FormLabelWrap.js +103 -0
- package/dist/Form/{FieldContext.d.ts → InternalFormContext.d.ts} +2 -2
- package/dist/Form/{FieldContext.js → InternalFormContext.js} +5 -2
- package/dist/Form/List.d.ts +3 -3
- package/dist/Form/List.js +4 -4
- package/dist/Form/index.d.ts +4 -2
- package/dist/Form/index.js +4 -1
- package/dist/Form/typings.d.ts +61 -9
- package/dist/Form/typings.js +15 -1
- package/dist/Form/useForm.js +3 -3
- package/dist/Form/useWatch.js +1 -1
- package/dist/Input/Input.d.ts +2 -14
- package/dist/Input/Input.js +187 -140
- package/dist/Input/InputGroup.js +1 -1
- package/dist/Input/InputRange.js +7 -11
- package/dist/Input/TextArea.d.ts +1 -1
- package/dist/Input/TextArea.js +85 -30
- package/dist/Input/index.d.ts +1 -0
- package/dist/Input/index.js +2 -1
- package/dist/Input/typings.d.ts +38 -19
- package/dist/Input/utils.d.ts +1 -0
- package/dist/Input/utils.js +5 -1
- package/dist/InputNumber/InputNumber.js +408 -147
- package/dist/InputNumber/typings.d.ts +15 -5
- package/dist/Loading/Loading.js +5 -2
- package/dist/Menu/Menu.js +26 -2
- package/dist/Menu/MenuItem.js +4 -2
- package/dist/Menu/SubMenu.js +2 -2
- package/dist/Menu/SubMenuCollapseTransition.js +14 -9
- package/dist/Menu/typings.d.ts +5 -14
- package/dist/Message/Message.js +51 -23
- package/dist/Message/index.js +13 -13
- package/dist/Message/typings.d.ts +8 -5
- package/dist/MessageBox/MessageBox.js +75 -57
- package/dist/MessageBox/index.d.ts +2 -1
- package/dist/MessageBox/index.js +4 -2
- package/dist/MessageBox/typings.d.ts +3 -1
- package/dist/Notification/Notification.js +26 -19
- package/dist/Notification/typings.d.ts +1 -1
- package/dist/PageHeader/PageHeader.d.ts +8 -0
- package/dist/PageHeader/PageHeader.js +91 -0
- package/dist/PageHeader/index.d.ts +2 -0
- package/dist/PageHeader/index.js +1 -0
- package/dist/PageHeader/typings.d.ts +34 -0
- package/dist/PageHeader/typings.js +1 -0
- package/dist/Pagination/typings.d.ts +1 -1
- package/dist/Popover/Popover.js +7 -7
- package/dist/Popover/typings.d.ts +3 -3
- package/dist/Popper/Popper.js +49 -28
- package/dist/Popper/popperOptions.js +1 -0
- package/dist/Popper/typings.d.ts +2 -0
- package/dist/Radio/Radio.d.ts +2 -12
- package/dist/Radio/Radio.js +2 -6
- package/dist/Radio/RadioButton.d.ts +1 -1
- package/dist/Radio/RadioButton.js +4 -4
- package/dist/Radio/index.d.ts +1 -0
- package/dist/Radio/index.js +2 -1
- package/dist/Radio/typings.d.ts +1 -1
- package/dist/RadioGroup/RadioGroup.js +44 -16
- package/dist/RadioGroup/typings.d.ts +10 -0
- package/dist/Segmented/Segmented.d.ts +4 -0
- package/dist/Segmented/Segmented.js +208 -0
- package/dist/Segmented/index.d.ts +2 -0
- package/dist/Segmented/index.js +1 -0
- package/dist/Segmented/typings.d.ts +20 -0
- package/dist/Segmented/typings.js +5 -0
- package/dist/Select/SelectContext.d.ts +2 -1
- package/dist/Select/SelectContext.js +2 -1
- package/dist/Select/SelectCore.js +64 -15
- package/dist/Select/SelectDropdown.js +23 -15
- package/dist/Select/index.d.ts +1 -1
- package/dist/Select/typings.d.ts +26 -17
- package/dist/Select/useSelect.d.ts +35 -18
- package/dist/Select/useSelect.js +88 -33
- package/dist/Skeleton/typings.d.ts +1 -1
- package/dist/Slider/Button.d.ts +4 -0
- package/dist/Slider/Button.js +96 -0
- package/dist/Slider/Marker.d.ts +4 -0
- package/dist/Slider/Marker.js +31 -0
- package/dist/Slider/Slider.d.ts +4 -0
- package/dist/Slider/Slider.js +263 -0
- package/dist/Slider/SliderContext.d.ts +3 -0
- package/dist/Slider/SliderContext.js +2 -0
- package/dist/Slider/hooks/index.d.ts +5 -0
- package/dist/Slider/hooks/index.js +5 -0
- package/dist/Slider/hooks/useLifecycle.d.ts +5 -0
- package/dist/Slider/hooks/useLifecycle.js +50 -0
- package/dist/Slider/hooks/useMarks.d.ts +2 -0
- package/dist/Slider/hooks/useMarks.js +49 -0
- package/dist/Slider/hooks/useSlider.d.ts +38 -0
- package/dist/Slider/hooks/useSlider.js +227 -0
- package/dist/Slider/hooks/useSliderButton.d.ts +28 -0
- package/dist/Slider/hooks/useSliderButton.js +454 -0
- package/dist/Slider/hooks/useStops.d.ts +6 -0
- package/dist/Slider/hooks/useStops.js +47 -0
- package/dist/Slider/hooks/useWatch.d.ts +3 -0
- package/dist/Slider/hooks/useWatch.js +119 -0
- package/dist/Slider/index.d.ts +2 -0
- package/dist/Slider/index.js +1 -0
- package/dist/Slider/style/css.d.ts +1 -0
- package/dist/Slider/style/css.js +1 -0
- package/dist/Slider/style/index.d.ts +1 -0
- package/dist/Slider/style/index.js +1 -0
- package/dist/Slider/typings.d.ts +122 -0
- package/dist/Slider/typings.js +1 -0
- package/dist/Space/Space.d.ts +4 -0
- package/dist/Space/Space.js +125 -0
- package/dist/Space/SpaceItem.d.ts +7 -0
- package/dist/Space/SpaceItem.js +14 -0
- package/dist/Space/index.d.ts +3 -0
- package/dist/Space/index.js +2 -0
- package/dist/Space/typings.d.ts +26 -0
- package/dist/Space/typings.js +1 -0
- package/dist/Space/useSpace.d.ts +7 -0
- package/dist/Space/useSpace.js +105 -0
- package/dist/Statistic/Statistic.d.ts +4 -0
- package/dist/Statistic/Statistic.js +91 -0
- package/dist/Statistic/index.d.ts +2 -0
- package/dist/Statistic/index.js +1 -0
- package/dist/Statistic/typings.d.ts +28 -0
- package/dist/Statistic/typings.js +1 -0
- package/dist/Steps/Step.d.ts +4 -0
- package/dist/Steps/Step.js +247 -0
- package/dist/Steps/Steps.d.ts +5 -0
- package/dist/Steps/Steps.js +116 -0
- package/dist/Steps/index.d.ts +3 -0
- package/dist/Steps/index.js +2 -0
- package/dist/Steps/typings.d.ts +119 -0
- package/dist/Steps/typings.js +1 -0
- package/dist/Switch/Switch.js +2 -2
- package/dist/Switch/typings.d.ts +0 -1
- package/dist/Table/Table.js +17 -14
- package/dist/Table/TableBody.js +4 -4
- package/dist/Table/TableCell.js +53 -28
- package/dist/Table/TableColumn.d.ts +2 -2
- package/dist/Table/TableHeader.js +2 -2
- package/dist/Table/TableHeaderCell.js +2 -2
- package/dist/Table/hooks/useResize.js +0 -2
- package/dist/Table/hooks/useTable.d.ts +1 -1
- package/dist/Table/hooks/useTable.js +15 -10
- package/dist/Table/typings.d.ts +28 -12
- package/dist/Table/util.d.ts +1 -1
- package/dist/Table/util.js +8 -65
- package/dist/TableV2/index.d.ts +10 -0
- package/dist/TableV2/index.js +7 -0
- package/dist/TableV2/src/auto-resizer.d.ts +14 -0
- package/dist/TableV2/src/auto-resizer.js +1 -0
- package/dist/TableV2/src/cell.d.ts +21 -0
- package/dist/TableV2/src/cell.js +1 -0
- package/dist/TableV2/src/components/auto-resizer.d.ts +4 -0
- package/dist/TableV2/src/components/auto-resizer.js +32 -0
- package/dist/TableV2/src/components/cell.d.ts +4 -0
- package/dist/TableV2/src/components/cell.js +22 -0
- package/dist/TableV2/src/components/expand-icon.d.ts +12 -0
- package/dist/TableV2/src/components/expand-icon.js +29 -0
- package/dist/TableV2/src/components/header-cell.d.ts +4 -0
- package/dist/TableV2/src/components/header-cell.js +23 -0
- package/dist/TableV2/src/components/header-row.d.ts +17 -0
- package/dist/TableV2/src/components/header-row.js +41 -0
- package/dist/TableV2/src/components/header.d.ts +20 -0
- package/dist/TableV2/src/components/header.js +103 -0
- package/dist/TableV2/src/components/index.d.ts +10 -0
- package/dist/TableV2/src/components/index.js +7 -0
- package/dist/TableV2/src/components/row.d.ts +19 -0
- package/dist/TableV2/src/components/row.js +206 -0
- package/dist/TableV2/src/components/sort-icon.d.ts +9 -0
- package/dist/TableV2/src/components/sort-icon.js +14 -0
- package/dist/TableV2/src/composables/index.d.ts +6 -0
- package/dist/TableV2/src/composables/index.js +6 -0
- package/dist/TableV2/src/composables/use-auto-resize.d.ts +7 -0
- package/dist/TableV2/src/composables/use-auto-resize.js +55 -0
- package/dist/TableV2/src/composables/use-columns.d.ts +21 -0
- package/dist/TableV2/src/composables/use-columns.js +119 -0
- package/dist/TableV2/src/composables/use-data.d.ts +15 -0
- package/dist/TableV2/src/composables/use-data.js +62 -0
- package/dist/TableV2/src/composables/use-row.d.ts +34 -0
- package/dist/TableV2/src/composables/use-row.js +191 -0
- package/dist/TableV2/src/composables/use-scrollbar.d.ts +25 -0
- package/dist/TableV2/src/composables/use-scrollbar.js +117 -0
- package/dist/TableV2/src/composables/use-styles.d.ts +23 -0
- package/dist/TableV2/src/composables/use-styles.js +90 -0
- package/dist/TableV2/src/composables/utils.d.ts +3 -0
- package/dist/TableV2/src/composables/utils.js +29 -0
- package/dist/TableV2/src/constants.d.ts +18 -0
- package/dist/{Tree/Indent.js → TableV2/src/constants.js} +18 -21
- package/dist/TableV2/src/grid.d.ts +52 -0
- package/dist/TableV2/src/grid.js +1 -0
- package/dist/TableV2/src/header-cell.d.ts +13 -0
- package/dist/TableV2/src/header-cell.js +1 -0
- package/dist/TableV2/src/header-row.d.ts +10 -0
- package/dist/TableV2/src/header-row.js +1 -0
- package/dist/TableV2/src/header.d.ts +15 -0
- package/dist/TableV2/src/header.js +1 -0
- package/dist/TableV2/src/private.d.ts +1 -0
- package/dist/TableV2/src/private.js +1 -0
- package/dist/TableV2/src/renderers/cell.d.ts +14 -0
- package/dist/TableV2/src/renderers/cell.js +120 -0
- package/dist/TableV2/src/renderers/empty.d.ts +7 -0
- package/dist/TableV2/src/renderers/empty.js +11 -0
- package/dist/TableV2/src/renderers/footer.d.ts +7 -0
- package/dist/TableV2/src/renderers/footer.js +9 -0
- package/dist/TableV2/src/renderers/header-cell.d.ts +13 -0
- package/dist/TableV2/src/renderers/header-cell.js +92 -0
- package/dist/TableV2/src/renderers/header.d.ts +9 -0
- package/dist/TableV2/src/renderers/header.js +39 -0
- package/dist/TableV2/src/renderers/left-table.d.ts +32 -0
- package/dist/TableV2/src/renderers/left-table.js +15 -0
- package/dist/TableV2/src/renderers/main-table.d.ts +31 -0
- package/dist/TableV2/src/renderers/main-table.js +12 -0
- package/dist/TableV2/src/renderers/overlay.d.ts +3 -0
- package/dist/TableV2/src/renderers/overlay.js +9 -0
- package/dist/TableV2/src/renderers/right-table.d.ts +31 -0
- package/dist/TableV2/src/renderers/right-table.js +15 -0
- package/dist/TableV2/src/renderers/row.d.ts +11 -0
- package/dist/TableV2/src/renderers/row.js +96 -0
- package/dist/TableV2/src/row.d.ts +51 -0
- package/dist/TableV2/src/row.js +1 -0
- package/dist/TableV2/src/table-grid.d.ts +43 -0
- package/dist/TableV2/src/table-grid.js +283 -0
- package/dist/TableV2/src/table-v2.d.ts +31 -0
- package/dist/TableV2/src/table-v2.js +311 -0
- package/dist/TableV2/src/table.d.ts +196 -0
- package/dist/TableV2/src/table.js +1 -0
- package/dist/TableV2/src/tokens.d.ts +11 -0
- package/dist/TableV2/src/tokens.js +6 -0
- package/dist/TableV2/src/types.d.ts +94 -0
- package/dist/TableV2/src/types.js +1 -0
- package/dist/TableV2/src/use-table.d.ts +48 -0
- package/dist/TableV2/src/use-table.js +197 -0
- package/dist/TableV2/src/utils.d.ts +5 -0
- package/dist/TableV2/src/utils.js +47 -0
- package/dist/Tabs/Tabs.js +1 -1
- package/dist/Tabs/typings.d.ts +1 -3
- package/dist/Tag/Tag.js +1 -1
- package/dist/Tag/typings.d.ts +1 -1
- package/dist/Text/Text.d.ts +4 -0
- package/dist/Text/Text.js +84 -0
- package/dist/Text/index.d.ts +2 -0
- package/dist/Text/index.js +1 -0
- package/dist/Text/typings.d.ts +15 -0
- package/dist/Text/typings.js +1 -0
- package/dist/TimePicker/TimePicker.js +6 -7
- package/dist/TimePicker/TimePickerPanel.js +12 -2
- package/dist/TimePicker/TimePickerRange.js +19 -8
- package/dist/Tooltip/Tooltip.js +31 -8
- package/dist/Tooltip/typings.d.ts +4 -0
- package/dist/Tour/Content.d.ts +9 -0
- package/dist/Tour/Content.js +81 -0
- package/dist/Tour/Mask.d.ts +12 -0
- package/dist/Tour/Mask.js +100 -0
- package/dist/Tour/Step.d.ts +7 -0
- package/dist/Tour/Step.js +119 -0
- package/dist/Tour/Tour.d.ts +6 -0
- package/dist/Tour/Tour.js +237 -0
- package/dist/Tour/context.d.ts +4 -0
- package/dist/Tour/context.js +9 -0
- package/dist/Tour/helper.d.ts +39 -0
- package/dist/Tour/helper.js +286 -0
- package/dist/Tour/index.d.ts +3 -0
- package/dist/Tour/index.js +2 -0
- package/dist/Tour/typings.d.ts +318 -0
- package/dist/Tour/typings.js +38 -0
- package/dist/Transfer/List.js +58 -59
- package/dist/Transfer/ListItem.d.ts +2 -2
- package/dist/Transfer/Transfer.d.ts +2 -2
- package/dist/Transfer/Transfer.js +84 -70
- package/dist/Transfer/index.d.ts +1 -1
- package/dist/Transfer/operation.js +8 -10
- package/dist/Transfer/typings/index.d.ts +49 -38
- package/dist/Transfer/typings/list.d.ts +11 -11
- package/dist/Transfer/typings/listBody.d.ts +2 -2
- package/dist/Transition/Transition.d.ts +1 -0
- package/dist/Transition/Transition.js +8 -7
- package/dist/Tree/CollapseTransition.d.ts +7 -0
- package/dist/Tree/CollapseTransition.js +60 -0
- package/dist/Tree/Tree.d.ts +3 -140
- package/dist/Tree/Tree.js +351 -77
- package/dist/Tree/TreeContext.d.ts +9 -0
- package/dist/Tree/TreeContext.js +14 -0
- package/dist/Tree/TreeNode.d.ts +5 -3
- package/dist/Tree/TreeNode.js +321 -331
- package/dist/Tree/TreeNodeContent.d.ts +9 -0
- package/dist/Tree/TreeNodeContent.js +22 -0
- package/dist/Tree/index.d.ts +3 -8
- package/dist/Tree/index.js +1 -4
- package/dist/Tree/model/node.d.ts +62 -0
- package/dist/Tree/model/node.js +601 -0
- package/dist/Tree/model/tree-store.d.ts +52 -0
- package/dist/Tree/model/tree-store.js +510 -0
- package/dist/Tree/model/useDragNode.d.ts +30 -0
- package/dist/Tree/model/useDragNode.js +293 -0
- package/dist/Tree/model/useKeydown.d.ts +0 -0
- package/dist/Tree/model/useKeydown.js +104 -0
- package/dist/Tree/model/useNodeExpandEventBroadcast.d.ts +15 -0
- package/dist/Tree/model/useNodeExpandEventBroadcast.js +54 -0
- package/dist/Tree/model/util.d.ts +7 -0
- package/dist/Tree/model/util.js +24 -0
- package/dist/Tree/typings.d.ts +227 -114
- package/dist/TreeSelect/TreeSelect.d.ts +2 -10
- package/dist/TreeSelect/TreeSelect.js +90 -566
- package/dist/TreeSelect/TreeSelectOption.d.ts +6 -0
- package/dist/TreeSelect/TreeSelectOption.js +62 -0
- package/dist/TreeSelect/Utils.d.ts +10 -3
- package/dist/TreeSelect/Utils.js +37 -19
- package/dist/TreeSelect/cacheOptions.d.ts +9 -0
- package/dist/TreeSelect/cacheOptions.js +22 -0
- package/dist/TreeSelect/index.d.ts +0 -1
- package/dist/TreeSelect/typings.d.ts +11 -63
- package/dist/TreeSelect/useSelect.d.ts +78 -0
- package/dist/TreeSelect/useSelect.js +104 -0
- package/dist/TreeSelect/useTree.d.ts +125 -0
- package/dist/TreeSelect/useTree.js +285 -0
- package/dist/Upload/UploadContent.js +3 -1
- package/dist/Upload/ajax.js +3 -0
- package/dist/Upload/typings.d.ts +5 -1
- package/dist/Util/PopupManager.js +1 -1
- package/dist/Util/aria.d.ts +1 -1
- package/dist/Util/aria.js +12 -12
- package/dist/Util/base.d.ts +36 -6
- package/dist/Util/base.js +180 -13
- package/dist/Util/easings.d.ts +1 -0
- package/dist/Util/easings.js +8 -0
- package/dist/Util/error.d.ts +3 -0
- package/dist/Util/error.js +39 -0
- package/dist/Util/icons.d.ts +2 -0
- package/dist/Util/icons.js +15 -0
- package/dist/Util/index.d.ts +6 -2
- package/dist/Util/index.js +6 -2
- package/dist/Util/position.d.ts +9 -0
- package/dist/Util/position.js +53 -0
- package/dist/Util/raf.d.ts +4 -0
- package/dist/Util/raf.js +10 -0
- package/dist/Util/scroll.d.ts +9 -0
- package/dist/Util/scroll.js +72 -0
- package/dist/Util/throttleByRaf.d.ts +4 -0
- package/dist/Util/throttleByRaf.js +21 -0
- package/dist/VirtualList/builders/build-grid.d.ts +5 -0
- package/dist/VirtualList/builders/build-grid.js +561 -0
- package/dist/VirtualList/builders/build-list.d.ts +7 -0
- package/dist/VirtualList/builders/build-list.js +408 -0
- package/dist/VirtualList/components/dynamic-size-grid.d.ts +15 -0
- package/dist/VirtualList/components/dynamic-size-grid.js +242 -0
- package/dist/VirtualList/components/dynamic-size-list.d.ts +7 -0
- package/dist/VirtualList/components/dynamic-size-list.js +186 -0
- package/dist/VirtualList/components/fixed-size-grid.d.ts +4 -0
- package/dist/VirtualList/components/fixed-size-grid.js +161 -0
- package/dist/VirtualList/components/fixed-size-list.d.ts +7 -0
- package/dist/VirtualList/components/fixed-size-list.js +103 -0
- package/dist/VirtualList/components/scrollbar.d.ts +5 -0
- package/dist/VirtualList/components/scrollbar.js +272 -0
- package/dist/VirtualList/defaults.d.ts +26 -0
- package/dist/VirtualList/defaults.js +24 -0
- package/dist/VirtualList/hooks/use-cache.d.ts +1 -0
- package/dist/VirtualList/hooks/use-cache.js +16 -0
- package/dist/VirtualList/hooks/use-grid-touch.d.ts +8 -0
- package/dist/VirtualList/hooks/use-grid-touch.js +58 -0
- package/dist/VirtualList/hooks/use-grid-wheel.d.ts +12 -0
- package/dist/VirtualList/hooks/use-grid-wheel.js +48 -0
- package/dist/VirtualList/hooks/use-wheel.d.ts +12 -0
- package/dist/VirtualList/hooks/use-wheel.js +41 -0
- package/dist/VirtualList/index.d.ts +9 -0
- package/dist/VirtualList/index.js +6 -0
- package/dist/VirtualList/props.d.ts +95 -0
- package/dist/VirtualList/props.js +42 -0
- package/dist/VirtualList/types.d.ts +151 -0
- package/dist/VirtualList/types.js +1 -0
- package/dist/VirtualList/utils.d.ts +11 -0
- package/dist/VirtualList/utils.js +56 -0
- package/dist/Watermark/Watermark.d.ts +4 -0
- package/dist/Watermark/Watermark.js +257 -0
- package/dist/Watermark/helper.d.ts +50 -0
- package/dist/Watermark/helper.js +253 -0
- package/dist/Watermark/index.d.ts +2 -0
- package/dist/Watermark/index.js +1 -0
- package/dist/Watermark/typings.d.ts +93 -0
- package/dist/Watermark/typings.js +1 -0
- package/dist/config/Constants.d.ts +3 -0
- package/dist/config/Constants.js +8 -0
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/popperPropsUtils.js +1 -1
- package/dist/hooks/treePropsUtils.d.ts +3 -3
- package/dist/hooks/treePropsUtils.js +2 -2
- package/dist/hooks/useClassNames.d.ts +1 -0
- package/dist/hooks/useClickOutside.js +25 -9
- package/dist/hooks/useCommonProps.d.ts +4 -0
- package/dist/hooks/useCommonProps.js +12 -3
- package/dist/hooks/useConfigProvider.d.ts +27 -0
- package/dist/hooks/useConfigProvider.js +78 -0
- package/dist/hooks/useLockscreen.d.ts +6 -0
- package/dist/hooks/useLockscreen.js +45 -0
- package/dist/hooks/useResizeObserver.d.ts +1 -1
- package/dist/hooks/useResizeObserver.js +7 -7
- package/dist/index.css +1 -1
- package/dist/index.d.ts +50 -22
- package/dist/index.js +27 -10
- package/dist/locale/en.d.ts +4 -1
- package/dist/locale/en.js +4 -1
- package/dist/locale/zhCn.d.ts +4 -1
- package/dist/locale/zhCn.js +4 -1
- package/package.json +5 -3
- package/theme-chalk/affix.scss +7 -0
- package/theme-chalk/alert.scss +115 -0
- package/theme-chalk/anchor-link.scss +45 -0
- package/theme-chalk/anchor.scss +93 -0
- package/theme-chalk/aside.scss +8 -8
- package/theme-chalk/backtop.scss +29 -0
- package/theme-chalk/breadcrumb-item.scss +58 -0
- package/theme-chalk/breadcrumb.scss +5 -61
- package/theme-chalk/button-group.scss +80 -80
- package/theme-chalk/button.scss +304 -304
- package/theme-chalk/calendar/date-table.scss +164 -164
- package/theme-chalk/cascader-panel.scss +57 -82
- package/theme-chalk/cascader.scss +206 -160
- package/theme-chalk/checkbox.scss +38 -0
- package/theme-chalk/collapse-item.scss +72 -0
- package/theme-chalk/collapse.scss +21 -76
- package/theme-chalk/color/index.scss +20 -20
- package/theme-chalk/common/popup.scss +47 -0
- package/theme-chalk/common/transition.scss +142 -142
- package/theme-chalk/common/var.scss +62 -6
- package/theme-chalk/container.scss +14 -14
- package/theme-chalk/dark/css-vars.scss +39 -39
- package/theme-chalk/dark/var.scss +225 -225
- package/theme-chalk/date-picker.scss +12 -12
- package/theme-chalk/dialog.scss +145 -137
- package/theme-chalk/drawer.scss +252 -246
- package/theme-chalk/footer.scss +12 -12
- package/theme-chalk/form-item.scss +437 -0
- package/theme-chalk/form.scss +23 -361
- package/theme-chalk/header.scss +12 -12
- package/theme-chalk/index.scss +21 -1
- package/theme-chalk/input/input-range.scss +2 -1
- package/theme-chalk/input/input.scss +458 -424
- package/theme-chalk/input-number.scss +82 -75
- package/theme-chalk/link.scss +87 -87
- package/theme-chalk/main.scss +14 -14
- package/theme-chalk/menu.scss +353 -353
- package/theme-chalk/message-box.scss +160 -133
- package/theme-chalk/message.scss +54 -128
- package/theme-chalk/mixins/_button.scss +224 -224
- package/theme-chalk/mixins/_col.scss +33 -33
- package/theme-chalk/mixins/_var.scss +67 -67
- package/theme-chalk/mixins/config.scss +5 -5
- package/theme-chalk/mixins/function.scss +99 -99
- package/theme-chalk/mixins/mixins.scss +237 -240
- package/theme-chalk/mixins/utils.scss +39 -39
- package/theme-chalk/notification.scss +96 -143
- package/theme-chalk/overlay.scss +17 -0
- package/theme-chalk/page-header.scss +60 -0
- package/theme-chalk/popper.scss +104 -104
- package/theme-chalk/radio-button.scss +169 -169
- package/theme-chalk/radio.scss +3 -3
- package/theme-chalk/segmented.scss +186 -0
- package/theme-chalk/select/index.scss +278 -272
- package/theme-chalk/slider.scss +212 -0
- package/theme-chalk/space.scss +20 -0
- package/theme-chalk/statistic.scss +35 -0
- package/theme-chalk/step.scss +320 -0
- package/theme-chalk/steps.scss +22 -0
- package/theme-chalk/switch.scss +300 -300
- package/theme-chalk/table-v2.scss +237 -0
- package/theme-chalk/table.scss +461 -482
- package/theme-chalk/tag.scss +181 -181
- package/theme-chalk/text.scss +48 -0
- package/theme-chalk/time-range-picker.scss +1 -1
- package/theme-chalk/tooltip.scss +2 -2
- package/theme-chalk/tour.scss +170 -0
- package/theme-chalk/transfer.scss +38 -12
- package/theme-chalk/transition.scss +34 -4
- package/theme-chalk/tree-select.scss +35 -19
- package/theme-chalk/tree.scss +136 -0
- package/theme-chalk/var.scss +83 -83
- package/theme-chalk/virtual-list.scss +40 -0
- package/dist/Input/Input.1.d.ts +0 -16
- package/dist/Input/Input.1.js +0 -376
- package/dist/Tree/DirectoryTree.d.ts +0 -15
- package/dist/Tree/DirectoryTree.js +0 -183
- package/dist/Tree/DropIndicator.d.ts +0 -8
- package/dist/Tree/DropIndicator.js +0 -34
- package/dist/Tree/Indent.d.ts +0 -9
- package/dist/Tree/MotionTreeNode.d.ts +0 -14
- package/dist/Tree/MotionTreeNode.js +0 -125
- package/dist/Tree/NodeList.d.ts +0 -50
- package/dist/Tree/NodeList.js +0 -301
- package/dist/Tree/RCTree.d.ts +0 -248
- package/dist/Tree/RCTree.js +0 -1216
- package/dist/Tree/contextTypes.d.ts +0 -69
- package/dist/Tree/contextTypes.js +0 -9
- package/dist/Tree/typings.tsx--bak +0 -245
- package/dist/Tree/useUnmount.d.ts +0 -5
- package/dist/Tree/useUnmount.js +0 -34
- package/dist/Tree/util.d.ts +0 -51
- package/dist/Tree/util.js +0 -303
- package/dist/Tree/utils/conductUtil.d.ts +0 -17
- package/dist/Tree/utils/conductUtil.js +0 -209
- package/dist/Tree/utils/dictUtil.d.ts +0 -13
- package/dist/Tree/utils/dictUtil.js +0 -75
- package/dist/Tree/utils/diffUtil.d.ts +0 -7
- package/dist/Tree/utils/diffUtil.js +0 -48
- package/dist/Tree/utils/dropIndicator.d.ts +0 -11
- package/dist/Tree/utils/dropIndicator.js +0 -36
- package/dist/Tree/utils/iconUtil.d.ts +0 -5
- package/dist/Tree/utils/iconUtil.js +0 -62
- package/dist/Tree/utils/keyUtil.d.ts +0 -2
- package/dist/Tree/utils/keyUtil.js +0 -3
- package/dist/Tree/utils/motion.d.ts +0 -10
- package/dist/Tree/utils/motion.js +0 -54
- package/dist/Tree/utils/pickAttrs.d.ts +0 -11
- package/dist/Tree/utils/pickAttrs.js +0 -51
- package/dist/Tree/utils/treeUtil.d.ts +0 -86
- package/dist/Tree/utils/treeUtil.js +0 -364
- package/theme-chalk/button/_mixins.scss +0 -317
- package/theme-chalk/button/button-group.scss +0 -83
- package/theme-chalk/button/button.scss +0 -382
- package/theme-chalk/button/index.scss +0 -2
- package/theme-chalk/button--bak/_mixins.scss +0 -317
- package/theme-chalk/button--bak/button-group.scss +0 -83
- package/theme-chalk/button--bak/button.scss +0 -382
- package/theme-chalk/button--bak/index.scss +0 -2
- package/theme-chalk/calendar/date-table.scss--bak +0 -156
- package/theme-chalk/input/input.scss--bak +0 -578
- package/theme-chalk/link.scss--bak +0 -99
- package/theme-chalk/popper.scss--bak +0 -86
- package/theme-chalk/radio-button.scss--bak +0 -128
- package/theme-chalk/select/index.scss--bak +0 -247
- package/theme-chalk/switch.scss--bak +0 -273
- package/theme-chalk/tag.scss--bak +0 -203
- package/theme-chalk/tree/_directory.scss +0 -73
- package/theme-chalk/tree/_tree.scss +0 -401
- package/theme-chalk/tree/index.scss +0 -2
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
4
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
5
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
10
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
11
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
12
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
14
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
15
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
16
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
17
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
18
|
+
import { isObject, isPropAbsent, nextTick } from "../../Util";
|
|
19
|
+
import isEqual from 'lodash/isEqual';
|
|
20
|
+
import isNil from 'lodash/isNil';
|
|
21
|
+
import noop from 'lodash/noop';
|
|
22
|
+
import Node from "./node";
|
|
23
|
+
import { getNodeKey } from "./util";
|
|
24
|
+
var TreeStore = /*#__PURE__*/function () {
|
|
25
|
+
function TreeStore(options) {
|
|
26
|
+
_classCallCheck(this, TreeStore);
|
|
27
|
+
_defineProperty(this, "currentNode", void 0);
|
|
28
|
+
_defineProperty(this, "currentNodeKey", void 0);
|
|
29
|
+
_defineProperty(this, "nodesMap", void 0);
|
|
30
|
+
_defineProperty(this, "root", void 0);
|
|
31
|
+
_defineProperty(this, "data", void 0);
|
|
32
|
+
_defineProperty(this, "lazy", false);
|
|
33
|
+
_defineProperty(this, "load", void 0);
|
|
34
|
+
_defineProperty(this, "filterNodeMethod", void 0);
|
|
35
|
+
_defineProperty(this, "key", void 0);
|
|
36
|
+
_defineProperty(this, "defaultCheckedKeys", void 0);
|
|
37
|
+
_defineProperty(this, "checkStrictly", false);
|
|
38
|
+
_defineProperty(this, "defaultExpandedKeys", void 0);
|
|
39
|
+
_defineProperty(this, "autoExpandParent", false);
|
|
40
|
+
_defineProperty(this, "defaultExpandAll", false);
|
|
41
|
+
_defineProperty(this, "checkDescendants", false);
|
|
42
|
+
_defineProperty(this, "props", void 0);
|
|
43
|
+
_defineProperty(this, "forceUpdate", void 0);
|
|
44
|
+
this.currentNode = null;
|
|
45
|
+
this.currentNodeKey = null;
|
|
46
|
+
for (var option in options) {
|
|
47
|
+
if (Object.prototype.hasOwnProperty.call(options, option)) {
|
|
48
|
+
this[option] = options[option];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.nodesMap = {};
|
|
52
|
+
}
|
|
53
|
+
_createClass(TreeStore, [{
|
|
54
|
+
key: "initialize",
|
|
55
|
+
value: function initialize() {
|
|
56
|
+
var _this = this;
|
|
57
|
+
this.root = new Node({
|
|
58
|
+
data: this.data,
|
|
59
|
+
store: this
|
|
60
|
+
});
|
|
61
|
+
this.root.initialize();
|
|
62
|
+
if (this.lazy && this.load) {
|
|
63
|
+
var loadFn = this.load;
|
|
64
|
+
loadFn(this.root, function (data) {
|
|
65
|
+
_this.root.doCreateChildren(data);
|
|
66
|
+
_this._initDefaultCheckedNodes();
|
|
67
|
+
_this.forceUpdate();
|
|
68
|
+
}, noop);
|
|
69
|
+
} else {
|
|
70
|
+
this._initDefaultCheckedNodes();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "filter",
|
|
75
|
+
value: function filter(value) {
|
|
76
|
+
var _this2 = this;
|
|
77
|
+
var filterNodeMethod = this.filterNodeMethod;
|
|
78
|
+
var lazy = this.lazy;
|
|
79
|
+
var traverse = /*#__PURE__*/function () {
|
|
80
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(node) {
|
|
81
|
+
var childNodes, _iterator, _step, _step$value, index, child, allHidden;
|
|
82
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
83
|
+
while (1) switch (_context.prev = _context.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
86
|
+
_iterator = _createForOfIteratorHelper(childNodes.entries());
|
|
87
|
+
_context.prev = 2;
|
|
88
|
+
_iterator.s();
|
|
89
|
+
case 4:
|
|
90
|
+
if ((_step = _iterator.n()).done) {
|
|
91
|
+
_context.next = 14;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
_step$value = _slicedToArray(_step.value, 2), index = _step$value[0], child = _step$value[1];
|
|
95
|
+
child.visible = !!(filterNodeMethod !== null && filterNodeMethod !== void 0 && filterNodeMethod.call(child, value, child.data, child));
|
|
96
|
+
if (!(index % 80 === 0 && index > 0)) {
|
|
97
|
+
_context.next = 10;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
_context.next = 10;
|
|
101
|
+
return nextTick();
|
|
102
|
+
case 10:
|
|
103
|
+
_context.next = 12;
|
|
104
|
+
return traverse(child);
|
|
105
|
+
case 12:
|
|
106
|
+
_context.next = 4;
|
|
107
|
+
break;
|
|
108
|
+
case 14:
|
|
109
|
+
_context.next = 19;
|
|
110
|
+
break;
|
|
111
|
+
case 16:
|
|
112
|
+
_context.prev = 16;
|
|
113
|
+
_context.t0 = _context["catch"](2);
|
|
114
|
+
_iterator.e(_context.t0);
|
|
115
|
+
case 19:
|
|
116
|
+
_context.prev = 19;
|
|
117
|
+
_iterator.f();
|
|
118
|
+
return _context.finish(19);
|
|
119
|
+
case 22:
|
|
120
|
+
if (!node.visible && childNodes.length) {
|
|
121
|
+
allHidden = true;
|
|
122
|
+
allHidden = !childNodes.some(function (child) {
|
|
123
|
+
return child.visible;
|
|
124
|
+
});
|
|
125
|
+
if (node.root) {
|
|
126
|
+
node.root.visible = allHidden === false;
|
|
127
|
+
} else {
|
|
128
|
+
node.visible = allHidden === false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
if (value) {
|
|
132
|
+
_context.next = 25;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
return _context.abrupt("return");
|
|
136
|
+
case 25:
|
|
137
|
+
if (node.visible && !node.isLeaf) {
|
|
138
|
+
if (!lazy || node.loaded) {
|
|
139
|
+
node.expand();
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
case 26:
|
|
143
|
+
case "end":
|
|
144
|
+
return _context.stop();
|
|
145
|
+
}
|
|
146
|
+
}, _callee, null, [[2, 16, 19, 22]]);
|
|
147
|
+
}));
|
|
148
|
+
return function traverse(_x) {
|
|
149
|
+
return _ref.apply(this, arguments);
|
|
150
|
+
};
|
|
151
|
+
}();
|
|
152
|
+
traverse(this).then(function () {
|
|
153
|
+
_this2.forceUpdate();
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}, {
|
|
157
|
+
key: "setData",
|
|
158
|
+
value: function setData(newVal) {
|
|
159
|
+
var instanceChanged = !isEqual(newVal, this.root.data);
|
|
160
|
+
if (instanceChanged) {
|
|
161
|
+
this.nodesMap = {};
|
|
162
|
+
this.root.setData(newVal);
|
|
163
|
+
this._initDefaultCheckedNodes();
|
|
164
|
+
this.setCurrentNodeKey(this.currentNodeKey);
|
|
165
|
+
} else {
|
|
166
|
+
this.root.updateChildren();
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, {
|
|
170
|
+
key: "getNode",
|
|
171
|
+
value: function getNode(data) {
|
|
172
|
+
if (data instanceof Node) {
|
|
173
|
+
return data;
|
|
174
|
+
}
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
var key = isObject(data) ? getNodeKey(this.key, data) : data;
|
|
177
|
+
return this.nodesMap[key] || null;
|
|
178
|
+
}
|
|
179
|
+
}, {
|
|
180
|
+
key: "insertBefore",
|
|
181
|
+
value: function insertBefore(data, refData) {
|
|
182
|
+
var _refNode$parent;
|
|
183
|
+
var refNode = this.getNode(refData);
|
|
184
|
+
(_refNode$parent = refNode.parent) === null || _refNode$parent === void 0 || _refNode$parent.insertBefore({
|
|
185
|
+
data: data
|
|
186
|
+
}, refNode);
|
|
187
|
+
}
|
|
188
|
+
}, {
|
|
189
|
+
key: "insertAfter",
|
|
190
|
+
value: function insertAfter(data, refData) {
|
|
191
|
+
var _refNode$parent2;
|
|
192
|
+
var refNode = this.getNode(refData);
|
|
193
|
+
(_refNode$parent2 = refNode.parent) === null || _refNode$parent2 === void 0 || _refNode$parent2.insertAfter({
|
|
194
|
+
data: data
|
|
195
|
+
}, refNode);
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "remove",
|
|
199
|
+
value: function remove(data) {
|
|
200
|
+
var node = this.getNode(data);
|
|
201
|
+
if (node && node.parent) {
|
|
202
|
+
if (node === this.currentNode) {
|
|
203
|
+
this.currentNode = null;
|
|
204
|
+
}
|
|
205
|
+
node.parent.removeChild(node);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}, {
|
|
209
|
+
key: "append",
|
|
210
|
+
value: function append(data, parentData) {
|
|
211
|
+
var parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
|
|
212
|
+
if (parentNode) {
|
|
213
|
+
parentNode.insertChild({
|
|
214
|
+
data: data
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "_initDefaultCheckedNodes",
|
|
220
|
+
value: function _initDefaultCheckedNodes() {
|
|
221
|
+
var _this3 = this;
|
|
222
|
+
var defaultCheckedKeys = this.defaultCheckedKeys || [];
|
|
223
|
+
var nodesMap = this.nodesMap;
|
|
224
|
+
defaultCheckedKeys.forEach(function (checkedKey) {
|
|
225
|
+
var node = nodesMap[checkedKey];
|
|
226
|
+
if (node) {
|
|
227
|
+
node.setChecked(true, !_this3.checkStrictly);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
}, {
|
|
232
|
+
key: "_initDefaultCheckedNode",
|
|
233
|
+
value: function _initDefaultCheckedNode(node) {
|
|
234
|
+
var defaultCheckedKeys = this.defaultCheckedKeys || [];
|
|
235
|
+
if (!isNil(node.key) && defaultCheckedKeys.includes(node.key)) {
|
|
236
|
+
node.setChecked(true, !this.checkStrictly);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}, {
|
|
240
|
+
key: "setDefaultCheckedKey",
|
|
241
|
+
value: function setDefaultCheckedKey(newVal) {
|
|
242
|
+
if (newVal !== this.defaultCheckedKeys) {
|
|
243
|
+
this.defaultCheckedKeys = newVal;
|
|
244
|
+
this._initDefaultCheckedNodes();
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}, {
|
|
248
|
+
key: "registerNode",
|
|
249
|
+
value: function registerNode(node) {
|
|
250
|
+
var key = this.key;
|
|
251
|
+
if (!node || !node.data) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
if (!key) {
|
|
255
|
+
this.nodesMap[node.id] = node;
|
|
256
|
+
} else {
|
|
257
|
+
var nodeKey = node.key;
|
|
258
|
+
if (!isNil(nodeKey)) {
|
|
259
|
+
this.nodesMap[nodeKey] = node;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}, {
|
|
264
|
+
key: "deregisterNode",
|
|
265
|
+
value: function deregisterNode(node) {
|
|
266
|
+
var _this4 = this;
|
|
267
|
+
var key = this.key;
|
|
268
|
+
if (!key || !node || !node.data) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
node.childNodes.forEach(function (child) {
|
|
272
|
+
_this4.deregisterNode(child);
|
|
273
|
+
});
|
|
274
|
+
delete this.nodesMap[node.key];
|
|
275
|
+
}
|
|
276
|
+
}, {
|
|
277
|
+
key: "getCheckedNodes",
|
|
278
|
+
value: function getCheckedNodes() {
|
|
279
|
+
var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
280
|
+
var includeHalfChecked = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
281
|
+
var checkedNodes = [];
|
|
282
|
+
var traverse = function traverse(node) {
|
|
283
|
+
var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
284
|
+
childNodes.forEach(function (child) {
|
|
285
|
+
if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
|
|
286
|
+
checkedNodes.push(child.data);
|
|
287
|
+
}
|
|
288
|
+
traverse(child);
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
traverse(this);
|
|
292
|
+
return checkedNodes;
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
key: "getCheckedKeys",
|
|
296
|
+
value: function getCheckedKeys() {
|
|
297
|
+
var _this5 = this;
|
|
298
|
+
var leafOnly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
299
|
+
return this.getCheckedNodes(leafOnly).map(function (data) {
|
|
300
|
+
return (data || {})[_this5.key];
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
}, {
|
|
304
|
+
key: "getHalfCheckedNodes",
|
|
305
|
+
value: function getHalfCheckedNodes() {
|
|
306
|
+
var nodes = [];
|
|
307
|
+
var traverse = function traverse(node) {
|
|
308
|
+
var childNodes = node.root ? node.root.childNodes : node.childNodes;
|
|
309
|
+
childNodes.forEach(function (child) {
|
|
310
|
+
if (child.indeterminate) {
|
|
311
|
+
nodes.push(child.data);
|
|
312
|
+
}
|
|
313
|
+
traverse(child);
|
|
314
|
+
});
|
|
315
|
+
};
|
|
316
|
+
traverse(this);
|
|
317
|
+
return nodes;
|
|
318
|
+
}
|
|
319
|
+
}, {
|
|
320
|
+
key: "getHalfCheckedKeys",
|
|
321
|
+
value: function getHalfCheckedKeys() {
|
|
322
|
+
var _this6 = this;
|
|
323
|
+
return this.getHalfCheckedNodes().map(function (data) {
|
|
324
|
+
return (data || {})[_this6.key];
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}, {
|
|
328
|
+
key: "_getAllNodes",
|
|
329
|
+
value: function _getAllNodes() {
|
|
330
|
+
var allNodes = [];
|
|
331
|
+
var nodesMap = this.nodesMap;
|
|
332
|
+
for (var nodeKey in nodesMap) {
|
|
333
|
+
if (Object.prototype.hasOwnProperty.call(nodesMap, nodeKey)) {
|
|
334
|
+
allNodes.push(nodesMap[nodeKey]);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return allNodes;
|
|
338
|
+
}
|
|
339
|
+
}, {
|
|
340
|
+
key: "updateChildren",
|
|
341
|
+
value: function updateChildren(key, data) {
|
|
342
|
+
var node = this.nodesMap[key];
|
|
343
|
+
if (!node) {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
var childNodes = node.childNodes;
|
|
347
|
+
for (var i = childNodes.length - 1; i >= 0; i--) {
|
|
348
|
+
var child = childNodes[i];
|
|
349
|
+
this.remove(child.data);
|
|
350
|
+
}
|
|
351
|
+
for (var _i = 0, j = data.length; _i < j; _i++) {
|
|
352
|
+
var _child = data[_i];
|
|
353
|
+
this.append(_child, node.data);
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
}, {
|
|
357
|
+
key: "_setCheckedKeys",
|
|
358
|
+
value: function _setCheckedKeys(key) {
|
|
359
|
+
var _this7 = this;
|
|
360
|
+
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
361
|
+
var checkedKeys = arguments.length > 2 ? arguments[2] : undefined;
|
|
362
|
+
var allNodes = this._getAllNodes().sort(function (a, b) {
|
|
363
|
+
return a.level - b.level;
|
|
364
|
+
});
|
|
365
|
+
var cache = Object.create(null);
|
|
366
|
+
var keys = Object.keys(checkedKeys);
|
|
367
|
+
allNodes.forEach(function (node) {
|
|
368
|
+
return node.setChecked(false, false);
|
|
369
|
+
});
|
|
370
|
+
var cacheCheckedChild = function cacheCheckedChild(node) {
|
|
371
|
+
node.childNodes.forEach(function (child) {
|
|
372
|
+
var _child$childNodes;
|
|
373
|
+
cache[child.data[key]] = true;
|
|
374
|
+
if ((_child$childNodes = child.childNodes) !== null && _child$childNodes !== void 0 && _child$childNodes.length) {
|
|
375
|
+
cacheCheckedChild(child);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
};
|
|
379
|
+
var _loop = function _loop() {
|
|
380
|
+
var node = allNodes[i];
|
|
381
|
+
var nodeKey = node.data[key].toString();
|
|
382
|
+
var checked = keys.includes(nodeKey);
|
|
383
|
+
if (!checked) {
|
|
384
|
+
if (node.checked && !cache[nodeKey]) {
|
|
385
|
+
node.setChecked(false, false);
|
|
386
|
+
}
|
|
387
|
+
return 0; // continue
|
|
388
|
+
}
|
|
389
|
+
if (node.childNodes.length) {
|
|
390
|
+
cacheCheckedChild(node);
|
|
391
|
+
}
|
|
392
|
+
if (node.isLeaf || _this7.checkStrictly) {
|
|
393
|
+
node.setChecked(true, false);
|
|
394
|
+
return 0; // continue
|
|
395
|
+
}
|
|
396
|
+
node.setChecked(true, true);
|
|
397
|
+
if (leafOnly) {
|
|
398
|
+
node.setChecked(false, false);
|
|
399
|
+
var traverse = function traverse(_node) {
|
|
400
|
+
var childNodes = _node.childNodes;
|
|
401
|
+
childNodes.forEach(function (child) {
|
|
402
|
+
if (!child.isLeaf) {
|
|
403
|
+
child.setChecked(false, false);
|
|
404
|
+
}
|
|
405
|
+
traverse(child);
|
|
406
|
+
});
|
|
407
|
+
};
|
|
408
|
+
traverse(node);
|
|
409
|
+
}
|
|
410
|
+
},
|
|
411
|
+
_ret;
|
|
412
|
+
for (var i = 0, j = allNodes.length; i < j; i++) {
|
|
413
|
+
_ret = _loop();
|
|
414
|
+
if (_ret === 0) continue;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}, {
|
|
418
|
+
key: "setCheckedNodes",
|
|
419
|
+
value: function setCheckedNodes(array) {
|
|
420
|
+
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
421
|
+
var key = this.key;
|
|
422
|
+
var checkedKeys = {};
|
|
423
|
+
array.forEach(function (item) {
|
|
424
|
+
checkedKeys[(item || {})[key]] = true;
|
|
425
|
+
});
|
|
426
|
+
this._setCheckedKeys(key, leafOnly, checkedKeys);
|
|
427
|
+
}
|
|
428
|
+
}, {
|
|
429
|
+
key: "setCheckedKeys",
|
|
430
|
+
value: function setCheckedKeys(keys) {
|
|
431
|
+
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
432
|
+
this.defaultCheckedKeys = keys;
|
|
433
|
+
var key = this.key;
|
|
434
|
+
var checkedKeys = {};
|
|
435
|
+
keys.forEach(function (k) {
|
|
436
|
+
checkedKeys[k] = true;
|
|
437
|
+
});
|
|
438
|
+
this._setCheckedKeys(key, leafOnly, checkedKeys);
|
|
439
|
+
}
|
|
440
|
+
}, {
|
|
441
|
+
key: "setDefaultExpandedKeys",
|
|
442
|
+
value: function setDefaultExpandedKeys(keys) {
|
|
443
|
+
var _this8 = this;
|
|
444
|
+
keys = keys || [];
|
|
445
|
+
this.defaultExpandedKeys = keys;
|
|
446
|
+
keys.forEach(function (key) {
|
|
447
|
+
var node = _this8.getNode(key);
|
|
448
|
+
if (node) {
|
|
449
|
+
node.expand(null, _this8.autoExpandParent);
|
|
450
|
+
}
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
}, {
|
|
454
|
+
key: "setChecked",
|
|
455
|
+
value: function setChecked(data, checked, deep) {
|
|
456
|
+
var node = this.getNode(data);
|
|
457
|
+
if (node) {
|
|
458
|
+
node.setChecked(!!checked, deep);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
}, {
|
|
462
|
+
key: "getCurrentNode",
|
|
463
|
+
value: function getCurrentNode() {
|
|
464
|
+
return this.currentNode;
|
|
465
|
+
}
|
|
466
|
+
}, {
|
|
467
|
+
key: "setCurrentNode",
|
|
468
|
+
value: function setCurrentNode(currentNode) {
|
|
469
|
+
var prevCurrentNode = this.currentNode;
|
|
470
|
+
if (prevCurrentNode) {
|
|
471
|
+
prevCurrentNode.isCurrent = false;
|
|
472
|
+
}
|
|
473
|
+
this.currentNode = currentNode;
|
|
474
|
+
this.currentNode.isCurrent = true;
|
|
475
|
+
}
|
|
476
|
+
}, {
|
|
477
|
+
key: "setUserCurrentNode",
|
|
478
|
+
value: function setUserCurrentNode(node) {
|
|
479
|
+
var shouldAutoExpandParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
480
|
+
var key = node.data[this.key];
|
|
481
|
+
var currNode = this.nodesMap[key];
|
|
482
|
+
this.setCurrentNode(currNode);
|
|
483
|
+
if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
|
|
484
|
+
var _this$currentNode$par;
|
|
485
|
+
(_this$currentNode$par = this.currentNode.parent) === null || _this$currentNode$par === void 0 || _this$currentNode$par.expand(null, true);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}, {
|
|
489
|
+
key: "setCurrentNodeKey",
|
|
490
|
+
value: function setCurrentNodeKey(key) {
|
|
491
|
+
var shouldAutoExpandParent = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
492
|
+
this.currentNodeKey = key;
|
|
493
|
+
if (isPropAbsent(key)) {
|
|
494
|
+
this.currentNode && (this.currentNode.isCurrent = false);
|
|
495
|
+
this.currentNode = null;
|
|
496
|
+
return;
|
|
497
|
+
}
|
|
498
|
+
var node = this.getNode(key);
|
|
499
|
+
if (node) {
|
|
500
|
+
this.setCurrentNode(node);
|
|
501
|
+
if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) {
|
|
502
|
+
var _this$currentNode$par2;
|
|
503
|
+
(_this$currentNode$par2 = this.currentNode.parent) === null || _this$currentNode$par2 === void 0 || _this$currentNode$par2.expand(null, true);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}]);
|
|
508
|
+
return TreeStore;
|
|
509
|
+
}();
|
|
510
|
+
export { TreeStore as default };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TreeProps } from '../typings';
|
|
3
|
+
import type Node from './node';
|
|
4
|
+
import type TreeStore from './tree-store';
|
|
5
|
+
export interface TreeNode {
|
|
6
|
+
node: Node;
|
|
7
|
+
$el?: HTMLElement;
|
|
8
|
+
}
|
|
9
|
+
export interface DragOptions {
|
|
10
|
+
event: React.DragEvent<HTMLDivElement>;
|
|
11
|
+
treeNode: TreeNode;
|
|
12
|
+
}
|
|
13
|
+
interface Props {
|
|
14
|
+
props: TreeProps;
|
|
15
|
+
elRef: React.RefObject<HTMLElement>;
|
|
16
|
+
dropIndicatorRef: React.RefObject<HTMLElement>;
|
|
17
|
+
store: TreeStore;
|
|
18
|
+
}
|
|
19
|
+
export interface DragEvents {
|
|
20
|
+
treeNodeDragStart: (options: DragOptions) => void;
|
|
21
|
+
treeNodeDragOver: (options: DragOptions) => void;
|
|
22
|
+
treeNodeDragEnd: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare const dragEventsKey: unique symbol;
|
|
25
|
+
export declare function useDragNodeHandler({ props, elRef, dropIndicatorRef, store }: Props): {
|
|
26
|
+
treeNodeDragStart: ({ event, treeNode }: DragOptions) => false;
|
|
27
|
+
treeNodeDragOver: ({ event, treeNode }: DragOptions) => void;
|
|
28
|
+
treeNodeDragEnd: (event: React.DragEvent<HTMLDivElement>) => void;
|
|
29
|
+
};
|
|
30
|
+
export {};
|