@luck-design-biz/luckda 0.0.22-3 → 0.0.22-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/LICENSE +21 -21
- package/README.md +40 -40
- package/es/components/Builder/index.js +1 -1
- package/es/components/LdGrid/index.js +4 -4
- package/es/components/LdGridForm/index.less +7 -7
- package/es/components/LdRuntimeCom/index.js +42 -0
- package/es/components/LdTree/index.less +36 -36
- package/es/helper/action.js +6 -6
- package/es/helper/form.js +14 -14
- package/es/helper/index.less +7 -7
- package/es/index.js +1 -0
- package/es/lowcode/constants/api-url.js +3 -0
- package/es/lowcode/constants/event-topics.js +31 -0
- package/es/lowcode/constants/index.js +12 -0
- package/es/lowcode/engine/factory/DataFactory.js +1 -0
- package/es/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +60 -0
- package/es/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/Strategy.js +21 -0
- package/es/lowcode/engine/factory/panel-item-factory/StringStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/index.js +40 -0
- package/es/lowcode/engine/meta/box.props.default.json +10 -0
- package/es/lowcode/engine/meta/box.props.json +40 -0
- package/es/lowcode/engine/meta/button.props.default.json +16 -0
- package/es/lowcode/engine/meta/button.props.json +117 -0
- package/es/lowcode/engine/meta/cardlist.props.default.json +18 -0
- package/es/lowcode/engine/meta/cardlist.props.json +144 -0
- package/es/lowcode/engine/meta/components-list.json +128 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +19 -0
- package/es/lowcode/engine/meta/dialog.props.json +121 -0
- package/es/lowcode/engine/meta/drawer.props.default.json +18 -0
- package/es/lowcode/engine/meta/drawer.props.json +144 -0
- package/es/lowcode/engine/meta/form.props.default.json +13 -0
- package/es/lowcode/engine/meta/form.props.json +117 -0
- package/es/lowcode/engine/meta/iframe.props.default.json +11 -0
- package/es/lowcode/engine/meta/iframe.props.json +32 -0
- package/es/lowcode/engine/meta/image.props.default.json +16 -0
- package/es/lowcode/engine/meta/image.props.json +114 -0
- package/es/lowcode/engine/meta/imex.props.default.json +12 -0
- package/es/lowcode/engine/meta/imex.props.json +82 -0
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +29 -0
- package/es/lowcode/engine/meta/jsx.props.default.json +10 -0
- package/es/lowcode/engine/meta/jsx.props.json +25 -0
- package/es/lowcode/engine/meta/layout.props.default.json +13 -0
- package/es/lowcode/engine/meta/layout.props.json +108 -0
- package/es/lowcode/engine/meta/link.props.default.json +14 -0
- package/es/lowcode/engine/meta/link.props.json +112 -0
- package/es/lowcode/engine/meta/section.props.default.json +17 -0
- package/es/lowcode/engine/meta/section.props.json +108 -0
- package/es/lowcode/engine/meta/split.props.default.json +13 -0
- package/es/lowcode/engine/meta/split.props.json +72 -0
- package/es/lowcode/engine/meta/table.props.default.json +18 -0
- package/es/lowcode/engine/meta/table.props.json +162 -0
- package/es/lowcode/engine/meta/tabs.props.default.json +18 -0
- package/es/lowcode/engine/meta/tabs.props.json +141 -0
- package/es/lowcode/engine/meta/text.props.default.json +12 -0
- package/es/lowcode/engine/meta/text.props.json +66 -0
- package/es/lowcode/engine/meta/tree.props.default.json +17 -0
- package/es/lowcode/engine/meta/tree.props.json +157 -0
- package/es/lowcode/engine/provider/ContextProvider.js +165 -0
- package/es/lowcode/engine/provider/EventBusProvider.js +120 -0
- package/es/lowcode/engine/tools/dataProcess.js +263 -0
- package/es/lowcode/engine/tools/helper.js +4 -0
- package/es/lowcode/engine/tools/lcid.js +16 -0
- package/es/lowcode/index.js +3 -0
- package/es/lowcode/painter/Components.js +104 -0
- package/es/lowcode/painter/Design.js +210 -0
- package/es/lowcode/painter/I18n.js +202 -0
- package/es/lowcode/painter/Outline.js +208 -0
- package/es/lowcode/painter/Panel.js +195 -0
- package/es/lowcode/painter/Ribbon.js +142 -0
- package/es/lowcode/painter/components/PanelItem.js +35 -0
- package/es/lowcode/painter/components/PopConfirm.js +20 -0
- package/es/lowcode/painter/components/PopForm.js +71 -0
- package/es/lowcode/painter/components/RuleInput.js +105 -0
- package/es/lowcode/painter/components/SortBox.js +92 -0
- package/es/lowcode/painter/components/TabEditor.js +88 -0
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +49 -0
- package/es/lowcode/painter/components/code-editor/JSEditor.js +77 -0
- package/es/lowcode/painter/components/code-editor/index.js +2 -0
- package/es/lowcode/painter/index.js +45 -0
- package/es/lowcode/painter/panel-section/Icon.js +48 -0
- package/es/lowcode/painter/panel-section/IconSelector.js +139 -0
- package/es/lowcode/painter/panel-section/LayoutRatio.js +140 -0
- package/es/lowcode/painter/panel-section/TabItems.js +238 -0
- package/es/lowcode/painter/services/I18n.js +85 -0
- package/es/lowcode/painter/style/components.less +90 -0
- package/es/lowcode/painter/style/design.less +82 -0
- package/es/lowcode/painter/style/icon-selector.less +22 -0
- package/es/lowcode/painter/style/icon.less +11 -0
- package/es/lowcode/painter/style/index.less +6 -0
- package/es/lowcode/painter/style/layout-ratio.less +51 -0
- package/es/lowcode/painter/style/outline.less +28 -0
- package/es/lowcode/painter/style/panel-item.less +22 -0
- package/es/lowcode/painter/style/panel.less +119 -0
- package/es/lowcode/painter/style/pop-confirm.less +10 -0
- package/es/lowcode/painter/style/pop-form.less +20 -0
- package/es/lowcode/painter/style/radio.less +24 -0
- package/es/lowcode/painter/style/ribbon.less +5 -0
- package/es/lowcode/painter/style/rule-input.less +13 -0
- package/es/lowcode/painter/style/tabeditor.less +90 -0
- package/es/lowcode/painter/style/tabitems.less +90 -0
- package/es/lowcode/view/Canvas.js +135 -0
- package/es/lowcode/view/Loading.js +23 -0
- package/es/lowcode/view/Page.js +251 -0
- package/es/lowcode/view/index.js +18 -0
- package/es/lowcode/view/lc-components/Box/index.js +24 -0
- package/es/lowcode/view/lc-components/Box/meta.json +40 -0
- package/es/lowcode/view/lc-components/Button/index.js +37 -0
- package/es/lowcode/view/lc-components/Button/meta.json +117 -0
- package/es/lowcode/view/lc-components/CardList/index.js +20 -0
- package/es/lowcode/view/lc-components/CardList/meta.json +144 -0
- package/es/lowcode/view/lc-components/Dialog/index.js +61 -0
- package/es/lowcode/view/lc-components/Dialog/index.less +3 -0
- package/es/lowcode/view/lc-components/Dialog/meta.json +121 -0
- package/es/lowcode/view/lc-components/Drawer/index.js +62 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +144 -0
- package/es/lowcode/view/lc-components/Drawer/style.less +7 -0
- package/es/lowcode/view/lc-components/Form/index.js +20 -0
- package/es/lowcode/view/lc-components/Form/meta.json +117 -0
- package/es/lowcode/view/lc-components/Iframe/index.js +20 -0
- package/es/lowcode/view/lc-components/Iframe/meta.json +32 -0
- package/es/lowcode/view/lc-components/ImEx/index.js +20 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +82 -0
- package/es/lowcode/view/lc-components/Image/index.js +20 -0
- package/es/lowcode/view/lc-components/Image/meta.json +114 -0
- package/es/lowcode/view/lc-components/JSX/index.js +20 -0
- package/es/lowcode/view/lc-components/JSX/meta.json +25 -0
- package/es/lowcode/view/lc-components/Layout/index.js +98 -0
- package/es/lowcode/view/lc-components/Layout/index.less +9 -0
- package/es/lowcode/view/lc-components/Layout/meta.json +108 -0
- package/es/lowcode/view/lc-components/Link/index.js +20 -0
- package/es/lowcode/view/lc-components/Link/meta.json +112 -0
- package/es/lowcode/view/lc-components/Section/index.js +34 -0
- package/es/lowcode/view/lc-components/Section/meta.json +108 -0
- package/es/lowcode/view/lc-components/Split/index.js +21 -0
- package/es/lowcode/view/lc-components/Split/meta.json +72 -0
- package/es/lowcode/view/lc-components/Table/index.js +23 -0
- package/es/lowcode/view/lc-components/Table/meta.json +162 -0
- package/es/lowcode/view/lc-components/Tabs/index.js +21 -0
- package/es/lowcode/view/lc-components/Tabs/meta.json +141 -0
- package/es/lowcode/view/lc-components/Text/index.js +23 -0
- package/es/lowcode/view/lc-components/Text/meta.json +66 -0
- package/es/lowcode/view/lc-components/Tree/index.js +20 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +157 -0
- package/es/lowcode/view/lc-components/Wrapper.js +52 -0
- package/es/lowcode/view/style/canvas.less +5 -0
- package/es/lowcode/view/style/loading.less +84 -0
- package/es/lowcode/view/style/page.less +5 -0
- package/es/upload/Form/gridForm.js +24 -6
- package/es/upload/Form/index.less +7 -7
- package/es/upload/FormItem/index.js +30 -18
- package/es/utils/form.js +22 -22
- package/es/utils/grid.js +2 -2
- package/lib/components/Builder/index.js +1 -1
- package/lib/components/LdGrid/index.js +4 -4
- package/lib/components/LdGridForm/index.less +7 -7
- package/lib/components/LdRuntimeCom/index.js +49 -0
- package/lib/components/LdTree/index.less +36 -36
- package/lib/helper/action.js +6 -6
- package/lib/helper/form.js +14 -14
- package/lib/helper/index.less +7 -7
- package/lib/index.js +9 -1
- package/lib/lowcode/constants/api-url.js +9 -0
- package/lib/lowcode/constants/event-topics.js +37 -0
- package/lib/lowcode/constants/index.js +18 -0
- package/lib/lowcode/engine/factory/DataFactory.js +3 -0
- package/lib/lowcode/engine/factory/panel-item-factory/DynamicStrategy.js +73 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SegmentedStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/Strategy.js +27 -0
- package/lib/lowcode/engine/factory/panel-item-factory/StringStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/index.js +46 -0
- package/lib/lowcode/engine/meta/box.props.default.json +10 -0
- package/lib/lowcode/engine/meta/box.props.json +40 -0
- package/lib/lowcode/engine/meta/button.props.default.json +16 -0
- package/lib/lowcode/engine/meta/button.props.json +117 -0
- package/lib/lowcode/engine/meta/cardlist.props.default.json +18 -0
- package/lib/lowcode/engine/meta/cardlist.props.json +144 -0
- package/lib/lowcode/engine/meta/components-list.json +128 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +19 -0
- package/lib/lowcode/engine/meta/dialog.props.json +121 -0
- package/lib/lowcode/engine/meta/drawer.props.default.json +18 -0
- package/lib/lowcode/engine/meta/drawer.props.json +144 -0
- package/lib/lowcode/engine/meta/form.props.default.json +13 -0
- package/lib/lowcode/engine/meta/form.props.json +117 -0
- package/lib/lowcode/engine/meta/iframe.props.default.json +11 -0
- package/lib/lowcode/engine/meta/iframe.props.json +32 -0
- package/lib/lowcode/engine/meta/image.props.default.json +16 -0
- package/lib/lowcode/engine/meta/image.props.json +114 -0
- package/lib/lowcode/engine/meta/imex.props.default.json +12 -0
- package/lib/lowcode/engine/meta/imex.props.json +82 -0
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +29 -0
- package/lib/lowcode/engine/meta/jsx.props.default.json +10 -0
- package/lib/lowcode/engine/meta/jsx.props.json +25 -0
- package/lib/lowcode/engine/meta/layout.props.default.json +13 -0
- package/lib/lowcode/engine/meta/layout.props.json +108 -0
- package/lib/lowcode/engine/meta/link.props.default.json +14 -0
- package/lib/lowcode/engine/meta/link.props.json +112 -0
- package/lib/lowcode/engine/meta/section.props.default.json +17 -0
- package/lib/lowcode/engine/meta/section.props.json +108 -0
- package/lib/lowcode/engine/meta/split.props.default.json +13 -0
- package/lib/lowcode/engine/meta/split.props.json +72 -0
- package/lib/lowcode/engine/meta/table.props.default.json +18 -0
- package/lib/lowcode/engine/meta/table.props.json +162 -0
- package/lib/lowcode/engine/meta/tabs.props.default.json +18 -0
- package/lib/lowcode/engine/meta/tabs.props.json +141 -0
- package/lib/lowcode/engine/meta/text.props.default.json +12 -0
- package/lib/lowcode/engine/meta/text.props.json +66 -0
- package/lib/lowcode/engine/meta/tree.props.default.json +17 -0
- package/lib/lowcode/engine/meta/tree.props.json +157 -0
- package/lib/lowcode/engine/provider/ContextProvider.js +173 -0
- package/lib/lowcode/engine/provider/EventBusProvider.js +128 -0
- package/lib/lowcode/engine/tools/dataProcess.js +277 -0
- package/lib/lowcode/engine/tools/helper.js +11 -0
- package/lib/lowcode/engine/tools/lcid.js +22 -0
- package/lib/lowcode/index.js +20 -0
- package/lib/lowcode/painter/Components.js +112 -0
- package/lib/lowcode/painter/Design.js +218 -0
- package/lib/lowcode/painter/I18n.js +209 -0
- package/lib/lowcode/painter/Outline.js +216 -0
- package/lib/lowcode/painter/Panel.js +203 -0
- package/lib/lowcode/painter/Ribbon.js +150 -0
- package/lib/lowcode/painter/components/PanelItem.js +41 -0
- package/lib/lowcode/painter/components/PopConfirm.js +26 -0
- package/lib/lowcode/painter/components/PopForm.js +77 -0
- package/lib/lowcode/painter/components/RuleInput.js +112 -0
- package/lib/lowcode/painter/components/SortBox.js +99 -0
- package/lib/lowcode/painter/components/TabEditor.js +94 -0
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +57 -0
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +88 -0
- package/lib/lowcode/painter/components/code-editor/index.js +20 -0
- package/lib/lowcode/painter/index.js +54 -0
- package/lib/lowcode/painter/panel-section/Icon.js +54 -0
- package/lib/lowcode/painter/panel-section/IconSelector.js +146 -0
- package/lib/lowcode/painter/panel-section/LayoutRatio.js +148 -0
- package/lib/lowcode/painter/panel-section/TabItems.js +246 -0
- package/lib/lowcode/painter/services/I18n.js +95 -0
- package/lib/lowcode/painter/style/components.less +90 -0
- package/lib/lowcode/painter/style/design.less +82 -0
- package/lib/lowcode/painter/style/icon-selector.less +22 -0
- package/lib/lowcode/painter/style/icon.less +11 -0
- package/lib/lowcode/painter/style/index.less +6 -0
- package/lib/lowcode/painter/style/layout-ratio.less +51 -0
- package/lib/lowcode/painter/style/outline.less +28 -0
- package/lib/lowcode/painter/style/panel-item.less +22 -0
- package/lib/lowcode/painter/style/panel.less +119 -0
- package/lib/lowcode/painter/style/pop-confirm.less +10 -0
- package/lib/lowcode/painter/style/pop-form.less +20 -0
- package/lib/lowcode/painter/style/radio.less +24 -0
- package/lib/lowcode/painter/style/ribbon.less +5 -0
- package/lib/lowcode/painter/style/rule-input.less +13 -0
- package/lib/lowcode/painter/style/tabeditor.less +90 -0
- package/lib/lowcode/painter/style/tabitems.less +90 -0
- package/lib/lowcode/view/Canvas.js +150 -0
- package/lib/lowcode/view/Loading.js +30 -0
- package/lib/lowcode/view/Page.js +259 -0
- package/lib/lowcode/view/index.js +25 -0
- package/lib/lowcode/view/lc-components/Box/index.js +32 -0
- package/lib/lowcode/view/lc-components/Box/meta.json +40 -0
- package/lib/lowcode/view/lc-components/Button/index.js +45 -0
- package/lib/lowcode/view/lc-components/Button/meta.json +117 -0
- package/lib/lowcode/view/lc-components/CardList/index.js +28 -0
- package/lib/lowcode/view/lc-components/CardList/meta.json +144 -0
- package/lib/lowcode/view/lc-components/Dialog/index.js +69 -0
- package/lib/lowcode/view/lc-components/Dialog/index.less +3 -0
- package/lib/lowcode/view/lc-components/Dialog/meta.json +121 -0
- package/lib/lowcode/view/lc-components/Drawer/index.js +70 -0
- package/lib/lowcode/view/lc-components/Drawer/meta.json +144 -0
- package/lib/lowcode/view/lc-components/Drawer/style.less +7 -0
- package/lib/lowcode/view/lc-components/Form/index.js +28 -0
- package/lib/lowcode/view/lc-components/Form/meta.json +117 -0
- package/lib/lowcode/view/lc-components/Iframe/index.js +28 -0
- package/lib/lowcode/view/lc-components/Iframe/meta.json +32 -0
- package/lib/lowcode/view/lc-components/ImEx/index.js +28 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +82 -0
- package/lib/lowcode/view/lc-components/Image/index.js +28 -0
- package/lib/lowcode/view/lc-components/Image/meta.json +114 -0
- package/lib/lowcode/view/lc-components/JSX/index.js +28 -0
- package/lib/lowcode/view/lc-components/JSX/meta.json +25 -0
- package/lib/lowcode/view/lc-components/Layout/index.js +106 -0
- package/lib/lowcode/view/lc-components/Layout/index.less +9 -0
- package/lib/lowcode/view/lc-components/Layout/meta.json +108 -0
- package/lib/lowcode/view/lc-components/Link/index.js +28 -0
- package/lib/lowcode/view/lc-components/Link/meta.json +112 -0
- package/lib/lowcode/view/lc-components/Section/index.js +42 -0
- package/lib/lowcode/view/lc-components/Section/meta.json +108 -0
- package/lib/lowcode/view/lc-components/Split/index.js +29 -0
- package/lib/lowcode/view/lc-components/Split/meta.json +72 -0
- package/lib/lowcode/view/lc-components/Table/index.js +31 -0
- package/lib/lowcode/view/lc-components/Table/meta.json +162 -0
- package/lib/lowcode/view/lc-components/Tabs/index.js +29 -0
- package/lib/lowcode/view/lc-components/Tabs/meta.json +141 -0
- package/lib/lowcode/view/lc-components/Text/index.js +31 -0
- package/lib/lowcode/view/lc-components/Text/meta.json +66 -0
- package/lib/lowcode/view/lc-components/Tree/index.js +28 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +157 -0
- package/lib/lowcode/view/lc-components/Wrapper.js +59 -0
- package/lib/lowcode/view/style/canvas.less +5 -0
- package/lib/lowcode/view/style/loading.less +84 -0
- package/lib/lowcode/view/style/page.less +5 -0
- package/lib/upload/Form/gridForm.js +22 -4
- package/lib/upload/Form/index.less +7 -7
- package/lib/upload/FormItem/index.js +29 -17
- package/lib/utils/form.js +22 -22
- package/lib/utils/grid.js +2 -2
- package/lowcode.js +1 -0
- package/package.json +163 -151
- package/upload.js +1 -1
- package/utils.js +1 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "Tabs",
|
|
3
|
+
"name": "选项卡",
|
|
4
|
+
"icon": "icon-tabs",
|
|
5
|
+
"group": "container",
|
|
6
|
+
"groupName": "布局",
|
|
7
|
+
"desc": "用于显示多个相关内容并提供切换功能。它包含了标签项、形态、大小等配置选项,使用户能够创建具有选项卡切换功能的界面,并根据需要自定义选项卡的外观和尺寸。",
|
|
8
|
+
"order": 1,
|
|
9
|
+
"props": [
|
|
10
|
+
{
|
|
11
|
+
"key": "fieldId",
|
|
12
|
+
"name": "唯一标识",
|
|
13
|
+
"desc": "组件的唯一标识符,不能够与其它组件重名,不能够为空,且只能够使用以字母开头的,下划线以及数字的组合",
|
|
14
|
+
"type": "string",
|
|
15
|
+
"disabled": true
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"key": "items",
|
|
19
|
+
"name": "标签项",
|
|
20
|
+
"desc": "表示标签项或选项卡的集合",
|
|
21
|
+
"type": "_TabsItems",
|
|
22
|
+
"default": []
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"key": "shape",
|
|
26
|
+
"name": "形态",
|
|
27
|
+
"desc": "表示选项卡的形态或外观样式",
|
|
28
|
+
"type": "radio",
|
|
29
|
+
"options": [
|
|
30
|
+
{
|
|
31
|
+
"label": "普通型",
|
|
32
|
+
"value": "pure"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"label": "包裹型",
|
|
36
|
+
"value": "wrapped"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"label": "文本型",
|
|
40
|
+
"value": "text"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"label": "胶囊型",
|
|
44
|
+
"value": "capsule"
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
"default": "pure"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"key": "size",
|
|
51
|
+
"name": "大小",
|
|
52
|
+
"desc": "表示选项卡的形态或外观样式",
|
|
53
|
+
"type": "radio",
|
|
54
|
+
"options": [
|
|
55
|
+
{
|
|
56
|
+
"label": "小",
|
|
57
|
+
"value": "small"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"label": "中",
|
|
61
|
+
"value": "default"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"default": "default"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"key": "contentPadding",
|
|
68
|
+
"name": "内容间距",
|
|
69
|
+
"desc": "设定内容区的内间距,请输入合理的CSS padding值",
|
|
70
|
+
"type": "string",
|
|
71
|
+
"default": "20px 20px"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"key": "excessMode",
|
|
75
|
+
"name": "选项卡过多时的滑动模式",
|
|
76
|
+
"desc": "表示选项卡过多时的滑动模式",
|
|
77
|
+
"type": "radio",
|
|
78
|
+
"options": [
|
|
79
|
+
{
|
|
80
|
+
"label": "滑动",
|
|
81
|
+
"value": "slide"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"label": "下拉",
|
|
85
|
+
"value": "dropdown"
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
"default": "slide"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"key": "unmountInactiveTabs",
|
|
92
|
+
"name": "切换销毁",
|
|
93
|
+
"desc": "表示选项卡切换时是否销毁非活动选项卡的内容",
|
|
94
|
+
"type": "boolean",
|
|
95
|
+
"default": false
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"key": "lazyLoad",
|
|
99
|
+
"name": "延迟加载",
|
|
100
|
+
"desc": "表示选项卡的延迟加载行为",
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"default": false
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"key": "needBadge",
|
|
106
|
+
"name": "开启徽标",
|
|
107
|
+
"desc": "表示选项卡是否开启徽标",
|
|
108
|
+
"type": "boolean",
|
|
109
|
+
"default": false
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"style": {},
|
|
113
|
+
"advance": {
|
|
114
|
+
"events": [
|
|
115
|
+
{
|
|
116
|
+
"key": "onMount",
|
|
117
|
+
"name": "组件首次渲染时",
|
|
118
|
+
"desc": "在组件首次渲染时,执行方法",
|
|
119
|
+
"func": "(params)=>{\n\t\n}"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"key": "onUnmount",
|
|
123
|
+
"name": "组件卸载时",
|
|
124
|
+
"desc": "在组件卸载时,执行方法。",
|
|
125
|
+
"func": "(params)=>{\n\t\n}"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"key": "renderBadge",
|
|
129
|
+
"name": "徽标渲染",
|
|
130
|
+
"desc": "当needBadge为true时可配置。徽标渲染方法",
|
|
131
|
+
"func": "(tabItem)=>{\n\t\n}"
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"key": "onExtraRender",
|
|
135
|
+
"name": "渲染导航栏附加内容",
|
|
136
|
+
"desc": "渲染导航栏附加内容方法",
|
|
137
|
+
"func": "(activeTab)=>{\n\t\n}"
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "Text",
|
|
3
|
+
"name": "文本",
|
|
4
|
+
"icon": "icon-text",
|
|
5
|
+
"group": "basic",
|
|
6
|
+
"groupName": "基础",
|
|
7
|
+
"desc": "文本组件用于显示文本内容。",
|
|
8
|
+
"order": 1,
|
|
9
|
+
"props": [
|
|
10
|
+
{
|
|
11
|
+
"key": "id",
|
|
12
|
+
"desc": "唯一标识",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"disabled": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"key": "content",
|
|
18
|
+
"name": "内容",
|
|
19
|
+
"desc": "文本内容设置",
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"key": "showTitle",
|
|
24
|
+
"name": "显示标题",
|
|
25
|
+
"desc": "是否显示标题",
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"key": "title",
|
|
31
|
+
"name": "自定义标题",
|
|
32
|
+
"desc": "显示标题时配置。自定义标题内容",
|
|
33
|
+
"type": "string"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"key": "maxLine",
|
|
37
|
+
"name": "最大行数",
|
|
38
|
+
"desc": "超出时自动省略号展示",
|
|
39
|
+
"type": "number",
|
|
40
|
+
"default": 0
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"style": {},
|
|
44
|
+
"advance": {
|
|
45
|
+
"events": [
|
|
46
|
+
{
|
|
47
|
+
"key": "onMount",
|
|
48
|
+
"name": "组件首次渲染时",
|
|
49
|
+
"desc": "在组件首次渲染时,执行方法",
|
|
50
|
+
"func": "(params)=>{\n\t\n}"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"key": "onUnmount",
|
|
54
|
+
"name": "组件卸载时",
|
|
55
|
+
"desc": "在组件卸载时,执行方法。",
|
|
56
|
+
"func": "(params)=>{\n\t\n}"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"key": "onClick",
|
|
60
|
+
"name": "点击事件",
|
|
61
|
+
"desc": "点击文本时,执行方法",
|
|
62
|
+
"func": "(e)=>{\n\t\n}"
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "Tree",
|
|
3
|
+
"name": "树",
|
|
4
|
+
"desc": "用于展示和管理具有层级结构的数据。它提供了层级结构、节点展开/折叠、节点选择、节点操作和展示样式等功能和配置选项,使用户能够轻松创建和管理树结构。",
|
|
5
|
+
"icon": "icon-tree",
|
|
6
|
+
"group": "advance",
|
|
7
|
+
"groupName": "高级",
|
|
8
|
+
"order": 1,
|
|
9
|
+
"style": {},
|
|
10
|
+
"showLine": false,
|
|
11
|
+
"lazyLoad": false,
|
|
12
|
+
"editable": false,
|
|
13
|
+
"draggable": false,
|
|
14
|
+
"defaultExpandDeep": 1,
|
|
15
|
+
"doubleClick": true,
|
|
16
|
+
"multiple": false
|
|
17
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
{
|
|
2
|
+
"component": "Tree",
|
|
3
|
+
"name": "树",
|
|
4
|
+
"desc": "用于展示和管理具有层级结构的数据。它提供了层级结构、节点展开/折叠、节点选择、节点操作和展示样式等功能和配置选项,使用户能够轻松创建和管理树结构。",
|
|
5
|
+
"icon": "icon-tree",
|
|
6
|
+
"group": "advance",
|
|
7
|
+
"groupName": "高级",
|
|
8
|
+
"order": 1,
|
|
9
|
+
"props": [
|
|
10
|
+
{
|
|
11
|
+
"key": "id",
|
|
12
|
+
"desc": "唯一标识",
|
|
13
|
+
"type": "string",
|
|
14
|
+
"disabled": true
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"key": "dateset",
|
|
18
|
+
"name": "数据集",
|
|
19
|
+
"desc": "选择系统中的可用树形数据集",
|
|
20
|
+
"type": "_DataSetSelector"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"key": "showLine",
|
|
24
|
+
"name": "显示线",
|
|
25
|
+
"desc": "是否显示树组件的连接线",
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"default": false
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"key": "lazyLoad",
|
|
31
|
+
"name": "懒加载",
|
|
32
|
+
"desc": "是否树形组件懒加载",
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"default": false
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"key": "editable",
|
|
38
|
+
"name": "支持编辑",
|
|
39
|
+
"desc": "是否支持编辑树",
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"default": false
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"key": "draggable",
|
|
45
|
+
"name": "支持拖拽",
|
|
46
|
+
"desc": "是否支持拖拽",
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"default": false
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"key": "defaultExpandDeep",
|
|
52
|
+
"name": "默认展开层级",
|
|
53
|
+
"desc": "默认展开多少层级",
|
|
54
|
+
"type": "select",
|
|
55
|
+
"options": [
|
|
56
|
+
{
|
|
57
|
+
"label": "1",
|
|
58
|
+
"value": "1"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"label": "2",
|
|
62
|
+
"value": "2"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"label": "3",
|
|
66
|
+
"value": "3"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"label": "4",
|
|
70
|
+
"value": "4"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"label": "5",
|
|
74
|
+
"value": "5"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"label": "全部",
|
|
78
|
+
"value": "all"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"default": 1
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"key": "rowKey",
|
|
85
|
+
"name": "数据主键key",
|
|
86
|
+
"desc": "数据主键",
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"key": "actions",
|
|
91
|
+
"name": "操作项",
|
|
92
|
+
"desc": "单行操作项",
|
|
93
|
+
"type": "_ActionSelector"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"key": "doubleClick",
|
|
97
|
+
"name": "开启双击事件",
|
|
98
|
+
"desc": "是否开启双击事件(默认双击收缩节点)",
|
|
99
|
+
"type": "boolean",
|
|
100
|
+
"default": true
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"key": "multiple",
|
|
104
|
+
"name": "多选",
|
|
105
|
+
"desc": "是否支持多选",
|
|
106
|
+
"type": "boolean",
|
|
107
|
+
"default": false
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"style": {},
|
|
111
|
+
"advance": {
|
|
112
|
+
"events": [
|
|
113
|
+
{
|
|
114
|
+
"key": "onMount",
|
|
115
|
+
"name": "组件首次渲染时",
|
|
116
|
+
"desc": "在组件首次渲染时,执行方法",
|
|
117
|
+
"func": "(params)=>{\n\t\n}"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"key": "onUnmount",
|
|
121
|
+
"name": "组件卸载时",
|
|
122
|
+
"desc": "在组件卸载时,执行方法。",
|
|
123
|
+
"func": "(params)=>{\n\t\n}"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"key": "processDataSource",
|
|
127
|
+
"name": "数据预处理",
|
|
128
|
+
"desc": "数据渲染前预处理",
|
|
129
|
+
"func": "(data)=>{\n\t\n}"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"key": "onTreeNodeRender",
|
|
133
|
+
"name": "定制渲染",
|
|
134
|
+
"desc": "单行树节点渲染",
|
|
135
|
+
"func": "(title, rowData)=>{\n\t\n}"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"key": "unSelectableNodes",
|
|
139
|
+
"name": "失活节点",
|
|
140
|
+
"desc": "不可选择的节点",
|
|
141
|
+
"func": "(data)=>{\n\t\n}"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"key": "onRightMenus",
|
|
145
|
+
"name": "定制渲染",
|
|
146
|
+
"desc": "返回为false时,该操作不可见",
|
|
147
|
+
"func": "(title, rowData)=>{\n\t\n}"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"key": "onDoubleClick",
|
|
151
|
+
"name": "自定义双击事件",
|
|
152
|
+
"desc": "自定义双击事件,默认为收缩节点",
|
|
153
|
+
"func": "(rowData)=>{\n\t\n}"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import React, { createContext, useContext, useRef } from 'react';
|
|
4
|
+
import { history } from 'umi';
|
|
5
|
+
import { useMemoizedFn, useSafeState } from 'ahooks';
|
|
6
|
+
import { useLDEventBus } from "./EventBusProvider";
|
|
7
|
+
import * as topics from "../../constants/event-topics";
|
|
8
|
+
export var Context = /*#__PURE__*/createContext(null);
|
|
9
|
+
export var useLDContext = function useLDContext() {
|
|
10
|
+
return useContext(Context);
|
|
11
|
+
};
|
|
12
|
+
var PRIVATE_KEYS = ['pageCode', 'moduleCode', 'componentList', 'componentMap'];
|
|
13
|
+
export default (function (_ref) {
|
|
14
|
+
var children = _ref.children;
|
|
15
|
+
var eventBus = useLDEventBus();
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 页面码
|
|
19
|
+
*/
|
|
20
|
+
var _pageCode = useRef(void 0);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 模块码
|
|
24
|
+
*/
|
|
25
|
+
var _moduleCode = useRef(void 0);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 页面数据
|
|
29
|
+
*/
|
|
30
|
+
var _useSafeState = useSafeState(null),
|
|
31
|
+
_useSafeState2 = _slicedToArray(_useSafeState, 2),
|
|
32
|
+
pageData = _useSafeState2[0],
|
|
33
|
+
_setPageData = _useSafeState2[1];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 组件列表
|
|
37
|
+
*/
|
|
38
|
+
var _componentList = useRef([]);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 组件id与组件的映射
|
|
42
|
+
*/
|
|
43
|
+
var _componentMap = useRef(new Map());
|
|
44
|
+
var _privateGetter = useRef({
|
|
45
|
+
pageCode: function pageCode() {
|
|
46
|
+
return _pageCode.current;
|
|
47
|
+
},
|
|
48
|
+
moduleCode: function moduleCode() {
|
|
49
|
+
return _moduleCode.current;
|
|
50
|
+
},
|
|
51
|
+
componentList: function componentList() {
|
|
52
|
+
return _componentList.current;
|
|
53
|
+
},
|
|
54
|
+
componentMap: function componentMap() {
|
|
55
|
+
return _componentMap.current;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 注册组件
|
|
61
|
+
* id:string 组件id
|
|
62
|
+
* component:ReactNode 组件
|
|
63
|
+
*/
|
|
64
|
+
var register = useMemoizedFn(function (id, component) {
|
|
65
|
+
_componentMap.current.set(id, component);
|
|
66
|
+
_componentList.current.push([id, component]);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 注销组件
|
|
71
|
+
* id:string 组件id
|
|
72
|
+
*/
|
|
73
|
+
var unregister = useMemoizedFn(function (id) {
|
|
74
|
+
_componentMap.current.delete(id);
|
|
75
|
+
_componentList.current = _componentList.current.filter(function (_ref2) {
|
|
76
|
+
var _ref3 = _slicedToArray(_ref2, 1),
|
|
77
|
+
_id = _ref3[0];
|
|
78
|
+
return _id !== id;
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 根据组件id获取组件
|
|
84
|
+
* compId:string 组件id
|
|
85
|
+
* return:ReactNode
|
|
86
|
+
*/
|
|
87
|
+
var getElementById = useMemoizedFn(function (compId) {});
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* 根据组件id获取父组件
|
|
91
|
+
* compId:string 组件id
|
|
92
|
+
* return:ReactNode
|
|
93
|
+
*/
|
|
94
|
+
var getParentElement = useMemoizedFn(function (compId) {});
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 根据组件id获取组件路径
|
|
98
|
+
* compId:string 组件id
|
|
99
|
+
* return:ReactNode
|
|
100
|
+
*/
|
|
101
|
+
var getElementPathById = useMemoizedFn(function (compId) {});
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* 获取当前模块数据
|
|
105
|
+
* return:Object
|
|
106
|
+
*/
|
|
107
|
+
var getModule = useMemoizedFn(function () {});
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* 根据datasetId获取数据集
|
|
111
|
+
* datasetId:string 数据集id
|
|
112
|
+
* return:Object
|
|
113
|
+
*/
|
|
114
|
+
var getDataSetById = useMemoizedFn(function (datasetId) {});
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 执行actionKey对应的行为
|
|
118
|
+
* actionKey:string 行为key
|
|
119
|
+
* return:Promise
|
|
120
|
+
*/
|
|
121
|
+
var doAction = useMemoizedFn(function (actionKey) {});
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* 获取url参数
|
|
125
|
+
* return:object
|
|
126
|
+
*/
|
|
127
|
+
var getUrlParams = useMemoizedFn(function () {});
|
|
128
|
+
return /*#__PURE__*/React.createElement(Context.Provider, {
|
|
129
|
+
value: new Proxy(_objectSpread({
|
|
130
|
+
_pageCode: _pageCode,
|
|
131
|
+
_moduleCode: _moduleCode,
|
|
132
|
+
_setPageData: _setPageData,
|
|
133
|
+
_componentList: _componentList,
|
|
134
|
+
_componentMap: _componentMap,
|
|
135
|
+
pageData: pageData,
|
|
136
|
+
history: history,
|
|
137
|
+
topics: topics,
|
|
138
|
+
register: register,
|
|
139
|
+
unregister: unregister,
|
|
140
|
+
getElementById: getElementById,
|
|
141
|
+
getParentElement: getParentElement,
|
|
142
|
+
getElementPathById: getElementPathById,
|
|
143
|
+
getModule: getModule,
|
|
144
|
+
getDataSetById: getDataSetById,
|
|
145
|
+
doAction: doAction,
|
|
146
|
+
getUrlParams: getUrlParams
|
|
147
|
+
}, eventBus), {
|
|
148
|
+
get: function get(target, property, receiver) {
|
|
149
|
+
if (PRIVATE_KEYS.includes(property)) {
|
|
150
|
+
var _privateGetter$curren;
|
|
151
|
+
return (_privateGetter$curren = _privateGetter.current) === null || _privateGetter$curren === void 0 ? void 0 : _privateGetter$curren[property]();
|
|
152
|
+
}
|
|
153
|
+
return Reflect.get(target, property, receiver);
|
|
154
|
+
},
|
|
155
|
+
set: function set(target, property, receiver) {
|
|
156
|
+
console.log('set', target, property, receiver);
|
|
157
|
+
if (PRIVATE_KEYS.includes(property)) {
|
|
158
|
+
throw new Error("\u5C5E\u6027 \"".concat(property, "\" \u662F\u53EA\u8BFB\u7684"));
|
|
159
|
+
} else {
|
|
160
|
+
return Reflect.set(target, property, receiver);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
}, children);
|
|
165
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["topic"];
|
|
5
|
+
import React, { createContext, useContext } from 'react';
|
|
6
|
+
import { useEventEmitter, useCreation, useMemoizedFn } from 'ahooks';
|
|
7
|
+
import lcid from "../tools/lcid";
|
|
8
|
+
import { isPromise } from "../tools/helper";
|
|
9
|
+
export var EventBus = /*#__PURE__*/createContext(null);
|
|
10
|
+
export var useLDEventBus = function useLDEventBus() {
|
|
11
|
+
return useContext(EventBus);
|
|
12
|
+
};
|
|
13
|
+
function Subscriber(id) {
|
|
14
|
+
function on(hook) {
|
|
15
|
+
this._on = hook;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
function once(hook) {
|
|
19
|
+
this._once = hook;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
function before(hook) {
|
|
23
|
+
this._before = hook;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
function after(hook) {
|
|
27
|
+
this._after = hook;
|
|
28
|
+
return this;
|
|
29
|
+
}
|
|
30
|
+
function off(hook) {
|
|
31
|
+
this._off = hook;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
function watch() {
|
|
35
|
+
return id;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
on: on,
|
|
39
|
+
once: once,
|
|
40
|
+
before: before,
|
|
41
|
+
after: after,
|
|
42
|
+
off: off,
|
|
43
|
+
watch: watch
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
export default (function (_ref) {
|
|
47
|
+
var children = _ref.children,
|
|
48
|
+
runtime = _ref.runtime;
|
|
49
|
+
var event$ = useEventEmitter();
|
|
50
|
+
var subscriberPool = useCreation(function () {
|
|
51
|
+
return new Map();
|
|
52
|
+
}, []);
|
|
53
|
+
event$.useSubscription(function (_ref2) {
|
|
54
|
+
var topic = _ref2.topic,
|
|
55
|
+
payload = _objectWithoutProperties(_ref2, _excluded);
|
|
56
|
+
if (!subscriberPool.has(topic)) return;
|
|
57
|
+
subscriberPool.get(topic).forEach(function (_ref3) {
|
|
58
|
+
var _ref4 = _slicedToArray(_ref3, 2),
|
|
59
|
+
_id = _ref4[0],
|
|
60
|
+
_subscriber = _ref4[1];
|
|
61
|
+
var temp = _subscriber._before ? _subscriber._before(payload) : null;
|
|
62
|
+
if (_subscriber._before && !isPromise(temp)) {
|
|
63
|
+
console.error('before hook must return a promise');
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
var _before = temp || Promise.resolve(true);
|
|
67
|
+
_before.then(function (flag) {
|
|
68
|
+
if (!flag) return flag;
|
|
69
|
+
var func = _subscriber._once || _subscriber._on;
|
|
70
|
+
if (!func) return;
|
|
71
|
+
return func(payload);
|
|
72
|
+
}).then(function (flag) {
|
|
73
|
+
if (flag === false || !_subscriber._after) return;
|
|
74
|
+
return _subscriber._after(payload);
|
|
75
|
+
}).finally(function () {
|
|
76
|
+
if (_subscriber._once) {
|
|
77
|
+
$unsubscriber(topic, _id);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
var $publisher = useMemoizedFn(function (topic, payload) {
|
|
83
|
+
event$.emit(_objectSpread({
|
|
84
|
+
topic: topic,
|
|
85
|
+
runtime: runtime
|
|
86
|
+
}, payload));
|
|
87
|
+
});
|
|
88
|
+
var $subscriber = useMemoizedFn(function (topic) {
|
|
89
|
+
if (!subscriberPool.has(topic)) subscriberPool.set(topic, []);
|
|
90
|
+
var id = lcid();
|
|
91
|
+
var _subscriber = Subscriber(id);
|
|
92
|
+
subscriberPool.get(topic).push([id, _subscriber]);
|
|
93
|
+
return _subscriber;
|
|
94
|
+
});
|
|
95
|
+
var $unsubscriber = useMemoizedFn(function (topic, id) {
|
|
96
|
+
if (!subscriberPool.has(topic)) return;
|
|
97
|
+
subscriberPool.get(topic).forEach(function (_ref5, index) {
|
|
98
|
+
var _ref6 = _slicedToArray(_ref5, 2),
|
|
99
|
+
_id = _ref6[0],
|
|
100
|
+
_subscriber = _ref6[1];
|
|
101
|
+
if (_id === id) {
|
|
102
|
+
var _subscriber$_off, _subscriber2;
|
|
103
|
+
subscriberPool.get(topic).splice(index, 1);
|
|
104
|
+
if (!subscriberPool.get(topic).length) {
|
|
105
|
+
subscriberPool.delete(topic);
|
|
106
|
+
}
|
|
107
|
+
(_subscriber$_off = (_subscriber2 = _subscriber)._off) === null || _subscriber$_off === void 0 || _subscriber$_off.call(_subscriber2);
|
|
108
|
+
_subscriber = null;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
return /*#__PURE__*/React.createElement(EventBus.Provider, {
|
|
113
|
+
value: {
|
|
114
|
+
runtime: runtime,
|
|
115
|
+
$publisher: $publisher,
|
|
116
|
+
$subscriber: $subscriber,
|
|
117
|
+
$unsubscriber: $unsubscriber
|
|
118
|
+
}
|
|
119
|
+
}, children);
|
|
120
|
+
});
|