@king-design/vue 2.1.2 → 2.1.4
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 +0 -5
- package/components/affix/index.spec.js +84 -108
- package/components/affix/index.vdt.js +5 -8
- package/components/affix/useStyle.js +8 -19
- package/components/badge/index.js +0 -2
- package/components/badge/index.vdt.js +5 -9
- package/components/badge/styles.js +0 -2
- package/components/breadcrumb/index.js +0 -4
- package/components/breadcrumb/index.spec.js +6 -6
- package/components/breadcrumb/index.vdt.js +5 -14
- package/components/breadcrumb/item.js +0 -8
- package/components/breadcrumb/item.vdt.js +3 -6
- package/components/breadcrumb/styles.js +0 -3
- package/components/button/dynamicButton.d.ts +1 -1
- package/components/button/dynamicButton.js +2 -5
- package/components/button/group.js +2 -10
- package/components/button/group.vdt.js +4 -7
- package/components/button/index.js +3 -27
- package/components/button/index.spec.js +74 -96
- package/components/button/index.vdt.js +19 -29
- package/components/button/styles.d.ts +2 -2
- package/components/button/styles.js +4 -48
- package/components/card/column.js +0 -2
- package/components/card/column.vdt.js +5 -10
- package/components/card/index.js +0 -4
- package/components/card/index.vdt.js +4 -16
- package/components/carousel/index.js +1 -19
- package/components/carousel/index.spec.js +127 -163
- package/components/carousel/index.vdt.js +12 -15
- package/components/carousel/item.js +0 -2
- package/components/carousel/item.vdt.js +4 -7
- package/components/carousel/styles.js +0 -1
- package/components/carousel/useAutoplay.js +0 -4
- package/components/carousel/useItems.js +4 -20
- package/components/carousel/useSlide.js +57 -89
- package/components/cascader/index.js +3 -18
- package/components/cascader/index.spec.js +365 -379
- package/components/cascader/index.vdt.js +14 -31
- package/components/cascader/styles.js +0 -6
- package/components/cascader/useFields.js +1 -4
- package/components/cascader/useFilterable.js +2 -19
- package/components/cascader/useLabel.js +1 -9
- package/components/cascader/useLoad.js +22 -35
- package/components/cascader/useValue.d.ts +2 -2
- package/components/cascader/useValue.js +6 -27
- package/components/checkbox/index.js +5 -27
- package/components/checkbox/index.spec.js +129 -171
- package/components/checkbox/index.vdt.js +12 -16
- package/components/checkbox/styles.js +0 -10
- package/components/code/crossDomain.js +2 -9
- package/components/code/index.js +0 -9
- package/components/code/index.spec.js +46 -55
- package/components/code/index.vdt.js +6 -14
- package/components/code/styles.js +0 -1
- package/components/code/useEditor.js +5 -10
- package/components/collapse/index.d.ts +1 -1
- package/components/collapse/index.js +3 -14
- package/components/collapse/index.spec.js +47 -60
- package/components/collapse/index.vdt.js +4 -12
- package/components/collapse/item.js +0 -10
- package/components/collapse/item.vdt.js +7 -14
- package/components/collapse/styles.js +0 -1
- package/components/colorpicker/drag.js +0 -5
- package/components/colorpicker/index.js +0 -4
- package/components/colorpicker/index.spec.js +211 -259
- package/components/colorpicker/index.vdt.js +8 -11
- package/components/colorpicker/panel.js +0 -5
- package/components/colorpicker/panel.vdt.js +21 -26
- package/components/colorpicker/styles.js +2 -13
- package/components/colorpicker/useDrag.js +22 -26
- package/components/colorpicker/useInput.js +0 -16
- package/components/colorpicker/usePointer.js +15 -18
- package/components/colorpicker/useValue.js +2 -7
- package/components/context.d.ts +2 -2
- package/components/context.js +2 -19
- package/components/datepicker/basepicker.d.ts +8 -8
- package/components/datepicker/basepicker.js +20 -90
- package/components/datepicker/calendar.js +0 -11
- package/components/datepicker/calendar.vdt.js +11 -14
- package/components/datepicker/constants.js +0 -1
- package/components/datepicker/dayjs.js +1 -1
- package/components/datepicker/helpers.js +3 -15
- package/components/datepicker/index.js +6 -32
- package/components/datepicker/index.spec.js +1141 -1448
- package/components/datepicker/index.vdt.js +20 -34
- package/components/datepicker/shortcuts.d.ts +1 -1
- package/components/datepicker/shortcuts.js +0 -4
- package/components/datepicker/styles.js +0 -8
- package/components/datepicker/time.d.ts +1 -1
- package/components/datepicker/time.js +3 -23
- package/components/datepicker/time.vdt.js +4 -5
- package/components/datepicker/useDays.js +2 -9
- package/components/datepicker/useDisabled.js +6 -23
- package/components/datepicker/useFocusDate.js +0 -2
- package/components/datepicker/useFormats.js +6 -15
- package/components/datepicker/useKeyboards.js +20 -36
- package/components/datepicker/useMonths.js +0 -6
- package/components/datepicker/usePanel.js +0 -10
- package/components/datepicker/useShowDate.js +10 -37
- package/components/datepicker/useStatus.js +3 -15
- package/components/datepicker/useValue.js +22 -35
- package/components/datepicker/useYears.js +4 -15
- package/components/diagram/diagram.js +17 -43
- package/components/diagram/diagram.vdt.js +2 -5
- 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 +369 -495
- package/components/diagram/layouts/circle.js +6 -14
- package/components/diagram/layouts/flow.js +7 -15
- package/components/diagram/layouts/layout.js +6 -28
- package/components/diagram/layouts/organic.js +3 -11
- package/components/diagram/layouts/partition.js +4 -12
- package/components/diagram/layouts/radial.js +6 -18
- package/components/diagram/layouts/stack.js +6 -14
- package/components/diagram/layouts/tree.js +11 -21
- package/components/diagram/mxgraph/handler/mxConnectionHandler.js +15 -22
- package/components/diagram/mxgraph/handler/mxConstraintHandler.js +4 -4
- package/components/diagram/mxgraph/handler/mxEdgeHandler.js +11 -15
- package/components/diagram/mxgraph/handler/mxGraphHandler.js +6 -9
- package/components/diagram/mxgraph/handler/mxRubberband.js +4 -4
- package/components/diagram/mxgraph/handler/mxVertexHandler.js +7 -10
- package/components/diagram/mxgraph/index.js +0 -2
- package/components/diagram/mxgraph/mx.js +3 -3
- package/components/diagram/mxgraph/shape/mxCloud.js +2 -2
- package/components/diagram/mxgraph/shape/mxCylinder.js +4 -9
- 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 +6 -12
- package/components/diagram/mxgraph/shape/mxShape.js +0 -1
- 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 +5 -7
- package/components/diagram/mxgraph/view/mxCellEditor.js +16 -29
- package/components/diagram/mxgraph/view/mxCellRenderer.js +0 -2
- package/components/diagram/mxgraph/view/mxGraph.js +14 -32
- package/components/diagram/shapes/base.d.ts +1 -1
- package/components/diagram/shapes/base.js +9 -39
- package/components/diagram/shapes/callout.js +10 -23
- package/components/diagram/shapes/circle.js +3 -10
- package/components/diagram/shapes/document.js +5 -16
- package/components/diagram/shapes/ellipse.js +0 -5
- package/components/diagram/shapes/generateShapes.d.ts +1 -1
- package/components/diagram/shapes/generateShapes.js +0 -9
- package/components/diagram/shapes/hexagon.js +9 -26
- package/components/diagram/shapes/image.js +1 -9
- package/components/diagram/shapes/line.d.ts +2 -2
- package/components/diagram/shapes/line.js +13 -48
- package/components/diagram/shapes/parallelogram.js +9 -26
- package/components/diagram/shapes/rectangle.js +1 -9
- package/components/diagram/shapes/shape.js +6 -35
- package/components/diagram/shapes/square.js +3 -11
- package/components/diagram/shapes/text.js +0 -5
- package/components/diagram/styles.js +0 -1
- package/components/dialog/alert.vdt.js +9 -19
- package/components/dialog/base.js +1 -29
- package/components/dialog/base.vdt.js +14 -29
- package/components/dialog/index.js +6 -31
- package/components/dialog/index.spec.js +416 -503
- package/components/dialog/staticMethods.d.ts +1 -1
- package/components/dialog/staticMethods.js +2 -13
- package/components/dialog/styles.js +0 -11
- package/components/dialog/useDraggable.js +0 -6
- package/components/dialog/useEscClosable.js +4 -12
- package/components/dialog/useFixBody.d.ts +1 -1
- package/components/dialog/useFixBody.js +0 -11
- package/components/dialog/usePosition.js +7 -5
- package/components/drawer/index.js +0 -5
- package/components/drawer/index.spec.js +126 -168
- package/components/drawer/index.vdt.js +3 -9
- package/components/drawer/styles.d.ts +2 -2
- package/components/drawer/styles.js +0 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +33 -89
- package/components/dropdown/index.js +2 -6
- package/components/dropdown/index.spec.js +388 -496
- package/components/dropdown/item.js +4 -25
- package/components/dropdown/item.vdt.js +5 -8
- package/components/dropdown/menu.js +14 -29
- package/components/dropdown/menu.vdt.js +5 -13
- package/components/dropdown/styles.js +0 -9
- package/components/dropdown/useKeyboard.d.ts +2 -2
- package/components/dropdown/useKeyboard.js +8 -30
- package/components/dropdown/usePosition.d.ts +2 -1
- package/components/dropdown/usePosition.js +33 -28
- package/components/dropdown/useTransition.js +0 -8
- package/components/editable/index.d.ts +1 -1
- package/components/editable/index.js +4 -28
- package/components/editable/index.spec.js +152 -189
- package/components/editable/index.vdt.js +8 -11
- package/components/editable/styles.js +0 -1
- package/components/form/form.js +0 -18
- package/components/form/form.vdt.js +4 -7
- package/components/form/index.spec.js +1057 -1280
- package/components/form/item.d.ts +1 -1
- package/components/form/item.js +0 -12
- package/components/form/item.vdt.js +17 -31
- package/components/form/methods.d.ts +5 -5
- package/components/form/methods.js +2 -12
- package/components/form/styles.js +0 -8
- package/components/form/useDirty.js +2 -7
- package/components/form/useError.js +2 -10
- package/components/form/useValidate.d.ts +1 -1
- package/components/form/useValidate.js +8 -24
- package/components/grid/col.d.ts +3 -3
- package/components/grid/col.js +0 -7
- package/components/grid/col.vdt.js +8 -13
- package/components/grid/constants.d.ts +6 -6
- package/components/grid/row.js +0 -5
- package/components/grid/row.vdt.js +5 -8
- package/components/grid/styles.js +0 -7
- package/components/grid/useBreakpoints.js +0 -5
- package/components/grid/useGutter.js +5 -25
- package/components/icon/index.js +0 -10
- package/components/icon/index.vdt.js +7 -13
- package/components/icon/styles.js +0 -1
- package/components/input/index.d.ts +3 -3
- package/components/input/index.js +0 -14
- package/components/input/index.spec.js +185 -239
- package/components/input/index.vdt.js +39 -49
- package/components/input/search.js +0 -20
- package/components/input/search.vdt.js +6 -9
- package/components/input/styles.js +0 -26
- package/components/input/useAutoRows.js +6 -18
- package/components/input/useAutoWidth.js +0 -5
- package/components/input/useFrozen.js +0 -6
- package/components/input/useShowPassword.js +2 -5
- package/components/layout/aside.js +5 -17
- package/components/layout/aside.vdt.js +5 -9
- package/components/layout/body.js +5 -17
- package/components/layout/footer.js +1 -7
- package/components/layout/header.js +7 -21
- package/components/layout/layout.js +9 -24
- package/components/layout/styles.js +2 -13
- package/components/layout/template.vdt.js +2 -4
- package/components/layout/useParse.js +0 -7
- package/components/menu/index.spec.js +189 -242
- package/components/menu/item.js +3 -16
- package/components/menu/item.vdt.js +20 -32
- package/components/menu/menu.js +2 -11
- package/components/menu/menu.vdt.js +6 -12
- package/components/menu/styles.js +0 -18
- package/components/menu/useDropdown.js +4 -9
- package/components/menu/useExpanded.js +0 -14
- package/components/menu/useHighlight.js +26 -36
- package/components/message/index.spec.js +58 -73
- package/components/message/message.js +0 -19
- package/components/message/message.vdt.js +5 -8
- package/components/message/messages.js +0 -12
- package/components/message/messages.vdt.js +0 -1
- package/components/message/styles.js +0 -9
- package/components/pagination/index.d.ts +1 -1
- package/components/pagination/index.js +10 -46
- package/components/pagination/index.spec.js +133 -173
- package/components/pagination/index.vdt.js +14 -34
- package/components/pagination/styles.js +0 -4
- package/components/portal.d.ts +1 -1
- package/components/portal.js +13 -28
- package/components/position.d.ts +12 -12
- package/components/position.js +32 -88
- package/components/progress/index.d.ts +6 -6
- package/components/progress/index.js +0 -12
- package/components/progress/index.spec.js +143 -191
- package/components/progress/index.vdt.js +8 -11
- package/components/progress/styles.js +0 -6
- package/components/progress/useColor.js +2 -7
- package/components/progress/useStatus.d.ts +1 -1
- package/components/progress/useStatus.js +2 -5
- package/components/radio/index.js +3 -18
- package/components/radio/index.spec.js +111 -149
- package/components/radio/index.vdt.js +14 -17
- package/components/radio/styles.js +0 -10
- package/components/rate/index.js +0 -7
- package/components/rate/index.spec.js +64 -79
- package/components/rate/index.vdt.js +8 -21
- package/components/rate/styles.js +0 -3
- package/components/rate/useActiveValue.js +2 -7
- package/components/scrollSelect/index.d.ts +2 -2
- package/components/scrollSelect/index.js +0 -7
- package/components/scrollSelect/index.spec.js +100 -131
- package/components/scrollSelect/index.vdt.js +6 -11
- package/components/scrollSelect/styles.js +0 -7
- package/components/scrollSelect/useList.js +3 -17
- package/components/scrollSelect/useMouseEvents.js +31 -49
- package/components/scrollSelect/useTranslate.js +1 -11
- package/components/select/base.js +5 -35
- package/components/select/base.vdt.js +23 -38
- package/components/select/group.js +0 -5
- package/components/select/group.vdt.js +4 -10
- package/components/select/index.spec.js +361 -452
- package/components/select/menu.js +0 -5
- package/components/select/menu.vdt.js +18 -33
- package/components/select/option.js +2 -16
- package/components/select/option.vdt.js +7 -14
- package/components/select/select.js +3 -20
- package/components/select/select.vdt.js +9 -17
- package/components/select/styles.js +0 -33
- package/components/select/useBaseLabel.d.ts +1 -1
- package/components/select/useBaseLabel.js +4 -17
- package/components/select/useCard.js +0 -4
- package/components/select/useEqualWidth.js +0 -1
- package/components/select/useFilterable.js +5 -27
- package/components/select/useFocusout.d.ts +1 -1
- package/components/select/useFocusout.js +1 -9
- package/components/select/useInput.js +6 -10
- package/components/select/useLabel.js +3 -13
- package/components/select/useSearchable.js +0 -10
- package/components/skeleton/item.d.ts +1 -1
- package/components/skeleton/item.js +0 -4
- package/components/skeleton/item.vdt.js +1 -6
- package/components/skeleton/skeleton.js +0 -4
- package/components/skeleton/skeleton.vdt.js +6 -12
- package/components/skeleton/style.d.ts +1 -1
- package/components/skeleton/style.js +0 -1
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +0 -7
- package/components/slider/index.spec.js +467 -585
- package/components/slider/index.vdt.js +32 -45
- package/components/slider/styles.js +0 -14
- package/components/slider/useClick.js +2 -11
- package/components/slider/useDraggable.js +23 -34
- package/components/slider/useKeyboard.js +7 -18
- package/components/slider/useMarks.d.ts +5 -5
- package/components/slider/useMarks.js +5 -13
- package/components/slider/usePoints.d.ts +2 -2
- package/components/slider/usePoints.js +7 -21
- package/components/slider/useStyles.d.ts +1 -1
- package/components/slider/useStyles.js +5 -10
- package/components/slider/useTooltip.js +2 -10
- package/components/slider/useValue.d.ts +1 -1
- package/components/slider/useValue.js +7 -22
- package/components/spin/index.js +0 -4
- package/components/spin/index.vdt.js +4 -11
- package/components/spin/styles.js +0 -2
- package/components/spinner/index.d.ts +4 -4
- package/components/spinner/index.js +9 -24
- package/components/spinner/index.spec.js +359 -460
- package/components/spinner/index.vdt.js +10 -13
- package/components/spinner/styles.js +0 -3
- package/components/spinner/useChange.js +4 -16
- package/components/spinner/useFormatter.js +6 -16
- package/components/spinner/useStep.d.ts +3 -3
- package/components/spinner/useStep.js +2 -20
- package/components/spinner/useValue.js +11 -26
- package/components/split/index.js +0 -7
- package/components/split/index.spec.js +223 -267
- package/components/split/index.vdt.js +8 -17
- package/components/split/style.d.ts +1 -1
- package/components/split/style.js +0 -8
- package/components/split/useDraggable.js +11 -35
- package/components/split/useSize.js +2 -5
- package/components/steps/context.d.ts +2 -2
- package/components/steps/index.js +2 -10
- package/components/steps/index.spec.js +21 -27
- package/components/steps/index.vdt.js +8 -10
- package/components/steps/step.js +0 -2
- package/components/steps/step.vdt.js +8 -12
- package/components/steps/styles.js +0 -27
- package/components/switch/index.js +2 -23
- package/components/switch/index.spec.js +188 -224
- package/components/switch/index.vdt.js +16 -32
- package/components/switch/styles.js +3 -14
- package/components/switch/useDraggable.js +10 -18
- package/components/table/cell.js +0 -6
- package/components/table/cell.vdt.js +14 -21
- package/components/table/column.d.ts +1 -1
- package/components/table/column.js +0 -5
- package/components/table/column.vdt.js +19 -30
- package/components/table/exportTable.js +45 -56
- package/components/table/index.spec.js +780 -984
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +18 -40
- package/components/table/row.vdt.js +27 -39
- package/components/table/styles.js +0 -11
- package/components/table/table.d.ts +5 -5
- package/components/table/table.js +18 -50
- package/components/table/table.vdt.js +61 -85
- package/components/table/useChecked.d.ts +1 -1
- package/components/table/useChecked.js +20 -61
- package/components/table/useColumns.js +3 -16
- package/components/table/useDisableRow.js +2 -12
- package/components/table/useDraggable.js +4 -12
- package/components/table/useExpandable.js +2 -5
- package/components/table/useFixedColumns.d.ts +1 -1
- package/components/table/useFixedColumns.js +4 -23
- package/components/table/useGroup.d.ts +1 -1
- package/components/table/useGroup.js +7 -24
- package/components/table/useMerge.d.ts +4 -4
- package/components/table/useMerge.js +2 -14
- package/components/table/usePagination.js +4 -18
- package/components/table/useResizable.js +2 -10
- package/components/table/useRestRowStatus.js +2 -6
- package/components/table/useScroll.d.ts +1 -1
- package/components/table/useScroll.js +0 -3
- package/components/table/useSelected.js +2 -5
- package/components/table/useSortable.js +2 -8
- package/components/table/useStickyHeader.js +3 -7
- package/components/table/useStickyScrollbar.js +6 -16
- package/components/table/useTree.js +1 -12
- package/components/table/useWidth.js +14 -30
- package/components/tabs/index.js +29 -51
- package/components/tabs/index.spec.js +56 -74
- package/components/tabs/index.vdt.js +13 -16
- package/components/tabs/styles.js +0 -16
- package/components/tabs/tab.js +0 -10
- package/components/tabs/tab.vdt.js +6 -10
- package/components/tabs/useActiveBar.js +2 -11
- package/components/tabs/useScroll.js +4 -20
- package/components/tag/base.js +0 -8
- package/components/tag/index.js +2 -4
- package/components/tag/index.spec.js +19 -25
- package/components/tag/index.vdt.js +8 -15
- package/components/tag/styles.js +0 -9
- package/components/timeline/item.js +0 -4
- package/components/timeline/item.vdt.js +4 -9
- package/components/timeline/styles.d.ts +2 -2
- package/components/timeline/styles.js +0 -4
- package/components/timeline/timeline.js +0 -2
- package/components/timeline/timeline.vdt.js +2 -5
- package/components/timepicker/index.js +2 -7
- package/components/timepicker/index.spec.js +293 -368
- package/components/timepicker/panelPicker.js +2 -11
- package/components/timepicker/panelPicker.vdt.js +14 -24
- package/components/timepicker/selectPicker.js +0 -5
- package/components/timepicker/selectPicker.vdt.js +5 -10
- package/components/timepicker/styles.js +0 -1
- package/components/timepicker/useDisabled.js +2 -4
- package/components/timepicker/useFormats.js +4 -13
- package/components/timepicker/useStep.d.ts +1 -1
- package/components/timepicker/useStep.js +8 -17
- package/components/timepicker/useValue.js +16 -21
- package/components/tip/index.js +0 -2
- package/components/tip/index.vdt.js +5 -17
- package/components/tip/styles.js +0 -3
- package/components/tooltip/content.js +0 -28
- package/components/tooltip/content.vdt.js +15 -25
- package/components/tooltip/index.js +3 -7
- package/components/tooltip/index.spec.js +434 -572
- package/components/tooltip/styles.d.ts +1 -1
- package/components/tooltip/styles.js +2 -10
- package/components/tooltip/tooltip.js +2 -15
- package/components/tooltip/useArrow.js +11 -14
- package/components/transfer/index.d.ts +1 -1
- package/components/transfer/index.js +1 -13
- package/components/transfer/index.spec.js +159 -194
- package/components/transfer/index.vdt.js +16 -34
- package/components/transfer/styles.js +0 -10
- package/components/transfer/useCheck.d.ts +1 -1
- package/components/transfer/useCheck.js +1 -15
- package/components/transfer/useFilter.d.ts +1 -1
- package/components/transfer/useFilter.js +9 -30
- package/components/transfer/useTransfer.js +10 -26
- package/components/tree/index.d.ts +3 -3
- package/components/tree/index.js +4 -22
- package/components/tree/index.spec.js +285 -355
- package/components/tree/index.vdt.js +12 -23
- package/components/tree/styles.js +2 -16
- package/components/tree/useChecked.js +3 -26
- package/components/tree/useDraggable.js +12 -42
- package/components/tree/useExpanded.js +26 -43
- package/components/tree/useFilter.js +3 -10
- package/components/tree/useNodes.d.ts +1 -1
- package/components/tree/useNodes.js +0 -4
- package/components/tree/useSelected.js +21 -38
- package/components/tree/useTransitionEvent.js +3 -5
- package/components/treeSelect/index.js +9 -36
- package/components/treeSelect/index.spec.js +123 -160
- package/components/treeSelect/index.vdt.js +14 -20
- package/components/treeSelect/styles.js +0 -1
- package/components/treeSelect/useValue.js +0 -11
- package/components/types.d.ts +3 -3
- package/components/upload/ajaxUploader.d.ts +1 -1
- package/components/upload/ajaxUploader.js +0 -17
- package/components/upload/index.d.ts +4 -4
- package/components/upload/index.js +0 -14
- package/components/upload/index.spec.js +142 -249
- package/components/upload/index.vdt.js +12 -27
- package/components/upload/styles.js +0 -30
- package/components/upload/useAccept.js +2 -10
- package/components/upload/useDrag.js +0 -7
- package/components/upload/useFiles.js +103 -145
- package/components/upload/useShowImage.js +0 -3
- package/components/upload/useUpload.js +47 -69
- package/components/utils.d.ts +4 -3
- package/components/utils.js +24 -43
- package/components/virtual.js +14 -39
- package/components/wave/index.js +5 -31
- package/hooks/useDelayClose.js +2 -6
- package/hooks/useDocumentClick.js +8 -16
- package/hooks/useDraggable.d.ts +1 -1
- package/hooks/useDraggable.js +0 -9
- package/hooks/useKeyboard.d.ts +3 -3
- package/hooks/useKeyboard.js +0 -10
- package/hooks/useMouseOutsidable.js +0 -8
- package/hooks/useReceive.d.ts +1 -1
- package/hooks/useReceive.js +0 -4
- package/hooks/useRecordComponent.js +0 -6
- package/hooks/useRouter.js +7 -18
- package/hooks/useShowHideEvents.js +0 -3
- package/hooks/useState.d.ts +2 -2
- package/hooks/useState.js +2 -6
- package/i18n/en-US.js +0 -1
- package/i18n/index.d.ts +1 -1
- package/i18n/index.js +0 -7
- package/index.d.ts +2 -2
- package/index.js +2 -3
- package/package.json +2 -2
- package/styles/global.js +2 -3
- package/styles/keyframes.js +0 -1
- package/styles/theme.d.ts +1 -1
- package/styles/theme.js +4 -7
- package/styles/utils.d.ts +1 -1
- package/styles/utils.js +3 -17
- package/yarn-error.log +1013 -0
- package/components/cascader/index.d.ts +0 -45
- package/components/datepicker/index.d.ts +0 -63
- package/components/select/select.d.ts +0 -33
- package/components/timepicker/panelPicker.d.ts +0 -54
- package/components/treeSelect/index.d.ts +0 -27
|
@@ -13,206 +13,166 @@ describe('Pagination', function () {
|
|
|
13
13
|
// afterEach(() => unmount());
|
|
14
14
|
it('basic test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
15
15
|
var _mount, instance, element, pagination, btns, prev, next;
|
|
16
|
-
|
|
17
16
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
18
|
-
while (1) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return wait();
|
|
67
|
-
|
|
68
|
-
case 34:
|
|
69
|
-
expect(pagination.innerHTML).to.matchSnapshot();
|
|
70
|
-
expect(instance.get('value1')).to.eql(1);
|
|
71
|
-
|
|
72
|
-
case 36:
|
|
73
|
-
case "end":
|
|
74
|
-
return _context.stop();
|
|
75
|
-
}
|
|
17
|
+
while (1) switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
20
|
+
pagination = element.querySelector('.k-pagination');
|
|
21
|
+
btns = pagination.querySelectorAll('.k-btns .k-btn');
|
|
22
|
+
prev = btns[0];
|
|
23
|
+
next = btns[btns.length - 1];
|
|
24
|
+
prev.click();
|
|
25
|
+
_context.next = 8;
|
|
26
|
+
return wait();
|
|
27
|
+
case 8:
|
|
28
|
+
expect(pagination.innerHTML).to.matchSnapshot();
|
|
29
|
+
expect(instance.get('value1')).to.eql(1);
|
|
30
|
+
next.click();
|
|
31
|
+
next.click();
|
|
32
|
+
_context.next = 14;
|
|
33
|
+
return wait();
|
|
34
|
+
case 14:
|
|
35
|
+
expect(pagination.innerHTML).to.matchSnapshot();
|
|
36
|
+
expect(instance.get('value1')).to.eql(3);
|
|
37
|
+
prev.click();
|
|
38
|
+
_context.next = 19;
|
|
39
|
+
return wait();
|
|
40
|
+
case 19:
|
|
41
|
+
expect(pagination.innerHTML).to.matchSnapshot();
|
|
42
|
+
expect(instance.get('value1')).to.eql(2);
|
|
43
|
+
pagination.querySelector('.k-pagination-ellipsis').click();
|
|
44
|
+
_context.next = 24;
|
|
45
|
+
return wait();
|
|
46
|
+
case 24:
|
|
47
|
+
expect(pagination.innerHTML).to.matchSnapshot();
|
|
48
|
+
expect(instance.get('value1')).to.eql(6);
|
|
49
|
+
pagination.querySelector('.k-pagination-ellipsis').click();
|
|
50
|
+
_context.next = 29;
|
|
51
|
+
return wait();
|
|
52
|
+
case 29:
|
|
53
|
+
expect(pagination.innerHTML).to.matchSnapshot();
|
|
54
|
+
expect(instance.get('value1')).to.eql(2);
|
|
55
|
+
// change limit
|
|
56
|
+
instance.refs.__test.set('limit', 20);
|
|
57
|
+
_context.next = 34;
|
|
58
|
+
return wait();
|
|
59
|
+
case 34:
|
|
60
|
+
expect(pagination.innerHTML).to.matchSnapshot();
|
|
61
|
+
expect(instance.get('value1')).to.eql(1);
|
|
62
|
+
case 36:
|
|
63
|
+
case "end":
|
|
64
|
+
return _context.stop();
|
|
76
65
|
}
|
|
77
66
|
}, _callee);
|
|
78
67
|
})));
|
|
79
68
|
it('goto test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
80
69
|
var _mount2, instance, element, input;
|
|
81
|
-
|
|
82
70
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
83
|
-
while (1) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
case 14:
|
|
106
|
-
case "end":
|
|
107
|
-
return _context2.stop();
|
|
108
|
-
}
|
|
71
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
72
|
+
case 0:
|
|
73
|
+
_mount2 = mount(GotoDemo), instance = _mount2[0], element = _mount2[1];
|
|
74
|
+
input = element.querySelector('.k-input-inner');
|
|
75
|
+
input.value = '45';
|
|
76
|
+
dispatchEvent(input, 'change');
|
|
77
|
+
_context2.next = 6;
|
|
78
|
+
return wait();
|
|
79
|
+
case 6:
|
|
80
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
81
|
+
expect(instance.get('value')).to.eql(20);
|
|
82
|
+
input.value = '-10';
|
|
83
|
+
dispatchEvent(input, 'change');
|
|
84
|
+
_context2.next = 12;
|
|
85
|
+
return wait();
|
|
86
|
+
case 12:
|
|
87
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
88
|
+
expect(instance.get('value')).to.eql(1);
|
|
89
|
+
case 14:
|
|
90
|
+
case "end":
|
|
91
|
+
return _context2.stop();
|
|
109
92
|
}
|
|
110
93
|
}, _callee2);
|
|
111
94
|
})));
|
|
112
95
|
it('should trigger change event once', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
113
96
|
var fn, _mount3, instance, element;
|
|
114
|
-
|
|
115
97
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
116
|
-
while (1) {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
case 11:
|
|
141
|
-
case "end":
|
|
142
|
-
return _context3.stop();
|
|
143
|
-
}
|
|
98
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
99
|
+
case 0:
|
|
100
|
+
fn = CurrentDemo.prototype._fetch2 = sinon.spy(function () {
|
|
101
|
+
instance.forceUpdate();
|
|
102
|
+
});
|
|
103
|
+
_mount3 = mount(CurrentDemo), instance = _mount3[0], element = _mount3[1];
|
|
104
|
+
instance.set('value2', 2);
|
|
105
|
+
_context3.next = 5;
|
|
106
|
+
return wait();
|
|
107
|
+
case 5:
|
|
108
|
+
expect(fn.callCount).to.eql(1);
|
|
109
|
+
instance.set('limit', 50);
|
|
110
|
+
_context3.next = 9;
|
|
111
|
+
return wait();
|
|
112
|
+
case 9:
|
|
113
|
+
expect(fn.callCount).to.eql(2);
|
|
114
|
+
expect(fn.lastCall.lastArg).to.eql({
|
|
115
|
+
value: 1,
|
|
116
|
+
limit: 50
|
|
117
|
+
});
|
|
118
|
+
case 11:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context3.stop();
|
|
144
121
|
}
|
|
145
122
|
}, _callee3);
|
|
146
123
|
})));
|
|
147
124
|
it('should not goto disabled page', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
148
125
|
var _mount4, instance, element, input;
|
|
149
|
-
|
|
150
126
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
151
|
-
while (1) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
case 10:
|
|
168
|
-
case "end":
|
|
169
|
-
return _context4.stop();
|
|
170
|
-
}
|
|
127
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
_mount4 = mount(DisableDemo), instance = _mount4[0], element = _mount4[1];
|
|
130
|
+
input = element.querySelector('.k-input-inner');
|
|
131
|
+
dispatchEvent(input, 'focus');
|
|
132
|
+
input.value = '11';
|
|
133
|
+
dispatchEvent(input, 'change');
|
|
134
|
+
dispatchEvent(input, 'blur');
|
|
135
|
+
_context4.next = 8;
|
|
136
|
+
return wait();
|
|
137
|
+
case 8:
|
|
138
|
+
expect(input.value).to.eql('10');
|
|
139
|
+
expect(instance.get('value2')).to.eql(10);
|
|
140
|
+
case 10:
|
|
141
|
+
case "end":
|
|
142
|
+
return _context4.stop();
|
|
171
143
|
}
|
|
172
144
|
}, _callee4);
|
|
173
145
|
})));
|
|
174
146
|
it('should not set value to 0 when total is 0 on intialization', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
175
147
|
var Demo, _mount5, instance;
|
|
176
|
-
|
|
177
148
|
return _regeneratorRuntime.wrap(function _callee5$(_context6) {
|
|
178
|
-
while (1) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
Demo
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
var _this;
|
|
188
|
-
|
|
189
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
190
|
-
args[_key] = arguments[_key];
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
194
|
-
_this.Pagination = Pagination;
|
|
195
|
-
return _this;
|
|
149
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
152
|
+
_inheritsLoose(Demo, _Component);
|
|
153
|
+
function Demo() {
|
|
154
|
+
var _context5;
|
|
155
|
+
var _this;
|
|
156
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
157
|
+
args[_key] = arguments[_key];
|
|
196
158
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
159
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
160
|
+
_this.Pagination = Pagination;
|
|
161
|
+
return _this;
|
|
162
|
+
}
|
|
163
|
+
Demo.defaults = function defaults() {
|
|
164
|
+
return {
|
|
165
|
+
page: 1
|
|
202
166
|
};
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
case 4:
|
|
213
|
-
case "end":
|
|
214
|
-
return _context6.stop();
|
|
215
|
-
}
|
|
167
|
+
};
|
|
168
|
+
return Demo;
|
|
169
|
+
}(Component);
|
|
170
|
+
Demo.template = "\n const { Pagination } = this;\n <Pagination total={0} v-model=\"page\" />\n ";
|
|
171
|
+
_mount5 = mount(Demo), instance = _mount5[0]; // await wait();
|
|
172
|
+
expect(instance.get('page')).to.eql(1);
|
|
173
|
+
case 4:
|
|
174
|
+
case "end":
|
|
175
|
+
return _context6.stop();
|
|
216
176
|
}
|
|
217
177
|
}, _callee5);
|
|
218
178
|
})));
|
|
@@ -15,52 +15,43 @@ var _$tmp1 = {
|
|
|
15
15
|
};
|
|
16
16
|
export default function ($props, $blocks, $__proto__) {
|
|
17
17
|
var _classNameObj;
|
|
18
|
-
|
|
19
18
|
$blocks || ($blocks = {});
|
|
20
19
|
$props || ($props = {});
|
|
21
20
|
var $this = this;
|
|
22
|
-
|
|
23
21
|
var _this$get = this.get(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
22
|
+
total = _this$get.total,
|
|
23
|
+
size = _this$get.size,
|
|
24
|
+
noBorder = _this$get.noBorder,
|
|
25
|
+
simple = _this$get.simple,
|
|
26
|
+
className = _this$get.className,
|
|
27
|
+
showTotal = _this$get.showTotal,
|
|
28
|
+
showGoto = _this$get.showGoto,
|
|
29
|
+
counts = _this$get.counts,
|
|
30
|
+
value = _this$get.value,
|
|
31
|
+
limit = _this$get.limit,
|
|
32
|
+
limits = _this$get.limits,
|
|
33
|
+
showLimits = _this$get.showLimits,
|
|
34
|
+
disableBtn = _this$get.disableBtn,
|
|
35
|
+
disablePage = _this$get.disablePage;
|
|
39
36
|
if (!total) return _$ccv(' pagination ');
|
|
40
37
|
var classNameObj = (_classNameObj = {
|
|
41
38
|
'k-pagination': true
|
|
42
39
|
}, _classNameObj[className] = className, _classNameObj["k-" + size] = size !== 'default', _classNameObj['k-no-border'] = noBorder, _classNameObj['k-simple'] = simple, _classNameObj[makeStyles()] = true, _classNameObj);
|
|
43
40
|
var type = 'default';
|
|
44
|
-
|
|
45
41
|
if (noBorder || simple) {
|
|
46
42
|
type = 'none';
|
|
47
43
|
}
|
|
48
|
-
|
|
49
44
|
var totalPages = Math.ceil(total / limit) || 0;
|
|
50
|
-
|
|
51
45
|
var paginationButton = function paginationButton(page) {
|
|
52
46
|
var disabled = false;
|
|
53
|
-
|
|
54
47
|
if (page !== value) {
|
|
55
48
|
if (disablePage) {
|
|
56
49
|
disabled || (disabled = !!disablePage(page, limit));
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
if (disableBtn) {
|
|
60
52
|
disabled || (disabled = !!disableBtn(page, limit));
|
|
61
53
|
}
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
return _$cc(Button, {
|
|
65
56
|
'type': type,
|
|
66
57
|
'size': size,
|
|
@@ -70,7 +61,6 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
70
61
|
'children': page
|
|
71
62
|
});
|
|
72
63
|
};
|
|
73
|
-
|
|
74
64
|
var paginationDot = function paginationDot(callback) {
|
|
75
65
|
return _$cc(Button, {
|
|
76
66
|
'type': type,
|
|
@@ -81,22 +71,18 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
81
71
|
'children': '...'
|
|
82
72
|
});
|
|
83
73
|
};
|
|
84
|
-
|
|
85
74
|
var paginationItems = [];
|
|
86
75
|
var minCount = Math.ceil(counts / 2);
|
|
87
76
|
var maxCount = totalPages - minCount;
|
|
88
77
|
var prevPage = value - 1;
|
|
89
78
|
var nextPage = value + 1;
|
|
90
|
-
|
|
91
79
|
if (!simple) {
|
|
92
80
|
if (totalPages > counts) {
|
|
93
81
|
if (value <= minCount) {
|
|
94
82
|
var max = counts - 2;
|
|
95
|
-
|
|
96
83
|
for (var i = 1; i <= max; i++) {
|
|
97
84
|
paginationItems.push(paginationButton(i));
|
|
98
85
|
}
|
|
99
|
-
|
|
100
86
|
paginationItems.push(paginationDot(this.fastNext));
|
|
101
87
|
paginationItems.push(paginationButton(totalPages));
|
|
102
88
|
} else if (value > minCount && value <= maxCount) {
|
|
@@ -105,21 +91,16 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
105
91
|
var midCount = counts - 4;
|
|
106
92
|
var mid = Math.floor(midCount / 2);
|
|
107
93
|
var min = value - mid;
|
|
108
|
-
|
|
109
94
|
var _max = midCount % 2 === 1 ? value + mid : value + mid - 1;
|
|
110
|
-
|
|
111
95
|
for (var _i = min; _i <= _max; _i++) {
|
|
112
96
|
paginationItems.push(paginationButton(_i));
|
|
113
97
|
}
|
|
114
|
-
|
|
115
98
|
paginationItems.push(paginationDot(this.fastNext));
|
|
116
99
|
paginationItems.push(paginationButton(totalPages));
|
|
117
100
|
} else {
|
|
118
101
|
paginationItems.push(paginationButton(1));
|
|
119
102
|
paginationItems.push(paginationDot(this.fastPrev));
|
|
120
|
-
|
|
121
103
|
var _min = totalPages - counts + 3;
|
|
122
|
-
|
|
123
104
|
for (var _i2 = _min; _i2 <= totalPages; _i2++) {
|
|
124
105
|
paginationItems.push(paginationButton(_i2));
|
|
125
106
|
}
|
|
@@ -137,7 +118,6 @@ export default function ($props, $blocks, $__proto__) {
|
|
|
137
118
|
'ev-change': this.goto
|
|
138
119
|
}), _$ce(2, 'span', [_$ct(' / '), totalPages], 0, 'k-pagination-text')];
|
|
139
120
|
}
|
|
140
|
-
|
|
141
121
|
return _$cv('div', _extends({
|
|
142
122
|
'className': _$cn(classNameObj)
|
|
143
123
|
}, getRestProps(this)), [_$cc(ButtonGroup, {
|
|
@@ -19,7 +19,6 @@ var defaults = deepDefaults({
|
|
|
19
19
|
get fontSize() {
|
|
20
20
|
return theme.default.fontSize;
|
|
21
21
|
},
|
|
22
|
-
|
|
23
22
|
gap: '16px',
|
|
24
23
|
btn: {
|
|
25
24
|
gap: '6px',
|
|
@@ -36,15 +35,12 @@ var defaults = deepDefaults({
|
|
|
36
35
|
get fontSize() {
|
|
37
36
|
return styles.fontSize;
|
|
38
37
|
},
|
|
39
|
-
|
|
40
38
|
get btnGap() {
|
|
41
39
|
return btnGapMap[size];
|
|
42
40
|
},
|
|
43
|
-
|
|
44
41
|
get iconFontSize() {
|
|
45
42
|
return iconFontSizeMap[size];
|
|
46
43
|
}
|
|
47
|
-
|
|
48
44
|
};
|
|
49
45
|
return memo;
|
|
50
46
|
}, {}));
|
package/components/portal.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Component, VNodeComponentClass, IntactDom, TypeDefs } from 'intact-vue-
|
|
|
2
2
|
export interface PortalProps {
|
|
3
3
|
container?: Container;
|
|
4
4
|
}
|
|
5
|
-
export
|
|
5
|
+
export type Container = string | ((parentDom: Element, anchor: IntactDom | null) => Element);
|
|
6
6
|
export declare class Portal<T extends PortalProps = PortalProps> extends Component<T> {
|
|
7
7
|
static template(this: Portal): import("intact").VNodeTextElement;
|
|
8
8
|
static typeDefs: Required<TypeDefs<PortalProps>>;
|
package/components/portal.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
2
2
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
3
|
-
import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject } from 'intact-vue-next';
|
|
3
|
+
import { Component, createCommentVNode, createTextVNode, mount, patch, remove, inject, unmount, removeVNodeDom } from 'intact-vue-next';
|
|
4
4
|
import { isString } from 'intact-shared';
|
|
5
5
|
import { DIALOG } from './dialog/constants';
|
|
6
6
|
import { BaseDialog } from './dialog/base';
|
|
@@ -9,16 +9,12 @@ var typeDefs = {
|
|
|
9
9
|
};
|
|
10
10
|
export var Portal = /*#__PURE__*/function (_Component) {
|
|
11
11
|
_inheritsLoose(Portal, _Component);
|
|
12
|
-
|
|
13
12
|
function Portal() {
|
|
14
13
|
var _context;
|
|
15
|
-
|
|
16
14
|
var _this;
|
|
17
|
-
|
|
18
15
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
16
|
args[_key] = arguments[_key];
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
23
19
|
_this.container = null;
|
|
24
20
|
_this.dialog = inject(DIALOG, null);
|
|
@@ -27,21 +23,16 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
27
23
|
_this.$isPortal = true;
|
|
28
24
|
return _this;
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
Portal.template = function template() {
|
|
32
27
|
if (process.env.NODE_ENV === 'production') {
|
|
33
28
|
return createTextVNode('');
|
|
34
29
|
}
|
|
35
|
-
|
|
36
30
|
return createCommentVNode('portal');
|
|
37
31
|
};
|
|
38
|
-
|
|
39
32
|
var _proto = Portal.prototype;
|
|
40
|
-
|
|
41
33
|
_proto.$render = function $render(lastVNode, nextVNode, parentDom, anchor, mountedQueue // in React, it has priority property to add some prior functions
|
|
42
34
|
) {
|
|
43
35
|
var _this2 = this;
|
|
44
|
-
|
|
45
36
|
/**
|
|
46
37
|
* In React, we cannot render real elements in mountedQueue.
|
|
47
38
|
* Because the rendering time of react element is uncontrollable
|
|
@@ -50,42 +41,33 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
50
41
|
var fakeContainer = document.createDocumentFragment();
|
|
51
42
|
(mountedQueue.priority || mountedQueue).push(function () {
|
|
52
43
|
var parentDom = _this2.$lastInput.dom.parentElement;
|
|
53
|
-
|
|
44
|
+
// maybe the <!-- portal --> has been removed by react, #938
|
|
45
|
+
if (!parentDom) return;
|
|
54
46
|
_this2.initContainer(nextProps.container, parentDom, anchor);
|
|
55
|
-
|
|
56
47
|
_this2.container.appendChild(fakeContainer);
|
|
57
48
|
});
|
|
58
49
|
mount(nextProps.children, fakeContainer, this, this.$SVG, null, mountedQueue);
|
|
59
|
-
|
|
60
50
|
_Component.prototype.$render.call(this, lastVNode, nextVNode, parentDom, anchor, mountedQueue);
|
|
61
51
|
};
|
|
62
|
-
|
|
63
52
|
_proto.$update = function $update(lastVNode, nextVNode, parentDom, anchor, mountedQueue, force) {
|
|
64
53
|
var _this3 = this;
|
|
65
|
-
|
|
66
54
|
// update container if it has changed
|
|
67
55
|
var lastProps = lastVNode.props;
|
|
68
56
|
var nextProps = nextVNode.props;
|
|
69
|
-
|
|
70
57
|
var update = function update() {
|
|
71
58
|
var lastContainer = _this3.container;
|
|
72
|
-
|
|
73
59
|
if (lastProps.container !== nextProps.container) {
|
|
74
60
|
_this3.initContainer(nextProps.container, parentDom, anchor);
|
|
75
61
|
}
|
|
76
|
-
|
|
77
62
|
var nextContainer = _this3.container;
|
|
78
|
-
|
|
79
63
|
if (lastContainer === nextContainer) {
|
|
80
64
|
patch(lastProps.children, nextProps.children, nextContainer, _this3, _this3.$SVG, anchor, mountedQueue, false);
|
|
81
65
|
} else {
|
|
82
66
|
remove(lastProps.children, lastContainer, false);
|
|
83
67
|
mount(nextProps.children, nextContainer, _this3, _this3.$SVG, anchor, mountedQueue);
|
|
84
68
|
}
|
|
85
|
-
|
|
86
69
|
_Component.prototype.$update.call(_this3, lastVNode, nextVNode, parentDom, anchor, mountedQueue, force);
|
|
87
70
|
};
|
|
88
|
-
|
|
89
71
|
if (!this.container) {
|
|
90
72
|
// in react, sometimes $update will be called before mountedQueue in $render
|
|
91
73
|
(mountedQueue.priority || mountedQueue).push(update);
|
|
@@ -93,13 +75,16 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
93
75
|
update();
|
|
94
76
|
}
|
|
95
77
|
};
|
|
96
|
-
|
|
97
78
|
_proto.$unmount = function $unmount(vNode, nextVNode) {
|
|
98
|
-
|
|
99
|
-
|
|
79
|
+
var children = vNode.props.children;
|
|
80
|
+
unmount(children, null);
|
|
81
|
+
if (this.container) {
|
|
82
|
+
// maybe the <!-- portal --> has been removed by react, #938
|
|
83
|
+
// remove(children, this.container, false);
|
|
84
|
+
removeVNodeDom(children, this.container);
|
|
85
|
+
}
|
|
100
86
|
_Component.prototype.$unmount.call(this, vNode, nextVNode);
|
|
101
87
|
};
|
|
102
|
-
|
|
103
88
|
_proto.initContainer = function initContainer(container, parentDom, anchor) {
|
|
104
89
|
if (container) {
|
|
105
90
|
if (isString(container)) {
|
|
@@ -107,8 +92,10 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
107
92
|
} else {
|
|
108
93
|
this.container = container(parentDom, anchor);
|
|
109
94
|
}
|
|
95
|
+
} else {
|
|
96
|
+
// let below logic to set container to default if container does not exist.
|
|
97
|
+
this.container = null;
|
|
110
98
|
}
|
|
111
|
-
|
|
112
99
|
if (!this.container) {
|
|
113
100
|
if (this.$senior instanceof BaseDialog) {
|
|
114
101
|
// Dialog and Drawer must be inserted into document.body
|
|
@@ -127,10 +114,8 @@ export var Portal = /*#__PURE__*/function (_Component) {
|
|
|
127
114
|
// } else {
|
|
128
115
|
// this.container = document.body;
|
|
129
116
|
// }
|
|
130
|
-
|
|
131
117
|
}
|
|
132
118
|
};
|
|
133
|
-
|
|
134
119
|
return Portal;
|
|
135
120
|
}(Component);
|
|
136
121
|
Portal.typeDefs = typeDefs;
|