@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
|
@@ -20,7 +20,7 @@ export interface FormItemBlocks {
|
|
|
20
20
|
content: null;
|
|
21
21
|
append: null;
|
|
22
22
|
}
|
|
23
|
-
export type Rules = Record<string, any>;
|
|
23
|
+
export declare type Rules = Record<string, any>;
|
|
24
24
|
export declare class FormItem extends Component<FormItemProps, FormItemEvents, FormItemBlocks> {
|
|
25
25
|
static template: string | import("intact").Template<any>;
|
|
26
26
|
static typeDefs: Required<TypeDefs<FormItemProps>>;
|
package/components/form/item.js
CHANGED
|
@@ -8,10 +8,12 @@ import { useError } from './useError';
|
|
|
8
8
|
import { useValidate } from './useValidate';
|
|
9
9
|
import { useDirty } from './useDirty';
|
|
10
10
|
var MessageOrClassname;
|
|
11
|
+
|
|
11
12
|
(function (MessageOrClassname) {
|
|
12
13
|
MessageOrClassname[MessageOrClassname["Message"] = 0] = "Message";
|
|
13
14
|
MessageOrClassname[MessageOrClassname["ClassName"] = 1] = "ClassName";
|
|
14
15
|
})(MessageOrClassname || (MessageOrClassname = {}));
|
|
16
|
+
|
|
15
17
|
var typeDefs = {
|
|
16
18
|
value: null,
|
|
17
19
|
rules: Object,
|
|
@@ -25,12 +27,16 @@ var typeDefs = {
|
|
|
25
27
|
};
|
|
26
28
|
export var FormItem = /*#__PURE__*/function (_Component) {
|
|
27
29
|
_inheritsLoose(FormItem, _Component);
|
|
30
|
+
|
|
28
31
|
function FormItem() {
|
|
29
32
|
var _context;
|
|
33
|
+
|
|
30
34
|
var _this;
|
|
35
|
+
|
|
31
36
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
37
|
args[_key] = arguments[_key];
|
|
33
38
|
}
|
|
39
|
+
|
|
34
40
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
35
41
|
_this.form = inject(FORM, null);
|
|
36
42
|
_this.error = useError();
|
|
@@ -40,22 +46,28 @@ export var FormItem = /*#__PURE__*/function (_Component) {
|
|
|
40
46
|
_this.validateHook = useValidate(_this.error.getErrorMessage, _this.error.getErrorClassName, _this.error.message, _this.dirty.isDirty);
|
|
41
47
|
return _this;
|
|
42
48
|
}
|
|
49
|
+
|
|
43
50
|
var _proto = FormItem.prototype;
|
|
51
|
+
|
|
44
52
|
_proto.init = function init() {
|
|
45
53
|
useRecordItem(RECORD_KEY);
|
|
46
54
|
};
|
|
55
|
+
|
|
47
56
|
_proto.validate = function validate() {
|
|
48
57
|
if (!this.form) return true;
|
|
49
58
|
return this.validateHook.validate();
|
|
50
59
|
};
|
|
60
|
+
|
|
51
61
|
_proto.isValid = function isValid() {
|
|
52
62
|
return this.validateHook.isValid.value;
|
|
53
63
|
};
|
|
64
|
+
|
|
54
65
|
_proto.reset = function reset() {
|
|
55
66
|
this.error.reset();
|
|
56
67
|
this.validateHook.reset();
|
|
57
68
|
this.dirty.reset();
|
|
58
69
|
};
|
|
70
|
+
|
|
59
71
|
return FormItem;
|
|
60
72
|
}(Component);
|
|
61
73
|
FormItem.template = template;
|
|
@@ -12,27 +12,30 @@ var _$tmp0 = {
|
|
|
12
12
|
};
|
|
13
13
|
export default function ($props, $blocks, $__proto__) {
|
|
14
14
|
var _classNameObj, _$cn2;
|
|
15
|
+
|
|
15
16
|
$blocks || ($blocks = {});
|
|
16
17
|
$props || ($props = {});
|
|
17
18
|
var $this = this;
|
|
18
19
|
var _$blocks = {};
|
|
19
20
|
var __$blocks = {};
|
|
21
|
+
|
|
20
22
|
var _this$get = this.get(),
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
className = _this$get.className,
|
|
24
|
+
children = _this$get.children,
|
|
25
|
+
label = _this$get.label,
|
|
26
|
+
hideLabel = _this$get.hideLabel,
|
|
27
|
+
htmlFor = _this$get.htmlFor,
|
|
28
|
+
errorClassName = _this$get.errorClassName,
|
|
29
|
+
rules = _this$get.rules,
|
|
30
|
+
fluid = _this$get.fluid;
|
|
31
|
+
|
|
29
32
|
var _this$dirty = this.dirty,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
isDirty = _this$dirty.isDirty.value,
|
|
34
|
+
onChange = _this$dirty.onChange,
|
|
35
|
+
onFocusout = _this$dirty.onFocusout;
|
|
33
36
|
var _this$validateHook = this.validateHook,
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
isValid = _this$validateHook.isValid.value,
|
|
38
|
+
customErrorClassName = _this$validateHook.errorClassName.value;
|
|
36
39
|
var classNameObj = (_classNameObj = {
|
|
37
40
|
'k-form-item': true,
|
|
38
41
|
'k-invalid': isDirty && !isValid,
|
|
@@ -41,6 +44,7 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
41
44
|
var starOnRequired = this.form && this.form.get('starOnRequired');
|
|
42
45
|
var labelWidth = this.form && this.form.get('labelWidth');
|
|
43
46
|
var labelStyle;
|
|
47
|
+
|
|
44
48
|
if (labelWidth != null) {
|
|
45
49
|
if (/^\d+$/.test(labelWidth)) {
|
|
46
50
|
labelStyle = {
|
|
@@ -52,10 +56,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
52
56
|
};
|
|
53
57
|
}
|
|
54
58
|
}
|
|
59
|
+
|
|
55
60
|
var _this$error = this.error,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
61
|
+
ellipsis = _this$error.ellipsis,
|
|
62
|
+
message = _this$error.message,
|
|
63
|
+
errorRef = _this$error.errorRef;
|
|
59
64
|
return _$cv('div', _extends({}, getRestProps(this), {
|
|
60
65
|
'className': _$cn(classNameObj),
|
|
61
66
|
'ev-change': onChange,
|
|
@@ -64,9 +69,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
64
69
|
return label;
|
|
65
70
|
}, __$blocks['label'] = function ($super, data) {
|
|
66
71
|
var block = $blocks['label'];
|
|
72
|
+
|
|
67
73
|
var callBlock = function callBlock() {
|
|
68
74
|
return _$blocks['label'].call($this, $super, data);
|
|
69
75
|
};
|
|
76
|
+
|
|
70
77
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
71
78
|
}, __$blocks['label'](_$no))], 0, 'k-form-label', {
|
|
72
79
|
'htmlFor': htmlFor,
|
|
@@ -77,9 +84,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
77
84
|
return children;
|
|
78
85
|
}, __$blocks['content'] = function ($super, data) {
|
|
79
86
|
var block = $blocks['content'];
|
|
87
|
+
|
|
80
88
|
var callBlock = function callBlock() {
|
|
81
89
|
return _$blocks['content'].call($this, $super, data);
|
|
82
90
|
};
|
|
91
|
+
|
|
83
92
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
84
93
|
}, __$blocks['content'](_$no))
|
|
85
94
|
}), _$cc(Transition, {
|
|
@@ -91,14 +100,17 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
91
100
|
'children': _$cc(Icon, _$tmp0),
|
|
92
101
|
'$blocks': function ($blocks) {
|
|
93
102
|
var _$blocks = {},
|
|
94
|
-
|
|
103
|
+
__$blocks = _$ex({}, $blocks);
|
|
104
|
+
|
|
95
105
|
return (_$blocks['content'] = function ($super) {
|
|
96
106
|
return message.value;
|
|
97
107
|
}, __$blocks['content'] = function ($super, data) {
|
|
98
108
|
var block = $blocks['content'];
|
|
109
|
+
|
|
99
110
|
var callBlock = function callBlock() {
|
|
100
111
|
return _$blocks['content'].call($this, $super, data);
|
|
101
112
|
};
|
|
113
|
+
|
|
102
114
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
103
115
|
}), __$blocks;
|
|
104
116
|
}.call($this, _$em)
|
|
@@ -109,9 +121,11 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
109
121
|
return null;
|
|
110
122
|
}, __$blocks['append'] = function ($super, data) {
|
|
111
123
|
var block = $blocks['append'];
|
|
124
|
+
|
|
112
125
|
var callBlock = function callBlock() {
|
|
113
126
|
return _$blocks['append'].call($this, $super, data);
|
|
114
127
|
};
|
|
128
|
+
|
|
115
129
|
return block ? block.call($this, callBlock, data) : callBlock();
|
|
116
130
|
}, __$blocks['append'](_$no)), 0, 'k-form-append') : undefined]);
|
|
117
131
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export type MethodReturn = boolean | string;
|
|
2
|
-
export type Method = (value: any, param: any) => MethodReturn | Promise<MethodReturn>;
|
|
3
|
-
export type Message = string | ((value: any, param: any) => string);
|
|
4
|
-
export type ClassName = string | ((value: any, param: any) => string);
|
|
1
|
+
export declare type MethodReturn = boolean | string;
|
|
2
|
+
export declare type Method = (value: any, param: any) => MethodReturn | Promise<MethodReturn>;
|
|
3
|
+
export declare type Message = string | ((value: any, param: any) => string);
|
|
4
|
+
export declare type ClassName = string | ((value: any, param: any) => string);
|
|
5
5
|
export declare const methods: Record<string, Method>;
|
|
6
6
|
export declare const messages: Record<string, Message>;
|
|
7
7
|
export declare const classNames: Record<string, ClassName>;
|
|
8
|
-
export declare const addMethod: (name: string, method: Method, message?: Message, className?: ClassName) => void;
|
|
8
|
+
export declare const addMethod: (name: string, method: Method, message?: Message | undefined, className?: ClassName | undefined) => void;
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
import _trimInstanceProperty from "@babel/runtime-corejs3/core-js/instance/trim";
|
|
2
2
|
import { _$ } from '../../i18n';
|
|
3
3
|
import { isNumber, isNullOrUndefined, isString } from 'intact-shared';
|
|
4
|
+
|
|
4
5
|
function decimalPlaces(num) {
|
|
5
6
|
var match = ("" + num).match(/(?:\.(\d+))?$/);
|
|
6
7
|
/* istanbul ignore if */
|
|
8
|
+
|
|
7
9
|
if (!match) {
|
|
8
10
|
return 0;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
+
} // Number of digits right of decimal point.
|
|
12
|
+
|
|
13
|
+
|
|
11
14
|
return match[1] ? match[1].length : 0;
|
|
12
15
|
}
|
|
16
|
+
|
|
13
17
|
export var methods = {
|
|
14
18
|
required: function required(value) {
|
|
15
19
|
if (isNullOrUndefined(value)) return false;
|
|
20
|
+
|
|
16
21
|
if (isString(value)) {
|
|
17
22
|
return _trimInstanceProperty(value).call(value).length > 0;
|
|
18
23
|
}
|
|
24
|
+
|
|
19
25
|
if (Array.isArray(value)) {
|
|
20
26
|
return value.length > 0;
|
|
21
27
|
}
|
|
28
|
+
|
|
22
29
|
return true;
|
|
23
30
|
},
|
|
24
31
|
digits: function digits(value) {
|
|
@@ -63,9 +70,11 @@ export var methods = {
|
|
|
63
70
|
},
|
|
64
71
|
step: function step(value, param) {
|
|
65
72
|
var decimals = decimalPlaces(param);
|
|
73
|
+
|
|
66
74
|
var toInt = function toInt(num) {
|
|
67
75
|
return Math.round(num * Math.pow(10, decimals));
|
|
68
76
|
};
|
|
77
|
+
|
|
69
78
|
return decimalPlaces(value) <= decimals && toInt(value) % toInt(param) === 0;
|
|
70
79
|
},
|
|
71
80
|
equal: function equal(value, param) {
|
|
@@ -157,6 +166,7 @@ export var classNames = {};
|
|
|
157
166
|
export var addMethod = function addMethod(name, method, message, className) {
|
|
158
167
|
methods[name] = method;
|
|
159
168
|
messages[name] = message !== undefined ? message : messages[name];
|
|
169
|
+
|
|
160
170
|
if (className) {
|
|
161
171
|
classNames[name] = className;
|
|
162
172
|
}
|
|
@@ -7,23 +7,30 @@ var defaults = {
|
|
|
7
7
|
item: {
|
|
8
8
|
gap: "24px",
|
|
9
9
|
labelWidth: "80px",
|
|
10
|
+
|
|
10
11
|
get labelLineHeight() {
|
|
11
12
|
return theme.default.height;
|
|
12
13
|
},
|
|
14
|
+
|
|
13
15
|
labelTextAlign: 'right',
|
|
14
16
|
labelGap: '10px',
|
|
17
|
+
|
|
15
18
|
get starColor() {
|
|
16
19
|
return theme.color.danger;
|
|
17
20
|
},
|
|
21
|
+
|
|
18
22
|
starGap: '3px',
|
|
19
23
|
// invalid
|
|
20
24
|
errorFontSize: '12px',
|
|
25
|
+
|
|
21
26
|
get errorColor() {
|
|
22
27
|
return theme.color.danger;
|
|
23
28
|
},
|
|
29
|
+
|
|
24
30
|
get invalidBorder() {
|
|
25
31
|
return "1px solid " + theme.color.danger;
|
|
26
32
|
},
|
|
33
|
+
|
|
27
34
|
// append
|
|
28
35
|
appendPadding: "0 10px",
|
|
29
36
|
// layout
|
|
@@ -47,6 +54,7 @@ export function makeItemStyles() {
|
|
|
47
54
|
}
|
|
48
55
|
export function makeFormStyles() {
|
|
49
56
|
var _context;
|
|
57
|
+
|
|
50
58
|
return /*#__PURE__*/css("&.k-inline{.k-form-item{display:inline-block;vertical-align:top;margin-right:", form.item.inlineGap, ";}.k-form-label{width:auto;}}&.k-vertical{.k-form-item,.k-form-label,.k-form-content{display:block;}.k-form-label{width:auto;text-align:left;line-height:inherit;margin-bottom:", form.item.verticalLabelGap, ";}}", _mapInstanceProperty(_context = ['small', 'mini']).call(_context, function (size) {
|
|
51
59
|
return /*#__PURE__*/css("&.k-", size, "{.k-form-item:not(:last-of-type){margin:", form.item[size + "Gap"], ";}&.k-inline{.k-form-item{margin-right:", form.item[size + "InlineGap"], ";}}}");
|
|
52
60
|
}), ";");
|
|
@@ -3,28 +3,33 @@ import { useState } from '../../hooks/useState';
|
|
|
3
3
|
export function useDirty(getValidate) {
|
|
4
4
|
var instance = useInstance();
|
|
5
5
|
var isDirty = useState(false);
|
|
6
|
+
|
|
6
7
|
function onChange(e) {
|
|
7
8
|
dirty();
|
|
8
9
|
instance.trigger('change', e);
|
|
9
10
|
}
|
|
11
|
+
|
|
10
12
|
function onFocusout(e) {
|
|
11
13
|
dirty();
|
|
12
14
|
instance.trigger('focusout', e);
|
|
13
15
|
}
|
|
16
|
+
|
|
14
17
|
function dirty() {
|
|
15
18
|
if (isDirty.value) return;
|
|
16
|
-
isDirty.set(true);
|
|
17
|
-
// for select, the focusout event triggers before select
|
|
19
|
+
isDirty.set(true); // for select, the focusout event triggers before select
|
|
18
20
|
// so we put off validating it
|
|
21
|
+
|
|
19
22
|
setTimeout(function () {
|
|
20
23
|
// maybe it has been unmounted or reset
|
|
21
24
|
if (instance.$unmounted || !isDirty.value) return;
|
|
22
25
|
getValidate()();
|
|
23
26
|
}, 100);
|
|
24
27
|
}
|
|
28
|
+
|
|
25
29
|
function reset() {
|
|
26
30
|
isDirty.set(false);
|
|
27
31
|
}
|
|
32
|
+
|
|
28
33
|
return {
|
|
29
34
|
onChange: onChange,
|
|
30
35
|
onFocusout: onFocusout,
|
|
@@ -2,11 +2,11 @@ import { useInstance, nextTick, createRef } from 'intact-vue-next';
|
|
|
2
2
|
import { useState, watchState } from '../../hooks/useState';
|
|
3
3
|
import { messages as globalMessages, classNames as globalClassNames } from './methods';
|
|
4
4
|
import { isFunction } from 'intact-shared';
|
|
5
|
-
import { createContext } from '../context';
|
|
6
|
-
// enum MessageOrClassname {
|
|
5
|
+
import { createContext } from '../context'; // enum MessageOrClassname {
|
|
7
6
|
// Message,
|
|
8
7
|
// ClassName,
|
|
9
8
|
// }
|
|
9
|
+
|
|
10
10
|
export var context = createContext();
|
|
11
11
|
export function useError() {
|
|
12
12
|
var instance = useInstance();
|
|
@@ -16,30 +16,38 @@ export function useError() {
|
|
|
16
16
|
watchState(message, function () {
|
|
17
17
|
nextTick(checkEllipsis);
|
|
18
18
|
});
|
|
19
|
+
|
|
19
20
|
function checkEllipsis() {
|
|
20
21
|
var error = errorRef.value;
|
|
21
22
|
if (!error) return;
|
|
22
23
|
ellipsis.set(error.offsetWidth < error.scrollWidth);
|
|
23
24
|
}
|
|
25
|
+
|
|
24
26
|
function getErrorMessageOrClassName(type, key) {
|
|
25
27
|
var custom = instance.get(type);
|
|
26
28
|
var value = custom && custom[key] || (type === 'messages' ? globalMessages[key] : globalClassNames[key]);
|
|
29
|
+
|
|
27
30
|
if (isFunction(value)) {
|
|
28
31
|
var rules = instance.get('rules');
|
|
29
32
|
return value(instance.get('value'), rules[key]);
|
|
30
33
|
}
|
|
34
|
+
|
|
31
35
|
return value;
|
|
32
36
|
}
|
|
37
|
+
|
|
33
38
|
function getErrorMessage(key) {
|
|
34
39
|
return getErrorMessageOrClassName('messages', key);
|
|
35
40
|
}
|
|
41
|
+
|
|
36
42
|
function getErrorClassName(key) {
|
|
37
43
|
return getErrorMessageOrClassName('classNames', key);
|
|
38
44
|
}
|
|
45
|
+
|
|
39
46
|
function reset() {
|
|
40
47
|
ellipsis.set(false);
|
|
41
48
|
message.set(undefined);
|
|
42
49
|
}
|
|
50
|
+
|
|
43
51
|
return {
|
|
44
52
|
ellipsis: ellipsis,
|
|
45
53
|
message: message,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { State } from '../../hooks/useState';
|
|
2
|
-
type PromiseWithCancelled = Promise<boolean> & {
|
|
2
|
+
declare type PromiseWithCancelled = Promise<boolean> & {
|
|
3
3
|
cancelled: boolean;
|
|
4
4
|
};
|
|
5
5
|
export declare function useValidate(getErrorMessage: (ruleName: string) => string, getErrorClassName: (ruleName: string) => string, message: State<string | undefined>, isDirty: State<boolean>): {
|
|
@@ -10,68 +10,81 @@ export function useValidate(getErrorMessage, getErrorClassName, message, isDirty
|
|
|
10
10
|
var errorClassName = useState(undefined);
|
|
11
11
|
var promise = null;
|
|
12
12
|
useReceive(['value', 'rules'], validateIfDirty);
|
|
13
|
+
|
|
13
14
|
function validateIfDirty() {
|
|
14
15
|
if (isDirty.value) {
|
|
15
16
|
validate();
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
function validate() {
|
|
19
21
|
var _instance$get = instance.get(),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
rules = _instance$get.rules,
|
|
23
|
+
value = _instance$get.value;
|
|
24
|
+
|
|
22
25
|
if (!rules) return true;
|
|
23
26
|
cancel();
|
|
24
27
|
var promises = [];
|
|
25
|
-
var ruleNames = [];
|
|
26
|
-
|
|
28
|
+
var ruleNames = []; // check required rule firstly, detect whether it is empty or not
|
|
29
|
+
|
|
27
30
|
var required = globalMethods.required(value, true);
|
|
31
|
+
|
|
28
32
|
if (rules.required) {
|
|
29
33
|
promises.push(required);
|
|
30
34
|
ruleNames.push('required');
|
|
31
|
-
}
|
|
32
|
-
|
|
35
|
+
} // if required rule passed, then check other rules
|
|
36
|
+
|
|
37
|
+
|
|
33
38
|
if (required) {
|
|
34
39
|
for (var key in rules) {
|
|
35
40
|
var rule = rules[key];
|
|
36
41
|
if (key === 'required' || rule === false) continue;
|
|
37
42
|
var fn = void 0;
|
|
43
|
+
|
|
38
44
|
if (isFunction(rule)) {
|
|
39
45
|
fn = rule;
|
|
40
46
|
} else {
|
|
41
47
|
fn = globalMethods[key];
|
|
42
48
|
/* istanbul ignore if */
|
|
49
|
+
|
|
43
50
|
if (!fn) {
|
|
44
51
|
console.warn("Can not find validate method: " + key);
|
|
45
52
|
continue;
|
|
46
53
|
}
|
|
47
54
|
}
|
|
55
|
+
|
|
48
56
|
promises.push(fn(value, rules[key]));
|
|
49
57
|
ruleNames.push(key);
|
|
50
58
|
}
|
|
51
59
|
}
|
|
60
|
+
|
|
52
61
|
return promise = _Promise.all(promises).then(function (results) {
|
|
53
62
|
for (var index = 0; index < results.length; index++) {
|
|
54
63
|
var result = results[index];
|
|
64
|
+
|
|
55
65
|
if (result !== true) {
|
|
56
66
|
var ruleName = ruleNames[index];
|
|
57
67
|
return [false, result || getErrorMessage(ruleName), getErrorClassName(ruleName)];
|
|
58
68
|
}
|
|
59
69
|
}
|
|
70
|
+
|
|
60
71
|
return [true, message.value, undefined];
|
|
61
72
|
}, function (err) {
|
|
62
73
|
var message;
|
|
63
74
|
var className;
|
|
75
|
+
|
|
64
76
|
if (isString(err)) {
|
|
65
77
|
message = err;
|
|
66
78
|
} else if (err) {
|
|
67
79
|
message = err.message || getErrorMessage(err.name);
|
|
68
80
|
className = err.className || getErrorClassName(err.name);
|
|
69
81
|
}
|
|
82
|
+
|
|
70
83
|
return [false, message, className];
|
|
71
84
|
}).then(function (_ref) {
|
|
72
85
|
var _isValid = _ref[0],
|
|
73
|
-
|
|
74
|
-
|
|
86
|
+
_message = _ref[1],
|
|
87
|
+
_className = _ref[2];
|
|
75
88
|
// if cancelled, should return the last result
|
|
76
89
|
if (promise.cancelled) return isValid.value;
|
|
77
90
|
isDirty.set(true);
|
|
@@ -81,16 +94,19 @@ export function useValidate(getErrorMessage, getErrorClassName, message, isDirty
|
|
|
81
94
|
return _isValid;
|
|
82
95
|
});
|
|
83
96
|
}
|
|
97
|
+
|
|
84
98
|
function cancel() {
|
|
85
99
|
if (promise) {
|
|
86
100
|
promise.cancelled = true;
|
|
87
101
|
}
|
|
88
102
|
}
|
|
103
|
+
|
|
89
104
|
function reset() {
|
|
90
105
|
isValid.set(true);
|
|
91
106
|
errorClassName.set(undefined);
|
|
92
107
|
cancel();
|
|
93
108
|
}
|
|
109
|
+
|
|
94
110
|
return {
|
|
95
111
|
isValid: isValid,
|
|
96
112
|
errorClassName: errorClassName,
|
package/components/grid/col.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Component, TypeDefs } from 'intact-vue-next';
|
|
2
2
|
import { PrimitiveValue, BreakpointValues } from './constants';
|
|
3
|
-
export type BaseColProps = {
|
|
3
|
+
export declare type BaseColProps = {
|
|
4
4
|
span?: PrimitiveValue;
|
|
5
5
|
offset?: PrimitiveValue;
|
|
6
6
|
order?: PrimitiveValue;
|
|
7
7
|
pull?: PrimitiveValue;
|
|
8
8
|
push?: PrimitiveValue;
|
|
9
9
|
};
|
|
10
|
-
export type BreakpointProps = BreakpointValues<keyof BaseColProps>;
|
|
11
|
-
export type ColProps = BaseColProps & BreakpointProps;
|
|
10
|
+
export declare type BreakpointProps = BreakpointValues<keyof BaseColProps>;
|
|
11
|
+
export declare type ColProps = BaseColProps & BreakpointProps;
|
|
12
12
|
export declare const baseTypeDefs: Required<TypeDefs<BaseColProps>>;
|
|
13
13
|
export declare class Col extends Component<ColProps> {
|
|
14
14
|
static template: string | import("intact").Template<any>;
|
package/components/grid/col.js
CHANGED
|
@@ -12,22 +12,29 @@ export var baseTypeDefs = {
|
|
|
12
12
|
pull: PrimitiveValue,
|
|
13
13
|
push: PrimitiveValue
|
|
14
14
|
};
|
|
15
|
+
|
|
15
16
|
var typeDefs = _extends({}, baseTypeDefs, breakpoints.reduce(function (memo, key) {
|
|
16
17
|
memo[key] = Value;
|
|
17
18
|
return memo;
|
|
18
19
|
}, {}));
|
|
20
|
+
|
|
19
21
|
export var Col = /*#__PURE__*/function (_Component) {
|
|
20
22
|
_inheritsLoose(Col, _Component);
|
|
23
|
+
|
|
21
24
|
function Col() {
|
|
22
25
|
var _context;
|
|
26
|
+
|
|
23
27
|
var _this;
|
|
28
|
+
|
|
24
29
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
25
30
|
args[_key] = arguments[_key];
|
|
26
31
|
}
|
|
32
|
+
|
|
27
33
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
28
34
|
_this.breakpoints = useBreakpoints();
|
|
29
35
|
return _this;
|
|
30
36
|
}
|
|
37
|
+
|
|
31
38
|
return Col;
|
|
32
39
|
}(Component);
|
|
33
40
|
Col.template = template;
|
|
@@ -5,24 +5,29 @@ import { makeColStyles } from './styles';
|
|
|
5
5
|
import { context as GutterContext, gutterStyle } from './useGutter';
|
|
6
6
|
export default function ($props, $blocks, $__proto__) {
|
|
7
7
|
var _this = this;
|
|
8
|
+
|
|
8
9
|
$blocks || ($blocks = {});
|
|
9
10
|
$props || ($props = {});
|
|
10
11
|
var $this = this;
|
|
12
|
+
|
|
11
13
|
var _this$get = this.get(),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
className = _this$get.className,
|
|
15
|
+
_children = _this$get.children,
|
|
16
|
+
span = _this$get.span,
|
|
17
|
+
style = _this$get.style,
|
|
18
|
+
offset = _this$get.offset,
|
|
19
|
+
push = _this$get.push,
|
|
20
|
+
pull = _this$get.pull,
|
|
21
|
+
order = _this$get.order;
|
|
22
|
+
|
|
20
23
|
return _$cc(GutterContext.Consumer, {
|
|
21
24
|
'children': function children(gutter) {
|
|
22
25
|
var _extends2, _$cn2;
|
|
26
|
+
|
|
23
27
|
var classNameObj = _extends((_extends2 = {
|
|
24
28
|
'k-col': true
|
|
25
29
|
}, _extends2["k-" + span] = span, _extends2["k-offset-" + offset] = offset, _extends2["k-pull-" + pull] = pull, _extends2["k-push-" + push] = push, _extends2["k-order-" + order] = order, _extends2[className] = className && !gutter, _extends2[makeColStyles()] = true, _extends2), _this.breakpoints.getBreakpointsClassName());
|
|
30
|
+
|
|
26
31
|
var newStyle = gutter ? gutterStyle(gutter, style, 'padding') : style;
|
|
27
32
|
return _$cv('div', _extends({
|
|
28
33
|
'className': _$cn(classNameObj)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
2
|
-
export type PrimitiveValue = string | number;
|
|
3
|
-
export type BreakpointValue = {
|
|
1
|
+
export declare type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs';
|
|
2
|
+
export declare type PrimitiveValue = string | number;
|
|
3
|
+
export declare type BreakpointValue = {
|
|
4
4
|
[key in Breakpoint]?: PrimitiveValue;
|
|
5
5
|
};
|
|
6
|
-
export type Value = PrimitiveValue | BreakpointValue;
|
|
7
|
-
export type BreakpointPropsValues<T extends string> = {
|
|
6
|
+
export declare type Value = PrimitiveValue | BreakpointValue;
|
|
7
|
+
export declare type BreakpointPropsValues<T extends string> = {
|
|
8
8
|
[key in T]?: PrimitiveValue;
|
|
9
9
|
};
|
|
10
|
-
export type BreakpointValues<T extends string> = {
|
|
10
|
+
export declare type BreakpointValues<T extends string> = {
|
|
11
11
|
[key in Breakpoint]?: PrimitiveValue | null | undefined | BreakpointPropsValues<T>;
|
|
12
12
|
};
|
|
13
13
|
export declare const Value: (ObjectConstructor | StringConstructor | NumberConstructor)[];
|
package/components/grid/row.js
CHANGED
|
@@ -11,16 +11,21 @@ var typeDefs = {
|
|
|
11
11
|
};
|
|
12
12
|
export var Row = /*#__PURE__*/function (_Component) {
|
|
13
13
|
_inheritsLoose(Row, _Component);
|
|
14
|
+
|
|
14
15
|
function Row() {
|
|
15
16
|
var _context;
|
|
17
|
+
|
|
16
18
|
var _this;
|
|
19
|
+
|
|
17
20
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
21
|
args[_key] = arguments[_key];
|
|
19
22
|
}
|
|
23
|
+
|
|
20
24
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
21
25
|
_this.gutter = useGutter();
|
|
22
26
|
return _this;
|
|
23
27
|
}
|
|
28
|
+
|
|
24
29
|
return Row;
|
|
25
30
|
}(Component);
|
|
26
31
|
Row.template = template;
|
|
@@ -5,15 +5,18 @@ import { makeRowStyles } from './styles';
|
|
|
5
5
|
import { context as GutterContext, gutterStyle } from './useGutter';
|
|
6
6
|
export default function ($props, $blocks, $__proto__) {
|
|
7
7
|
var _classNameObj;
|
|
8
|
+
|
|
8
9
|
$blocks || ($blocks = {});
|
|
9
10
|
$props || ($props = {});
|
|
10
11
|
var $this = this;
|
|
12
|
+
|
|
11
13
|
var _this$get = this.get(),
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
className = _this$get.className,
|
|
15
|
+
children = _this$get.children,
|
|
16
|
+
style = _this$get.style,
|
|
17
|
+
justify = _this$get.justify,
|
|
18
|
+
align = _this$get.align;
|
|
19
|
+
|
|
17
20
|
var classNameObj = (_classNameObj = {
|
|
18
21
|
'k-row': true
|
|
19
22
|
}, _classNameObj["k-justify-" + justify] = justify, _classNameObj["k-align-" + align] = align, _classNameObj[className] = className, _classNameObj[makeRowStyles()] = true, _classNameObj);
|