@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
|
@@ -10,29 +10,37 @@ var defaults = {
|
|
|
10
10
|
dragLinesSize: '1px',
|
|
11
11
|
dragLinesCount: 5,
|
|
12
12
|
dragLiensGutter: 5,
|
|
13
|
+
|
|
13
14
|
get bgColor() {
|
|
14
15
|
return theme.color.bg;
|
|
15
16
|
},
|
|
17
|
+
|
|
16
18
|
get baseBorder() {
|
|
17
19
|
return "1px solid " + theme.color.border;
|
|
18
20
|
},
|
|
21
|
+
|
|
19
22
|
get transition() {
|
|
20
23
|
return theme.transition.middle;
|
|
21
24
|
},
|
|
25
|
+
|
|
22
26
|
get boderColor() {
|
|
23
27
|
return theme.color.border;
|
|
24
28
|
},
|
|
29
|
+
|
|
25
30
|
get dragLineMargin() {
|
|
26
31
|
return "-" + split.dragLinesCount * (split.dragLiensGutter + 1) / 2 + "px";
|
|
27
32
|
},
|
|
33
|
+
|
|
28
34
|
boxShadow: function boxShadow(direction) {
|
|
29
35
|
var i = 1;
|
|
30
36
|
var tmp = [];
|
|
37
|
+
|
|
31
38
|
while (i <= split.dragLinesCount) {
|
|
32
39
|
var shadowVal = direction === 'horizontal' ? "0 " + i * split.dragLiensGutter + "px 0 0" : i * split.dragLiensGutter + "px 0 0 0";
|
|
33
40
|
tmp.push(shadowVal + " " + split.boderColor);
|
|
34
41
|
i++;
|
|
35
42
|
}
|
|
43
|
+
|
|
36
44
|
return "" + tmp.join(',');
|
|
37
45
|
}
|
|
38
46
|
};
|
|
@@ -15,17 +15,20 @@ export function useDraggable(firstSize, lastSize) {
|
|
|
15
15
|
var baseY = 0;
|
|
16
16
|
var originalWidth = 0;
|
|
17
17
|
var originalHeight = 0;
|
|
18
|
+
|
|
18
19
|
var _useBaseDraggable = useBaseDraggable({
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
onStart: onStart,
|
|
21
|
+
onMove: onMove,
|
|
22
|
+
onEnd: onEnd
|
|
23
|
+
}),
|
|
24
|
+
start = _useBaseDraggable.start,
|
|
25
|
+
dragging = _useBaseDraggable.dragging;
|
|
26
|
+
|
|
25
27
|
function onStart(e) {
|
|
26
28
|
// set mouse style
|
|
27
29
|
setMouseStyle(true);
|
|
28
30
|
calcMinMaxValue();
|
|
31
|
+
|
|
29
32
|
if (lastSize.value === 'auto') {
|
|
30
33
|
targetRef = firstRef;
|
|
31
34
|
targetSize = firstSize;
|
|
@@ -33,6 +36,7 @@ export function useDraggable(firstSize, lastSize) {
|
|
|
33
36
|
targetRef = lastRef;
|
|
34
37
|
targetSize = lastSize;
|
|
35
38
|
}
|
|
39
|
+
|
|
36
40
|
var targetEl = targetRef.value;
|
|
37
41
|
originalWidth = restrainValue(targetEl.offsetWidth);
|
|
38
42
|
originalHeight = restrainValue(targetEl.offsetHeight);
|
|
@@ -40,9 +44,11 @@ export function useDraggable(firstSize, lastSize) {
|
|
|
40
44
|
baseY = e.clientY;
|
|
41
45
|
instance.trigger('moveStart', e);
|
|
42
46
|
}
|
|
47
|
+
|
|
43
48
|
function onMove(e) {
|
|
44
49
|
var changed;
|
|
45
50
|
var originalSize;
|
|
51
|
+
|
|
46
52
|
if (instance.get('mode') === 'horizontal') {
|
|
47
53
|
originalSize = originalWidth;
|
|
48
54
|
changed = e.clientX - baseX;
|
|
@@ -50,24 +56,30 @@ export function useDraggable(firstSize, lastSize) {
|
|
|
50
56
|
originalSize = originalHeight;
|
|
51
57
|
changed = e.clientY - baseY;
|
|
52
58
|
}
|
|
59
|
+
|
|
53
60
|
if (targetRef === lastRef) {
|
|
54
61
|
changed = -changed;
|
|
55
62
|
}
|
|
63
|
+
|
|
56
64
|
targetSize.set(restrainValue(originalSize + changed) + "px");
|
|
57
65
|
instance.trigger('moving', e);
|
|
58
66
|
}
|
|
67
|
+
|
|
59
68
|
function onEnd(e) {
|
|
60
69
|
// reset mouse style
|
|
61
70
|
setMouseStyle();
|
|
62
71
|
instance.trigger('moveEnd', e);
|
|
63
72
|
}
|
|
73
|
+
|
|
64
74
|
function calcMinMaxValue() {
|
|
65
75
|
var _instance$get = instance.get(),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
_min = _instance$get.min,
|
|
77
|
+
_max = _instance$get.max,
|
|
78
|
+
mode = _instance$get.mode;
|
|
79
|
+
|
|
69
80
|
var parsedMin = parseValue(_min);
|
|
70
81
|
var parsedMax = parseValue(_max);
|
|
82
|
+
|
|
71
83
|
if (parsedMin.percent || parsedMax.percent) {
|
|
72
84
|
var totalSize = mode === 'horizontal' ? elementRef.value.offsetWidth : elementRef.value.offsetHeight;
|
|
73
85
|
min = generateValue(parsedMin, totalSize);
|
|
@@ -77,15 +89,19 @@ export function useDraggable(firstSize, lastSize) {
|
|
|
77
89
|
max = _max;
|
|
78
90
|
}
|
|
79
91
|
}
|
|
92
|
+
|
|
80
93
|
function setMouseStyle(set) {
|
|
81
94
|
if (set === void 0) {
|
|
82
95
|
set = false;
|
|
83
96
|
}
|
|
97
|
+
|
|
84
98
|
document.body.style.cursor = set ? instance.get('mode') === 'vertical' ? 'row-resize' : 'col-resize' : '';
|
|
85
99
|
}
|
|
100
|
+
|
|
86
101
|
function restrainValue(value) {
|
|
87
102
|
return Math.min(Math.max(value, min), max);
|
|
88
103
|
}
|
|
104
|
+
|
|
89
105
|
return {
|
|
90
106
|
start: start,
|
|
91
107
|
dragging: dragging,
|
|
@@ -94,11 +110,13 @@ export function useDraggable(firstSize, lastSize) {
|
|
|
94
110
|
lastRef: lastRef
|
|
95
111
|
};
|
|
96
112
|
}
|
|
113
|
+
|
|
97
114
|
function parseValue(v) {
|
|
98
115
|
if (typeof v === 'undefined') return cache;
|
|
99
116
|
if (typeof v === 'number') return {
|
|
100
117
|
px: v
|
|
101
118
|
};
|
|
119
|
+
|
|
102
120
|
if (!cache[v]) {
|
|
103
121
|
var matches = v.match(VALUE_REG) || [];
|
|
104
122
|
cache[v] = {
|
|
@@ -107,19 +125,25 @@ function parseValue(v) {
|
|
|
107
125
|
px: matches[3]
|
|
108
126
|
};
|
|
109
127
|
}
|
|
128
|
+
|
|
110
129
|
return cache[v];
|
|
111
130
|
}
|
|
131
|
+
|
|
112
132
|
function generateValue(_ref, totalSize) {
|
|
113
133
|
var percent = _ref.percent,
|
|
114
|
-
|
|
115
|
-
|
|
134
|
+
op = _ref.op,
|
|
135
|
+
px = _ref.px;
|
|
136
|
+
|
|
116
137
|
if (percent) {
|
|
117
138
|
var value = totalSize * Number(percent) / 100;
|
|
139
|
+
|
|
118
140
|
if (px) {
|
|
119
141
|
px = Number(px);
|
|
120
142
|
value = op === '-' ? value - px : value + px;
|
|
121
143
|
}
|
|
144
|
+
|
|
122
145
|
return value;
|
|
123
146
|
}
|
|
147
|
+
|
|
124
148
|
return Number(px);
|
|
125
149
|
}
|
|
@@ -7,10 +7,12 @@ export function useSize() {
|
|
|
7
7
|
var lastSize = useState('auto');
|
|
8
8
|
fixSize();
|
|
9
9
|
useReceive(['firstSize', 'lastSize'], fixSize, true);
|
|
10
|
+
|
|
10
11
|
function fixSize() {
|
|
11
12
|
var _instance$get = instance.get(),
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
first = _instance$get.firstSize,
|
|
14
|
+
last = _instance$get.lastSize;
|
|
15
|
+
|
|
14
16
|
if (first === 'auto' && last === 'auto') {
|
|
15
17
|
firstSize.set('50%');
|
|
16
18
|
lastSize.set(last);
|
|
@@ -22,6 +24,7 @@ export function useSize() {
|
|
|
22
24
|
lastSize.set(last);
|
|
23
25
|
}
|
|
24
26
|
}
|
|
27
|
+
|
|
25
28
|
;
|
|
26
29
|
return {
|
|
27
30
|
firstSize: firstSize,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const context: {
|
|
2
|
-
Provider: import("
|
|
3
|
-
Consumer: import("
|
|
2
|
+
Provider: import("misstime").ComponentConstructor<import('intact-vue-next').Component<import("../context").ProviderProps<any>, {}, {}, {}>>;
|
|
3
|
+
Consumer: import("misstime").ComponentConstructor<import("intact").Component<import("../context").ConsumerProps<any>, {}, {}, {}>>;
|
|
4
4
|
};
|
|
@@ -10,6 +10,7 @@ var typeDefs = {
|
|
|
10
10
|
type: ['default', 'line', 'simple'],
|
|
11
11
|
clickable: Boolean
|
|
12
12
|
};
|
|
13
|
+
|
|
13
14
|
var defaults = function defaults() {
|
|
14
15
|
return {
|
|
15
16
|
value: 0,
|
|
@@ -17,23 +18,30 @@ var defaults = function defaults() {
|
|
|
17
18
|
type: 'default'
|
|
18
19
|
};
|
|
19
20
|
};
|
|
21
|
+
|
|
20
22
|
export var Steps = /*#__PURE__*/function (_Component) {
|
|
21
23
|
_inheritsLoose(Steps, _Component);
|
|
24
|
+
|
|
22
25
|
function Steps() {
|
|
23
26
|
return _Component.apply(this, arguments) || this;
|
|
24
27
|
}
|
|
28
|
+
|
|
25
29
|
var _proto = Steps.prototype;
|
|
30
|
+
|
|
26
31
|
_proto.changeIndex = function changeIndex(index) {
|
|
27
32
|
var _this$get = this.get(),
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
value = _this$get.value,
|
|
34
|
+
clickable = _this$get.clickable;
|
|
35
|
+
|
|
30
36
|
if (clickable && value > index) {
|
|
31
37
|
this.set('value', index);
|
|
32
38
|
}
|
|
33
39
|
};
|
|
40
|
+
|
|
34
41
|
return Steps;
|
|
35
42
|
}(Component);
|
|
36
43
|
Steps.template = template;
|
|
37
44
|
Steps.typeDefs = typeDefs;
|
|
38
45
|
Steps.defaults = defaults;
|
|
46
|
+
|
|
39
47
|
__decorate([bind], Steps.prototype, "changeIndex", null);
|
|
@@ -8,28 +8,34 @@ describe('Steps', function () {
|
|
|
8
8
|
});
|
|
9
9
|
it('change step', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
10
10
|
var _mount, instance, element, _element$querySelecto, next, _element$querySelecto2, step1, step2;
|
|
11
|
+
|
|
11
12
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
-
while (1)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
13
|
+
while (1) {
|
|
14
|
+
switch (_context.prev = _context.next) {
|
|
15
|
+
case 0:
|
|
16
|
+
_mount = mount(ClickableDemo), instance = _mount[0], element = _mount[1];
|
|
17
|
+
_element$querySelecto = element.querySelectorAll('.k-btn'), next = _element$querySelecto[1];
|
|
18
|
+
next.click();
|
|
19
|
+
_context.next = 5;
|
|
20
|
+
return wait();
|
|
21
|
+
|
|
22
|
+
case 5:
|
|
23
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
24
|
+
_element$querySelecto2 = element.querySelectorAll('.k-step'), step1 = _element$querySelecto2[0], step2 = _element$querySelecto2[1];
|
|
25
|
+
step1.click();
|
|
26
|
+
_context.next = 10;
|
|
27
|
+
return wait();
|
|
28
|
+
|
|
29
|
+
case 10:
|
|
30
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
31
|
+
expect(instance.get('index')).to.eql(0);
|
|
32
|
+
step2.click();
|
|
33
|
+
expect(instance.get('index')).to.eql(0);
|
|
34
|
+
|
|
35
|
+
case 14:
|
|
36
|
+
case "end":
|
|
37
|
+
return _context.stop();
|
|
38
|
+
}
|
|
33
39
|
}
|
|
34
40
|
}, _callee);
|
|
35
41
|
})));
|
|
@@ -6,16 +6,19 @@ import { makeStepsStyles } from './styles';
|
|
|
6
6
|
import { context as StepsContext } from './context';
|
|
7
7
|
export default function ($props, $blocks, $__proto__) {
|
|
8
8
|
var _classNameObj;
|
|
9
|
+
|
|
9
10
|
$blocks || ($blocks = {});
|
|
10
11
|
$props || ($props = {});
|
|
11
12
|
var $this = this;
|
|
13
|
+
|
|
12
14
|
var _this$get = this.get(),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
children = _this$get.children,
|
|
16
|
+
className = _this$get.className,
|
|
17
|
+
value = _this$get.value,
|
|
18
|
+
status = _this$get.status,
|
|
19
|
+
type = _this$get.type,
|
|
20
|
+
clickable = _this$get.clickable;
|
|
21
|
+
|
|
19
22
|
var classNameObj = (_classNameObj = {
|
|
20
23
|
'k-steps': true
|
|
21
24
|
}, _classNameObj[className] = className, _classNameObj["k-" + type] = true, _classNameObj['k-clickable'] = clickable, _classNameObj[makeStepsStyles()] = true, _classNameObj);
|
|
@@ -29,9 +32,8 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
29
32
|
steps.push(vNode);
|
|
30
33
|
stepIndex++;
|
|
31
34
|
}
|
|
32
|
-
});
|
|
35
|
+
}); // add width
|
|
33
36
|
|
|
34
|
-
// add width
|
|
35
37
|
var width = 100 / stepIndex + '%';
|
|
36
38
|
return _$cc(StepsContext.Provider, {
|
|
37
39
|
'value': {
|
package/components/steps/step.js
CHANGED
|
@@ -7,9 +7,11 @@ var typeDefs = {
|
|
|
7
7
|
};
|
|
8
8
|
export var Step = /*#__PURE__*/function (_Component) {
|
|
9
9
|
_inheritsLoose(Step, _Component);
|
|
10
|
+
|
|
10
11
|
function Step() {
|
|
11
12
|
return _Component.apply(this, arguments) || this;
|
|
12
13
|
}
|
|
14
|
+
|
|
13
15
|
return Step;
|
|
14
16
|
}(Component);
|
|
15
17
|
Step.template = template;
|
|
@@ -6,22 +6,26 @@ import { makeStepStyles } from './styles';
|
|
|
6
6
|
import { context as StepsContext } from './context';
|
|
7
7
|
export default function ($props, $blocks, $__proto__) {
|
|
8
8
|
var _this = this;
|
|
9
|
+
|
|
9
10
|
$blocks || ($blocks = {});
|
|
10
11
|
$props || ($props = {});
|
|
11
12
|
var $this = this;
|
|
13
|
+
|
|
12
14
|
var _this$get = this.get(),
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
_children = _this$get.children,
|
|
16
|
+
title = _this$get.title,
|
|
17
|
+
index = _this$get.index,
|
|
18
|
+
className = _this$get.className,
|
|
19
|
+
style = _this$get.style;
|
|
20
|
+
|
|
18
21
|
return _$cc(StepsContext.Consumer, {
|
|
19
22
|
'children': function children(_ref) {
|
|
20
23
|
var _classNameObj;
|
|
24
|
+
|
|
21
25
|
var value = _ref.value,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
status = _ref.status,
|
|
27
|
+
width = _ref.width,
|
|
28
|
+
onChange = _ref.onChange;
|
|
25
29
|
var selected = value === index;
|
|
26
30
|
var error = selected && status === 'error';
|
|
27
31
|
var classNameObj = (_classNameObj = {
|
|
@@ -7,20 +7,25 @@ var defaults = {
|
|
|
7
7
|
get transition() {
|
|
8
8
|
return theme.transition.middle;
|
|
9
9
|
},
|
|
10
|
+
|
|
10
11
|
get height() {
|
|
11
12
|
return theme.default.height;
|
|
12
13
|
},
|
|
14
|
+
|
|
13
15
|
get bgColor() {
|
|
14
16
|
return theme.color.bg;
|
|
15
17
|
},
|
|
18
|
+
|
|
16
19
|
gutter: '10px',
|
|
17
20
|
gapTop: '-2px',
|
|
18
21
|
// head
|
|
19
22
|
head: {
|
|
20
23
|
innerWidth: '16px',
|
|
24
|
+
|
|
21
25
|
get innerBorder() {
|
|
22
26
|
return "1px solid " + theme.color.placeholder;
|
|
23
27
|
},
|
|
28
|
+
|
|
24
29
|
iconFontSize: '24px',
|
|
25
30
|
paddingRight: '10px'
|
|
26
31
|
},
|
|
@@ -28,9 +33,11 @@ var defaults = {
|
|
|
28
33
|
get color() {
|
|
29
34
|
return theme.color.text;
|
|
30
35
|
},
|
|
36
|
+
|
|
31
37
|
get titlePaddingRight() {
|
|
32
38
|
return steps.head.paddingRight;
|
|
33
39
|
},
|
|
40
|
+
|
|
34
41
|
contentFontSize: '12px'
|
|
35
42
|
},
|
|
36
43
|
// done
|
|
@@ -38,59 +45,77 @@ var defaults = {
|
|
|
38
45
|
get headColor() {
|
|
39
46
|
return theme.color.primary;
|
|
40
47
|
},
|
|
48
|
+
|
|
41
49
|
get headInnerBorderColor() {
|
|
42
50
|
return theme.color.primary;
|
|
43
51
|
},
|
|
52
|
+
|
|
44
53
|
headInnerBgColor: 'transparent',
|
|
54
|
+
|
|
45
55
|
get mainColor() {
|
|
46
56
|
return theme.color.primary;
|
|
47
57
|
},
|
|
58
|
+
|
|
48
59
|
get simpleColor() {
|
|
49
60
|
return theme.color.text;
|
|
50
61
|
}
|
|
62
|
+
|
|
51
63
|
},
|
|
52
64
|
// active
|
|
53
65
|
active: {
|
|
54
66
|
headColor: '#fff',
|
|
67
|
+
|
|
55
68
|
get headInnerBorderColor() {
|
|
56
69
|
return theme.color.primary;
|
|
57
70
|
},
|
|
71
|
+
|
|
58
72
|
get headInnerBgColor() {
|
|
59
73
|
return theme.color.primary;
|
|
60
74
|
},
|
|
75
|
+
|
|
61
76
|
get mainColor() {
|
|
62
77
|
return theme.color.primary;
|
|
63
78
|
},
|
|
79
|
+
|
|
64
80
|
get simpleColor() {
|
|
65
81
|
return theme.color.primary;
|
|
66
82
|
}
|
|
83
|
+
|
|
67
84
|
},
|
|
68
85
|
// error
|
|
69
86
|
error: {
|
|
70
87
|
get headColor() {
|
|
71
88
|
return theme.color.danger;
|
|
72
89
|
},
|
|
90
|
+
|
|
73
91
|
get headInnerBorderColor() {
|
|
74
92
|
return theme.color.danger;
|
|
75
93
|
},
|
|
94
|
+
|
|
76
95
|
headInnerBgColor: 'transparent',
|
|
96
|
+
|
|
77
97
|
get mainColor() {
|
|
78
98
|
return theme.color.danger;
|
|
79
99
|
},
|
|
100
|
+
|
|
80
101
|
get simpleColor() {
|
|
81
102
|
return theme.color.danger;
|
|
82
103
|
}
|
|
104
|
+
|
|
83
105
|
},
|
|
84
106
|
// line
|
|
85
107
|
line: {
|
|
86
108
|
bgColor: '#fff',
|
|
87
109
|
mainContentGap: '5px 0 0',
|
|
110
|
+
|
|
88
111
|
get tailBgColor() {
|
|
89
112
|
return theme.color.placeholder;
|
|
90
113
|
},
|
|
114
|
+
|
|
91
115
|
get doneTailBgColor() {
|
|
92
116
|
return theme.color.primary;
|
|
93
117
|
},
|
|
118
|
+
|
|
94
119
|
innerWidth: '32px',
|
|
95
120
|
innerLineHeight: '30px',
|
|
96
121
|
innerFontSize: '18px',
|
|
@@ -104,9 +129,11 @@ var defaults = {
|
|
|
104
129
|
// simple
|
|
105
130
|
simple: {
|
|
106
131
|
fontSize: '14px',
|
|
132
|
+
|
|
107
133
|
get color() {
|
|
108
134
|
return theme.color.disabled;
|
|
109
135
|
},
|
|
136
|
+
|
|
110
137
|
headPaddingRight: '6px'
|
|
111
138
|
}
|
|
112
139
|
};
|
|
@@ -18,6 +18,7 @@ var typeDefs = {
|
|
|
18
18
|
size: sizes,
|
|
19
19
|
disabled: Boolean
|
|
20
20
|
};
|
|
21
|
+
|
|
21
22
|
var defaults = function defaults() {
|
|
22
23
|
return {
|
|
23
24
|
value: false,
|
|
@@ -26,67 +27,87 @@ var defaults = function defaults() {
|
|
|
26
27
|
size: 'default'
|
|
27
28
|
};
|
|
28
29
|
};
|
|
30
|
+
|
|
29
31
|
var events = {
|
|
30
32
|
click: true,
|
|
31
33
|
keypress: true
|
|
32
34
|
};
|
|
33
35
|
export var Switch = /*#__PURE__*/function (_Component) {
|
|
34
36
|
_inheritsLoose(Switch, _Component);
|
|
37
|
+
|
|
35
38
|
function Switch() {
|
|
36
39
|
var _context;
|
|
40
|
+
|
|
37
41
|
var _this;
|
|
42
|
+
|
|
38
43
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
39
44
|
args[_key] = arguments[_key];
|
|
40
45
|
}
|
|
46
|
+
|
|
41
47
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
42
48
|
_this.elementRef = createRef();
|
|
43
49
|
_this.draggable = useDraggable(_this.elementRef);
|
|
44
50
|
return _this;
|
|
45
51
|
}
|
|
52
|
+
|
|
46
53
|
var _proto = Switch.prototype;
|
|
54
|
+
|
|
47
55
|
_proto.onClick = function onClick(e) {
|
|
48
56
|
if (!e._switchIgnore) {
|
|
49
57
|
this.toggle(false);
|
|
50
58
|
}
|
|
59
|
+
|
|
51
60
|
this.trigger('click', e);
|
|
52
61
|
};
|
|
62
|
+
|
|
53
63
|
_proto.onClickOnHandle = function onClickOnHandle(e) {
|
|
54
64
|
// we can not stop propagation, otherwise the click can not be listen at outer
|
|
55
65
|
e._switchIgnore = true;
|
|
56
66
|
};
|
|
67
|
+
|
|
57
68
|
_proto.onKeypress = function onKeypress(e) {
|
|
58
69
|
this.trigger('keypress', e);
|
|
70
|
+
|
|
59
71
|
if (e.keyCode === 13) {
|
|
60
72
|
this.toggle(true);
|
|
61
73
|
}
|
|
62
74
|
};
|
|
75
|
+
|
|
63
76
|
_proto.toggle = function toggle(isKeypress) {
|
|
64
|
-
if (this.get('disabled')) return;
|
|
65
|
-
|
|
77
|
+
if (this.get('disabled')) return; // if is not keypress, we blur it to remove focus style
|
|
78
|
+
|
|
66
79
|
if (!isKeypress) {
|
|
67
80
|
this.elementRef.value.blur();
|
|
68
81
|
}
|
|
82
|
+
|
|
69
83
|
if (this.isChecked()) {
|
|
70
84
|
this.uncheck();
|
|
71
85
|
} else {
|
|
72
86
|
this.check();
|
|
73
87
|
}
|
|
74
88
|
};
|
|
89
|
+
|
|
75
90
|
_proto.isChecked = function isChecked() {
|
|
76
91
|
return this.get('value') === this.get('trueValue');
|
|
77
92
|
};
|
|
93
|
+
|
|
78
94
|
_proto.check = function check() {
|
|
79
95
|
this.set('value', this.get('trueValue'));
|
|
80
96
|
};
|
|
97
|
+
|
|
81
98
|
_proto.uncheck = function uncheck() {
|
|
82
99
|
this.set('value', this.get('falseValue'));
|
|
83
100
|
};
|
|
101
|
+
|
|
84
102
|
return Switch;
|
|
85
103
|
}(Component);
|
|
86
104
|
Switch.template = template;
|
|
87
105
|
Switch.typeDefs = typeDefs;
|
|
88
106
|
Switch.defaults = defaults;
|
|
89
107
|
Switch.events = events;
|
|
108
|
+
|
|
90
109
|
__decorate([bind], Switch.prototype, "onClick", null);
|
|
110
|
+
|
|
91
111
|
__decorate([bind], Switch.prototype, "onClickOnHandle", null);
|
|
112
|
+
|
|
92
113
|
__decorate([bind], Switch.prototype, "onKeypress", null);
|