@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
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
4
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
1
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
6
|
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."); }
|
|
3
7
|
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); }
|
|
@@ -5,33 +9,84 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
5
9
|
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
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
11
|
import classNames from 'classnames';
|
|
8
|
-
import
|
|
12
|
+
import castArray from 'lodash/castArray';
|
|
13
|
+
import React, { forwardRef, memo, useCallback } from 'react';
|
|
9
14
|
import { useClassNames, useControlled } from "../hooks";
|
|
15
|
+
import { debugWarn, isBoolean, isPromise, mergeDefaultProps, throwError } from "../Util";
|
|
10
16
|
import { CollapseContext } from "./CollapseContext";
|
|
11
|
-
var Collapse = /*#__PURE__*/memo(function (props) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
var Collapse = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
18
|
+
props = mergeDefaultProps({
|
|
19
|
+
expandIconPosition: 'right'
|
|
20
|
+
}, props);
|
|
21
|
+
var _props = props,
|
|
22
|
+
accordion = _props.accordion,
|
|
23
|
+
expandIconPosition = _props.expandIconPosition,
|
|
24
|
+
onChange = _props.onChange,
|
|
25
|
+
beforeCollapse = _props.beforeCollapse,
|
|
26
|
+
_props$classPrefix = _props.classPrefix,
|
|
17
27
|
classPrefix = _props$classPrefix === void 0 ? 'collapse' : _props$classPrefix;
|
|
18
28
|
var _useClassNames = useClassNames(classPrefix),
|
|
19
29
|
b = _useClassNames.b;
|
|
20
|
-
var _useControlled = useControlled(activeName, defaultActiveName),
|
|
30
|
+
var _useControlled = useControlled(props.activeName ? castArray(props.activeName) : undefined, props.defaultActiveName ? castArray(props.defaultActiveName) : []),
|
|
21
31
|
_useControlled2 = _slicedToArray(_useControlled, 2),
|
|
22
|
-
|
|
23
|
-
|
|
32
|
+
activeName = _useControlled2[0],
|
|
33
|
+
setActiveName = _useControlled2[1];
|
|
34
|
+
var setActiveNames = useCallback(function (activeNames) {
|
|
35
|
+
setActiveName(activeNames);
|
|
36
|
+
var _value = accordion ? activeNames[0] : activeNames;
|
|
37
|
+
onChange === null || onChange === void 0 || onChange(_value);
|
|
38
|
+
}, [setActiveName, accordion, onChange]);
|
|
39
|
+
var handleChange = useCallback(function (name) {
|
|
40
|
+
if (accordion) {
|
|
41
|
+
setActiveNames([activeName[0] === name ? '' : name]);
|
|
42
|
+
} else {
|
|
43
|
+
var _activeNames = _toConsumableArray(activeName);
|
|
44
|
+
var index = _activeNames.indexOf(name);
|
|
45
|
+
if (index > -1) {
|
|
46
|
+
_activeNames.splice(index, 1);
|
|
47
|
+
} else {
|
|
48
|
+
_activeNames.push(name);
|
|
49
|
+
}
|
|
50
|
+
setActiveNames(_activeNames);
|
|
51
|
+
}
|
|
52
|
+
}, [activeName, setActiveNames, accordion]);
|
|
53
|
+
var handleItemClick = function handleItemClick(name) {
|
|
54
|
+
if (!beforeCollapse) {
|
|
55
|
+
handleChange(name);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
var shouldChange = beforeCollapse(name);
|
|
59
|
+
var isPromiseOrBool = [isPromise(shouldChange), isBoolean(shouldChange)].includes(true);
|
|
60
|
+
if (!isPromiseOrBool) {
|
|
61
|
+
throwError('ElCollapse', 'beforeCollapse must return type `Promise<boolean>` or `boolean`');
|
|
62
|
+
}
|
|
63
|
+
if (isPromise(shouldChange)) {
|
|
64
|
+
shouldChange.then(function (result) {
|
|
65
|
+
if (result !== false) {
|
|
66
|
+
handleChange(name);
|
|
67
|
+
}
|
|
68
|
+
}).catch(function (e) {
|
|
69
|
+
debugWarn('ElCollapse', "some error occurred: ".concat(e));
|
|
70
|
+
});
|
|
71
|
+
} else if (shouldChange) {
|
|
72
|
+
handleChange(name);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
React.useImperativeHandle(ref, function () {
|
|
76
|
+
return {
|
|
77
|
+
activeNames: activeName,
|
|
78
|
+
setActiveNames: setActiveNames
|
|
79
|
+
};
|
|
80
|
+
});
|
|
24
81
|
return /*#__PURE__*/React.createElement("div", {
|
|
25
|
-
className: classNames(b(), props.className),
|
|
82
|
+
className: classNames(b(), b("icon-position-".concat(expandIconPosition)), props.className),
|
|
26
83
|
style: props.style
|
|
27
84
|
}, /*#__PURE__*/React.createElement(CollapseContext.Provider, {
|
|
28
85
|
value: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
accordion: accordion,
|
|
32
|
-
onChange: onChange
|
|
86
|
+
activeNames: activeName,
|
|
87
|
+
handleItemClick: handleItemClick
|
|
33
88
|
}
|
|
34
89
|
}, props.children));
|
|
35
|
-
});
|
|
90
|
+
}));
|
|
36
91
|
Collapse.displayName = 'ElCollapse';
|
|
37
92
|
export default Collapse;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { CollapseActiveName } from './typings';
|
|
3
3
|
interface CollapseContextProps {
|
|
4
4
|
/** 当前激活的面板(可控模式:如果是手风琴模式,绑定值类型需要为string,否则为array) */
|
|
5
|
-
|
|
6
|
-
setValue: (value: CollapseProps['activeName']) => void;
|
|
7
|
-
/** 是否手风琴模式 */
|
|
8
|
-
accordion: boolean;
|
|
5
|
+
activeNames: CollapseActiveName[];
|
|
9
6
|
/** 当前激活面板改变时触发(如果是手风琴模式,参数 activeNames 类型为string,否则为array) */
|
|
10
|
-
|
|
7
|
+
handleItemClick: (name: CollapseActiveName) => void;
|
|
11
8
|
}
|
|
12
9
|
export declare const CollapseContext: import("react").Context<CollapseContextProps>;
|
|
13
10
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { CollapseItemProps } from './typings';
|
|
3
|
-
declare const CollapseItem:
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CollapseItemProps, CollapseItemRef } from './typings';
|
|
3
|
+
declare const CollapseItem: React.MemoExoticComponent<React.ForwardRefExoticComponent<CollapseItemProps & React.RefAttributes<CollapseItemRef>>>;
|
|
4
4
|
export default CollapseItem;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
|
-
function
|
|
4
|
-
function
|
|
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
5
|
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); }
|
|
6
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
7
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
8
6
|
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; }
|
|
7
|
+
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; } }
|
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
9
9
|
import classNames from 'classnames';
|
|
10
|
-
import React, { memo, useCallback, useContext, useMemo, useRef } from 'react';
|
|
10
|
+
import React, { forwardRef, memo, useCallback, useContext, useMemo, useRef, useState } from 'react';
|
|
11
11
|
import Icon from "../Icon/Icon";
|
|
12
12
|
import Transition from "../Transition/Transition";
|
|
13
13
|
import { useClassNames } from "../hooks";
|
|
14
14
|
import { CollapseContext } from "./CollapseContext";
|
|
15
15
|
import { afterEnter as _afterEnter, afterLeave as _afterLeave, beforeEnter as _beforeEnter, beforeLeave as _beforeLeave, onEnter as _onEnter, onLeave as _onLeave } from "./CollapseTransition";
|
|
16
|
-
var CollapseItem = /*#__PURE__*/memo(function (props) {
|
|
16
|
+
var CollapseItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
17
17
|
var name = props.name,
|
|
18
18
|
title = props.title,
|
|
19
|
+
icon = props.icon,
|
|
19
20
|
disabled = props.disabled,
|
|
20
21
|
_props$classPrefix = props.classPrefix,
|
|
21
22
|
classPrefix = _props$classPrefix === void 0 ? 'collapse-item' : _props$classPrefix;
|
|
@@ -24,60 +25,101 @@ var CollapseItem = /*#__PURE__*/memo(function (props) {
|
|
|
24
25
|
e = _useClassNames.e,
|
|
25
26
|
is = _useClassNames.is;
|
|
26
27
|
var _useContext = useContext(CollapseContext),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
activeNames = _useContext.activeNames,
|
|
29
|
+
handleItemClick = _useContext.handleItemClick;
|
|
30
|
+
var isClick = useRef(false);
|
|
31
|
+
var _useState = useState(false),
|
|
32
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
33
|
+
focusing = _useState2[0],
|
|
34
|
+
setFocusing = _useState2[1];
|
|
31
35
|
var containerRef = useRef(null);
|
|
32
36
|
var active = useMemo(function () {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
}, [accordion, name, value]);
|
|
42
|
-
var handleClick = useCallback(function () {
|
|
43
|
-
if (accordion) {
|
|
44
|
-
setValue(active ? '' : name);
|
|
45
|
-
onChange === null || onChange === void 0 || onChange(active ? '' : name);
|
|
46
|
-
} else {
|
|
47
|
-
if (value instanceof Array) {
|
|
48
|
-
if (active) {
|
|
49
|
-
var v = JSON.parse(JSON.stringify(value));
|
|
50
|
-
v.splice(v.indexOf(name), 1);
|
|
51
|
-
setValue(v);
|
|
52
|
-
onChange === null || onChange === void 0 || onChange(v);
|
|
53
|
-
} else {
|
|
54
|
-
setValue([].concat(_toConsumableArray(value), [name]));
|
|
55
|
-
onChange === null || onChange === void 0 || onChange([].concat(_toConsumableArray(value), [name]));
|
|
56
|
-
}
|
|
37
|
+
return activeNames.includes(name);
|
|
38
|
+
}, [activeNames, name]);
|
|
39
|
+
var handleFocus = function handleFocus() {
|
|
40
|
+
setTimeout(function () {
|
|
41
|
+
if (!isClick.current) {
|
|
42
|
+
setFocusing(true);
|
|
57
43
|
} else {
|
|
58
|
-
|
|
59
|
-
onChange === null || onChange === void 0 || onChange(active ? [] : [name]);
|
|
44
|
+
isClick.current = false;
|
|
60
45
|
}
|
|
46
|
+
}, 50);
|
|
47
|
+
};
|
|
48
|
+
var handleHeaderClick = useCallback(function (event) {
|
|
49
|
+
if (disabled) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
var target = event.target;
|
|
53
|
+
if (target !== null && target !== void 0 && target.closest('input, textarea, select')) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
handleItemClick(name);
|
|
57
|
+
isClick.current = true;
|
|
58
|
+
setFocusing(false);
|
|
59
|
+
}, [disabled, handleItemClick, name]);
|
|
60
|
+
var handleEnterClick = function handleEnterClick(event) {
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
if (event.key !== 'Enter' && event.code !== 'Space') {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
event.stopPropagation();
|
|
66
|
+
var target = event.target;
|
|
67
|
+
if (target !== null && target !== void 0 && target.closest('input, textarea, select')) {
|
|
68
|
+
return;
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
handleItemClick(name);
|
|
71
|
+
};
|
|
72
|
+
var getIcon = function getIcon() {
|
|
73
|
+
if (!icon) {
|
|
74
|
+
return /*#__PURE__*/React.createElement(Icon, {
|
|
75
|
+
name: "angle-right",
|
|
76
|
+
className: classNames(e(_templateObject || (_templateObject = _taggedTemplateLiteral(["arrow"]))), is({
|
|
77
|
+
active: active
|
|
78
|
+
}))
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
if (typeof icon === 'function') {
|
|
82
|
+
return icon(active);
|
|
83
|
+
}
|
|
84
|
+
return /*#__PURE__*/React.isValidElement(icon) ? icon : /*#__PURE__*/React.createElement(Icon, {
|
|
85
|
+
name: icon,
|
|
86
|
+
className: classNames(e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["arrow"]))), is({
|
|
87
|
+
active: active
|
|
88
|
+
}))
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
React.useImperativeHandle(ref, function () {
|
|
92
|
+
return {
|
|
93
|
+
isActive: active
|
|
94
|
+
};
|
|
95
|
+
});
|
|
63
96
|
return /*#__PURE__*/React.createElement("div", {
|
|
64
97
|
className: classNames(b(), is({
|
|
65
98
|
active: active,
|
|
66
99
|
disabled: disabled
|
|
67
100
|
}), props.className),
|
|
68
101
|
style: props.style
|
|
69
|
-
}, /*#__PURE__*/React.createElement("div",
|
|
70
|
-
className: e(
|
|
71
|
-
onClick: handleClick
|
|
72
|
-
}, title, /*#__PURE__*/React.createElement(Icon, {
|
|
73
|
-
name: "angle-right",
|
|
74
|
-
className: classNames(e(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["arrow"]))), is({
|
|
102
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
103
|
+
className: classNames(e(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["header"]))), is({
|
|
75
104
|
active: active
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
105
|
+
}), {
|
|
106
|
+
focusing: focusing && !disabled
|
|
107
|
+
}),
|
|
108
|
+
onClick: handleHeaderClick,
|
|
109
|
+
onKeyDown: handleEnterClick,
|
|
110
|
+
tabIndex: 0,
|
|
111
|
+
onFocus: handleFocus,
|
|
112
|
+
onBlur: function onBlur() {
|
|
113
|
+
return setFocusing(false);
|
|
114
|
+
}
|
|
115
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
116
|
+
className: e(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["title"])))
|
|
117
|
+
}, typeof title === 'function' ? title(active) : title), getIcon()), /*#__PURE__*/React.createElement(Transition, {
|
|
118
|
+
nodeRef: containerRef
|
|
119
|
+
// name={b('menu-collapse', false)}
|
|
120
|
+
,
|
|
80
121
|
duration: 300,
|
|
122
|
+
showDuration: 0,
|
|
81
123
|
visible: active,
|
|
82
124
|
beforeEnter: function beforeEnter() {
|
|
83
125
|
return _beforeEnter(containerRef);
|
|
@@ -99,13 +141,13 @@ var CollapseItem = /*#__PURE__*/memo(function (props) {
|
|
|
99
141
|
}
|
|
100
142
|
}, /*#__PURE__*/React.createElement("div", {
|
|
101
143
|
ref: containerRef,
|
|
102
|
-
className: classNames(e(
|
|
144
|
+
className: classNames(e(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["wrap"])))),
|
|
103
145
|
style: {
|
|
104
146
|
display: 'none'
|
|
105
147
|
}
|
|
106
148
|
}, /*#__PURE__*/React.createElement("div", {
|
|
107
|
-
className: e(
|
|
149
|
+
className: e(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["content"])))
|
|
108
150
|
}, props.children))));
|
|
109
|
-
});
|
|
151
|
+
}));
|
|
110
152
|
CollapseItem.displayName = 'CollapseItem';
|
|
111
153
|
export default CollapseItem;
|
|
@@ -22,10 +22,12 @@ export var onEnter = function onEnter(node) {
|
|
|
22
22
|
};
|
|
23
23
|
export var afterEnter = function afterEnter(node) {
|
|
24
24
|
if (node.current) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
setTimeout(function () {
|
|
26
|
+
var el = node.current;
|
|
27
|
+
removeClass(el, 'collapse-transition');
|
|
28
|
+
el.style.height = '';
|
|
29
|
+
el.style.overflow = el.dataset.oldOverflow;
|
|
30
|
+
}, 300);
|
|
29
31
|
}
|
|
30
32
|
};
|
|
31
33
|
export var beforeLeave = function beforeLeave(node) {
|
|
@@ -39,13 +41,15 @@ export var beforeLeave = function beforeLeave(node) {
|
|
|
39
41
|
el.style.height = "".concat(el.scrollHeight, "px");
|
|
40
42
|
el.style.overflow = 'hidden';
|
|
41
43
|
el.style.margin = 0;
|
|
44
|
+
el.style.transitionProperty = 'height';
|
|
45
|
+
setTimeout(function () {
|
|
46
|
+
el.style.height = 0;
|
|
47
|
+
}, 0);
|
|
42
48
|
}
|
|
43
49
|
};
|
|
44
50
|
export var onLeave = function onLeave(node) {
|
|
45
51
|
if (node.current) {
|
|
46
52
|
var el = node.current;
|
|
47
|
-
el.style.transitionProperty = 'height';
|
|
48
|
-
el.style.height = 0;
|
|
49
53
|
}
|
|
50
54
|
};
|
|
51
55
|
export var afterLeave = function afterLeave(node) {
|
|
@@ -53,6 +57,6 @@ export var afterLeave = function afterLeave(node) {
|
|
|
53
57
|
var el = node.current;
|
|
54
58
|
el.style.height = '';
|
|
55
59
|
el.style.overflow = el.dataset.oldOverflow;
|
|
56
|
-
el.style.display = '';
|
|
60
|
+
// el.style.display = '';
|
|
57
61
|
}
|
|
58
62
|
};
|
package/dist/Collapse/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { default as Collapse } from './Collapse';
|
|
2
2
|
export { default as CollapseItem } from './CollapseItem';
|
|
3
|
-
export type { CollapseItemProps, CollapseProps } from './typings';
|
|
3
|
+
export type { CollapseActiveName, CollapseItemProps, CollapseItemRef, CollapseProps, CollapseRef } from './typings';
|
|
@@ -1,20 +1,35 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IconName } from '../Icon';
|
|
2
3
|
import { BaseProps, NativeProps } from '../types/common';
|
|
4
|
+
export type CollapseActiveName = string | number;
|
|
5
|
+
export type CollapseRef = {
|
|
6
|
+
activeNames: CollapseActiveName | CollapseActiveName[];
|
|
7
|
+
setActiveNames: (activeNames: CollapseActiveName[]) => void;
|
|
8
|
+
};
|
|
9
|
+
export type CollapseItemRef = {
|
|
10
|
+
isActive: boolean;
|
|
11
|
+
};
|
|
3
12
|
export interface CollapseProps extends BaseProps, NativeProps<'--el-collapse-border-color' | '--el-collapse-header-height' | '--el-collapse-header-bg-color' | '--el-collapse-header-text-color' | '--el-collapse-header-font-size' | '--el-collapse-content-bg-color' | '--el-collapse-content-font-size' | '--el-collapse-content-text-color' | '--el-transition-duration' | '--el-collapse-item-margin'> {
|
|
4
13
|
/** 当前激活的面板(如果是手风琴模式,绑定值类型需要为string,否则为array) */
|
|
5
|
-
defaultActiveName?:
|
|
14
|
+
defaultActiveName?: CollapseActiveName | CollapseActiveName[];
|
|
6
15
|
/** 当前激活的面板(可控模式:如果是手风琴模式,绑定值类型需要为string,否则为array) */
|
|
7
|
-
activeName?:
|
|
16
|
+
activeName?: CollapseActiveName | CollapseActiveName[];
|
|
8
17
|
/** 是否手风琴模式 */
|
|
9
18
|
accordion?: boolean;
|
|
19
|
+
/** 展开图标位置 */
|
|
20
|
+
expandIconPosition?: 'left' | 'right';
|
|
21
|
+
/** 折叠状态更改之前的折叠钩子。 返回 false 或者返回 Promise 且被 reject 则停止切换 */
|
|
22
|
+
beforeCollapse?: (name: CollapseActiveName) => Promise<boolean> | boolean;
|
|
10
23
|
/** 当前激活面板改变时触发(如果是手风琴模式,参数 activeNames 类型为string,否则为array) */
|
|
11
|
-
onChange?: (activeNames:
|
|
24
|
+
onChange?: (activeNames: CollapseActiveName | CollapseActiveName[]) => void;
|
|
12
25
|
}
|
|
13
26
|
export interface CollapseItemProps extends BaseProps, NativeProps {
|
|
14
27
|
/** 唯一标志符 */
|
|
15
|
-
name:
|
|
28
|
+
name: CollapseActiveName;
|
|
16
29
|
/** 面板标题 */
|
|
17
|
-
title?: string | React.ReactElement;
|
|
30
|
+
title?: string | React.ReactElement | ((isActive: boolean) => React.ReactNode);
|
|
31
|
+
/** 自定义图标 */
|
|
32
|
+
icon?: IconName | React.ReactElement | ((isActive: boolean) => React.ReactNode);
|
|
18
33
|
/** 是否禁用 */
|
|
19
34
|
disabled?: boolean;
|
|
20
35
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PopperOptions } from '../Popper';
|
|
2
2
|
import { AnimationEventProps, BaseProps, NativeProps, TypeAttributes } from '../types/common';
|
|
3
|
-
export interface ColorPickerProps extends BaseProps, NativeProps
|
|
3
|
+
export interface ColorPickerProps extends BaseProps, NativeProps<'--el-color-picker-alpha-bg-a' | '--el-color-picker-alpha-bg-b'>, AnimationEventProps, PopperOptions {
|
|
4
4
|
/** 绑定值(可控模式) */
|
|
5
5
|
value?: string;
|
|
6
6
|
/** 默认值 */
|
|
@@ -7,8 +7,8 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
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); }
|
|
8
8
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
9
9
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
10
|
-
import React
|
|
11
|
-
import {
|
|
10
|
+
import React from 'react';
|
|
11
|
+
import { mergeDefaultProps } from "../Util";
|
|
12
12
|
import ConfigProviderContext from "./ConfigProviderContext";
|
|
13
13
|
var ConfigProvider = function ConfigProvider(props) {
|
|
14
14
|
props = mergeDefaultProps({
|
|
@@ -38,28 +38,6 @@ var ConfigProvider = function ConfigProvider(props) {
|
|
|
38
38
|
children = _props.children,
|
|
39
39
|
locale = _props.locale,
|
|
40
40
|
values = _objectWithoutProperties(_props, _excluded);
|
|
41
|
-
useEffect(function () {
|
|
42
|
-
// const configs = localStorage.getItem('__el__config__provider__');
|
|
43
|
-
// let msgConfig = null;
|
|
44
|
-
// if (isEmpty(configs) || JSON.parse(configs).length === 0) {
|
|
45
|
-
// msgConfig = [props.message];
|
|
46
|
-
// localStorage.setItem('__el__config__provider__', JSON.stringify([props.message]));
|
|
47
|
-
// } else {
|
|
48
|
-
// msgConfig = [...JSON.parse(configs), props.message];
|
|
49
|
-
// localStorage.setItem('__el__config__provider__', JSON.stringify(msgConfig));
|
|
50
|
-
// }
|
|
51
|
-
|
|
52
|
-
var msgConfig = localStorage.getItem('__el__message__config__provider__');
|
|
53
|
-
if (isEmpty(msgConfig) || Object.keys(JSON.parse(msgConfig)).length === 0) {
|
|
54
|
-
localStorage.setItem('__el__message__config__provider__', JSON.stringify(props.message));
|
|
55
|
-
} else {
|
|
56
|
-
localStorage.setItem('__el__message__config__provider__', JSON.stringify(mergeDefaultProps(JSON.parse(msgConfig), props.message)));
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// return () => {
|
|
60
|
-
// localStorage.removeItem('__el__message_config__provider');
|
|
61
|
-
// };
|
|
62
|
-
});
|
|
63
41
|
return /*#__PURE__*/React.createElement(ConfigProviderContext.Provider, {
|
|
64
42
|
value: _objectSpread(_objectSpread({}, values), {}, {
|
|
65
43
|
locale: locale === 'zh-cn' ? 'zh-CN' : locale
|
package/dist/Container/Main.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const Main: React.ForwardRefExoticComponent<import("..").BaseProps<import("../types/common").ComponentChildren> & import("..").NativeProps & React.RefAttributes<HTMLDivElement>>;
|
|
2
|
+
declare const Main: React.ForwardRefExoticComponent<import("..").BaseProps<import("../types/common").ComponentChildren> & import("..").NativeProps<"--el-main-padding"> & React.RefAttributes<HTMLDivElement>>;
|
|
3
3
|
export default Main;
|
|
@@ -20,7 +20,7 @@ export type HeaderProps = BaseProps & NativeProps<'--el-header-padding' | '--el-
|
|
|
20
20
|
*/
|
|
21
21
|
height?: string | number;
|
|
22
22
|
};
|
|
23
|
-
export type MainProps = BaseProps & NativeProps
|
|
23
|
+
export type MainProps = BaseProps & NativeProps<'--el-main-padding'>;
|
|
24
24
|
export type FooterProps = BaseProps & NativeProps<'--el-footer-padding' | '--el-footer-height'> & {
|
|
25
25
|
/**
|
|
26
26
|
* 底栏高度
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
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."); }
|
|
3
|
+
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); }
|
|
4
|
+
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; }
|
|
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
|
+
import { useMount, useUnmount } from 'ahooks';
|
|
8
|
+
import React, { forwardRef, memo, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
9
|
+
import Statistic from "../Statistic/Statistic";
|
|
10
|
+
import { cAF, rAF } from "../Util";
|
|
11
|
+
import { mergeDefaultProps } from "../Util/base";
|
|
12
|
+
import { formatTime, getTime } from "./util";
|
|
13
|
+
var Countdown = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (props, ref) {
|
|
14
|
+
props = mergeDefaultProps({
|
|
15
|
+
format: 'HH:mm:ss',
|
|
16
|
+
value: 0,
|
|
17
|
+
valueStyle: undefined
|
|
18
|
+
}, props);
|
|
19
|
+
var _props = props,
|
|
20
|
+
format = _props.format,
|
|
21
|
+
value = _props.value,
|
|
22
|
+
title = _props.title,
|
|
23
|
+
prefix = _props.prefix,
|
|
24
|
+
suffix = _props.suffix,
|
|
25
|
+
valueStyle = _props.valueStyle,
|
|
26
|
+
onChange = _props.onChange,
|
|
27
|
+
onFinish = _props.onFinish,
|
|
28
|
+
className = _props.className,
|
|
29
|
+
style = _props.style,
|
|
30
|
+
children = _props.children;
|
|
31
|
+
var timerRef = useRef(undefined);
|
|
32
|
+
var _useState = useState(0),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
rawValue = _useState2[0],
|
|
35
|
+
setRawValue = _useState2[1];
|
|
36
|
+
var statisticRef = useRef(null);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @description 计算格式化后的倒计时显示值
|
|
40
|
+
*/
|
|
41
|
+
var displayValue = useMemo(function () {
|
|
42
|
+
return formatTime(rawValue, format);
|
|
43
|
+
}, [rawValue, format]);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* @description 自定义格式化函数,传递给 Statistic 组件
|
|
47
|
+
*/
|
|
48
|
+
var formatter = useCallback(function (val) {
|
|
49
|
+
return formatTime(Number(val), format);
|
|
50
|
+
}, [format]);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description 停止计时器
|
|
54
|
+
*/
|
|
55
|
+
var stopTimer = useCallback(function () {
|
|
56
|
+
if (timerRef.current !== undefined) {
|
|
57
|
+
cAF(timerRef.current);
|
|
58
|
+
timerRef.current = undefined;
|
|
59
|
+
}
|
|
60
|
+
}, []);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @description 启动倒计时计时器
|
|
64
|
+
*/
|
|
65
|
+
var startTimer = useCallback(function () {
|
|
66
|
+
var timestamp = getTime(value);
|
|
67
|
+
var frameFunc = function frameFunc() {
|
|
68
|
+
var diff = timestamp - Date.now();
|
|
69
|
+
onChange === null || onChange === void 0 || onChange(diff);
|
|
70
|
+
if (diff <= 0) {
|
|
71
|
+
diff = 0;
|
|
72
|
+
stopTimer();
|
|
73
|
+
onFinish === null || onFinish === void 0 || onFinish();
|
|
74
|
+
} else {
|
|
75
|
+
timerRef.current = rAF(frameFunc);
|
|
76
|
+
}
|
|
77
|
+
setRawValue(diff);
|
|
78
|
+
};
|
|
79
|
+
timerRef.current = rAF(frameFunc);
|
|
80
|
+
}, [value, onChange, onFinish, stopTimer]);
|
|
81
|
+
useMount(function () {
|
|
82
|
+
setRawValue(getTime(value) - Date.now());
|
|
83
|
+
});
|
|
84
|
+
useUnmount(function () {
|
|
85
|
+
stopTimer();
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @description 组件挂载时初始化倒计时并启动计时器
|
|
90
|
+
*/
|
|
91
|
+
useEffect(function () {
|
|
92
|
+
stopTimer();
|
|
93
|
+
startTimer();
|
|
94
|
+
}, [value, format]);
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @description 暴露 displayValue 给父组件
|
|
98
|
+
*/
|
|
99
|
+
useImperativeHandle(ref, function () {
|
|
100
|
+
return {
|
|
101
|
+
get ref() {
|
|
102
|
+
var _statisticRef$current;
|
|
103
|
+
return (_statisticRef$current = statisticRef.current) === null || _statisticRef$current === void 0 ? void 0 : _statisticRef$current.ref;
|
|
104
|
+
},
|
|
105
|
+
displayValue: displayValue
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
return /*#__PURE__*/React.createElement(Statistic, {
|
|
109
|
+
ref: statisticRef,
|
|
110
|
+
value: rawValue,
|
|
111
|
+
title: title,
|
|
112
|
+
prefix: prefix,
|
|
113
|
+
suffix: suffix,
|
|
114
|
+
formatter: formatter,
|
|
115
|
+
valueStyle: valueStyle,
|
|
116
|
+
className: className,
|
|
117
|
+
style: style
|
|
118
|
+
}, children);
|
|
119
|
+
}));
|
|
120
|
+
Countdown.displayName = 'ElCountdown';
|
|
121
|
+
export default Countdown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as Countdown } from "./Countdown";
|