@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
|
@@ -23,295 +23,365 @@ describe('Tooltip', function () {
|
|
|
23
23
|
});
|
|
24
24
|
it('should show and hide content correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
25
25
|
var _mount, element, _Array$from, first, second, disabled, content, content1, content2;
|
|
26
|
+
|
|
26
27
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
27
|
-
while (1)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
28
|
+
while (1) {
|
|
29
|
+
switch (_context.prev = _context.next) {
|
|
30
|
+
case 0:
|
|
31
|
+
_mount = mount(BasicDemo), element = _mount[1];
|
|
32
|
+
_Array$from = _Array$from2(element.querySelectorAll('span')), first = _Array$from[0], second = _Array$from[2], disabled = _Array$from[4];
|
|
33
|
+
dispatchEvent(first, 'mouseenter');
|
|
34
|
+
_context.next = 5;
|
|
35
|
+
return wait(0);
|
|
36
|
+
|
|
37
|
+
case 5:
|
|
38
|
+
content = getElement('.k-tooltip-content');
|
|
39
|
+
expect(content.textContent).eql('hello'); // should not show
|
|
40
|
+
|
|
41
|
+
dispatchEvent(second, 'mouseenter');
|
|
42
|
+
_context.next = 10;
|
|
43
|
+
return wait(0);
|
|
44
|
+
|
|
45
|
+
case 10:
|
|
46
|
+
content1 = getElement('.k-tooltip-content');
|
|
47
|
+
expect(content1).eql(content); // should not show if disabled
|
|
48
|
+
|
|
49
|
+
dispatchEvent(disabled, 'mouseenter');
|
|
50
|
+
_context.next = 15;
|
|
51
|
+
return wait(0);
|
|
52
|
+
|
|
53
|
+
case 15:
|
|
54
|
+
content2 = getElement('.k-tooltip-content');
|
|
55
|
+
expect(content2).eql(content); // should hide
|
|
56
|
+
|
|
57
|
+
dispatchEvent(first, 'mouseleave');
|
|
58
|
+
_context.next = 20;
|
|
59
|
+
return wait(600);
|
|
60
|
+
|
|
61
|
+
case 20:
|
|
62
|
+
expect(content.style.display).to.eql('none');
|
|
63
|
+
|
|
64
|
+
case 21:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context.stop();
|
|
67
|
+
}
|
|
60
68
|
}
|
|
61
69
|
}, _callee);
|
|
62
70
|
})));
|
|
63
71
|
it('should position correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
64
72
|
var _mount2, instance, element, tooltipContent, arrow, at, _at$getBoundingClient, width, height, left, top, contains, eql;
|
|
73
|
+
|
|
65
74
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
66
|
-
while (1)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
a = Math.floor(a);
|
|
78
|
-
b = Math.floor(b);
|
|
79
|
-
// Don't be entangled with the difference of 1 to 2 pixels
|
|
80
|
-
expect(a >= b - 1 && a <= b + 1).to.be.true;
|
|
81
|
-
};
|
|
82
|
-
instance.set('position', 'left');
|
|
83
|
-
_context2.next = 10;
|
|
84
|
-
return wait();
|
|
85
|
-
case 10:
|
|
86
|
-
contains('k-right');
|
|
87
|
-
eql(arrow.offsetTop, Math.round(tooltipContent.offsetHeight / 2 - arrow.offsetHeight / 2));
|
|
88
|
-
instance.set('position', 'right');
|
|
89
|
-
_context2.next = 15;
|
|
90
|
-
return wait();
|
|
91
|
-
case 15:
|
|
92
|
-
contains('k-left');
|
|
93
|
-
eql(arrow.offsetTop, Math.round(tooltipContent.offsetHeight / 2 - arrow.offsetHeight / 2));
|
|
94
|
-
instance.set('position', 'top');
|
|
95
|
-
_context2.next = 20;
|
|
96
|
-
return wait();
|
|
97
|
-
case 20:
|
|
98
|
-
contains('k-bottom');
|
|
99
|
-
eql(arrow.offsetLeft, Math.round(tooltipContent.offsetWidth / 2 - arrow.offsetWidth / 2));
|
|
100
|
-
instance.set('position', 'bottom');
|
|
101
|
-
_context2.next = 25;
|
|
102
|
-
return wait();
|
|
103
|
-
case 25:
|
|
104
|
-
contains('k-top');
|
|
105
|
-
eql(arrow.offsetLeft, Math.round(tooltipContent.offsetWidth / 2 - arrow.offsetWidth / 2));
|
|
106
|
-
instance.set('position', 'custom');
|
|
107
|
-
_context2.next = 30;
|
|
108
|
-
return wait();
|
|
109
|
-
case 30:
|
|
110
|
-
instance.getPosition = function () {
|
|
111
|
-
return {
|
|
112
|
-
my: 'left bottom',
|
|
113
|
-
at: 'left top'
|
|
75
|
+
while (1) {
|
|
76
|
+
switch (_context2.prev = _context2.next) {
|
|
77
|
+
case 0:
|
|
78
|
+
_mount2 = mount(PositionDemo), instance = _mount2[0], element = _mount2[1];
|
|
79
|
+
tooltipContent = getElement('.k-tooltip-content');
|
|
80
|
+
arrow = tooltipContent.querySelector('.k-tooltip-arrow');
|
|
81
|
+
at = element.querySelector('.opera .k-btn');
|
|
82
|
+
_at$getBoundingClient = at.getBoundingClientRect(), width = _at$getBoundingClient.width, height = _at$getBoundingClient.height, left = _at$getBoundingClient.left, top = _at$getBoundingClient.top;
|
|
83
|
+
|
|
84
|
+
contains = function contains(name) {
|
|
85
|
+
return expect(arrow.classList.contains(name)).to.be.true;
|
|
114
86
|
};
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
instance.getPosition = function () {
|
|
122
|
-
return {
|
|
123
|
-
my: 'left+100 bottom',
|
|
124
|
-
at: 'left top'
|
|
87
|
+
|
|
88
|
+
eql = function eql(a, b) {
|
|
89
|
+
a = Math.floor(a);
|
|
90
|
+
b = Math.floor(b); // Don't be entangled with the difference of 1 to 2 pixels
|
|
91
|
+
|
|
92
|
+
expect(a >= b - 1 && a <= b + 1).to.be.true;
|
|
125
93
|
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
94
|
+
|
|
95
|
+
instance.set('position', 'left');
|
|
96
|
+
_context2.next = 10;
|
|
97
|
+
return wait();
|
|
98
|
+
|
|
99
|
+
case 10:
|
|
100
|
+
contains('k-right');
|
|
101
|
+
eql(arrow.offsetTop, Math.round(tooltipContent.offsetHeight / 2 - arrow.offsetHeight / 2));
|
|
102
|
+
instance.set('position', 'right');
|
|
103
|
+
_context2.next = 15;
|
|
104
|
+
return wait();
|
|
105
|
+
|
|
106
|
+
case 15:
|
|
107
|
+
contains('k-left');
|
|
108
|
+
eql(arrow.offsetTop, Math.round(tooltipContent.offsetHeight / 2 - arrow.offsetHeight / 2));
|
|
109
|
+
instance.set('position', 'top');
|
|
110
|
+
_context2.next = 20;
|
|
111
|
+
return wait();
|
|
112
|
+
|
|
113
|
+
case 20:
|
|
114
|
+
contains('k-bottom');
|
|
115
|
+
eql(arrow.offsetLeft, Math.round(tooltipContent.offsetWidth / 2 - arrow.offsetWidth / 2));
|
|
116
|
+
instance.set('position', 'bottom');
|
|
117
|
+
_context2.next = 25;
|
|
118
|
+
return wait();
|
|
119
|
+
|
|
120
|
+
case 25:
|
|
121
|
+
contains('k-top');
|
|
122
|
+
eql(arrow.offsetLeft, Math.round(tooltipContent.offsetWidth / 2 - arrow.offsetWidth / 2));
|
|
123
|
+
instance.set('position', 'custom');
|
|
124
|
+
_context2.next = 30;
|
|
125
|
+
return wait();
|
|
126
|
+
|
|
127
|
+
case 30:
|
|
128
|
+
instance.getPosition = function () {
|
|
129
|
+
return {
|
|
130
|
+
my: 'left bottom',
|
|
131
|
+
at: 'left top'
|
|
132
|
+
};
|
|
136
133
|
};
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
134
|
+
|
|
135
|
+
instance.forceUpdate();
|
|
136
|
+
_context2.next = 34;
|
|
137
|
+
return wait();
|
|
138
|
+
|
|
139
|
+
case 34:
|
|
140
|
+
eql(arrow.offsetLeft, Math.round(width / 2 - arrow.offsetWidth / 2));
|
|
141
|
+
|
|
142
|
+
instance.getPosition = function () {
|
|
143
|
+
return {
|
|
144
|
+
my: 'left+100 bottom',
|
|
145
|
+
at: 'left top'
|
|
146
|
+
};
|
|
147
147
|
};
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
148
|
+
|
|
149
|
+
instance.forceUpdate();
|
|
150
|
+
_context2.next = 39;
|
|
151
|
+
return wait();
|
|
152
|
+
|
|
153
|
+
case 39:
|
|
154
|
+
eql(arrow.offsetLeft, 1);
|
|
155
|
+
|
|
156
|
+
instance.getPosition = function () {
|
|
157
|
+
return {
|
|
158
|
+
my: 'left top',
|
|
159
|
+
at: 'right top'
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
instance.forceUpdate();
|
|
164
|
+
_context2.next = 44;
|
|
165
|
+
return wait();
|
|
166
|
+
|
|
167
|
+
case 44:
|
|
168
|
+
eql(arrow.offsetTop, Math.floor(tooltipContent.offsetHeight / 2 - arrow.offsetHeight / 2));
|
|
169
|
+
|
|
170
|
+
instance.getPosition = function () {
|
|
171
|
+
return {
|
|
172
|
+
my: 'left top+30',
|
|
173
|
+
at: 'right top'
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
instance.forceUpdate();
|
|
178
|
+
_context2.next = 49;
|
|
179
|
+
return wait();
|
|
180
|
+
|
|
181
|
+
case 49:
|
|
182
|
+
eql(arrow.offsetTop, 1);
|
|
183
|
+
|
|
184
|
+
case 50:
|
|
185
|
+
case "end":
|
|
186
|
+
return _context2.stop();
|
|
187
|
+
}
|
|
157
188
|
}
|
|
158
189
|
}, _callee2);
|
|
159
190
|
})));
|
|
160
191
|
it('should trigger correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
161
192
|
var _mount3, element, _element$querySelecto, click, content, content1;
|
|
193
|
+
|
|
162
194
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
163
|
-
while (1)
|
|
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
|
-
|
|
195
|
+
while (1) {
|
|
196
|
+
switch (_context3.prev = _context3.next) {
|
|
197
|
+
case 0:
|
|
198
|
+
_mount3 = mount(TriggerDemo), element = _mount3[1];
|
|
199
|
+
_element$querySelecto = element.querySelectorAll('.k-btn'), click = _element$querySelecto[1];
|
|
200
|
+
click.click();
|
|
201
|
+
_context3.next = 5;
|
|
202
|
+
return wait();
|
|
203
|
+
|
|
204
|
+
case 5:
|
|
205
|
+
content = getElement('.k-tooltip-content');
|
|
206
|
+
expect(content.textContent).to.matchSnapshot(); // should not hide
|
|
207
|
+
|
|
208
|
+
content.click();
|
|
209
|
+
_context3.next = 10;
|
|
210
|
+
return wait();
|
|
211
|
+
|
|
212
|
+
case 10:
|
|
213
|
+
content1 = getElement('.k-tooltip-content');
|
|
214
|
+
expect(content).eql(content1); // should hide when click document
|
|
215
|
+
|
|
216
|
+
document.body.click();
|
|
217
|
+
_context3.next = 15;
|
|
218
|
+
return wait(500);
|
|
219
|
+
|
|
220
|
+
case 15:
|
|
221
|
+
expect(content.style.display).to.eql('none');
|
|
222
|
+
|
|
223
|
+
case 16:
|
|
224
|
+
case "end":
|
|
225
|
+
return _context3.stop();
|
|
226
|
+
}
|
|
189
227
|
}
|
|
190
228
|
}, _callee3);
|
|
191
229
|
})));
|
|
192
230
|
it('should be hoverable', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
193
231
|
var _mount4, element, _Array$from3, canHover, content, content1;
|
|
232
|
+
|
|
194
233
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
195
|
-
while (1)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
234
|
+
while (1) {
|
|
235
|
+
switch (_context4.prev = _context4.next) {
|
|
236
|
+
case 0:
|
|
237
|
+
this.timeout(0);
|
|
238
|
+
_mount4 = mount(TriggerDemo), element = _mount4[1];
|
|
239
|
+
_Array$from3 = _Array$from2(element.querySelectorAll('.k-btn')), canHover = _Array$from3[2];
|
|
240
|
+
dispatchEvent(canHover, 'mouseenter');
|
|
241
|
+
_context4.next = 6;
|
|
242
|
+
return wait();
|
|
243
|
+
|
|
244
|
+
case 6:
|
|
245
|
+
dispatchEvent(canHover, 'mouseleave');
|
|
246
|
+
_context4.next = 9;
|
|
247
|
+
return wait(500);
|
|
248
|
+
|
|
249
|
+
case 9:
|
|
250
|
+
content = getElement('.k-tooltip-content');
|
|
251
|
+
dispatchEvent(content, 'mouseenter');
|
|
252
|
+
_context4.next = 13;
|
|
253
|
+
return wait(500);
|
|
254
|
+
|
|
255
|
+
case 13:
|
|
256
|
+
content1 = getElement('.k-tooltip-content'); // should not hide when move mouse from button to tooltip content
|
|
257
|
+
|
|
258
|
+
expect(content1).eql(content);
|
|
259
|
+
dispatchEvent(canHover, 'mouseleave');
|
|
260
|
+
_context4.next = 18;
|
|
261
|
+
return wait(800);
|
|
262
|
+
|
|
263
|
+
case 18:
|
|
264
|
+
expect(content.style.display).to.eql('none');
|
|
265
|
+
|
|
266
|
+
case 19:
|
|
267
|
+
case "end":
|
|
268
|
+
return _context4.stop();
|
|
269
|
+
}
|
|
223
270
|
}
|
|
224
271
|
}, _callee4, this);
|
|
225
272
|
})));
|
|
226
273
|
it('should custom content correctly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
227
274
|
var _mount5, element, _Array$from4, btn, content;
|
|
275
|
+
|
|
228
276
|
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
229
|
-
while (1)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
277
|
+
while (1) {
|
|
278
|
+
switch (_context5.prev = _context5.next) {
|
|
279
|
+
case 0:
|
|
280
|
+
_mount5 = mount(ContentDemo), element = _mount5[1];
|
|
281
|
+
_Array$from4 = _Array$from2(element.querySelectorAll('.k-btn')), btn = _Array$from4[0];
|
|
282
|
+
btn.click();
|
|
283
|
+
_context5.next = 5;
|
|
284
|
+
return wait(500);
|
|
285
|
+
|
|
286
|
+
case 5:
|
|
287
|
+
content = getElement('.k-tooltip-content'); // ignore the arrow, because it may change className to adapt to the direction
|
|
288
|
+
|
|
289
|
+
expect(content.querySelector('.k-slider').outerHTML).to.matchSnapshot();
|
|
290
|
+
|
|
291
|
+
case 7:
|
|
292
|
+
case "end":
|
|
293
|
+
return _context5.stop();
|
|
294
|
+
}
|
|
242
295
|
}
|
|
243
296
|
}, _callee5);
|
|
244
297
|
})));
|
|
245
298
|
it('should handle confirm tooltip corectly', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
246
299
|
var _mount6, instance, element, cancelCb, okCb, content, _Array$from5, btn;
|
|
300
|
+
|
|
247
301
|
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
248
|
-
while (1)
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
302
|
+
while (1) {
|
|
303
|
+
switch (_context6.prev = _context6.next) {
|
|
304
|
+
case 0:
|
|
305
|
+
_mount6 = mount(ConfirmDemo), instance = _mount6[0], element = _mount6[1];
|
|
306
|
+
cancelCb = sinon.spy();
|
|
307
|
+
okCb = sinon.spy();
|
|
308
|
+
|
|
309
|
+
instance.refs.__test.on('cancel', cancelCb);
|
|
310
|
+
|
|
311
|
+
instance.refs.__test.on('ok', okCb);
|
|
312
|
+
|
|
313
|
+
dispatchEvent(element.children[0], 'click');
|
|
314
|
+
_context6.next = 8;
|
|
315
|
+
return wait();
|
|
316
|
+
|
|
317
|
+
case 8:
|
|
318
|
+
content = getElement('.k-tooltip-content');
|
|
319
|
+
expect(content.querySelector('.k-tooltip-buttons').outerHTML).to.matchSnapshot();
|
|
320
|
+
content.querySelector('.k-btn').click();
|
|
321
|
+
_context6.next = 13;
|
|
322
|
+
return wait(500);
|
|
323
|
+
|
|
324
|
+
case 13:
|
|
325
|
+
expect(content.style.display).eql('none');
|
|
326
|
+
dispatchEvent(element.firstElementChild, 'click');
|
|
327
|
+
_context6.next = 17;
|
|
328
|
+
return wait();
|
|
329
|
+
|
|
330
|
+
case 17:
|
|
331
|
+
content = getElement('.k-tooltip-content');
|
|
332
|
+
_Array$from5 = _Array$from2(content.querySelectorAll('.k-btn')), btn = _Array$from5[1];
|
|
333
|
+
btn.click();
|
|
334
|
+
_context6.next = 22;
|
|
335
|
+
return wait(500);
|
|
336
|
+
|
|
337
|
+
case 22:
|
|
338
|
+
expect(content.style.display).eql('none');
|
|
339
|
+
expect(cancelCb.callCount).eql(1);
|
|
340
|
+
expect(okCb.callCount).eql(1);
|
|
341
|
+
|
|
342
|
+
case 25:
|
|
343
|
+
case "end":
|
|
344
|
+
return _context6.stop();
|
|
345
|
+
}
|
|
282
346
|
}
|
|
283
347
|
}, _callee6);
|
|
284
348
|
})));
|
|
285
349
|
it('should always show tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
286
350
|
var _mount7, element, content;
|
|
351
|
+
|
|
287
352
|
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
288
|
-
while (1)
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
353
|
+
while (1) {
|
|
354
|
+
switch (_context7.prev = _context7.next) {
|
|
355
|
+
case 0:
|
|
356
|
+
_mount7 = mount(AlwaysDemo), element = _mount7[1];
|
|
357
|
+
content = getElement('.k-tooltip-content');
|
|
358
|
+
expect(content.textContent).eql('hello');
|
|
359
|
+
document.body.click();
|
|
360
|
+
_context7.next = 6;
|
|
361
|
+
return wait(500);
|
|
362
|
+
|
|
363
|
+
case 6:
|
|
364
|
+
expect(getElement('.k-tooltip-content')).eql(content);
|
|
365
|
+
element.querySelector('span').click();
|
|
366
|
+
_context7.next = 10;
|
|
367
|
+
return wait(500);
|
|
368
|
+
|
|
369
|
+
case 10:
|
|
370
|
+
expect(getElement('.k-tooltip-content')).eql(content);
|
|
371
|
+
dispatchEvent(content, 'mouseleave');
|
|
372
|
+
_context7.next = 14;
|
|
373
|
+
return wait(600);
|
|
374
|
+
|
|
375
|
+
case 14:
|
|
376
|
+
expect(getElement('.k-tooltip-content')).eql(content);
|
|
377
|
+
|
|
378
|
+
case 15:
|
|
379
|
+
case "end":
|
|
380
|
+
return _context7.stop();
|
|
381
|
+
}
|
|
311
382
|
}
|
|
312
383
|
}, _callee7);
|
|
313
|
-
})));
|
|
314
|
-
// it('should hide tooltip when v-show is false in Vue', async () => {
|
|
384
|
+
}))); // it('should hide tooltip when v-show is false in Vue', async () => {
|
|
315
385
|
// interface IData {
|
|
316
386
|
// show: boolean
|
|
317
387
|
// }
|
|
@@ -379,228 +449,296 @@ describe('Tooltip', function () {
|
|
|
379
449
|
// app.$destroy();
|
|
380
450
|
// document.body.removeChild(app.$el);
|
|
381
451
|
// });
|
|
452
|
+
|
|
382
453
|
it('should hide layer when we have disabled Tooltip and also hide on next updating', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
383
454
|
var Demo, _mount8, i, content;
|
|
455
|
+
|
|
384
456
|
return _regeneratorRuntime.wrap(function _callee8$(_context9) {
|
|
385
|
-
while (1)
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
457
|
+
while (1) {
|
|
458
|
+
switch (_context9.prev = _context9.next) {
|
|
459
|
+
case 0:
|
|
460
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
461
|
+
_inheritsLoose(Demo, _Component);
|
|
462
|
+
|
|
463
|
+
function Demo() {
|
|
464
|
+
var _context8;
|
|
465
|
+
|
|
466
|
+
var _this;
|
|
467
|
+
|
|
468
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
469
|
+
args[_key] = arguments[_key];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context8 = [this]).call(_context8, args)) || this;
|
|
473
|
+
_this.Tooltip = Tooltip;
|
|
474
|
+
return _this;
|
|
394
475
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
476
|
+
|
|
477
|
+
return Demo;
|
|
478
|
+
}(Component);
|
|
479
|
+
|
|
480
|
+
Demo.template = "\n const Tooltip = this.Tooltip;\n <div>\n <Tooltip disabled={this.get('disabled')}\n content=\"hello\"\n >\n <div ref=\"test\">test</div>\n </Tooltip>\n </div>\n ";
|
|
481
|
+
|
|
482
|
+
Demo.defaults = function () {
|
|
483
|
+
return {
|
|
484
|
+
disabled: false
|
|
485
|
+
};
|
|
405
486
|
};
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
487
|
+
|
|
488
|
+
_mount8 = mount(Demo), i = _mount8[0];
|
|
489
|
+
dispatchEvent(i.refs.test, 'mouseenter');
|
|
490
|
+
_context9.next = 7;
|
|
491
|
+
return wait();
|
|
492
|
+
|
|
493
|
+
case 7:
|
|
494
|
+
content = getElement('.k-tooltip-content');
|
|
495
|
+
expect(content.textContent).eql('hello');
|
|
496
|
+
i.set('disabled', true);
|
|
497
|
+
_context9.next = 12;
|
|
498
|
+
return wait(500);
|
|
499
|
+
|
|
500
|
+
case 12:
|
|
501
|
+
content = getElement('.k-tooltip-content');
|
|
502
|
+
expect(content).eql(undefined);
|
|
503
|
+
i.set('disabled', false);
|
|
504
|
+
_context9.next = 17;
|
|
505
|
+
return wait();
|
|
506
|
+
|
|
507
|
+
case 17:
|
|
508
|
+
content = getElement('.k-tooltip-content');
|
|
509
|
+
expect(content).eql(undefined);
|
|
510
|
+
|
|
511
|
+
case 19:
|
|
512
|
+
case "end":
|
|
513
|
+
return _context9.stop();
|
|
514
|
+
}
|
|
429
515
|
}
|
|
430
516
|
}, _callee8);
|
|
431
517
|
})));
|
|
432
518
|
it('should not detect collison when target is not in viewport', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
|
|
433
519
|
var Demo, _mount9, i, content;
|
|
520
|
+
|
|
434
521
|
return _regeneratorRuntime.wrap(function _callee9$(_context11) {
|
|
435
|
-
while (1)
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
522
|
+
while (1) {
|
|
523
|
+
switch (_context11.prev = _context11.next) {
|
|
524
|
+
case 0:
|
|
525
|
+
Demo = /*#__PURE__*/function (_Component2) {
|
|
526
|
+
_inheritsLoose(Demo, _Component2);
|
|
527
|
+
|
|
528
|
+
function Demo() {
|
|
529
|
+
var _context10;
|
|
530
|
+
|
|
531
|
+
var _this2;
|
|
532
|
+
|
|
533
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
534
|
+
args[_key2] = arguments[_key2];
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context10 = [this]).call(_context10, args)) || this;
|
|
538
|
+
_this2.Tooltip = Tooltip;
|
|
539
|
+
return _this2;
|
|
444
540
|
}
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
541
|
+
|
|
542
|
+
var _proto = Demo.prototype;
|
|
543
|
+
|
|
544
|
+
_proto.mounted = function mounted() {
|
|
545
|
+
var element = findDomFromVNode(this.$lastInput, true);
|
|
546
|
+
var style = element.style;
|
|
547
|
+
style.position = 'fixed';
|
|
548
|
+
style.top = '-200px'; // const windowHeight = window.innerHeight || document.documentElement.clientHeight;
|
|
549
|
+
// (element.parentNode as HTMLElement).style.height = `${windowHeight * 2}px`;
|
|
550
|
+
};
|
|
551
|
+
|
|
552
|
+
return Demo;
|
|
553
|
+
}(Component);
|
|
554
|
+
|
|
555
|
+
Demo.template = "\n const Tooltip = this.Tooltip;\n <div>\n <Tooltip v-model=\"show\" content=\"hello\">\n <div ref=\"test\">test</div>\n </Tooltip>\n </div>\n ";
|
|
556
|
+
|
|
557
|
+
Demo.defaults = function () {
|
|
558
|
+
return {
|
|
559
|
+
show: false
|
|
560
|
+
};
|
|
464
561
|
};
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
562
|
+
|
|
563
|
+
_mount9 = mount(Demo), i = _mount9[0]; // await wait(500);
|
|
564
|
+
// window.scrollTo(0, 10000);
|
|
565
|
+
|
|
566
|
+
i.set('show', true);
|
|
567
|
+
_context11.next = 7;
|
|
568
|
+
return wait(500);
|
|
569
|
+
|
|
570
|
+
case 7:
|
|
571
|
+
content = getElement('.k-tooltip-content');
|
|
572
|
+
console.log(content.outerHTML);
|
|
573
|
+
console.log(_JSON$stringify(content.getBoundingClientRect()));
|
|
574
|
+
expect(content.getBoundingClientRect().top < 0).to.be.true;
|
|
575
|
+
|
|
576
|
+
case 11:
|
|
577
|
+
case "end":
|
|
578
|
+
return _context11.stop();
|
|
579
|
+
}
|
|
479
580
|
}
|
|
480
581
|
}, _callee9);
|
|
481
582
|
})));
|
|
482
583
|
it('should add className', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10() {
|
|
483
584
|
var Demo, _mount10, instance, element, trigger, dropdown;
|
|
585
|
+
|
|
484
586
|
return _regeneratorRuntime.wrap(function _callee10$(_context13) {
|
|
485
|
-
while (1)
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
587
|
+
while (1) {
|
|
588
|
+
switch (_context13.prev = _context13.next) {
|
|
589
|
+
case 0:
|
|
590
|
+
Demo = /*#__PURE__*/function (_Component3) {
|
|
591
|
+
_inheritsLoose(Demo, _Component3);
|
|
592
|
+
|
|
593
|
+
function Demo() {
|
|
594
|
+
var _context12;
|
|
595
|
+
|
|
596
|
+
var _this3;
|
|
597
|
+
|
|
598
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
599
|
+
args[_key3] = arguments[_key3];
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context12 = [this]).call(_context12, args)) || this;
|
|
603
|
+
_this3.Tooltip = Tooltip;
|
|
604
|
+
return _this3;
|
|
494
605
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
606
|
+
|
|
607
|
+
return Demo;
|
|
608
|
+
}(Component);
|
|
609
|
+
|
|
610
|
+
Demo.template = "\n const Tooltip = this.Tooltip;\n <div>\n <Tooltip content=\"hello\" class=\"a\">\n <div ref=\"test\" class=\"b\">test</div>\n </Tooltip>\n </div>\n ";
|
|
611
|
+
_mount10 = mount(Demo), instance = _mount10[0], element = _mount10[1];
|
|
612
|
+
trigger = instance.refs.test;
|
|
613
|
+
expect(trigger.className).to.eql('b a');
|
|
614
|
+
dispatchEvent(trigger, 'mouseenter');
|
|
615
|
+
_context13.next = 8;
|
|
616
|
+
return wait();
|
|
617
|
+
|
|
618
|
+
case 8:
|
|
619
|
+
dropdown = getElement('.k-tooltip-content');
|
|
620
|
+
expect(dropdown.classList.contains('a')).to.be.true;
|
|
621
|
+
|
|
622
|
+
case 10:
|
|
623
|
+
case "end":
|
|
624
|
+
return _context13.stop();
|
|
625
|
+
}
|
|
514
626
|
}
|
|
515
627
|
}, _callee10);
|
|
516
628
|
})));
|
|
517
629
|
it('should fix the width in small container', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
|
|
518
630
|
var Demo, _mount11, instance, element, trigger, expecedWidth, content, width, newWidth;
|
|
631
|
+
|
|
519
632
|
return _regeneratorRuntime.wrap(function _callee11$(_context15) {
|
|
520
|
-
while (1)
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
633
|
+
while (1) {
|
|
634
|
+
switch (_context15.prev = _context15.next) {
|
|
635
|
+
case 0:
|
|
636
|
+
Demo = /*#__PURE__*/function (_Component4) {
|
|
637
|
+
_inheritsLoose(Demo, _Component4);
|
|
638
|
+
|
|
639
|
+
function Demo() {
|
|
640
|
+
var _context14;
|
|
641
|
+
|
|
642
|
+
var _this4;
|
|
643
|
+
|
|
644
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
645
|
+
args[_key4] = arguments[_key4];
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context14 = [this]).call(_context14, args)) || this;
|
|
649
|
+
_this4.Tooltip = Tooltip;
|
|
650
|
+
_this4.Dialog = Dialog;
|
|
651
|
+
return _this4;
|
|
529
652
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
653
|
+
|
|
654
|
+
return Demo;
|
|
655
|
+
}(Component);
|
|
656
|
+
|
|
657
|
+
Demo.template = "\n const {Tooltip, Dialog} = this;\n <div style=\"text-align: right; position: relative; width: 300px;\">\n <Tooltip content=\"\u8FD9\u662F\u4E00\u6BB5\u5F88\u957F\u7684\u63CF\u8FF0\u6587\u5B57\uFF0C\u8FD9\u662F\u4E00\u6BB5\u5F88\u957F\u7684\u63CF\u8FF0\u6587\u5B57\" container={dom => dom}>\n <span class=\"trigger\">test</span>\n </Tooltip>\n </div>\n ";
|
|
658
|
+
_mount11 = mount(Demo), instance = _mount11[0], element = _mount11[1];
|
|
659
|
+
trigger = element.querySelector('.trigger');
|
|
660
|
+
expecedWidth = parseInt(tooltipTheme.maxWidth);
|
|
661
|
+
dispatchEvent(trigger, 'mouseenter');
|
|
662
|
+
_context15.next = 8;
|
|
663
|
+
return wait();
|
|
664
|
+
|
|
665
|
+
case 8:
|
|
666
|
+
content = getElement('.k-tooltip-content');
|
|
667
|
+
width = content.offsetWidth;
|
|
668
|
+
expect(width).to.eql(expecedWidth);
|
|
669
|
+
dispatchEvent(trigger, 'mouseleave');
|
|
670
|
+
_context15.next = 14;
|
|
671
|
+
return wait();
|
|
672
|
+
|
|
673
|
+
case 14:
|
|
674
|
+
dispatchEvent(trigger, 'mouseenter');
|
|
675
|
+
_context15.next = 17;
|
|
676
|
+
return wait();
|
|
677
|
+
|
|
678
|
+
case 17:
|
|
679
|
+
newWidth = content.offsetWidth;
|
|
680
|
+
expect(newWidth).to.eql(width);
|
|
681
|
+
|
|
682
|
+
case 19:
|
|
683
|
+
case "end":
|
|
684
|
+
return _context15.stop();
|
|
685
|
+
}
|
|
561
686
|
}
|
|
562
687
|
}, _callee11);
|
|
563
688
|
})));
|
|
564
689
|
it('should not impact select when wrap select with tooltip', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee12() {
|
|
565
690
|
var Demo, _mount12, instance, element, menu;
|
|
691
|
+
|
|
566
692
|
return _regeneratorRuntime.wrap(function _callee12$(_context17) {
|
|
567
|
-
while (1)
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
693
|
+
while (1) {
|
|
694
|
+
switch (_context17.prev = _context17.next) {
|
|
695
|
+
case 0:
|
|
696
|
+
Demo = /*#__PURE__*/function (_Component5) {
|
|
697
|
+
_inheritsLoose(Demo, _Component5);
|
|
698
|
+
|
|
699
|
+
function Demo() {
|
|
700
|
+
var _context16;
|
|
701
|
+
|
|
702
|
+
var _this5;
|
|
703
|
+
|
|
704
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
705
|
+
args[_key5] = arguments[_key5];
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
_this5 = _Component5.call.apply(_Component5, _concatInstanceProperty(_context16 = [this]).call(_context16, args)) || this;
|
|
709
|
+
_this5.Tooltip = Tooltip;
|
|
710
|
+
_this5.Select = Select;
|
|
711
|
+
_this5.Option = Option;
|
|
712
|
+
return _this5;
|
|
576
713
|
}
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
714
|
+
|
|
715
|
+
return Demo;
|
|
716
|
+
}(Component);
|
|
717
|
+
|
|
718
|
+
Demo.template = "\n const {Tooltip, Select, Option} = this;\n <Tooltip>\n <Select>\n <Option value=\"1\">Option 1</Option>\n <Option value=\"2\">Option 2</Option>\n </Select>\n </Tooltip>\n ";
|
|
719
|
+
_mount12 = mount(Demo), instance = _mount12[0], element = _mount12[1];
|
|
720
|
+
dispatchEvent(element, 'mouseenter');
|
|
721
|
+
_context17.next = 6;
|
|
722
|
+
return wait();
|
|
723
|
+
|
|
724
|
+
case 6:
|
|
725
|
+
dispatchEvent(element, 'click');
|
|
726
|
+
_context17.next = 9;
|
|
727
|
+
return wait();
|
|
728
|
+
|
|
729
|
+
case 9:
|
|
730
|
+
menu = getElement(".k-select-menu");
|
|
731
|
+
dispatchEvent(element, 'mouseleave');
|
|
732
|
+
_context17.next = 13;
|
|
733
|
+
return wait(500);
|
|
734
|
+
|
|
735
|
+
case 13:
|
|
736
|
+
expect(menu.style.display).to.eql('');
|
|
737
|
+
|
|
738
|
+
case 14:
|
|
739
|
+
case "end":
|
|
740
|
+
return _context17.stop();
|
|
741
|
+
}
|
|
604
742
|
}
|
|
605
743
|
}, _callee12);
|
|
606
744
|
})));
|