@king-design/vue 2.1.3 → 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 +406 -554
- 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 +0 -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 +24 -22
- 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 +2 -29
- 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 +12 -41
- 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 +3 -3
- package/components/utils.js +12 -47
- package/components/virtual.js +9 -37
- 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 +633 -517
- 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
|
@@ -5,13 +5,9 @@ import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-meth
|
|
|
5
5
|
import _inheritsLoose from "@babel/runtime-corejs3/helpers/inheritsLoose";
|
|
6
6
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
8
|
-
|
|
9
8
|
function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
-
|
|
11
9
|
function _unsupportedIterableToArray(o, minLen) { var _context15; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context15 = Object.prototype.toString.call(o)).call(_context15, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
12
|
-
|
|
13
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
|
-
|
|
10
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
11
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
16
12
|
import _Promise from "@babel/runtime-corejs3/core-js/promise";
|
|
17
13
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js/instance/concat";
|
|
@@ -25,38 +21,30 @@ import ManuallyDemo from '~/components/upload/demos/manually';
|
|
|
25
21
|
import { mount, unmount, dispatchEvent, getElement, wait } from '../../test/utils';
|
|
26
22
|
import { Upload } from './';
|
|
27
23
|
import { bind } from '../utils';
|
|
28
|
-
|
|
29
24
|
function getDataTransfer(names, options, type) {
|
|
30
25
|
if (options === void 0) {
|
|
31
26
|
options = {};
|
|
32
27
|
}
|
|
33
|
-
|
|
34
28
|
if (type === void 0) {
|
|
35
29
|
type = '';
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
var data = _mapInstanceProperty(names).call(names, function (item) {
|
|
39
32
|
var file = new File([item], (options.name || item) + "." + (options.type || 'png'), {
|
|
40
33
|
type: type
|
|
41
34
|
});
|
|
42
35
|
return file;
|
|
43
36
|
});
|
|
44
|
-
|
|
45
37
|
var dt = new DataTransfer();
|
|
46
|
-
|
|
47
38
|
for (var _iterator = _createForOfIteratorHelperLoose(data), _step; !(_step = _iterator()).done;) {
|
|
48
39
|
var file = _step.value;
|
|
49
40
|
dt.items.add(file);
|
|
50
41
|
}
|
|
51
|
-
|
|
52
42
|
return dt;
|
|
53
43
|
}
|
|
54
|
-
|
|
55
44
|
var respond = function respond(xhr) {
|
|
56
45
|
xhr.respond(200);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
|
|
46
|
+
};
|
|
47
|
+
// we should trigger change event manually in the newest ChromeHeadless
|
|
60
48
|
function fixInputChange(input) {
|
|
61
49
|
var files;
|
|
62
50
|
Object.defineProperty(input, 'files', {
|
|
@@ -69,12 +57,10 @@ function fixInputChange(input) {
|
|
|
69
57
|
}
|
|
70
58
|
});
|
|
71
59
|
}
|
|
72
|
-
|
|
73
60
|
describe('Upload', function () {
|
|
74
61
|
beforeEach(function () {
|
|
75
62
|
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
76
63
|
var requests = this.requests = [];
|
|
77
|
-
|
|
78
64
|
this.xhr.onCreate = function (xhr) {
|
|
79
65
|
setTimeout(function () {
|
|
80
66
|
respond(xhr);
|
|
@@ -83,68 +69,55 @@ describe('Upload', function () {
|
|
|
83
69
|
});
|
|
84
70
|
afterEach(function (done) {
|
|
85
71
|
unmount();
|
|
86
|
-
|
|
87
72
|
respond = function respond(xhr) {
|
|
88
73
|
xhr.respond(200);
|
|
89
74
|
};
|
|
90
|
-
|
|
91
75
|
this.xhr.restore();
|
|
92
76
|
setTimeout(done, 500);
|
|
93
77
|
});
|
|
94
78
|
it('basic', function (done) {
|
|
95
79
|
this.timeout(0);
|
|
96
|
-
|
|
97
80
|
var _mount = mount(BasicDemo),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
81
|
+
instance = _mount[0],
|
|
82
|
+
element = _mount[1];
|
|
101
83
|
var upload = instance.$lastInput.children;
|
|
102
84
|
upload.on('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
103
85
|
var remove, dialog, _dialog$querySelector, cancel, _dialog$querySelector2, ok;
|
|
104
|
-
|
|
105
86
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
106
|
-
while (1) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
case 21:
|
|
141
|
-
expect(element.innerHTML).to.matchSnapshot();
|
|
142
|
-
done();
|
|
143
|
-
|
|
144
|
-
case 23:
|
|
145
|
-
case "end":
|
|
146
|
-
return _context.stop();
|
|
147
|
-
}
|
|
87
|
+
while (1) switch (_context.prev = _context.next) {
|
|
88
|
+
case 0:
|
|
89
|
+
_context.next = 2;
|
|
90
|
+
return wait(500);
|
|
91
|
+
case 2:
|
|
92
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
93
|
+
// beforeRemove
|
|
94
|
+
remove = element.querySelector('.k-upload-close');
|
|
95
|
+
remove.click();
|
|
96
|
+
_context.next = 7;
|
|
97
|
+
return wait();
|
|
98
|
+
case 7:
|
|
99
|
+
dialog = getElement('.k-dialog');
|
|
100
|
+
_dialog$querySelector = dialog.querySelectorAll('.k-dialog-footer .k-btn'), cancel = _dialog$querySelector[1];
|
|
101
|
+
cancel.click();
|
|
102
|
+
_context.next = 12;
|
|
103
|
+
return wait(500);
|
|
104
|
+
case 12:
|
|
105
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
106
|
+
remove.click();
|
|
107
|
+
_context.next = 16;
|
|
108
|
+
return wait();
|
|
109
|
+
case 16:
|
|
110
|
+
dialog = getElement('.k-dialog');
|
|
111
|
+
_dialog$querySelector2 = dialog.querySelectorAll('.k-dialog-footer .k-btn'), ok = _dialog$querySelector2[0];
|
|
112
|
+
ok.click();
|
|
113
|
+
_context.next = 21;
|
|
114
|
+
return wait(500);
|
|
115
|
+
case 21:
|
|
116
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
117
|
+
done();
|
|
118
|
+
case 23:
|
|
119
|
+
case "end":
|
|
120
|
+
return _context.stop();
|
|
148
121
|
}
|
|
149
122
|
}, _callee);
|
|
150
123
|
})));
|
|
@@ -155,92 +128,78 @@ describe('Upload', function () {
|
|
|
155
128
|
});
|
|
156
129
|
it('drag', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
157
130
|
var _mount2, instance, element, handle, upload, p;
|
|
158
|
-
|
|
159
131
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
160
|
-
while (1) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
expect(element.innerHTML).to.matchSnapshot();
|
|
183
|
-
resolve();
|
|
184
|
-
}, 1000);
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
dispatchEvent(handle, 'drop', {
|
|
188
|
-
dataTransfer: getDataTransfer(['a'])
|
|
132
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
133
|
+
case 0:
|
|
134
|
+
this.timeout(0);
|
|
135
|
+
_mount2 = mount(DragDemo), instance = _mount2[0], element = _mount2[1];
|
|
136
|
+
handle = element.querySelector('.k-upload-handle');
|
|
137
|
+
dispatchEvent(handle, 'dragenter');
|
|
138
|
+
_context2.next = 6;
|
|
139
|
+
return wait();
|
|
140
|
+
case 6:
|
|
141
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
142
|
+
dispatchEvent(handle, 'dragleave');
|
|
143
|
+
_context2.next = 10;
|
|
144
|
+
return wait();
|
|
145
|
+
case 10:
|
|
146
|
+
expect(element.outerHTML).to.matchSnapshot();
|
|
147
|
+
upload = instance.$lastInput.children;
|
|
148
|
+
p = new _Promise(function (resolve) {
|
|
149
|
+
upload.on('success', function () {
|
|
150
|
+
setTimeout(function () {
|
|
151
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
152
|
+
resolve();
|
|
153
|
+
}, 1000);
|
|
189
154
|
});
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
155
|
+
});
|
|
156
|
+
dispatchEvent(handle, 'drop', {
|
|
157
|
+
dataTransfer: getDataTransfer(['a'])
|
|
158
|
+
});
|
|
159
|
+
_context2.next = 16;
|
|
160
|
+
return wait();
|
|
161
|
+
case 16:
|
|
162
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
163
|
+
_context2.next = 19;
|
|
164
|
+
return p;
|
|
165
|
+
case 19:
|
|
166
|
+
case "end":
|
|
167
|
+
return _context2.stop();
|
|
202
168
|
}
|
|
203
169
|
}, _callee2, this);
|
|
204
170
|
})));
|
|
205
171
|
it('gallery', function (done) {
|
|
206
172
|
this.timeout(0);
|
|
207
|
-
|
|
208
173
|
var _mount3 = mount(GalleryDemo),
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
174
|
+
instance = _mount3[0],
|
|
175
|
+
element = _mount3[1];
|
|
212
176
|
var input = element.querySelector('input');
|
|
213
177
|
var upload = instance.$lastInput.children;
|
|
214
178
|
upload.on('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
215
179
|
var view, dialog;
|
|
216
180
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
217
|
-
while (1) {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
181
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
182
|
+
case 0:
|
|
183
|
+
_context3.next = 2;
|
|
184
|
+
return wait(1000);
|
|
185
|
+
case 2:
|
|
186
|
+
expect(element.innerHTML.replace(/blob:[^"]*/g, '')).to.matchSnapshot();
|
|
187
|
+
view = element.querySelector('.k-upload-overlap');
|
|
188
|
+
view.click();
|
|
189
|
+
_context3.next = 7;
|
|
190
|
+
return wait();
|
|
191
|
+
case 7:
|
|
192
|
+
dialog = getElement('.k-dialog');
|
|
193
|
+
expect(dialog.innerHTML.replace(/blob:[^"]*/g, '')).to.matchSnapshot();
|
|
194
|
+
upload.on('error', function (err) {
|
|
195
|
+
expect(err.message).to.matchSnapshot();
|
|
224
196
|
expect(element.innerHTML.replace(/blob:[^"]*/g, '')).to.matchSnapshot();
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
dialog = getElement('.k-dialog');
|
|
232
|
-
expect(dialog.innerHTML.replace(/blob:[^"]*/g, '')).to.matchSnapshot();
|
|
233
|
-
upload.on('error', function (err) {
|
|
234
|
-
expect(err.message).to.matchSnapshot();
|
|
235
|
-
expect(element.innerHTML.replace(/blob:[^"]*/g, '')).to.matchSnapshot();
|
|
236
|
-
done();
|
|
237
|
-
});
|
|
238
|
-
input.files = getDataTransfer(['b', 'c', 'd']).files;
|
|
239
|
-
|
|
240
|
-
case 11:
|
|
241
|
-
case "end":
|
|
242
|
-
return _context3.stop();
|
|
243
|
-
}
|
|
197
|
+
done();
|
|
198
|
+
});
|
|
199
|
+
input.files = getDataTransfer(['b', 'c', 'd']).files;
|
|
200
|
+
case 11:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context3.stop();
|
|
244
203
|
}
|
|
245
204
|
}, _callee3);
|
|
246
205
|
})));
|
|
@@ -252,28 +211,22 @@ describe('Upload', function () {
|
|
|
252
211
|
});
|
|
253
212
|
it('manually', function (done) {
|
|
254
213
|
this.timeout(0);
|
|
255
|
-
|
|
256
214
|
var _mount4 = mount(ManuallyDemo),
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
215
|
+
instance = _mount4[0],
|
|
216
|
+
element = _mount4[1];
|
|
260
217
|
var upload = instance.$lastInput.children;
|
|
261
218
|
upload.on('success', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
262
219
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
263
|
-
while (1) {
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
case 4:
|
|
274
|
-
case "end":
|
|
275
|
-
return _context4.stop();
|
|
276
|
-
}
|
|
220
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
221
|
+
case 0:
|
|
222
|
+
_context4.next = 2;
|
|
223
|
+
return wait(500);
|
|
224
|
+
case 2:
|
|
225
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
226
|
+
done();
|
|
227
|
+
case 4:
|
|
228
|
+
case "end":
|
|
229
|
+
return _context4.stop();
|
|
277
230
|
}
|
|
278
231
|
}, _callee4);
|
|
279
232
|
})));
|
|
@@ -287,40 +240,29 @@ describe('Upload', function () {
|
|
|
287
240
|
});
|
|
288
241
|
it('should trigger error event when exceed the maxSize', function (done) {
|
|
289
242
|
var _context6;
|
|
290
|
-
|
|
291
243
|
var Demo = /*#__PURE__*/function (_Component) {
|
|
292
244
|
_inheritsLoose(Demo, _Component);
|
|
293
|
-
|
|
294
245
|
function Demo() {
|
|
295
246
|
var _context5;
|
|
296
|
-
|
|
297
247
|
var _this;
|
|
298
|
-
|
|
299
248
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
300
249
|
args[_key] = arguments[_key];
|
|
301
250
|
}
|
|
302
|
-
|
|
303
251
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context5 = [this]).call(_context5, args)) || this;
|
|
304
252
|
_this.Upload = Upload;
|
|
305
253
|
return _this;
|
|
306
254
|
}
|
|
307
|
-
|
|
308
255
|
var _proto = Demo.prototype;
|
|
309
|
-
|
|
310
256
|
_proto._onError = function _onError(e) {
|
|
311
257
|
expect(e.message).to.matchSnapshot();
|
|
312
258
|
done();
|
|
313
259
|
};
|
|
314
|
-
|
|
315
260
|
return Demo;
|
|
316
261
|
}(Component);
|
|
317
|
-
|
|
318
262
|
Demo.template = "const {Upload} = this; <Upload maxSize={1} ev-error={this._onError} />";
|
|
319
|
-
|
|
320
263
|
var _mount5 = mount(Demo),
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
264
|
+
instance = _mount5[0],
|
|
265
|
+
element = _mount5[1];
|
|
324
266
|
var input = element.querySelector('input');
|
|
325
267
|
fixInputChange(input);
|
|
326
268
|
input.files = getDataTransfer([_repeatInstanceProperty(_context6 = 'a').call(_context6, 1025 * 1)], {
|
|
@@ -329,108 +271,79 @@ describe('Upload', function () {
|
|
|
329
271
|
});
|
|
330
272
|
it('should handle error on uploading correctly', function (done) {
|
|
331
273
|
var _context9;
|
|
332
|
-
|
|
333
274
|
this.timeout(0);
|
|
334
|
-
|
|
335
275
|
var Demo = /*#__PURE__*/function (_Component2) {
|
|
336
276
|
_inheritsLoose(Demo, _Component2);
|
|
337
|
-
|
|
338
277
|
function Demo() {
|
|
339
278
|
var _context7;
|
|
340
|
-
|
|
341
279
|
var _this2;
|
|
342
|
-
|
|
343
280
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
344
281
|
args[_key2] = arguments[_key2];
|
|
345
282
|
}
|
|
346
|
-
|
|
347
283
|
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context7 = [this]).call(_context7, args)) || this;
|
|
348
284
|
_this2.Upload = Upload;
|
|
349
285
|
return _this2;
|
|
350
286
|
}
|
|
351
|
-
|
|
352
287
|
var _proto2 = Demo.prototype;
|
|
353
|
-
|
|
354
288
|
_proto2._onError = /*#__PURE__*/function () {
|
|
355
289
|
var _onError2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(e) {
|
|
356
290
|
return _regeneratorRuntime.wrap(function _callee5$(_context8) {
|
|
357
|
-
while (1) {
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
case 4:
|
|
370
|
-
case "end":
|
|
371
|
-
return _context8.stop();
|
|
372
|
-
}
|
|
291
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
292
|
+
case 0:
|
|
293
|
+
_context8.next = 2;
|
|
294
|
+
return wait(500);
|
|
295
|
+
case 2:
|
|
296
|
+
// FIXME: the innerHTML has string: `height: 44px;` when we run test in travis-ci
|
|
297
|
+
// expect(element.innerHTML.replace(/height: \d+px;/, '')).to.matchSnapshot();
|
|
298
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
299
|
+
done();
|
|
300
|
+
case 4:
|
|
301
|
+
case "end":
|
|
302
|
+
return _context8.stop();
|
|
373
303
|
}
|
|
374
304
|
}, _callee5);
|
|
375
305
|
}));
|
|
376
|
-
|
|
377
306
|
function _onError(_x) {
|
|
378
307
|
return _onError2.apply(this, arguments);
|
|
379
308
|
}
|
|
380
|
-
|
|
381
309
|
return _onError;
|
|
382
310
|
}();
|
|
383
|
-
|
|
384
311
|
return Demo;
|
|
385
312
|
}(Component);
|
|
386
|
-
|
|
387
313
|
Demo.template = "\n const {Upload} = this;\n <Upload\n action=\"//localhost\"\n ev-error={this._onError}\n />\n ";
|
|
388
|
-
|
|
389
314
|
var _mount6 = mount(Demo),
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
315
|
+
instance = _mount6[0],
|
|
316
|
+
element = _mount6[1];
|
|
393
317
|
var input = element.querySelector('input');
|
|
394
318
|
fixInputChange(input);
|
|
395
319
|
input.files = getDataTransfer([_repeatInstanceProperty(_context9 = 'a').call(_context9, 1024 * 100)], {
|
|
396
320
|
name: 'a'
|
|
397
321
|
}).files;
|
|
398
|
-
|
|
399
322
|
respond = function respond(xhr) {
|
|
400
323
|
return xhr.respond(500);
|
|
401
324
|
};
|
|
402
325
|
});
|
|
403
326
|
it('should abort request when remove file in progress', function (done) {
|
|
404
327
|
var _context11;
|
|
405
|
-
|
|
406
328
|
this.timeout(0);
|
|
407
|
-
|
|
408
329
|
var Demo = /*#__PURE__*/function (_Component3) {
|
|
409
330
|
_inheritsLoose(Demo, _Component3);
|
|
410
|
-
|
|
411
331
|
function Demo() {
|
|
412
332
|
var _context10;
|
|
413
|
-
|
|
414
333
|
var _this3;
|
|
415
|
-
|
|
416
334
|
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
417
335
|
args[_key3] = arguments[_key3];
|
|
418
336
|
}
|
|
419
|
-
|
|
420
337
|
_this3 = _Component3.call.apply(_Component3, _concatInstanceProperty(_context10 = [this]).call(_context10, args)) || this;
|
|
421
338
|
_this3.Upload = Upload;
|
|
422
339
|
return _this3;
|
|
423
340
|
}
|
|
424
|
-
|
|
425
341
|
return Demo;
|
|
426
342
|
}(Component);
|
|
427
|
-
|
|
428
343
|
Demo.template = "\n const {Upload} = this;\n <Upload\n action=\"//jsonplaceholder.typicode.com/posts/\"\n ref=\"upload\"\n />\n ";
|
|
429
|
-
|
|
430
344
|
var _mount7 = mount(Demo),
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
345
|
+
instance = _mount7[0],
|
|
346
|
+
element = _mount7[1];
|
|
434
347
|
var input = element.querySelector('input');
|
|
435
348
|
fixInputChange(input);
|
|
436
349
|
input.files = getDataTransfer([_repeatInstanceProperty(_context11 = 'a').call(_context11, 1024 * 512)], {
|
|
@@ -438,21 +351,17 @@ describe('Upload', function () {
|
|
|
438
351
|
}).files;
|
|
439
352
|
instance.refs.upload.on('progress', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
440
353
|
return _regeneratorRuntime.wrap(function _callee6$(_context12) {
|
|
441
|
-
while (1) {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
case 5:
|
|
453
|
-
case "end":
|
|
454
|
-
return _context12.stop();
|
|
455
|
-
}
|
|
354
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
355
|
+
case 0:
|
|
356
|
+
element.querySelector('.k-upload-close').click();
|
|
357
|
+
_context12.next = 3;
|
|
358
|
+
return wait(500);
|
|
359
|
+
case 3:
|
|
360
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
361
|
+
done();
|
|
362
|
+
case 5:
|
|
363
|
+
case "end":
|
|
364
|
+
return _context12.stop();
|
|
456
365
|
}
|
|
457
366
|
}, _callee6);
|
|
458
367
|
})));
|
|
@@ -468,11 +377,9 @@ describe('Upload', function () {
|
|
|
468
377
|
expect(!!i.accept.isValidType('image/png', '')).to.be.true;
|
|
469
378
|
expect(!!i.accept.isValidType('video/avi', '')).to.be.true;
|
|
470
379
|
expect(!!i.accept.isValidType('application/x-tar', 'a.tar')).to.be.true;
|
|
471
|
-
|
|
472
380
|
var _mount8 = mount(BasicDemo),
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
381
|
+
instance = _mount8[0],
|
|
382
|
+
element = _mount8[1];
|
|
476
383
|
var upload = instance.$lastInput.children;
|
|
477
384
|
upload.on('error', function (e) {
|
|
478
385
|
expect(e.message).to.matchSnapshot();
|
|
@@ -486,34 +393,25 @@ describe('Upload', function () {
|
|
|
486
393
|
});
|
|
487
394
|
it('should not add file if beforeUpload returns false', function (done) {
|
|
488
395
|
var _context14;
|
|
489
|
-
|
|
490
396
|
var Demo = /*#__PURE__*/function (_Component4) {
|
|
491
397
|
_inheritsLoose(Demo, _Component4);
|
|
492
|
-
|
|
493
398
|
function Demo() {
|
|
494
399
|
var _context13;
|
|
495
|
-
|
|
496
400
|
var _this4;
|
|
497
|
-
|
|
498
401
|
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
499
402
|
args[_key4] = arguments[_key4];
|
|
500
403
|
}
|
|
501
|
-
|
|
502
404
|
_this4 = _Component4.call.apply(_Component4, _concatInstanceProperty(_context13 = [this]).call(_context13, args)) || this;
|
|
503
405
|
_this4.Upload = Upload;
|
|
504
406
|
return _this4;
|
|
505
407
|
}
|
|
506
|
-
|
|
507
408
|
var _proto3 = Demo.prototype;
|
|
508
|
-
|
|
509
409
|
_proto3.beforeUpload = function beforeUpload() {
|
|
510
410
|
var _this5 = this;
|
|
511
|
-
|
|
512
411
|
return new _Promise(function (resolve, reject) {
|
|
513
412
|
setTimeout(function () {
|
|
514
413
|
setTimeout(function () {
|
|
515
414
|
var files = _this5.refs.upload.get('files');
|
|
516
|
-
|
|
517
415
|
expect(files.length).to.eql(0);
|
|
518
416
|
done();
|
|
519
417
|
});
|
|
@@ -521,18 +419,13 @@ describe('Upload', function () {
|
|
|
521
419
|
}, 100);
|
|
522
420
|
});
|
|
523
421
|
};
|
|
524
|
-
|
|
525
422
|
return Demo;
|
|
526
423
|
}(Component);
|
|
527
|
-
|
|
528
424
|
Demo.template = "\n const {Upload} = this;\n <Upload\n action=\"//jsonplaceholder.typicode.com/posts/\"\n ref=\"upload\"\n beforeUpload={this.beforeUpload}\n type=\"gallery\"\n limit={1}\n />\n ";
|
|
529
|
-
|
|
530
425
|
__decorate([bind], Demo.prototype, "beforeUpload", null);
|
|
531
|
-
|
|
532
426
|
var _mount9 = mount(Demo),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
427
|
+
instance = _mount9[0],
|
|
428
|
+
element = _mount9[1];
|
|
536
429
|
var input = element.querySelector('input');
|
|
537
430
|
fixInputChange(input);
|
|
538
431
|
input.files = getDataTransfer([_repeatInstanceProperty(_context14 = 'a').call(_context14, 1024 * 512)], {
|