@king-design/vue 2.1.4 → 2.1.5
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/components/affix/index.d.ts +2 -2
- package/components/affix/index.js +5 -0
- package/components/affix/index.spec.js +108 -84
- package/components/affix/index.vdt.js +8 -5
- package/components/affix/useStyle.js +19 -8
- package/components/badge/index.js +2 -0
- package/components/badge/index.vdt.js +9 -5
- package/components/badge/styles.js +2 -0
- package/components/breadcrumb/index.js +4 -0
- package/components/breadcrumb/index.spec.js +6 -6
- package/components/breadcrumb/index.vdt.js +14 -5
- package/components/breadcrumb/item.js +8 -0
- package/components/breadcrumb/item.vdt.js +6 -3
- package/components/breadcrumb/styles.js +3 -0
- package/components/button/dynamicButton.d.ts +1 -1
- package/components/button/dynamicButton.js +5 -2
- package/components/button/group.js +10 -2
- package/components/button/group.vdt.js +7 -4
- package/components/button/index.js +27 -3
- package/components/button/index.spec.js +96 -74
- package/components/button/index.vdt.js +29 -19
- package/components/button/styles.d.ts +2 -2
- package/components/button/styles.js +48 -4
- package/components/card/column.js +2 -0
- package/components/card/column.vdt.js +10 -5
- package/components/card/index.js +4 -0
- package/components/card/index.vdt.js +16 -4
- package/components/carousel/index.js +19 -1
- package/components/carousel/index.spec.js +163 -127
- package/components/carousel/index.vdt.js +15 -12
- package/components/carousel/item.js +2 -0
- package/components/carousel/item.vdt.js +7 -4
- package/components/carousel/styles.js +1 -0
- package/components/carousel/useAutoplay.js +4 -0
- package/components/carousel/useItems.js +20 -4
- package/components/carousel/useSlide.js +89 -57
- package/components/cascader/index.d.ts +45 -0
- package/components/cascader/index.js +18 -3
- package/components/cascader/index.spec.js +445 -354
- package/components/cascader/index.vdt.js +31 -14
- package/components/cascader/styles.js +6 -0
- package/components/cascader/useFields.js +4 -1
- package/components/cascader/useFilterable.js +19 -2
- package/components/cascader/useLabel.js +9 -1
- package/components/cascader/useLoad.js +35 -22
- package/components/cascader/useValue.d.ts +2 -2
- package/components/cascader/useValue.js +26 -5
- package/components/checkbox/index.js +27 -5
- package/components/checkbox/index.spec.js +171 -129
- package/components/checkbox/index.vdt.js +16 -12
- package/components/checkbox/styles.js +10 -0
- package/components/code/crossDomain.js +9 -2
- package/components/code/index.js +9 -0
- package/components/code/index.spec.js +55 -46
- package/components/code/index.vdt.js +14 -6
- package/components/code/styles.js +1 -0
- package/components/code/useEditor.js +10 -5
- package/components/collapse/index.d.ts +1 -1
- package/components/collapse/index.js +14 -3
- package/components/collapse/index.spec.js +60 -47
- package/components/collapse/index.vdt.js +12 -4
- package/components/collapse/item.js +10 -0
- package/components/collapse/item.vdt.js +14 -7
- package/components/collapse/styles.js +1 -0
- package/components/colorpicker/drag.js +5 -0
- package/components/colorpicker/index.js +4 -0
- package/components/colorpicker/index.spec.js +259 -211
- package/components/colorpicker/index.vdt.js +11 -8
- package/components/colorpicker/panel.js +5 -0
- package/components/colorpicker/panel.vdt.js +26 -21
- package/components/colorpicker/styles.js +13 -2
- package/components/colorpicker/useDrag.js +26 -22
- package/components/colorpicker/useInput.js +16 -0
- package/components/colorpicker/usePointer.js +18 -15
- package/components/colorpicker/useValue.js +7 -2
- package/components/context.d.ts +2 -2
- package/components/context.js +19 -2
- package/components/datepicker/basepicker.d.ts +8 -8
- package/components/datepicker/basepicker.js +90 -20
- package/components/datepicker/calendar.js +11 -0
- package/components/datepicker/calendar.vdt.js +14 -11
- package/components/datepicker/constants.js +1 -0
- package/components/datepicker/dayjs.js +1 -1
- package/components/datepicker/helpers.js +15 -3
- package/components/datepicker/index.d.ts +63 -0
- package/components/datepicker/index.js +32 -6
- package/components/datepicker/index.spec.js +1448 -1141
- package/components/datepicker/index.vdt.js +34 -20
- package/components/datepicker/shortcuts.d.ts +1 -1
- package/components/datepicker/shortcuts.js +4 -0
- package/components/datepicker/styles.js +8 -0
- package/components/datepicker/time.d.ts +1 -1
- package/components/datepicker/time.js +23 -3
- package/components/datepicker/time.vdt.js +5 -4
- package/components/datepicker/useDays.js +9 -2
- package/components/datepicker/useDisabled.js +23 -6
- package/components/datepicker/useFocusDate.js +2 -0
- package/components/datepicker/useFormats.js +15 -6
- package/components/datepicker/useKeyboards.js +36 -20
- package/components/datepicker/useMonths.js +6 -0
- package/components/datepicker/usePanel.js +10 -0
- package/components/datepicker/useShowDate.js +37 -10
- package/components/datepicker/useStatus.js +15 -3
- package/components/datepicker/useValue.js +35 -22
- package/components/datepicker/useYears.js +15 -4
- package/components/diagram/diagram.js +43 -17
- package/components/diagram/diagram.vdt.js +5 -2
- package/components/diagram/graph.js +6 -6
- package/components/diagram/index.d.ts +1 -1
- package/components/diagram/index.js +7 -7
- package/components/diagram/index.spec.js +495 -369
- package/components/diagram/layouts/circle.js +14 -6
- package/components/diagram/layouts/flow.js +15 -7
- package/components/diagram/layouts/layout.js +28 -6
- package/components/diagram/layouts/organic.js +11 -3
- package/components/diagram/layouts/partition.js +12 -4
- package/components/diagram/layouts/radial.js +18 -6
- package/components/diagram/layouts/stack.js +14 -6
- package/components/diagram/layouts/tree.js +21 -11
- package/components/diagram/mxgraph/handler/mxConnectionHandler.js +22 -15
- package/components/diagram/mxgraph/handler/mxConstraintHandler.js +4 -4
- package/components/diagram/mxgraph/handler/mxEdgeHandler.js +15 -11
- package/components/diagram/mxgraph/handler/mxGraphHandler.js +9 -6
- package/components/diagram/mxgraph/handler/mxRubberband.js +4 -4
- package/components/diagram/mxgraph/handler/mxVertexHandler.js +10 -7
- package/components/diagram/mxgraph/index.js +2 -0
- package/components/diagram/mxgraph/mx.js +3 -3
- package/components/diagram/mxgraph/shape/mxCloud.js +2 -2
- package/components/diagram/mxgraph/shape/mxCylinder.js +9 -4
- package/components/diagram/mxgraph/shape/mxEllipse.js +2 -2
- package/components/diagram/mxgraph/shape/mxHexagon.js +2 -2
- package/components/diagram/mxgraph/shape/mxLine.js +2 -2
- package/components/diagram/mxgraph/shape/mxRectangleShape.js +2 -2
- package/components/diagram/mxgraph/shape/mxRhombus.js +12 -6
- package/components/diagram/mxgraph/shape/mxShape.js +1 -0
- package/components/diagram/mxgraph/shape/mxTriangle.js +2 -2
- package/components/diagram/mxgraph/util/mxConstants.js +2 -2
- package/components/diagram/mxgraph/util/mxGuide.js +7 -5
- package/components/diagram/mxgraph/view/mxCellEditor.js +29 -16
- package/components/diagram/mxgraph/view/mxCellRenderer.js +2 -0
- package/components/diagram/mxgraph/view/mxGraph.js +32 -14
- package/components/diagram/shapes/base.d.ts +1 -1
- package/components/diagram/shapes/base.js +39 -9
- package/components/diagram/shapes/callout.js +23 -10
- package/components/diagram/shapes/circle.js +10 -3
- package/components/diagram/shapes/document.js +16 -5
- package/components/diagram/shapes/ellipse.js +5 -0
- package/components/diagram/shapes/generateShapes.d.ts +1 -1
- package/components/diagram/shapes/generateShapes.js +9 -0
- package/components/diagram/shapes/hexagon.js +26 -9
- package/components/diagram/shapes/image.js +9 -1
- package/components/diagram/shapes/line.d.ts +2 -2
- package/components/diagram/shapes/line.js +48 -13
- package/components/diagram/shapes/parallelogram.js +26 -9
- package/components/diagram/shapes/rectangle.js +9 -1
- package/components/diagram/shapes/shape.js +35 -6
- package/components/diagram/shapes/square.js +11 -3
- package/components/diagram/shapes/text.js +5 -0
- package/components/diagram/styles.js +1 -0
- package/components/dialog/alert.vdt.js +19 -9
- package/components/dialog/base.js +29 -1
- package/components/dialog/base.vdt.js +29 -14
- package/components/dialog/index.js +31 -6
- package/components/dialog/index.spec.js +554 -406
- package/components/dialog/staticMethods.d.ts +1 -1
- package/components/dialog/staticMethods.js +13 -2
- package/components/dialog/styles.js +11 -0
- package/components/dialog/useDraggable.js +6 -0
- package/components/dialog/useEscClosable.js +12 -4
- package/components/dialog/useFixBody.d.ts +1 -1
- package/components/dialog/useFixBody.js +11 -0
- package/components/dialog/usePosition.js +5 -0
- package/components/drawer/index.js +5 -0
- package/components/drawer/index.spec.js +168 -126
- package/components/drawer/index.vdt.js +9 -3
- package/components/drawer/styles.d.ts +2 -2
- package/components/drawer/styles.js +4 -0
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +89 -33
- package/components/dropdown/index.js +6 -2
- package/components/dropdown/index.spec.js +496 -388
- package/components/dropdown/item.js +25 -4
- package/components/dropdown/item.vdt.js +8 -5
- package/components/dropdown/menu.js +29 -12
- package/components/dropdown/menu.vdt.js +13 -5
- package/components/dropdown/styles.js +9 -0
- package/components/dropdown/useKeyboard.d.ts +2 -2
- package/components/dropdown/useKeyboard.js +30 -8
- package/components/dropdown/usePosition.d.ts +1 -1
- package/components/dropdown/usePosition.js +22 -12
- package/components/dropdown/useTransition.js +8 -0
- package/components/editable/index.d.ts +1 -1
- package/components/editable/index.js +28 -4
- package/components/editable/index.spec.js +189 -152
- package/components/editable/index.vdt.js +11 -8
- package/components/editable/styles.js +1 -0
- package/components/form/form.js +18 -0
- package/components/form/form.vdt.js +7 -4
- package/components/form/index.spec.js +1280 -1057
- package/components/form/item.d.ts +1 -1
- package/components/form/item.js +12 -0
- package/components/form/item.vdt.js +31 -17
- package/components/form/methods.d.ts +5 -5
- package/components/form/methods.js +12 -2
- package/components/form/styles.js +8 -0
- package/components/form/useDirty.js +7 -2
- package/components/form/useError.js +10 -2
- package/components/form/useValidate.d.ts +1 -1
- package/components/form/useValidate.js +24 -8
- package/components/grid/col.d.ts +3 -3
- package/components/grid/col.js +7 -0
- package/components/grid/col.vdt.js +13 -8
- package/components/grid/constants.d.ts +6 -6
- package/components/grid/row.js +5 -0
- package/components/grid/row.vdt.js +8 -5
- package/components/grid/styles.js +7 -0
- package/components/grid/useBreakpoints.js +5 -0
- package/components/grid/useGutter.js +25 -5
- package/components/icon/index.js +10 -0
- package/components/icon/index.vdt.js +13 -7
- package/components/icon/styles.js +1 -0
- package/components/input/index.d.ts +3 -3
- package/components/input/index.js +14 -0
- package/components/input/index.spec.js +239 -185
- package/components/input/index.vdt.js +49 -39
- package/components/input/search.js +20 -0
- package/components/input/search.vdt.js +9 -6
- package/components/input/styles.js +26 -0
- package/components/input/useAutoRows.js +18 -6
- package/components/input/useAutoWidth.js +5 -0
- package/components/input/useFrozen.js +6 -0
- package/components/input/useShowPassword.js +5 -2
- package/components/layout/aside.js +17 -5
- package/components/layout/aside.vdt.js +9 -5
- package/components/layout/body.js +17 -5
- package/components/layout/footer.js +7 -1
- package/components/layout/header.js +21 -7
- package/components/layout/layout.js +24 -9
- package/components/layout/styles.js +13 -2
- package/components/layout/template.vdt.js +4 -2
- package/components/layout/useParse.js +7 -0
- package/components/menu/index.spec.js +242 -189
- package/components/menu/item.js +16 -3
- package/components/menu/item.vdt.js +32 -20
- package/components/menu/menu.js +11 -2
- package/components/menu/menu.vdt.js +12 -6
- package/components/menu/styles.js +18 -0
- package/components/menu/useDropdown.js +9 -4
- package/components/menu/useExpanded.js +14 -0
- package/components/menu/useHighlight.js +36 -26
- package/components/message/index.spec.js +73 -58
- package/components/message/message.js +19 -0
- package/components/message/message.vdt.js +8 -5
- package/components/message/messages.js +12 -0
- package/components/message/messages.vdt.js +1 -0
- package/components/message/styles.js +9 -0
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +46 -10
- package/components/pagination/index.spec.js +173 -133
- package/components/pagination/index.vdt.js +34 -14
- package/components/pagination/styles.js +4 -0
- package/components/portal.d.ts +1 -1
- package/components/portal.js +29 -2
- package/components/position.d.ts +12 -12
- package/components/position.js +88 -32
- package/components/progress/index.d.ts +6 -6
- package/components/progress/index.js +12 -0
- package/components/progress/index.spec.js +191 -143
- package/components/progress/index.vdt.js +11 -8
- package/components/progress/styles.js +6 -0
- package/components/progress/useColor.js +7 -2
- package/components/progress/useStatus.d.ts +1 -1
- package/components/progress/useStatus.js +5 -2
- package/components/radio/index.js +18 -3
- package/components/radio/index.spec.js +149 -111
- package/components/radio/index.vdt.js +17 -14
- package/components/radio/styles.js +10 -0
- package/components/rate/index.js +7 -0
- package/components/rate/index.spec.js +79 -64
- package/components/rate/index.vdt.js +21 -8
- package/components/rate/styles.js +3 -0
- package/components/rate/useActiveValue.js +7 -2
- package/components/scrollSelect/index.d.ts +2 -2
- package/components/scrollSelect/index.js +7 -0
- package/components/scrollSelect/index.spec.js +131 -100
- package/components/scrollSelect/index.vdt.js +11 -6
- package/components/scrollSelect/styles.js +7 -0
- package/components/scrollSelect/useList.js +17 -3
- package/components/scrollSelect/useMouseEvents.js +49 -31
- package/components/scrollSelect/useTranslate.js +11 -1
- package/components/select/base.js +35 -5
- package/components/select/base.vdt.js +38 -23
- package/components/select/group.js +5 -0
- package/components/select/group.vdt.js +10 -4
- package/components/select/index.spec.js +452 -361
- package/components/select/menu.js +5 -0
- package/components/select/menu.vdt.js +33 -18
- package/components/select/option.js +16 -2
- package/components/select/option.vdt.js +14 -7
- package/components/select/select.d.ts +33 -0
- package/components/select/select.js +20 -3
- package/components/select/select.vdt.js +17 -9
- package/components/select/styles.js +33 -0
- package/components/select/useBaseLabel.d.ts +1 -1
- package/components/select/useBaseLabel.js +17 -4
- package/components/select/useCard.js +4 -0
- package/components/select/useEqualWidth.js +1 -0
- package/components/select/useFilterable.js +27 -5
- package/components/select/useFocusout.js +8 -0
- package/components/select/useInput.js +10 -6
- package/components/select/useLabel.js +13 -3
- package/components/select/useSearchable.js +10 -0
- package/components/skeleton/item.d.ts +1 -1
- package/components/skeleton/item.js +4 -0
- package/components/skeleton/item.vdt.js +6 -1
- package/components/skeleton/skeleton.js +4 -0
- package/components/skeleton/skeleton.vdt.js +12 -6
- package/components/skeleton/style.d.ts +1 -1
- package/components/skeleton/style.js +1 -0
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +7 -0
- package/components/slider/index.spec.js +585 -467
- package/components/slider/index.vdt.js +45 -32
- package/components/slider/styles.js +14 -0
- package/components/slider/useClick.js +11 -2
- package/components/slider/useDraggable.js +34 -23
- package/components/slider/useKeyboard.js +18 -7
- package/components/slider/useMarks.d.ts +5 -5
- package/components/slider/useMarks.js +13 -5
- package/components/slider/usePoints.d.ts +2 -2
- package/components/slider/usePoints.js +21 -7
- package/components/slider/useStyles.d.ts +1 -1
- package/components/slider/useStyles.js +10 -5
- package/components/slider/useTooltip.js +10 -2
- package/components/slider/useValue.d.ts +1 -1
- package/components/slider/useValue.js +22 -7
- package/components/spin/index.js +4 -0
- package/components/spin/index.vdt.js +11 -4
- package/components/spin/styles.js +2 -0
- package/components/spinner/index.d.ts +4 -4
- package/components/spinner/index.js +24 -9
- package/components/spinner/index.spec.js +460 -359
- package/components/spinner/index.vdt.js +13 -10
- package/components/spinner/styles.js +3 -0
- package/components/spinner/useChange.js +16 -4
- package/components/spinner/useFormatter.js +16 -6
- package/components/spinner/useStep.d.ts +3 -3
- package/components/spinner/useStep.js +20 -2
- package/components/spinner/useValue.js +26 -11
- package/components/split/index.js +7 -0
- package/components/split/index.spec.js +267 -223
- package/components/split/index.vdt.js +17 -8
- package/components/split/style.d.ts +1 -1
- package/components/split/style.js +8 -0
- package/components/split/useDraggable.js +35 -11
- package/components/split/useSize.js +5 -2
- package/components/steps/context.d.ts +2 -2
- package/components/steps/index.js +10 -2
- package/components/steps/index.spec.js +27 -21
- package/components/steps/index.vdt.js +10 -8
- package/components/steps/step.js +2 -0
- package/components/steps/step.vdt.js +12 -8
- package/components/steps/styles.js +27 -0
- package/components/switch/index.js +23 -2
- package/components/switch/index.spec.js +224 -188
- package/components/switch/index.vdt.js +32 -16
- package/components/switch/styles.js +14 -3
- package/components/switch/useDraggable.js +18 -10
- package/components/table/cell.js +6 -0
- package/components/table/cell.vdt.js +21 -14
- package/components/table/column.d.ts +1 -1
- package/components/table/column.js +5 -0
- package/components/table/column.vdt.js +30 -19
- package/components/table/exportTable.js +56 -45
- package/components/table/index.spec.js +984 -780
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +41 -12
- package/components/table/row.vdt.js +39 -27
- package/components/table/styles.js +11 -0
- package/components/table/table.d.ts +5 -5
- package/components/table/table.js +50 -18
- package/components/table/table.vdt.js +85 -61
- package/components/table/useChecked.d.ts +1 -1
- package/components/table/useChecked.js +61 -20
- package/components/table/useColumns.js +16 -3
- package/components/table/useDisableRow.js +12 -2
- package/components/table/useDraggable.js +12 -4
- package/components/table/useExpandable.js +5 -2
- package/components/table/useFixedColumns.d.ts +1 -1
- package/components/table/useFixedColumns.js +23 -4
- package/components/table/useGroup.d.ts +1 -1
- package/components/table/useGroup.js +24 -7
- package/components/table/useMerge.d.ts +4 -4
- package/components/table/useMerge.js +14 -2
- package/components/table/usePagination.js +18 -4
- package/components/table/useResizable.js +10 -2
- package/components/table/useRestRowStatus.js +6 -2
- package/components/table/useScroll.d.ts +1 -1
- package/components/table/useScroll.js +3 -0
- package/components/table/useSelected.js +5 -2
- package/components/table/useSortable.js +8 -2
- package/components/table/useStickyHeader.js +7 -3
- package/components/table/useStickyScrollbar.js +16 -6
- package/components/table/useTree.js +12 -1
- package/components/table/useWidth.js +30 -14
- package/components/tabs/index.js +51 -29
- package/components/tabs/index.spec.js +74 -56
- package/components/tabs/index.vdt.js +16 -13
- package/components/tabs/styles.js +16 -0
- package/components/tabs/tab.js +10 -0
- package/components/tabs/tab.vdt.js +10 -6
- package/components/tabs/useActiveBar.js +11 -2
- package/components/tabs/useScroll.js +20 -4
- package/components/tag/base.js +8 -0
- package/components/tag/index.js +4 -2
- package/components/tag/index.spec.js +25 -19
- package/components/tag/index.vdt.js +15 -8
- package/components/tag/styles.js +9 -0
- package/components/timeline/item.js +4 -0
- package/components/timeline/item.vdt.js +9 -4
- package/components/timeline/styles.d.ts +2 -2
- package/components/timeline/styles.js +4 -0
- package/components/timeline/timeline.js +2 -0
- package/components/timeline/timeline.vdt.js +5 -2
- package/components/timepicker/index.js +7 -2
- package/components/timepicker/index.spec.js +368 -293
- package/components/timepicker/panelPicker.d.ts +54 -0
- package/components/timepicker/panelPicker.js +11 -2
- package/components/timepicker/panelPicker.vdt.js +24 -14
- package/components/timepicker/selectPicker.js +5 -0
- package/components/timepicker/selectPicker.vdt.js +10 -5
- package/components/timepicker/styles.js +1 -0
- package/components/timepicker/useDisabled.js +4 -2
- package/components/timepicker/useFormats.js +13 -4
- package/components/timepicker/useStep.d.ts +1 -1
- package/components/timepicker/useStep.js +17 -8
- package/components/timepicker/useValue.js +21 -16
- package/components/tip/index.js +2 -0
- package/components/tip/index.vdt.js +17 -5
- package/components/tip/styles.js +3 -0
- package/components/tooltip/content.js +28 -0
- package/components/tooltip/content.vdt.js +25 -15
- package/components/tooltip/index.js +7 -3
- package/components/tooltip/index.spec.js +572 -434
- package/components/tooltip/styles.d.ts +1 -1
- package/components/tooltip/styles.js +10 -2
- package/components/tooltip/tooltip.js +15 -2
- package/components/tooltip/useArrow.js +14 -11
- package/components/transfer/index.d.ts +1 -1
- package/components/transfer/index.js +13 -1
- package/components/transfer/index.spec.js +194 -159
- package/components/transfer/index.vdt.js +34 -16
- package/components/transfer/styles.js +10 -0
- package/components/transfer/useCheck.d.ts +1 -1
- package/components/transfer/useCheck.js +15 -1
- package/components/transfer/useFilter.d.ts +1 -1
- package/components/transfer/useFilter.js +30 -9
- package/components/transfer/useTransfer.js +26 -10
- package/components/tree/index.d.ts +3 -3
- package/components/tree/index.js +22 -4
- package/components/tree/index.spec.js +355 -285
- package/components/tree/index.vdt.js +23 -12
- package/components/tree/styles.js +16 -2
- package/components/tree/useChecked.js +26 -3
- package/components/tree/useDraggable.js +42 -12
- package/components/tree/useExpanded.js +43 -26
- package/components/tree/useFilter.js +10 -3
- package/components/tree/useNodes.d.ts +1 -1
- package/components/tree/useNodes.js +4 -0
- package/components/tree/useSelected.js +38 -21
- package/components/tree/useTransitionEvent.js +5 -3
- package/components/treeSelect/index.d.ts +27 -0
- package/components/treeSelect/index.js +36 -9
- package/components/treeSelect/index.spec.js +160 -123
- package/components/treeSelect/index.vdt.js +20 -14
- package/components/treeSelect/styles.js +1 -0
- package/components/treeSelect/useValue.js +11 -0
- package/components/types.d.ts +3 -3
- package/components/upload/ajaxUploader.d.ts +1 -1
- package/components/upload/ajaxUploader.js +17 -0
- package/components/upload/index.d.ts +4 -4
- package/components/upload/index.js +14 -0
- package/components/upload/index.spec.js +249 -142
- package/components/upload/index.vdt.js +27 -12
- package/components/upload/styles.js +30 -0
- package/components/upload/useAccept.js +10 -2
- package/components/upload/useDrag.js +7 -0
- package/components/upload/useFiles.js +145 -103
- package/components/upload/useShowImage.js +3 -0
- package/components/upload/useUpload.js +69 -47
- package/components/utils.d.ts +3 -3
- package/components/utils.js +47 -12
- package/components/virtual.js +37 -9
- package/components/wave/index.js +31 -5
- package/hooks/useDelayClose.js +6 -2
- package/hooks/useDocumentClick.js +16 -8
- package/hooks/useDraggable.d.ts +1 -1
- package/hooks/useDraggable.js +9 -0
- package/hooks/useKeyboard.d.ts +3 -3
- package/hooks/useKeyboard.js +10 -0
- package/hooks/useMouseOutsidable.js +8 -0
- package/hooks/useReceive.d.ts +1 -1
- package/hooks/useReceive.js +4 -0
- package/hooks/useRecordComponent.js +6 -0
- package/hooks/useRouter.js +18 -7
- package/hooks/useShowHideEvents.js +3 -0
- package/hooks/useState.d.ts +2 -2
- package/hooks/useState.js +6 -2
- package/i18n/en-US.js +1 -0
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +7 -0
- package/index.d.ts +2 -2
- package/index.js +3 -2
- package/package.json +1 -1
- package/styles/global.js +3 -2
- package/styles/keyframes.js +1 -0
- package/styles/theme.d.ts +1 -1
- package/styles/theme.js +7 -4
- package/styles/utils.d.ts +1 -1
- package/styles/utils.js +17 -3
- package/yarn-error.log +0 -1013
|
@@ -8,6 +8,7 @@ export function useDraggable(data) {
|
|
|
8
8
|
var originIndex;
|
|
9
9
|
var originData;
|
|
10
10
|
var draggingIndex;
|
|
11
|
+
|
|
11
12
|
function onRowDragStart(e, tableRow) {
|
|
12
13
|
draggingIndex = originIndex = tableRow.get('index');
|
|
13
14
|
var key = tableRow.get('key');
|
|
@@ -18,22 +19,28 @@ export function useDraggable(data) {
|
|
|
18
19
|
from: draggingIndex
|
|
19
20
|
});
|
|
20
21
|
}
|
|
22
|
+
|
|
21
23
|
function onRowDragOver(e, tableRow) {
|
|
22
24
|
var _context;
|
|
25
|
+
|
|
23
26
|
e.preventDefault();
|
|
24
27
|
e.stopPropagation();
|
|
25
28
|
var newIndex = tableRow.get('index');
|
|
26
|
-
if (newIndex === draggingIndex) return;
|
|
27
|
-
|
|
29
|
+
if (newIndex === draggingIndex) return; // swap data
|
|
30
|
+
|
|
28
31
|
var newData = _sliceInstanceProperty(_context = data.value).call(_context);
|
|
32
|
+
|
|
29
33
|
var item = _spliceInstanceProperty(newData).call(newData, draggingIndex, 1)[0];
|
|
34
|
+
|
|
30
35
|
_spliceInstanceProperty(newData).call(newData, newIndex, 0, item);
|
|
36
|
+
|
|
31
37
|
draggingIndex = newIndex;
|
|
32
38
|
data.set(newData);
|
|
33
39
|
}
|
|
40
|
+
|
|
34
41
|
function onRowDragEnd(e, tableRow) {
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
|
|
42
|
+
e.preventDefault(); // revert to origin data, then set to new data to trigger animation
|
|
43
|
+
|
|
37
44
|
var newData = data.value;
|
|
38
45
|
data.set(originData);
|
|
39
46
|
nextTick(function () {
|
|
@@ -46,6 +53,7 @@ export function useDraggable(data) {
|
|
|
46
53
|
});
|
|
47
54
|
});
|
|
48
55
|
}
|
|
56
|
+
|
|
49
57
|
return {
|
|
50
58
|
onRowDragStart: onRowDragStart,
|
|
51
59
|
onRowDragOver: onRowDragOver,
|
|
@@ -3,14 +3,17 @@ import { inArray } from './useChecked';
|
|
|
3
3
|
import { toggleArray } from '../utils';
|
|
4
4
|
export function useExpandable() {
|
|
5
5
|
var instance = useInstance();
|
|
6
|
+
|
|
6
7
|
function isExpanded(key) {
|
|
7
8
|
return inArray(instance.get('expandedKeys'), key);
|
|
8
9
|
}
|
|
10
|
+
|
|
9
11
|
instance.on('clickRow', function (data, index, key) {
|
|
10
12
|
if (instance.get('rowExpandable')) {
|
|
11
13
|
var _instance$get = instance.get(),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
expandedKeys = _instance$get.expandedKeys,
|
|
15
|
+
$blocks = _instance$get.$blocks;
|
|
16
|
+
|
|
14
17
|
if (!$blocks || !$blocks.expand) return;
|
|
15
18
|
instance.set('expandedKeys', toggleArray(expandedKeys, key));
|
|
16
19
|
}
|
|
@@ -3,7 +3,7 @@ import { TableColumn, TableColumnProps } from './column';
|
|
|
3
3
|
import type { TableProps, TableRowKey } from './table';
|
|
4
4
|
import { State } from '../../hooks/useState';
|
|
5
5
|
import type { useScroll } from './useScroll';
|
|
6
|
-
type ScrollPosition = 'left' | 'middle' | 'right';
|
|
6
|
+
declare type ScrollPosition = 'left' | 'middle' | 'right';
|
|
7
7
|
export declare const context: {
|
|
8
8
|
Provider: import("intact").ComponentConstructor<import("intact").Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
|
|
9
9
|
Consumer: import("intact").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
|
|
@@ -8,7 +8,7 @@ import { createContext } from '../context';
|
|
|
8
8
|
export var context = createContext();
|
|
9
9
|
export function useFixedColumns(getColumns, _ref, widthMap) {
|
|
10
10
|
var scrollRef = _ref.scrollRef,
|
|
11
|
-
|
|
11
|
+
callbacks = _ref.callbacks;
|
|
12
12
|
var instance = useInstance();
|
|
13
13
|
var scrollPosition = useState(null);
|
|
14
14
|
var hasFixed = useState(false);
|
|
@@ -32,6 +32,7 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
|
|
|
32
32
|
onUnmounted(function () {
|
|
33
33
|
window.removeEventListener('resize', throttleUpdate);
|
|
34
34
|
});
|
|
35
|
+
|
|
35
36
|
function handleFixedColumns() {
|
|
36
37
|
var columns = getColumns();
|
|
37
38
|
hasFixedLeft = false;
|
|
@@ -44,34 +45,45 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
|
|
|
44
45
|
var key = props.key;
|
|
45
46
|
offsetMap[key] = 0;
|
|
46
47
|
var fixed = props.fixed;
|
|
48
|
+
|
|
47
49
|
if (fixed === 'left') {
|
|
48
50
|
var value = 0;
|
|
49
51
|
var prevVNode = props.prevVNode;
|
|
52
|
+
|
|
50
53
|
while (prevVNode) {
|
|
51
54
|
var _props = prevVNode.props;
|
|
55
|
+
|
|
52
56
|
if (_props.fixed === 'left') {
|
|
53
57
|
if (process.env.NODE_ENV !== 'production') {
|
|
54
58
|
validateWidth(_props);
|
|
55
59
|
}
|
|
60
|
+
|
|
56
61
|
value += widthMap.value[_props.key] || parseInt(_props.width, 10) || 0;
|
|
57
62
|
}
|
|
63
|
+
|
|
58
64
|
prevVNode = _props.prevVNode;
|
|
59
65
|
}
|
|
66
|
+
|
|
60
67
|
offsetMap[key] = value;
|
|
61
68
|
hasFixedLeft = true;
|
|
62
69
|
} else if (fixed === 'right') {
|
|
63
70
|
var _value = 0;
|
|
64
71
|
var lastVNode = columns[columns.length - 1];
|
|
72
|
+
|
|
65
73
|
while (vNode !== lastVNode) {
|
|
66
74
|
var _props2 = lastVNode.props;
|
|
75
|
+
|
|
67
76
|
if (_props2.fixed === 'right') {
|
|
68
77
|
if (process.env.NODE_ENV !== 'production') {
|
|
69
78
|
validateWidth(_props2);
|
|
70
79
|
}
|
|
80
|
+
|
|
71
81
|
_value += widthMap.value[_props2.key] || parseInt(_props2.width, 10) || 0;
|
|
72
82
|
}
|
|
83
|
+
|
|
73
84
|
lastVNode = _props2.prevVNode;
|
|
74
85
|
}
|
|
86
|
+
|
|
75
87
|
offsetMap[key] = _value;
|
|
76
88
|
hasFixedRight = true;
|
|
77
89
|
}
|
|
@@ -79,20 +91,24 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
|
|
|
79
91
|
});
|
|
80
92
|
hasFixed.set(hasFixedLeft || hasFixedRight);
|
|
81
93
|
}
|
|
94
|
+
|
|
82
95
|
function setScrollPosition(scrollLeft) {
|
|
83
96
|
if (!hasFixed.value) return;
|
|
84
97
|
var scrollDom = scrollRef.value;
|
|
85
98
|
var maxScroll = scrollDom.scrollWidth - scrollDom.offsetWidth;
|
|
86
99
|
scrollPosition.set(scrollLeft === 0 ? 'left' : scrollLeft >= maxScroll ? 'right' : 'middle');
|
|
87
100
|
}
|
|
101
|
+
|
|
88
102
|
function updateScrollPositionOnResize() {
|
|
89
103
|
var scrollDom = scrollRef.value;
|
|
104
|
+
|
|
90
105
|
if (scrollDom.scrollWidth - scrollDom.offsetWidth <= 0) {
|
|
91
106
|
scrollPosition.set(null);
|
|
92
107
|
} else {
|
|
93
108
|
setScrollPosition(scrollRef.value.scrollLeft);
|
|
94
109
|
}
|
|
95
110
|
}
|
|
111
|
+
|
|
96
112
|
return {
|
|
97
113
|
scrollPosition: scrollPosition,
|
|
98
114
|
setScrollPosition: setScrollPosition,
|
|
@@ -107,18 +123,21 @@ export function useFixedColumns(getColumns, _ref, widthMap) {
|
|
|
107
123
|
}
|
|
108
124
|
export function getClassAndStyleForFixed(_ref2, offset, checkType) {
|
|
109
125
|
var _cx, _ref3;
|
|
126
|
+
|
|
110
127
|
var className = _ref2.className,
|
|
111
|
-
|
|
112
|
-
|
|
128
|
+
fixed = _ref2.fixed,
|
|
129
|
+
align = _ref2.align;
|
|
113
130
|
var extraOffset = checkType && checkType !== 'none' && fixed === 'left' ? 40 : 0;
|
|
114
131
|
return {
|
|
115
132
|
className: cx((_cx = {}, _cx[className] = !!className, _cx["k-fixed-" + fixed] = !!fixed, _cx["k-align-" + align] = !!align, _cx)),
|
|
116
133
|
style: fixed ? (_ref3 = {}, _ref3[fixed] = offset + extraOffset + "px", _ref3) : null
|
|
117
134
|
};
|
|
118
135
|
}
|
|
136
|
+
|
|
119
137
|
function validateWidth(_ref4) {
|
|
120
138
|
var width = _ref4.width,
|
|
121
|
-
|
|
139
|
+
key = _ref4.key;
|
|
140
|
+
|
|
122
141
|
if (isNullOrUndefined(width) || isString(width) && !/\d+(px)?/.test(width)) {
|
|
123
142
|
error("The width must be specified with 'px' when the column has fixed. <TableColumn key=\"" + key + "\" />");
|
|
124
143
|
}
|
|
@@ -15,54 +15,71 @@ export function useGroup() {
|
|
|
15
15
|
instance.on('$receive:group', function (group) {
|
|
16
16
|
return filteredGroup.set(group);
|
|
17
17
|
});
|
|
18
|
+
|
|
18
19
|
function onSelect(value, groupValue, onChange) {
|
|
19
20
|
var _instance$get = instance.get(),
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
multiple = _instance$get.multiple,
|
|
22
|
+
key = _instance$get.key;
|
|
23
|
+
|
|
22
24
|
if (multiple) {
|
|
23
25
|
value = toggleArray(groupValue, value);
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
onChange(key, value);
|
|
26
29
|
}
|
|
30
|
+
|
|
27
31
|
function isChecked(value, groupValue) {
|
|
28
32
|
var _instance$get2 = instance.get(),
|
|
29
|
-
|
|
33
|
+
multiple = _instance$get2.multiple;
|
|
34
|
+
|
|
30
35
|
if (multiple) {
|
|
31
36
|
return groupValue && _includesInstanceProperty(groupValue).call(groupValue, value);
|
|
32
37
|
}
|
|
38
|
+
|
|
33
39
|
return groupValue === value;
|
|
34
40
|
}
|
|
41
|
+
|
|
35
42
|
function getGroupText(groupValue) {
|
|
36
43
|
var _instance$get3 = instance.get(),
|
|
37
|
-
|
|
38
|
-
|
|
44
|
+
multiple = _instance$get3.multiple,
|
|
45
|
+
group = _instance$get3.group;
|
|
46
|
+
|
|
39
47
|
if (isNullOrUndefined(groupValue)) return null;
|
|
48
|
+
|
|
40
49
|
if (!multiple) {
|
|
41
50
|
groupValue = [groupValue];
|
|
42
51
|
}
|
|
52
|
+
|
|
43
53
|
if (group) {
|
|
44
54
|
var _context;
|
|
55
|
+
|
|
45
56
|
var ret = _mapInstanceProperty(_context = _filterInstanceProperty(group).call(group, function (item) {
|
|
46
57
|
return _includesInstanceProperty(groupValue).call(groupValue, item.value);
|
|
47
58
|
})).call(_context, function (item) {
|
|
48
59
|
return item.label;
|
|
49
60
|
}).join(', ');
|
|
61
|
+
|
|
50
62
|
if (ret) {
|
|
51
63
|
return "(" + ret + ")";
|
|
52
64
|
}
|
|
53
65
|
}
|
|
66
|
+
|
|
54
67
|
return null;
|
|
55
68
|
}
|
|
69
|
+
|
|
56
70
|
watchState(keywords, function (v) {
|
|
57
71
|
var _instance$get4 = instance.get(),
|
|
58
|
-
|
|
59
|
-
|
|
72
|
+
_instance$get4$group = _instance$get4.group,
|
|
73
|
+
group = _instance$get4$group === void 0 ? [] : _instance$get4$group;
|
|
74
|
+
|
|
60
75
|
v = _trimInstanceProperty(v).call(v);
|
|
76
|
+
|
|
61
77
|
if (!v) {
|
|
62
78
|
filteredGroup.set(group);
|
|
63
79
|
} else {
|
|
64
80
|
filteredGroup.set(_filterInstanceProperty(group).call(group, function (item) {
|
|
65
81
|
var _context2, _context3;
|
|
82
|
+
|
|
66
83
|
return _includesInstanceProperty(_context2 = String(item.label)).call(_context2, v) || _includesInstanceProperty(_context3 = String(item.value)).call(_context3, v);
|
|
67
84
|
}));
|
|
68
85
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Props } from 'intact-vue-next';
|
|
2
2
|
import type { TableColumnProps } from './column';
|
|
3
3
|
import { State } from '../../hooks/useState';
|
|
4
|
-
export type TableMerge<T = any, CheckType = 'checkbox'> = (row: T, column: CheckType extends 'none' ? Props<TableColumnProps> : Props<TableColumnProps> | null, rowIndex: number, columnIndex: number) => TableMergeConfig | undefined;
|
|
5
|
-
export type TableMergeConfig = {
|
|
4
|
+
export declare type TableMerge<T = any, CheckType = 'checkbox'> = (row: T, column: CheckType extends 'none' ? Props<TableColumnProps> : Props<TableColumnProps> | null, rowIndex: number, columnIndex: number) => TableMergeConfig | undefined;
|
|
5
|
+
export declare type TableMergeConfig = {
|
|
6
6
|
colspan?: number;
|
|
7
7
|
rowspan?: number;
|
|
8
8
|
};
|
|
9
|
-
export type TableGridItem = {
|
|
9
|
+
export declare type TableGridItem = {
|
|
10
10
|
render: boolean;
|
|
11
11
|
spans: TableMergeConfig | undefined;
|
|
12
12
|
};
|
|
13
|
-
export type TableGrid = TableGridItem[][];
|
|
13
|
+
export declare type TableGrid = TableGridItem[][];
|
|
14
14
|
export declare function useMerge(getCols: () => Props<TableColumnProps>[], data: State<unknown[] | undefined>): {
|
|
15
15
|
getGrid: () => TableGrid;
|
|
16
16
|
};
|
|
@@ -3,29 +3,36 @@ import { watchState } from '../../hooks/useState';
|
|
|
3
3
|
export function useMerge(getCols, data) {
|
|
4
4
|
var instance = useInstance();
|
|
5
5
|
var grid = [];
|
|
6
|
+
|
|
6
7
|
function handleSpans() {
|
|
7
8
|
grid = [];
|
|
9
|
+
|
|
8
10
|
var _instance$get = instance.get(),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
merge = _instance$get.merge,
|
|
12
|
+
checkType = _instance$get.checkType;
|
|
13
|
+
|
|
11
14
|
if (!data.value || !data.value.length || !merge) return;
|
|
12
15
|
var cols = getCols();
|
|
13
16
|
data.value.forEach(function (data, rowIndex) {
|
|
14
17
|
var currentRow = [];
|
|
15
18
|
grid.push(currentRow);
|
|
16
19
|
var columnIndexOffset = 0;
|
|
20
|
+
|
|
17
21
|
if (checkType !== 'none') {
|
|
18
22
|
handleGridItem(currentRow, merge, data, null, rowIndex, 0);
|
|
19
23
|
columnIndexOffset = 1;
|
|
20
24
|
}
|
|
25
|
+
|
|
21
26
|
cols.forEach(function (props, columnIndex) {
|
|
22
27
|
handleGridItem(currentRow, merge, data, props, rowIndex, columnIndex + columnIndexOffset);
|
|
23
28
|
});
|
|
24
29
|
});
|
|
25
30
|
}
|
|
31
|
+
|
|
26
32
|
function handleGridItem(currentRow, merge, data, column, rowIndex, columnIndex) {
|
|
27
33
|
var prevCell = currentRow[columnIndex - 1];
|
|
28
34
|
var tmp;
|
|
35
|
+
|
|
29
36
|
if (prevCell && (tmp = prevCell.spans) && tmp.colspan > 1) {
|
|
30
37
|
currentRow.push({
|
|
31
38
|
render: false,
|
|
@@ -36,9 +43,11 @@ export function useMerge(getCols, data) {
|
|
|
36
43
|
});
|
|
37
44
|
return;
|
|
38
45
|
}
|
|
46
|
+
|
|
39
47
|
if (rowIndex > 0) {
|
|
40
48
|
var prevRow = grid[rowIndex - 1];
|
|
41
49
|
var aboveCell = prevRow[columnIndex];
|
|
50
|
+
|
|
42
51
|
if (aboveCell && (tmp = aboveCell.spans) && tmp.rowspan > 1) {
|
|
43
52
|
currentRow.push({
|
|
44
53
|
render: false,
|
|
@@ -50,14 +59,17 @@ export function useMerge(getCols, data) {
|
|
|
50
59
|
return;
|
|
51
60
|
}
|
|
52
61
|
}
|
|
62
|
+
|
|
53
63
|
currentRow.push({
|
|
54
64
|
render: true,
|
|
55
65
|
spans: merge(data, column, rowIndex, columnIndex)
|
|
56
66
|
});
|
|
57
67
|
}
|
|
68
|
+
|
|
58
69
|
function getGrid() {
|
|
59
70
|
return grid;
|
|
60
71
|
}
|
|
72
|
+
|
|
61
73
|
instance.on('$receive:children', handleSpans);
|
|
62
74
|
watchState(data, handleSpans);
|
|
63
75
|
return {
|
|
@@ -12,51 +12,65 @@ export function usePagination() {
|
|
|
12
12
|
var value = useState(defaultPagination.value);
|
|
13
13
|
var limit = useState(defaultPagination.limit);
|
|
14
14
|
var paginationRef = createRef(); // for unit test
|
|
15
|
+
|
|
15
16
|
useReceive(['data', 'pagination'], function () {
|
|
16
17
|
handleData();
|
|
17
18
|
});
|
|
19
|
+
|
|
18
20
|
function handleData() {
|
|
19
21
|
var _instance$get = instance.get(),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
_data = _instance$get.data,
|
|
23
|
+
pagination = _instance$get.pagination;
|
|
24
|
+
|
|
22
25
|
if (!_data) {
|
|
23
26
|
data.set(undefined);
|
|
24
27
|
return;
|
|
25
28
|
}
|
|
29
|
+
|
|
26
30
|
if (!pagination) {
|
|
27
31
|
data.set(_data);
|
|
28
32
|
return;
|
|
29
33
|
}
|
|
34
|
+
|
|
30
35
|
if (isObject(pagination)) {
|
|
31
36
|
if (pagination.value) {
|
|
32
37
|
value.set(pagination.value);
|
|
33
38
|
}
|
|
39
|
+
|
|
34
40
|
if (pagination.limit) {
|
|
35
41
|
limit.set(pagination.limit);
|
|
36
42
|
}
|
|
37
43
|
}
|
|
44
|
+
|
|
38
45
|
updateDataByPage();
|
|
39
46
|
}
|
|
47
|
+
|
|
40
48
|
function updateDataByPage() {
|
|
41
49
|
var _instance$get2 = instance.get(),
|
|
42
|
-
|
|
50
|
+
_data = _instance$get2.data;
|
|
51
|
+
|
|
43
52
|
var index = (value.value - 1) * limit.value;
|
|
44
53
|
data.set(_sliceInstanceProperty(_data).call(_data, index, index + limit.value));
|
|
45
54
|
}
|
|
55
|
+
|
|
46
56
|
function onChange(data) {
|
|
47
57
|
var _instance$get3 = instance.get(),
|
|
48
|
-
|
|
58
|
+
pagination = _instance$get3.pagination;
|
|
59
|
+
|
|
49
60
|
value.set(data.value);
|
|
50
61
|
limit.set(data.limit);
|
|
51
62
|
updateDataByPage();
|
|
63
|
+
|
|
52
64
|
if (isObject(pagination)) {
|
|
53
65
|
instance.set('pagination', _extends({}, pagination, {
|
|
54
66
|
value: value.value,
|
|
55
67
|
limit: limit.value
|
|
56
68
|
}));
|
|
57
69
|
}
|
|
70
|
+
|
|
58
71
|
instance.trigger('changePage', data);
|
|
59
72
|
}
|
|
73
|
+
|
|
60
74
|
return {
|
|
61
75
|
data: data,
|
|
62
76
|
value: value,
|
|
@@ -12,21 +12,26 @@ export function useResizable(scrollRef, tableRef, tableWidth, widthMap, storeWid
|
|
|
12
12
|
var currentVNode;
|
|
13
13
|
var currentTh;
|
|
14
14
|
var minWidth;
|
|
15
|
+
|
|
15
16
|
function onStart(e) {
|
|
16
17
|
containerWidth = scrollRef.value.clientWidth;
|
|
17
|
-
x = e.clientX;
|
|
18
|
-
|
|
18
|
+
x = e.clientX; // find the previous column but exclude the hidden columns, #467
|
|
19
|
+
|
|
19
20
|
prevVNode = currentVNode = e._vNode;
|
|
20
21
|
prevTh;
|
|
22
|
+
|
|
21
23
|
do {
|
|
22
24
|
prevVNode = prevVNode.props.prevVNode;
|
|
23
25
|
prevTh = findDomFromVNode(prevVNode, true);
|
|
24
26
|
} while (window.getComputedStyle(prevTh).display === 'none');
|
|
27
|
+
|
|
25
28
|
currentTh = findDomFromVNode(currentVNode, true);
|
|
26
29
|
minWidth = prevVNode.props.minWidth || instance.get('minColWidth');
|
|
27
30
|
}
|
|
31
|
+
|
|
28
32
|
function onMove(e) {
|
|
29
33
|
var _map;
|
|
34
|
+
|
|
30
35
|
var delX = e.clientX - x;
|
|
31
36
|
if (delX === 0) return;
|
|
32
37
|
var newPrevWidth = prevTh.offsetWidth + delX;
|
|
@@ -37,13 +42,16 @@ export function useResizable(scrollRef, tableRef, tableWidth, widthMap, storeWid
|
|
|
37
42
|
var prevKey = prevVNode.props.key;
|
|
38
43
|
x = e.clientX;
|
|
39
44
|
var map = (_map = {}, _map[prevKey] = newPrevWidth, _map);
|
|
45
|
+
|
|
40
46
|
if (containerWidth > newTableWidth) {
|
|
41
47
|
map[currentKey] = newCurrentWidth;
|
|
42
48
|
} else {
|
|
43
49
|
tableWidth.set(newTableWidth);
|
|
44
50
|
}
|
|
51
|
+
|
|
45
52
|
widthMap.set(_extends({}, widthMap.value, map));
|
|
46
53
|
}
|
|
54
|
+
|
|
47
55
|
return useDraggable({
|
|
48
56
|
onStart: onStart,
|
|
49
57
|
onMove: onMove,
|
|
@@ -6,13 +6,15 @@ export function useRestRowStatus(getAllKeys) {
|
|
|
6
6
|
var instance = useInstance();
|
|
7
7
|
var allUnmountedRows = [];
|
|
8
8
|
var willUnmounted = false;
|
|
9
|
+
|
|
9
10
|
function onRowBeforeUnmount(key) {
|
|
10
|
-
if (willUnmounted || instance.get('keepStatus')) return;
|
|
11
|
-
|
|
11
|
+
if (willUnmounted || instance.get('keepStatus')) return; // maybe the row is only removed by shrinking, i.e. tree table
|
|
12
|
+
|
|
12
13
|
var allKeys = getAllKeys();
|
|
13
14
|
if (_includesInstanceProperty(allKeys).call(allKeys, key)) return;
|
|
14
15
|
allUnmountedRows.push(key);
|
|
15
16
|
}
|
|
17
|
+
|
|
16
18
|
function reset() {
|
|
17
19
|
if (allUnmountedRows.length) {
|
|
18
20
|
omit('checkedKeys', allUnmountedRows);
|
|
@@ -22,6 +24,7 @@ export function useRestRowStatus(getAllKeys) {
|
|
|
22
24
|
allUnmountedRows = [];
|
|
23
25
|
}
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
function omit(type, keys) {
|
|
26
29
|
var originKeys = instance.get(type);
|
|
27
30
|
if (!originKeys) return;
|
|
@@ -31,6 +34,7 @@ export function useRestRowStatus(getAllKeys) {
|
|
|
31
34
|
});
|
|
32
35
|
instance.set(type, originKeys);
|
|
33
36
|
}
|
|
37
|
+
|
|
34
38
|
onBeforeUnmount(function () {
|
|
35
39
|
return willUnmounted = true;
|
|
36
40
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RefObject } from 'intact-vue-next';
|
|
2
|
-
export type ScrollCallback = (scrollLeft: number) => void;
|
|
2
|
+
export declare type ScrollCallback = (scrollLeft: number) => void;
|
|
3
3
|
export declare function useScroll(): {
|
|
4
4
|
callbacks: ScrollCallback[];
|
|
5
5
|
scrollRef: RefObject<HTMLElement>;
|
|
@@ -3,8 +3,10 @@ export function useScroll() {
|
|
|
3
3
|
var callbacks = [];
|
|
4
4
|
var scrollRef = createRef();
|
|
5
5
|
var scrollLeft = 0;
|
|
6
|
+
|
|
6
7
|
function onScroll() {
|
|
7
8
|
var newScrollLeft = scrollRef.value.scrollLeft;
|
|
9
|
+
|
|
8
10
|
if (scrollLeft !== newScrollLeft) {
|
|
9
11
|
scrollLeft = newScrollLeft;
|
|
10
12
|
callbacks.forEach(function (fn) {
|
|
@@ -12,6 +14,7 @@ export function useScroll() {
|
|
|
12
14
|
});
|
|
13
15
|
}
|
|
14
16
|
}
|
|
17
|
+
|
|
15
18
|
onMounted(function () {
|
|
16
19
|
scrollRef.value.addEventListener('scroll', onScroll, {
|
|
17
20
|
passive: true
|
|
@@ -3,13 +3,16 @@ import { inArray } from './useChecked';
|
|
|
3
3
|
import { toggleArray } from '../utils';
|
|
4
4
|
export function useSelected() {
|
|
5
5
|
var instance = useInstance();
|
|
6
|
+
|
|
6
7
|
function isSelected(key) {
|
|
7
8
|
return inArray(instance.get('selectedKeys'), key);
|
|
8
9
|
}
|
|
10
|
+
|
|
9
11
|
instance.on('clickRow', function (data, index, key) {
|
|
10
12
|
var _instance$get = instance.get(),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
rowSelectable = _instance$get.rowSelectable,
|
|
14
|
+
selectedKeys = _instance$get.selectedKeys;
|
|
15
|
+
|
|
13
16
|
if (rowSelectable === 'multiple') {
|
|
14
17
|
instance.set('selectedKeys', toggleArray(selectedKeys, key));
|
|
15
18
|
} else if (rowSelectable) {
|
|
@@ -3,16 +3,20 @@ import { useInstance } from 'intact-vue-next';
|
|
|
3
3
|
import { createContext } from '../context';
|
|
4
4
|
export var context = createContext();
|
|
5
5
|
export function useSortable() {
|
|
6
|
-
var instance = useInstance();
|
|
7
|
-
// if the same column has been clicked three times consecutively,
|
|
6
|
+
var instance = useInstance(); // if the same column has been clicked three times consecutively,
|
|
8
7
|
// then let the third click to reset the sort
|
|
8
|
+
|
|
9
9
|
var count = 0;
|
|
10
|
+
|
|
10
11
|
function onChange(key, event) {
|
|
11
12
|
// ignore when click group dropdown menu
|
|
12
13
|
if (event._ignoreSortable) return;
|
|
14
|
+
|
|
13
15
|
var sort = _extends({}, instance.get('sort'));
|
|
16
|
+
|
|
14
17
|
if (sort.key === key) {
|
|
15
18
|
count++;
|
|
19
|
+
|
|
16
20
|
if (count === 3) {
|
|
17
21
|
sort = {};
|
|
18
22
|
} else {
|
|
@@ -23,8 +27,10 @@ export function useSortable() {
|
|
|
23
27
|
sort.key = key;
|
|
24
28
|
if (!sort.type) sort.type = 'desc';
|
|
25
29
|
}
|
|
30
|
+
|
|
26
31
|
instance.set('sort', sort);
|
|
27
32
|
}
|
|
33
|
+
|
|
28
34
|
return {
|
|
29
35
|
onChange: onChange
|
|
30
36
|
};
|
|
@@ -6,16 +6,20 @@ export function useStickyHeader(callbacks) {
|
|
|
6
6
|
var elementRef = createRef();
|
|
7
7
|
var headRef = createRef();
|
|
8
8
|
var stickHeader = useState(null);
|
|
9
|
+
|
|
9
10
|
function excludeStickHeader(_ref) {
|
|
10
11
|
var offsetTop = _ref.offsetTop;
|
|
12
|
+
|
|
11
13
|
var _elementRef$value$get = elementRef.value.getBoundingClientRect(),
|
|
12
|
-
|
|
14
|
+
bottom = _elementRef$value$get.bottom;
|
|
15
|
+
|
|
13
16
|
return bottom <= offsetTop;
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
instance.on('$receive:stickHeader', function (v) {
|
|
16
20
|
stickHeader.set(v === true ? 0 : isStringOrNumber(v) ? +v : null);
|
|
17
|
-
});
|
|
18
|
-
|
|
21
|
+
}); // when the scroll element scroll horizontally, scroll the sticky header too
|
|
22
|
+
|
|
19
23
|
callbacks.push(function (scrollLeft) {
|
|
20
24
|
if (isNull(stickHeader.value)) return;
|
|
21
25
|
var affixHeadWrapper = headRef.value.parentElement;
|