@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
|
@@ -16,340 +16,410 @@ describe('Tree', function () {
|
|
|
16
16
|
});
|
|
17
17
|
it('expand and shrink', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
18
18
|
var _mount, instance, element, _element$querySelecto, icon1, icon2;
|
|
19
|
+
|
|
19
20
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
20
|
-
while (1)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
while (1) {
|
|
22
|
+
switch (_context.prev = _context.next) {
|
|
23
|
+
case 0:
|
|
24
|
+
this.timeout(0);
|
|
25
|
+
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
26
|
+
_element$querySelecto = element.querySelectorAll('.k-icon'), icon1 = _element$querySelecto[1], icon2 = _element$querySelecto[2];
|
|
27
|
+
icon2.click();
|
|
28
|
+
_context.next = 6;
|
|
29
|
+
return wait(500);
|
|
30
|
+
|
|
31
|
+
case 6:
|
|
32
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
33
|
+
icon1.click();
|
|
34
|
+
_context.next = 10;
|
|
35
|
+
return wait(500);
|
|
36
|
+
|
|
37
|
+
case 10:
|
|
38
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
39
|
+
icon1.click();
|
|
40
|
+
_context.next = 14;
|
|
41
|
+
return wait(500);
|
|
42
|
+
|
|
43
|
+
case 14:
|
|
44
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
45
|
+
|
|
46
|
+
case 15:
|
|
47
|
+
case "end":
|
|
48
|
+
return _context.stop();
|
|
49
|
+
}
|
|
43
50
|
}
|
|
44
51
|
}, _callee, this);
|
|
45
52
|
})));
|
|
46
53
|
it('checkbox', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
47
54
|
var _mount2, instance, element, tree, _element$querySelecto2, checkbox1, checkbox2, data1, _element$querySelecto3, firstIcon, icon, _element$querySelecto4, icon1, data2, _element$querySelecto5, checkbox3, checkbox4;
|
|
55
|
+
|
|
48
56
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
49
|
-
while (1)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
57
|
+
while (1) {
|
|
58
|
+
switch (_context2.prev = _context2.next) {
|
|
59
|
+
case 0:
|
|
60
|
+
_mount2 = mount(CheckboxDemo), instance = _mount2[0], element = _mount2[1];
|
|
61
|
+
tree = instance.refs.tree;
|
|
62
|
+
expect(_JSON$stringify(tree.getCheckedData())).to.matchSnapshot();
|
|
63
|
+
_element$querySelecto2 = element.querySelectorAll('.k-checkbox'), checkbox1 = _element$querySelecto2[0], checkbox2 = _element$querySelecto2[1];
|
|
64
|
+
checkbox2.click();
|
|
65
|
+
_context2.next = 7;
|
|
66
|
+
return wait();
|
|
67
|
+
|
|
68
|
+
case 7:
|
|
69
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
70
|
+
data1 = tree.getCheckedData();
|
|
71
|
+
expect(data1.length).to.eql(4);
|
|
72
|
+
expect(_JSON$stringify(data1)).to.matchSnapshot();
|
|
73
|
+
_element$querySelecto3 = element.querySelectorAll('.k-icon'), firstIcon = _element$querySelecto3[0], icon = _element$querySelecto3[1]; // expand
|
|
74
|
+
|
|
75
|
+
icon.click();
|
|
76
|
+
_context2.next = 15;
|
|
77
|
+
return wait();
|
|
78
|
+
|
|
79
|
+
case 15:
|
|
80
|
+
_element$querySelecto4 = element.querySelectorAll('.k-icon'), icon1 = _element$querySelecto4[2]; // expand
|
|
81
|
+
|
|
82
|
+
icon1.click();
|
|
83
|
+
_context2.next = 19;
|
|
84
|
+
return wait(500);
|
|
85
|
+
|
|
86
|
+
case 19:
|
|
87
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
88
|
+
data2 = tree.getCheckedData(true);
|
|
89
|
+
expect(data2.length).to.eql(2);
|
|
90
|
+
expect(_JSON$stringify(data2)).to.matchSnapshot(); // uncheck a leaf checkbox
|
|
91
|
+
|
|
92
|
+
_element$querySelecto5 = element.querySelectorAll('.k-checkbox'), checkbox3 = _element$querySelecto5[2], checkbox4 = _element$querySelecto5[3];
|
|
93
|
+
checkbox4.click();
|
|
94
|
+
_context2.next = 27;
|
|
95
|
+
return wait();
|
|
96
|
+
|
|
97
|
+
case 27:
|
|
98
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
99
|
+
checkbox4.click();
|
|
100
|
+
_context2.next = 31;
|
|
101
|
+
return wait();
|
|
102
|
+
|
|
103
|
+
case 31:
|
|
104
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
105
|
+
checkbox3.click();
|
|
106
|
+
_context2.next = 35;
|
|
107
|
+
return wait();
|
|
108
|
+
|
|
109
|
+
case 35:
|
|
110
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
111
|
+
|
|
112
|
+
case 36:
|
|
113
|
+
case "end":
|
|
114
|
+
return _context2.stop();
|
|
115
|
+
}
|
|
97
116
|
}
|
|
98
117
|
}, _callee2);
|
|
99
118
|
})));
|
|
100
119
|
it('async load', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
101
120
|
var _mount3, instance, element, icon, _element$querySelecto6, icon1, checkbox, _element$querySelecto7, icon2;
|
|
121
|
+
|
|
102
122
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
103
|
-
while (1)
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
123
|
+
while (1) {
|
|
124
|
+
switch (_context3.prev = _context3.next) {
|
|
125
|
+
case 0:
|
|
126
|
+
this.timeout(0);
|
|
127
|
+
_mount3 = mount(LoadingDemo), instance = _mount3[0], element = _mount3[1];
|
|
128
|
+
icon = element.querySelector('.k-icon');
|
|
129
|
+
icon.click();
|
|
130
|
+
_context3.next = 6;
|
|
131
|
+
return wait();
|
|
132
|
+
|
|
133
|
+
case 6:
|
|
134
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
135
|
+
_context3.next = 9;
|
|
136
|
+
return wait(500);
|
|
137
|
+
|
|
138
|
+
case 9:
|
|
139
|
+
_element$querySelecto6 = element.querySelectorAll('.k-icon'), icon1 = _element$querySelecto6[1];
|
|
140
|
+
icon1.click();
|
|
141
|
+
_context3.next = 13;
|
|
142
|
+
return wait();
|
|
143
|
+
|
|
144
|
+
case 13:
|
|
145
|
+
expect(element.outerHTML).to.matchSnapshot(); // loaded
|
|
146
|
+
|
|
147
|
+
_context3.next = 16;
|
|
148
|
+
return wait(1500);
|
|
149
|
+
|
|
150
|
+
case 16:
|
|
151
|
+
expect(element.outerHTML).to.matchSnapshot(); // check
|
|
152
|
+
|
|
153
|
+
checkbox = element.querySelector('.k-checkbox');
|
|
154
|
+
checkbox.click();
|
|
155
|
+
_context3.next = 21;
|
|
156
|
+
return wait();
|
|
157
|
+
|
|
158
|
+
case 21:
|
|
159
|
+
_element$querySelecto7 = element.querySelectorAll('.k-icon'), icon2 = _element$querySelecto7[2];
|
|
160
|
+
icon2.click();
|
|
161
|
+
_context3.next = 25;
|
|
162
|
+
return wait(1500);
|
|
163
|
+
|
|
164
|
+
case 25:
|
|
165
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
166
|
+
|
|
167
|
+
case 26:
|
|
168
|
+
case "end":
|
|
169
|
+
return _context3.stop();
|
|
170
|
+
}
|
|
142
171
|
}
|
|
143
172
|
}, _callee3, this);
|
|
144
173
|
})));
|
|
145
174
|
it('append and remove node', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
146
175
|
var _mount4, instance, element, _element$querySelecto8, btn1, btn2, _element$querySelecto9, checkbox, _element$querySelecto10, btn3, _element$querySelecto11, checkbox1;
|
|
176
|
+
|
|
147
177
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
148
|
-
while (1)
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
178
|
+
while (1) {
|
|
179
|
+
switch (_context4.prev = _context4.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
this.timeout(0);
|
|
182
|
+
_mount4 = mount(CustomDemo), instance = _mount4[0], element = _mount4[1];
|
|
183
|
+
_element$querySelecto8 = element.querySelectorAll('.k-btn'), btn1 = _element$querySelecto8[0], btn2 = _element$querySelecto8[1];
|
|
184
|
+
btn1.click();
|
|
185
|
+
_context4.next = 6;
|
|
186
|
+
return wait(500);
|
|
187
|
+
|
|
188
|
+
case 6:
|
|
189
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
190
|
+
expect(instance.get('data')).to.have.length(3);
|
|
191
|
+
expect(instance.get('data')).to.matchSnapshot();
|
|
192
|
+
btn2.click();
|
|
193
|
+
_context4.next = 12;
|
|
194
|
+
return wait(500);
|
|
195
|
+
|
|
196
|
+
case 12:
|
|
197
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
198
|
+
_element$querySelecto9 = element.querySelectorAll('.k-checkbox'), checkbox = _element$querySelecto9[1];
|
|
199
|
+
checkbox.click();
|
|
200
|
+
_context4.next = 17;
|
|
201
|
+
return wait();
|
|
202
|
+
|
|
203
|
+
case 17:
|
|
204
|
+
_element$querySelecto10 = element.querySelectorAll('.k-btn'), btn3 = _element$querySelecto10[3];
|
|
205
|
+
btn3.click();
|
|
206
|
+
_context4.next = 21;
|
|
207
|
+
return wait(500);
|
|
208
|
+
|
|
209
|
+
case 21:
|
|
210
|
+
expect(element.outerHTML).to.matchSnapshot(); // uncheck and remove
|
|
211
|
+
|
|
212
|
+
_element$querySelecto11 = element.querySelectorAll('.k-checkbox'), checkbox1 = _element$querySelecto11[2];
|
|
213
|
+
checkbox1.click();
|
|
214
|
+
_context4.next = 26;
|
|
215
|
+
return wait();
|
|
216
|
+
|
|
217
|
+
case 26:
|
|
218
|
+
checkbox1.parentNode.querySelector('.k-btn:nth-child(2)').click();
|
|
219
|
+
_context4.next = 29;
|
|
220
|
+
return wait(500);
|
|
221
|
+
|
|
222
|
+
case 29:
|
|
223
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
224
|
+
expect(instance.get('data')).to.matchSnapshot();
|
|
225
|
+
|
|
226
|
+
case 31:
|
|
227
|
+
case "end":
|
|
228
|
+
return _context4.stop();
|
|
229
|
+
}
|
|
191
230
|
}
|
|
192
231
|
}, _callee4, this);
|
|
193
232
|
})));
|
|
194
233
|
it('filterable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
195
234
|
var _mount5, instance, element;
|
|
235
|
+
|
|
196
236
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
197
|
-
while (1)
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
237
|
+
while (1) {
|
|
238
|
+
switch (_context5.prev = _context5.next) {
|
|
239
|
+
case 0:
|
|
240
|
+
_mount5 = mount(FilterableDemo), instance = _mount5[0], element = _mount5[1];
|
|
241
|
+
instance.set('keywords', 'First');
|
|
242
|
+
_context5.next = 4;
|
|
243
|
+
return wait(500);
|
|
244
|
+
|
|
245
|
+
case 4:
|
|
246
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
247
|
+
instance.set('keywords', '2.1.1');
|
|
248
|
+
_context5.next = 8;
|
|
249
|
+
return wait(500);
|
|
250
|
+
|
|
251
|
+
case 8:
|
|
252
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
253
|
+
|
|
254
|
+
case 9:
|
|
255
|
+
case "end":
|
|
256
|
+
return _context5.stop();
|
|
257
|
+
}
|
|
213
258
|
}
|
|
214
259
|
}, _callee5);
|
|
215
260
|
})));
|
|
216
261
|
it('select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
217
262
|
var _mount6, instance, element, tree, _element$querySelecto12, text1, text2, disabledText;
|
|
263
|
+
|
|
218
264
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
219
|
-
while (1)
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
265
|
+
while (1) {
|
|
266
|
+
switch (_context6.prev = _context6.next) {
|
|
267
|
+
case 0:
|
|
268
|
+
_mount6 = mount(SelectDemo), instance = _mount6[0], element = _mount6[1];
|
|
269
|
+
tree = instance.refs.tree;
|
|
270
|
+
expect(tree.getSelectedData().length).to.eql(1);
|
|
271
|
+
_element$querySelecto12 = element.querySelectorAll('.k-tree-text'), text1 = _element$querySelecto12[2], text2 = _element$querySelecto12[3], disabledText = _element$querySelecto12[5];
|
|
272
|
+
text1.click();
|
|
273
|
+
_context6.next = 7;
|
|
274
|
+
return wait();
|
|
275
|
+
|
|
276
|
+
case 7:
|
|
277
|
+
expect(tree.getSelectedData().length).to.eql(2);
|
|
278
|
+
text1.click();
|
|
279
|
+
text2.click();
|
|
280
|
+
_context6.next = 12;
|
|
281
|
+
return wait();
|
|
282
|
+
|
|
283
|
+
case 12:
|
|
284
|
+
expect(tree.getSelectedData().length).to.eql(0);
|
|
285
|
+
disabledText.click();
|
|
286
|
+
_context6.next = 16;
|
|
287
|
+
return wait();
|
|
288
|
+
|
|
289
|
+
case 16:
|
|
290
|
+
expect(tree.getSelectedData().length).to.eql(0); // disable select and click on disabled selectable text should expand the tree
|
|
291
|
+
|
|
292
|
+
tree.set('selectable', false);
|
|
293
|
+
text1.click();
|
|
294
|
+
_context6.next = 21;
|
|
295
|
+
return wait(500);
|
|
296
|
+
|
|
297
|
+
case 21:
|
|
298
|
+
expect(tree.getSelectedData().length).to.eql(0);
|
|
299
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
300
|
+
|
|
301
|
+
case 23:
|
|
302
|
+
case "end":
|
|
303
|
+
return _context6.stop();
|
|
304
|
+
}
|
|
252
305
|
}
|
|
253
306
|
}, _callee6);
|
|
254
307
|
})));
|
|
255
308
|
it('draggable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
256
309
|
var onDenyDrag, onDenyDrop, onDragEnd, _mount7, instance, element, disabled, nodes, notAllowed;
|
|
310
|
+
|
|
257
311
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
258
|
-
while (1)
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
expect(
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
+
while (1) {
|
|
313
|
+
switch (_context7.prev = _context7.next) {
|
|
314
|
+
case 0:
|
|
315
|
+
this.timeout(0);
|
|
316
|
+
onDenyDrag = sinon.spy();
|
|
317
|
+
onDenyDrop = sinon.spy();
|
|
318
|
+
onDragEnd = sinon.spy();
|
|
319
|
+
DraggableDemo.prototype.onDenyDrag = onDenyDrag;
|
|
320
|
+
DraggableDemo.prototype.onDenyDrop = onDenyDrop;
|
|
321
|
+
DraggableDemo.prototype.onDragEnd = onDragEnd;
|
|
322
|
+
_mount7 = mount(DraggableDemo), instance = _mount7[0], element = _mount7[1];
|
|
323
|
+
instance.set('expandedKeys', ['2', '2-1', '1', '1-1']);
|
|
324
|
+
_context7.next = 11;
|
|
325
|
+
return wait(500);
|
|
326
|
+
|
|
327
|
+
case 11:
|
|
328
|
+
// can not drag disabled item
|
|
329
|
+
disabled = element.querySelector('.k-disabled'); // dispatchEvent(disabled, 'mousedown');
|
|
330
|
+
|
|
331
|
+
dispatchEvent(disabled, 'dragstart');
|
|
332
|
+
expect(onDenyDrag.callCount).to.eql(1);
|
|
333
|
+
nodes = element.querySelectorAll('.k-tree-label'); // can not drag not-allowed item
|
|
334
|
+
|
|
335
|
+
notAllowed = nodes[2]; // dispatchEvent(notAllowed, 'mousedown');
|
|
336
|
+
|
|
337
|
+
dispatchEvent(notAllowed, 'dragstart');
|
|
338
|
+
expect(onDenyDrag.callCount).to.eql(2); // drag insert
|
|
339
|
+
|
|
340
|
+
return _context7.abrupt("return", dragInsert(nodes[6], nodes[6]).then(function () {
|
|
341
|
+
// drag to self will do nothing
|
|
342
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
343
|
+
expect(onDragEnd.callCount).to.eql(0);
|
|
344
|
+
return dragInsert(nodes[6], notAllowed);
|
|
345
|
+
}).then(function () {
|
|
346
|
+
// drag to not-allowed item will do nothing
|
|
347
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
348
|
+
expect(onDragEnd.callCount).to.eql(0);
|
|
349
|
+
return dragInsert(nodes[6], disabled);
|
|
350
|
+
}).then(function () {
|
|
351
|
+
// drag to disabled item will do nothing
|
|
352
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
353
|
+
expect(onDragEnd.callCount).to.eql(0);
|
|
354
|
+
return dragInsert(nodes[6], nodes[5], 'before');
|
|
355
|
+
}).then(function () {
|
|
356
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
357
|
+
expect(onDragEnd.callCount).to.eql(1);
|
|
358
|
+
expect(instance.get('data')).to.matchSnapshot();
|
|
359
|
+
return dragInsert(nodes[6], nodes[5], 'after');
|
|
360
|
+
}).then(function () {
|
|
361
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
362
|
+
expect(instance.get('data')).to.matchSnapshot();
|
|
363
|
+
return dragInsert(nodes[6], nodes[5]);
|
|
364
|
+
}).then(function () {
|
|
365
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
366
|
+
expect(instance.get('data')).to.matchSnapshot();
|
|
367
|
+
}));
|
|
368
|
+
|
|
369
|
+
case 19:
|
|
370
|
+
case "end":
|
|
371
|
+
return _context7.stop();
|
|
372
|
+
}
|
|
312
373
|
}
|
|
313
374
|
}, _callee7, this);
|
|
314
375
|
})));
|
|
315
376
|
});
|
|
377
|
+
|
|
316
378
|
function dragInsert(_x, _x2, _x3) {
|
|
317
379
|
return _dragInsert.apply(this, arguments);
|
|
318
380
|
}
|
|
381
|
+
|
|
319
382
|
function _dragInsert() {
|
|
320
383
|
_dragInsert = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(srcElement, toElement, mode) {
|
|
321
384
|
var _toElement$getBoundin, top, bottom, height, des;
|
|
385
|
+
|
|
322
386
|
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
323
|
-
while (1)
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
_toElement$getBoundin = toElement.getBoundingClientRect(), top = _toElement$getBoundin.top, bottom = _toElement$getBoundin.bottom, height = _toElement$getBoundin.height;
|
|
330
|
-
des = height * RANGE;
|
|
331
|
-
if (mode === 'before') {
|
|
332
|
-
dispatchEvent(toElement, 'dragover', {
|
|
333
|
-
clientY: top + des - 1
|
|
334
|
-
});
|
|
335
|
-
} else if (mode === 'after') {
|
|
336
|
-
dispatchEvent(toElement, 'dragover', {
|
|
337
|
-
clientY: bottom - des + 1
|
|
338
|
-
});
|
|
339
|
-
} else {
|
|
340
|
-
dispatchEvent(toElement, 'dragover', {
|
|
341
|
-
clientY: top + des + 1
|
|
387
|
+
while (1) {
|
|
388
|
+
switch (_context8.prev = _context8.next) {
|
|
389
|
+
case 0:
|
|
390
|
+
// dispatchEvent(srcElement, 'mousedown');
|
|
391
|
+
dispatchEvent(srcElement, 'dragstart', {
|
|
392
|
+
dataTransfer: new DataTransfer()
|
|
342
393
|
});
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
394
|
+
_toElement$getBoundin = toElement.getBoundingClientRect(), top = _toElement$getBoundin.top, bottom = _toElement$getBoundin.bottom, height = _toElement$getBoundin.height;
|
|
395
|
+
des = height * RANGE;
|
|
396
|
+
|
|
397
|
+
if (mode === 'before') {
|
|
398
|
+
dispatchEvent(toElement, 'dragover', {
|
|
399
|
+
clientY: top + des - 1
|
|
400
|
+
});
|
|
401
|
+
} else if (mode === 'after') {
|
|
402
|
+
dispatchEvent(toElement, 'dragover', {
|
|
403
|
+
clientY: bottom - des + 1
|
|
404
|
+
});
|
|
405
|
+
} else {
|
|
406
|
+
dispatchEvent(toElement, 'dragover', {
|
|
407
|
+
clientY: top + des + 1
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
_context8.next = 6;
|
|
412
|
+
return wait(700);
|
|
413
|
+
|
|
414
|
+
case 6:
|
|
415
|
+
dispatchEvent(toElement, 'dragend');
|
|
416
|
+
_context8.next = 9;
|
|
417
|
+
return wait(500);
|
|
418
|
+
|
|
419
|
+
case 9:
|
|
420
|
+
case "end":
|
|
421
|
+
return _context8.stop();
|
|
422
|
+
}
|
|
353
423
|
}
|
|
354
424
|
}, _callee8);
|
|
355
425
|
}));
|