@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
|
@@ -7,63 +7,72 @@ import { getRestProps } from '../utils';
|
|
|
7
7
|
import { makeStyles } from './styles';
|
|
8
8
|
export default function ($props, $blocks, $__proto__) {
|
|
9
9
|
var _classNameObj;
|
|
10
|
+
|
|
10
11
|
$blocks || ($blocks = {});
|
|
11
12
|
$props || ($props = {});
|
|
12
13
|
var $this = this;
|
|
13
14
|
var _$blocks = {};
|
|
14
15
|
var __$blocks = {};
|
|
16
|
+
|
|
15
17
|
var _this$get = this.get(),
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
disabled = _this$get.disabled,
|
|
19
|
+
className = _this$get.className,
|
|
20
|
+
max = _this$get.max,
|
|
21
|
+
min = _this$get.min,
|
|
22
|
+
unit = _this$get.unit,
|
|
23
|
+
showInput = _this$get.showInput,
|
|
24
|
+
range = _this$get.range,
|
|
25
|
+
step = _this$get.step,
|
|
26
|
+
value = _this$get.value,
|
|
27
|
+
spinnerProps = _this$get.spinnerProps,
|
|
28
|
+
showEnd = _this$get.showEnd,
|
|
29
|
+
showTooltip = _this$get.showTooltip,
|
|
30
|
+
animate = _this$get.animate,
|
|
31
|
+
forceStep = _this$get.forceStep;
|
|
32
|
+
|
|
30
33
|
var _this$draggable = this.draggable,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
onStart = _this$draggable.onStart,
|
|
35
|
+
trackRef = _this$draggable.trackRef,
|
|
36
|
+
dragging = _this$draggable.dragging,
|
|
37
|
+
firstThumbRef = _this$draggable.firstThumbRef,
|
|
38
|
+
secondThumbRef = _this$draggable.secondThumbRef,
|
|
39
|
+
onFocusin = _this$draggable.onFocusin;
|
|
37
40
|
var classNameObj = (_classNameObj = {
|
|
38
41
|
'k-slider': true,
|
|
39
42
|
'k-disabled': disabled,
|
|
40
43
|
'k-dragging': dragging.value || !animate
|
|
41
44
|
}, _classNameObj[className] = className, _classNameObj[makeStyles()] = true, _classNameObj);
|
|
45
|
+
|
|
42
46
|
var _this$styles = this.styles(),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
47
|
+
barStyle = _this$styles.barStyle,
|
|
48
|
+
thumbFirstStyle = _this$styles.thumbFirstStyle,
|
|
49
|
+
thumbSecondStyle = _this$styles.thumbSecondStyle;
|
|
50
|
+
|
|
46
51
|
var onSpinnerChange = this.value.onSpinnerChange;
|
|
47
52
|
var _this$keyboard = this.keyboard,
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
onKeydown = _this$keyboard.onKeydown,
|
|
54
|
+
onKeyup = _this$keyboard.onKeyup;
|
|
50
55
|
var _this$tooltip = this.tooltip,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
firstTooltipRef = _this$tooltip.firstTooltipRef,
|
|
57
|
+
secondTooltipRef = _this$tooltip.secondTooltipRef,
|
|
58
|
+
getTooltipProps = _this$tooltip.getTooltipProps,
|
|
59
|
+
hide = _this$tooltip.hide;
|
|
55
60
|
var tooltipProps = getTooltipProps();
|
|
61
|
+
|
|
56
62
|
var tooltip = function tooltip(value) {
|
|
57
63
|
return _$blocks['tooltip'] = function ($super) {
|
|
58
64
|
return value;
|
|
59
65
|
}, __$blocks['tooltip'] = function ($super, data) {
|
|
60
66
|
var block = $blocks['tooltip'];
|
|
67
|
+
|
|
61
68
|
var callBlock = function callBlock() {
|
|
62
69
|
return _$blocks['tooltip'].call($this, $super, data);
|
|
63
70
|
};
|
|
71
|
+
|
|
64
72
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
65
73
|
}, __$blocks['tooltip'](_$no, value);
|
|
66
74
|
};
|
|
75
|
+
|
|
67
76
|
var createThumb = function createThumb(thumbStyle, isFirst, ref, value, tooltipRef) {
|
|
68
77
|
return _$ce(2, 'div', _$cc(Tooltip, _extends({
|
|
69
78
|
'disabled': !showTooltip,
|
|
@@ -80,14 +89,17 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
80
89
|
}, null, ref),
|
|
81
90
|
'$blocks': function ($blocks) {
|
|
82
91
|
var _$blocks = {},
|
|
83
|
-
|
|
92
|
+
__$blocks = _$ex({}, $blocks);
|
|
93
|
+
|
|
84
94
|
return (_$blocks['content'] = function ($super) {
|
|
85
95
|
return tooltip(value);
|
|
86
96
|
}, __$blocks['content'] = function ($super, data) {
|
|
87
97
|
var block = $blocks['content'];
|
|
98
|
+
|
|
88
99
|
var callBlock = function callBlock() {
|
|
89
100
|
return _$blocks['content'].call($this, $super, data);
|
|
90
101
|
};
|
|
102
|
+
|
|
91
103
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
92
104
|
}), __$blocks;
|
|
93
105
|
}.call($this, _$em)
|
|
@@ -95,9 +107,10 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
95
107
|
'style': thumbStyle
|
|
96
108
|
});
|
|
97
109
|
};
|
|
110
|
+
|
|
98
111
|
var _this$click = this.click,
|
|
99
|
-
|
|
100
|
-
|
|
112
|
+
onClickTrack = _this$click.onClickTrack,
|
|
113
|
+
setOneValue = _this$click.setOneValue;
|
|
101
114
|
var points = this.points();
|
|
102
115
|
var marks = this.marks();
|
|
103
116
|
return _$cv('div', _extends({
|
|
@@ -6,18 +6,23 @@ var defaults = {
|
|
|
6
6
|
get transition() {
|
|
7
7
|
return theme.transition.middle;
|
|
8
8
|
},
|
|
9
|
+
|
|
9
10
|
height: '4px',
|
|
10
11
|
bgColor: '#e5e5e5',
|
|
12
|
+
|
|
11
13
|
get barColor() {
|
|
12
14
|
return theme.color.primary;
|
|
13
15
|
},
|
|
16
|
+
|
|
14
17
|
borderRadius: '2px',
|
|
15
18
|
thumb: {
|
|
16
19
|
height: '12px',
|
|
17
20
|
width: '12px',
|
|
21
|
+
|
|
18
22
|
get border() {
|
|
19
23
|
return "2px solid " + slider.barColor;
|
|
20
24
|
},
|
|
25
|
+
|
|
21
26
|
borderRadius: '50%',
|
|
22
27
|
bgColor: '#fff',
|
|
23
28
|
hoverTransform: 'scale(1.5)',
|
|
@@ -29,31 +34,40 @@ var defaults = {
|
|
|
29
34
|
get color() {
|
|
30
35
|
return theme.color.disabled;
|
|
31
36
|
},
|
|
37
|
+
|
|
32
38
|
get bgColor() {
|
|
33
39
|
return theme.color.disabledBg;
|
|
34
40
|
}
|
|
41
|
+
|
|
35
42
|
},
|
|
36
43
|
// spinnerWidth: '124px',
|
|
37
44
|
spinnerGap: '16px',
|
|
38
45
|
point: {
|
|
39
46
|
width: '8px',
|
|
47
|
+
|
|
40
48
|
get height() {
|
|
41
49
|
return slider.point.width;
|
|
42
50
|
},
|
|
51
|
+
|
|
43
52
|
bgColor: '#fff',
|
|
44
53
|
borderRadius: '50%',
|
|
54
|
+
|
|
45
55
|
get border() {
|
|
46
56
|
return "2px solid " + slider.bgColor;
|
|
47
57
|
},
|
|
58
|
+
|
|
48
59
|
get activeBorderColor() {
|
|
49
60
|
return slider.barColor;
|
|
50
61
|
}
|
|
62
|
+
|
|
51
63
|
},
|
|
52
64
|
marks: {
|
|
53
65
|
height: '26px',
|
|
66
|
+
|
|
54
67
|
get activeColor() {
|
|
55
68
|
return theme.color.primary;
|
|
56
69
|
}
|
|
70
|
+
|
|
57
71
|
}
|
|
58
72
|
};
|
|
59
73
|
var slider;
|
|
@@ -1,33 +1,42 @@
|
|
|
1
1
|
import { useInstance } from 'intact-vue-next';
|
|
2
2
|
export function useClick(getSlidingValue, fixValue, showValue, setValue) {
|
|
3
3
|
var instance = useInstance();
|
|
4
|
+
|
|
4
5
|
function onClickTrack(e) {
|
|
5
6
|
if (instance.get('disabled')) return;
|
|
6
7
|
var newValue = getSlidingValue(e.clientX);
|
|
8
|
+
|
|
7
9
|
if (instance.get('range')) {
|
|
8
10
|
newValue = generateRangeValue(newValue);
|
|
9
11
|
}
|
|
12
|
+
|
|
10
13
|
fixValue(newValue, true);
|
|
11
14
|
}
|
|
15
|
+
|
|
12
16
|
function generateRangeValue(v) {
|
|
13
17
|
var _instance$get = instance.get('value'),
|
|
14
|
-
|
|
15
|
-
|
|
18
|
+
min = _instance$get[0],
|
|
19
|
+
max = _instance$get[1];
|
|
20
|
+
|
|
16
21
|
if (Math.abs(min - v) <= Math.abs(max - v)) {
|
|
17
22
|
return [v, max];
|
|
18
23
|
} else {
|
|
19
24
|
return [min, v];
|
|
20
25
|
}
|
|
21
26
|
}
|
|
27
|
+
|
|
22
28
|
function setOneValue(v) {
|
|
23
29
|
if (instance.get('disabled')) return;
|
|
24
30
|
var newValue = v;
|
|
31
|
+
|
|
25
32
|
if (instance.get('range')) {
|
|
26
33
|
newValue = generateRangeValue(v);
|
|
27
34
|
}
|
|
35
|
+
|
|
28
36
|
showValue.set(newValue);
|
|
29
37
|
setValue(newValue);
|
|
30
38
|
}
|
|
39
|
+
|
|
31
40
|
return {
|
|
32
41
|
onClickTrack: onClickTrack,
|
|
33
42
|
setOneValue: setOneValue
|
|
@@ -7,36 +7,42 @@ export function useDraggable(showValue, fixValue, triggerChangeEvent, showToolti
|
|
|
7
7
|
var secondThumbRef = createRef();
|
|
8
8
|
var _isFirst2 = true;
|
|
9
9
|
var oldValue;
|
|
10
|
+
|
|
10
11
|
var _useBaseDraggable = useBaseDraggable({
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
onMove: function onMove(e) {
|
|
13
|
+
var tempValue = getNewValue(getSlidingValue(e.clientX));
|
|
14
|
+
fixValue(tempValue, false);
|
|
15
|
+
showTooltip();
|
|
16
|
+
},
|
|
17
|
+
onEnd: function onEnd() {
|
|
18
|
+
if (instance.$unmounted) return;
|
|
19
|
+
(_isFirst2 ? firstThumbRef.value : secondThumbRef.value).blur();
|
|
20
|
+
showValue.set(instance.get('value'));
|
|
21
|
+
triggerChangeEvent(oldValue);
|
|
22
|
+
}
|
|
23
|
+
}),
|
|
24
|
+
start = _useBaseDraggable.start,
|
|
25
|
+
dragging = _useBaseDraggable.dragging;
|
|
26
|
+
|
|
25
27
|
function onStart(e) {
|
|
26
|
-
if (instance.get('disabled')) return;
|
|
27
|
-
|
|
28
|
-
oldValue = instance.get('value');
|
|
29
|
-
// use Focusin to set the flag, because it will be used on operating by keyboard
|
|
28
|
+
if (instance.get('disabled')) return; // remain the old value to detect whether it changed to trigger change event
|
|
29
|
+
|
|
30
|
+
oldValue = instance.get('value'); // use Focusin to set the flag, because it will be used on operating by keyboard
|
|
30
31
|
// isFirst = _isFirst;
|
|
32
|
+
|
|
31
33
|
start(e);
|
|
32
34
|
}
|
|
35
|
+
|
|
33
36
|
function getSlidingValue(pos) {
|
|
34
37
|
var rect = trackRef.value.getBoundingClientRect();
|
|
35
38
|
var percent = (pos - rect.left) / rect.width;
|
|
39
|
+
|
|
36
40
|
var _instance$get = instance.get(),
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
max = _instance$get.max,
|
|
42
|
+
min = _instance$get.min;
|
|
43
|
+
|
|
39
44
|
var sliderWidth = max - min;
|
|
45
|
+
|
|
40
46
|
if (percent <= 0) {
|
|
41
47
|
return min;
|
|
42
48
|
} else if (percent >= 1) {
|
|
@@ -45,13 +51,16 @@ export function useDraggable(showValue, fixValue, triggerChangeEvent, showToolti
|
|
|
45
51
|
return min + sliderWidth * percent;
|
|
46
52
|
}
|
|
47
53
|
}
|
|
54
|
+
|
|
48
55
|
function getNewValue(value) {
|
|
49
56
|
var _instance$get2 = instance.get(),
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
range = _instance$get2.range,
|
|
58
|
+
oldValue = _instance$get2.value;
|
|
59
|
+
|
|
52
60
|
if (!range) return value;
|
|
53
61
|
var min = oldValue[0],
|
|
54
|
-
|
|
62
|
+
max = oldValue[1];
|
|
63
|
+
|
|
55
64
|
if (_isFirst2) {
|
|
56
65
|
if (value > max) {
|
|
57
66
|
// exchange the thumb
|
|
@@ -74,10 +83,12 @@ export function useDraggable(showValue, fixValue, triggerChangeEvent, showToolti
|
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
85
|
}
|
|
86
|
+
|
|
77
87
|
function onFocusin(_isFirst) {
|
|
78
88
|
_isFirst2 = _isFirst;
|
|
79
89
|
showTooltip();
|
|
80
90
|
}
|
|
91
|
+
|
|
81
92
|
return {
|
|
82
93
|
onStart: onStart,
|
|
83
94
|
dragging: dragging,
|
|
@@ -2,43 +2,54 @@ import { useInstance } from 'intact-vue-next';
|
|
|
2
2
|
export function useKeyboard(getStep, getNewValue, fixValue, isFirst, dragging, triggerChangeEvent) {
|
|
3
3
|
var instance = useInstance();
|
|
4
4
|
var oldValue;
|
|
5
|
+
|
|
5
6
|
function onKeydown(_ref) {
|
|
6
7
|
var keyCode = _ref.keyCode;
|
|
7
8
|
if (instance.get('disabled')) return;
|
|
9
|
+
|
|
8
10
|
var _instance$get = instance.get(),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
value = _instance$get.value,
|
|
12
|
+
range = _instance$get.range; // remain the old value to detect whether it changed to trigger change event
|
|
13
|
+
|
|
14
|
+
|
|
12
15
|
oldValue = value;
|
|
16
|
+
|
|
13
17
|
if (range) {
|
|
14
18
|
var _value = value,
|
|
15
|
-
|
|
16
|
-
|
|
19
|
+
min = _value[0],
|
|
20
|
+
max = _value[1];
|
|
17
21
|
value = isFirst() ? min : max;
|
|
18
22
|
}
|
|
23
|
+
|
|
19
24
|
if (keyCode === 37) {
|
|
20
25
|
// left
|
|
21
26
|
var _getStep = getStep(value, 'decrease'),
|
|
22
|
-
|
|
27
|
+
step = _getStep[0];
|
|
28
|
+
|
|
23
29
|
updateValue(value - step);
|
|
24
30
|
} else if (keyCode === 39) {
|
|
25
31
|
var _getStep2 = getStep(value, 'increase'),
|
|
26
|
-
|
|
32
|
+
_step = _getStep2[0];
|
|
33
|
+
|
|
27
34
|
updateValue(value + _step);
|
|
28
35
|
}
|
|
29
36
|
}
|
|
37
|
+
|
|
30
38
|
function updateValue(value) {
|
|
31
39
|
// disable transition
|
|
32
40
|
dragging.set(true);
|
|
33
41
|
fixValue(getNewValue(value), true);
|
|
34
42
|
}
|
|
43
|
+
|
|
35
44
|
function onKeyup(_ref2) {
|
|
36
45
|
var keyCode = _ref2.keyCode;
|
|
46
|
+
|
|
37
47
|
if (keyCode === 37 || keyCode === 39) {
|
|
38
48
|
dragging.set(false);
|
|
39
49
|
triggerChangeEvent(oldValue);
|
|
40
50
|
}
|
|
41
51
|
}
|
|
52
|
+
|
|
42
53
|
return {
|
|
43
54
|
onKeydown: onKeydown,
|
|
44
55
|
onKeyup: onKeyup
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
type MarkKey = string | number;
|
|
2
|
-
type MarkValue = MarkKey | [MarkKey] | [MarkKey, MarkKey];
|
|
3
|
-
export type Marks = Record<MarkKey, MarkValue>;
|
|
4
|
-
type Mark = {
|
|
1
|
+
declare type MarkKey = string | number;
|
|
2
|
+
declare type MarkValue = MarkKey | [MarkKey] | [MarkKey, MarkKey];
|
|
3
|
+
export declare type Marks = Record<MarkKey, MarkValue>;
|
|
4
|
+
declare type Mark = {
|
|
5
5
|
value: number;
|
|
6
6
|
raw: MarkValue;
|
|
7
7
|
style: Style;
|
|
8
8
|
active: boolean;
|
|
9
9
|
text: string | number;
|
|
10
10
|
};
|
|
11
|
-
type Style = {
|
|
11
|
+
declare type Style = {
|
|
12
12
|
left: string;
|
|
13
13
|
};
|
|
14
14
|
export declare function useMarks(): () => Mark[];
|
|
@@ -6,10 +6,12 @@ export function useMarks() {
|
|
|
6
6
|
var marks = [];
|
|
7
7
|
useReceive(['marks', 'value'], function () {
|
|
8
8
|
var _instance$get = instance.get(),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
max = _instance$get.max,
|
|
10
|
+
min = _instance$get.min,
|
|
11
|
+
_marks = _instance$get.marks;
|
|
12
|
+
|
|
12
13
|
marks = [];
|
|
14
|
+
|
|
13
15
|
for (var key in _marks) {
|
|
14
16
|
var mark = _marks[key];
|
|
15
17
|
var value = +key;
|
|
@@ -23,26 +25,32 @@ export function useMarks() {
|
|
|
23
25
|
text: ''
|
|
24
26
|
});
|
|
25
27
|
}
|
|
28
|
+
|
|
26
29
|
addText();
|
|
27
30
|
});
|
|
28
31
|
instance.on('$change:value', addText);
|
|
32
|
+
|
|
29
33
|
function addText() {
|
|
30
34
|
var _instance$get2 = instance.get(),
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
value = _instance$get2.value,
|
|
36
|
+
range = _instance$get2.range;
|
|
37
|
+
|
|
33
38
|
marks.forEach(function (mark) {
|
|
34
39
|
var active = !range ? mark.value === value : _includesInstanceProperty(value).call(value, mark.value);
|
|
35
40
|
var text;
|
|
36
41
|
var raw = mark.raw;
|
|
42
|
+
|
|
37
43
|
if (Array.isArray(raw)) {
|
|
38
44
|
text = active && raw[1] !== undefined ? raw[1] : raw[0];
|
|
39
45
|
} else {
|
|
40
46
|
text = raw;
|
|
41
47
|
}
|
|
48
|
+
|
|
42
49
|
mark.active = active;
|
|
43
50
|
mark.text = text;
|
|
44
51
|
});
|
|
45
52
|
}
|
|
53
|
+
|
|
46
54
|
return function () {
|
|
47
55
|
return marks;
|
|
48
56
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { State } from '../../hooks/useState';
|
|
2
2
|
import type { NormalizedGetStep } from '../spinner/useStep';
|
|
3
3
|
import { Value } from './useValue';
|
|
4
|
-
type Point = {
|
|
4
|
+
declare type Point = {
|
|
5
5
|
value: number;
|
|
6
6
|
style: Style;
|
|
7
7
|
active: boolean;
|
|
8
8
|
};
|
|
9
|
-
type Style = {
|
|
9
|
+
declare type Style = {
|
|
10
10
|
left: string;
|
|
11
11
|
};
|
|
12
12
|
export declare function usePoints(showValue: State<Value>, getStep: NormalizedGetStep): () => Point[];
|
|
@@ -15,34 +15,45 @@ export function usePoints(showValue, getStep) {
|
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
watchState(showValue, addActive);
|
|
18
|
+
|
|
18
19
|
function makeStepPoints() {
|
|
19
20
|
var _instance$get = instance.get(),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
max = _instance$get.max,
|
|
22
|
+
min = _instance$get.min,
|
|
23
|
+
step = _instance$get.step;
|
|
24
|
+
|
|
23
25
|
if (!step) {
|
|
24
26
|
if (process.env.NODE_ENV !== 'production') {
|
|
25
27
|
error('[Slider]: Step cannot be 0 if you want to show step points.');
|
|
26
28
|
}
|
|
29
|
+
|
|
27
30
|
return;
|
|
28
31
|
}
|
|
32
|
+
|
|
29
33
|
var results = [];
|
|
30
34
|
var i = min;
|
|
35
|
+
|
|
31
36
|
while (true) {
|
|
32
37
|
var _getStep = getStep(i, 'increase'),
|
|
33
|
-
|
|
38
|
+
_step = _getStep[0];
|
|
39
|
+
|
|
34
40
|
i = i + _step;
|
|
41
|
+
|
|
35
42
|
if (Number(i.toFixed(10)) >= max) {
|
|
36
43
|
break;
|
|
37
44
|
}
|
|
45
|
+
|
|
38
46
|
results.push(i);
|
|
39
47
|
}
|
|
48
|
+
|
|
40
49
|
addStyle(results);
|
|
41
50
|
}
|
|
51
|
+
|
|
42
52
|
function addStyle(values) {
|
|
43
53
|
var _instance$get2 = instance.get(),
|
|
44
|
-
|
|
45
|
-
|
|
54
|
+
min = _instance$get2.min,
|
|
55
|
+
max = _instance$get2.max;
|
|
56
|
+
|
|
46
57
|
var total = max - min;
|
|
47
58
|
points = _mapInstanceProperty(values).call(values, function (point) {
|
|
48
59
|
return {
|
|
@@ -55,14 +66,17 @@ export function usePoints(showValue, getStep) {
|
|
|
55
66
|
});
|
|
56
67
|
addActive();
|
|
57
68
|
}
|
|
69
|
+
|
|
58
70
|
function addActive() {
|
|
59
71
|
var _instance$get3 = instance.get(),
|
|
60
|
-
|
|
72
|
+
range = _instance$get3.range;
|
|
73
|
+
|
|
61
74
|
var value = showValue.value;
|
|
62
75
|
points.forEach(function (point) {
|
|
63
76
|
point.active = !range ? point.value <= value : point.value >= value[0] && point.value <= value[1];
|
|
64
77
|
});
|
|
65
78
|
}
|
|
79
|
+
|
|
66
80
|
return function () {
|
|
67
81
|
return points;
|
|
68
82
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { State } from '../../hooks/useState';
|
|
2
2
|
import { Value } from './useValue';
|
|
3
|
-
type Style = Record<string, string>;
|
|
3
|
+
declare type Style = Record<string, string>;
|
|
4
4
|
export declare function useStyles(showValue: State<Value>): () => {
|
|
5
5
|
barStyle: Style;
|
|
6
6
|
thumbFirstStyle: Style;
|
|
@@ -4,17 +4,20 @@ export function useStyles(showValue) {
|
|
|
4
4
|
var barStyle;
|
|
5
5
|
var thumbFirstStyle;
|
|
6
6
|
var thumbSecondStyle;
|
|
7
|
+
|
|
7
8
|
function updateStyle() {
|
|
8
9
|
var _instance$get = instance.get(),
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
max = _instance$get.max,
|
|
11
|
+
min = _instance$get.min,
|
|
12
|
+
range = _instance$get.range;
|
|
13
|
+
|
|
12
14
|
var total = max - min;
|
|
15
|
+
|
|
13
16
|
if (total > 0) {
|
|
14
17
|
if (range) {
|
|
15
18
|
var _showValue$value = showValue.value,
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
first = _showValue$value[0],
|
|
20
|
+
second = _showValue$value[1];
|
|
18
21
|
barStyle = {
|
|
19
22
|
width: toPercent(Math.abs(second - first), total),
|
|
20
23
|
left: toPercent(Math.min(first, second) - min, total)
|
|
@@ -47,6 +50,7 @@ export function useStyles(showValue) {
|
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
}
|
|
53
|
+
|
|
50
54
|
onBeforeUpdate(updateStyle);
|
|
51
55
|
onBeforeMount(updateStyle);
|
|
52
56
|
return function () {
|
|
@@ -57,6 +61,7 @@ export function useStyles(showValue) {
|
|
|
57
61
|
};
|
|
58
62
|
};
|
|
59
63
|
}
|
|
64
|
+
|
|
60
65
|
function toPercent(value, total) {
|
|
61
66
|
return value / total * 100 + '%';
|
|
62
67
|
}
|
|
@@ -15,11 +15,13 @@ export function useTooltip(showValue) {
|
|
|
15
15
|
var tooltipProps = defaultTooltipProps;
|
|
16
16
|
useReceive(['always', 'tooltipProps'], function () {
|
|
17
17
|
var _instance$get = instance.get(),
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
always = _instance$get.always,
|
|
19
|
+
props = _instance$get.tooltipProps;
|
|
20
|
+
|
|
20
21
|
tooltipProps = _extends({}, defaultTooltipProps, {
|
|
21
22
|
always: always
|
|
22
23
|
}, props);
|
|
24
|
+
|
|
23
25
|
if (always) {
|
|
24
26
|
tooltipProps.value = true;
|
|
25
27
|
}
|
|
@@ -29,27 +31,33 @@ export function useTooltip(showValue) {
|
|
|
29
31
|
show();
|
|
30
32
|
}
|
|
31
33
|
});
|
|
34
|
+
|
|
32
35
|
function getTooltipProps() {
|
|
33
36
|
return tooltipProps;
|
|
34
37
|
}
|
|
38
|
+
|
|
35
39
|
function show() {
|
|
36
40
|
if (!instance.get('showTooltip')) return;
|
|
37
41
|
var first = firstTooltipRef.value;
|
|
38
42
|
var second = secondTooltipRef.value;
|
|
39
43
|
first.show();
|
|
40
44
|
first.position();
|
|
45
|
+
|
|
41
46
|
if (second) {
|
|
42
47
|
second.show();
|
|
43
48
|
second.position();
|
|
44
49
|
}
|
|
45
50
|
}
|
|
51
|
+
|
|
46
52
|
function hide() {
|
|
47
53
|
firstTooltipRef.value.hide(false);
|
|
48
54
|
var second = secondTooltipRef.value;
|
|
55
|
+
|
|
49
56
|
if (second) {
|
|
50
57
|
second.hide(false);
|
|
51
58
|
}
|
|
52
59
|
}
|
|
60
|
+
|
|
53
61
|
return {
|
|
54
62
|
firstTooltipRef: firstTooltipRef,
|
|
55
63
|
secondTooltipRef: secondTooltipRef,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NormalizedGetStep } from '../spinner/useStep';
|
|
2
|
-
export type Value<Range extends boolean = boolean> = Range extends true ? [number, number] : number;
|
|
2
|
+
export declare type Value<Range extends boolean = boolean> = Range extends true ? [number, number] : number;
|
|
3
3
|
export declare function useValue(getStep: NormalizedGetStep, getDragging: () => boolean): {
|
|
4
4
|
showValue: import("../../hooks/useState").State<number | [number, number]>;
|
|
5
5
|
onSpinnerChange: (v: number) => void;
|