@luck-design-biz/luckda 0.0.25-6 → 0.0.25-8
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/es/components/LDActions/index.js +8 -10
- package/es/components/LDActions/index.less +7 -4
- package/es/components/LdAutoForm/index.js +26 -8
- package/es/components/LdFormList/index.js +37 -22
- package/es/components/LdGrid/index.js +14 -7
- package/es/components/LdGridForm/index.js +18 -6
- package/es/components/LdTree/index.js +33 -15
- package/es/helper/form.js +15 -8
- package/es/locales/zh-CN.js +16 -10
- package/es/lowcode/constants/api-url.js +120 -32
- package/es/lowcode/constants/event-topics.js +2 -0
- package/es/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
- package/es/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- package/es/lowcode/engine/meta/box.props.json +3 -3
- package/es/lowcode/engine/meta/button.props.json +3 -3
- package/es/lowcode/engine/meta/components-list.json +6 -0
- package/es/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/es/lowcode/engine/meta/dialog.props.json +72 -42
- package/es/lowcode/engine/meta/drawer.props.json +8 -20
- package/es/lowcode/engine/meta/form.props.json +16 -10
- package/es/lowcode/engine/meta/imex.props.default.json +8 -1
- package/es/lowcode/engine/meta/imex.props.json +54 -22
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/es/lowcode/engine/meta/layout.props.json +2 -2
- package/es/lowcode/engine/meta/page.props.json +2 -2
- package/es/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/es/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/es/lowcode/engine/meta/section.props.json +2 -2
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +4 -4
- package/es/lowcode/engine/meta/table.props.json +17 -11
- package/es/lowcode/engine/meta/tabs.props.json +3 -3
- package/es/lowcode/engine/meta/tree.props.default.json +2 -0
- package/es/lowcode/engine/meta/tree.props.json +62 -6
- package/es/lowcode/engine/provider/ContextProvider/index.js +20 -43
- package/es/lowcode/engine/provider/RemoteSourceProvider.js +69 -24
- package/es/lowcode/engine/tools/dataProcess.js +4 -0
- package/es/lowcode/engine/tools/helper.js +2 -3
- package/es/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/es/lowcode/engine/tools/usePageDataStore.js +176 -0
- package/es/lowcode/engine/tools/usePromiseState.js +12 -23
- package/es/lowcode/engine/tools/useTodo.js +20 -10
- package/es/lowcode/painter/DesignOperator.js +12 -23
- package/es/lowcode/painter/DesignToolbar.js +10 -45
- package/es/lowcode/painter/Outline.js +2 -4
- package/es/lowcode/painter/Panel.js +29 -28
- package/es/lowcode/painter/components/ActionBindModal.js +30 -24
- package/es/lowcode/painter/components/AdvancePanel.js +6 -1
- package/es/lowcode/painter/components/AttrsPanel.js +38 -29
- package/es/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/es/lowcode/painter/components/field-setting/CheckFrontRules.js +108 -0
- package/es/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/es/lowcode/painter/components/field-setting/FieldRulesModal.js +33 -13
- package/es/lowcode/painter/components/field-setting/SettingUI.js +162 -30
- package/es/lowcode/painter/components/field-setting/index.js +32 -63
- package/es/lowcode/painter/components/field-setting/meta/frontRules.js +53 -0
- package/es/lowcode/painter/panel-section/BlocksEditor/index.js +14 -17
- package/es/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/es/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/es/lowcode/painter/panel-section/FieldsSetting.js +53 -8
- package/es/lowcode/painter/panel-section/ImpExp.js +93 -6
- package/es/lowcode/painter/panel-section/ImpExpAlone.js +109 -0
- package/es/lowcode/painter/panel-section/PageLayoutDisplay.js +95 -0
- package/es/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/es/lowcode/painter/panel-section/SplitDisplay.js +25 -110
- package/es/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/es/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/es/lowcode/painter/style/action-bind-modal.less +3 -3
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/page-layout-display.less +28 -0
- package/es/lowcode/painter/style/panel-item.less +1 -1
- package/es/lowcode/painter/style/split-display.less +0 -9
- package/es/lowcode/preview/index.js +4 -2
- package/es/lowcode/view/Canvas.js +6 -7
- package/es/lowcode/view/Page.js +2 -3
- package/es/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/es/lowcode/view/lc-components/Box/meta.json +3 -3
- package/es/lowcode/view/lc-components/Button/index.js +2 -6
- package/es/lowcode/view/lc-components/Button/meta.json +3 -3
- package/es/lowcode/view/lc-components/Dialog/FunctionDesign.js +3 -10
- package/es/lowcode/view/lc-components/Dialog/index.js +114 -19
- package/es/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/es/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/es/lowcode/view/lc-components/Form/FunctionDesign.js +23 -33
- package/es/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/es/lowcode/view/lc-components/Form/index.js +113 -21
- package/es/lowcode/view/lc-components/Form/meta.json +16 -10
- package/es/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/es/lowcode/view/lc-components/ImEx/index.js +260 -10
- package/es/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/es/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +12 -19
- package/es/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/es/lowcode/view/lc-components/Page/meta.json +2 -2
- package/es/lowcode/view/lc-components/PageContent/index.js +8 -9
- package/es/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/es/lowcode/view/lc-components/PageHeader/index.js +5 -6
- package/es/lowcode/view/lc-components/PageLayout/FunctionDesign.js +63 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionLive.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/FunctionPreview.js +10 -0
- package/es/lowcode/view/lc-components/PageLayout/index.js +32 -0
- package/es/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/es/lowcode/view/lc-components/PageModal/index.js +12 -15
- package/es/lowcode/view/lc-components/Section/FunctionDesign.js +3 -9
- package/es/lowcode/view/lc-components/Section/meta.json +2 -2
- package/es/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
- package/es/lowcode/view/lc-components/Split/index.js +5 -9
- package/es/lowcode/view/lc-components/Split/meta.json +4 -4
- package/es/lowcode/view/lc-components/Table/components/TopImex.js +138 -0
- package/es/lowcode/view/lc-components/Table/index.js +124 -39
- package/es/lowcode/view/lc-components/Table/meta.json +17 -11
- package/es/lowcode/view/lc-components/Tabs/FunctionDesign.js +10 -17
- package/es/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/es/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/es/lowcode/view/lc-components/Tree/index.js +67 -18
- package/es/lowcode/view/lc-components/Tree/meta.json +62 -7
- package/es/lowcode/view/lc-components/Wrapper.js +9 -11
- package/es/services.js +0 -24
- package/es/upload/FilesWall/file.png +0 -0
- package/es/upload/FilesWall/index.js +422 -0
- package/es/upload/FilesWall/index.less +74 -0
- package/es/upload/Form/index.js +2 -1
- package/es/upload/FormItem/index.js +3 -5
- package/es/upload/index.js +2 -1
- package/es/utils/action.js +2 -2
- package/lib/components/LDActions/index.js +7 -9
- package/lib/components/LDActions/index.less +7 -4
- package/lib/components/LdAutoForm/index.js +25 -7
- package/lib/components/LdFormList/index.js +36 -21
- package/lib/components/LdGrid/index.js +14 -7
- package/lib/components/LdGridForm/index.js +16 -4
- package/lib/components/LdTree/index.js +33 -15
- package/lib/helper/form.js +14 -7
- package/lib/locales/zh-CN.js +16 -10
- package/lib/lowcode/constants/api-url.js +123 -32
- package/lib/lowcode/constants/event-topics.js +3 -1
- package/lib/lowcode/engine/factory/panel-item-factory/SelectStrategy.js +4 -2
- package/lib/lowcode/engine/factory/panel-item-factory/SwitchStrategy.js +4 -2
- package/lib/lowcode/engine/meta/box.props.json +3 -3
- package/lib/lowcode/engine/meta/button.props.json +3 -3
- package/lib/lowcode/engine/meta/components-list.json +6 -0
- package/lib/lowcode/engine/meta/dialog.props.default.json +10 -5
- package/lib/lowcode/engine/meta/dialog.props.json +72 -42
- package/lib/lowcode/engine/meta/drawer.props.json +8 -20
- package/lib/lowcode/engine/meta/form.props.json +16 -10
- package/lib/lowcode/engine/meta/imex.props.default.json +8 -1
- package/lib/lowcode/engine/meta/imex.props.json +54 -22
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +53 -3
- package/lib/lowcode/engine/meta/layout.props.json +2 -2
- package/lib/lowcode/engine/meta/page.props.json +2 -2
- package/lib/lowcode/engine/meta/pagelayout.props.default.json +14 -0
- package/lib/lowcode/engine/meta/pagelayout.props.json +47 -0
- package/lib/lowcode/engine/meta/section.props.json +2 -2
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +4 -4
- package/lib/lowcode/engine/meta/table.props.json +17 -11
- package/lib/lowcode/engine/meta/tabs.props.json +3 -3
- package/lib/lowcode/engine/meta/tree.props.default.json +2 -0
- package/lib/lowcode/engine/meta/tree.props.json +62 -6
- package/lib/lowcode/engine/provider/ContextProvider/index.js +36 -43
- package/lib/lowcode/engine/provider/RemoteSourceProvider.js +68 -23
- package/lib/lowcode/engine/tools/dataProcess.js +4 -0
- package/lib/lowcode/engine/tools/helper.js +2 -3
- package/lib/lowcode/engine/tools/useCanvasRender.js +3 -2
- package/lib/lowcode/engine/tools/usePageDataStore.js +183 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +11 -21
- package/lib/lowcode/engine/tools/useTodo.js +19 -9
- package/lib/lowcode/painter/DesignOperator.js +11 -22
- package/lib/lowcode/painter/DesignToolbar.js +9 -44
- package/lib/lowcode/painter/Outline.js +1 -3
- package/lib/lowcode/painter/Panel.js +28 -27
- package/lib/lowcode/painter/components/ActionBindModal.js +28 -22
- package/lib/lowcode/painter/components/AdvancePanel.js +6 -1
- package/lib/lowcode/painter/components/AttrsPanel.js +37 -28
- package/lib/lowcode/painter/components/DragDrop/DragDropContext.js +1 -1
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +3 -2
- package/lib/lowcode/painter/components/field-setting/CheckFrontRules.js +116 -0
- package/lib/lowcode/painter/components/field-setting/CheckRules.js +1 -26
- package/lib/lowcode/painter/components/field-setting/FieldRulesModal.js +34 -13
- package/lib/lowcode/painter/components/field-setting/SettingUI.js +159 -27
- package/lib/lowcode/painter/components/field-setting/index.js +32 -63
- package/lib/lowcode/painter/components/field-setting/meta/frontRules.js +59 -0
- package/lib/lowcode/painter/panel-section/BlocksEditor/index.js +13 -16
- package/lib/lowcode/painter/panel-section/ButtonType.js +4 -2
- package/lib/lowcode/painter/panel-section/DataSetSelector.js +4 -1
- package/lib/lowcode/painter/panel-section/FieldsSetting.js +53 -8
- package/lib/lowcode/painter/panel-section/ImpExp.js +92 -5
- package/lib/lowcode/painter/panel-section/ImpExpAlone.js +115 -0
- package/lib/lowcode/painter/panel-section/PageLayoutDisplay.js +103 -0
- package/lib/lowcode/painter/panel-section/SerialsSelector.js +4 -2
- package/lib/lowcode/painter/panel-section/SplitDisplay.js +24 -109
- package/lib/lowcode/painter/panel-section/StylePanel/index.js +10 -4
- package/lib/lowcode/painter/panel-section/TreeRootEditor.js +2 -2
- package/lib/lowcode/painter/style/action-bind-modal.less +3 -3
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/page-layout-display.less +28 -0
- package/lib/lowcode/painter/style/panel-item.less +1 -1
- package/lib/lowcode/painter/style/split-display.less +0 -9
- package/lib/lowcode/preview/index.js +4 -2
- package/lib/lowcode/view/Canvas.js +5 -6
- package/lib/lowcode/view/Page.js +2 -3
- package/lib/lowcode/view/lc-components/Box/FunctionDesign.js +3 -2
- package/lib/lowcode/view/lc-components/Box/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Button/index.js +2 -6
- package/lib/lowcode/view/lc-components/Button/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Dialog/FunctionDesign.js +2 -9
- package/lib/lowcode/view/lc-components/Dialog/index.js +114 -19
- package/lib/lowcode/view/lc-components/Dialog/meta.json +65 -42
- package/lib/lowcode/view/lc-components/Drawer/meta.json +8 -20
- package/lib/lowcode/view/lc-components/Form/FunctionDesign.js +20 -31
- package/lib/lowcode/view/lc-components/Form/FunctionPreview.js +8 -1
- package/lib/lowcode/view/lc-components/Form/index.js +110 -18
- package/lib/lowcode/view/lc-components/Form/meta.json +16 -10
- package/lib/lowcode/view/lc-components/ImEx/FunctionDesign.js +8 -3
- package/lib/lowcode/view/lc-components/ImEx/index.js +257 -8
- package/lib/lowcode/view/lc-components/ImEx/index.less +7 -0
- package/lib/lowcode/view/lc-components/ImEx/meta.json +55 -23
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/Layout/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Page/meta.json +2 -2
- package/lib/lowcode/view/lc-components/PageContent/index.js +7 -8
- package/lib/lowcode/view/lc-components/PageFooter/index.js +2 -5
- package/lib/lowcode/view/lc-components/PageHeader/index.js +4 -5
- package/lib/lowcode/view/lc-components/PageLayout/FunctionDesign.js +71 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionLive.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/FunctionPreview.js +17 -0
- package/lib/lowcode/view/lc-components/PageLayout/index.js +40 -0
- package/lib/lowcode/view/lc-components/PageLayout/meta.json +47 -0
- package/lib/lowcode/view/lc-components/PageModal/index.js +11 -14
- package/lib/lowcode/view/lc-components/Section/FunctionDesign.js +2 -8
- package/lib/lowcode/view/lc-components/Section/meta.json +2 -2
- package/lib/lowcode/view/lc-components/Split/FunctionDesign.js +19 -20
- package/lib/lowcode/view/lc-components/Split/index.js +2 -6
- package/lib/lowcode/view/lc-components/Split/meta.json +4 -4
- package/lib/lowcode/view/lc-components/Table/components/TopImex.js +145 -0
- package/lib/lowcode/view/lc-components/Table/index.js +123 -38
- package/lib/lowcode/view/lc-components/Table/meta.json +17 -11
- package/lib/lowcode/view/lc-components/Tabs/FunctionDesign.js +11 -18
- package/lib/lowcode/view/lc-components/Tabs/index.js +3 -1
- package/lib/lowcode/view/lc-components/Tabs/meta.json +3 -3
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +2 -1
- package/lib/lowcode/view/lc-components/Tree/index.js +65 -16
- package/lib/lowcode/view/lc-components/Tree/meta.json +62 -7
- package/lib/lowcode/view/lc-components/Wrapper.js +8 -10
- package/lib/services.js +0 -25
- package/lib/upload/FilesWall/file.png +0 -0
- package/lib/upload/FilesWall/index.js +429 -0
- package/lib/upload/FilesWall/index.less +74 -0
- package/lib/upload/Form/index.js +2 -1
- package/lib/upload/FormItem/index.js +3 -5
- package/lib/upload/index.js +8 -1
- package/lib/utils/action.js +2 -2
- package/package.json +5 -4
|
@@ -5,7 +5,8 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
|
5
5
|
var _excluded = ["datasetCode"];
|
|
6
6
|
import { useBoolean, useMemoizedFn } from 'ahooks';
|
|
7
7
|
import { message } from 'luck-design/antd';
|
|
8
|
-
import { keys, isNil } from 'lodash';
|
|
8
|
+
import { keys, isNil, isFunction } from 'lodash';
|
|
9
|
+
import usePageDataStore from "./usePageDataStore";
|
|
9
10
|
import { executeCode } from "./helper";
|
|
10
11
|
import { fetchCallBehavior } from "../../constants/api-url";
|
|
11
12
|
var useTodo = function useTodo() {
|
|
@@ -25,10 +26,13 @@ var useTodo = function useTodo() {
|
|
|
25
26
|
behaviorKey: behaviorKey
|
|
26
27
|
}, params), data);
|
|
27
28
|
});
|
|
29
|
+
var moduleData = usePageDataStore(function (state) {
|
|
30
|
+
return state.moduleData;
|
|
31
|
+
});
|
|
28
32
|
var todo = useMemoizedFn(function (ctx, actionPool) {
|
|
29
33
|
var argsMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
30
34
|
if (isNil(actionPool)) {
|
|
31
|
-
return;
|
|
35
|
+
return Promise.resolve();
|
|
32
36
|
}
|
|
33
37
|
var dsCode = argsMap.datasetCode,
|
|
34
38
|
args = _objectWithoutProperties(argsMap, _excluded);
|
|
@@ -47,21 +51,27 @@ var useTodo = function useTodo() {
|
|
|
47
51
|
return Promise.resolve(executeCode.apply(void 0, [ctx, info.code, argsName].concat(_toConsumableArray(_args))));
|
|
48
52
|
case 'page-action':
|
|
49
53
|
{
|
|
50
|
-
var
|
|
51
|
-
moduleCode =
|
|
52
|
-
datasetCode =
|
|
53
|
-
params =
|
|
54
|
-
data =
|
|
54
|
+
var _ref4 = executeCode.apply(void 0, [ctx, info.code, argsName].concat(_toConsumableArray(_args))) || {},
|
|
55
|
+
moduleCode = _ref4.moduleCode,
|
|
56
|
+
datasetCode = _ref4.datasetCode,
|
|
57
|
+
params = _ref4.params,
|
|
58
|
+
data = _ref4.data,
|
|
59
|
+
after = _ref4.after;
|
|
60
|
+
var _moduleCode = moduleCode || moduleData.moduleCode;
|
|
55
61
|
var _dscode = datasetCode || dsCode;
|
|
56
|
-
if (!
|
|
62
|
+
if (!_moduleCode || !_dscode) {
|
|
57
63
|
message.warning('接口重要参数(模块编码或数据集编码)丢失');
|
|
58
64
|
return;
|
|
59
65
|
}
|
|
60
66
|
return callBehavior({
|
|
61
67
|
datasetCode: _dscode,
|
|
62
|
-
moduleCode:
|
|
68
|
+
moduleCode: _moduleCode,
|
|
63
69
|
behaviorKey: actionKey
|
|
64
|
-
}, params, data)
|
|
70
|
+
}, params, data).then(function (res) {
|
|
71
|
+
if (isFunction(after)) {
|
|
72
|
+
after(ctx, res);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
65
75
|
}
|
|
66
76
|
case 'trigger':
|
|
67
77
|
return Promise.resolve();
|
|
@@ -5,8 +5,7 @@ import { useEventListener, useSetState, useMemoizedFn, useCreation, useSize, use
|
|
|
5
5
|
import { Icon, Dropdown, message } from 'luck-design/antd';
|
|
6
6
|
import { reverse } from 'lodash';
|
|
7
7
|
import { suid } from '@luck-design-biz/base/utils';
|
|
8
|
-
import { useContext,
|
|
9
|
-
import { add, deleteById } from "../engine/tools/dataProcess";
|
|
8
|
+
import { useContext, addNode, deleteNode } from "../engine/provider/ContextProvider";
|
|
10
9
|
import { LC_BUILDIN_UNIT_KEY, LC_COMPONENT_UNIT_KEY, LC_COMPONENT_UNIT, CONTAINER_UNITS } from "../constants";
|
|
11
10
|
import styles from "./style/design.less";
|
|
12
11
|
var _MODAL_COMPONENT_ = ['Dialog', 'Drawer'];
|
|
@@ -29,10 +28,6 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
29
28
|
var _getDomById, _getDomById2;
|
|
30
29
|
var target = _ref.target;
|
|
31
30
|
var context = useContext();
|
|
32
|
-
var _usePageData = usePageData(),
|
|
33
|
-
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
34
|
-
pageData = _usePageData2[0],
|
|
35
|
-
setPageData = _usePageData2[1].setPageData;
|
|
36
31
|
var size = useSize(target);
|
|
37
32
|
var _useState = useState(suid()),
|
|
38
33
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -64,27 +59,24 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
64
59
|
var handleDelete = useMemoizedFn(function (_ref2) {
|
|
65
60
|
var id = _ref2.id;
|
|
66
61
|
context.$publisher(context.topics.COMPONENT_DELETE, {
|
|
67
|
-
id: id
|
|
68
|
-
pageData: pageData
|
|
62
|
+
id: id
|
|
69
63
|
});
|
|
70
64
|
});
|
|
71
65
|
var addComponent = useMemoizedFn(function (data, targetId) {
|
|
72
|
-
var json = require("../engine/meta/".concat(data.component.toLowerCase(), ".props.default.json"));
|
|
73
|
-
var _id = "".concat(data.component.toLowerCase(), "_").concat(suid());
|
|
74
|
-
add(pageData, targetId, _id, json);
|
|
75
66
|
context.$subscriber(context.topics.COMPONENT_MOUNT).once(function (_ref3) {
|
|
76
67
|
var mountCompId = _ref3.id;
|
|
77
68
|
if (mountCompId === _id) {
|
|
78
69
|
context.$publisher(context.topics.COMPONENT_APPEND, {
|
|
79
|
-
id: _id
|
|
80
|
-
pageData: pageData
|
|
70
|
+
id: _id
|
|
81
71
|
});
|
|
82
72
|
context.$publisher(context.topics.COMPONENT_ACTIVE, {
|
|
83
73
|
id: _id
|
|
84
74
|
});
|
|
85
75
|
}
|
|
86
76
|
}).watch();
|
|
87
|
-
|
|
77
|
+
var json = require("../engine/meta/".concat(data.component.toLowerCase(), ".props.default.json"));
|
|
78
|
+
var _id = "".concat(data.component.toLowerCase(), "_").concat(suid());
|
|
79
|
+
addNode(targetId, _id, json);
|
|
88
80
|
});
|
|
89
81
|
var acticeProps = useCreation(function () {
|
|
90
82
|
if (!operatorId.selector) return null;
|
|
@@ -191,11 +183,10 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
191
183
|
}).watch();
|
|
192
184
|
var acid = context.$subscriber(context.topics.COMPONENT_ACTIVE).on(function (payload) {
|
|
193
185
|
if (payload.id) {
|
|
194
|
-
var
|
|
195
|
-
node = _context$componentMap2.node;
|
|
186
|
+
var node = context.componentMap.get(payload.id).api.getSelfData();
|
|
196
187
|
setOperatorId({
|
|
197
188
|
selector: payload.id,
|
|
198
|
-
deletable: node.props.buildIn !== true,
|
|
189
|
+
deletable: !node || node.props.buildIn !== true,
|
|
199
190
|
detector: null
|
|
200
191
|
});
|
|
201
192
|
} else {
|
|
@@ -207,14 +198,14 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
207
198
|
var cmtid = context.$subscriber(context.topics.COMPONENT_MODAL_TOGGLE).on(function (_ref6) {
|
|
208
199
|
var toggle = _ref6.toggle,
|
|
209
200
|
id = _ref6.id;
|
|
210
|
-
if (toggle) {
|
|
201
|
+
if (toggle && id !== currentModal.current) {
|
|
211
202
|
target.current.style.setProperty('overflow', 'hidden');
|
|
212
203
|
var _modal = context.componentMap.get(id);
|
|
213
204
|
var _prevModal = currentModal.current ? context.componentMap.get(currentModal.current) : null;
|
|
214
205
|
_prevModal === null || _prevModal === void 0 || _prevModal.api.doClose();
|
|
215
206
|
_modal.api.doOpen();
|
|
216
207
|
currentModal.current = id;
|
|
217
|
-
} else {
|
|
208
|
+
} else if (!toggle) {
|
|
218
209
|
target.current.style.removeProperty('overflow');
|
|
219
210
|
var _id = id || currentModal.current;
|
|
220
211
|
if (_id) {
|
|
@@ -225,13 +216,11 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
225
216
|
}
|
|
226
217
|
}).watch();
|
|
227
218
|
var cdid = context.$subscriber(context.topics.COMPONENT_DELETE).on(function (_ref7) {
|
|
228
|
-
var id = _ref7.id
|
|
229
|
-
pageData = _ref7.pageData;
|
|
219
|
+
var id = _ref7.id;
|
|
230
220
|
if (lastSelectorId.current === id) {
|
|
231
221
|
context.$publisher(context.topics.COMPONENT_ACTIVE, null);
|
|
232
222
|
}
|
|
233
|
-
|
|
234
|
-
setPageData(pageData);
|
|
223
|
+
deleteNode(id);
|
|
235
224
|
});
|
|
236
225
|
return function () {
|
|
237
226
|
context.$unsubscriber(context.topics.COMPONENT_SETTING_CLICK, csid);
|
|
@@ -12,7 +12,7 @@ import classNames from 'classnames';
|
|
|
12
12
|
import { useMemoizedFn, useRequest, useDebounceFn, useCookieState } from 'ahooks';
|
|
13
13
|
import { Select, Button, Icon, Divider, Modal, message, Drawer } from 'luck-design/antd';
|
|
14
14
|
import { showPop, formatMessage } from '@luck-design-biz/base/utils';
|
|
15
|
-
import { useContext,
|
|
15
|
+
import { useContext, useGet, resetPageData, useRemoteSource } from "../engine/provider/ContextProvider";
|
|
16
16
|
import JsonEditor from "../painter/components/code-editor/JsonEditor";
|
|
17
17
|
import Preview from "../preview";
|
|
18
18
|
import { LC_BUILDIN_UNIT_KEY, COOKIE_VIRTUAL_ACCOUNT_KEY } from "../constants";
|
|
@@ -25,15 +25,7 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
25
25
|
var location = useLocation();
|
|
26
26
|
var editorRef = useRef();
|
|
27
27
|
var context = useContext();
|
|
28
|
-
var
|
|
29
|
-
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
30
|
-
pageData = _usePageData2[0],
|
|
31
|
-
_usePageData2$ = _usePageData2[1],
|
|
32
|
-
setPageData = _usePageData2$.setPageData,
|
|
33
|
-
back = _usePageData2$.back,
|
|
34
|
-
forward = _usePageData2$.forward,
|
|
35
|
-
backLength = _usePageData2$.backLength,
|
|
36
|
-
forwardLength = _usePageData2$.forwardLength;
|
|
28
|
+
var pageData = useGet();
|
|
37
29
|
var _ref2 = useRemoteSource() || {},
|
|
38
30
|
pageinfo = _ref2.pageinfo;
|
|
39
31
|
var _useState = useState(null),
|
|
@@ -135,9 +127,10 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
135
127
|
var code = editorRef.current.editor.getValue();
|
|
136
128
|
try {
|
|
137
129
|
var data = JSON.parse(code);
|
|
138
|
-
|
|
130
|
+
resetPageData(data);
|
|
139
131
|
setShow(false);
|
|
140
132
|
} catch (e) {
|
|
133
|
+
console.error(e);
|
|
141
134
|
message.warning(formatMessage({
|
|
142
135
|
id: 'luckda.lowcode.error.pagedata',
|
|
143
136
|
label: '页面数据错误'
|
|
@@ -212,35 +205,6 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
212
205
|
type: "mobile"
|
|
213
206
|
})), /*#__PURE__*/React.createElement(Divider, {
|
|
214
207
|
type: "vertical"
|
|
215
|
-
}), /*#__PURE__*/React.createElement("span", {
|
|
216
|
-
className: classNames(styles['toolbar-item'], _defineProperty({}, styles.disabled, backLength < 1)),
|
|
217
|
-
onClick: function onClick() {
|
|
218
|
-
return backLength > 0 && back();
|
|
219
|
-
}
|
|
220
|
-
}, /*#__PURE__*/React.createElement("svg", {
|
|
221
|
-
viewBox: "0 0 1024 1024",
|
|
222
|
-
width: "20",
|
|
223
|
-
height: "20",
|
|
224
|
-
fill: "currentColor",
|
|
225
|
-
style: {
|
|
226
|
-
transform: 'rotateY(180deg)'
|
|
227
|
-
}
|
|
228
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
229
|
-
d: "M946.8 420L651.9 125.1c-19.5-19.5-52.7-5.7-52.7 21.8v174c-79.3-1.8-501.8 14.9-532.3 569.6-0.9 17.2 22.1 24.3 30.6 9.3C255 621 396.6 553.3 599.1 561.5v175.2c0 27.5 33.3 41.3 52.8 21.9l294.8-294.9c12.1-12.1 12.1-31.6 0.1-43.7z"
|
|
230
|
-
}))), /*#__PURE__*/React.createElement("span", {
|
|
231
|
-
className: classNames(styles['toolbar-item'], _defineProperty({}, styles.disabled, forwardLength < 1)),
|
|
232
|
-
onClick: function onClick() {
|
|
233
|
-
return forwardLength > 0 && forward();
|
|
234
|
-
}
|
|
235
|
-
}, /*#__PURE__*/React.createElement("svg", {
|
|
236
|
-
viewBox: "0 0 1024 1024",
|
|
237
|
-
width: "20",
|
|
238
|
-
height: "20",
|
|
239
|
-
fill: "currentColor"
|
|
240
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
241
|
-
d: "M946.8 420L651.9 125.1c-19.5-19.5-52.7-5.7-52.7 21.8v174c-79.3-1.8-501.8 14.9-532.3 569.6-0.9 17.2 22.1 24.3 30.6 9.3C255 621 396.6 553.3 599.1 561.5v175.2c0 27.5 33.3 41.3 52.8 21.9l294.8-294.9c12.1-12.1 12.1-31.6 0.1-43.7z"
|
|
242
|
-
}))), /*#__PURE__*/React.createElement(Divider, {
|
|
243
|
-
type: "vertical"
|
|
244
208
|
}), /*#__PURE__*/React.createElement("span", {
|
|
245
209
|
style: {
|
|
246
210
|
width: 'auto',
|
|
@@ -312,15 +276,15 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
312
276
|
return document.getElementById('lc-design-workspace');
|
|
313
277
|
},
|
|
314
278
|
zIndex: 3000,
|
|
315
|
-
bodyStyle: {
|
|
316
|
-
height: '70vh'
|
|
317
|
-
},
|
|
318
279
|
onOk: handleOk,
|
|
319
280
|
onCancel: function onCancel() {
|
|
320
281
|
return setShow(false);
|
|
321
282
|
}
|
|
322
283
|
}, /*#__PURE__*/React.createElement(JsonEditor, {
|
|
323
|
-
ref: editorRef
|
|
284
|
+
ref: editorRef,
|
|
285
|
+
style: {
|
|
286
|
+
height: '70vh'
|
|
287
|
+
}
|
|
324
288
|
}, JSON.stringify(pageData, null, '\t'))), /*#__PURE__*/React.createElement(Drawer, {
|
|
325
289
|
title: /*#__PURE__*/React.createElement("div", {
|
|
326
290
|
id: "preview-drawer-header",
|
|
@@ -393,7 +357,8 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
393
357
|
}
|
|
394
358
|
}, /*#__PURE__*/React.createElement(Preview, {
|
|
395
359
|
code: location.query.code,
|
|
396
|
-
userId: userId || 'no-user'
|
|
360
|
+
userId: userId || 'no-user',
|
|
361
|
+
debug: true
|
|
397
362
|
})));
|
|
398
363
|
};
|
|
399
364
|
export default DesignToolbar;
|
|
@@ -9,7 +9,7 @@ import { uniq, split, reduce } from 'lodash';
|
|
|
9
9
|
import classNames from 'classnames';
|
|
10
10
|
import { Card, Tree, Icon } from 'luck-design/antd';
|
|
11
11
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
12
|
-
import { useContext,
|
|
12
|
+
import { useContext, useGet } from "../engine/provider/ContextProvider";
|
|
13
13
|
import { LC_BUILDIN_UNIT_KEY, LC_BUILDIN_UNIT_KEY_LIST } from "../constants";
|
|
14
14
|
import { getPathById } from "../engine/tools/dataProcess";
|
|
15
15
|
import styles from "./style/outline.less";
|
|
@@ -19,9 +19,7 @@ var Outline = function Outline(_ref) {
|
|
|
19
19
|
var open = _ref.open;
|
|
20
20
|
var clickBySelf = useRef(false);
|
|
21
21
|
var ctx = useContext();
|
|
22
|
-
var
|
|
23
|
-
_usePageData2 = _slicedToArray(_usePageData, 1),
|
|
24
|
-
pageData = _usePageData2[0];
|
|
22
|
+
var pageData = useGet();
|
|
25
23
|
var _useState = useState(null),
|
|
26
24
|
_useState2 = _slicedToArray(_useState, 2),
|
|
27
25
|
pageAndModal = _useState2[0],
|
|
@@ -7,11 +7,10 @@ import { Breadcrumb } from 'luck-design/antd';
|
|
|
7
7
|
import classNames from 'classnames';
|
|
8
8
|
import { takeRight, isNil, reduce, get, set } from 'lodash';
|
|
9
9
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
10
|
-
import { useContext,
|
|
10
|
+
import { useContext, useTask, addNode, deleteNode } from "../engine/provider/ContextProvider";
|
|
11
11
|
import AttrsPanel from "./components/AttrsPanel";
|
|
12
12
|
import StylePanel from "./panel-section/StylePanel";
|
|
13
13
|
import AdvancePanel from "./components/AdvancePanel";
|
|
14
|
-
import { modifyById, add, deleteById } from "../engine/tools/dataProcess";
|
|
15
14
|
import styles from "./style/panel.less";
|
|
16
15
|
import { LC_BUILDIN_UNIT_KEY } from "../constants";
|
|
17
16
|
var _I18N_PREFIX_ = 'luckda.lowcode.painter.panel';
|
|
@@ -46,10 +45,7 @@ var Panel = function Panel() {
|
|
|
46
45
|
activeTabKey = _useState4[0],
|
|
47
46
|
setActiveTabKey = _useState4[1];
|
|
48
47
|
var context = useContext();
|
|
49
|
-
var
|
|
50
|
-
_usePageData2 = _slicedToArray(_usePageData, 2),
|
|
51
|
-
pageData = _usePageData2[0],
|
|
52
|
-
setPageData = _usePageData2[1].setPageData;
|
|
48
|
+
var task = useTask('modify');
|
|
53
49
|
var meta = useCreation(function () {
|
|
54
50
|
try {
|
|
55
51
|
return isNil(activeNode) ? null : require("../engine/meta/".concat(activeNode.node.component.toLowerCase(), ".props.json"));
|
|
@@ -57,38 +53,41 @@ var Panel = function Panel() {
|
|
|
57
53
|
return null;
|
|
58
54
|
}
|
|
59
55
|
}, [activeNode]);
|
|
60
|
-
var handleChange = useMemoizedFn(function (field, value
|
|
56
|
+
var handleChange = useMemoizedFn(function (field, value) {
|
|
57
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
58
|
+
repositioning = _ref.repositioning,
|
|
59
|
+
before = _ref.before;
|
|
61
60
|
if (field === 'enableHeader') {
|
|
62
61
|
if (value) {
|
|
63
62
|
var headerMeta = require("../engine/meta/pageheader.props.default.json");
|
|
64
|
-
|
|
63
|
+
addNode(LC_BUILDIN_UNIT_KEY.PAGE_ROOT, LC_BUILDIN_UNIT_KEY.PAGE_HEADER, _objectSpread(_objectSpread({}, headerMeta), {}, {
|
|
65
64
|
buildIn: true
|
|
66
65
|
}));
|
|
67
66
|
} else {
|
|
68
|
-
|
|
67
|
+
deleteNode(LC_BUILDIN_UNIT_KEY.PAGE_HEADER);
|
|
69
68
|
}
|
|
70
69
|
} else if (field === 'enableFooter') {
|
|
71
70
|
if (value) {
|
|
72
71
|
var footerMeta = require("../engine/meta/pagefooter.props.default.json");
|
|
73
|
-
|
|
72
|
+
addNode(LC_BUILDIN_UNIT_KEY.PAGE_ROOT, LC_BUILDIN_UNIT_KEY.PAGE_FOOTER, _objectSpread(_objectSpread({}, footerMeta), {}, {
|
|
74
73
|
buildIn: true
|
|
75
74
|
}));
|
|
76
75
|
} else {
|
|
77
|
-
|
|
76
|
+
deleteNode(LC_BUILDIN_UNIT_KEY.PAGE_FOOTER);
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
var component = context.componentMap.get(activeNode.node.id);
|
|
81
|
-
var
|
|
82
|
-
node = _component$api$getSel.node;
|
|
80
|
+
var node = component.api.getSelfData();
|
|
83
81
|
var oldValue = _defineProperty({}, field, get(node.props, field));
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
var newValue = _defineProperty({}, field, value);
|
|
83
|
+
if (before) {
|
|
84
|
+
before(handleChange);
|
|
85
|
+
}
|
|
86
|
+
task(activeNode.node.id, newValue).then(function (a, b) {
|
|
87
87
|
context.$publisher(context.topics.COMPONENT_MODIFY, {
|
|
88
88
|
id: activeNode.node.id,
|
|
89
|
-
pageData: newData,
|
|
90
89
|
oldValue: oldValue,
|
|
91
|
-
newValue:
|
|
90
|
+
newValue: newValue
|
|
92
91
|
});
|
|
93
92
|
if (repositioning) context.$publisher(context.topics.COMPONENT_REPOSITIONING, {
|
|
94
93
|
id: activeNode.node.id
|
|
@@ -103,8 +102,7 @@ var Panel = function Panel() {
|
|
|
103
102
|
return;
|
|
104
103
|
}
|
|
105
104
|
var component = context.componentMap.get(payload.id);
|
|
106
|
-
var
|
|
107
|
-
node = _component$api$getSel2.node;
|
|
105
|
+
var node = component.api.getSelfData();
|
|
108
106
|
var levelNodes = takeRight(component.api.getLevelNodes(), 4);
|
|
109
107
|
setActiveNode({
|
|
110
108
|
node: node.props,
|
|
@@ -127,9 +125,9 @@ var Panel = function Panel() {
|
|
|
127
125
|
style: {
|
|
128
126
|
fontSize: 12
|
|
129
127
|
}
|
|
130
|
-
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (
|
|
131
|
-
var id =
|
|
132
|
-
name =
|
|
128
|
+
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (_ref2) {
|
|
129
|
+
var id = _ref2.id,
|
|
130
|
+
name = _ref2.name;
|
|
133
131
|
return /*#__PURE__*/React.createElement(Breadcrumb.Item, {
|
|
134
132
|
key: id,
|
|
135
133
|
className: classNames(_defineProperty({}, styles['active-node-level'], id !== activeNode.node.id)),
|
|
@@ -176,19 +174,22 @@ var Panel = function Panel() {
|
|
|
176
174
|
ref: underLineRef,
|
|
177
175
|
className: styles.underline
|
|
178
176
|
})), activeTabKey === _TAB_LIST_[0].key && /*#__PURE__*/React.createElement(AttrsPanel, {
|
|
177
|
+
key: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
178
|
+
nodeId: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
179
179
|
meta: meta,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
return handleChange(field, value, repositioning);
|
|
180
|
+
onChange: function onChange(field, value, params) {
|
|
181
|
+
return handleChange(field, value, params);
|
|
183
182
|
}
|
|
184
183
|
}), activeTabKey === _TAB_LIST_[1].key && /*#__PURE__*/React.createElement(StylePanel, {
|
|
185
|
-
|
|
184
|
+
key: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
185
|
+
nodeId: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
186
186
|
onChange: function onChange(_, newCss) {
|
|
187
187
|
return handleChange('css', newCss);
|
|
188
188
|
}
|
|
189
189
|
}), activeTabKey === _TAB_LIST_[2].key && /*#__PURE__*/React.createElement(AdvancePanel, {
|
|
190
|
+
key: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
191
|
+
nodeId: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
190
192
|
meta: meta,
|
|
191
|
-
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.advance,
|
|
192
193
|
onChange: function onChange(val) {
|
|
193
194
|
return handleChange('advance', val);
|
|
194
195
|
}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
2
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
3
|
import React, { useRef, useState } from 'react';
|
|
5
|
-
import { useMemoizedFn, useLatest, useCreation, useMap, useUpdateEffect } from 'ahooks';
|
|
4
|
+
import { useMemoizedFn, useLatest, useCreation, useMap, useUpdateEffect, useDebounceFn } from 'ahooks';
|
|
6
5
|
import { Modal, Icon, Input, Checkbox, Tooltip } from 'luck-design/antd';
|
|
7
6
|
import classNames from 'classnames';
|
|
8
|
-
import {
|
|
7
|
+
import { reduce } from 'lodash';
|
|
9
8
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
10
9
|
import { useRemoteSource } from "../../engine/provider/ContextProvider";
|
|
11
10
|
import { useContext } from "../../engine/provider/ContextProvider";
|
|
12
11
|
import JSEditor from "./code-editor/JSEditor";
|
|
13
|
-
import JsonEditor from "./code-editor/JsonEditor";
|
|
14
12
|
import styles from "../style/action-bind-modal.less";
|
|
15
13
|
var _I18N_PREFIX_ = 'luckda.lowcode.painter.actionBindModal';
|
|
16
14
|
var _ACTION_CATEGORY_ = [{
|
|
@@ -32,7 +30,7 @@ var _ACTION_CATEGORY_ = [{
|
|
|
32
30
|
label: '自定义动作'
|
|
33
31
|
})
|
|
34
32
|
}];
|
|
35
|
-
var _DEFAULT_JSON_CODE_ = '{"
|
|
33
|
+
var _DEFAULT_JSON_CODE_ = '{"params":{},"data":{}}';
|
|
36
34
|
var _DEFAULT_JS_CODE_ = 'function todo() {\n\n}';
|
|
37
35
|
var ActionBindModal = function ActionBindModal(_ref) {
|
|
38
36
|
var event = _ref.event,
|
|
@@ -82,7 +80,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
82
80
|
target = _ref3[1];
|
|
83
81
|
ret.push({
|
|
84
82
|
key: key,
|
|
85
|
-
label: "".concat(target.api.
|
|
83
|
+
label: "".concat(target.api.getSelfData().props.name, "(").concat(key, ")")
|
|
86
84
|
});
|
|
87
85
|
return ret;
|
|
88
86
|
}, []);
|
|
@@ -100,27 +98,28 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
100
98
|
useUpdateEffect(function () {
|
|
101
99
|
if (activeKey) {
|
|
102
100
|
var action = get(activeKey);
|
|
103
|
-
editorRef.current.editor.setValue(action.code);
|
|
101
|
+
(action === null || action === void 0 ? void 0 : action.code) && editorRef.current.editor.setValue(action.code);
|
|
104
102
|
}
|
|
105
103
|
}, [activeKey]);
|
|
106
104
|
useUpdateEffect(function () {
|
|
107
105
|
setAll(event === null || event === void 0 ? void 0 : event.actionPool);
|
|
108
106
|
}, [event]);
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
107
|
+
var _useDebounceFn = useDebounceFn(function (code) {
|
|
108
|
+
if (latestActiveKey.current) {
|
|
109
|
+
var action = get(latestActiveKey.current);
|
|
110
|
+
action.code = code;
|
|
111
|
+
}
|
|
112
|
+
}, {
|
|
113
|
+
wait: 500
|
|
114
|
+
}),
|
|
115
|
+
handleEditorValueChange = _useDebounceFn.run;
|
|
115
116
|
var handleOptionClick = useMemoizedFn(function (key) {
|
|
116
117
|
setActiveKey(key);
|
|
117
118
|
var action;
|
|
118
119
|
if (actionPool.has(key)) {
|
|
119
120
|
action = get(key);
|
|
120
121
|
} else {
|
|
121
|
-
var code = category === 'custom' ?
|
|
122
|
-
moduleCode: module.moduleCode
|
|
123
|
-
}, JSON.parse(_DEFAULT_JSON_CODE_)), null, '\t');
|
|
122
|
+
var code = event.func || (category === 'custom' ? defaultCode : "".concat(defaultCode.slice(0, -1), "\n\treturn ").concat(_DEFAULT_JSON_CODE_, " \n}"));
|
|
124
123
|
action = {
|
|
125
124
|
category: category,
|
|
126
125
|
key: key,
|
|
@@ -134,9 +133,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
134
133
|
if (activeKey !== key) {
|
|
135
134
|
setActiveKey(key);
|
|
136
135
|
}
|
|
137
|
-
var code = category === 'custom' ?
|
|
138
|
-
moduleCode: module.moduleCode
|
|
139
|
-
}, JSON.parse(_DEFAULT_JSON_CODE_)), null, '\t');
|
|
136
|
+
var code = event.func || (category === 'custom' ? defaultCode : "".concat(defaultCode.slice(0, -1), "\n\treturn ").concat(_DEFAULT_JSON_CODE_, " \n}"));
|
|
140
137
|
set(key, {
|
|
141
138
|
category: category,
|
|
142
139
|
key: key,
|
|
@@ -168,7 +165,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
168
165
|
},
|
|
169
166
|
title: event === null || event === void 0 ? void 0 : event.name,
|
|
170
167
|
visible: !!event,
|
|
171
|
-
width:
|
|
168
|
+
width: "70vw",
|
|
172
169
|
closable: false,
|
|
173
170
|
maskClosable: false,
|
|
174
171
|
getContainer: function getContainer() {
|
|
@@ -196,7 +193,16 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
196
193
|
className: classNames(_defineProperty({}, styles.active, key === category)),
|
|
197
194
|
onClick: function onClick() {
|
|
198
195
|
setCategory(key);
|
|
199
|
-
|
|
196
|
+
if ('custom' === key) {
|
|
197
|
+
setActiveKey('coding');
|
|
198
|
+
if (!actionPool.has(key)) {
|
|
199
|
+
set('coding', {
|
|
200
|
+
category: key,
|
|
201
|
+
key: 'coding',
|
|
202
|
+
code: event.func || defaultCode
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
}
|
|
200
206
|
}
|
|
201
207
|
}, label, key === category && /*#__PURE__*/React.createElement(Icon, {
|
|
202
208
|
type: "check",
|
|
@@ -271,9 +277,9 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
271
277
|
type: "exclamation-circle"
|
|
272
278
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
273
279
|
className: styles['code-box']
|
|
274
|
-
}, activeKey ? /*#__PURE__*/React.createElement(
|
|
280
|
+
}, activeKey ? /*#__PURE__*/React.createElement(JSEditor, {
|
|
275
281
|
ref: editorRef,
|
|
276
|
-
onChange: handleEditorValueChange
|
|
282
|
+
onChange: handleEditorValueChange
|
|
277
283
|
}) : formatMessage({
|
|
278
284
|
id: "".concat(_I18N_PREFIX_, ".noActionSelected"),
|
|
279
285
|
label: '请在右侧选择行为项'
|
|
@@ -284,7 +290,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
284
290
|
className: styles['code-box']
|
|
285
291
|
}, activeKey ? /*#__PURE__*/React.createElement(JSEditor, {
|
|
286
292
|
ref: editorRef,
|
|
287
|
-
onChange: handleEditorValueChange
|
|
293
|
+
onChange: handleEditorValueChange
|
|
288
294
|
}) : formatMessage({
|
|
289
295
|
id: "".concat(_I18N_PREFIX_, ".noActionSelected"),
|
|
290
296
|
label: '请在右侧选择行为项'
|
|
@@ -9,6 +9,7 @@ import { useCreation, useMemoizedFn } from 'ahooks';
|
|
|
9
9
|
import { Menu, Dropdown, Button, Tooltip, Icon } from 'luck-design/antd';
|
|
10
10
|
import styled from 'styled-components';
|
|
11
11
|
import { keyBy, keys, omit } from 'lodash';
|
|
12
|
+
import { useGet } from "../../engine/provider/ContextProvider";
|
|
12
13
|
import { formatMessage } from '@luck-design-biz/base/utils';
|
|
13
14
|
import Collapse from "./Collapse";
|
|
14
15
|
import ActionBindModal from "./ActionBindModal";
|
|
@@ -19,8 +20,12 @@ var EventItem = styled.div.withConfig({
|
|
|
19
20
|
})(["display:flex;align-items:center;justify-content:space-between;padding:4px 8px;border:1px solid #e5e6e8;border-radius:6px;margin-bottom:6px;font-size:12px;i{color:rgba(0,0,0,0.4);cursor:pointer;}i:not(:last-child){margin-right:6px;}"]);
|
|
20
21
|
var AdvancePanel = function AdvancePanel(_ref) {
|
|
21
22
|
var meta = _ref.meta,
|
|
22
|
-
|
|
23
|
+
nodeId = _ref.nodeId,
|
|
23
24
|
onChange = _ref.onChange;
|
|
25
|
+
var value = useGet({
|
|
26
|
+
id: nodeId,
|
|
27
|
+
path: 'props.advance'
|
|
28
|
+
});
|
|
24
29
|
var _useState = useState((value === null || value === void 0 ? void 0 : value.events) || {}),
|
|
25
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
26
31
|
events = _useState2[0],
|