@king-design/vue 2.1.4 → 2.1.6
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 +2 -2
- 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,12 +8,14 @@ import { __decorate } from "tslib";
|
|
|
8
8
|
/**
|
|
9
9
|
* The base hook for handling value of Datepicker and Timepicker
|
|
10
10
|
*/
|
|
11
|
+
|
|
11
12
|
import { useInstance } from 'intact-vue-next';
|
|
12
13
|
import { useState, watchState } from '../../hooks/useState';
|
|
13
14
|
import dayjs from './dayjs';
|
|
14
15
|
import { findValueIndex } from './helpers';
|
|
15
16
|
import { isEqualArray, last, bind } from '../utils';
|
|
16
17
|
import { BaseSelect } from '../select/base';
|
|
18
|
+
|
|
17
19
|
var typeDefs = _extends({}, BaseSelect.typeDefs, {
|
|
18
20
|
value: [String, Array, Date, Number, dayjs.Dayjs],
|
|
19
21
|
range: Boolean,
|
|
@@ -24,42 +26,52 @@ var typeDefs = _extends({}, BaseSelect.typeDefs, {
|
|
|
24
26
|
max: [String, Date, Number, dayjs.Dayjs],
|
|
25
27
|
disabledDate: Function
|
|
26
28
|
});
|
|
29
|
+
|
|
27
30
|
var defaults = function defaults() {
|
|
28
31
|
return _extends({}, BaseSelect.defaults(), {
|
|
29
32
|
filterable: true
|
|
30
33
|
});
|
|
31
34
|
};
|
|
35
|
+
|
|
32
36
|
var events = _extends({}, BaseSelect.events, {
|
|
33
37
|
selecting: true
|
|
34
38
|
});
|
|
39
|
+
|
|
35
40
|
export var BasePicker = /*#__PURE__*/function (_BaseSelect) {
|
|
36
41
|
_inheritsLoose(BasePicker, _BaseSelect);
|
|
42
|
+
|
|
37
43
|
function BasePicker() {
|
|
38
44
|
return _BaseSelect.apply(this, arguments) || this;
|
|
39
45
|
}
|
|
46
|
+
|
|
40
47
|
var _proto = BasePicker.prototype;
|
|
48
|
+
|
|
41
49
|
_proto.resetKeywords = function resetKeywords(keywords) {
|
|
42
50
|
var _this$get = this.get(),
|
|
43
|
-
|
|
44
|
-
|
|
51
|
+
multiple = _this$get.multiple,
|
|
52
|
+
range = _this$get.range;
|
|
53
|
+
|
|
45
54
|
var dayjsValue = this.value.getDayjsValue();
|
|
46
55
|
var getShowString = this.formats.getShowString;
|
|
47
56
|
var value = last(dayjsValue);
|
|
48
57
|
keywords.set(multiple ? '' : !range ? value ? getShowString(value) : '' : value ? [getShowString(value[0]), getShowString(value[1])].join(' ~ ') : '');
|
|
49
58
|
};
|
|
59
|
+
|
|
50
60
|
return BasePicker;
|
|
51
61
|
}(BaseSelect);
|
|
52
62
|
BasePicker.typeDefs = typeDefs;
|
|
53
63
|
BasePicker.defaults = defaults;
|
|
54
64
|
BasePicker.events = events;
|
|
65
|
+
|
|
55
66
|
__decorate([bind], BasePicker.prototype, "resetKeywords", null);
|
|
67
|
+
|
|
56
68
|
export function useValue(_ref, _ref2, panel, shouldUpdateValue, updateValueOnInput, getEqualType, updateStateValue) {
|
|
57
69
|
var createDateByValueFormat = _ref.createDateByValueFormat,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
70
|
+
createDateByShowFormat = _ref.createDateByShowFormat,
|
|
71
|
+
getShowString = _ref.getShowString,
|
|
72
|
+
getValueString = _ref.getValueString;
|
|
61
73
|
var isDisabled = _ref2.isDisabled,
|
|
62
|
-
|
|
74
|
+
minDate = _ref2.minDate;
|
|
63
75
|
// Normalize the value to multipe values, no matter it's multipe or not
|
|
64
76
|
var value = useState([]);
|
|
65
77
|
var instance = useInstance();
|
|
@@ -67,106 +79,138 @@ export function useValue(_ref, _ref2, panel, shouldUpdateValue, updateValueOnInp
|
|
|
67
79
|
instance.watch('value', function (newValue, oldValue) {
|
|
68
80
|
if (isEqualArray(newValue, oldValue)) return;
|
|
69
81
|
dayjsValue = convertToDayjs(newValue);
|
|
70
|
-
updateStateValue(dayjsValue, value);
|
|
71
|
-
|
|
82
|
+
updateStateValue(dayjsValue, value); // should update keywords
|
|
83
|
+
|
|
72
84
|
instance.resetKeywords(instance.input.keywords);
|
|
73
85
|
});
|
|
74
86
|
watchState(instance.input.keywords, function (v) {
|
|
75
87
|
var _instance$get = instance.get(),
|
|
76
|
-
|
|
77
|
-
|
|
88
|
+
range = _instance$get.range,
|
|
89
|
+
multiple = _instance$get.multiple;
|
|
90
|
+
|
|
78
91
|
if (!multiple && v === '') return instance.set('value', null);
|
|
92
|
+
|
|
79
93
|
if (range) {
|
|
80
94
|
var _context;
|
|
95
|
+
|
|
81
96
|
var _v$split$map = _mapInstanceProperty(_context = v.split(/\s*~\s*/)).call(_context, function (s) {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
97
|
+
return _trimInstanceProperty(s).call(s);
|
|
98
|
+
}),
|
|
99
|
+
start = _v$split$map[0],
|
|
100
|
+
end = _v$split$map[1];
|
|
101
|
+
|
|
86
102
|
if (start && end) {
|
|
87
103
|
var startDate = createDateByShowFormat(start);
|
|
104
|
+
|
|
88
105
|
if (!isValidDate(startDate)) {
|
|
89
106
|
return;
|
|
90
107
|
}
|
|
108
|
+
|
|
91
109
|
var endDate = createDateByShowFormat(end);
|
|
110
|
+
|
|
92
111
|
if (!isValidDate(endDate)) {
|
|
93
112
|
return;
|
|
94
113
|
}
|
|
114
|
+
|
|
95
115
|
if (endDate.isAfter(startDate)) {
|
|
96
116
|
updateValueOnInput([startDate, endDate]);
|
|
97
117
|
}
|
|
98
118
|
}
|
|
99
119
|
} else {
|
|
100
120
|
var date = createDateByShowFormat(v);
|
|
121
|
+
|
|
101
122
|
if (isValidDate(date)) {
|
|
102
123
|
updateValueOnInput(date);
|
|
103
124
|
}
|
|
104
125
|
}
|
|
105
126
|
});
|
|
127
|
+
|
|
106
128
|
function convertToDayjs(v) {
|
|
107
129
|
if (!v || Array.isArray(v) && !v.length) return [];
|
|
130
|
+
|
|
108
131
|
var _instance$get2 = instance.get(),
|
|
109
|
-
|
|
132
|
+
multiple = _instance$get2.multiple;
|
|
133
|
+
|
|
110
134
|
if (!multiple) {
|
|
111
135
|
v = [v];
|
|
112
136
|
}
|
|
137
|
+
|
|
113
138
|
return _mapInstanceProperty(v).call(v, function (value) {
|
|
114
139
|
if (Array.isArray(value)) {
|
|
115
140
|
// range
|
|
116
141
|
return _mapInstanceProperty(value).call(value, createDateByValueFormat);
|
|
117
142
|
}
|
|
143
|
+
|
|
118
144
|
return createDateByValueFormat(value);
|
|
119
145
|
});
|
|
120
146
|
}
|
|
147
|
+
|
|
121
148
|
function convertToValueString(v) {
|
|
122
149
|
var results = _mapInstanceProperty(v).call(v, function (value) {
|
|
123
150
|
if (Array.isArray(value)) {
|
|
124
151
|
return _mapInstanceProperty(value).call(value, getValueString);
|
|
125
152
|
}
|
|
153
|
+
|
|
126
154
|
return getValueString(value);
|
|
127
155
|
});
|
|
156
|
+
|
|
128
157
|
if (!instance.get('multiple')) {
|
|
129
158
|
return results[0] || null;
|
|
130
159
|
}
|
|
160
|
+
|
|
131
161
|
return results;
|
|
132
162
|
}
|
|
163
|
+
|
|
133
164
|
function format() {
|
|
134
165
|
var results = _mapInstanceProperty(dayjsValue).call(dayjsValue, function (value) {
|
|
135
166
|
if (Array.isArray(value)) {
|
|
136
167
|
return _mapInstanceProperty(value).call(value, getShowString).join(' ~ ');
|
|
137
168
|
}
|
|
169
|
+
|
|
138
170
|
return getShowString(value);
|
|
139
171
|
});
|
|
172
|
+
|
|
140
173
|
if (!instance.get('multiple')) {
|
|
141
174
|
return results[0];
|
|
142
175
|
}
|
|
176
|
+
|
|
143
177
|
return results;
|
|
144
178
|
}
|
|
179
|
+
|
|
145
180
|
function setSingleDate(v, fromInput) {
|
|
146
181
|
var _instance$get3 = instance.get(),
|
|
147
|
-
|
|
182
|
+
range = _instance$get3.range;
|
|
183
|
+
|
|
148
184
|
value.set([v]);
|
|
185
|
+
|
|
149
186
|
if (fromInput || shouldUpdateValue(v)) {
|
|
150
187
|
updateValue();
|
|
151
188
|
}
|
|
152
189
|
}
|
|
190
|
+
|
|
153
191
|
function addMultipeDate(v, fromInput) {
|
|
154
192
|
var _instance$get4 = instance.get(),
|
|
155
|
-
|
|
193
|
+
range = _instance$get4.range;
|
|
194
|
+
|
|
156
195
|
var _value = value.value;
|
|
157
196
|
_value = !_value ? [] : _sliceInstanceProperty(_value).call(_value);
|
|
197
|
+
|
|
158
198
|
if (range && v.length === 2) {
|
|
159
199
|
// pop the last value firstly, if it only has the start date
|
|
160
200
|
var lastValue = last(_value);
|
|
201
|
+
|
|
161
202
|
if (lastValue && lastValue.length < 2) {
|
|
162
203
|
_value.pop();
|
|
163
204
|
}
|
|
164
205
|
}
|
|
206
|
+
|
|
165
207
|
var _shouldUpdateValue = true;
|
|
208
|
+
|
|
166
209
|
if (fromInput || shouldUpdateValue(v)) {
|
|
167
210
|
// if select the date/year/month, then toggle the value.
|
|
168
211
|
// if from input, treat the value as the final value
|
|
169
212
|
var index = findValueIndex(_value, v, getEqualType());
|
|
213
|
+
|
|
170
214
|
if (index > -1) {
|
|
171
215
|
_spliceInstanceProperty(_value).call(_value, index, 1);
|
|
172
216
|
} else {
|
|
@@ -176,27 +220,34 @@ export function useValue(_ref, _ref2, panel, shouldUpdateValue, updateValueOnInp
|
|
|
176
220
|
// select the datetime, only push the value,
|
|
177
221
|
// and unique the array on click confrim button
|
|
178
222
|
_value.push(v);
|
|
223
|
+
|
|
179
224
|
_shouldUpdateValue = false;
|
|
180
225
|
}
|
|
226
|
+
|
|
181
227
|
value.set(_value);
|
|
228
|
+
|
|
182
229
|
if (_shouldUpdateValue) {
|
|
183
230
|
updateValue();
|
|
184
231
|
}
|
|
185
232
|
}
|
|
233
|
+
|
|
186
234
|
function setValue(v, fromInput) {
|
|
187
235
|
var multiple = instance.get('multiple');
|
|
236
|
+
|
|
188
237
|
if (multiple) {
|
|
189
238
|
addMultipeDate(v, fromInput);
|
|
190
239
|
} else {
|
|
191
240
|
setSingleDate(v, fromInput);
|
|
192
241
|
}
|
|
193
242
|
}
|
|
243
|
+
|
|
194
244
|
function updateValue() {
|
|
195
245
|
var _value = value.value;
|
|
196
246
|
var valueStr = convertToValueString(_value);
|
|
197
247
|
instance.set('value', valueStr);
|
|
198
248
|
instance.resetKeywords(instance.input.keywords);
|
|
199
249
|
}
|
|
250
|
+
|
|
200
251
|
function onConfirm() {
|
|
201
252
|
// unique
|
|
202
253
|
if (!instance.get('multiple')) {
|
|
@@ -205,57 +256,76 @@ export function useValue(_ref, _ref2, panel, shouldUpdateValue, updateValueOnInp
|
|
|
205
256
|
unique();
|
|
206
257
|
panel.reset();
|
|
207
258
|
}
|
|
259
|
+
|
|
208
260
|
updateValue();
|
|
209
261
|
}
|
|
262
|
+
|
|
210
263
|
function unique() {
|
|
211
264
|
var _value = value.value;
|
|
212
265
|
var map = {};
|
|
213
266
|
var results = [];
|
|
267
|
+
|
|
214
268
|
_value.forEach(function (value) {
|
|
215
269
|
var key;
|
|
270
|
+
|
|
216
271
|
if (Array.isArray(value)) {
|
|
217
272
|
key = _mapInstanceProperty(value).call(value, getValueString).join(' ~ ');
|
|
218
273
|
} else {
|
|
219
274
|
key = getValueString(value);
|
|
220
275
|
}
|
|
276
|
+
|
|
221
277
|
if (!map[key]) {
|
|
222
278
|
map[key] = true;
|
|
223
279
|
results.push(value);
|
|
224
280
|
}
|
|
225
281
|
});
|
|
282
|
+
|
|
226
283
|
value.set(results);
|
|
227
284
|
}
|
|
285
|
+
|
|
228
286
|
function isValidDate(date) {
|
|
229
287
|
return date.isValid() && !isDisabled(date, getEqualType());
|
|
230
288
|
}
|
|
289
|
+
|
|
231
290
|
function onChangeTime(date, flag) {
|
|
232
291
|
var _context2;
|
|
292
|
+
|
|
233
293
|
var _instance$get5 = instance.get(),
|
|
234
|
-
|
|
294
|
+
range = _instance$get5.range;
|
|
295
|
+
|
|
235
296
|
var values = _sliceInstanceProperty(_context2 = value.value).call(_context2);
|
|
297
|
+
|
|
236
298
|
var lastIndex = values.length - 1;
|
|
237
299
|
var _value = date;
|
|
300
|
+
|
|
238
301
|
if (range) {
|
|
239
302
|
var _context3;
|
|
303
|
+
|
|
240
304
|
_value = _sliceInstanceProperty(_context3 = values[lastIndex]).call(_context3);
|
|
241
305
|
_value[flag] = date;
|
|
242
306
|
instance.trigger('selecting', _value);
|
|
243
307
|
}
|
|
308
|
+
|
|
244
309
|
values[lastIndex] = _value;
|
|
245
310
|
value.set(values);
|
|
246
311
|
}
|
|
312
|
+
|
|
247
313
|
function getTimeValue(flag) {
|
|
248
314
|
var _value = value.value;
|
|
249
315
|
if (!_value.length) return null;
|
|
316
|
+
|
|
250
317
|
var _instance$get6 = instance.get(),
|
|
251
|
-
|
|
252
|
-
|
|
318
|
+
range = _instance$get6.range,
|
|
319
|
+
min = _instance$get6.min;
|
|
320
|
+
|
|
253
321
|
var lastValue = last(_value);
|
|
254
322
|
return range ? lastValue[flag] : lastValue;
|
|
255
323
|
}
|
|
324
|
+
|
|
256
325
|
function getDayjsValue() {
|
|
257
326
|
return dayjsValue;
|
|
258
327
|
}
|
|
328
|
+
|
|
259
329
|
return {
|
|
260
330
|
value: value,
|
|
261
331
|
format: format,
|
|
@@ -12,19 +12,25 @@ import { bind } from '../utils';
|
|
|
12
12
|
import { useYears } from './useYears';
|
|
13
13
|
import { useMonths } from './useMonths';
|
|
14
14
|
import { useStatus } from './useStatus';
|
|
15
|
+
|
|
15
16
|
var defaults = function defaults() {
|
|
16
17
|
return {
|
|
17
18
|
type: 'date'
|
|
18
19
|
};
|
|
19
20
|
};
|
|
21
|
+
|
|
20
22
|
export var DatepickerCalendar = /*#__PURE__*/function (_Component) {
|
|
21
23
|
_inheritsLoose(DatepickerCalendar, _Component);
|
|
24
|
+
|
|
22
25
|
function DatepickerCalendar() {
|
|
23
26
|
var _context;
|
|
27
|
+
|
|
24
28
|
var _this;
|
|
29
|
+
|
|
25
30
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
31
|
args[_key] = arguments[_key];
|
|
27
32
|
}
|
|
33
|
+
|
|
28
34
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
29
35
|
_this.type = useType(_assertThisInitialized(_this));
|
|
30
36
|
_this.datepicker = inject(DATEPICKER);
|
|
@@ -35,15 +41,20 @@ export var DatepickerCalendar = /*#__PURE__*/function (_Component) {
|
|
|
35
41
|
_this.months = useMonths(_this.showDate.date, _this.status, _this.datepicker.focusDate.focusDate);
|
|
36
42
|
return _this;
|
|
37
43
|
}
|
|
44
|
+
|
|
38
45
|
var _proto = DatepickerCalendar.prototype;
|
|
46
|
+
|
|
39
47
|
_proto.triggerChange = function triggerChange(value) {
|
|
40
48
|
this.trigger('change', value, this.get('flag'));
|
|
41
49
|
};
|
|
50
|
+
|
|
42
51
|
return DatepickerCalendar;
|
|
43
52
|
}(Component);
|
|
44
53
|
DatepickerCalendar.template = template;
|
|
45
54
|
DatepickerCalendar.defaults = defaults;
|
|
55
|
+
|
|
46
56
|
__decorate([bind], DatepickerCalendar.prototype, "triggerChange", null);
|
|
57
|
+
|
|
47
58
|
function useType(instance) {
|
|
48
59
|
var type = useState('date');
|
|
49
60
|
instance.on('$receive:type', function (v) {
|
|
@@ -31,6 +31,7 @@ var _$tmp5 = {
|
|
|
31
31
|
};
|
|
32
32
|
export default function ($props, $blocks, $__proto__) {
|
|
33
33
|
var _classNameObj;
|
|
34
|
+
|
|
34
35
|
$blocks || ($blocks = {});
|
|
35
36
|
$props || ($props = {});
|
|
36
37
|
var $this = this;
|
|
@@ -42,8 +43,9 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
42
43
|
}, _classNameObj[makeCalendarStyles()] = true, _classNameObj);
|
|
43
44
|
var now = getNowDate();
|
|
44
45
|
var _this$datepicker$focu = this.datepicker.focusDate,
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
focusDate = _this$datepicker$focu.focusDate,
|
|
47
|
+
resetFocusDate = _this$datepicker$focu.reset;
|
|
48
|
+
|
|
47
49
|
var getItems = function getItems(data, onClick) {
|
|
48
50
|
return _$ma(data, function ($value, $key) {
|
|
49
51
|
return _$ce(2, 'div', _$ce(2, 'div', $value.label, 0, 'k-value'), 2, _$cn({
|
|
@@ -65,17 +67,18 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
65
67
|
});
|
|
66
68
|
}, $this);
|
|
67
69
|
};
|
|
70
|
+
|
|
68
71
|
var _this$days = this.days,
|
|
69
|
-
|
|
70
|
-
|
|
72
|
+
getDays = _this$days.getDays,
|
|
73
|
+
onClickDay = _this$days.onClick;
|
|
71
74
|
var _this$showDate = this.showDate,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
getDateLabel = _this$showDate.getDateLabel,
|
|
76
|
+
prevMonth = _this$showDate.prevMonth,
|
|
77
|
+
nextMonth = _this$showDate.nextMonth,
|
|
78
|
+
prevYear = _this$showDate.prevYear,
|
|
79
|
+
nextYear = _this$showDate.nextYear,
|
|
80
|
+
prevTenYears = _this$showDate.prevTenYears,
|
|
81
|
+
nextTenYears = _this$showDate.nextTenYears;
|
|
79
82
|
return _$ce(2, 'div', [_$ce(2, 'div', [_$ce(2, 'div', [_$cc(Button, {
|
|
80
83
|
'icon': true,
|
|
81
84
|
'type': 'none',
|
|
@@ -24,40 +24,52 @@ export function isEqual(a, b, type) {
|
|
|
24
24
|
if (type === void 0) {
|
|
25
25
|
type = 'date';
|
|
26
26
|
}
|
|
27
|
+
|
|
27
28
|
if (a && b) {
|
|
28
29
|
return a.isSame(b, type);
|
|
29
30
|
}
|
|
31
|
+
|
|
30
32
|
return false;
|
|
31
33
|
}
|
|
32
34
|
export function isLT(a, b, type) {
|
|
33
35
|
if (type === void 0) {
|
|
34
36
|
type = 'date';
|
|
35
37
|
}
|
|
38
|
+
|
|
36
39
|
if (a && b) {
|
|
37
40
|
return a.isBefore(b, type);
|
|
38
41
|
}
|
|
42
|
+
|
|
39
43
|
return false;
|
|
40
44
|
}
|
|
41
45
|
export function isGT(a, b, type) {
|
|
42
46
|
if (type === void 0) {
|
|
43
47
|
type = 'date';
|
|
44
48
|
}
|
|
49
|
+
|
|
45
50
|
return isLT(b, a, type);
|
|
46
51
|
}
|
|
47
52
|
export function createDate(date) {
|
|
48
53
|
if (typeof date === 'string') {
|
|
49
54
|
var _context;
|
|
55
|
+
|
|
50
56
|
var _date$split = date.split(' '),
|
|
51
|
-
|
|
52
|
-
|
|
57
|
+
dateString = _date$split[0],
|
|
58
|
+
timeString = _date$split[1];
|
|
59
|
+
|
|
53
60
|
var args = _mapInstanceProperty(_context = dateString.split('-')).call(_context, Number);
|
|
61
|
+
|
|
54
62
|
args[1] = args[1] - 1;
|
|
63
|
+
|
|
55
64
|
if (timeString) {
|
|
56
65
|
var _context2;
|
|
66
|
+
|
|
57
67
|
args.push.apply(args, _mapInstanceProperty(_context2 = timeString.split(':')).call(_context2, Number));
|
|
58
68
|
}
|
|
69
|
+
|
|
59
70
|
return _construct(Date, args);
|
|
60
71
|
}
|
|
72
|
+
|
|
61
73
|
if (!date) return new Date();
|
|
62
74
|
return new Date(date);
|
|
63
75
|
}
|
|
@@ -66,7 +78,7 @@ export function findValueIndex(values, value, type) {
|
|
|
66
78
|
if (Array.isArray(item)) {
|
|
67
79
|
// is multipe range values
|
|
68
80
|
var start = value[0],
|
|
69
|
-
|
|
81
|
+
end = value[1];
|
|
70
82
|
return isEqual(item[0], start, type) && isEqual(item[1], end, type);
|
|
71
83
|
} else {
|
|
72
84
|
return isEqual(value, item, type);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TypeDefs } from 'intact-vue-next';
|
|
2
|
+
import dayjs from './dayjs';
|
|
3
|
+
import { State } from '../../hooks/useState';
|
|
4
|
+
import { Shortcut } from './shortcuts';
|
|
5
|
+
import { BasePicker, BasePickerProps, BasePickerEvents, BasePickerBlocks, Value } from './basepicker';
|
|
6
|
+
export * as shortcuts from './shortcuts';
|
|
7
|
+
export interface DatepickerProps<V extends Value = Value, M extends boolean = boolean, R extends boolean = boolean> extends BasePickerProps<V extends string ? V : V | string, M, R> {
|
|
8
|
+
type?: 'date' | 'datetime' | 'year' | 'month';
|
|
9
|
+
shortcuts?: Shortcut[];
|
|
10
|
+
}
|
|
11
|
+
export interface DatepickerEvents extends BasePickerEvents {
|
|
12
|
+
}
|
|
13
|
+
export interface DatepickerBlocks<V extends Value = Value, R extends boolean = boolean> extends BasePickerBlocks<V, R> {
|
|
14
|
+
}
|
|
15
|
+
export declare class Datepicker<V extends Value = Value, M extends boolean = false, R extends boolean = false> extends BasePicker<DatepickerProps<V, M, R>, DatepickerEvents, DatepickerBlocks<V, R>> {
|
|
16
|
+
static template: string | import("intact").Template<any>;
|
|
17
|
+
static typeDefs: Required<TypeDefs<DatepickerProps<Value, boolean, boolean>>>;
|
|
18
|
+
static defaults: () => Partial<DatepickerProps<Value, boolean, boolean>>;
|
|
19
|
+
formats: {
|
|
20
|
+
getValueFormat: () => string;
|
|
21
|
+
getShowFormat: () => string;
|
|
22
|
+
createDateByValueFormat: (value: Value) => dayjs.Dayjs;
|
|
23
|
+
createDateByShowFormat: (value: string) => dayjs.Dayjs;
|
|
24
|
+
getShowString: (value: dayjs.Dayjs) => string;
|
|
25
|
+
getValueString: (value: dayjs.Dayjs) => string;
|
|
26
|
+
};
|
|
27
|
+
disabled: {
|
|
28
|
+
isDisabled: (value: dayjs.Dayjs, type?: dayjs.OpUnitType) => boolean;
|
|
29
|
+
isDisabledTime: (value: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => boolean;
|
|
30
|
+
isDisabledConfirm: () => boolean;
|
|
31
|
+
maxDate: State<dayjs.Dayjs | null>;
|
|
32
|
+
minDate: State<dayjs.Dayjs | null>;
|
|
33
|
+
};
|
|
34
|
+
panel: {
|
|
35
|
+
startPanel: State<import("./usePanel").PanelTypes>;
|
|
36
|
+
endPanel: State<import("./usePanel").PanelTypes>;
|
|
37
|
+
changePanel: (type: import("./usePanel").PanelTypes, flag?: import("./usePanel").PanelFlags) => void;
|
|
38
|
+
getPanel: (flag: import("./usePanel").PanelFlags) => State<import("./usePanel").PanelTypes>;
|
|
39
|
+
reset: () => void;
|
|
40
|
+
startRef: import("intact").RefObject<import("./calendar").DatepickerCalendar>;
|
|
41
|
+
endRef: import("intact").RefObject<import("./calendar").DatepickerCalendar>;
|
|
42
|
+
};
|
|
43
|
+
focusDate: {
|
|
44
|
+
focusDate: State<dayjs.Dayjs | null>;
|
|
45
|
+
reset: () => void;
|
|
46
|
+
};
|
|
47
|
+
value: {
|
|
48
|
+
format: () => string | string[];
|
|
49
|
+
onConfirm: () => void;
|
|
50
|
+
onChangeTime: (date: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
51
|
+
getTimeValue: (flag: import("./usePanel").PanelFlags) => dayjs.Dayjs | null | undefined;
|
|
52
|
+
convertToDayjs: (v: Value | [Value, Value] | Value[] | [Value, Value][] | null | undefined) => import("./basepicker").DayjsValue;
|
|
53
|
+
getDayjsValue: () => import("./basepicker").DayjsValue;
|
|
54
|
+
value: State<import("./basepicker").StateValue>;
|
|
55
|
+
setValue: (v: import("./basepicker").StateValueItem, fromInput: boolean) => void;
|
|
56
|
+
onChangeDate: (v: dayjs.Dayjs, flag: import("./usePanel").PanelFlags) => void;
|
|
57
|
+
};
|
|
58
|
+
init(): void;
|
|
59
|
+
protected getPlaceholder(): string | number | boolean | import("misstime/dist/utils/types").VNode<any> | import("intact").Children[];
|
|
60
|
+
protected getLabel(): string | string[];
|
|
61
|
+
protected clear(e: MouseEvent): void;
|
|
62
|
+
private setByShortcut;
|
|
63
|
+
}
|
|
@@ -17,23 +17,30 @@ import { useKeyboards } from './useKeyboards';
|
|
|
17
17
|
import { BasePicker } from './basepicker';
|
|
18
18
|
import * as _shortcuts from './shortcuts';
|
|
19
19
|
export { _shortcuts as shortcuts };
|
|
20
|
+
|
|
20
21
|
var typeDefs = _extends({}, BasePicker.typeDefs, {
|
|
21
22
|
type: ['date', 'datetime', 'year', 'month'],
|
|
22
23
|
shortcuts: Array
|
|
23
24
|
});
|
|
25
|
+
|
|
24
26
|
var defaults = function defaults() {
|
|
25
27
|
return _extends({}, BasePicker.defaults(), {
|
|
26
28
|
type: 'date'
|
|
27
29
|
});
|
|
28
30
|
};
|
|
31
|
+
|
|
29
32
|
export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
30
33
|
_inheritsLoose(Datepicker, _BasePicker);
|
|
34
|
+
|
|
31
35
|
function Datepicker() {
|
|
32
36
|
var _context;
|
|
37
|
+
|
|
33
38
|
var _this;
|
|
39
|
+
|
|
34
40
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
35
41
|
args[_key] = arguments[_key];
|
|
36
42
|
}
|
|
43
|
+
|
|
37
44
|
_this = _BasePicker.call.apply(_BasePicker, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
38
45
|
_this.formats = useFormats();
|
|
39
46
|
_this.disabled = useDisabled(_this.formats);
|
|
@@ -42,54 +49,73 @@ export var Datepicker = /*#__PURE__*/function (_BasePicker) {
|
|
|
42
49
|
_this.value = useValue(_this.formats, _this.disabled, _this.panel);
|
|
43
50
|
return _this;
|
|
44
51
|
}
|
|
52
|
+
|
|
45
53
|
var _proto = Datepicker.prototype;
|
|
54
|
+
|
|
46
55
|
_proto.init = function init() {
|
|
47
56
|
_BasePicker.prototype.init.call(this);
|
|
57
|
+
|
|
48
58
|
provide(DATEPICKER, this);
|
|
49
59
|
useKeyboards(this.panel.startRef, this.focusDate.focusDate);
|
|
50
60
|
};
|
|
61
|
+
|
|
51
62
|
_proto.getPlaceholder = function getPlaceholder() {
|
|
52
63
|
var _this$get = this.get(),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
64
|
+
placeholder = _this$get.placeholder,
|
|
65
|
+
type = _this$get.type,
|
|
66
|
+
range = _this$get.range;
|
|
67
|
+
|
|
56
68
|
if (!isNullOrUndefined(placeholder)) return placeholder;
|
|
69
|
+
|
|
57
70
|
switch (type) {
|
|
58
71
|
case 'datetime':
|
|
59
72
|
return range ? _$('开始时间 ~ 结束时间') : _$('请选择日期和时间');
|
|
73
|
+
|
|
60
74
|
case 'year':
|
|
61
75
|
return _$('请选择年份');
|
|
76
|
+
|
|
62
77
|
case 'month':
|
|
63
78
|
return _$('请选择月份');
|
|
79
|
+
|
|
64
80
|
default:
|
|
65
81
|
return range ? _$('开始日期 ~ 结束日期') : _$('请选择日期');
|
|
66
82
|
}
|
|
67
83
|
};
|
|
84
|
+
|
|
68
85
|
_proto.getLabel = function getLabel() {
|
|
69
86
|
return this.value.format();
|
|
70
87
|
};
|
|
88
|
+
|
|
71
89
|
_proto.clear = function clear(e) {
|
|
72
90
|
_BasePicker.prototype.clear.call(this, e);
|
|
91
|
+
|
|
73
92
|
if (this.get('type') === 'datetime') {
|
|
74
93
|
// reset the state to let user re-select
|
|
75
94
|
this.panel.reset();
|
|
76
95
|
}
|
|
77
96
|
};
|
|
97
|
+
|
|
78
98
|
_proto.setByShortcut = function setByShortcut(shortcut) {
|
|
79
99
|
var _this$value = this.value,
|
|
80
|
-
|
|
81
|
-
|
|
100
|
+
setValue = _this$value.setValue,
|
|
101
|
+
convertToDayjs = _this$value.convertToDayjs;
|
|
102
|
+
|
|
82
103
|
var _this$get2 = this.get(),
|
|
83
|
-
|
|
104
|
+
multiple = _this$get2.multiple;
|
|
105
|
+
|
|
84
106
|
setValue(convertToDayjs(shortcut.value())[0], true);
|
|
107
|
+
|
|
85
108
|
if (!multiple) {
|
|
86
109
|
this.hide();
|
|
87
110
|
}
|
|
88
111
|
};
|
|
112
|
+
|
|
89
113
|
return Datepicker;
|
|
90
114
|
}(BasePicker);
|
|
91
115
|
Datepicker.template = template;
|
|
92
116
|
Datepicker.typeDefs = typeDefs;
|
|
93
117
|
Datepicker.defaults = defaults;
|
|
118
|
+
|
|
94
119
|
__decorate([bind], Datepicker.prototype, "clear", null);
|
|
120
|
+
|
|
95
121
|
__decorate([bind], Datepicker.prototype, "setByShortcut", null);
|