@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
|
@@ -12,6 +12,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
12
12
|
var _ahooks = require("ahooks");
|
|
13
13
|
var _antd = require("luck-design/antd");
|
|
14
14
|
var _lodash = require("lodash");
|
|
15
|
+
var _usePageDataStore = _interopRequireDefault(require("./usePageDataStore"));
|
|
15
16
|
var _helper = require("./helper");
|
|
16
17
|
var _apiUrl = require("../../constants/api-url");
|
|
17
18
|
var _excluded = ["datasetCode"];
|
|
@@ -32,10 +33,13 @@ var useTodo = function useTodo() {
|
|
|
32
33
|
behaviorKey: behaviorKey
|
|
33
34
|
}, params), data);
|
|
34
35
|
});
|
|
36
|
+
var moduleData = (0, _usePageDataStore.default)(function (state) {
|
|
37
|
+
return state.moduleData;
|
|
38
|
+
});
|
|
35
39
|
var todo = (0, _ahooks.useMemoizedFn)(function (ctx, actionPool) {
|
|
36
40
|
var argsMap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
37
41
|
if ((0, _lodash.isNil)(actionPool)) {
|
|
38
|
-
return;
|
|
42
|
+
return Promise.resolve();
|
|
39
43
|
}
|
|
40
44
|
var dsCode = argsMap.datasetCode,
|
|
41
45
|
args = (0, _objectWithoutProperties2.default)(argsMap, _excluded);
|
|
@@ -54,21 +58,27 @@ var useTodo = function useTodo() {
|
|
|
54
58
|
return Promise.resolve(_helper.executeCode.apply(void 0, [ctx, info.code, argsName].concat((0, _toConsumableArray2.default)(_args))));
|
|
55
59
|
case 'page-action':
|
|
56
60
|
{
|
|
57
|
-
var
|
|
58
|
-
moduleCode =
|
|
59
|
-
datasetCode =
|
|
60
|
-
params =
|
|
61
|
-
data =
|
|
61
|
+
var _ref4 = _helper.executeCode.apply(void 0, [ctx, info.code, argsName].concat((0, _toConsumableArray2.default)(_args))) || {},
|
|
62
|
+
moduleCode = _ref4.moduleCode,
|
|
63
|
+
datasetCode = _ref4.datasetCode,
|
|
64
|
+
params = _ref4.params,
|
|
65
|
+
data = _ref4.data,
|
|
66
|
+
after = _ref4.after;
|
|
67
|
+
var _moduleCode = moduleCode || moduleData.moduleCode;
|
|
62
68
|
var _dscode = datasetCode || dsCode;
|
|
63
|
-
if (!
|
|
69
|
+
if (!_moduleCode || !_dscode) {
|
|
64
70
|
_antd.message.warning('接口重要参数(模块编码或数据集编码)丢失');
|
|
65
71
|
return;
|
|
66
72
|
}
|
|
67
73
|
return callBehavior({
|
|
68
74
|
datasetCode: _dscode,
|
|
69
|
-
moduleCode:
|
|
75
|
+
moduleCode: _moduleCode,
|
|
70
76
|
behaviorKey: actionKey
|
|
71
|
-
}, params, data)
|
|
77
|
+
}, params, data).then(function (res) {
|
|
78
|
+
if ((0, _lodash.isFunction)(after)) {
|
|
79
|
+
after(ctx, res);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
72
82
|
}
|
|
73
83
|
case 'trigger':
|
|
74
84
|
return Promise.resolve();
|
|
@@ -13,7 +13,6 @@ var _ahooks = require("ahooks");
|
|
|
13
13
|
var _antd = require("luck-design/antd");
|
|
14
14
|
var _utils = require("@luck-design-biz/base/utils");
|
|
15
15
|
var _ContextProvider = require("../engine/provider/ContextProvider");
|
|
16
|
-
var _dataProcess = require("../engine/tools/dataProcess");
|
|
17
16
|
var _constants = require("../constants");
|
|
18
17
|
var _design = _interopRequireDefault(require("./style/design.less"));
|
|
19
18
|
var _MODAL_COMPONENT_ = ['Dialog', 'Drawer'];
|
|
@@ -36,10 +35,6 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
36
35
|
var _getDomById, _getDomById2;
|
|
37
36
|
var target = _ref.target;
|
|
38
37
|
var context = (0, _ContextProvider.useContext)();
|
|
39
|
-
var _usePageData = (0, _ContextProvider.usePageData)(),
|
|
40
|
-
_usePageData2 = (0, _slicedToArray2.default)(_usePageData, 2),
|
|
41
|
-
pageData = _usePageData2[0],
|
|
42
|
-
setPageData = _usePageData2[1].setPageData;
|
|
43
38
|
var size = (0, _ahooks.useSize)(target);
|
|
44
39
|
var _useState = (0, _react.useState)((0, _utils.suid)()),
|
|
45
40
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -71,27 +66,24 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
71
66
|
var handleDelete = (0, _ahooks.useMemoizedFn)(function (_ref2) {
|
|
72
67
|
var id = _ref2.id;
|
|
73
68
|
context.$publisher(context.topics.COMPONENT_DELETE, {
|
|
74
|
-
id: id
|
|
75
|
-
pageData: pageData
|
|
69
|
+
id: id
|
|
76
70
|
});
|
|
77
71
|
});
|
|
78
72
|
var addComponent = (0, _ahooks.useMemoizedFn)(function (data, targetId) {
|
|
79
|
-
var json = require("../engine/meta/".concat(data.component.toLowerCase(), ".props.default.json"));
|
|
80
|
-
var _id = "".concat(data.component.toLowerCase(), "_").concat((0, _utils.suid)());
|
|
81
|
-
(0, _dataProcess.add)(pageData, targetId, _id, json);
|
|
82
73
|
context.$subscriber(context.topics.COMPONENT_MOUNT).once(function (_ref3) {
|
|
83
74
|
var mountCompId = _ref3.id;
|
|
84
75
|
if (mountCompId === _id) {
|
|
85
76
|
context.$publisher(context.topics.COMPONENT_APPEND, {
|
|
86
|
-
id: _id
|
|
87
|
-
pageData: pageData
|
|
77
|
+
id: _id
|
|
88
78
|
});
|
|
89
79
|
context.$publisher(context.topics.COMPONENT_ACTIVE, {
|
|
90
80
|
id: _id
|
|
91
81
|
});
|
|
92
82
|
}
|
|
93
83
|
}).watch();
|
|
94
|
-
|
|
84
|
+
var json = require("../engine/meta/".concat(data.component.toLowerCase(), ".props.default.json"));
|
|
85
|
+
var _id = "".concat(data.component.toLowerCase(), "_").concat((0, _utils.suid)());
|
|
86
|
+
(0, _ContextProvider.addNode)(targetId, _id, json);
|
|
95
87
|
});
|
|
96
88
|
var acticeProps = (0, _ahooks.useCreation)(function () {
|
|
97
89
|
if (!operatorId.selector) return null;
|
|
@@ -198,11 +190,10 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
198
190
|
}).watch();
|
|
199
191
|
var acid = context.$subscriber(context.topics.COMPONENT_ACTIVE).on(function (payload) {
|
|
200
192
|
if (payload.id) {
|
|
201
|
-
var
|
|
202
|
-
node = _context$componentMap2.node;
|
|
193
|
+
var node = context.componentMap.get(payload.id).api.getSelfData();
|
|
203
194
|
setOperatorId({
|
|
204
195
|
selector: payload.id,
|
|
205
|
-
deletable: node.props.buildIn !== true,
|
|
196
|
+
deletable: !node || node.props.buildIn !== true,
|
|
206
197
|
detector: null
|
|
207
198
|
});
|
|
208
199
|
} else {
|
|
@@ -214,14 +205,14 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
214
205
|
var cmtid = context.$subscriber(context.topics.COMPONENT_MODAL_TOGGLE).on(function (_ref6) {
|
|
215
206
|
var toggle = _ref6.toggle,
|
|
216
207
|
id = _ref6.id;
|
|
217
|
-
if (toggle) {
|
|
208
|
+
if (toggle && id !== currentModal.current) {
|
|
218
209
|
target.current.style.setProperty('overflow', 'hidden');
|
|
219
210
|
var _modal = context.componentMap.get(id);
|
|
220
211
|
var _prevModal = currentModal.current ? context.componentMap.get(currentModal.current) : null;
|
|
221
212
|
_prevModal === null || _prevModal === void 0 || _prevModal.api.doClose();
|
|
222
213
|
_modal.api.doOpen();
|
|
223
214
|
currentModal.current = id;
|
|
224
|
-
} else {
|
|
215
|
+
} else if (!toggle) {
|
|
225
216
|
target.current.style.removeProperty('overflow');
|
|
226
217
|
var _id = id || currentModal.current;
|
|
227
218
|
if (_id) {
|
|
@@ -232,13 +223,11 @@ var DesignOperator = function DesignOperator(_ref) {
|
|
|
232
223
|
}
|
|
233
224
|
}).watch();
|
|
234
225
|
var cdid = context.$subscriber(context.topics.COMPONENT_DELETE).on(function (_ref7) {
|
|
235
|
-
var id = _ref7.id
|
|
236
|
-
pageData = _ref7.pageData;
|
|
226
|
+
var id = _ref7.id;
|
|
237
227
|
if (lastSelectorId.current === id) {
|
|
238
228
|
context.$publisher(context.topics.COMPONENT_ACTIVE, null);
|
|
239
229
|
}
|
|
240
|
-
(0,
|
|
241
|
-
setPageData(pageData);
|
|
230
|
+
(0, _ContextProvider.deleteNode)(id);
|
|
242
231
|
});
|
|
243
232
|
return function () {
|
|
244
233
|
context.$unsubscriber(context.topics.COMPONENT_SETTING_CLICK, csid);
|
|
@@ -33,15 +33,7 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
33
33
|
var location = (0, _umi.useLocation)();
|
|
34
34
|
var editorRef = (0, _react.useRef)();
|
|
35
35
|
var context = (0, _ContextProvider.useContext)();
|
|
36
|
-
var
|
|
37
|
-
_usePageData2 = (0, _slicedToArray2.default)(_usePageData, 2),
|
|
38
|
-
pageData = _usePageData2[0],
|
|
39
|
-
_usePageData2$ = _usePageData2[1],
|
|
40
|
-
setPageData = _usePageData2$.setPageData,
|
|
41
|
-
back = _usePageData2$.back,
|
|
42
|
-
forward = _usePageData2$.forward,
|
|
43
|
-
backLength = _usePageData2$.backLength,
|
|
44
|
-
forwardLength = _usePageData2$.forwardLength;
|
|
36
|
+
var pageData = (0, _ContextProvider.useGet)();
|
|
45
37
|
var _ref2 = (0, _ContextProvider.useRemoteSource)() || {},
|
|
46
38
|
pageinfo = _ref2.pageinfo;
|
|
47
39
|
var _useState = (0, _react.useState)(null),
|
|
@@ -143,9 +135,10 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
143
135
|
var code = editorRef.current.editor.getValue();
|
|
144
136
|
try {
|
|
145
137
|
var data = JSON.parse(code);
|
|
146
|
-
|
|
138
|
+
(0, _ContextProvider.resetPageData)(data);
|
|
147
139
|
setShow(false);
|
|
148
140
|
} catch (e) {
|
|
141
|
+
console.error(e);
|
|
149
142
|
_antd.message.warning((0, _utils.formatMessage)({
|
|
150
143
|
id: 'luckda.lowcode.error.pagedata',
|
|
151
144
|
label: '页面数据错误'
|
|
@@ -220,35 +213,6 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
220
213
|
type: "mobile"
|
|
221
214
|
})), /*#__PURE__*/_react.default.createElement(_antd.Divider, {
|
|
222
215
|
type: "vertical"
|
|
223
|
-
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
224
|
-
className: (0, _classnames.default)(_design.default['toolbar-item'], (0, _defineProperty2.default)({}, _design.default.disabled, backLength < 1)),
|
|
225
|
-
onClick: function onClick() {
|
|
226
|
-
return backLength > 0 && back();
|
|
227
|
-
}
|
|
228
|
-
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
229
|
-
viewBox: "0 0 1024 1024",
|
|
230
|
-
width: "20",
|
|
231
|
-
height: "20",
|
|
232
|
-
fill: "currentColor",
|
|
233
|
-
style: {
|
|
234
|
-
transform: 'rotateY(180deg)'
|
|
235
|
-
}
|
|
236
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
237
|
-
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"
|
|
238
|
-
}))), /*#__PURE__*/_react.default.createElement("span", {
|
|
239
|
-
className: (0, _classnames.default)(_design.default['toolbar-item'], (0, _defineProperty2.default)({}, _design.default.disabled, forwardLength < 1)),
|
|
240
|
-
onClick: function onClick() {
|
|
241
|
-
return forwardLength > 0 && forward();
|
|
242
|
-
}
|
|
243
|
-
}, /*#__PURE__*/_react.default.createElement("svg", {
|
|
244
|
-
viewBox: "0 0 1024 1024",
|
|
245
|
-
width: "20",
|
|
246
|
-
height: "20",
|
|
247
|
-
fill: "currentColor"
|
|
248
|
-
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
249
|
-
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"
|
|
250
|
-
}))), /*#__PURE__*/_react.default.createElement(_antd.Divider, {
|
|
251
|
-
type: "vertical"
|
|
252
216
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
253
217
|
style: {
|
|
254
218
|
width: 'auto',
|
|
@@ -320,15 +284,15 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
320
284
|
return document.getElementById('lc-design-workspace');
|
|
321
285
|
},
|
|
322
286
|
zIndex: 3000,
|
|
323
|
-
bodyStyle: {
|
|
324
|
-
height: '70vh'
|
|
325
|
-
},
|
|
326
287
|
onOk: handleOk,
|
|
327
288
|
onCancel: function onCancel() {
|
|
328
289
|
return setShow(false);
|
|
329
290
|
}
|
|
330
291
|
}, /*#__PURE__*/_react.default.createElement(_JsonEditor.default, {
|
|
331
|
-
ref: editorRef
|
|
292
|
+
ref: editorRef,
|
|
293
|
+
style: {
|
|
294
|
+
height: '70vh'
|
|
295
|
+
}
|
|
332
296
|
}, JSON.stringify(pageData, null, '\t'))), /*#__PURE__*/_react.default.createElement(_antd.Drawer, {
|
|
333
297
|
title: /*#__PURE__*/_react.default.createElement("div", {
|
|
334
298
|
id: "preview-drawer-header",
|
|
@@ -401,7 +365,8 @@ var DesignToolbar = function DesignToolbar(_ref) {
|
|
|
401
365
|
}
|
|
402
366
|
}, /*#__PURE__*/_react.default.createElement(_preview.default, {
|
|
403
367
|
code: location.query.code,
|
|
404
|
-
userId: userId || 'no-user'
|
|
368
|
+
userId: userId || 'no-user',
|
|
369
|
+
debug: true
|
|
405
370
|
})));
|
|
406
371
|
};
|
|
407
372
|
var _default = exports.default = DesignToolbar;
|
|
@@ -27,9 +27,7 @@ var Outline = function Outline(_ref) {
|
|
|
27
27
|
var open = _ref.open;
|
|
28
28
|
var clickBySelf = (0, _react.useRef)(false);
|
|
29
29
|
var ctx = (0, _ContextProvider.useContext)();
|
|
30
|
-
var
|
|
31
|
-
_usePageData2 = (0, _slicedToArray2.default)(_usePageData, 1),
|
|
32
|
-
pageData = _usePageData2[0];
|
|
30
|
+
var pageData = (0, _ContextProvider.useGet)();
|
|
33
31
|
var _useState = (0, _react.useState)(null),
|
|
34
32
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
35
33
|
pageAndModal = _useState2[0],
|
|
@@ -19,7 +19,6 @@ var _ContextProvider = require("../engine/provider/ContextProvider");
|
|
|
19
19
|
var _AttrsPanel = _interopRequireDefault(require("./components/AttrsPanel"));
|
|
20
20
|
var _StylePanel = _interopRequireDefault(require("./panel-section/StylePanel"));
|
|
21
21
|
var _AdvancePanel = _interopRequireDefault(require("./components/AdvancePanel"));
|
|
22
|
-
var _dataProcess = require("../engine/tools/dataProcess");
|
|
23
22
|
var _panel = _interopRequireDefault(require("./style/panel.less"));
|
|
24
23
|
var _constants = require("../constants");
|
|
25
24
|
var _I18N_PREFIX_ = 'luckda.lowcode.painter.panel';
|
|
@@ -54,10 +53,7 @@ var Panel = function Panel() {
|
|
|
54
53
|
activeTabKey = _useState4[0],
|
|
55
54
|
setActiveTabKey = _useState4[1];
|
|
56
55
|
var context = (0, _ContextProvider.useContext)();
|
|
57
|
-
var
|
|
58
|
-
_usePageData2 = (0, _slicedToArray2.default)(_usePageData, 2),
|
|
59
|
-
pageData = _usePageData2[0],
|
|
60
|
-
setPageData = _usePageData2[1].setPageData;
|
|
56
|
+
var task = (0, _ContextProvider.useTask)('modify');
|
|
61
57
|
var meta = (0, _ahooks.useCreation)(function () {
|
|
62
58
|
try {
|
|
63
59
|
return (0, _lodash.isNil)(activeNode) ? null : require("../engine/meta/".concat(activeNode.node.component.toLowerCase(), ".props.json"));
|
|
@@ -65,38 +61,41 @@ var Panel = function Panel() {
|
|
|
65
61
|
return null;
|
|
66
62
|
}
|
|
67
63
|
}, [activeNode]);
|
|
68
|
-
var handleChange = (0, _ahooks.useMemoizedFn)(function (field, value
|
|
64
|
+
var handleChange = (0, _ahooks.useMemoizedFn)(function (field, value) {
|
|
65
|
+
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
66
|
+
repositioning = _ref.repositioning,
|
|
67
|
+
before = _ref.before;
|
|
69
68
|
if (field === 'enableHeader') {
|
|
70
69
|
if (value) {
|
|
71
70
|
var headerMeta = require("../engine/meta/pageheader.props.default.json");
|
|
72
|
-
(0,
|
|
71
|
+
(0, _ContextProvider.addNode)(_constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT, _constants.LC_BUILDIN_UNIT_KEY.PAGE_HEADER, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headerMeta), {}, {
|
|
73
72
|
buildIn: true
|
|
74
73
|
}));
|
|
75
74
|
} else {
|
|
76
|
-
(0,
|
|
75
|
+
(0, _ContextProvider.deleteNode)(_constants.LC_BUILDIN_UNIT_KEY.PAGE_HEADER);
|
|
77
76
|
}
|
|
78
77
|
} else if (field === 'enableFooter') {
|
|
79
78
|
if (value) {
|
|
80
79
|
var footerMeta = require("../engine/meta/pagefooter.props.default.json");
|
|
81
|
-
(0,
|
|
80
|
+
(0, _ContextProvider.addNode)(_constants.LC_BUILDIN_UNIT_KEY.PAGE_ROOT, _constants.LC_BUILDIN_UNIT_KEY.PAGE_FOOTER, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, footerMeta), {}, {
|
|
82
81
|
buildIn: true
|
|
83
82
|
}));
|
|
84
83
|
} else {
|
|
85
|
-
(0,
|
|
84
|
+
(0, _ContextProvider.deleteNode)(_constants.LC_BUILDIN_UNIT_KEY.PAGE_FOOTER);
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
var component = context.componentMap.get(activeNode.node.id);
|
|
89
|
-
var
|
|
90
|
-
node = _component$api$getSel.node;
|
|
88
|
+
var node = component.api.getSelfData();
|
|
91
89
|
var oldValue = (0, _defineProperty2.default)({}, field, (0, _lodash.get)(node.props, field));
|
|
92
|
-
var
|
|
93
|
-
(
|
|
94
|
-
|
|
90
|
+
var newValue = (0, _defineProperty2.default)({}, field, value);
|
|
91
|
+
if (before) {
|
|
92
|
+
before(handleChange);
|
|
93
|
+
}
|
|
94
|
+
task(activeNode.node.id, newValue).then(function (a, b) {
|
|
95
95
|
context.$publisher(context.topics.COMPONENT_MODIFY, {
|
|
96
96
|
id: activeNode.node.id,
|
|
97
|
-
pageData: newData,
|
|
98
97
|
oldValue: oldValue,
|
|
99
|
-
newValue:
|
|
98
|
+
newValue: newValue
|
|
100
99
|
});
|
|
101
100
|
if (repositioning) context.$publisher(context.topics.COMPONENT_REPOSITIONING, {
|
|
102
101
|
id: activeNode.node.id
|
|
@@ -111,8 +110,7 @@ var Panel = function Panel() {
|
|
|
111
110
|
return;
|
|
112
111
|
}
|
|
113
112
|
var component = context.componentMap.get(payload.id);
|
|
114
|
-
var
|
|
115
|
-
node = _component$api$getSel2.node;
|
|
113
|
+
var node = component.api.getSelfData();
|
|
116
114
|
var levelNodes = (0, _lodash.takeRight)(component.api.getLevelNodes(), 4);
|
|
117
115
|
setActiveNode({
|
|
118
116
|
node: node.props,
|
|
@@ -135,9 +133,9 @@ var Panel = function Panel() {
|
|
|
135
133
|
style: {
|
|
136
134
|
fontSize: 12
|
|
137
135
|
}
|
|
138
|
-
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (
|
|
139
|
-
var id =
|
|
140
|
-
name =
|
|
136
|
+
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (_ref2) {
|
|
137
|
+
var id = _ref2.id,
|
|
138
|
+
name = _ref2.name;
|
|
141
139
|
return /*#__PURE__*/_react.default.createElement(_antd.Breadcrumb.Item, {
|
|
142
140
|
key: id,
|
|
143
141
|
className: (0, _classnames.default)((0, _defineProperty2.default)({}, _panel.default['active-node-level'], id !== activeNode.node.id)),
|
|
@@ -184,19 +182,22 @@ var Panel = function Panel() {
|
|
|
184
182
|
ref: underLineRef,
|
|
185
183
|
className: _panel.default.underline
|
|
186
184
|
})), activeTabKey === _TAB_LIST_[0].key && /*#__PURE__*/_react.default.createElement(_AttrsPanel.default, {
|
|
185
|
+
key: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
186
|
+
nodeId: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
187
187
|
meta: meta,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
return handleChange(field, value, repositioning);
|
|
188
|
+
onChange: function onChange(field, value, params) {
|
|
189
|
+
return handleChange(field, value, params);
|
|
191
190
|
}
|
|
192
191
|
}), activeTabKey === _TAB_LIST_[1].key && /*#__PURE__*/_react.default.createElement(_StylePanel.default, {
|
|
193
|
-
|
|
192
|
+
key: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
193
|
+
nodeId: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
194
194
|
onChange: function onChange(_, newCss) {
|
|
195
195
|
return handleChange('css', newCss);
|
|
196
196
|
}
|
|
197
197
|
}), activeTabKey === _TAB_LIST_[2].key && /*#__PURE__*/_react.default.createElement(_AdvancePanel.default, {
|
|
198
|
+
key: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
199
|
+
nodeId: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.id,
|
|
198
200
|
meta: meta,
|
|
199
|
-
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.advance,
|
|
200
201
|
onChange: function onChange(val) {
|
|
201
202
|
return handleChange('advance', val);
|
|
202
203
|
}
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
12
|
var _ahooks = require("ahooks");
|
|
@@ -17,7 +16,6 @@ var _lodash = require("lodash");
|
|
|
17
16
|
var _utils = require("@luck-design-biz/base/utils");
|
|
18
17
|
var _ContextProvider = require("../../engine/provider/ContextProvider");
|
|
19
18
|
var _JSEditor = _interopRequireDefault(require("./code-editor/JSEditor"));
|
|
20
|
-
var _JsonEditor = _interopRequireDefault(require("./code-editor/JsonEditor"));
|
|
21
19
|
var _actionBindModal = _interopRequireDefault(require("../style/action-bind-modal.less"));
|
|
22
20
|
var _I18N_PREFIX_ = 'luckda.lowcode.painter.actionBindModal';
|
|
23
21
|
var _ACTION_CATEGORY_ = [{
|
|
@@ -39,7 +37,7 @@ var _ACTION_CATEGORY_ = [{
|
|
|
39
37
|
label: '自定义动作'
|
|
40
38
|
})
|
|
41
39
|
}];
|
|
42
|
-
var _DEFAULT_JSON_CODE_ = '{"
|
|
40
|
+
var _DEFAULT_JSON_CODE_ = '{"params":{},"data":{}}';
|
|
43
41
|
var _DEFAULT_JS_CODE_ = 'function todo() {\n\n}';
|
|
44
42
|
var ActionBindModal = function ActionBindModal(_ref) {
|
|
45
43
|
var event = _ref.event,
|
|
@@ -89,7 +87,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
89
87
|
target = _ref3[1];
|
|
90
88
|
ret.push({
|
|
91
89
|
key: key,
|
|
92
|
-
label: "".concat(target.api.
|
|
90
|
+
label: "".concat(target.api.getSelfData().props.name, "(").concat(key, ")")
|
|
93
91
|
});
|
|
94
92
|
return ret;
|
|
95
93
|
}, []);
|
|
@@ -107,27 +105,28 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
107
105
|
(0, _ahooks.useUpdateEffect)(function () {
|
|
108
106
|
if (activeKey) {
|
|
109
107
|
var action = get(activeKey);
|
|
110
|
-
editorRef.current.editor.setValue(action.code);
|
|
108
|
+
(action === null || action === void 0 ? void 0 : action.code) && editorRef.current.editor.setValue(action.code);
|
|
111
109
|
}
|
|
112
110
|
}, [activeKey]);
|
|
113
111
|
(0, _ahooks.useUpdateEffect)(function () {
|
|
114
112
|
setAll(event === null || event === void 0 ? void 0 : event.actionPool);
|
|
115
113
|
}, [event]);
|
|
116
|
-
var
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
var _useDebounceFn = (0, _ahooks.useDebounceFn)(function (code) {
|
|
115
|
+
if (latestActiveKey.current) {
|
|
116
|
+
var action = get(latestActiveKey.current);
|
|
117
|
+
action.code = code;
|
|
118
|
+
}
|
|
119
|
+
}, {
|
|
120
|
+
wait: 500
|
|
121
|
+
}),
|
|
122
|
+
handleEditorValueChange = _useDebounceFn.run;
|
|
122
123
|
var handleOptionClick = (0, _ahooks.useMemoizedFn)(function (key) {
|
|
123
124
|
setActiveKey(key);
|
|
124
125
|
var action;
|
|
125
126
|
if (actionPool.has(key)) {
|
|
126
127
|
action = get(key);
|
|
127
128
|
} else {
|
|
128
|
-
var code = category === 'custom' ?
|
|
129
|
-
moduleCode: module.moduleCode
|
|
130
|
-
}, JSON.parse(_DEFAULT_JSON_CODE_)), null, '\t');
|
|
129
|
+
var code = event.func || (category === 'custom' ? defaultCode : "".concat(defaultCode.slice(0, -1), "\n\treturn ").concat(_DEFAULT_JSON_CODE_, " \n}"));
|
|
131
130
|
action = {
|
|
132
131
|
category: category,
|
|
133
132
|
key: key,
|
|
@@ -141,9 +140,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
141
140
|
if (activeKey !== key) {
|
|
142
141
|
setActiveKey(key);
|
|
143
142
|
}
|
|
144
|
-
var code = category === 'custom' ?
|
|
145
|
-
moduleCode: module.moduleCode
|
|
146
|
-
}, JSON.parse(_DEFAULT_JSON_CODE_)), null, '\t');
|
|
143
|
+
var code = event.func || (category === 'custom' ? defaultCode : "".concat(defaultCode.slice(0, -1), "\n\treturn ").concat(_DEFAULT_JSON_CODE_, " \n}"));
|
|
147
144
|
set(key, {
|
|
148
145
|
category: category,
|
|
149
146
|
key: key,
|
|
@@ -175,7 +172,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
175
172
|
},
|
|
176
173
|
title: event === null || event === void 0 ? void 0 : event.name,
|
|
177
174
|
visible: !!event,
|
|
178
|
-
width:
|
|
175
|
+
width: "70vw",
|
|
179
176
|
closable: false,
|
|
180
177
|
maskClosable: false,
|
|
181
178
|
getContainer: function getContainer() {
|
|
@@ -203,7 +200,16 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
203
200
|
className: (0, _classnames.default)((0, _defineProperty2.default)({}, _actionBindModal.default.active, key === category)),
|
|
204
201
|
onClick: function onClick() {
|
|
205
202
|
setCategory(key);
|
|
206
|
-
|
|
203
|
+
if ('custom' === key) {
|
|
204
|
+
setActiveKey('coding');
|
|
205
|
+
if (!actionPool.has(key)) {
|
|
206
|
+
set('coding', {
|
|
207
|
+
category: key,
|
|
208
|
+
key: 'coding',
|
|
209
|
+
code: event.func || defaultCode
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
207
213
|
}
|
|
208
214
|
}, label, key === category && /*#__PURE__*/_react.default.createElement(_antd.Icon, {
|
|
209
215
|
type: "check",
|
|
@@ -278,9 +284,9 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
278
284
|
type: "exclamation-circle"
|
|
279
285
|
}))), /*#__PURE__*/_react.default.createElement("div", {
|
|
280
286
|
className: _actionBindModal.default['code-box']
|
|
281
|
-
}, activeKey ? /*#__PURE__*/_react.default.createElement(
|
|
287
|
+
}, activeKey ? /*#__PURE__*/_react.default.createElement(_JSEditor.default, {
|
|
282
288
|
ref: editorRef,
|
|
283
|
-
onChange: handleEditorValueChange
|
|
289
|
+
onChange: handleEditorValueChange
|
|
284
290
|
}) : (0, _utils.formatMessage)({
|
|
285
291
|
id: "".concat(_I18N_PREFIX_, ".noActionSelected"),
|
|
286
292
|
label: '请在右侧选择行为项'
|
|
@@ -291,7 +297,7 @@ var ActionBindModal = function ActionBindModal(_ref) {
|
|
|
291
297
|
className: _actionBindModal.default['code-box']
|
|
292
298
|
}, activeKey ? /*#__PURE__*/_react.default.createElement(_JSEditor.default, {
|
|
293
299
|
ref: editorRef,
|
|
294
|
-
onChange: handleEditorValueChange
|
|
300
|
+
onChange: handleEditorValueChange
|
|
295
301
|
}) : (0, _utils.formatMessage)({
|
|
296
302
|
id: "".concat(_I18N_PREFIX_, ".noActionSelected"),
|
|
297
303
|
label: '请在右侧选择行为项'
|
|
@@ -15,6 +15,7 @@ var _ahooks = require("ahooks");
|
|
|
15
15
|
var _antd = require("luck-design/antd");
|
|
16
16
|
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
17
17
|
var _lodash = require("lodash");
|
|
18
|
+
var _ContextProvider = require("../../engine/provider/ContextProvider");
|
|
18
19
|
var _utils = require("@luck-design-biz/base/utils");
|
|
19
20
|
var _Collapse = _interopRequireDefault(require("./Collapse"));
|
|
20
21
|
var _ActionBindModal = _interopRequireDefault(require("./ActionBindModal"));
|
|
@@ -27,8 +28,12 @@ var EventItem = _styledComponents.default.div.withConfig({
|
|
|
27
28
|
})(["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;}"]);
|
|
28
29
|
var AdvancePanel = function AdvancePanel(_ref) {
|
|
29
30
|
var meta = _ref.meta,
|
|
30
|
-
|
|
31
|
+
nodeId = _ref.nodeId,
|
|
31
32
|
onChange = _ref.onChange;
|
|
33
|
+
var value = (0, _ContextProvider.useGet)({
|
|
34
|
+
id: nodeId,
|
|
35
|
+
path: 'props.advance'
|
|
36
|
+
});
|
|
32
37
|
var _useState = (0, _react.useState)((value === null || value === void 0 ? void 0 : value.events) || {}),
|
|
33
38
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
34
39
|
events = _useState2[0],
|