@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
|
@@ -19,35 +19,39 @@ var _$tmp1 = {
|
|
|
19
19
|
};
|
|
20
20
|
export default function ($props, $blocks, $__proto__) {
|
|
21
21
|
var _classNameObj,
|
|
22
|
-
|
|
22
|
+
_this = this;
|
|
23
|
+
|
|
23
24
|
$blocks || ($blocks = {});
|
|
24
25
|
$props || ($props = {});
|
|
25
26
|
var $this = this;
|
|
27
|
+
|
|
26
28
|
var _this$get = this.get(),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
className = _this$get.className,
|
|
30
|
+
type = _this$get.type,
|
|
31
|
+
range = _this$get.range,
|
|
32
|
+
multiple = _this$get.multiple,
|
|
33
|
+
shortcuts = _this$get.shortcuts;
|
|
34
|
+
|
|
32
35
|
var _this$value = this.value,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
value = _this$value.value.value,
|
|
37
|
+
onChangeDate = _this$value.onChangeDate,
|
|
38
|
+
onConfirm = _this$value.onConfirm,
|
|
39
|
+
onChangeTime = _this$value.onChangeTime,
|
|
40
|
+
onChangeDateForRange = _this$value.onChangeDateForRange,
|
|
41
|
+
getTimeValue = _this$value.getTimeValue;
|
|
39
42
|
var classNameObj = (_classNameObj = {
|
|
40
43
|
'k-datepicker-content': true
|
|
41
44
|
}, _classNameObj[className] = className, _classNameObj[makePanelStyles()] = true, _classNameObj);
|
|
42
45
|
var _this$disabled = this.disabled,
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
isDisabledTime = _this$disabled.isDisabledTime,
|
|
47
|
+
isDisabledConfirm = _this$disabled.isDisabledConfirm;
|
|
45
48
|
var _this$panel = this.panel,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
startPanel = _this$panel.startPanel,
|
|
50
|
+
endPanel = _this$panel.endPanel,
|
|
51
|
+
getPanel = _this$panel.getPanel,
|
|
52
|
+
startRef = _this$panel.startRef,
|
|
53
|
+
endRef = _this$panel.endRef;
|
|
54
|
+
|
|
51
55
|
var generatePanel = function generatePanel(flag) {
|
|
52
56
|
var panel = getPanel(flag);
|
|
53
57
|
var timeValue = getTimeValue(flag);
|
|
@@ -55,11 +59,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
55
59
|
if (type === 'datetime') {
|
|
56
60
|
var dateString = '0000-00-00';
|
|
57
61
|
var timeString = '00:00:00';
|
|
62
|
+
|
|
58
63
|
if (timeValue) {
|
|
59
64
|
var valueString = _this.formats.getShowString(timeValue).split(/\s+/);
|
|
65
|
+
|
|
60
66
|
dateString = valueString[0];
|
|
61
67
|
timeString = valueString[1];
|
|
62
68
|
}
|
|
69
|
+
|
|
63
70
|
return _$cc(Tabs, {
|
|
64
71
|
'type': 'border-card',
|
|
65
72
|
'value': panel.value,
|
|
@@ -90,11 +97,14 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
90
97
|
'isDisabledTime': isDisabledTime
|
|
91
98
|
})], 0, 'k-datepicker-calendar-wrapper');
|
|
92
99
|
};
|
|
100
|
+
|
|
93
101
|
return _$su.call($this, _$tmp0, function ($blocks) {
|
|
94
102
|
var _$blocks = {},
|
|
95
|
-
|
|
103
|
+
__$blocks = _$ex({}, $blocks);
|
|
104
|
+
|
|
96
105
|
return (_$blocks['base-menu'] = function ($super) {
|
|
97
106
|
var _this2 = this;
|
|
107
|
+
|
|
98
108
|
return _$cc(DropdownMenu, {
|
|
99
109
|
'className': _$cn(classNameObj),
|
|
100
110
|
'children': [shortcuts && shortcuts.length ? _$ce(2, 'div', _mapInstanceProperty(shortcuts).call(shortcuts, function ($value) {
|
|
@@ -113,17 +123,21 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
113
123
|
});
|
|
114
124
|
}, __$blocks['base-menu'] = function ($super, data) {
|
|
115
125
|
var block = $blocks['base-menu'];
|
|
126
|
+
|
|
116
127
|
var callBlock = function callBlock() {
|
|
117
128
|
return _$blocks['base-menu'].call($this, $super, data);
|
|
118
129
|
};
|
|
130
|
+
|
|
119
131
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
120
132
|
}), (_$blocks['suffix'] = function ($super) {
|
|
121
133
|
return _$cc(Icon, _$tmp1);
|
|
122
134
|
}, __$blocks['suffix'] = function ($super, data) {
|
|
123
135
|
var block = $blocks['suffix'];
|
|
136
|
+
|
|
124
137
|
var callBlock = function callBlock() {
|
|
125
138
|
return _$blocks['suffix'].call($this, $super, data);
|
|
126
139
|
};
|
|
140
|
+
|
|
127
141
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
128
142
|
}), __$blocks;
|
|
129
143
|
}.call($this, $blocks), $__proto__);
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import { _$ } from '../../i18n';
|
|
2
|
+
|
|
2
3
|
function now() {
|
|
3
4
|
return new Date();
|
|
4
5
|
}
|
|
6
|
+
|
|
5
7
|
function days(days) {
|
|
6
8
|
var now = new Date();
|
|
7
9
|
now.setDate(now.getDate() + days);
|
|
8
10
|
return now;
|
|
9
11
|
}
|
|
12
|
+
|
|
10
13
|
function months(months) {
|
|
11
14
|
var now = new Date();
|
|
12
15
|
now.setMonth(now.getMonth() + months);
|
|
13
16
|
return now;
|
|
14
17
|
}
|
|
18
|
+
|
|
15
19
|
export var today = {
|
|
16
20
|
label: function label() {
|
|
17
21
|
return _$('今天');
|
|
@@ -9,22 +9,28 @@ var defaults = {
|
|
|
9
9
|
item: {
|
|
10
10
|
gutter: "7px",
|
|
11
11
|
height: "24px",
|
|
12
|
+
|
|
12
13
|
get hoverBgColor() {
|
|
13
14
|
return theme.color.bg;
|
|
14
15
|
},
|
|
16
|
+
|
|
15
17
|
get exceedColor() {
|
|
16
18
|
return theme.color.disabled;
|
|
17
19
|
},
|
|
20
|
+
|
|
18
21
|
get todayBorder() {
|
|
19
22
|
return "1px solid " + theme.color.border;
|
|
20
23
|
},
|
|
24
|
+
|
|
21
25
|
get borderRadius() {
|
|
22
26
|
return theme.borderRadius;
|
|
23
27
|
},
|
|
28
|
+
|
|
24
29
|
active: {
|
|
25
30
|
get bgColor() {
|
|
26
31
|
return theme.color.primary;
|
|
27
32
|
},
|
|
33
|
+
|
|
28
34
|
color: "#fff",
|
|
29
35
|
todayBorderColor: "transparent"
|
|
30
36
|
},
|
|
@@ -36,6 +42,7 @@ var defaults = {
|
|
|
36
42
|
get bgColor() {
|
|
37
43
|
return palette(datepicker.item.active.bgColor, -4);
|
|
38
44
|
}
|
|
45
|
+
|
|
39
46
|
}
|
|
40
47
|
},
|
|
41
48
|
weekday: {
|
|
@@ -56,6 +63,7 @@ var defaults = {
|
|
|
56
63
|
get hoverBgcolor() {
|
|
57
64
|
return theme.color.bg;
|
|
58
65
|
},
|
|
66
|
+
|
|
59
67
|
height: '32px',
|
|
60
68
|
padding: '0 16px'
|
|
61
69
|
}
|
|
@@ -14,20 +14,27 @@ var defaultValue = {
|
|
|
14
14
|
};
|
|
15
15
|
export var DatepickerTime = /*#__PURE__*/function (_Component) {
|
|
16
16
|
_inheritsLoose(DatepickerTime, _Component);
|
|
17
|
+
|
|
17
18
|
function DatepickerTime() {
|
|
18
19
|
var _context;
|
|
20
|
+
|
|
19
21
|
var _this;
|
|
22
|
+
|
|
20
23
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
24
|
args[_key] = arguments[_key];
|
|
22
25
|
}
|
|
26
|
+
|
|
23
27
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
24
28
|
_this.value = useState(defaultValue);
|
|
25
29
|
_this.disabled = useDisable(_assertThisInitialized(_this));
|
|
26
30
|
return _this;
|
|
27
31
|
}
|
|
32
|
+
|
|
28
33
|
var _proto = DatepickerTime.prototype;
|
|
34
|
+
|
|
29
35
|
_proto.init = function init() {
|
|
30
36
|
var _this2 = this;
|
|
37
|
+
|
|
31
38
|
this.watch('value', function (v) {
|
|
32
39
|
_this2.value.set(v ? {
|
|
33
40
|
h: v.hour(),
|
|
@@ -36,28 +43,38 @@ export var DatepickerTime = /*#__PURE__*/function (_Component) {
|
|
|
36
43
|
} : defaultValue);
|
|
37
44
|
});
|
|
38
45
|
};
|
|
46
|
+
|
|
39
47
|
_proto.changeHour = function changeHour(v) {
|
|
40
48
|
this.changeValue(v, 'h');
|
|
41
49
|
};
|
|
50
|
+
|
|
42
51
|
_proto.changeMinute = function changeMinute(v) {
|
|
43
52
|
this.changeValue(v, 'm');
|
|
44
53
|
};
|
|
54
|
+
|
|
45
55
|
_proto.changeSecond = function changeSecond(v) {
|
|
46
56
|
this.changeValue(v, 's');
|
|
47
57
|
};
|
|
58
|
+
|
|
48
59
|
_proto.changeValue = function changeValue(v, type) {
|
|
49
60
|
var value = this.get('value') || getNowDate();
|
|
50
61
|
this.set('value', value.set(type, v));
|
|
51
62
|
};
|
|
63
|
+
|
|
52
64
|
return DatepickerTime;
|
|
53
65
|
}(Component);
|
|
54
66
|
DatepickerTime.template = template;
|
|
67
|
+
|
|
55
68
|
__decorate([bind], DatepickerTime.prototype, "changeHour", null);
|
|
69
|
+
|
|
56
70
|
__decorate([bind], DatepickerTime.prototype, "changeMinute", null);
|
|
71
|
+
|
|
57
72
|
__decorate([bind], DatepickerTime.prototype, "changeSecond", null);
|
|
73
|
+
|
|
58
74
|
var hourRegExp = /h/i;
|
|
59
75
|
var secondRegExp = /s/;
|
|
60
76
|
var minuteRegExp = /m/;
|
|
77
|
+
|
|
61
78
|
function useDisable(instance) {
|
|
62
79
|
var disableSeconds = useState(false);
|
|
63
80
|
var disableMinutes = useState(false);
|
|
@@ -67,15 +84,18 @@ function useDisable(instance) {
|
|
|
67
84
|
disableMinutes.set(!minuteRegExp.test(format));
|
|
68
85
|
disableHours.set(!hourRegExp.test(format));
|
|
69
86
|
});
|
|
87
|
+
|
|
70
88
|
function disableItem(v, type) {
|
|
71
89
|
var _instance$get = instance.get(),
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
90
|
+
value = _instance$get.value,
|
|
91
|
+
isDisabledTime = _instance$get.isDisabledTime,
|
|
92
|
+
flag = _instance$get.flag;
|
|
93
|
+
|
|
75
94
|
if (!value) return false;
|
|
76
95
|
value = value.set(type, v);
|
|
77
96
|
return isDisabledTime(value, flag);
|
|
78
97
|
}
|
|
98
|
+
|
|
79
99
|
return {
|
|
80
100
|
disableSeconds: disableSeconds,
|
|
81
101
|
disableMinutes: disableMinutes,
|
|
@@ -4,15 +4,16 @@ 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
|
+
|
|
7
8
|
$blocks || ($blocks = {});
|
|
8
9
|
$props || ($props = {});
|
|
9
10
|
var $this = this;
|
|
10
11
|
var value = this.value.value;
|
|
11
12
|
var _this$disabled = this.disabled,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
disableHours = _this$disabled.disableHours,
|
|
14
|
+
disableMinutes = _this$disabled.disableMinutes,
|
|
15
|
+
disableSeconds = _this$disabled.disableSeconds,
|
|
16
|
+
disableItem = _this$disabled.disableItem;
|
|
16
17
|
var classNameObj = (_classNameObj = {
|
|
17
18
|
'k-datepicker-time': true
|
|
18
19
|
}, _classNameObj[makeTimeStyles()] = true, _classNameObj);
|
|
@@ -3,19 +3,24 @@ 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
|
+
|
|
6
7
|
function getDays(now) {
|
|
7
|
-
var days = [];
|
|
8
|
-
|
|
8
|
+
var days = []; // dayjs is immutable, so we convert to native Date
|
|
9
|
+
|
|
9
10
|
var start = showDate.value.toDate();
|
|
10
11
|
var month = start.getMonth();
|
|
11
12
|
start.setDate(1);
|
|
12
13
|
clearTime(start);
|
|
13
14
|
var startWeekday = start.getDay();
|
|
14
15
|
start.setDate(1 - startWeekday);
|
|
16
|
+
|
|
15
17
|
for (var i = 0; i < 42; i++) {
|
|
16
18
|
var dayjsDate = dayjs(start);
|
|
19
|
+
|
|
17
20
|
var _date = start.getDate();
|
|
21
|
+
|
|
18
22
|
var _month = start.getMonth();
|
|
23
|
+
|
|
19
24
|
var isExceed = _month !== month;
|
|
20
25
|
days.push({
|
|
21
26
|
isExceed: isExceed,
|
|
@@ -29,8 +34,10 @@ export function useDays(showDate, status, focusDate) {
|
|
|
29
34
|
});
|
|
30
35
|
start.setDate(start.getDate() + 1);
|
|
31
36
|
}
|
|
37
|
+
|
|
32
38
|
return days;
|
|
33
39
|
}
|
|
40
|
+
|
|
34
41
|
return {
|
|
35
42
|
getDays: getDays,
|
|
36
43
|
onClick: instance.triggerChange
|
|
@@ -8,6 +8,7 @@ export function useDisabled(_ref) {
|
|
|
8
8
|
var instance = useInstance();
|
|
9
9
|
var maxDate = useState(null);
|
|
10
10
|
var minDate = useState(null);
|
|
11
|
+
|
|
11
12
|
function convertToDayjs(state, v) {
|
|
12
13
|
if (isNullOrUndefined(v)) {
|
|
13
14
|
state.set(null);
|
|
@@ -15,59 +16,75 @@ export function useDisabled(_ref) {
|
|
|
15
16
|
state.set(createDateByValueFormat(v));
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
instance.on('$receive:max', function (v) {
|
|
19
21
|
convertToDayjs(maxDate, v);
|
|
20
22
|
});
|
|
21
23
|
instance.on('$receive:min', function (v) {
|
|
22
24
|
convertToDayjs(minDate, v);
|
|
23
25
|
});
|
|
26
|
+
|
|
24
27
|
function isDisabled(value, type) {
|
|
25
28
|
if (type === void 0) {
|
|
26
29
|
type = 'date';
|
|
27
30
|
}
|
|
31
|
+
|
|
28
32
|
var _instance$get = instance.get(),
|
|
29
|
-
|
|
33
|
+
disabledDate = _instance$get.disabledDate;
|
|
34
|
+
|
|
30
35
|
return isGT(value, maxDate.value, type) || isLT(value, minDate.value, type) || !!disabledDate && disabledDate(value);
|
|
31
36
|
}
|
|
37
|
+
|
|
32
38
|
function isDisabledTime(value, flag) {
|
|
33
39
|
if (!isDisabled(value, 'second')) {
|
|
34
|
-
if (!instance.get('range')) return false;
|
|
35
|
-
|
|
40
|
+
if (!instance.get('range')) return false; // compare the start and the end datetime
|
|
41
|
+
|
|
36
42
|
var anotherDatetime = instance.value.getTimeValue(flag === PanelFlags.Start ? PanelFlags.End : PanelFlags.Start);
|
|
37
43
|
if (!anotherDatetime) return false;
|
|
44
|
+
|
|
38
45
|
if (flag === PanelFlags.Start) {
|
|
39
46
|
return value.isAfter(anotherDatetime, 'second');
|
|
40
47
|
} else {
|
|
41
48
|
return value.isBefore(anotherDatetime, 'second');
|
|
42
49
|
}
|
|
43
50
|
}
|
|
51
|
+
|
|
44
52
|
return true;
|
|
45
53
|
}
|
|
54
|
+
|
|
46
55
|
function isDisabledConfirm() {
|
|
47
56
|
var lastValue = last(instance.value.value.value);
|
|
48
57
|
if (!lastValue) return true;
|
|
58
|
+
|
|
49
59
|
var _instance$get2 = instance.get(),
|
|
50
|
-
|
|
60
|
+
range = _instance$get2.range;
|
|
61
|
+
|
|
51
62
|
if (range && lastValue.length < 2) return true;
|
|
52
63
|
var _instance$panel = instance.panel,
|
|
53
|
-
|
|
54
|
-
|
|
64
|
+
startPanel = _instance$panel.startPanel,
|
|
65
|
+
endPanel = _instance$panel.endPanel;
|
|
66
|
+
|
|
55
67
|
if (startPanel.value === PanelTypes.Date && endPanel.value === PanelTypes.Date) {
|
|
56
68
|
return true;
|
|
57
69
|
}
|
|
70
|
+
|
|
58
71
|
var start;
|
|
59
72
|
var end;
|
|
73
|
+
|
|
60
74
|
if (range) {
|
|
61
75
|
start = lastValue[0];
|
|
62
76
|
end = lastValue[1];
|
|
63
77
|
} else {
|
|
64
78
|
start = lastValue;
|
|
65
79
|
}
|
|
80
|
+
|
|
66
81
|
if (isDisabledTime(start, PanelFlags.Start) || end && isDisabledTime(end, PanelFlags.End)) {
|
|
67
82
|
return true;
|
|
68
83
|
}
|
|
84
|
+
|
|
69
85
|
return false;
|
|
70
86
|
}
|
|
87
|
+
|
|
71
88
|
return {
|
|
72
89
|
isDisabled: isDisabled,
|
|
73
90
|
isDisabledTime: isDisabledTime,
|
|
@@ -3,9 +3,11 @@ import { useState } from '../../hooks/useState';
|
|
|
3
3
|
export function useFocusDate() {
|
|
4
4
|
var instance = useInstance();
|
|
5
5
|
var focusDate = useState(null);
|
|
6
|
+
|
|
6
7
|
function reset() {
|
|
7
8
|
focusDate.set(null);
|
|
8
9
|
}
|
|
10
|
+
|
|
9
11
|
instance.on('hide', reset);
|
|
10
12
|
return {
|
|
11
13
|
focusDate: focusDate,
|
|
@@ -9,32 +9,41 @@ var FORMATS = {
|
|
|
9
9
|
};
|
|
10
10
|
export function useFormats() {
|
|
11
11
|
var instance = useInstance();
|
|
12
|
+
|
|
12
13
|
function getValueFormat() {
|
|
13
14
|
var _instance$get = instance.get(),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
format = _instance$get.format,
|
|
16
|
+
valueFormat = _instance$get.valueFormat,
|
|
17
|
+
type = _instance$get.type;
|
|
18
|
+
|
|
17
19
|
return valueFormat || format || FORMATS[type];
|
|
18
20
|
}
|
|
21
|
+
|
|
19
22
|
function getShowFormat() {
|
|
20
23
|
var _instance$get2 = instance.get(),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
format = _instance$get2.format,
|
|
25
|
+
showFormat = _instance$get2.showFormat,
|
|
26
|
+
type = _instance$get2.type;
|
|
27
|
+
|
|
24
28
|
return showFormat || format || FORMATS[type];
|
|
25
29
|
}
|
|
30
|
+
|
|
26
31
|
function createDateByValueFormat(value) {
|
|
27
32
|
return dayjs(value, isString(value) ? getValueFormat() : undefined);
|
|
28
33
|
}
|
|
34
|
+
|
|
29
35
|
function createDateByShowFormat(value) {
|
|
30
36
|
return dayjs(value, getShowFormat(), true); // strict parsing
|
|
31
37
|
}
|
|
38
|
+
|
|
32
39
|
function getShowString(value) {
|
|
33
40
|
return value.format(getShowFormat());
|
|
34
41
|
}
|
|
42
|
+
|
|
35
43
|
function getValueString(value) {
|
|
36
44
|
return value.format(getValueFormat());
|
|
37
45
|
}
|
|
46
|
+
|
|
38
47
|
return {
|
|
39
48
|
getValueFormat: getValueFormat,
|
|
40
49
|
getShowFormat: getShowFormat,
|
|
@@ -1,80 +1,96 @@
|
|
|
1
1
|
import { useInstance } from 'intact-vue-next';
|
|
2
2
|
import { useKeyboard } from '../../hooks/useKeyboard';
|
|
3
3
|
var Direction;
|
|
4
|
+
|
|
4
5
|
(function (Direction) {
|
|
5
6
|
Direction[Direction["Up"] = 0] = "Up";
|
|
6
7
|
Direction[Direction["Down"] = 1] = "Down";
|
|
7
8
|
Direction[Direction["Left"] = 2] = "Left";
|
|
8
9
|
Direction[Direction["Right"] = 3] = "Right";
|
|
9
10
|
})(Direction || (Direction = {}));
|
|
11
|
+
|
|
10
12
|
export function useKeyboards(panelRef, focusDate) {
|
|
11
13
|
var instance = useInstance();
|
|
14
|
+
|
|
12
15
|
var _useKeyboard = useKeyboard({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
down: function down(e) {
|
|
17
|
+
focus(e, Direction.Down);
|
|
18
|
+
},
|
|
19
|
+
up: function up(e) {
|
|
20
|
+
focus(e, Direction.Up);
|
|
21
|
+
},
|
|
22
|
+
right: function right(e) {
|
|
23
|
+
focus(e, Direction.Right);
|
|
24
|
+
},
|
|
25
|
+
left: function left(e) {
|
|
26
|
+
focus(e, Direction.Left);
|
|
27
|
+
},
|
|
28
|
+
enter: function enter() {
|
|
29
|
+
select(focusDate.value);
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
add = _useKeyboard[0],
|
|
33
|
+
remove = _useKeyboard[1];
|
|
34
|
+
|
|
31
35
|
instance.on('show', add);
|
|
32
36
|
instance.on('hide', remove);
|
|
37
|
+
|
|
33
38
|
function select(date) {
|
|
34
39
|
if (!date) return;
|
|
35
40
|
var calendar = panelRef.value;
|
|
36
41
|
if (!calendar) return; // maybe select time
|
|
42
|
+
|
|
37
43
|
switch (calendar.type.value) {
|
|
38
44
|
case 'date':
|
|
39
45
|
calendar.days.onClick(date);
|
|
40
46
|
break;
|
|
47
|
+
|
|
41
48
|
case 'month':
|
|
42
49
|
calendar.months.onClick(date);
|
|
43
50
|
break;
|
|
51
|
+
|
|
44
52
|
case 'year':
|
|
45
53
|
calendar.years.onClick(date);
|
|
46
54
|
break;
|
|
47
55
|
}
|
|
48
56
|
}
|
|
57
|
+
|
|
49
58
|
function focus(e, direction) {
|
|
50
59
|
var calendar = panelRef.value;
|
|
51
60
|
if (!calendar) return;
|
|
52
61
|
e.preventDefault();
|
|
62
|
+
|
|
53
63
|
if (!focusDate.value) {
|
|
54
64
|
focusDate.set(calendar.showDate.date.value);
|
|
55
65
|
return;
|
|
56
66
|
}
|
|
67
|
+
|
|
57
68
|
var type = calendar.type.value;
|
|
58
69
|
var upAndDownOffset = type === 'date' ? 7 : 4;
|
|
59
70
|
var offset;
|
|
71
|
+
|
|
60
72
|
switch (direction) {
|
|
61
73
|
case Direction.Up:
|
|
62
74
|
offset = -upAndDownOffset;
|
|
63
75
|
break;
|
|
76
|
+
|
|
64
77
|
case Direction.Down:
|
|
65
78
|
offset = upAndDownOffset;
|
|
66
79
|
break;
|
|
80
|
+
|
|
67
81
|
case Direction.Left:
|
|
68
82
|
offset = -1;
|
|
69
83
|
break;
|
|
84
|
+
|
|
70
85
|
case Direction.Right:
|
|
71
86
|
offset = 1;
|
|
72
87
|
break;
|
|
73
88
|
}
|
|
89
|
+
|
|
74
90
|
var _focusDate = focusDate.value;
|
|
75
91
|
_focusDate = _focusDate.add(offset, type === 'date' ? 'day' : type);
|
|
76
|
-
focusDate.set(_focusDate);
|
|
77
|
-
|
|
92
|
+
focusDate.set(_focusDate); // change panel show date
|
|
93
|
+
|
|
78
94
|
calendar.showDate.date.set(_focusDate);
|
|
79
95
|
}
|
|
80
96
|
}
|
|
@@ -4,10 +4,12 @@ import { isEqual } from './helpers';
|
|
|
4
4
|
import { _$ } from '../../i18n';
|
|
5
5
|
export function useMonths(showDate, status, focusDate) {
|
|
6
6
|
var instance = useInstance();
|
|
7
|
+
|
|
7
8
|
function getMonths(now) {
|
|
8
9
|
var ret = [];
|
|
9
10
|
var start = showDate.value.toDate();
|
|
10
11
|
start.setMonth(0);
|
|
12
|
+
|
|
11
13
|
for (var i = 0; i < 12; i++) {
|
|
12
14
|
var dayjsDate = dayjs(start);
|
|
13
15
|
ret.push({
|
|
@@ -21,17 +23,21 @@ export function useMonths(showDate, status, focusDate) {
|
|
|
21
23
|
});
|
|
22
24
|
start.setMonth(i + 1);
|
|
23
25
|
}
|
|
26
|
+
|
|
24
27
|
return ret;
|
|
25
28
|
}
|
|
29
|
+
|
|
26
30
|
function onClick(date) {
|
|
27
31
|
showDate.set(date);
|
|
28
32
|
var datepickerType = instance.datepicker.get('type');
|
|
33
|
+
|
|
29
34
|
if (datepickerType !== 'month' && datepickerType !== 'year') {
|
|
30
35
|
instance.type.set('date');
|
|
31
36
|
} else {
|
|
32
37
|
instance.triggerChange(date);
|
|
33
38
|
}
|
|
34
39
|
}
|
|
40
|
+
|
|
35
41
|
return {
|
|
36
42
|
getMonths: getMonths,
|
|
37
43
|
onClick: onClick
|