@king-design/react 3.1.4-beta.2 → 3.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/__snapshots__/Dialog.md +1 -1
- package/__tests__/__snapshots__/React Demos.md +260 -254
- package/__tests__/components/cascader.spec.tsx +1 -1
- 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 +7 -10
- package/components/affix/styles.js +1 -1
- package/components/affix/useStyle.js +8 -19
- package/components/badge/index.js +0 -5
- package/components/badge/index.vdt.js +7 -11
- package/components/badge/styles.js +1 -3
- package/components/breadcrumb/index.js +0 -7
- 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 +1 -4
- package/components/button/dynamicButton.d.ts +1 -1
- package/components/button/dynamicButton.js +2 -5
- package/components/button/group.js +2 -13
- package/components/button/group.vdt.js +5 -8
- package/components/button/index.js +3 -27
- package/components/button/index.spec.js +74 -96
- package/components/button/index.vdt.js +21 -31
- package/components/button/styles.d.ts +2 -2
- package/components/button/styles.js +8 -53
- package/components/card/column.js +0 -5
- package/components/card/column.vdt.js +5 -10
- package/components/card/index.js +0 -7
- package/components/card/index.vdt.js +5 -17
- package/components/card/styles.js +3 -6
- package/components/carousel/index.js +1 -19
- package/components/carousel/index.spec.js +127 -163
- package/components/carousel/index.vdt.js +12 -16
- package/components/carousel/item.js +0 -5
- package/components/carousel/item.vdt.js +4 -7
- package/components/carousel/styles.js +2 -3
- 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 +15 -33
- package/components/cascader/styles.js +2 -8
- 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 +1 -13
- 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 -17
- 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 +2 -5
- package/components/colorpicker/drag.js +0 -5
- package/components/colorpicker/index.js +0 -7
- 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 +4 -15
- 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/config/index.js +3 -8
- package/components/config/index.spec.js +37 -50
- package/components/context.d.ts +2 -2
- package/components/context.js +2 -21
- package/components/copy/index.js +0 -7
- package/components/copy/index.spec.js +64 -86
- package/components/copy/index.vdt.js +4 -7
- package/components/copy/styles.js +0 -1
- package/components/copy/useCopy.js +13 -23
- 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 -15
- 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 +1154 -1464
- 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 +3 -12
- 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 +20 -38
- 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 -20
- package/components/dialog/base.js +1 -29
- package/components/dialog/base.vdt.js +14 -31
- package/components/dialog/index.js +6 -31
- package/components/dialog/index.spec.js +456 -627
- package/components/dialog/staticMethods.d.ts +1 -1
- package/components/dialog/staticMethods.js +2 -13
- package/components/dialog/styles.js +3 -14
- 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 +128 -170
- package/components/drawer/index.vdt.js +3 -9
- package/components/drawer/styles.d.ts +2 -2
- package/components/drawer/styles.js +1 -4
- package/components/dropdown/dropdown.d.ts +2 -2
- package/components/dropdown/dropdown.js +33 -90
- 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 +2 -11
- 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 +1 -2
- package/components/form/form.js +0 -18
- package/components/form/form.vdt.js +4 -7
- package/components/form/index.spec.js +1082 -1316
- 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 +2 -10
- package/components/form/useDirty.js +2 -8
- 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 +2 -8
- package/components/grid/useBreakpoints.js +0 -5
- package/components/grid/useGutter.js +9 -27
- package/components/icon/index.js +0 -10
- package/components/icon/index.vdt.js +8 -14
- package/components/icon/styles.js +1 -4
- package/components/input/index.d.ts +3 -3
- package/components/input/index.js +0 -13
- package/components/input/index.spec.js +185 -239
- package/components/input/index.vdt.js +46 -57
- package/components/input/search.js +0 -20
- package/components/input/search.vdt.js +6 -9
- package/components/input/styles.js +2 -29
- package/components/input/useAutoRows.js +6 -18
- package/components/input/useAutoWidth.js +0 -5
- package/components/input/useFocus.js +0 -2
- package/components/input/useFrozen.js +0 -6
- package/components/input/useShowPassword.js +2 -5
- package/components/layout/aside.js +6 -18
- package/components/layout/aside.vdt.js +5 -9
- package/components/layout/body.js +5 -18
- package/components/layout/footer.js +1 -10
- package/components/layout/header.js +9 -23
- package/components/layout/index.spec.js +24 -34
- package/components/layout/layout.js +9 -24
- package/components/layout/styles.js +6 -17
- 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 +22 -38
- package/components/menu/menu.js +2 -11
- package/components/menu/menu.vdt.js +6 -12
- package/components/menu/styles.js +4 -23
- package/components/menu/useDropdown.js +4 -10
- 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 +6 -9
- package/components/message/messages.js +0 -12
- package/components/message/messages.vdt.js +0 -1
- package/components/message/styles.js +2 -11
- 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 -32
- package/components/pagination/styles.js +3 -9
- package/components/popover/content.js +1 -5
- package/components/popover/content.vdt.js +4 -14
- package/components/popover/index.js +5 -10
- package/components/popover/index.spec.js +113 -150
- package/components/popover/styles.js +1 -1
- package/components/portal.d.ts +1 -1
- package/components/portal.js +2 -30
- 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 -17
- package/components/progress/styles.js +1 -7
- 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 +1 -13
- 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 +1 -4
- 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 -12
- package/components/scrollSelect/styles.js +1 -8
- 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.d.ts +2 -2
- package/components/select/base.js +3 -33
- package/components/select/base.vdt.js +27 -46
- package/components/select/group.js +0 -5
- package/components/select/group.vdt.js +4 -10
- package/components/select/index.spec.js +370 -464
- 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 +3 -34
- 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/useDraggble.js +2 -2
- package/components/select/useEqualWidth.js +0 -1
- package/components/select/useFilterable.js +9 -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 -7
- package/components/skeleton/item.vdt.js +1 -6
- package/components/skeleton/skeleton.js +0 -7
- package/components/skeleton/skeleton.vdt.js +6 -12
- package/components/skeleton/styles.d.ts +1 -1
- package/components/skeleton/styles.js +2 -3
- package/components/slider/index.d.ts +1 -1
- package/components/slider/index.js +0 -7
- package/components/slider/index.spec.js +502 -624
- package/components/slider/index.vdt.js +35 -50
- package/components/slider/styles.js +1 -19
- 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 -24
- package/components/spin/index.js +0 -7
- package/components/spin/index.vdt.js +4 -11
- package/components/spin/styles.js +1 -3
- package/components/spinner/index.d.ts +4 -4
- package/components/spinner/index.js +6 -18
- package/components/spinner/index.spec.js +359 -460
- package/components/spinner/index.vdt.js +12 -15
- package/components/spinner/styles.js +1 -11
- 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 +14 -32
- 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/memo.js +0 -6
- package/components/split/styles.d.ts +1 -1
- package/components/split/styles.js +1 -9
- package/components/split/useDraggable.js +11 -35
- package/components/split/useSize.js +2 -5
- package/components/steps/context.d.ts +3 -3
- package/components/steps/index.js +2 -13
- package/components/steps/index.spec.js +21 -27
- package/components/steps/index.vdt.js +9 -12
- package/components/steps/step.js +0 -5
- package/components/steps/step.vdt.js +8 -12
- package/components/steps/styles.js +1 -38
- package/components/switch/index.js +2 -23
- package/components/switch/index.spec.js +194 -234
- package/components/switch/index.vdt.js +16 -32
- package/components/switch/styles.js +4 -12
- package/components/switch/useDraggable.js +10 -18
- package/components/table/cell.js +0 -9
- 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 +25 -37
- package/components/table/exportTable.js +41 -55
- package/components/table/index.spec.js +817 -1026
- package/components/table/row.d.ts +1 -1
- package/components/table/row.js +12 -44
- package/components/table/row.vdt.js +27 -38
- package/components/table/styles.js +2 -18
- package/components/table/table.d.ts +5 -5
- package/components/table/table.js +18 -50
- package/components/table/table.vdt.js +61 -86
- 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 -8
- package/components/table/useExpandable.js +2 -5
- package/components/table/useFixedColumns.d.ts +1 -1
- package/components/table/useFixedColumns.js +3 -20
- package/components/table/useGroup.d.ts +1 -1
- package/components/table/useGroup.js +7 -25
- 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/useResetRowStatus.js +2 -6
- package/components/table/useResizable.js +4 -21
- 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 +97 -129
- package/components/tabs/index.vdt.js +13 -16
- package/components/tabs/styles.js +1 -23
- 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 +10 -30
- package/components/tag/base.js +0 -11
- package/components/tag/index.js +2 -4
- package/components/tag/index.spec.js +123 -156
- package/components/tag/index.vdt.js +8 -15
- package/components/tag/styles.d.ts +1 -1
- package/components/tag/styles.js +2 -18
- package/components/tag/tags.d.ts +2 -2
- package/components/tag/tags.js +0 -7
- package/components/tag/tags.vdt.js +10 -18
- package/components/tag/useChildren.js +0 -5
- package/components/tag/useDraggable.js +6 -15
- package/components/tag/useNowrap.js +10 -27
- package/components/timeline/item.js +0 -7
- package/components/timeline/item.vdt.js +4 -9
- package/components/timeline/styles.d.ts +2 -2
- package/components/timeline/styles.js +2 -6
- package/components/timeline/timeline.js +0 -5
- 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 +1 -2
- 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 +1 -4
- package/components/tooltip/content.js +0 -28
- package/components/tooltip/content.vdt.js +15 -27
- package/components/tooltip/index.js +3 -7
- package/components/tooltip/index.spec.js +400 -527
- package/components/tooltip/styles.d.ts +1 -1
- package/components/tooltip/styles.js +3 -13
- 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 +17 -36
- package/components/transfer/styles.js +1 -11
- package/components/transfer/useCheck.d.ts +1 -1
- package/components/transfer/useCheck.js +1 -16
- 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 +3 -22
- package/components/tree/index.spec.js +310 -388
- package/components/tree/index.vdt.js +12 -24
- package/components/tree/styles.js +3 -17
- package/components/tree/useChecked.js +3 -27
- package/components/tree/useDraggable.js +14 -44
- package/components/tree/useExpanded.js +28 -46
- package/components/tree/useFilter.js +3 -10
- package/components/tree/useNodes.d.ts +3 -3
- 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 -37
- package/components/treeSelect/index.spec.js +123 -160
- package/components/treeSelect/index.vdt.js +14 -20
- package/components/treeSelect/styles.js +1 -2
- 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 -248
- package/components/upload/index.vdt.js +12 -28
- package/components/upload/styles.js +2 -28
- package/components/upload/useAccept.js +2 -10
- package/components/upload/useDrag.js +0 -7
- package/components/upload/useFiles.js +103 -148
- package/components/upload/useShowImage.js +0 -3
- package/components/upload/useUpload.js +47 -69
- package/components/utils.d.ts +6 -6
- package/components/utils.js +12 -56
- package/components/virtual.js +9 -37
- package/components/wave/index.js +5 -32
- package/components/wave/styles.js +1 -1
- package/hooks/useDelayClose.js +2 -7
- 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/useResizeObserver.js +0 -2
- 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 -5
- package/styles/keyframes.js +0 -1
- package/styles/theme.d.ts +1 -1
- package/styles/theme.js +2 -5
- package/styles/utils.d.ts +1 -1
- package/styles/utils.js +3 -17
- package/yarn-error.log +528 -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 -28
|
@@ -8,45 +8,36 @@ var defaults = {
|
|
|
8
8
|
get height() {
|
|
9
9
|
return theme.default.height;
|
|
10
10
|
},
|
|
11
|
-
|
|
12
11
|
width: '100px',
|
|
13
|
-
|
|
14
12
|
get border() {
|
|
15
13
|
return "1px solid " + theme.color.border;
|
|
16
14
|
},
|
|
17
|
-
|
|
18
15
|
get borderRadius() {
|
|
19
16
|
return theme.borderRadius;
|
|
20
17
|
},
|
|
21
|
-
|
|
22
18
|
cursor: 'pointer',
|
|
23
19
|
bgColor: '#fff',
|
|
24
20
|
padding: '4px',
|
|
25
|
-
|
|
26
21
|
get innerBorderRadius() {
|
|
27
22
|
return theme.borderRadius;
|
|
28
23
|
},
|
|
29
|
-
|
|
30
24
|
// size
|
|
31
25
|
large: {
|
|
32
26
|
get height() {
|
|
33
27
|
return theme.large.height;
|
|
34
28
|
},
|
|
35
|
-
|
|
36
29
|
width: '120px'
|
|
37
30
|
},
|
|
38
31
|
small: {
|
|
39
32
|
get height() {
|
|
40
33
|
return theme.small.height;
|
|
41
34
|
},
|
|
42
|
-
|
|
43
35
|
width: '70px'
|
|
44
36
|
},
|
|
45
37
|
mini: {
|
|
46
38
|
get height() {
|
|
47
39
|
return theme.mini.height;
|
|
48
40
|
},
|
|
49
|
-
|
|
50
41
|
width: '50px',
|
|
51
42
|
padding: '2px'
|
|
52
43
|
},
|
|
@@ -102,11 +93,9 @@ var defaults = {
|
|
|
102
93
|
get bgColor() {
|
|
103
94
|
return theme.color.disabledBg;
|
|
104
95
|
},
|
|
105
|
-
|
|
106
96
|
get borderColor() {
|
|
107
97
|
return theme.color.disabledBorder;
|
|
108
98
|
},
|
|
109
|
-
|
|
110
99
|
cursor: 'not-allowed'
|
|
111
100
|
}
|
|
112
101
|
};
|
|
@@ -115,8 +104,8 @@ setDefault(function () {
|
|
|
115
104
|
colorpicker = deepDefaults(theme, {
|
|
116
105
|
colorpicker: defaults
|
|
117
106
|
}).colorpicker;
|
|
118
|
-
makeStyles == null
|
|
119
|
-
makePanelStyles == null
|
|
107
|
+
makeStyles == null || makeStyles.clearCache();
|
|
108
|
+
makePanelStyles == null || makePanelStyles.clearCache();
|
|
120
109
|
});
|
|
121
110
|
var _sizes = ['large', 'small', 'mini'];
|
|
122
111
|
export var makeStyles = cache(function makeStyles(k) {
|
|
@@ -130,7 +119,7 @@ export var makePanelStyles = cache(function makePanelStyles(k) {
|
|
|
130
119
|
});
|
|
131
120
|
export function makeAlphaBgColor(_ref, k) {
|
|
132
121
|
var r = _ref.r,
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
g = _ref.g,
|
|
123
|
+
b = _ref.b;
|
|
135
124
|
return /*#__PURE__*/css(".", k, "-slider-track-wrapper{background:linear-gradient(to right, rgba(", r, ", ", g, ", ", b, ", 0) 0%, rgb(", r, ", ", g, ", ", b, ") 100%);}");
|
|
136
125
|
}
|
|
@@ -5,35 +5,31 @@ export function useDrag() {
|
|
|
5
5
|
var mousedown = false;
|
|
6
6
|
var mousemove = false;
|
|
7
7
|
var x;
|
|
8
|
-
|
|
9
8
|
var _useDraggable = useDraggable({
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
var _instance$get = instance.get(),
|
|
9
|
+
onStart: function onStart(e) {
|
|
10
|
+
mousedown = true;
|
|
11
|
+
x = e.clientX;
|
|
12
|
+
instance.get('onStart')();
|
|
13
|
+
},
|
|
14
|
+
onMove: function onMove(e) {
|
|
15
|
+
mousemove = true;
|
|
16
|
+
var _instance$get = instance.get(),
|
|
19
17
|
value = _instance$get.value,
|
|
20
18
|
max = _instance$get.max;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
start = _useDraggable.start;
|
|
36
|
-
|
|
19
|
+
var deltaX = e.clientX - x;
|
|
20
|
+
var newValue = value + deltaX;
|
|
21
|
+
x = e.clientX;
|
|
22
|
+
instance.set('value', Math.min(max, Math.max(0, newValue)));
|
|
23
|
+
},
|
|
24
|
+
onEnd: function onEnd(e) {
|
|
25
|
+
if (instance.$unmounted) return;
|
|
26
|
+
if (mousedown && !mousemove) instance.trigger('click');
|
|
27
|
+
mousedown = false;
|
|
28
|
+
mousemove = false;
|
|
29
|
+
instance.get('onEnd')();
|
|
30
|
+
}
|
|
31
|
+
}),
|
|
32
|
+
start = _useDraggable.start;
|
|
37
33
|
return {
|
|
38
34
|
start: start
|
|
39
35
|
};
|
|
@@ -5,64 +5,48 @@ import { useInstance } from 'intact-react';
|
|
|
5
5
|
import tinycolor from 'tinycolor2';
|
|
6
6
|
import { useState } from '../../hooks/useState';
|
|
7
7
|
export var Mode;
|
|
8
|
-
|
|
9
8
|
(function (Mode) {
|
|
10
9
|
Mode[Mode["RGB"] = 0] = "RGB";
|
|
11
10
|
Mode[Mode["HSL"] = 1] = "HSL";
|
|
12
11
|
})(Mode || (Mode = {}));
|
|
13
|
-
|
|
14
12
|
export function useInput(hsv, rgb, hsl) {
|
|
15
13
|
var instance = useInstance();
|
|
16
14
|
var mode = useState(Mode.RGB);
|
|
17
15
|
var dragging = useState(false);
|
|
18
|
-
|
|
19
16
|
function onInputHex(e) {
|
|
20
17
|
var _context;
|
|
21
|
-
|
|
22
18
|
var hex = _trimInstanceProperty(_context = e.target.value).call(_context);
|
|
23
|
-
|
|
24
19
|
var color = tinycolor(hex);
|
|
25
|
-
|
|
26
20
|
if (color.isValid()) {
|
|
27
21
|
hsv.set(color.toHsv());
|
|
28
22
|
}
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
function changeMode() {
|
|
32
25
|
mode.set(mode.value === Mode.RGB ? Mode.HSL : Mode.RGB);
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
function changeColor(type, v) {
|
|
36
28
|
var _extends2;
|
|
37
|
-
|
|
38
29
|
var isRgb = mode.value === Mode.RGB;
|
|
39
30
|
var color = isRgb ? rgb.value : hsl.value;
|
|
40
|
-
|
|
41
31
|
if (!isRgb && type !== 'h' || type === 'a') {
|
|
42
32
|
v = v / 100;
|
|
43
33
|
}
|
|
44
|
-
|
|
45
34
|
if (color[type] === v) return;
|
|
46
35
|
hsv.set(tinycolor(_extends({}, color, (_extends2 = {}, _extends2[type] = v, _extends2))).toHsv());
|
|
47
36
|
}
|
|
48
|
-
|
|
49
37
|
function setInputValue(type, maxValue, e) {
|
|
50
38
|
var _context2;
|
|
51
|
-
|
|
52
39
|
var value = parseInt(_trimInstanceProperty(_context2 = e.target.value).call(_context2), 10);
|
|
53
40
|
if (_Number$isNaN(value)) return;
|
|
54
41
|
value = Math.min(Math.max(0, value), maxValue);
|
|
55
42
|
changeColor(type, value);
|
|
56
43
|
}
|
|
57
|
-
|
|
58
44
|
function onStart() {
|
|
59
45
|
dragging.set(true);
|
|
60
46
|
}
|
|
61
|
-
|
|
62
47
|
function onEnd() {
|
|
63
48
|
dragging.set(false);
|
|
64
49
|
}
|
|
65
|
-
|
|
66
50
|
return {
|
|
67
51
|
onInputHex: onInputHex,
|
|
68
52
|
mode: mode,
|
|
@@ -7,25 +7,22 @@ window.tinycolor = tinycolor;
|
|
|
7
7
|
export function usePointer(hsv, format) {
|
|
8
8
|
var instance = useInstance();
|
|
9
9
|
var areaRef = createRef();
|
|
10
|
-
|
|
11
10
|
var _useDraggable = useDraggable({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
onStart: function onStart(e) {
|
|
12
|
+
handleChange(e);
|
|
13
|
+
},
|
|
14
|
+
onMove: function onMove(e) {
|
|
15
|
+
handleChange(e);
|
|
16
|
+
}
|
|
17
|
+
}),
|
|
18
|
+
start = _useDraggable.start;
|
|
19
|
+
// @reference: https://github.com/casesandberg/react-color/blob/master/src/helpers/saturation.js
|
|
22
20
|
function handleChange(e) {
|
|
23
21
|
var _areaRef$value$getBou = areaRef.value.getBoundingClientRect(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
width = _areaRef$value$getBou.width,
|
|
23
|
+
height = _areaRef$value$getBou.height,
|
|
24
|
+
_left = _areaRef$value$getBou.left,
|
|
25
|
+
_top = _areaRef$value$getBou.top;
|
|
29
26
|
var x = isNumber(e.pageX) ? e.pageX : e.touches[0].pageX;
|
|
30
27
|
var y = isNumber(e.pageY) ? e.pageY : e.touches[0].pageY;
|
|
31
28
|
var left = x - _left - window.pageXOffset;
|
|
@@ -37,13 +34,13 @@ export function usePointer(hsv, format) {
|
|
|
37
34
|
hsv.set(_extends({}, hsv.value, {
|
|
38
35
|
s: saturation,
|
|
39
36
|
v: bright
|
|
40
|
-
}));
|
|
37
|
+
}));
|
|
38
|
+
// const value = tinycolor(hsv.value!).toString(format.value as 'rgb');
|
|
41
39
|
// // console.log()
|
|
42
40
|
// // const tinyValue = tinycolor(value);
|
|
43
41
|
// // console.log(hsv, value, tinycolor(hsv).toHsv(), getFormat(), tinyValue.toHsv());
|
|
44
42
|
// instance.set({value});
|
|
45
43
|
}
|
|
46
|
-
|
|
47
44
|
return {
|
|
48
45
|
start: start,
|
|
49
46
|
areaRef: areaRef
|
|
@@ -19,30 +19,25 @@ export function useValue() {
|
|
|
19
19
|
var color = tinycolor(hsv);
|
|
20
20
|
rgb.set(color.toRgb());
|
|
21
21
|
hex.set(color.toHex());
|
|
22
|
-
hsl.set(color.toHsl());
|
|
23
|
-
|
|
22
|
+
hsl.set(color.toHsl());
|
|
23
|
+
// if alpha less than 1, use rgba format
|
|
24
24
|
var _format = hsv.a < 1 ? 'rgb' : format.value;
|
|
25
|
-
|
|
26
25
|
instance.set('value', color.toString(_format));
|
|
27
26
|
});
|
|
28
|
-
|
|
29
27
|
function changeHue(v) {
|
|
30
28
|
hsv.set(_extends({}, hsv.value, {
|
|
31
29
|
h: v
|
|
32
30
|
}));
|
|
33
31
|
}
|
|
34
|
-
|
|
35
32
|
function changeAlpha(v) {
|
|
36
33
|
format.set('rgb');
|
|
37
34
|
hsv.set(_extends({}, hsv.value, {
|
|
38
35
|
a: v
|
|
39
36
|
}));
|
|
40
37
|
}
|
|
41
|
-
|
|
42
38
|
function setValue(v) {
|
|
43
39
|
hsv.set(tinycolor(v).toHsv());
|
|
44
40
|
}
|
|
45
|
-
|
|
46
41
|
return {
|
|
47
42
|
format: format,
|
|
48
43
|
hex: hex,
|
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import { createContext } from '../context';
|
|
2
2
|
import { EMPTY_OBJ, Component } from 'intact-react';
|
|
3
|
-
|
|
4
3
|
var _createContext = createContext(EMPTY_OBJ),
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Provider = _createContext.Provider,
|
|
5
|
+
ConfigConsumer = _createContext.Consumer,
|
|
6
|
+
useContext = _createContext.useContext;
|
|
9
7
|
function useConfigContext() {
|
|
10
8
|
var config = useContext();
|
|
11
9
|
return {
|
|
12
10
|
cls: function cls(name) {
|
|
13
11
|
return (config.value.classNamePrefix || 'k') + "-" + name;
|
|
14
12
|
},
|
|
15
|
-
|
|
16
13
|
get k() {
|
|
17
14
|
return config.value.classNamePrefix || 'k';
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
};
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
export var ConfigProvider = Provider;
|
|
24
19
|
export { ConfigConsumer, useConfigContext };
|
|
@@ -12,59 +12,46 @@ describe('Config', function () {
|
|
|
12
12
|
// });
|
|
13
13
|
it('should change classname prefix', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
14
14
|
var Demo, _mount, instance, element;
|
|
15
|
-
|
|
16
15
|
return _regeneratorRuntime.wrap(function _callee$(_context2) {
|
|
17
|
-
while (1) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
Demo
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var _this;
|
|
27
|
-
|
|
28
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
|
-
args[_key] = arguments[_key];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
33
|
-
_this.ConfigProvider = ConfigProvider;
|
|
34
|
-
_this.ButtonGroup = ButtonGroup;
|
|
35
|
-
_this.Button = Button;
|
|
36
|
-
return _this;
|
|
16
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
17
|
+
case 0:
|
|
18
|
+
Demo = /*#__PURE__*/function (_Component) {
|
|
19
|
+
_inheritsLoose(Demo, _Component);
|
|
20
|
+
function Demo() {
|
|
21
|
+
var _context;
|
|
22
|
+
var _this;
|
|
23
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
24
|
+
args[_key] = arguments[_key];
|
|
37
25
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
26
|
+
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
27
|
+
_this.ConfigProvider = ConfigProvider;
|
|
28
|
+
_this.ButtonGroup = ButtonGroup;
|
|
29
|
+
_this.Button = Button;
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
Demo.defaults = function defaults() {
|
|
33
|
+
return {
|
|
34
|
+
k: null
|
|
43
35
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
case 12:
|
|
65
|
-
case "end":
|
|
66
|
-
return _context2.stop();
|
|
67
|
-
}
|
|
36
|
+
};
|
|
37
|
+
return Demo;
|
|
38
|
+
}(Component);
|
|
39
|
+
Demo.template = "\n const { ConfigProvider, ButtonGroup, Button } = this;\n <div>\n <ConfigProvider value={{classNamePrefix: this.get('k')}}>\n <ButtonGroup>\n <Button ev-click={() => this.set('k', 'a')}>change to a</Button>\n <Button type=\"primary\" ev-click={() => this.set('k', 'b')}>change to b</Button>\n </ButtonGroup>\n </ConfigProvider>\n <Button>should not change</Button>\n </div>\n ";
|
|
40
|
+
_mount = mount(Demo), instance = _mount[0], element = _mount[1];
|
|
41
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
42
|
+
instance.set('k', 'a');
|
|
43
|
+
_context2.next = 7;
|
|
44
|
+
return wait();
|
|
45
|
+
case 7:
|
|
46
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
47
|
+
instance.set('k', 'b');
|
|
48
|
+
_context2.next = 11;
|
|
49
|
+
return wait();
|
|
50
|
+
case 11:
|
|
51
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
52
|
+
case 12:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context2.stop();
|
|
68
55
|
}
|
|
69
56
|
}, _callee);
|
|
70
57
|
})));
|
package/components/context.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export interface ProviderProps<T> {
|
|
|
5
5
|
export interface ConsumerProps<T> {
|
|
6
6
|
defaultValue?: T;
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
type ProviderConstructor<T> = ComponentConstructor<Component<ProviderProps<T>>>;
|
|
9
|
+
type ConsumerConstructor<T> = ComponentConstructor<Component<ConsumerProps<T>>>;
|
|
10
10
|
export declare function createContext<T = any>(defaultValue?: T): {
|
|
11
11
|
Provider: ProviderConstructor<T>;
|
|
12
12
|
Consumer: ConsumerConstructor<T>;
|
package/components/context.js
CHANGED
|
@@ -5,26 +5,19 @@ import { isNullOrUndefined } from 'intact-shared';
|
|
|
5
5
|
var id = 0;
|
|
6
6
|
export function createContext(defaultValue) {
|
|
7
7
|
var injectionKey = "$Context-" + id++;
|
|
8
|
-
|
|
9
8
|
var Provider = /*#__PURE__*/function (_Component) {
|
|
10
9
|
_inheritsLoose(Provider, _Component);
|
|
11
|
-
|
|
12
10
|
function Provider() {
|
|
13
11
|
var _context;
|
|
14
|
-
|
|
15
12
|
var _this;
|
|
16
|
-
|
|
17
13
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
14
|
args[_key] = arguments[_key];
|
|
19
15
|
}
|
|
20
|
-
|
|
21
16
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
22
17
|
_this.ref = createRef();
|
|
23
18
|
return _this;
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
var _proto = Provider.prototype;
|
|
27
|
-
|
|
28
21
|
_proto.init = function init(props) {
|
|
29
22
|
var value = props && props.value;
|
|
30
23
|
var ref = this.ref;
|
|
@@ -34,55 +27,43 @@ export function createContext(defaultValue) {
|
|
|
34
27
|
return ref.value = v;
|
|
35
28
|
});
|
|
36
29
|
};
|
|
37
|
-
|
|
38
30
|
return Provider;
|
|
39
31
|
}(Component);
|
|
40
|
-
|
|
41
32
|
Provider.template = providerTemplate;
|
|
42
|
-
|
|
43
33
|
var Consumer = /*#__PURE__*/function (_Component2) {
|
|
44
34
|
_inheritsLoose(Consumer, _Component2);
|
|
45
|
-
|
|
46
35
|
function Consumer() {
|
|
47
36
|
var _context2;
|
|
48
|
-
|
|
49
37
|
var _this2;
|
|
50
|
-
|
|
51
38
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
52
39
|
args[_key2] = arguments[_key2];
|
|
53
40
|
}
|
|
54
|
-
|
|
55
41
|
_this2 = _Component2.call.apply(_Component2, _concatInstanceProperty(_context2 = [this]).call(_context2, args)) || this;
|
|
56
42
|
_this2.ref = inject(injectionKey, createRef(defaultValue));
|
|
57
43
|
return _this2;
|
|
58
44
|
}
|
|
59
|
-
|
|
60
45
|
return Consumer;
|
|
61
46
|
}(Component);
|
|
62
|
-
|
|
63
47
|
Consumer.template = consumerTemplate;
|
|
64
|
-
|
|
65
48
|
function useContext() {
|
|
66
49
|
return inject(injectionKey, createRef(defaultValue));
|
|
67
50
|
}
|
|
68
|
-
|
|
69
51
|
return {
|
|
70
52
|
Provider: Provider,
|
|
71
53
|
Consumer: Consumer,
|
|
72
54
|
useContext: useContext
|
|
73
55
|
};
|
|
74
56
|
}
|
|
75
|
-
|
|
76
57
|
function providerTemplate() {
|
|
77
58
|
return this.$props.children;
|
|
78
59
|
}
|
|
79
|
-
|
|
80
60
|
function consumerTemplate() {
|
|
81
61
|
var ref = this.ref;
|
|
82
62
|
var props = this.$props;
|
|
83
63
|
var value = ref && ref.value || props && props.value;
|
|
84
64
|
return this.$props.children(value);
|
|
85
|
-
}
|
|
65
|
+
}
|
|
66
|
+
// Maybe like legency context api of React
|
|
86
67
|
// Error: Can not use it in multiple instances.
|
|
87
68
|
// export function Context<T = any>(defaultValue?: T) {
|
|
88
69
|
// let data: T | undefined;
|
package/components/copy/index.js
CHANGED
|
@@ -8,13 +8,11 @@ var typeDefs = {
|
|
|
8
8
|
text: String,
|
|
9
9
|
showMessage: Boolean
|
|
10
10
|
};
|
|
11
|
-
|
|
12
11
|
var defaults = function defaults() {
|
|
13
12
|
return {
|
|
14
13
|
showMessage: true
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
|
|
18
16
|
var events = {
|
|
19
17
|
success: true,
|
|
20
18
|
error: true,
|
|
@@ -22,22 +20,17 @@ var events = {
|
|
|
22
20
|
};
|
|
23
21
|
export var Copy = /*#__PURE__*/function (_Component) {
|
|
24
22
|
_inheritsLoose(Copy, _Component);
|
|
25
|
-
|
|
26
23
|
function Copy() {
|
|
27
24
|
var _context;
|
|
28
|
-
|
|
29
25
|
var _this;
|
|
30
|
-
|
|
31
26
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
27
|
args[_key] = arguments[_key];
|
|
33
28
|
}
|
|
34
|
-
|
|
35
29
|
_this = _Component.call.apply(_Component, _concatInstanceProperty(_context = [this]).call(_context, args)) || this;
|
|
36
30
|
_this.copy = useCopy();
|
|
37
31
|
_this.config = useConfigContext();
|
|
38
32
|
return _this;
|
|
39
33
|
}
|
|
40
|
-
|
|
41
34
|
return Copy;
|
|
42
35
|
}(Component);
|
|
43
36
|
Copy.template = template;
|