@king-design/vue 2.1.3 → 2.1.4
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 +0 -5
- package/components/affix/index.spec.js +84 -108
- package/components/affix/index.vdt.js +5 -8
- package/components/affix/useStyle.js +8 -19
- package/components/badge/index.js +0 -2
- package/components/badge/index.vdt.js +5 -9
- package/components/badge/styles.js +0 -2
- package/components/breadcrumb/index.js +0 -4
- package/components/breadcrumb/index.spec.js +6 -6
- package/components/breadcrumb/index.vdt.js +5 -14
- package/components/breadcrumb/item.js +0 -8
- package/components/breadcrumb/item.vdt.js +3 -6
- package/components/breadcrumb/styles.js +0 -3
- package/components/button/dynamicButton.d.ts +1 -1
- package/components/button/dynamicButton.js +2 -5
- package/components/button/group.js +2 -10
- package/components/button/group.vdt.js +4 -7
- package/components/button/index.js +3 -27
- package/components/button/index.spec.js +74 -96
- package/components/button/index.vdt.js +19 -29
- package/components/button/styles.d.ts +2 -2
- package/components/button/styles.js +4 -48
- package/components/card/column.js +0 -2
- package/components/card/column.vdt.js +5 -10
- package/components/card/index.js +0 -4
- package/components/card/index.vdt.js +4 -16
- package/components/carousel/index.js +1 -19
- package/components/carousel/index.spec.js +127 -163
- package/components/carousel/index.vdt.js +12 -15
- package/components/carousel/item.js +0 -2
- package/components/carousel/item.vdt.js +4 -7
- package/components/carousel/styles.js +0 -1
- package/components/carousel/useAutoplay.js +0 -4
- package/components/carousel/useItems.js +4 -20
- package/components/carousel/useSlide.js +57 -89
- package/components/cascader/index.js +3 -18
- package/components/cascader/index.spec.js +365 -379
- package/components/cascader/index.vdt.js +14 -31
- package/components/cascader/styles.js +0 -6
- package/components/cascader/useFields.js +1 -4
- package/components/cascader/useFilterable.js +2 -19
- package/components/cascader/useLabel.js +1 -9
- package/components/cascader/useLoad.js +22 -35
- package/components/cascader/useValue.d.ts +2 -2
- package/components/cascader/useValue.js +6 -27
- package/components/checkbox/index.js +5 -27
- package/components/checkbox/index.spec.js +129 -171
- package/components/checkbox/index.vdt.js +12 -16
- package/components/checkbox/styles.js +0 -10
- package/components/code/crossDomain.js +2 -9
- package/components/code/index.js +0 -9
- package/components/code/index.spec.js +46 -55
- package/components/code/index.vdt.js +6 -14
- package/components/code/styles.js +0 -1
- package/components/code/useEditor.js +5 -10
- package/components/collapse/index.d.ts +1 -1
- package/components/collapse/index.js +3 -14
- package/components/collapse/index.spec.js +47 -60
- package/components/collapse/index.vdt.js +4 -12
- package/components/collapse/item.js +0 -10
- package/components/collapse/item.vdt.js +7 -14
- package/components/collapse/styles.js +0 -1
- package/components/colorpicker/drag.js +0 -5
- package/components/colorpicker/index.js +0 -4
- package/components/colorpicker/index.spec.js +211 -259
- package/components/colorpicker/index.vdt.js +8 -11
- package/components/colorpicker/panel.js +0 -5
- package/components/colorpicker/panel.vdt.js +21 -26
- package/components/colorpicker/styles.js +2 -13
- package/components/colorpicker/useDrag.js +22 -26
- package/components/colorpicker/useInput.js +0 -16
- package/components/colorpicker/usePointer.js +15 -18
- package/components/colorpicker/useValue.js +2 -7
- package/components/context.d.ts +2 -2
- package/components/context.js +2 -19
- package/components/datepicker/basepicker.d.ts +8 -8
- package/components/datepicker/basepicker.js +20 -90
- package/components/datepicker/calendar.js +0 -11
- package/components/datepicker/calendar.vdt.js +11 -14
- package/components/datepicker/constants.js +0 -1
- package/components/datepicker/dayjs.js +1 -1
- package/components/datepicker/helpers.js +3 -15
- package/components/datepicker/index.js +6 -32
- package/components/datepicker/index.spec.js +1141 -1448
- package/components/datepicker/index.vdt.js +20 -34
- package/components/datepicker/shortcuts.d.ts +1 -1
- package/components/datepicker/shortcuts.js +0 -4
- package/components/datepicker/styles.js +0 -8
- package/components/datepicker/time.d.ts +1 -1
- package/components/datepicker/time.js +3 -23
- package/components/datepicker/time.vdt.js +4 -5
- package/components/datepicker/useDays.js +2 -9
- package/components/datepicker/useDisabled.js +6 -23
- package/components/datepicker/useFocusDate.js +0 -2
- package/components/datepicker/useFormats.js +6 -15
- package/components/datepicker/useKeyboards.js +20 -36
- package/components/datepicker/useMonths.js +0 -6
- package/components/datepicker/usePanel.js +0 -10
- package/components/datepicker/useShowDate.js +10 -37
- package/components/datepicker/useStatus.js +3 -15
- package/components/datepicker/useValue.js +22 -35
- package/components/datepicker/useYears.js +4 -15
- package/components/diagram/diagram.js +17 -43
- package/components/diagram/diagram.vdt.js +2 -5
- 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 +369 -495
- package/components/diagram/layouts/circle.js +6 -14
- package/components/diagram/layouts/flow.js +7 -15
- package/components/diagram/layouts/layout.js +6 -28
- package/components/diagram/layouts/organic.js +3 -11
- package/components/diagram/layouts/partition.js +4 -12
- package/components/diagram/layouts/radial.js +6 -18
- package/components/diagram/layouts/stack.js +6 -14
- package/components/diagram/layouts/tree.js +11 -21
- package/components/diagram/mxgraph/handler/mxConnectionHandler.js +15 -22
- package/components/diagram/mxgraph/handler/mxConstraintHandler.js +4 -4
- package/components/diagram/mxgraph/handler/mxEdgeHandler.js +11 -15
- package/components/diagram/mxgraph/handler/mxGraphHandler.js +6 -9
- package/components/diagram/mxgraph/handler/mxRubberband.js +4 -4
- package/components/diagram/mxgraph/handler/mxVertexHandler.js +7 -10
- package/components/diagram/mxgraph/index.js +0 -2
- package/components/diagram/mxgraph/mx.js +3 -3
- package/components/diagram/mxgraph/shape/mxCloud.js +2 -2
- package/components/diagram/mxgraph/shape/mxCylinder.js +4 -9
- 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 +6 -12
- package/components/diagram/mxgraph/shape/mxShape.js +0 -1
- 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 +5 -7
- package/components/diagram/mxgraph/view/mxCellEditor.js +16 -29
- package/components/diagram/mxgraph/view/mxCellRenderer.js +0 -2
- package/components/diagram/mxgraph/view/mxGraph.js +14 -32
- package/components/diagram/shapes/base.d.ts +1 -1
- package/components/diagram/shapes/base.js +9 -39
- package/components/diagram/shapes/callout.js +10 -23
- package/components/diagram/shapes/circle.js +3 -10
- package/components/diagram/shapes/document.js +5 -16
- package/components/diagram/shapes/ellipse.js +0 -5
- package/components/diagram/shapes/generateShapes.d.ts +1 -1
- package/components/diagram/shapes/generateShapes.js +0 -9
- package/components/diagram/shapes/hexagon.js +9 -26
- package/components/diagram/shapes/image.js +1 -9
- package/components/diagram/shapes/line.d.ts +2 -2
- package/components/diagram/shapes/line.js +13 -48
- package/components/diagram/shapes/parallelogram.js +9 -26
- package/components/diagram/shapes/rectangle.js +1 -9
- package/components/diagram/shapes/shape.js +6 -35
- package/components/diagram/shapes/square.js +3 -11
- package/components/diagram/shapes/text.js +0 -5
- package/components/diagram/styles.js +0 -1
- package/components/dialog/alert.vdt.js +9 -19
- package/components/dialog/base.js +1 -29
- package/components/dialog/base.vdt.js +14 -29
- package/components/dialog/index.js +6 -31
- package/components/dialog/index.spec.js +406 -554
- package/components/dialog/staticMethods.d.ts +1 -1
- package/components/dialog/staticMethods.js +2 -13
- package/components/dialog/styles.js +0 -11
- package/components/dialog/useDraggable.js +0 -6
- package/components/dialog/useEscClosable.js +4 -12
- package/components/dialog/useFixBody.d.ts +1 -1
- package/components/dialog/useFixBody.js +0 -11
- package/components/dialog/usePosition.js +0 -5
- package/components/drawer/index.js +0 -5
- package/components/drawer/index.spec.js +126 -168
- package/components/drawer/index.vdt.js +3 -9
- package/components/drawer/styles.d.ts +2 -2
- package/components/drawer/styles.js +0 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +33 -89
- package/components/dropdown/index.js +2 -6
- package/components/dropdown/index.spec.js +388 -496
- package/components/dropdown/item.js +4 -25
- package/components/dropdown/item.vdt.js +5 -8
- package/components/dropdown/menu.js +14 -29
- package/components/dropdown/menu.vdt.js +5 -13
- package/components/dropdown/styles.js +0 -9
- package/components/dropdown/useKeyboard.d.ts +2 -2
- package/components/dropdown/useKeyboard.js +8 -30
- package/components/dropdown/usePosition.d.ts +2 -1
- package/components/dropdown/usePosition.js +24 -22
- package/components/dropdown/useTransition.js +0 -8
- package/components/editable/index.d.ts +1 -1
- package/components/editable/index.js +4 -28
- package/components/editable/index.spec.js +152 -189
- package/components/editable/index.vdt.js +8 -11
- package/components/editable/styles.js +0 -1
- package/components/form/form.js +0 -18
- package/components/form/form.vdt.js +4 -7
- package/components/form/index.spec.js +1057 -1280
- package/components/form/item.d.ts +1 -1
- package/components/form/item.js +0 -12
- package/components/form/item.vdt.js +17 -31
- package/components/form/methods.d.ts +5 -5
- package/components/form/methods.js +2 -12
- package/components/form/styles.js +0 -8
- package/components/form/useDirty.js +2 -7
- package/components/form/useError.js +2 -10
- package/components/form/useValidate.d.ts +1 -1
- package/components/form/useValidate.js +8 -24
- package/components/grid/col.d.ts +3 -3
- package/components/grid/col.js +0 -7
- package/components/grid/col.vdt.js +8 -13
- package/components/grid/constants.d.ts +6 -6
- package/components/grid/row.js +0 -5
- package/components/grid/row.vdt.js +5 -8
- package/components/grid/styles.js +0 -7
- package/components/grid/useBreakpoints.js +0 -5
- package/components/grid/useGutter.js +5 -25
- package/components/icon/index.js +0 -10
- package/components/icon/index.vdt.js +7 -13
- package/components/icon/styles.js +0 -1
- package/components/input/index.d.ts +3 -3
- package/components/input/index.js +0 -14
- package/components/input/index.spec.js +185 -239
- package/components/input/index.vdt.js +39 -49
- package/components/input/search.js +0 -20
- package/components/input/search.vdt.js +6 -9
- package/components/input/styles.js +0 -26
- package/components/input/useAutoRows.js +6 -18
- package/components/input/useAutoWidth.js +0 -5
- package/components/input/useFrozen.js +0 -6
- package/components/input/useShowPassword.js +2 -5
- package/components/layout/aside.js +5 -17
- package/components/layout/aside.vdt.js +5 -9
- package/components/layout/body.js +5 -17
- package/components/layout/footer.js +1 -7
- package/components/layout/header.js +7 -21
- package/components/layout/layout.js +9 -24
- package/components/layout/styles.js +2 -13
- package/components/layout/template.vdt.js +2 -4
- package/components/layout/useParse.js +0 -7
- package/components/menu/index.spec.js +189 -242
- package/components/menu/item.js +3 -16
- package/components/menu/item.vdt.js +20 -32
- package/components/menu/menu.js +2 -11
- package/components/menu/menu.vdt.js +6 -12
- package/components/menu/styles.js +0 -18
- package/components/menu/useDropdown.js +4 -9
- package/components/menu/useExpanded.js +0 -14
- package/components/menu/useHighlight.js +26 -36
- package/components/message/index.spec.js +58 -73
- package/components/message/message.js +0 -19
- package/components/message/message.vdt.js +5 -8
- package/components/message/messages.js +0 -12
- package/components/message/messages.vdt.js +0 -1
- package/components/message/styles.js +0 -9
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +10 -46
- package/components/pagination/index.spec.js +133 -173
- package/components/pagination/index.vdt.js +14 -34
- package/components/pagination/styles.js +0 -4
- package/components/portal.d.ts +1 -1
- package/components/portal.js +2 -29
- package/components/position.d.ts +12 -12
- package/components/position.js +32 -88
- package/components/progress/index.d.ts +6 -6
- package/components/progress/index.js +0 -12
- package/components/progress/index.spec.js +143 -191
- package/components/progress/index.vdt.js +8 -11
- package/components/progress/styles.js +0 -6
- package/components/progress/useColor.js +2 -7
- package/components/progress/useStatus.d.ts +1 -1
- package/components/progress/useStatus.js +2 -5
- package/components/radio/index.js +3 -18
- package/components/radio/index.spec.js +111 -149
- package/components/radio/index.vdt.js +14 -17
- package/components/radio/styles.js +0 -10
- package/components/rate/index.js +0 -7
- package/components/rate/index.spec.js +64 -79
- package/components/rate/index.vdt.js +8 -21
- package/components/rate/styles.js +0 -3
- package/components/rate/useActiveValue.js +2 -7
- package/components/scrollSelect/index.d.ts +2 -2
- package/components/scrollSelect/index.js +0 -7
- package/components/scrollSelect/index.spec.js +100 -131
- package/components/scrollSelect/index.vdt.js +6 -11
- package/components/scrollSelect/styles.js +0 -7
- package/components/scrollSelect/useList.js +3 -17
- package/components/scrollSelect/useMouseEvents.js +31 -49
- package/components/scrollSelect/useTranslate.js +1 -11
- package/components/select/base.js +5 -35
- package/components/select/base.vdt.js +23 -38
- package/components/select/group.js +0 -5
- package/components/select/group.vdt.js +4 -10
- package/components/select/index.spec.js +361 -452
- package/components/select/menu.js +0 -5
- package/components/select/menu.vdt.js +18 -33
- package/components/select/option.js +2 -16
- package/components/select/option.vdt.js +7 -14
- package/components/select/select.js +3 -20
- package/components/select/select.vdt.js +9 -17
- package/components/select/styles.js +0 -33
- package/components/select/useBaseLabel.d.ts +1 -1
- package/components/select/useBaseLabel.js +4 -17
- package/components/select/useCard.js +0 -4
- package/components/select/useEqualWidth.js +0 -1
- package/components/select/useFilterable.js +5 -27
- package/components/select/useFocusout.d.ts +1 -1
- package/components/select/useFocusout.js +1 -9
- package/components/select/useInput.js +6 -10
- package/components/select/useLabel.js +3 -13
- package/components/select/useSearchable.js +0 -10
- package/components/skeleton/item.d.ts +1 -1
- package/components/skeleton/item.js +0 -4
- package/components/skeleton/item.vdt.js +1 -6
- package/components/skeleton/skeleton.js +0 -4
- package/components/skeleton/skeleton.vdt.js +6 -12
- package/components/skeleton/style.d.ts +1 -1
- package/components/skeleton/style.js +0 -1
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +0 -7
- package/components/slider/index.spec.js +467 -585
- package/components/slider/index.vdt.js +32 -45
- package/components/slider/styles.js +0 -14
- package/components/slider/useClick.js +2 -11
- package/components/slider/useDraggable.js +23 -34
- package/components/slider/useKeyboard.js +7 -18
- package/components/slider/useMarks.d.ts +5 -5
- package/components/slider/useMarks.js +5 -13
- package/components/slider/usePoints.d.ts +2 -2
- package/components/slider/usePoints.js +7 -21
- package/components/slider/useStyles.d.ts +1 -1
- package/components/slider/useStyles.js +5 -10
- package/components/slider/useTooltip.js +2 -10
- package/components/slider/useValue.d.ts +1 -1
- package/components/slider/useValue.js +7 -22
- package/components/spin/index.js +0 -4
- package/components/spin/index.vdt.js +4 -11
- package/components/spin/styles.js +0 -2
- package/components/spinner/index.d.ts +4 -4
- package/components/spinner/index.js +9 -24
- package/components/spinner/index.spec.js +359 -460
- package/components/spinner/index.vdt.js +10 -13
- package/components/spinner/styles.js +0 -3
- package/components/spinner/useChange.js +4 -16
- package/components/spinner/useFormatter.js +6 -16
- package/components/spinner/useStep.d.ts +3 -3
- package/components/spinner/useStep.js +2 -20
- package/components/spinner/useValue.js +11 -26
- package/components/split/index.js +0 -7
- package/components/split/index.spec.js +223 -267
- package/components/split/index.vdt.js +8 -17
- package/components/split/style.d.ts +1 -1
- package/components/split/style.js +0 -8
- package/components/split/useDraggable.js +11 -35
- package/components/split/useSize.js +2 -5
- package/components/steps/context.d.ts +2 -2
- package/components/steps/index.js +2 -10
- package/components/steps/index.spec.js +21 -27
- package/components/steps/index.vdt.js +8 -10
- package/components/steps/step.js +0 -2
- package/components/steps/step.vdt.js +8 -12
- package/components/steps/styles.js +0 -27
- package/components/switch/index.js +2 -23
- package/components/switch/index.spec.js +188 -224
- package/components/switch/index.vdt.js +16 -32
- package/components/switch/styles.js +3 -14
- package/components/switch/useDraggable.js +10 -18
- package/components/table/cell.js +0 -6
- package/components/table/cell.vdt.js +14 -21
- package/components/table/column.d.ts +1 -1
- package/components/table/column.js +0 -5
- package/components/table/column.vdt.js +19 -30
- package/components/table/exportTable.js +45 -56
- package/components/table/index.spec.js +780 -984
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +12 -41
- package/components/table/row.vdt.js +27 -39
- package/components/table/styles.js +0 -11
- package/components/table/table.d.ts +5 -5
- package/components/table/table.js +18 -50
- package/components/table/table.vdt.js +61 -85
- package/components/table/useChecked.d.ts +1 -1
- package/components/table/useChecked.js +20 -61
- package/components/table/useColumns.js +3 -16
- package/components/table/useDisableRow.js +2 -12
- package/components/table/useDraggable.js +4 -12
- package/components/table/useExpandable.js +2 -5
- package/components/table/useFixedColumns.d.ts +1 -1
- package/components/table/useFixedColumns.js +4 -23
- package/components/table/useGroup.d.ts +1 -1
- package/components/table/useGroup.js +7 -24
- package/components/table/useMerge.d.ts +4 -4
- package/components/table/useMerge.js +2 -14
- package/components/table/usePagination.js +4 -18
- package/components/table/useResizable.js +2 -10
- package/components/table/useRestRowStatus.js +2 -6
- package/components/table/useScroll.d.ts +1 -1
- package/components/table/useScroll.js +0 -3
- package/components/table/useSelected.js +2 -5
- package/components/table/useSortable.js +2 -8
- package/components/table/useStickyHeader.js +3 -7
- package/components/table/useStickyScrollbar.js +6 -16
- package/components/table/useTree.js +1 -12
- package/components/table/useWidth.js +14 -30
- package/components/tabs/index.js +29 -51
- package/components/tabs/index.spec.js +56 -74
- package/components/tabs/index.vdt.js +13 -16
- package/components/tabs/styles.js +0 -16
- package/components/tabs/tab.js +0 -10
- package/components/tabs/tab.vdt.js +6 -10
- package/components/tabs/useActiveBar.js +2 -11
- package/components/tabs/useScroll.js +4 -20
- package/components/tag/base.js +0 -8
- package/components/tag/index.js +2 -4
- package/components/tag/index.spec.js +19 -25
- package/components/tag/index.vdt.js +8 -15
- package/components/tag/styles.js +0 -9
- package/components/timeline/item.js +0 -4
- package/components/timeline/item.vdt.js +4 -9
- package/components/timeline/styles.d.ts +2 -2
- package/components/timeline/styles.js +0 -4
- package/components/timeline/timeline.js +0 -2
- package/components/timeline/timeline.vdt.js +2 -5
- package/components/timepicker/index.js +2 -7
- package/components/timepicker/index.spec.js +293 -368
- package/components/timepicker/panelPicker.js +2 -11
- package/components/timepicker/panelPicker.vdt.js +14 -24
- package/components/timepicker/selectPicker.js +0 -5
- package/components/timepicker/selectPicker.vdt.js +5 -10
- package/components/timepicker/styles.js +0 -1
- package/components/timepicker/useDisabled.js +2 -4
- package/components/timepicker/useFormats.js +4 -13
- package/components/timepicker/useStep.d.ts +1 -1
- package/components/timepicker/useStep.js +8 -17
- package/components/timepicker/useValue.js +16 -21
- package/components/tip/index.js +0 -2
- package/components/tip/index.vdt.js +5 -17
- package/components/tip/styles.js +0 -3
- package/components/tooltip/content.js +0 -28
- package/components/tooltip/content.vdt.js +15 -25
- package/components/tooltip/index.js +3 -7
- package/components/tooltip/index.spec.js +434 -572
- package/components/tooltip/styles.d.ts +1 -1
- package/components/tooltip/styles.js +2 -10
- package/components/tooltip/tooltip.js +2 -15
- package/components/tooltip/useArrow.js +11 -14
- package/components/transfer/index.d.ts +1 -1
- package/components/transfer/index.js +1 -13
- package/components/transfer/index.spec.js +159 -194
- package/components/transfer/index.vdt.js +16 -34
- package/components/transfer/styles.js +0 -10
- package/components/transfer/useCheck.d.ts +1 -1
- package/components/transfer/useCheck.js +1 -15
- package/components/transfer/useFilter.d.ts +1 -1
- package/components/transfer/useFilter.js +9 -30
- package/components/transfer/useTransfer.js +10 -26
- package/components/tree/index.d.ts +3 -3
- package/components/tree/index.js +4 -22
- package/components/tree/index.spec.js +285 -355
- package/components/tree/index.vdt.js +12 -23
- package/components/tree/styles.js +2 -16
- package/components/tree/useChecked.js +3 -26
- package/components/tree/useDraggable.js +12 -42
- package/components/tree/useExpanded.js +26 -43
- package/components/tree/useFilter.js +3 -10
- package/components/tree/useNodes.d.ts +1 -1
- package/components/tree/useNodes.js +0 -4
- package/components/tree/useSelected.js +21 -38
- package/components/tree/useTransitionEvent.js +3 -5
- package/components/treeSelect/index.js +9 -36
- package/components/treeSelect/index.spec.js +123 -160
- package/components/treeSelect/index.vdt.js +14 -20
- package/components/treeSelect/styles.js +0 -1
- package/components/treeSelect/useValue.js +0 -11
- package/components/types.d.ts +3 -3
- package/components/upload/ajaxUploader.d.ts +1 -1
- package/components/upload/ajaxUploader.js +0 -17
- package/components/upload/index.d.ts +4 -4
- package/components/upload/index.js +0 -14
- package/components/upload/index.spec.js +142 -249
- package/components/upload/index.vdt.js +12 -27
- package/components/upload/styles.js +0 -30
- package/components/upload/useAccept.js +2 -10
- package/components/upload/useDrag.js +0 -7
- package/components/upload/useFiles.js +103 -145
- package/components/upload/useShowImage.js +0 -3
- package/components/upload/useUpload.js +47 -69
- package/components/utils.d.ts +3 -3
- package/components/utils.js +12 -47
- package/components/virtual.js +9 -37
- package/components/wave/index.js +5 -31
- package/hooks/useDelayClose.js +2 -6
- package/hooks/useDocumentClick.js +8 -16
- package/hooks/useDraggable.d.ts +1 -1
- package/hooks/useDraggable.js +0 -9
- package/hooks/useKeyboard.d.ts +3 -3
- package/hooks/useKeyboard.js +0 -10
- package/hooks/useMouseOutsidable.js +0 -8
- package/hooks/useReceive.d.ts +1 -1
- package/hooks/useReceive.js +0 -4
- package/hooks/useRecordComponent.js +0 -6
- package/hooks/useRouter.js +7 -18
- package/hooks/useShowHideEvents.js +0 -3
- package/hooks/useState.d.ts +2 -2
- package/hooks/useState.js +2 -6
- package/i18n/en-US.js +0 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +0 -7
- package/index.d.ts +2 -2
- package/index.js +2 -3
- package/package.json +2 -2
- package/styles/global.js +2 -3
- package/styles/keyframes.js +0 -1
- package/styles/theme.d.ts +1 -1
- package/styles/theme.js +4 -7
- package/styles/utils.d.ts +1 -1
- package/styles/utils.js +3 -17
- package/yarn-error.log +633 -517
- package/components/cascader/index.d.ts +0 -45
- package/components/datepicker/index.d.ts +0 -63
- package/components/select/select.d.ts +0 -33
- package/components/timepicker/panelPicker.d.ts +0 -54
- package/components/treeSelect/index.d.ts +0 -27
|
@@ -19,39 +19,35 @@ var _$tmp1 = {
|
|
|
19
19
|
};
|
|
20
20
|
export default function ($props, $blocks, $__proto__) {
|
|
21
21
|
var _classNameObj,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
_this = this;
|
|
24
23
|
$blocks || ($blocks = {});
|
|
25
24
|
$props || ($props = {});
|
|
26
25
|
var $this = this;
|
|
27
|
-
|
|
28
26
|
var _this$get = this.get(),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
className = _this$get.className,
|
|
28
|
+
type = _this$get.type,
|
|
29
|
+
range = _this$get.range,
|
|
30
|
+
multiple = _this$get.multiple,
|
|
31
|
+
shortcuts = _this$get.shortcuts;
|
|
35
32
|
var _this$value = this.value,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
value = _this$value.value.value,
|
|
34
|
+
onChangeDate = _this$value.onChangeDate,
|
|
35
|
+
onConfirm = _this$value.onConfirm,
|
|
36
|
+
onChangeTime = _this$value.onChangeTime,
|
|
37
|
+
onChangeDateForRange = _this$value.onChangeDateForRange,
|
|
38
|
+
getTimeValue = _this$value.getTimeValue;
|
|
42
39
|
var classNameObj = (_classNameObj = {
|
|
43
40
|
'k-datepicker-content': true
|
|
44
41
|
}, _classNameObj[className] = className, _classNameObj[makePanelStyles()] = true, _classNameObj);
|
|
45
42
|
var _this$disabled = this.disabled,
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
isDisabledTime = _this$disabled.isDisabledTime,
|
|
44
|
+
isDisabledConfirm = _this$disabled.isDisabledConfirm;
|
|
48
45
|
var _this$panel = this.panel,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
startPanel = _this$panel.startPanel,
|
|
47
|
+
endPanel = _this$panel.endPanel,
|
|
48
|
+
getPanel = _this$panel.getPanel,
|
|
49
|
+
startRef = _this$panel.startRef,
|
|
50
|
+
endRef = _this$panel.endRef;
|
|
55
51
|
var generatePanel = function generatePanel(flag) {
|
|
56
52
|
var panel = getPanel(flag);
|
|
57
53
|
var timeValue = getTimeValue(flag);
|
|
@@ -59,14 +55,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
59
55
|
if (type === 'datetime') {
|
|
60
56
|
var dateString = '0000-00-00';
|
|
61
57
|
var timeString = '00:00:00';
|
|
62
|
-
|
|
63
58
|
if (timeValue) {
|
|
64
59
|
var valueString = _this.formats.getShowString(timeValue).split(/\s+/);
|
|
65
|
-
|
|
66
60
|
dateString = valueString[0];
|
|
67
61
|
timeString = valueString[1];
|
|
68
62
|
}
|
|
69
|
-
|
|
70
63
|
return _$cc(Tabs, {
|
|
71
64
|
'type': 'border-card',
|
|
72
65
|
'value': panel.value,
|
|
@@ -97,14 +90,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
97
90
|
'isDisabledTime': isDisabledTime
|
|
98
91
|
})], 0, 'k-datepicker-calendar-wrapper');
|
|
99
92
|
};
|
|
100
|
-
|
|
101
93
|
return _$su.call($this, _$tmp0, function ($blocks) {
|
|
102
94
|
var _$blocks = {},
|
|
103
|
-
|
|
104
|
-
|
|
95
|
+
__$blocks = _$ex({}, $blocks);
|
|
105
96
|
return (_$blocks['base-menu'] = function ($super) {
|
|
106
97
|
var _this2 = this;
|
|
107
|
-
|
|
108
98
|
return _$cc(DropdownMenu, {
|
|
109
99
|
'className': _$cn(classNameObj),
|
|
110
100
|
'children': [shortcuts && shortcuts.length ? _$ce(2, 'div', _mapInstanceProperty(shortcuts).call(shortcuts, function ($value) {
|
|
@@ -123,21 +113,17 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
123
113
|
});
|
|
124
114
|
}, __$blocks['base-menu'] = function ($super, data) {
|
|
125
115
|
var block = $blocks['base-menu'];
|
|
126
|
-
|
|
127
116
|
var callBlock = function callBlock() {
|
|
128
117
|
return _$blocks['base-menu'].call($this, $super, data);
|
|
129
118
|
};
|
|
130
|
-
|
|
131
119
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
132
120
|
}), (_$blocks['suffix'] = function ($super) {
|
|
133
121
|
return _$cc(Icon, _$tmp1);
|
|
134
122
|
}, __$blocks['suffix'] = function ($super, data) {
|
|
135
123
|
var block = $blocks['suffix'];
|
|
136
|
-
|
|
137
124
|
var callBlock = function callBlock() {
|
|
138
125
|
return _$blocks['suffix'].call($this, $super, data);
|
|
139
126
|
};
|
|
140
|
-
|
|
141
127
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
142
128
|
}), __$blocks;
|
|
143
129
|
}.call($this, $blocks), $__proto__);
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { _$ } from '../../i18n';
|
|
2
|
-
|
|
3
2
|
function now() {
|
|
4
3
|
return new Date();
|
|
5
4
|
}
|
|
6
|
-
|
|
7
5
|
function days(days) {
|
|
8
6
|
var now = new Date();
|
|
9
7
|
now.setDate(now.getDate() + days);
|
|
10
8
|
return now;
|
|
11
9
|
}
|
|
12
|
-
|
|
13
10
|
function months(months) {
|
|
14
11
|
var now = new Date();
|
|
15
12
|
now.setMonth(now.getMonth() + months);
|
|
16
13
|
return now;
|
|
17
14
|
}
|
|
18
|
-
|
|
19
15
|
export var today = {
|
|
20
16
|
label: function label() {
|
|
21
17
|
return _$('今天');
|
|
@@ -9,28 +9,22 @@ var defaults = {
|
|
|
9
9
|
item: {
|
|
10
10
|
gutter: "7px",
|
|
11
11
|
height: "24px",
|
|
12
|
-
|
|
13
12
|
get hoverBgColor() {
|
|
14
13
|
return theme.color.bg;
|
|
15
14
|
},
|
|
16
|
-
|
|
17
15
|
get exceedColor() {
|
|
18
16
|
return theme.color.disabled;
|
|
19
17
|
},
|
|
20
|
-
|
|
21
18
|
get todayBorder() {
|
|
22
19
|
return "1px solid " + theme.color.border;
|
|
23
20
|
},
|
|
24
|
-
|
|
25
21
|
get borderRadius() {
|
|
26
22
|
return theme.borderRadius;
|
|
27
23
|
},
|
|
28
|
-
|
|
29
24
|
active: {
|
|
30
25
|
get bgColor() {
|
|
31
26
|
return theme.color.primary;
|
|
32
27
|
},
|
|
33
|
-
|
|
34
28
|
color: "#fff",
|
|
35
29
|
todayBorderColor: "transparent"
|
|
36
30
|
},
|
|
@@ -42,7 +36,6 @@ var defaults = {
|
|
|
42
36
|
get bgColor() {
|
|
43
37
|
return palette(datepicker.item.active.bgColor, -4);
|
|
44
38
|
}
|
|
45
|
-
|
|
46
39
|
}
|
|
47
40
|
},
|
|
48
41
|
weekday: {
|
|
@@ -63,7 +56,6 @@ var defaults = {
|
|
|
63
56
|
get hoverBgcolor() {
|
|
64
57
|
return theme.color.bg;
|
|
65
58
|
},
|
|
66
|
-
|
|
67
59
|
height: '32px',
|
|
68
60
|
padding: '0 16px'
|
|
69
61
|
}
|
|
@@ -14,27 +14,20 @@ var defaultValue = {
|
|
|
14
14
|
};
|
|
15
15
|
export var DatepickerTime = /*#__PURE__*/function (_Component) {
|
|
16
16
|
_inheritsLoose(DatepickerTime, _Component);
|
|
17
|
-
|
|
18
17
|
function DatepickerTime() {
|
|
19
18
|
var _context;
|
|
20
|
-
|
|
21
19
|
var _this;
|
|
22
|
-
|
|
23
20
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
21
|
args[_key] = arguments[_key];
|
|
25
22
|
}
|
|
26
|
-
|
|
27
23
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
28
24
|
_this.value = useState(defaultValue);
|
|
29
25
|
_this.disabled = useDisable(_assertThisInitialized(_this));
|
|
30
26
|
return _this;
|
|
31
27
|
}
|
|
32
|
-
|
|
33
28
|
var _proto = DatepickerTime.prototype;
|
|
34
|
-
|
|
35
29
|
_proto.init = function init() {
|
|
36
30
|
var _this2 = this;
|
|
37
|
-
|
|
38
31
|
this.watch('value', function (v) {
|
|
39
32
|
_this2.value.set(v ? {
|
|
40
33
|
h: v.hour(),
|
|
@@ -43,38 +36,28 @@ export var DatepickerTime = /*#__PURE__*/function (_Component) {
|
|
|
43
36
|
} : defaultValue);
|
|
44
37
|
});
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
_proto.changeHour = function changeHour(v) {
|
|
48
40
|
this.changeValue(v, 'h');
|
|
49
41
|
};
|
|
50
|
-
|
|
51
42
|
_proto.changeMinute = function changeMinute(v) {
|
|
52
43
|
this.changeValue(v, 'm');
|
|
53
44
|
};
|
|
54
|
-
|
|
55
45
|
_proto.changeSecond = function changeSecond(v) {
|
|
56
46
|
this.changeValue(v, 's');
|
|
57
47
|
};
|
|
58
|
-
|
|
59
48
|
_proto.changeValue = function changeValue(v, type) {
|
|
60
49
|
var value = this.get('value') || getNowDate();
|
|
61
50
|
this.set('value', value.set(type, v));
|
|
62
51
|
};
|
|
63
|
-
|
|
64
52
|
return DatepickerTime;
|
|
65
53
|
}(Component);
|
|
66
54
|
DatepickerTime.template = template;
|
|
67
|
-
|
|
68
55
|
__decorate([bind], DatepickerTime.prototype, "changeHour", null);
|
|
69
|
-
|
|
70
56
|
__decorate([bind], DatepickerTime.prototype, "changeMinute", null);
|
|
71
|
-
|
|
72
57
|
__decorate([bind], DatepickerTime.prototype, "changeSecond", null);
|
|
73
|
-
|
|
74
58
|
var hourRegExp = /h/i;
|
|
75
59
|
var secondRegExp = /s/;
|
|
76
60
|
var minuteRegExp = /m/;
|
|
77
|
-
|
|
78
61
|
function useDisable(instance) {
|
|
79
62
|
var disableSeconds = useState(false);
|
|
80
63
|
var disableMinutes = useState(false);
|
|
@@ -84,18 +67,15 @@ function useDisable(instance) {
|
|
|
84
67
|
disableMinutes.set(!minuteRegExp.test(format));
|
|
85
68
|
disableHours.set(!hourRegExp.test(format));
|
|
86
69
|
});
|
|
87
|
-
|
|
88
70
|
function disableItem(v, type) {
|
|
89
71
|
var _instance$get = instance.get(),
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
72
|
+
value = _instance$get.value,
|
|
73
|
+
isDisabledTime = _instance$get.isDisabledTime,
|
|
74
|
+
flag = _instance$get.flag;
|
|
94
75
|
if (!value) return false;
|
|
95
76
|
value = value.set(type, v);
|
|
96
77
|
return isDisabledTime(value, flag);
|
|
97
78
|
}
|
|
98
|
-
|
|
99
79
|
return {
|
|
100
80
|
disableSeconds: disableSeconds,
|
|
101
81
|
disableMinutes: disableMinutes,
|
|
@@ -4,16 +4,15 @@ import { hours, minutes, seconds } from './constants';
|
|
|
4
4
|
import { makeTimeStyles } from './styles';
|
|
5
5
|
export default function ($props, $blocks, $__proto__) {
|
|
6
6
|
var _classNameObj;
|
|
7
|
-
|
|
8
7
|
$blocks || ($blocks = {});
|
|
9
8
|
$props || ($props = {});
|
|
10
9
|
var $this = this;
|
|
11
10
|
var value = this.value.value;
|
|
12
11
|
var _this$disabled = this.disabled,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
disableHours = _this$disabled.disableHours,
|
|
13
|
+
disableMinutes = _this$disabled.disableMinutes,
|
|
14
|
+
disableSeconds = _this$disabled.disableSeconds,
|
|
15
|
+
disableItem = _this$disabled.disableItem;
|
|
17
16
|
var classNameObj = (_classNameObj = {
|
|
18
17
|
'k-datepicker-time': true
|
|
19
18
|
}, _classNameObj[makeTimeStyles()] = true, _classNameObj);
|
|
@@ -3,24 +3,19 @@ import dayjs from 'dayjs';
|
|
|
3
3
|
import { clearTime, isEqual } from './helpers';
|
|
4
4
|
export function useDays(showDate, status, focusDate) {
|
|
5
5
|
var instance = useInstance();
|
|
6
|
-
|
|
7
6
|
function getDays(now) {
|
|
8
|
-
var days = [];
|
|
9
|
-
|
|
7
|
+
var days = [];
|
|
8
|
+
// dayjs is immutable, so we convert to native Date
|
|
10
9
|
var start = showDate.value.toDate();
|
|
11
10
|
var month = start.getMonth();
|
|
12
11
|
start.setDate(1);
|
|
13
12
|
clearTime(start);
|
|
14
13
|
var startWeekday = start.getDay();
|
|
15
14
|
start.setDate(1 - startWeekday);
|
|
16
|
-
|
|
17
15
|
for (var i = 0; i < 42; i++) {
|
|
18
16
|
var dayjsDate = dayjs(start);
|
|
19
|
-
|
|
20
17
|
var _date = start.getDate();
|
|
21
|
-
|
|
22
18
|
var _month = start.getMonth();
|
|
23
|
-
|
|
24
19
|
var isExceed = _month !== month;
|
|
25
20
|
days.push({
|
|
26
21
|
isExceed: isExceed,
|
|
@@ -34,10 +29,8 @@ export function useDays(showDate, status, focusDate) {
|
|
|
34
29
|
});
|
|
35
30
|
start.setDate(start.getDate() + 1);
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
return days;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
return {
|
|
42
35
|
getDays: getDays,
|
|
43
36
|
onClick: instance.triggerChange
|
|
@@ -8,7 +8,6 @@ export function useDisabled(_ref) {
|
|
|
8
8
|
var instance = useInstance();
|
|
9
9
|
var maxDate = useState(null);
|
|
10
10
|
var minDate = useState(null);
|
|
11
|
-
|
|
12
11
|
function convertToDayjs(state, v) {
|
|
13
12
|
if (isNullOrUndefined(v)) {
|
|
14
13
|
state.set(null);
|
|
@@ -16,75 +15,59 @@ export function useDisabled(_ref) {
|
|
|
16
15
|
state.set(createDateByValueFormat(v));
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
instance.on('$receive:max', function (v) {
|
|
21
19
|
convertToDayjs(maxDate, v);
|
|
22
20
|
});
|
|
23
21
|
instance.on('$receive:min', function (v) {
|
|
24
22
|
convertToDayjs(minDate, v);
|
|
25
23
|
});
|
|
26
|
-
|
|
27
24
|
function isDisabled(value, type) {
|
|
28
25
|
if (type === void 0) {
|
|
29
26
|
type = 'date';
|
|
30
27
|
}
|
|
31
|
-
|
|
32
28
|
var _instance$get = instance.get(),
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
disabledDate = _instance$get.disabledDate;
|
|
35
30
|
return isGT(value, maxDate.value, type) || isLT(value, minDate.value, type) || !!disabledDate && disabledDate(value);
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
function isDisabledTime(value, flag) {
|
|
39
33
|
if (!isDisabled(value, 'second')) {
|
|
40
|
-
if (!instance.get('range')) return false;
|
|
41
|
-
|
|
34
|
+
if (!instance.get('range')) return false;
|
|
35
|
+
// compare the start and the end datetime
|
|
42
36
|
var anotherDatetime = instance.value.getTimeValue(flag === PanelFlags.Start ? PanelFlags.End : PanelFlags.Start);
|
|
43
37
|
if (!anotherDatetime) return false;
|
|
44
|
-
|
|
45
38
|
if (flag === PanelFlags.Start) {
|
|
46
39
|
return value.isAfter(anotherDatetime, 'second');
|
|
47
40
|
} else {
|
|
48
41
|
return value.isBefore(anotherDatetime, 'second');
|
|
49
42
|
}
|
|
50
43
|
}
|
|
51
|
-
|
|
52
44
|
return true;
|
|
53
45
|
}
|
|
54
|
-
|
|
55
46
|
function isDisabledConfirm() {
|
|
56
47
|
var lastValue = last(instance.value.value.value);
|
|
57
48
|
if (!lastValue) return true;
|
|
58
|
-
|
|
59
49
|
var _instance$get2 = instance.get(),
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
range = _instance$get2.range;
|
|
62
51
|
if (range && lastValue.length < 2) return true;
|
|
63
52
|
var _instance$panel = instance.panel,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
53
|
+
startPanel = _instance$panel.startPanel,
|
|
54
|
+
endPanel = _instance$panel.endPanel;
|
|
67
55
|
if (startPanel.value === PanelTypes.Date && endPanel.value === PanelTypes.Date) {
|
|
68
56
|
return true;
|
|
69
57
|
}
|
|
70
|
-
|
|
71
58
|
var start;
|
|
72
59
|
var end;
|
|
73
|
-
|
|
74
60
|
if (range) {
|
|
75
61
|
start = lastValue[0];
|
|
76
62
|
end = lastValue[1];
|
|
77
63
|
} else {
|
|
78
64
|
start = lastValue;
|
|
79
65
|
}
|
|
80
|
-
|
|
81
66
|
if (isDisabledTime(start, PanelFlags.Start) || end && isDisabledTime(end, PanelFlags.End)) {
|
|
82
67
|
return true;
|
|
83
68
|
}
|
|
84
|
-
|
|
85
69
|
return false;
|
|
86
70
|
}
|
|
87
|
-
|
|
88
71
|
return {
|
|
89
72
|
isDisabled: isDisabled,
|
|
90
73
|
isDisabledTime: isDisabledTime,
|
|
@@ -3,11 +3,9 @@ import { useState } from '../../hooks/useState';
|
|
|
3
3
|
export function useFocusDate() {
|
|
4
4
|
var instance = useInstance();
|
|
5
5
|
var focusDate = useState(null);
|
|
6
|
-
|
|
7
6
|
function reset() {
|
|
8
7
|
focusDate.set(null);
|
|
9
8
|
}
|
|
10
|
-
|
|
11
9
|
instance.on('hide', reset);
|
|
12
10
|
return {
|
|
13
11
|
focusDate: focusDate,
|
|
@@ -9,41 +9,32 @@ var FORMATS = {
|
|
|
9
9
|
};
|
|
10
10
|
export function useFormats() {
|
|
11
11
|
var instance = useInstance();
|
|
12
|
-
|
|
13
12
|
function getValueFormat() {
|
|
14
13
|
var _instance$get = instance.get(),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
format = _instance$get.format,
|
|
15
|
+
valueFormat = _instance$get.valueFormat,
|
|
16
|
+
type = _instance$get.type;
|
|
19
17
|
return valueFormat || format || FORMATS[type];
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
function getShowFormat() {
|
|
23
20
|
var _instance$get2 = instance.get(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
format = _instance$get2.format,
|
|
22
|
+
showFormat = _instance$get2.showFormat,
|
|
23
|
+
type = _instance$get2.type;
|
|
28
24
|
return showFormat || format || FORMATS[type];
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
function createDateByValueFormat(value) {
|
|
32
27
|
return dayjs(value, isString(value) ? getValueFormat() : undefined);
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
function createDateByShowFormat(value) {
|
|
36
30
|
return dayjs(value, getShowFormat(), true); // strict parsing
|
|
37
31
|
}
|
|
38
|
-
|
|
39
32
|
function getShowString(value) {
|
|
40
33
|
return value.format(getShowFormat());
|
|
41
34
|
}
|
|
42
|
-
|
|
43
35
|
function getValueString(value) {
|
|
44
36
|
return value.format(getValueFormat());
|
|
45
37
|
}
|
|
46
|
-
|
|
47
38
|
return {
|
|
48
39
|
getValueFormat: getValueFormat,
|
|
49
40
|
getShowFormat: getShowFormat,
|
|
@@ -1,96 +1,80 @@
|
|
|
1
1
|
import { useInstance } from 'intact-vue-next';
|
|
2
2
|
import { useKeyboard } from '../../hooks/useKeyboard';
|
|
3
3
|
var Direction;
|
|
4
|
-
|
|
5
4
|
(function (Direction) {
|
|
6
5
|
Direction[Direction["Up"] = 0] = "Up";
|
|
7
6
|
Direction[Direction["Down"] = 1] = "Down";
|
|
8
7
|
Direction[Direction["Left"] = 2] = "Left";
|
|
9
8
|
Direction[Direction["Right"] = 3] = "Right";
|
|
10
9
|
})(Direction || (Direction = {}));
|
|
11
|
-
|
|
12
10
|
export function useKeyboards(panelRef, focusDate) {
|
|
13
11
|
var instance = useInstance();
|
|
14
|
-
|
|
15
12
|
var _useKeyboard = useKeyboard({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
13
|
+
down: function down(e) {
|
|
14
|
+
focus(e, Direction.Down);
|
|
15
|
+
},
|
|
16
|
+
up: function up(e) {
|
|
17
|
+
focus(e, Direction.Up);
|
|
18
|
+
},
|
|
19
|
+
right: function right(e) {
|
|
20
|
+
focus(e, Direction.Right);
|
|
21
|
+
},
|
|
22
|
+
left: function left(e) {
|
|
23
|
+
focus(e, Direction.Left);
|
|
24
|
+
},
|
|
25
|
+
enter: function enter() {
|
|
26
|
+
select(focusDate.value);
|
|
27
|
+
}
|
|
28
|
+
}),
|
|
29
|
+
add = _useKeyboard[0],
|
|
30
|
+
remove = _useKeyboard[1];
|
|
35
31
|
instance.on('show', add);
|
|
36
32
|
instance.on('hide', remove);
|
|
37
|
-
|
|
38
33
|
function select(date) {
|
|
39
34
|
if (!date) return;
|
|
40
35
|
var calendar = panelRef.value;
|
|
41
36
|
if (!calendar) return; // maybe select time
|
|
42
|
-
|
|
43
37
|
switch (calendar.type.value) {
|
|
44
38
|
case 'date':
|
|
45
39
|
calendar.days.onClick(date);
|
|
46
40
|
break;
|
|
47
|
-
|
|
48
41
|
case 'month':
|
|
49
42
|
calendar.months.onClick(date);
|
|
50
43
|
break;
|
|
51
|
-
|
|
52
44
|
case 'year':
|
|
53
45
|
calendar.years.onClick(date);
|
|
54
46
|
break;
|
|
55
47
|
}
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
function focus(e, direction) {
|
|
59
50
|
var calendar = panelRef.value;
|
|
60
51
|
if (!calendar) return;
|
|
61
52
|
e.preventDefault();
|
|
62
|
-
|
|
63
53
|
if (!focusDate.value) {
|
|
64
54
|
focusDate.set(calendar.showDate.date.value);
|
|
65
55
|
return;
|
|
66
56
|
}
|
|
67
|
-
|
|
68
57
|
var type = calendar.type.value;
|
|
69
58
|
var upAndDownOffset = type === 'date' ? 7 : 4;
|
|
70
59
|
var offset;
|
|
71
|
-
|
|
72
60
|
switch (direction) {
|
|
73
61
|
case Direction.Up:
|
|
74
62
|
offset = -upAndDownOffset;
|
|
75
63
|
break;
|
|
76
|
-
|
|
77
64
|
case Direction.Down:
|
|
78
65
|
offset = upAndDownOffset;
|
|
79
66
|
break;
|
|
80
|
-
|
|
81
67
|
case Direction.Left:
|
|
82
68
|
offset = -1;
|
|
83
69
|
break;
|
|
84
|
-
|
|
85
70
|
case Direction.Right:
|
|
86
71
|
offset = 1;
|
|
87
72
|
break;
|
|
88
73
|
}
|
|
89
|
-
|
|
90
74
|
var _focusDate = focusDate.value;
|
|
91
75
|
_focusDate = _focusDate.add(offset, type === 'date' ? 'day' : type);
|
|
92
|
-
focusDate.set(_focusDate);
|
|
93
|
-
|
|
76
|
+
focusDate.set(_focusDate);
|
|
77
|
+
// change panel show date
|
|
94
78
|
calendar.showDate.date.set(_focusDate);
|
|
95
79
|
}
|
|
96
80
|
}
|
|
@@ -4,12 +4,10 @@ import { isEqual } from './helpers';
|
|
|
4
4
|
import { _$ } from '../../i18n';
|
|
5
5
|
export function useMonths(showDate, status, focusDate) {
|
|
6
6
|
var instance = useInstance();
|
|
7
|
-
|
|
8
7
|
function getMonths(now) {
|
|
9
8
|
var ret = [];
|
|
10
9
|
var start = showDate.value.toDate();
|
|
11
10
|
start.setMonth(0);
|
|
12
|
-
|
|
13
11
|
for (var i = 0; i < 12; i++) {
|
|
14
12
|
var dayjsDate = dayjs(start);
|
|
15
13
|
ret.push({
|
|
@@ -23,21 +21,17 @@ export function useMonths(showDate, status, focusDate) {
|
|
|
23
21
|
});
|
|
24
22
|
start.setMonth(i + 1);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
return ret;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
function onClick(date) {
|
|
31
27
|
showDate.set(date);
|
|
32
28
|
var datepickerType = instance.datepicker.get('type');
|
|
33
|
-
|
|
34
29
|
if (datepickerType !== 'month' && datepickerType !== 'year') {
|
|
35
30
|
instance.type.set('date');
|
|
36
31
|
} else {
|
|
37
32
|
instance.triggerChange(date);
|
|
38
33
|
}
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
return {
|
|
42
36
|
getMonths: getMonths,
|
|
43
37
|
onClick: onClick
|