@king-design/react 2.0.0-beta.0
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/README.md +22 -0
- package/__tests__/__snapshots__/React Demos.md +1769 -0
- package/__tests__/components/dropdown.spec.tsx +35 -0
- package/__tests__/index.ts +46 -0
- package/__tests__/karma.conf.js +52 -0
- package/__tests__/webpack.config.js +17 -0
- package/components/affix/index.d.ts +32 -0
- package/components/affix/index.js +35 -0
- package/components/affix/index.spec.d.ts +4 -0
- package/components/affix/index.spec.js +132 -0
- package/components/affix/index.vdt.js +35 -0
- package/components/affix/styles.d.ts +5 -0
- package/components/affix/styles.js +18 -0
- package/components/affix/useStyle.d.ts +8 -0
- package/components/affix/useStyle.js +125 -0
- package/components/badge/index.d.ts +13 -0
- package/components/badge/index.js +21 -0
- package/components/badge/index.vdt.js +32 -0
- package/components/badge/styles.d.ts +5 -0
- package/components/badge/styles.js +28 -0
- package/components/breadcrumb/index.d.ts +18 -0
- package/components/breadcrumb/index.js +28 -0
- package/components/breadcrumb/index.spec.d.ts +4 -0
- package/components/breadcrumb/index.spec.js +46 -0
- package/components/breadcrumb/index.vdt.js +62 -0
- package/components/breadcrumb/item.d.ts +13 -0
- package/components/breadcrumb/item.js +52 -0
- package/components/breadcrumb/item.vdt.js +27 -0
- package/components/breadcrumb/styles.d.ts +5 -0
- package/components/breadcrumb/styles.js +30 -0
- package/components/button/constants.d.ts +4 -0
- package/components/button/constants.js +3 -0
- package/components/button/dynamicButton.d.ts +11 -0
- package/components/button/dynamicButton.js +24 -0
- package/components/button/group.d.ts +17 -0
- package/components/button/group.js +51 -0
- package/components/button/group.vdt.js +29 -0
- package/components/button/index.d.ts +51 -0
- package/components/button/index.js +121 -0
- package/components/button/index.spec.d.ts +4 -0
- package/components/button/index.spec.js +129 -0
- package/components/button/index.vdt.js +95 -0
- package/components/button/styles.d.ts +11 -0
- package/components/button/styles.js +257 -0
- package/components/card/column.d.ts +12 -0
- package/components/card/column.js +20 -0
- package/components/card/column.vdt.js +38 -0
- package/components/card/index.d.ts +21 -0
- package/components/card/index.js +29 -0
- package/components/card/index.vdt.js +79 -0
- package/components/card/styles.d.ts +5 -0
- package/components/card/styles.js +23 -0
- package/components/carousel/index.d.ts +26 -0
- package/components/carousel/index.js +106 -0
- package/components/carousel/index.spec.d.ts +4 -0
- package/components/carousel/index.spec.js +200 -0
- package/components/carousel/index.vdt.js +79 -0
- package/components/carousel/item.d.ts +12 -0
- package/components/carousel/item.js +20 -0
- package/components/carousel/item.vdt.js +35 -0
- package/components/carousel/styles.d.ts +6 -0
- package/components/carousel/styles.js +46 -0
- package/components/carousel/useAutoplay.d.ts +7 -0
- package/components/carousel/useAutoplay.js +37 -0
- package/components/carousel/useItems.d.ts +9 -0
- package/components/carousel/useItems.js +93 -0
- package/components/carousel/useSlide.d.ts +12 -0
- package/components/carousel/useSlide.js +191 -0
- package/components/cascader/index.d.ts +37 -0
- package/components/cascader/index.js +93 -0
- package/components/cascader/index.spec.d.ts +4 -0
- package/components/cascader/index.spec.js +283 -0
- package/components/cascader/index.vdt.js +151 -0
- package/components/cascader/styles.d.ts +6 -0
- package/components/cascader/styles.js +52 -0
- package/components/cascader/useFilterable.d.ts +11 -0
- package/components/cascader/useFilterable.js +65 -0
- package/components/cascader/useLabel.d.ts +6 -0
- package/components/cascader/useLabel.js +43 -0
- package/components/cascader/useLoad.d.ts +5 -0
- package/components/cascader/useLoad.js +54 -0
- package/components/cascader/useValue.d.ts +14 -0
- package/components/cascader/useValue.js +125 -0
- package/components/checkbox/index.d.ts +27 -0
- package/components/checkbox/index.js +122 -0
- package/components/checkbox/index.spec.d.ts +4 -0
- package/components/checkbox/index.spec.js +217 -0
- package/components/checkbox/index.vdt.js +67 -0
- package/components/checkbox/styles.d.ts +5 -0
- package/components/checkbox/styles.js +77 -0
- package/components/code/crossDomain.d.ts +4 -0
- package/components/code/crossDomain.js +48 -0
- package/components/code/index.d.ts +26 -0
- package/components/code/index.js +58 -0
- package/components/code/index.spec.d.ts +4 -0
- package/components/code/index.spec.js +73 -0
- package/components/code/index.vdt.js +54 -0
- package/components/code/styles.d.ts +5 -0
- package/components/code/styles.js +16 -0
- package/components/code/useEditor.d.ts +9 -0
- package/components/code/useEditor.js +81 -0
- package/components/collapse/index.d.ts +23 -0
- package/components/collapse/index.js +57 -0
- package/components/collapse/index.spec.d.ts +4 -0
- package/components/collapse/index.spec.js +84 -0
- package/components/collapse/index.vdt.js +47 -0
- package/components/collapse/item.d.ts +24 -0
- package/components/collapse/item.js +52 -0
- package/components/collapse/item.vdt.js +64 -0
- package/components/collapse/styles.d.ts +7 -0
- package/components/collapse/styles.js +33 -0
- package/components/colorpicker/drag.d.ts +18 -0
- package/components/colorpicker/drag.js +27 -0
- package/components/colorpicker/drag.vdt.js +12 -0
- package/components/colorpicker/index.d.ts +18 -0
- package/components/colorpicker/index.js +35 -0
- package/components/colorpicker/index.spec.d.ts +4 -0
- package/components/colorpicker/index.spec.js +312 -0
- package/components/colorpicker/index.vdt.js +54 -0
- package/components/colorpicker/panel.d.ts +14 -0
- package/components/colorpicker/panel.js +31 -0
- package/components/colorpicker/panel.vdt.js +166 -0
- package/components/colorpicker/styles.d.ts +8 -0
- package/components/colorpicker/styles.js +135 -0
- package/components/colorpicker/useDrag.d.ts +6 -0
- package/components/colorpicker/useDrag.js +42 -0
- package/components/colorpicker/useInput.d.ts +19 -0
- package/components/colorpicker/useInput.js +78 -0
- package/components/colorpicker/usePointer.d.ts +9 -0
- package/components/colorpicker/usePointer.js +53 -0
- package/components/colorpicker/useValue.d.ts +14 -0
- package/components/colorpicker/useValue.js +58 -0
- package/components/context.d.ts +14 -0
- package/components/context.js +90 -0
- package/components/datepicker/basepicker.d.ts +62 -0
- package/components/datepicker/basepicker.js +341 -0
- package/components/datepicker/calendar.d.ts +81 -0
- package/components/datepicker/calendar.js +66 -0
- package/components/datepicker/calendar.vdt.js +128 -0
- package/components/datepicker/constants.d.ts +16 -0
- package/components/datepicker/constants.js +20 -0
- package/components/datepicker/dayjs.d.ts +6 -0
- package/components/datepicker/dayjs.js +6 -0
- package/components/datepicker/helpers.d.ts +13 -0
- package/components/datepicker/helpers.js +86 -0
- package/components/datepicker/index.d.ts +66 -0
- package/components/datepicker/index.js +123 -0
- package/components/datepicker/index.spec.d.ts +4 -0
- package/components/datepicker/index.spec.js +1703 -0
- package/components/datepicker/index.vdt.js +142 -0
- package/components/datepicker/shortcuts.d.ts +24 -0
- package/components/datepicker/shortcuts.js +140 -0
- package/components/datepicker/styles.d.ts +9 -0
- package/components/datepicker/styles.js +89 -0
- package/components/datepicker/time.d.ts +33 -0
- package/components/datepicker/time.js +107 -0
- package/components/datepicker/time.vdt.js +48 -0
- package/components/datepicker/useDays.d.ts +19 -0
- package/components/datepicker/useDays.js +47 -0
- package/components/datepicker/useDisabled.d.ts +14 -0
- package/components/datepicker/useDisabled.js +97 -0
- package/components/datepicker/useFocusDate.d.ts +8 -0
- package/components/datepicker/useFocusDate.js +18 -0
- package/components/datepicker/useFormats.d.ts +13 -0
- package/components/datepicker/useFormats.js +57 -0
- package/components/datepicker/useKeyboards.d.ts +8 -0
- package/components/datepicker/useKeyboards.js +98 -0
- package/components/datepicker/useMonths.d.ts +18 -0
- package/components/datepicker/useMonths.js +47 -0
- package/components/datepicker/usePanel.d.ts +21 -0
- package/components/datepicker/usePanel.js +57 -0
- package/components/datepicker/useShowDate.d.ts +19 -0
- package/components/datepicker/useShowDate.js +160 -0
- package/components/datepicker/useStatus.d.ts +11 -0
- package/components/datepicker/useStatus.js +62 -0
- package/components/datepicker/useValue.d.ts +19 -0
- package/components/datepicker/useValue.js +84 -0
- package/components/datepicker/useYears.d.ts +21 -0
- package/components/datepicker/useYears.js +72 -0
- package/components/diagram/constants.d.ts +6 -0
- package/components/diagram/constants.js +5 -0
- package/components/diagram/defaultStyle.d.ts +117 -0
- package/components/diagram/defaultStyle.js +116 -0
- package/components/diagram/diagram.d.ts +43 -0
- package/components/diagram/diagram.js +176 -0
- package/components/diagram/diagram.vdt.js +25 -0
- package/components/diagram/graph.d.ts +5 -0
- package/components/diagram/graph.js +30 -0
- package/components/diagram/index.d.ts +25 -0
- package/components/diagram/index.js +30 -0
- package/components/diagram/index.spec.d.ts +4 -0
- package/components/diagram/index.spec.js +631 -0
- package/components/diagram/layouts/circle.d.ts +19 -0
- package/components/diagram/layouts/circle.js +56 -0
- package/components/diagram/layouts/flow.d.ts +19 -0
- package/components/diagram/layouts/flow.js +69 -0
- package/components/diagram/layouts/layout.d.ts +28 -0
- package/components/diagram/layouts/layout.js +113 -0
- package/components/diagram/layouts/organic.d.ts +18 -0
- package/components/diagram/layouts/organic.js +51 -0
- package/components/diagram/layouts/partition.d.ts +17 -0
- package/components/diagram/layouts/partition.js +55 -0
- package/components/diagram/layouts/radial.d.ts +21 -0
- package/components/diagram/layouts/radial.js +72 -0
- package/components/diagram/layouts/stack.d.ts +19 -0
- package/components/diagram/layouts/stack.js +66 -0
- package/components/diagram/layouts/tree.d.ts +22 -0
- package/components/diagram/layouts/tree.js +77 -0
- package/components/diagram/mxgraph/handler/mxConnectionHandler.d.ts +4 -0
- package/components/diagram/mxgraph/handler/mxConnectionHandler.js +53 -0
- package/components/diagram/mxgraph/handler/mxConstraintHandler.d.ts +5 -0
- package/components/diagram/mxgraph/handler/mxConstraintHandler.js +16 -0
- package/components/diagram/mxgraph/handler/mxEdgeHandler.d.ts +5 -0
- package/components/diagram/mxgraph/handler/mxEdgeHandler.js +45 -0
- package/components/diagram/mxgraph/handler/mxGraphHandler.d.ts +4 -0
- package/components/diagram/mxgraph/handler/mxGraphHandler.js +25 -0
- package/components/diagram/mxgraph/handler/mxRubberband.d.ts +4 -0
- package/components/diagram/mxgraph/handler/mxRubberband.js +10 -0
- package/components/diagram/mxgraph/handler/mxVertexHandler.d.ts +7 -0
- package/components/diagram/mxgraph/handler/mxVertexHandler.js +32 -0
- package/components/diagram/mxgraph/index.d.ts +5 -0
- package/components/diagram/mxgraph/index.js +49 -0
- package/components/diagram/mxgraph/mx.d.ts +6 -0
- package/components/diagram/mxgraph/mx.js +16 -0
- package/components/diagram/mxgraph/shape/mxCloud.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxCloud.js +9 -0
- package/components/diagram/mxgraph/shape/mxCylinder.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxCylinder.js +32 -0
- package/components/diagram/mxgraph/shape/mxEllipse.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxEllipse.js +9 -0
- package/components/diagram/mxgraph/shape/mxHexagon.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxHexagon.js +9 -0
- package/components/diagram/mxgraph/shape/mxLine.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxLine.js +9 -0
- package/components/diagram/mxgraph/shape/mxRectangleShape.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxRectangleShape.js +9 -0
- package/components/diagram/mxgraph/shape/mxRhombus.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxRhombus.js +41 -0
- package/components/diagram/mxgraph/shape/mxShape.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxShape.js +10 -0
- package/components/diagram/mxgraph/shape/mxTriangle.d.ts +4 -0
- package/components/diagram/mxgraph/shape/mxTriangle.js +9 -0
- package/components/diagram/mxgraph/util/mxConstants.d.ts +4 -0
- package/components/diagram/mxgraph/util/mxConstants.js +21 -0
- package/components/diagram/mxgraph/util/mxGuide.d.ts +4 -0
- package/components/diagram/mxgraph/util/mxGuide.js +22 -0
- package/components/diagram/mxgraph/view/mxCellEditor.d.ts +4 -0
- package/components/diagram/mxgraph/view/mxCellEditor.js +96 -0
- package/components/diagram/mxgraph/view/mxCellRenderer.d.ts +4 -0
- package/components/diagram/mxgraph/view/mxCellRenderer.js +15 -0
- package/components/diagram/mxgraph/view/mxGraph.d.ts +4 -0
- package/components/diagram/mxgraph/view/mxGraph.js +141 -0
- package/components/diagram/shapes/base.d.ts +45 -0
- package/components/diagram/shapes/base.js +156 -0
- package/components/diagram/shapes/callout.d.ts +24 -0
- package/components/diagram/shapes/callout.js +80 -0
- package/components/diagram/shapes/circle.d.ts +25 -0
- package/components/diagram/shapes/circle.js +38 -0
- package/components/diagram/shapes/document.d.ts +24 -0
- package/components/diagram/shapes/document.js +71 -0
- package/components/diagram/shapes/ellipse.d.ts +24 -0
- package/components/diagram/shapes/ellipse.js +30 -0
- package/components/diagram/shapes/generateShapes.d.ts +32 -0
- package/components/diagram/shapes/generateShapes.js +62 -0
- package/components/diagram/shapes/hexagon.d.ts +24 -0
- package/components/diagram/shapes/hexagon.js +101 -0
- package/components/diagram/shapes/image.d.ts +30 -0
- package/components/diagram/shapes/image.js +38 -0
- package/components/diagram/shapes/line.d.ts +46 -0
- package/components/diagram/shapes/line.js +193 -0
- package/components/diagram/shapes/parallelogram.d.ts +24 -0
- package/components/diagram/shapes/parallelogram.js +103 -0
- package/components/diagram/shapes/rectangle.d.ts +30 -0
- package/components/diagram/shapes/rectangle.js +38 -0
- package/components/diagram/shapes/shape.d.ts +35 -0
- package/components/diagram/shapes/shape.js +153 -0
- package/components/diagram/shapes/square.d.ts +26 -0
- package/components/diagram/shapes/square.js +40 -0
- package/components/diagram/shapes/text.d.ts +24 -0
- package/components/diagram/shapes/text.js +28 -0
- package/components/diagram/styles.d.ts +5 -0
- package/components/diagram/styles.js +16 -0
- package/components/dialog/alert.vdt.js +71 -0
- package/components/dialog/base.d.ts +70 -0
- package/components/dialog/base.js +167 -0
- package/components/dialog/base.vdt.js +146 -0
- package/components/dialog/constants.d.ts +6 -0
- package/components/dialog/constants.js +5 -0
- package/components/dialog/index.d.ts +24 -0
- package/components/dialog/index.js +104 -0
- package/components/dialog/index.spec.d.ts +4 -0
- package/components/dialog/index.spec.js +654 -0
- package/components/dialog/staticMethods.d.ts +13 -0
- package/components/dialog/staticMethods.js +66 -0
- package/components/dialog/styles.d.ts +7 -0
- package/components/dialog/styles.js +100 -0
- package/components/dialog/useDraggable.d.ts +8 -0
- package/components/dialog/useDraggable.js +56 -0
- package/components/dialog/useEscClosable.d.ts +4 -0
- package/components/dialog/useEscClosable.js +46 -0
- package/components/dialog/useFixBody.d.ts +5 -0
- package/components/dialog/useFixBody.js +71 -0
- package/components/dialog/usePosition.d.ts +5 -0
- package/components/dialog/usePosition.js +42 -0
- package/components/drawer/index.d.ts +14 -0
- package/components/drawer/index.js +30 -0
- package/components/drawer/index.spec.d.ts +4 -0
- package/components/drawer/index.spec.js +164 -0
- package/components/drawer/index.vdt.js +38 -0
- package/components/drawer/styles.d.ts +9 -0
- package/components/drawer/styles.js +45 -0
- package/components/dropdown/dropdown.d.ts +60 -0
- package/components/dropdown/dropdown.js +314 -0
- package/components/dropdown/index.d.ts +12 -0
- package/components/dropdown/index.js +39 -0
- package/components/dropdown/index.spec.d.ts +4 -0
- package/components/dropdown/index.spec.js +488 -0
- package/components/dropdown/item.d.ts +29 -0
- package/components/dropdown/item.js +117 -0
- package/components/dropdown/item.vdt.js +32 -0
- package/components/dropdown/menu.d.ts +24 -0
- package/components/dropdown/menu.js +108 -0
- package/components/dropdown/menu.vdt.js +53 -0
- package/components/dropdown/styles.d.ts +6 -0
- package/components/dropdown/styles.js +58 -0
- package/components/dropdown/useKeyboard.d.ts +26 -0
- package/components/dropdown/useKeyboard.js +195 -0
- package/components/dropdown/usePosition.d.ts +11 -0
- package/components/dropdown/usePosition.js +115 -0
- package/components/dropdown/useTransition.d.ts +11 -0
- package/components/dropdown/useTransition.js +80 -0
- package/components/editable/index.d.ts +32 -0
- package/components/editable/index.js +133 -0
- package/components/editable/index.spec.d.ts +4 -0
- package/components/editable/index.spec.js +225 -0
- package/components/editable/index.vdt.js +47 -0
- package/components/editable/styles.d.ts +7 -0
- package/components/editable/styles.js +27 -0
- package/components/form/form.d.ts +41 -0
- package/components/form/form.js +103 -0
- package/components/form/form.vdt.js +29 -0
- package/components/form/index.d.ts +5 -0
- package/components/form/index.js +4 -0
- package/components/form/index.spec.d.ts +4 -0
- package/components/form/index.spec.js +1322 -0
- package/components/form/item.d.ts +40 -0
- package/components/form/item.js +76 -0
- package/components/form/item.vdt.js +130 -0
- package/components/form/methods.d.ts +10 -0
- package/components/form/methods.js +175 -0
- package/components/form/styles.d.ts +6 -0
- package/components/form/styles.js +63 -0
- package/components/form/useDirty.d.ts +9 -0
- package/components/form/useDirty.js +41 -0
- package/components/form/useError.d.ts +11 -0
- package/components/form/useError.js +59 -0
- package/components/form/useValidate.d.ts +14 -0
- package/components/form/useValidate.js +118 -0
- package/components/grid/col.d.ts +20 -0
- package/components/grid/col.js +43 -0
- package/components/grid/col.vdt.js +42 -0
- package/components/grid/constants.d.ts +19 -0
- package/components/grid/constants.js +14 -0
- package/components/grid/index.d.ts +5 -0
- package/components/grid/index.js +4 -0
- package/components/grid/row.d.ts +15 -0
- package/components/grid/row.js +34 -0
- package/components/grid/row.vdt.js +36 -0
- package/components/grid/styles.d.ts +6 -0
- package/components/grid/styles.js +56 -0
- package/components/grid/useBreakpoints.d.ts +6 -0
- package/components/grid/useBreakpoints.js +51 -0
- package/components/grid/useGutter.d.ts +11 -0
- package/components/grid/useGutter.js +104 -0
- package/components/icon/index.d.ts +18 -0
- package/components/icon/index.js +48 -0
- package/components/icon/index.vdt.js +50 -0
- package/components/icon/styles.d.ts +9 -0
- package/components/icon/styles.js +35 -0
- package/components/input/index.d.ts +58 -0
- package/components/input/index.js +99 -0
- package/components/input/index.spec.d.ts +4 -0
- package/components/input/index.spec.js +129 -0
- package/components/input/index.vdt.js +126 -0
- package/components/input/search.d.ts +29 -0
- package/components/input/search.js +102 -0
- package/components/input/search.vdt.js +52 -0
- package/components/input/styles.d.ts +6 -0
- package/components/input/styles.js +132 -0
- package/components/input/useAutoWidth.d.ts +7 -0
- package/components/input/useAutoWidth.js +31 -0
- package/components/input/useFrozen.d.ts +12 -0
- package/components/input/useFrozen.js +49 -0
- package/components/layout/aside.d.ts +18 -0
- package/components/layout/aside.js +68 -0
- package/components/layout/aside.vdt.js +44 -0
- package/components/layout/body.d.ts +10 -0
- package/components/layout/body.js +57 -0
- package/components/layout/footer.d.ts +8 -0
- package/components/layout/footer.js +28 -0
- package/components/layout/header.d.ts +19 -0
- package/components/layout/header.js +76 -0
- package/components/layout/helpers.d.ts +8 -0
- package/components/layout/helpers.js +10 -0
- package/components/layout/index.d.ts +8 -0
- package/components/layout/index.js +7 -0
- package/components/layout/layout.d.ts +18 -0
- package/components/layout/layout.js +75 -0
- package/components/layout/styles.d.ts +9 -0
- package/components/layout/styles.js +81 -0
- package/components/layout/template.vdt.js +20 -0
- package/components/layout/useParse.d.ts +10 -0
- package/components/layout/useParse.js +65 -0
- package/components/menu/index.d.ts +5 -0
- package/components/menu/index.js +4 -0
- package/components/menu/index.spec.d.ts +4 -0
- package/components/menu/index.spec.js +218 -0
- package/components/menu/item.d.ts +29 -0
- package/components/menu/item.js +88 -0
- package/components/menu/item.vdt.js +103 -0
- package/components/menu/menu.d.ts +29 -0
- package/components/menu/menu.js +61 -0
- package/components/menu/menu.vdt.js +57 -0
- package/components/menu/styles.d.ts +9 -0
- package/components/menu/styles.js +138 -0
- package/components/menu/useDropdown.d.ts +19 -0
- package/components/menu/useDropdown.js +83 -0
- package/components/menu/useExpanded.d.ts +13 -0
- package/components/menu/useExpanded.js +80 -0
- package/components/menu/useHighlight.d.ts +13 -0
- package/components/menu/useHighlight.js +60 -0
- package/components/message/index.d.ts +4 -0
- package/components/message/index.js +3 -0
- package/components/message/index.spec.d.ts +4 -0
- package/components/message/index.spec.js +97 -0
- package/components/message/message.d.ts +23 -0
- package/components/message/message.js +112 -0
- package/components/message/message.vdt.js +54 -0
- package/components/message/messages.d.ts +11 -0
- package/components/message/messages.js +51 -0
- package/components/message/messages.vdt.js +20 -0
- package/components/message/styles.d.ts +6 -0
- package/components/message/styles.js +62 -0
- package/components/pagination/index.d.ts +40 -0
- package/components/pagination/index.js +167 -0
- package/components/pagination/index.spec.d.ts +4 -0
- package/components/pagination/index.spec.js +146 -0
- package/components/pagination/index.vdt.js +173 -0
- package/components/pagination/styles.d.ts +5 -0
- package/components/pagination/styles.js +65 -0
- package/components/portal.d.ts +23 -0
- package/components/portal.js +148 -0
- package/components/position.d.ts +77 -0
- package/components/position.js +489 -0
- package/components/progress/index.d.ts +31 -0
- package/components/progress/index.js +72 -0
- package/components/progress/index.spec.d.ts +4 -0
- package/components/progress/index.spec.js +235 -0
- package/components/progress/index.vdt.js +82 -0
- package/components/progress/styles.d.ts +6 -0
- package/components/progress/styles.js +88 -0
- package/components/progress/useColor.d.ts +7 -0
- package/components/progress/useColor.js +36 -0
- package/components/progress/useStatus.d.ts +4 -0
- package/components/progress/useStatus.js +24 -0
- package/components/radio/index.d.ts +24 -0
- package/components/radio/index.js +84 -0
- package/components/radio/index.spec.d.ts +4 -0
- package/components/radio/index.spec.js +192 -0
- package/components/radio/index.vdt.js +66 -0
- package/components/radio/styles.d.ts +5 -0
- package/components/radio/styles.js +49 -0
- package/components/rate/index.d.ts +25 -0
- package/components/rate/index.js +48 -0
- package/components/rate/index.spec.d.ts +4 -0
- package/components/rate/index.spec.js +112 -0
- package/components/rate/index.vdt.js +76 -0
- package/components/rate/styles.d.ts +5 -0
- package/components/rate/styles.js +28 -0
- package/components/rate/useActiveValue.d.ts +9 -0
- package/components/rate/useActiveValue.js +42 -0
- package/components/scrollSelect/index.d.ts +30 -0
- package/components/scrollSelect/index.js +48 -0
- package/components/scrollSelect/index.spec.d.ts +4 -0
- package/components/scrollSelect/index.spec.js +174 -0
- package/components/scrollSelect/index.vdt.js +59 -0
- package/components/scrollSelect/styles.d.ts +7 -0
- package/components/scrollSelect/styles.js +38 -0
- package/components/scrollSelect/useList.d.ts +9 -0
- package/components/scrollSelect/useList.js +82 -0
- package/components/scrollSelect/useMouseEvents.d.ts +12 -0
- package/components/scrollSelect/useMouseEvents.js +112 -0
- package/components/scrollSelect/useTranslate.d.ts +12 -0
- package/components/scrollSelect/useTranslate.js +78 -0
- package/components/select/base.d.ts +63 -0
- package/components/select/base.js +156 -0
- package/components/select/base.vdt.js +194 -0
- package/components/select/constants.d.ts +5 -0
- package/components/select/constants.js +4 -0
- package/components/select/group.d.ts +17 -0
- package/components/select/group.js +31 -0
- package/components/select/group.vdt.js +41 -0
- package/components/select/index.d.ts +6 -0
- package/components/select/index.js +5 -0
- package/components/select/index.spec.d.ts +4 -0
- package/components/select/index.spec.js +680 -0
- package/components/select/menu.d.ts +13 -0
- package/components/select/menu.js +31 -0
- package/components/select/menu.vdt.js +138 -0
- package/components/select/option.d.ts +16 -0
- package/components/select/option.js +74 -0
- package/components/select/option.vdt.js +65 -0
- package/components/select/select.d.ts +36 -0
- package/components/select/select.js +93 -0
- package/components/select/select.vdt.js +62 -0
- package/components/select/styles.d.ts +7 -0
- package/components/select/styles.js +201 -0
- package/components/select/useBaseLabel.d.ts +12 -0
- package/components/select/useBaseLabel.js +80 -0
- package/components/select/useCard.d.ts +11 -0
- package/components/select/useCard.js +41 -0
- package/components/select/useEqualWidth.d.ts +4 -0
- package/components/select/useEqualWidth.js +16 -0
- package/components/select/useFilterable.d.ts +10 -0
- package/components/select/useFilterable.js +120 -0
- package/components/select/useFocusout.d.ts +12 -0
- package/components/select/useFocusout.js +49 -0
- package/components/select/useInput.d.ts +10 -0
- package/components/select/useInput.js +53 -0
- package/components/select/useLabel.d.ts +8 -0
- package/components/select/useLabel.js +59 -0
- package/components/select/useSearchable.d.ts +14 -0
- package/components/select/useSearchable.js +71 -0
- package/components/slider/index.d.ts +50 -0
- package/components/slider/index.js +86 -0
- package/components/slider/index.spec.d.ts +4 -0
- package/components/slider/index.spec.js +737 -0
- package/components/slider/index.vdt.js +154 -0
- package/components/slider/styles.d.ts +5 -0
- package/components/slider/styles.js +79 -0
- package/components/slider/useClick.d.ts +9 -0
- package/components/slider/useClick.js +46 -0
- package/components/slider/useDraggable.d.ts +16 -0
- package/components/slider/useDraggable.js +107 -0
- package/components/slider/useKeyboard.d.ts +10 -0
- package/components/slider/useKeyboard.js +59 -0
- package/components/slider/useMarks.d.ts +18 -0
- package/components/slider/useMarks.js +59 -0
- package/components/slider/usePoints.d.ts +16 -0
- package/components/slider/usePoints.js +85 -0
- package/components/slider/useStyles.d.ts +12 -0
- package/components/slider/useStyles.js +69 -0
- package/components/slider/useTooltip.d.ts +13 -0
- package/components/slider/useTooltip.js +70 -0
- package/components/slider/useValue.d.ts +12 -0
- package/components/slider/useValue.js +100 -0
- package/components/spin/index.d.ts +20 -0
- package/components/spin/index.js +30 -0
- package/components/spin/index.vdt.js +51 -0
- package/components/spin/styles.d.ts +5 -0
- package/components/spin/styles.js +36 -0
- package/components/spinner/index.d.ts +47 -0
- package/components/spinner/index.js +106 -0
- package/components/spinner/index.spec.d.ts +4 -0
- package/components/spinner/index.spec.js +553 -0
- package/components/spinner/index.vdt.js +73 -0
- package/components/spinner/styles.d.ts +5 -0
- package/components/spinner/styles.js +70 -0
- package/components/spinner/useChange.d.ts +11 -0
- package/components/spinner/useChange.js +55 -0
- package/components/spinner/useFormatter.d.ts +7 -0
- package/components/spinner/useFormatter.js +49 -0
- package/components/spinner/useStep.d.ts +16 -0
- package/components/spinner/useStep.js +100 -0
- package/components/spinner/useValue.d.ts +17 -0
- package/components/spinner/useValue.js +91 -0
- package/components/split/index.d.ts +31 -0
- package/components/split/index.js +55 -0
- package/components/split/index.spec.d.ts +4 -0
- package/components/split/index.spec.js +332 -0
- package/components/split/index.vdt.js +69 -0
- package/components/split/style.d.ts +7 -0
- package/components/split/style.js +57 -0
- package/components/split/useDraggable.d.ts +11 -0
- package/components/split/useDraggable.js +151 -0
- package/components/split/useSize.d.ts +7 -0
- package/components/split/useSize.js +35 -0
- package/components/steps/context.d.ts +7 -0
- package/components/steps/context.js +4 -0
- package/components/steps/index.d.ts +17 -0
- package/components/steps/index.js +49 -0
- package/components/steps/index.spec.d.ts +4 -0
- package/components/steps/index.spec.js +44 -0
- package/components/steps/index.vdt.js +52 -0
- package/components/steps/step.d.ts +12 -0
- package/components/steps/step.js +20 -0
- package/components/steps/step.vdt.js +49 -0
- package/components/steps/styles.d.ts +6 -0
- package/components/steps/styles.js +156 -0
- package/components/switch/index.d.ts +41 -0
- package/components/switch/index.js +115 -0
- package/components/switch/index.spec.d.ts +4 -0
- package/components/switch/index.spec.js +267 -0
- package/components/switch/index.vdt.js +135 -0
- package/components/switch/styles.d.ts +5 -0
- package/components/switch/styles.js +87 -0
- package/components/switch/useDraggable.d.ts +10 -0
- package/components/switch/useDraggable.js +75 -0
- package/components/table/cell.d.ts +25 -0
- package/components/table/cell.js +34 -0
- package/components/table/cell.vdt.js +67 -0
- package/components/table/column.d.ts +38 -0
- package/components/table/column.js +50 -0
- package/components/table/column.vdt.js +149 -0
- package/components/table/exportTable.d.ts +6 -0
- package/components/table/exportTable.js +82 -0
- package/components/table/index.d.ts +5 -0
- package/components/table/index.js +4 -0
- package/components/table/index.spec.d.ts +4 -0
- package/components/table/index.spec.js +1044 -0
- package/components/table/row.d.ts +49 -0
- package/components/table/row.js +122 -0
- package/components/table/row.vdt.js +128 -0
- package/components/table/styles.d.ts +6 -0
- package/components/table/styles.js +86 -0
- package/components/table/table.d.ts +97 -0
- package/components/table/table.js +238 -0
- package/components/table/table.vdt.js +332 -0
- package/components/table/useChecked.d.ts +27 -0
- package/components/table/useChecked.js +242 -0
- package/components/table/useColumns.d.ts +19 -0
- package/components/table/useColumns.js +111 -0
- package/components/table/useDisableRow.d.ts +11 -0
- package/components/table/useDisableRow.js +59 -0
- package/components/table/useDraggable.d.ts +11 -0
- package/components/table/useDraggable.js +62 -0
- package/components/table/useExpandable.d.ts +7 -0
- package/components/table/useExpandable.js +26 -0
- package/components/table/useFixedColumns.d.ts +27 -0
- package/components/table/useFixedColumns.js +142 -0
- package/components/table/useGroup.d.ts +17 -0
- package/components/table/useGroup.js +70 -0
- package/components/table/useMerge.d.ts +18 -0
- package/components/table/useMerge.js +79 -0
- package/components/table/useResizable.d.ts +14 -0
- package/components/table/useResizable.js +62 -0
- package/components/table/useRestRowStatus.d.ts +7 -0
- package/components/table/useRestRowStatus.js +47 -0
- package/components/table/useScroll.d.ts +9 -0
- package/components/table/useScroll.js +32 -0
- package/components/table/useSelected.d.ts +7 -0
- package/components/table/useSelected.js +31 -0
- package/components/table/useSortable.d.ts +10 -0
- package/components/table/useSortable.js +36 -0
- package/components/table/useStickyHeader.d.ts +12 -0
- package/components/table/useStickyHeader.js +36 -0
- package/components/table/useStickyScrollbar.d.ts +15 -0
- package/components/table/useStickyScrollbar.js +86 -0
- package/components/table/useTree.d.ts +10 -0
- package/components/table/useTree.js +61 -0
- package/components/table/useWidth.d.ts +13 -0
- package/components/table/useWidth.js +129 -0
- package/components/tabs/constants.d.ts +4 -0
- package/components/tabs/constants.js +3 -0
- package/components/tabs/index.d.ts +30 -0
- package/components/tabs/index.js +119 -0
- package/components/tabs/index.spec.d.ts +4 -0
- package/components/tabs/index.spec.js +98 -0
- package/components/tabs/index.vdt.js +62 -0
- package/components/tabs/styles.d.ts +5 -0
- package/components/tabs/styles.js +95 -0
- package/components/tabs/tab.d.ts +19 -0
- package/components/tabs/tab.js +55 -0
- package/components/tabs/tab.vdt.js +46 -0
- package/components/tabs/useActiveBar.d.ts +4 -0
- package/components/tabs/useActiveBar.js +61 -0
- package/components/tabs/useScroll.d.ts +13 -0
- package/components/tabs/useScroll.js +116 -0
- package/components/tag/base.d.ts +26 -0
- package/components/tag/base.js +54 -0
- package/components/tag/index.d.ts +7 -0
- package/components/tag/index.js +19 -0
- package/components/tag/index.spec.d.ts +4 -0
- package/components/tag/index.spec.js +42 -0
- package/components/tag/index.vdt.js +63 -0
- package/components/tag/styles.d.ts +5 -0
- package/components/tag/styles.js +95 -0
- package/components/timeline/index.d.ts +5 -0
- package/components/timeline/index.js +4 -0
- package/components/timeline/item.d.ts +20 -0
- package/components/timeline/item.js +31 -0
- package/components/timeline/item.vdt.js +39 -0
- package/components/timeline/styles.d.ts +10 -0
- package/components/timeline/styles.js +67 -0
- package/components/timeline/timeline.d.ts +9 -0
- package/components/timeline/timeline.js +15 -0
- package/components/timeline/timeline.vdt.js +25 -0
- package/components/timepicker/constants.d.ts +18 -0
- package/components/timepicker/constants.js +15 -0
- package/components/timepicker/index.d.ts +11 -0
- package/components/timepicker/index.js +40 -0
- package/components/timepicker/index.spec.d.ts +4 -0
- package/components/timepicker/index.spec.js +425 -0
- package/components/timepicker/panelPicker.d.ts +57 -0
- package/components/timepicker/panelPicker.js +55 -0
- package/components/timepicker/panelPicker.vdt.js +109 -0
- package/components/timepicker/selectPicker.d.ts +30 -0
- package/components/timepicker/selectPicker.js +33 -0
- package/components/timepicker/selectPicker.vdt.js +57 -0
- package/components/timepicker/styles.d.ts +5 -0
- package/components/timepicker/styles.js +31 -0
- package/components/timepicker/useDisabled.d.ts +13 -0
- package/components/timepicker/useDisabled.js +20 -0
- package/components/timepicker/useFormats.d.ts +15 -0
- package/components/timepicker/useFormats.js +49 -0
- package/components/timepicker/useStep.d.ts +13 -0
- package/components/timepicker/useStep.js +70 -0
- package/components/timepicker/useValue.d.ts +19 -0
- package/components/timepicker/useValue.js +54 -0
- package/components/tip/index.d.ts +15 -0
- package/components/tip/index.js +15 -0
- package/components/tip/index.vdt.js +86 -0
- package/components/tip/styles.d.ts +5 -0
- package/components/tip/styles.js +30 -0
- package/components/tooltip/content.d.ts +21 -0
- package/components/tooltip/content.js +94 -0
- package/components/tooltip/content.vdt.js +86 -0
- package/components/tooltip/index.d.ts +16 -0
- package/components/tooltip/index.js +30 -0
- package/components/tooltip/index.spec.d.ts +4 -0
- package/components/tooltip/index.spec.js +576 -0
- package/components/tooltip/styles.d.ts +7 -0
- package/components/tooltip/styles.js +82 -0
- package/components/tooltip/tooltip.d.ts +31 -0
- package/components/tooltip/tooltip.js +78 -0
- package/components/tooltip/useArrow.d.ts +7 -0
- package/components/tooltip/useArrow.js +53 -0
- package/components/transfer/index.d.ts +51 -0
- package/components/transfer/index.js +90 -0
- package/components/transfer/index.spec.d.ts +4 -0
- package/components/transfer/index.spec.js +242 -0
- package/components/transfer/index.vdt.js +161 -0
- package/components/transfer/styles.d.ts +5 -0
- package/components/transfer/styles.js +73 -0
- package/components/transfer/useCheck.d.ts +10 -0
- package/components/transfer/useCheck.js +91 -0
- package/components/transfer/useFilter.d.ts +10 -0
- package/components/transfer/useFilter.js +113 -0
- package/components/transfer/useTransfer.d.ts +10 -0
- package/components/transfer/useTransfer.js +86 -0
- package/components/tree/index.d.ts +60 -0
- package/components/tree/index.js +124 -0
- package/components/tree/index.spec.d.ts +4 -0
- package/components/tree/index.spec.js +428 -0
- package/components/tree/index.vdt.js +134 -0
- package/components/tree/styles.d.ts +5 -0
- package/components/tree/styles.js +71 -0
- package/components/tree/useChecked.d.ts +9 -0
- package/components/tree/useChecked.js +144 -0
- package/components/tree/useDraggable.d.ts +19 -0
- package/components/tree/useDraggable.js +174 -0
- package/components/tree/useExpanded.d.ts +9 -0
- package/components/tree/useExpanded.js +96 -0
- package/components/tree/useFilter.d.ts +6 -0
- package/components/tree/useFilter.js +55 -0
- package/components/tree/useNodes.d.ts +25 -0
- package/components/tree/useNodes.js +54 -0
- package/components/tree/useSelected.d.ts +10 -0
- package/components/tree/useSelected.js +92 -0
- package/components/tree/useTransitionEvent.d.ts +11 -0
- package/components/tree/useTransitionEvent.js +23 -0
- package/components/treeSelect/index.d.ts +30 -0
- package/components/treeSelect/index.js +141 -0
- package/components/treeSelect/index.spec.d.ts +4 -0
- package/components/treeSelect/index.spec.js +210 -0
- package/components/treeSelect/index.vdt.js +68 -0
- package/components/treeSelect/styles.d.ts +5 -0
- package/components/treeSelect/styles.js +19 -0
- package/components/treeSelect/useLabel.d.ts +4 -0
- package/components/treeSelect/useLabel.js +3 -0
- package/components/treeSelect/useValue.d.ts +12 -0
- package/components/treeSelect/useValue.js +71 -0
- package/components/types.d.ts +13 -0
- package/components/types.js +3 -0
- package/components/upload/ajaxUploader.d.ts +22 -0
- package/components/upload/ajaxUploader.js +89 -0
- package/components/upload/index.d.ts +66 -0
- package/components/upload/index.js +102 -0
- package/components/upload/index.spec.d.ts +4 -0
- package/components/upload/index.spec.js +544 -0
- package/components/upload/index.vdt.js +182 -0
- package/components/upload/styles.d.ts +6 -0
- package/components/upload/styles.js +156 -0
- package/components/upload/useAccept.d.ts +6 -0
- package/components/upload/useAccept.js +55 -0
- package/components/upload/useDrag.d.ts +10 -0
- package/components/upload/useDrag.js +47 -0
- package/components/upload/useFiles.d.ts +8 -0
- package/components/upload/useFiles.js +210 -0
- package/components/upload/useShowImage.d.ts +10 -0
- package/components/upload/useShowImage.js +25 -0
- package/components/upload/useUpload.d.ts +12 -0
- package/components/upload/useUpload.js +121 -0
- package/components/utils.d.ts +42 -0
- package/components/utils.js +361 -0
- package/hooks/useDelayClose.d.ts +7 -0
- package/hooks/useDelayClose.js +37 -0
- package/hooks/useDocumentClick.d.ts +9 -0
- package/hooks/useDocumentClick.js +37 -0
- package/hooks/useDraggable.d.ts +12 -0
- package/hooks/useDraggable.js +49 -0
- package/hooks/useKeyboard.d.ts +14 -0
- package/hooks/useKeyboard.js +54 -0
- package/hooks/useMouseOutsidable.d.ts +11 -0
- package/hooks/useMouseOutsidable.js +53 -0
- package/hooks/useReceive.d.ts +7 -0
- package/hooks/useReceive.js +30 -0
- package/hooks/useRecordComponent.d.ts +9 -0
- package/hooks/useRecordComponent.js +49 -0
- package/hooks/useResizeObserver.d.ts +5 -0
- package/hooks/useResizeObserver.js +16 -0
- package/hooks/useRouter.d.ts +4 -0
- package/hooks/useRouter.js +78 -0
- package/hooks/useShowHideEvents.d.ts +4 -0
- package/hooks/useShowHideEvents.js +27 -0
- package/hooks/useState.d.ts +11 -0
- package/hooks/useState.js +46 -0
- package/i18n/en-US.d.ts +94 -0
- package/i18n/en-US.js +108 -0
- package/i18n/index.d.ts +8 -0
- package/i18n/index.js +47 -0
- package/index.d.ts +61 -0
- package/index.js +63 -0
- package/package.json +51 -0
- package/styles/fonts/iconfont.d.ts +4 -0
- package/styles/fonts/iconfont.eot +0 -0
- package/styles/fonts/iconfont.js +8 -0
- package/styles/fonts/iconfont.svg +371 -0
- package/styles/fonts/iconfont.ttf +0 -0
- package/styles/fonts/iconfont.woff +0 -0
- package/styles/fonts/ionicons.d.ts +4 -0
- package/styles/fonts/ionicons.eot +0 -0
- package/styles/fonts/ionicons.js +19 -0
- package/styles/fonts/ionicons.svg +2230 -0
- package/styles/fonts/ionicons.ttf +0 -0
- package/styles/fonts/ionicons.woff +0 -0
- package/styles/global.d.ts +4 -0
- package/styles/global.js +18 -0
- package/styles/keyframes.d.ts +4 -0
- package/styles/keyframes.js +13 -0
- package/styles/theme.d.ts +108 -0
- package/styles/theme.js +130 -0
- package/styles/utils.d.ts +17 -0
- package/styles/utils.js +116 -0
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import BasicDemo from '~/components/cascader/demos/basic';
|
|
4
|
+
import CustomDemo from '~/components/cascader/demos/custom';
|
|
5
|
+
import ChangeOnSelectDemo from '~/components/cascader/demos/changeOnSelect';
|
|
6
|
+
import LoadDataDemo from '~/components/cascader/demos/loadData';
|
|
7
|
+
import FilterDemo from '~/components/cascader/demos/filterable';
|
|
8
|
+
import { mount, unmount, dispatchEvent, getElement, getElements, wait } from '../../test/utils';
|
|
9
|
+
describe('Cascader', function () {
|
|
10
|
+
afterEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
11
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
12
|
+
while (1) {
|
|
13
|
+
switch (_context.prev = _context.next) {
|
|
14
|
+
case 0:
|
|
15
|
+
unmount();
|
|
16
|
+
_context.next = 3;
|
|
17
|
+
return wait(400);
|
|
18
|
+
|
|
19
|
+
case 3:
|
|
20
|
+
case "end":
|
|
21
|
+
return _context.stop();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, _callee);
|
|
25
|
+
})));
|
|
26
|
+
it('basic test', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
27
|
+
var _mount, instance, element, select, dropdown1, _dropdown1$querySelec, item1, item2, dropdown2, _dropdown2$querySelec, item11, item12, dropdown3, _dropdown3$querySelec, item21, item22, _getElements, _dropdown1, _dropdown2, _dropdown3;
|
|
28
|
+
|
|
29
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
30
|
+
while (1) {
|
|
31
|
+
switch (_context2.prev = _context2.next) {
|
|
32
|
+
case 0:
|
|
33
|
+
_mount = mount(BasicDemo), instance = _mount[0], element = _mount[1];
|
|
34
|
+
select = element.querySelector('.k-cascader');
|
|
35
|
+
select.click();
|
|
36
|
+
_context2.next = 5;
|
|
37
|
+
return wait();
|
|
38
|
+
|
|
39
|
+
case 5:
|
|
40
|
+
dropdown1 = getElement('.k-cascader-menu');
|
|
41
|
+
_dropdown1$querySelec = dropdown1.querySelectorAll(':scope > .k-dropdown-item'), item1 = _dropdown1$querySelec[0], item2 = _dropdown1$querySelec[1];
|
|
42
|
+
item2.click();
|
|
43
|
+
_context2.next = 10;
|
|
44
|
+
return wait();
|
|
45
|
+
|
|
46
|
+
case 10:
|
|
47
|
+
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
48
|
+
dropdown2 = getElement('.k-cascader-menu');
|
|
49
|
+
_dropdown2$querySelec = dropdown2.querySelectorAll(':scope > .k-dropdown-item'), item11 = _dropdown2$querySelec[0], item12 = _dropdown2$querySelec[1];
|
|
50
|
+
item12.click();
|
|
51
|
+
_context2.next = 16;
|
|
52
|
+
return wait();
|
|
53
|
+
|
|
54
|
+
case 16:
|
|
55
|
+
dropdown3 = getElement('.k-cascader-menu');
|
|
56
|
+
_dropdown3$querySelec = dropdown3.querySelectorAll(':scope > .k-dropdown-item'), item21 = _dropdown3$querySelec[0], item22 = _dropdown3$querySelec[1];
|
|
57
|
+
item22.click();
|
|
58
|
+
_context2.next = 21;
|
|
59
|
+
return wait();
|
|
60
|
+
|
|
61
|
+
case 21:
|
|
62
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
63
|
+
expect(instance.get('value')).to.eql(['hunan', 'yueyang', 'yueyangxian']);
|
|
64
|
+
select.click();
|
|
65
|
+
_context2.next = 26;
|
|
66
|
+
return wait();
|
|
67
|
+
|
|
68
|
+
case 26:
|
|
69
|
+
_getElements = getElements('.k-cascader-menu'), _dropdown1 = _getElements[0], _dropdown2 = _getElements[1], _dropdown3 = _getElements[2];
|
|
70
|
+
expect(_dropdown1.innerHTML).to.matchSnapshot();
|
|
71
|
+
expect(_dropdown2.innerHTML).to.matchSnapshot();
|
|
72
|
+
expect(_dropdown3.innerHTML).to.matchSnapshot();
|
|
73
|
+
|
|
74
|
+
case 30:
|
|
75
|
+
case "end":
|
|
76
|
+
return _context2.stop();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}, _callee2);
|
|
80
|
+
})));
|
|
81
|
+
it('custom label', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
82
|
+
var _mount2, instance, element;
|
|
83
|
+
|
|
84
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
85
|
+
while (1) {
|
|
86
|
+
switch (_context3.prev = _context3.next) {
|
|
87
|
+
case 0:
|
|
88
|
+
_mount2 = mount(CustomDemo), instance = _mount2[0], element = _mount2[1];
|
|
89
|
+
instance.set('value', ['beijing', 'haidian']);
|
|
90
|
+
_context3.next = 4;
|
|
91
|
+
return wait();
|
|
92
|
+
|
|
93
|
+
case 4:
|
|
94
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
95
|
+
instance.set('value', ['hunan', 'yueyang', 'yueyangxian']);
|
|
96
|
+
_context3.next = 8;
|
|
97
|
+
return wait();
|
|
98
|
+
|
|
99
|
+
case 8:
|
|
100
|
+
expect(element.innerHTML).to.matchSnapshot();
|
|
101
|
+
|
|
102
|
+
case 9:
|
|
103
|
+
case "end":
|
|
104
|
+
return _context3.stop();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}, _callee3);
|
|
108
|
+
})));
|
|
109
|
+
it('change on select', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
110
|
+
var _mount3, instance, element, select, dropdown1, _dropdown1$querySelec2, item1, item2;
|
|
111
|
+
|
|
112
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
113
|
+
while (1) {
|
|
114
|
+
switch (_context4.prev = _context4.next) {
|
|
115
|
+
case 0:
|
|
116
|
+
_mount3 = mount(ChangeOnSelectDemo), instance = _mount3[0], element = _mount3[1];
|
|
117
|
+
select = element.querySelector('.k-cascader');
|
|
118
|
+
select.click();
|
|
119
|
+
_context4.next = 5;
|
|
120
|
+
return wait();
|
|
121
|
+
|
|
122
|
+
case 5:
|
|
123
|
+
dropdown1 = getElement('.k-cascader-menu');
|
|
124
|
+
_dropdown1$querySelec2 = dropdown1.querySelectorAll(':scope > .k-dropdown-item'), item1 = _dropdown1$querySelec2[0], item2 = _dropdown1$querySelec2[1];
|
|
125
|
+
item2.click();
|
|
126
|
+
_context4.next = 10;
|
|
127
|
+
return wait();
|
|
128
|
+
|
|
129
|
+
case 10:
|
|
130
|
+
expect(instance.get('value')).to.eql(['hunan']);
|
|
131
|
+
item1.click();
|
|
132
|
+
_context4.next = 14;
|
|
133
|
+
return wait();
|
|
134
|
+
|
|
135
|
+
case 14:
|
|
136
|
+
expect(instance.get('value')).to.eql(['beijing']);
|
|
137
|
+
|
|
138
|
+
case 15:
|
|
139
|
+
case "end":
|
|
140
|
+
return _context4.stop();
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}, _callee4);
|
|
144
|
+
})));
|
|
145
|
+
it('load data asychronously', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
|
|
146
|
+
var _mount4, instance, element, dropdown1, _dropdown1$querySelec3, item1, item2, dropdown2, _dropdown2$querySelec2, item21, item22, dropdown3;
|
|
147
|
+
|
|
148
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
149
|
+
while (1) {
|
|
150
|
+
switch (_context5.prev = _context5.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
_mount4 = mount(LoadDataDemo), instance = _mount4[0], element = _mount4[1];
|
|
153
|
+
element.click();
|
|
154
|
+
_context5.next = 4;
|
|
155
|
+
return wait();
|
|
156
|
+
|
|
157
|
+
case 4:
|
|
158
|
+
dropdown1 = getElement('.k-cascader-menu');
|
|
159
|
+
_dropdown1$querySelec3 = dropdown1.querySelectorAll(':scope > .k-dropdown-item'), item1 = _dropdown1$querySelec3[0], item2 = _dropdown1$querySelec3[1];
|
|
160
|
+
item2.click();
|
|
161
|
+
_context5.next = 9;
|
|
162
|
+
return wait();
|
|
163
|
+
|
|
164
|
+
case 9:
|
|
165
|
+
dropdown2 = getElement('.k-cascader-menu');
|
|
166
|
+
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
167
|
+
expect(dropdown2.innerText).to.eql('');
|
|
168
|
+
_context5.next = 14;
|
|
169
|
+
return wait(1500);
|
|
170
|
+
|
|
171
|
+
case 14:
|
|
172
|
+
expect(dropdown2.innerHTML).to.matchSnapshot();
|
|
173
|
+
expect(dropdown2.innerText).to.not.eql('');
|
|
174
|
+
_dropdown2$querySelec2 = dropdown2.querySelectorAll(':scope > .k-dropdown-item'), item21 = _dropdown2$querySelec2[0], item22 = _dropdown2$querySelec2[1];
|
|
175
|
+
item22.click();
|
|
176
|
+
_context5.next = 20;
|
|
177
|
+
return wait();
|
|
178
|
+
|
|
179
|
+
case 20:
|
|
180
|
+
dropdown3 = getElement('.k-cascader-menu');
|
|
181
|
+
expect(dropdown3.innerHTML).to.matchSnapshot();
|
|
182
|
+
expect(dropdown3.innerText).to.eql('无数据');
|
|
183
|
+
|
|
184
|
+
case 23:
|
|
185
|
+
case "end":
|
|
186
|
+
return _context5.stop();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}, _callee5);
|
|
190
|
+
})));
|
|
191
|
+
it('filter', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
|
|
192
|
+
var _mount5, instance, element, input, dropdown, dropdown1;
|
|
193
|
+
|
|
194
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
195
|
+
while (1) {
|
|
196
|
+
switch (_context6.prev = _context6.next) {
|
|
197
|
+
case 0:
|
|
198
|
+
_mount5 = mount(FilterDemo), instance = _mount5[0], element = _mount5[1];
|
|
199
|
+
input = element.querySelector('.k-input-inner'); // show menu
|
|
200
|
+
|
|
201
|
+
input.click();
|
|
202
|
+
_context6.next = 5;
|
|
203
|
+
return wait();
|
|
204
|
+
|
|
205
|
+
case 5:
|
|
206
|
+
// should show layer when input empty string
|
|
207
|
+
input.value = ' ';
|
|
208
|
+
dispatchEvent(input, 'input');
|
|
209
|
+
_context6.next = 9;
|
|
210
|
+
return wait();
|
|
211
|
+
|
|
212
|
+
case 9:
|
|
213
|
+
dropdown = getElement('.k-cascader-menu');
|
|
214
|
+
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
215
|
+
expect(dropdown.innerText).to.eql('北京\n湖南');
|
|
216
|
+
input.value = '长沙';
|
|
217
|
+
dispatchEvent(input, 'input');
|
|
218
|
+
_context6.next = 16;
|
|
219
|
+
return wait();
|
|
220
|
+
|
|
221
|
+
case 16:
|
|
222
|
+
dropdown1 = getElement('.k-cascader-filter');
|
|
223
|
+
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
224
|
+
expect(dropdown1.innerText).to.eql('湖南 / 长沙市 / 岳麓区'); // should show no-data layer
|
|
225
|
+
|
|
226
|
+
input.value = 'xxx';
|
|
227
|
+
dispatchEvent(input, 'input');
|
|
228
|
+
_context6.next = 23;
|
|
229
|
+
return wait();
|
|
230
|
+
|
|
231
|
+
case 23:
|
|
232
|
+
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
233
|
+
expect(dropdown1.innerText).to.eql('无匹配数据');
|
|
234
|
+
input.value = '岳阳';
|
|
235
|
+
dispatchEvent(input, 'input');
|
|
236
|
+
_context6.next = 29;
|
|
237
|
+
return wait();
|
|
238
|
+
|
|
239
|
+
case 29:
|
|
240
|
+
expect(dropdown1.innerHTML).to.matchSnapshot();
|
|
241
|
+
expect(dropdown1.childElementCount).to.eql(2);
|
|
242
|
+
dropdown1.querySelector('.k-dropdown-item').click();
|
|
243
|
+
_context6.next = 34;
|
|
244
|
+
return wait();
|
|
245
|
+
|
|
246
|
+
case 34:
|
|
247
|
+
expect(instance.get('value')).to.eql(['hunan', 'yueyang', 'yueyanglou']);
|
|
248
|
+
|
|
249
|
+
case 35:
|
|
250
|
+
case "end":
|
|
251
|
+
return _context6.stop();
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}, _callee6);
|
|
255
|
+
})));
|
|
256
|
+
it('no data for init data', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
257
|
+
var _mount6, instance, element, _element$querySelecto, select, dropdown;
|
|
258
|
+
|
|
259
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
260
|
+
while (1) {
|
|
261
|
+
switch (_context7.prev = _context7.next) {
|
|
262
|
+
case 0:
|
|
263
|
+
_mount6 = mount(BasicDemo), instance = _mount6[0], element = _mount6[1];
|
|
264
|
+
_element$querySelecto = element.querySelectorAll('.k-cascader'), select = _element$querySelecto[1];
|
|
265
|
+
dispatchEvent(select, 'click');
|
|
266
|
+
_context7.next = 5;
|
|
267
|
+
return wait();
|
|
268
|
+
|
|
269
|
+
case 5:
|
|
270
|
+
dropdown = getElement('.k-cascader-menu');
|
|
271
|
+
expect(dropdown.innerHTML).to.matchSnapshot();
|
|
272
|
+
expect(dropdown.innerText).to.eql('无数据');
|
|
273
|
+
|
|
274
|
+
case 8:
|
|
275
|
+
case "end":
|
|
276
|
+
return _context7.stop();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}, _callee7);
|
|
280
|
+
})));
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
export {normalize} from 'intact-react';
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/values";
|
|
2
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
3
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
4
|
+
import { createUnknownComponentVNode as _$cc, createElementVNode as _$ce, className as _$cn, superCall as _$su, extend as _$ex, EMPTY_OBJ as _$em, map as _$ma } from 'intact-react';
|
|
5
|
+
import { Dropdown, DropdownMenu, DropdownItem } from '../dropdown';
|
|
6
|
+
import { Icon } from '../icon';
|
|
7
|
+
import { _$ } from '../../i18n';
|
|
8
|
+
import { makeMenuStyles, makeFilterMenuStyles } from './styles';
|
|
9
|
+
var _$tmp0 = {
|
|
10
|
+
'className': 'ion-load-c k-cascader-loading',
|
|
11
|
+
'rotate': true
|
|
12
|
+
};
|
|
13
|
+
var _$tmp1 = {
|
|
14
|
+
'className': 'k-cascader-arrow ion-ios-arrow-right'
|
|
15
|
+
};
|
|
16
|
+
var _$tmp2 = {
|
|
17
|
+
'className': 'k-cascader'
|
|
18
|
+
};
|
|
19
|
+
export default function ($props, $blocks, $__proto__) {
|
|
20
|
+
var _classNameObj,
|
|
21
|
+
_this = this;
|
|
22
|
+
|
|
23
|
+
$blocks || ($blocks = {});
|
|
24
|
+
$props || ($props = {});
|
|
25
|
+
var $this = this;
|
|
26
|
+
|
|
27
|
+
var _this$get = this.get(),
|
|
28
|
+
data = _this$get.data,
|
|
29
|
+
trigger = _this$get.trigger,
|
|
30
|
+
filterable = _this$get.filterable;
|
|
31
|
+
|
|
32
|
+
var baseMenuStyles = makeMenuStyles();
|
|
33
|
+
var classNameObj = (_classNameObj = {
|
|
34
|
+
'k-cascader-menu': true
|
|
35
|
+
}, _classNameObj[baseMenuStyles] = true, _classNameObj);
|
|
36
|
+
|
|
37
|
+
var _this$value = this.value,
|
|
38
|
+
values = _valuesInstanceProperty(_this$value),
|
|
39
|
+
isShowed = _this$value.isShowed,
|
|
40
|
+
isSelected = _this$value.isSelected,
|
|
41
|
+
onSelect = _this$value.onSelect,
|
|
42
|
+
toggleShowedValue = _this$value.toggleShowedValue;
|
|
43
|
+
|
|
44
|
+
var Options = function Options(data, level, loaded) {
|
|
45
|
+
if (!data.length) {
|
|
46
|
+
if (!loaded) {
|
|
47
|
+
return _$cc(Icon, _$tmp0);
|
|
48
|
+
} else {
|
|
49
|
+
return _$ce(2, 'div', _$('无数据'), 0, 'k-cascader-empty');
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return _mapInstanceProperty(data).call(data, function (item, index) {
|
|
54
|
+
var value = item.value;
|
|
55
|
+
var showed = isShowed(value, level);
|
|
56
|
+
var selected = isSelected(value, level);
|
|
57
|
+
var children = item.children;
|
|
58
|
+
|
|
59
|
+
var Item = function Item() {
|
|
60
|
+
return _$cc(DropdownItem, {
|
|
61
|
+
'disabled': item.disabled,
|
|
62
|
+
'className': _$cn({
|
|
63
|
+
'k-cascader-option': true,
|
|
64
|
+
'k-active': showed,
|
|
65
|
+
'k-selected': selected
|
|
66
|
+
}),
|
|
67
|
+
'ev-select': onSelect.bind(null, value, level),
|
|
68
|
+
'children': [item.label, children ? _$cc(Icon, _$tmp1) : undefined]
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return children ? _$cc(Dropdown, {
|
|
73
|
+
'position': _this.positionObj,
|
|
74
|
+
'of': 'parent',
|
|
75
|
+
'disabled': item.disabled,
|
|
76
|
+
'trigger': trigger,
|
|
77
|
+
'value': showed,
|
|
78
|
+
'ev-$changed:value': toggleShowedValue.bind(null, value, level),
|
|
79
|
+
'ev-show': _this.load.bind(null, item),
|
|
80
|
+
'children': [Item(), _$cc(DropdownMenu, {
|
|
81
|
+
'className': _$cn(classNameObj),
|
|
82
|
+
'children': showed ? Options(children, level + 1, item.loaded) : null
|
|
83
|
+
})]
|
|
84
|
+
}) : Item();
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var _this$filterable = this.filterable,
|
|
89
|
+
filter = _filterInstanceProperty(_this$filterable),
|
|
90
|
+
keywords = _this$filterable.keywords.value,
|
|
91
|
+
selectByFilter = _this$filterable.selectByFilter;
|
|
92
|
+
|
|
93
|
+
return _$su.call($this, _$tmp2, function ($blocks) {
|
|
94
|
+
var _$blocks = {},
|
|
95
|
+
__$blocks = _$ex({}, $blocks);
|
|
96
|
+
|
|
97
|
+
return (_$blocks['base-menu'] = function ($super) {
|
|
98
|
+
var _$cn2;
|
|
99
|
+
|
|
100
|
+
return !filterable || !keywords ? _$cc(DropdownMenu, {
|
|
101
|
+
'className': _$cn(classNameObj),
|
|
102
|
+
'key': 'common',
|
|
103
|
+
'children': Options(data, 0, true)
|
|
104
|
+
}, 'common') : _$cc(DropdownMenu, {
|
|
105
|
+
'key': 'filter',
|
|
106
|
+
'className': _$cn((_$cn2 = {
|
|
107
|
+
'k-cascader-filter': true
|
|
108
|
+
}, _$cn2[baseMenuStyles] = true, _$cn2[makeFilterMenuStyles()] = true, _$cn2)),
|
|
109
|
+
'children': function () {
|
|
110
|
+
var items = filter();
|
|
111
|
+
if (!items.length) return _$ce(2, 'div', _$('无匹配数据'), 0, 'k-cascader-empty');
|
|
112
|
+
return _$ma(items, function ($value, $key) {
|
|
113
|
+
return _$cc(DropdownItem, {
|
|
114
|
+
'ev-select': selectByFilter.bind(null, $value),
|
|
115
|
+
'disabled': $value.disabled,
|
|
116
|
+
'children': function () {
|
|
117
|
+
// highlight keywords
|
|
118
|
+
var label = _mapInstanceProperty($value).call($value, function (item) {
|
|
119
|
+
return item.label;
|
|
120
|
+
}).join(' / ');
|
|
121
|
+
|
|
122
|
+
var labels = label.split(keywords);
|
|
123
|
+
var length = labels.length;
|
|
124
|
+
return _mapInstanceProperty(labels).call(labels, function (item, index) {
|
|
125
|
+
var ret = [item];
|
|
126
|
+
|
|
127
|
+
if (index !== length - 1) {
|
|
128
|
+
ret.push(_$ce(2, 'em', keywords, 0));
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return ret;
|
|
132
|
+
});
|
|
133
|
+
}()
|
|
134
|
+
});
|
|
135
|
+
}, $this);
|
|
136
|
+
}()
|
|
137
|
+
}, 'filter');
|
|
138
|
+
}, __$blocks['base-menu'] = function ($super, data) {
|
|
139
|
+
var block = $blocks['base-menu'];
|
|
140
|
+
|
|
141
|
+
var callBlock = function callBlock() {
|
|
142
|
+
return _$blocks['base-menu'].call($this, $super, data);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
return block ? block.call($this, callBlock, data) : callBlock();
|
|
146
|
+
}), __$blocks;
|
|
147
|
+
}.call($this, $blocks), $__proto__);
|
|
148
|
+
}
|
|
149
|
+
;
|
|
150
|
+
|
|
151
|
+
export {normalize} from 'intact-react';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
2
|
+
import { css } from '@emotion/css';
|
|
3
|
+
import { theme, setDefault } from '../../styles/theme';
|
|
4
|
+
import { deepDefaults } from '../../styles/utils';
|
|
5
|
+
import '../../styles/global';
|
|
6
|
+
var defaults = {
|
|
7
|
+
width: '140px',
|
|
8
|
+
height: '160px',
|
|
9
|
+
loadingGap: '20px',
|
|
10
|
+
arrowGap: '8px',
|
|
11
|
+
|
|
12
|
+
get selectedColor() {
|
|
13
|
+
return theme.color.primary;
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
get activeBgColor() {
|
|
17
|
+
return theme.color.bg;
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
// empty
|
|
21
|
+
empty: {
|
|
22
|
+
padding: "16px",
|
|
23
|
+
|
|
24
|
+
get color() {
|
|
25
|
+
return theme.color.placeholder;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
},
|
|
29
|
+
// filter
|
|
30
|
+
filter: {
|
|
31
|
+
get highlightColor() {
|
|
32
|
+
return theme.color.danger;
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
minWidth: '300px',
|
|
36
|
+
maxHeight: '200px'
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var cascader;
|
|
40
|
+
setDefault(function () {
|
|
41
|
+
cascader = deepDefaults(theme, {
|
|
42
|
+
cascader: defaults
|
|
43
|
+
}).cascader;
|
|
44
|
+
});
|
|
45
|
+
export function makeMenuStyles() {
|
|
46
|
+
return /*#__PURE__*/css("min-width:", cascader.width, "!important;height:", cascader.height, ";.k-cascader-arrow{float:right;height:100%;margin-left:", cascader.arrowGap, ";line-height:inherit;}.k-cascader-loading{display:block;text-align:center;margin-top:", cascader.loadingGap, ";}.k-cascader-empty{padding:", cascader.empty.padding, ";color:", cascader.empty.color, ";text-align:center;}.k-cascader-option{&.k-selected{color:", cascader.selectedColor, ";}&.k-active{background:", cascader.activeBgColor, ";}}");
|
|
47
|
+
}
|
|
48
|
+
export function makeFilterMenuStyles() {
|
|
49
|
+
return /*#__PURE__*/css("min-width:", _filterInstanceProperty(cascader).minWidth, "!important;height:auto;max-height:", _filterInstanceProperty(cascader).maxHeight, ";em{font-style:normal;color:", _filterInstanceProperty(cascader).highlightColor, ";}");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export {normalize} from 'intact-react';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { CascaderData } from './';
|
|
2
|
+
import { State } from '../../hooks/useState';
|
|
3
|
+
import type { Value } from './useValue';
|
|
4
|
+
export declare function useFilterable(keywords: State<string>, setValue: (value: Value) => void): {
|
|
5
|
+
filter: () => CascaderData<any>[][];
|
|
6
|
+
selectByFilter: (data: CascaderData<any>[]) => void;
|
|
7
|
+
keywords: State<string>;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
export {normalize} from 'intact-react';
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js/instance/filter";
|
|
2
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js/instance/slice";
|
|
3
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js/instance/map";
|
|
4
|
+
import { useInstance } from 'intact-react';
|
|
5
|
+
export function useFilterable(keywords, setValue) {
|
|
6
|
+
var instance = useInstance();
|
|
7
|
+
|
|
8
|
+
function filter() {
|
|
9
|
+
var _instance$get = instance.get(),
|
|
10
|
+
data = _instance$get.data,
|
|
11
|
+
filter = _filterInstanceProperty(_instance$get);
|
|
12
|
+
|
|
13
|
+
var ret = [];
|
|
14
|
+
|
|
15
|
+
var loop = function loop(data, prefix, valid, disabled) {
|
|
16
|
+
if (prefix === void 0) {
|
|
17
|
+
prefix = [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (valid === void 0) {
|
|
21
|
+
valid = false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (disabled === void 0) {
|
|
25
|
+
disabled = false;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
data.forEach(function (item) {
|
|
29
|
+
var _valid = valid || filter(keywords.value, item);
|
|
30
|
+
|
|
31
|
+
var _disabled = disabled || item.disabled;
|
|
32
|
+
|
|
33
|
+
var _prefix = _sliceInstanceProperty(prefix).call(prefix, 0);
|
|
34
|
+
|
|
35
|
+
_prefix.push(item);
|
|
36
|
+
|
|
37
|
+
if (item.children) {
|
|
38
|
+
loop(item.children, _prefix, _valid, _disabled);
|
|
39
|
+
} else if (_valid) {
|
|
40
|
+
_prefix.disabled = _disabled;
|
|
41
|
+
ret.push(_prefix);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
loop(data);
|
|
47
|
+
return ret;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function selectByFilter(data) {
|
|
51
|
+
var value = _mapInstanceProperty(data).call(data, function (item) {
|
|
52
|
+
return item.value;
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
setValue(value);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
filter: filter,
|
|
60
|
+
selectByFilter: selectByFilter,
|
|
61
|
+
keywords: keywords
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export {normalize} from 'intact-react';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js/instance/includes";
|
|
2
|
+
import { useInstance } from 'intact-react';
|
|
3
|
+
import { useBaseLabel } from '../select/useBaseLabel';
|
|
4
|
+
export function useLabel() {
|
|
5
|
+
var instance = useInstance();
|
|
6
|
+
|
|
7
|
+
function findLabel(data, value) {
|
|
8
|
+
var _instance$get = instance.get(),
|
|
9
|
+
format = _instance$get.format;
|
|
10
|
+
|
|
11
|
+
var labels = [];
|
|
12
|
+
var length = value.length;
|
|
13
|
+
|
|
14
|
+
var loop = function loop(data) {
|
|
15
|
+
for (var i = 0; i < data.length; i++) {
|
|
16
|
+
var item = data[i];
|
|
17
|
+
|
|
18
|
+
if (_includesInstanceProperty(value).call(value, item.value)) {
|
|
19
|
+
labels.push(item.label);
|
|
20
|
+
|
|
21
|
+
if (labels.length === length) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var children = item.children;
|
|
27
|
+
|
|
28
|
+
if (children) {
|
|
29
|
+
loop(children);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
loop(data);
|
|
35
|
+
return labels.length ? format(labels) : null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return useBaseLabel(function () {
|
|
39
|
+
return instance.get('data');
|
|
40
|
+
}, findLabel);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export {normalize} from 'intact-react';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
2
|
+
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
3
|
+
import { useInstance } from 'intact-react';
|
|
4
|
+
export function useLoad() {
|
|
5
|
+
var instance = useInstance();
|
|
6
|
+
|
|
7
|
+
function loadData(_x) {
|
|
8
|
+
return _loadData.apply(this, arguments);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function _loadData() {
|
|
12
|
+
_loadData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(item) {
|
|
13
|
+
var _instance$get, loadData;
|
|
14
|
+
|
|
15
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
16
|
+
while (1) {
|
|
17
|
+
switch (_context.prev = _context.next) {
|
|
18
|
+
case 0:
|
|
19
|
+
_instance$get = instance.get(), loadData = _instance$get.loadData;
|
|
20
|
+
|
|
21
|
+
if (loadData) {
|
|
22
|
+
_context.next = 3;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return _context.abrupt("return");
|
|
27
|
+
|
|
28
|
+
case 3:
|
|
29
|
+
if (!(item.children && !item.children.length && !item.loaded)) {
|
|
30
|
+
_context.next = 8;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
_context.next = 6;
|
|
35
|
+
return loadData(item);
|
|
36
|
+
|
|
37
|
+
case 6:
|
|
38
|
+
item.loaded = true;
|
|
39
|
+
instance.forceUpdate();
|
|
40
|
+
|
|
41
|
+
case 8:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
}));
|
|
48
|
+
return _loadData.apply(this, arguments);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return loadData;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {normalize} from 'intact-react';
|