@luck-design-biz/luckda 0.0.24-2 → 0.0.25
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 +130 -0
- package/es/components/LDActions/index.less +48 -0
- package/es/components/LdFormList/index.js +1 -1
- package/es/components/LdGrid/index.js +9 -3
- package/es/components/LdTree/index.js +32 -5
- package/es/components/LdTree/index.less +6 -1
- package/es/index.js +1 -0
- package/es/locales/zh-CN.js +151 -0
- package/es/lowcode/constants/api-url.js +71 -12
- package/es/lowcode/constants/index.js +3 -1
- package/es/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +32 -0
- package/es/lowcode/engine/factory/panel-item-factory/index.js +2 -0
- package/es/lowcode/engine/meta/box.props.default.json +1 -3
- package/es/lowcode/engine/meta/box.props.json +1 -3
- package/es/lowcode/engine/meta/button.props.default.json +1 -1
- package/es/lowcode/engine/meta/button.props.json +1 -1
- package/es/lowcode/engine/meta/cardlist.props.default.json +0 -1
- package/es/lowcode/engine/meta/cardlist.props.json +1 -2
- package/es/lowcode/engine/meta/dialog.props.default.json +0 -1
- package/es/lowcode/engine/meta/dialog.props.json +0 -1
- package/es/lowcode/engine/meta/drawer.props.default.json +0 -1
- package/es/lowcode/engine/meta/drawer.props.json +0 -1
- package/es/lowcode/engine/meta/form.props.default.json +0 -1
- package/es/lowcode/engine/meta/form.props.json +1 -2
- package/es/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/es/lowcode/engine/meta/iframe.props.json +1 -1
- package/es/lowcode/engine/meta/image.props.default.json +1 -1
- package/es/lowcode/engine/meta/image.props.json +1 -1
- package/es/lowcode/engine/meta/imex.props.default.json +1 -1
- package/es/lowcode/engine/meta/imex.props.json +1 -1
- package/es/lowcode/engine/meta/js-editor/auto-complete.json +132 -26
- package/es/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/es/lowcode/engine/meta/jsx.props.json +1 -1
- package/es/lowcode/engine/meta/layout.props.default.json +1 -1
- package/es/lowcode/engine/meta/layout.props.json +1 -1
- package/es/lowcode/engine/meta/link.props.default.json +1 -1
- package/es/lowcode/engine/meta/link.props.json +1 -1
- package/es/lowcode/engine/meta/local/local.zh-cn.js +97 -0
- package/es/lowcode/engine/meta/section.props.default.json +1 -1
- package/es/lowcode/engine/meta/section.props.json +1 -1
- package/es/lowcode/engine/meta/split.props.default.json +1 -1
- package/es/lowcode/engine/meta/split.props.json +1 -1
- package/es/lowcode/engine/meta/table.props.default.json +18 -2
- package/es/lowcode/engine/meta/table.props.json +207 -32
- package/es/lowcode/engine/meta/tabs.props.default.json +0 -1
- package/es/lowcode/engine/meta/tabs.props.json +0 -1
- package/es/lowcode/engine/meta/text.props.default.json +1 -1
- package/es/lowcode/engine/meta/text.props.json +1 -1
- package/es/lowcode/engine/meta/tree.props.default.json +9 -4
- package/es/lowcode/engine/meta/tree.props.json +101 -55
- package/es/lowcode/engine/provider/{ContextProvider.js → ContextProvider/index.js} +71 -41
- package/es/lowcode/engine/tools/helper.js +29 -1
- package/es/lowcode/engine/tools/usePromiseState.js +7 -6
- package/es/lowcode/painter/Panel.js +50 -133
- package/es/lowcode/painter/Ribbon.js +1 -1
- package/es/lowcode/painter/components/ActionBindModal.js +180 -0
- package/es/lowcode/painter/components/AdvancePanel.js +68 -0
- package/es/lowcode/painter/components/AttrsPanel.js +134 -0
- package/es/lowcode/painter/components/Collapse.js +12 -7
- package/es/lowcode/painter/components/FieldSelector.js +44 -0
- package/es/lowcode/painter/components/ListEditor.js +4 -2
- package/es/lowcode/painter/components/PopConfirm.js +10 -3
- package/es/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
- package/es/lowcode/painter/components/code-editor/JSEditor.js +25 -14
- package/es/lowcode/painter/components/code-editor/JsonEditor.js +41 -0
- package/es/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/ActionEditor.js +10 -3
- package/es/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +36 -8
- package/es/lowcode/painter/panel-section/ImpExp.js +91 -0
- package/es/lowcode/painter/panel-section/JSEditor.js +48 -0
- package/es/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/es/lowcode/painter/panel-section/StylePanel/StyleContext.js +1 -1
- package/es/lowcode/painter/panel-section/TableTopFilter.js +306 -0
- package/es/lowcode/painter/style/action-bind-modal.less +99 -0
- package/es/lowcode/painter/style/design.less +1 -1
- package/es/lowcode/painter/style/impexp.less +7 -0
- package/es/lowcode/painter/style/panel-attrs.less +43 -0
- package/es/lowcode/painter/style/panel.less +6 -37
- package/es/lowcode/painter/style/pop-confirm.less +9 -2
- package/es/lowcode/view/lc-components/Box/index.js +20 -4
- package/es/lowcode/view/lc-components/Box/index.less +0 -1
- package/es/lowcode/view/lc-components/Box/meta.json +1 -3
- package/es/lowcode/view/lc-components/Button/meta.json +1 -1
- package/es/lowcode/view/lc-components/CardList/meta.json +1 -2
- package/es/lowcode/view/lc-components/Dialog/meta.json +0 -1
- package/es/lowcode/view/lc-components/Drawer/index.js +16 -0
- package/es/lowcode/view/lc-components/Drawer/meta.json +0 -1
- package/es/lowcode/view/lc-components/Form/meta.json +1 -2
- package/es/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/es/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/es/lowcode/view/lc-components/Image/meta.json +1 -1
- package/es/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/es/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -9
- package/es/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/es/lowcode/view/lc-components/Link/meta.json +1 -1
- package/es/lowcode/view/lc-components/Section/meta.json +1 -1
- package/es/lowcode/view/lc-components/Split/meta.json +1 -1
- package/es/lowcode/view/lc-components/Table/FunctionDesign.js +35 -2
- package/es/lowcode/view/lc-components/Table/components/TopFilter.js +96 -0
- package/es/lowcode/view/lc-components/Table/index.js +255 -35
- package/es/lowcode/view/lc-components/Table/meta.json +179 -32
- package/es/lowcode/view/lc-components/Tabs/meta.json +0 -1
- package/es/lowcode/view/lc-components/Text/meta.json +1 -1
- package/es/lowcode/view/lc-components/Tree/FunctionDesign.js +48 -3
- package/es/lowcode/view/lc-components/Tree/index.js +77 -6
- package/es/lowcode/view/lc-components/Tree/index.less +2 -0
- package/es/lowcode/view/lc-components/Tree/meta.json +97 -55
- package/es/lowcode/view/lc-components/Wrapper.js +2 -2
- package/lib/components/LDActions/index.js +138 -0
- package/lib/components/LDActions/index.less +48 -0
- package/lib/components/LdFormList/index.js +1 -1
- package/lib/components/LdGrid/index.js +8 -2
- package/lib/components/LdTree/index.js +31 -4
- package/lib/components/LdTree/index.less +6 -1
- package/lib/index.js +8 -0
- package/lib/locales/zh-CN.js +157 -0
- package/lib/lowcode/constants/api-url.js +71 -12
- package/lib/lowcode/constants/index.js +4 -2
- package/lib/lowcode/engine/factory/panel-item-factory/CheckboxStrategy.js +38 -0
- package/lib/lowcode/engine/factory/panel-item-factory/index.js +2 -0
- package/lib/lowcode/engine/meta/box.props.default.json +1 -3
- package/lib/lowcode/engine/meta/box.props.json +1 -3
- package/lib/lowcode/engine/meta/button.props.default.json +1 -1
- package/lib/lowcode/engine/meta/button.props.json +1 -1
- package/lib/lowcode/engine/meta/cardlist.props.default.json +0 -1
- package/lib/lowcode/engine/meta/cardlist.props.json +1 -2
- package/lib/lowcode/engine/meta/dialog.props.default.json +0 -1
- package/lib/lowcode/engine/meta/dialog.props.json +0 -1
- package/lib/lowcode/engine/meta/drawer.props.default.json +0 -1
- package/lib/lowcode/engine/meta/drawer.props.json +0 -1
- package/lib/lowcode/engine/meta/form.props.default.json +0 -1
- package/lib/lowcode/engine/meta/form.props.json +1 -2
- package/lib/lowcode/engine/meta/iframe.props.default.json +1 -1
- package/lib/lowcode/engine/meta/iframe.props.json +1 -1
- package/lib/lowcode/engine/meta/image.props.default.json +1 -1
- package/lib/lowcode/engine/meta/image.props.json +1 -1
- package/lib/lowcode/engine/meta/imex.props.default.json +1 -1
- package/lib/lowcode/engine/meta/imex.props.json +1 -1
- package/lib/lowcode/engine/meta/js-editor/auto-complete.json +132 -26
- package/lib/lowcode/engine/meta/jsx.props.default.json +1 -1
- package/lib/lowcode/engine/meta/jsx.props.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.default.json +1 -1
- package/lib/lowcode/engine/meta/layout.props.json +1 -1
- package/lib/lowcode/engine/meta/link.props.default.json +1 -1
- package/lib/lowcode/engine/meta/link.props.json +1 -1
- package/lib/lowcode/engine/meta/local/local.zh-cn.js +103 -0
- package/lib/lowcode/engine/meta/section.props.default.json +1 -1
- package/lib/lowcode/engine/meta/section.props.json +1 -1
- package/lib/lowcode/engine/meta/split.props.default.json +1 -1
- package/lib/lowcode/engine/meta/split.props.json +1 -1
- package/lib/lowcode/engine/meta/table.props.default.json +18 -2
- package/lib/lowcode/engine/meta/table.props.json +207 -32
- package/lib/lowcode/engine/meta/tabs.props.default.json +0 -1
- package/lib/lowcode/engine/meta/tabs.props.json +0 -1
- package/lib/lowcode/engine/meta/text.props.default.json +1 -1
- package/lib/lowcode/engine/meta/text.props.json +1 -1
- package/lib/lowcode/engine/meta/tree.props.default.json +9 -4
- package/lib/lowcode/engine/meta/tree.props.json +101 -55
- package/lib/lowcode/engine/provider/{ContextProvider.js → ContextProvider/index.js} +70 -40
- package/lib/lowcode/engine/tools/helper.js +31 -0
- package/lib/lowcode/engine/tools/usePromiseState.js +6 -5
- package/lib/lowcode/painter/Panel.js +48 -131
- package/lib/lowcode/painter/Ribbon.js +1 -1
- package/lib/lowcode/painter/components/ActionBindModal.js +188 -0
- package/lib/lowcode/painter/components/AdvancePanel.js +76 -0
- package/lib/lowcode/painter/components/AttrsPanel.js +142 -0
- package/lib/lowcode/painter/components/Collapse.js +12 -7
- package/lib/lowcode/painter/components/FieldSelector.js +52 -0
- package/lib/lowcode/painter/components/ListEditor.js +4 -2
- package/lib/lowcode/painter/components/PopConfirm.js +10 -3
- package/lib/lowcode/painter/components/code-editor/BaseEditor.js +14 -2
- package/lib/lowcode/painter/components/code-editor/JSEditor.js +25 -14
- package/lib/lowcode/painter/components/code-editor/JsonEditor.js +48 -0
- package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/ActionEditor.js +10 -3
- package/lib/lowcode/painter/{components/actions-editor → panel-section/ActionsEditor}/index.js +35 -7
- package/lib/lowcode/painter/panel-section/ImpExp.js +98 -0
- package/lib/lowcode/painter/panel-section/JSEditor.js +56 -0
- package/lib/lowcode/painter/panel-section/StylePanel/MainPanel.js +2 -2
- package/lib/lowcode/painter/panel-section/StylePanel/StyleContext.js +1 -1
- package/lib/lowcode/painter/panel-section/TableTopFilter.js +314 -0
- package/lib/lowcode/painter/style/action-bind-modal.less +99 -0
- package/lib/lowcode/painter/style/design.less +1 -1
- package/lib/lowcode/painter/style/impexp.less +7 -0
- package/lib/lowcode/painter/style/panel-attrs.less +43 -0
- package/lib/lowcode/painter/style/panel.less +6 -37
- package/lib/lowcode/painter/style/pop-confirm.less +9 -2
- package/lib/lowcode/view/lc-components/Box/index.js +17 -2
- package/lib/lowcode/view/lc-components/Box/index.less +0 -1
- package/lib/lowcode/view/lc-components/Box/meta.json +1 -3
- package/lib/lowcode/view/lc-components/Button/meta.json +1 -1
- package/lib/lowcode/view/lc-components/CardList/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Dialog/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Drawer/index.js +16 -0
- package/lib/lowcode/view/lc-components/Drawer/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Form/meta.json +1 -2
- package/lib/lowcode/view/lc-components/Iframe/meta.json +1 -1
- package/lib/lowcode/view/lc-components/ImEx/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Image/meta.json +1 -1
- package/lib/lowcode/view/lc-components/JSX/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Layout/FunctionDesign.js +6 -9
- package/lib/lowcode/view/lc-components/Layout/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Link/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Section/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Split/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Table/FunctionDesign.js +37 -3
- package/lib/lowcode/view/lc-components/Table/components/TopFilter.js +104 -0
- package/lib/lowcode/view/lc-components/Table/index.js +255 -35
- package/lib/lowcode/view/lc-components/Table/meta.json +179 -32
- package/lib/lowcode/view/lc-components/Tabs/meta.json +0 -1
- package/lib/lowcode/view/lc-components/Text/meta.json +1 -1
- package/lib/lowcode/view/lc-components/Tree/FunctionDesign.js +49 -3
- package/lib/lowcode/view/lc-components/Tree/index.js +77 -6
- package/lib/lowcode/view/lc-components/Tree/index.less +2 -0
- package/lib/lowcode/view/lc-components/Tree/meta.json +97 -55
- package/lib/lowcode/view/lc-components/Wrapper.js +2 -2
- package/package.json +10 -5
- package/es/lowcode/painter/panel-section/TableActions.js +0 -19
- package/lib/lowcode/painter/panel-section/TableActions.js +0 -26
|
@@ -12,12 +12,12 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _umi = require("umi");
|
|
14
14
|
var _ahooks = require("ahooks");
|
|
15
|
-
var _EventBusProvider = require("
|
|
16
|
-
var _usePromiseState3 = _interopRequireDefault(require("
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var _apiUrl = require("
|
|
15
|
+
var _EventBusProvider = require("../EventBusProvider");
|
|
16
|
+
var _usePromiseState3 = _interopRequireDefault(require("../../tools/usePromiseState"));
|
|
17
|
+
var topics = _interopRequireWildcard(require("../../../constants/event-topics"));
|
|
18
|
+
var _dataProcess = require("../../tools/dataProcess");
|
|
19
|
+
var _helper = require("../../tools/helper");
|
|
20
|
+
var _apiUrl = require("../../../constants/api-url");
|
|
21
21
|
var _excluded = ["source"];
|
|
22
22
|
var Context = exports.Context = /*#__PURE__*/(0, _react.createContext)(null);
|
|
23
23
|
var useLDContext = exports.useLDContext = function useLDContext() {
|
|
@@ -42,6 +42,14 @@ var _default = exports.default = function _default(_ref) {
|
|
|
42
42
|
*/
|
|
43
43
|
var _pageinfo = (0, _react.useRef)(null);
|
|
44
44
|
|
|
45
|
+
/**
|
|
46
|
+
* 页面公共资源
|
|
47
|
+
*/
|
|
48
|
+
var _useSetState = (0, _ahooks.useSetState)(null),
|
|
49
|
+
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
50
|
+
pagePublicResource = _useSetState2[0],
|
|
51
|
+
_setPagePublicResource = _useSetState2[1];
|
|
52
|
+
|
|
45
53
|
/**
|
|
46
54
|
* 组件列表
|
|
47
55
|
*/
|
|
@@ -63,7 +71,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
63
71
|
* id:string 组件id
|
|
64
72
|
* component:ReactNode 组件
|
|
65
73
|
*/
|
|
66
|
-
var
|
|
74
|
+
var _register = (0, _ahooks.useMemoizedFn)(function (id, component) {
|
|
67
75
|
_componentList.current.push([id, component]);
|
|
68
76
|
});
|
|
69
77
|
|
|
@@ -71,7 +79,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
71
79
|
* 注销组件
|
|
72
80
|
* id:string 组件id
|
|
73
81
|
*/
|
|
74
|
-
var
|
|
82
|
+
var _unregister = (0, _ahooks.useMemoizedFn)(function (id) {
|
|
75
83
|
_componentList.current = _componentList.current.filter(function (_ref2) {
|
|
76
84
|
var _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
|
|
77
85
|
_id = _ref3[0];
|
|
@@ -118,6 +126,17 @@ var _default = exports.default = function _default(_ref) {
|
|
|
118
126
|
* return:object
|
|
119
127
|
*/
|
|
120
128
|
var getUrlParams = (0, _ahooks.useMemoizedFn)(function () {});
|
|
129
|
+
var doAction = (0, _ahooks.useMemoizedFn)(function (action) {
|
|
130
|
+
(0, _helper.executeCode)(ctx, action.actionCode);
|
|
131
|
+
Promise.all(action.actionPool.map(function (actionKey) {
|
|
132
|
+
return new Promise(function (resolve) {
|
|
133
|
+
setTimeout(function () {
|
|
134
|
+
console.log("doAction:".concat(actionKey));
|
|
135
|
+
resolve(actionKey);
|
|
136
|
+
}, 400);
|
|
137
|
+
});
|
|
138
|
+
})).then();
|
|
139
|
+
});
|
|
121
140
|
var _useRequest = (0, _ahooks.useRequest)(_apiUrl.fetchPageData, {
|
|
122
141
|
manual: true
|
|
123
142
|
}),
|
|
@@ -140,38 +159,49 @@ var _default = exports.default = function _default(_ref) {
|
|
|
140
159
|
}
|
|
141
160
|
});
|
|
142
161
|
}, [code]);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
162
|
+
var ctx = new Proxy((0, _objectSpread2.default)({
|
|
163
|
+
_setPageData: _setPageData,
|
|
164
|
+
_register: _register,
|
|
165
|
+
_unregister: _unregister,
|
|
166
|
+
loading: loading,
|
|
167
|
+
pageData: pageData,
|
|
168
|
+
pagePublicResource: pagePublicResource,
|
|
169
|
+
history: _umi.history,
|
|
170
|
+
topics: topics,
|
|
171
|
+
getElementById: getElementById,
|
|
172
|
+
/**
|
|
173
|
+
* @method
|
|
174
|
+
* @param {string} id - 组件id
|
|
175
|
+
* @return {object}
|
|
176
|
+
*/
|
|
177
|
+
getParentElement: getParentElement,
|
|
178
|
+
getElementPathById: getElementPathById,
|
|
179
|
+
getModule: getModule,
|
|
180
|
+
getDataSetById: getDataSetById,
|
|
181
|
+
doAction: doAction,
|
|
182
|
+
/**
|
|
183
|
+
* @method
|
|
184
|
+
* @return {object}
|
|
185
|
+
*/
|
|
186
|
+
getUrlParams: getUrlParams
|
|
187
|
+
}, eventBus), {
|
|
188
|
+
get: function get(target, property, receiver) {
|
|
189
|
+
if (PRIVATE_KEYS.includes(property)) {
|
|
190
|
+
var _privateGetter$curren;
|
|
191
|
+
return (_privateGetter$curren = _privateGetter.current) === null || _privateGetter$curren === void 0 ? void 0 : _privateGetter$curren[property]();
|
|
174
192
|
}
|
|
175
|
-
|
|
193
|
+
return Reflect.get(target, property, receiver);
|
|
194
|
+
},
|
|
195
|
+
set: function set(target, property, receiver) {
|
|
196
|
+
console.log('set', target, property, receiver);
|
|
197
|
+
if (PRIVATE_KEYS.includes(property)) {
|
|
198
|
+
throw new Error("\u5C5E\u6027 \"".concat(property, "\" \u662F\u53EA\u8BFB\u7684"));
|
|
199
|
+
} else {
|
|
200
|
+
return Reflect.set(target, property, receiver);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
return /*#__PURE__*/_react.default.createElement(Context.Provider, {
|
|
205
|
+
value: ctx
|
|
176
206
|
}, children);
|
|
177
207
|
};
|
|
@@ -4,9 +4,13 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
exports.executeCode = executeCode;
|
|
8
|
+
exports.getCtx = getCtx;
|
|
9
|
+
exports.getFuncBody = getFuncBody;
|
|
7
10
|
exports.isPromise = isPromise;
|
|
8
11
|
exports.listReducer = listReducer;
|
|
9
12
|
exports.omitBadProps = omitBadProps;
|
|
13
|
+
var _construct2 = _interopRequireDefault(require("@babel/runtime/helpers/construct"));
|
|
10
14
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
15
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
@@ -78,4 +82,31 @@ function listReducer(state, action) {
|
|
|
78
82
|
default:
|
|
79
83
|
throw new Error();
|
|
80
84
|
}
|
|
85
|
+
}
|
|
86
|
+
function getCtx(context) {
|
|
87
|
+
return (0, _lodash.omitBy)(context, function (_, key) {
|
|
88
|
+
return (0, _lodash.startsWith)(key, '_');
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function getFuncBody(funcCode) {
|
|
92
|
+
var regex = /{([\s\S]*?)}(?![\s\S]*})/;
|
|
93
|
+
var matches = funcCode.match(regex);
|
|
94
|
+
if (matches) {
|
|
95
|
+
return matches[1].replace(/\s*\n\s*/g, ' ').trim();
|
|
96
|
+
}
|
|
97
|
+
return '';
|
|
98
|
+
}
|
|
99
|
+
function executeCode(context, code, argsName) {
|
|
100
|
+
if (!(0, _lodash.isString)(code)) {
|
|
101
|
+
throw new Error('executeCode编码参数无效');
|
|
102
|
+
}
|
|
103
|
+
for (var _len = arguments.length, args = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
104
|
+
args[_key - 3] = arguments[_key];
|
|
105
|
+
}
|
|
106
|
+
if ((0, _lodash.isNil)(argsName) && args.length > 0 || !(0, _lodash.isNil)(argsName) && !(0, _lodash.isArray)(argsName) || (0, _lodash.isArray)(argsName) && argsName.length !== (args === null || args === void 0 ? void 0 : args.length)) {
|
|
107
|
+
throw new Error('executeCode参数不匹配');
|
|
108
|
+
}
|
|
109
|
+
var ctx = getCtx(context);
|
|
110
|
+
var func = (0, _construct2.default)(Function, (0, _toConsumableArray2.default)(argsName || []).concat(['ctx', getFuncBody(code)]));
|
|
111
|
+
return func.apply(void 0, args.concat([ctx]));
|
|
81
112
|
}
|
|
@@ -9,10 +9,11 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _ahooks = require("ahooks");
|
|
11
11
|
var usePromiseState = function usePromiseState(initialState) {
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
state =
|
|
15
|
-
setState =
|
|
12
|
+
var _useResetState = (0, _ahooks.useResetState)(initialState),
|
|
13
|
+
_useResetState2 = (0, _slicedToArray2.default)(_useResetState, 3),
|
|
14
|
+
state = _useResetState2[0],
|
|
15
|
+
setState = _useResetState2[1],
|
|
16
|
+
resetState = _useResetState2[2];
|
|
16
17
|
var promiseRef = (0, _react.useRef)(null);
|
|
17
18
|
var setStatePromise = (0, _react.useCallback)(function (_state) {
|
|
18
19
|
return new Promise(function (resolve) {
|
|
@@ -26,6 +27,6 @@ var usePromiseState = function usePromiseState(initialState) {
|
|
|
26
27
|
promiseRef.current = null;
|
|
27
28
|
}
|
|
28
29
|
}, [state]);
|
|
29
|
-
return [state, setStatePromise];
|
|
30
|
+
return [state, setStatePromise, resetState];
|
|
30
31
|
};
|
|
31
32
|
var _default = exports.default = usePromiseState;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
10
|
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
@@ -16,29 +14,36 @@ var _ahooks = require("ahooks");
|
|
|
16
14
|
var _antd = require("luck-design/antd");
|
|
17
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
18
16
|
var _lodash = require("lodash");
|
|
17
|
+
var _utils = require("@luck-design-biz/base/utils");
|
|
19
18
|
var _ContextProvider = require("../engine/provider/ContextProvider");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
19
|
+
var _AttrsPanel = _interopRequireDefault(require("./components/AttrsPanel"));
|
|
20
|
+
var _StylePanel = _interopRequireDefault(require("./panel-section/StylePanel"));
|
|
21
|
+
var _AdvancePanel = _interopRequireDefault(require("./components/AdvancePanel"));
|
|
22
22
|
var _dataProcess = require("../engine/tools/dataProcess");
|
|
23
23
|
var _panel = _interopRequireDefault(require("./style/panel.less"));
|
|
24
|
-
var
|
|
25
|
-
var _excluded = ["type", "key", "name", "desc", "default", "props", "panelItem", "next", "repositioning"];
|
|
24
|
+
var _I18N_PREFIX_ = 'luckda.lowcode.painter.panel';
|
|
26
25
|
var _TAB_LIST_ = [{
|
|
27
|
-
title:
|
|
26
|
+
title: (0, _utils.formatMessage)({
|
|
27
|
+
id: "".concat(_I18N_PREFIX_, ".attrs"),
|
|
28
|
+
label: '属性'
|
|
29
|
+
}),
|
|
28
30
|
key: 'attrs'
|
|
29
31
|
}, {
|
|
30
|
-
title:
|
|
32
|
+
title: (0, _utils.formatMessage)({
|
|
33
|
+
id: "".concat(_I18N_PREFIX_, ".styles"),
|
|
34
|
+
label: '样式'
|
|
35
|
+
}),
|
|
31
36
|
key: 'styles'
|
|
32
37
|
}, {
|
|
33
|
-
title:
|
|
38
|
+
title: (0, _utils.formatMessage)({
|
|
39
|
+
id: "".concat(_I18N_PREFIX_, ".advance"),
|
|
40
|
+
label: '高级'
|
|
41
|
+
}),
|
|
34
42
|
key: 'advance'
|
|
35
43
|
}];
|
|
36
44
|
var Panel = function Panel() {
|
|
37
|
-
var _nextRef$current, _nextRef$current2;
|
|
38
45
|
var activeTabRef = (0, _react.useRef)(null);
|
|
39
46
|
var underLineRef = (0, _react.useRef)(null);
|
|
40
|
-
var nextRef = (0, _react.useRef)(null);
|
|
41
|
-
var factory = (0, _react.useRef)(new _panelItemFactory.default());
|
|
42
47
|
var _useState = (0, _react.useState)(null),
|
|
43
48
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
44
49
|
activeNode = _useState2[0],
|
|
@@ -47,13 +52,10 @@ var Panel = function Panel() {
|
|
|
47
52
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
48
53
|
activeTabKey = _useState4[0],
|
|
49
54
|
setActiveTabKey = _useState4[1];
|
|
50
|
-
var _useBoolean = (0, _ahooks.useBoolean)(false),
|
|
51
|
-
_useBoolean2 = (0, _slicedToArray2.default)(_useBoolean, 2),
|
|
52
|
-
open = _useBoolean2[0],
|
|
53
|
-
_useBoolean2$ = _useBoolean2[1],
|
|
54
|
-
setTrue = _useBoolean2$.setTrue,
|
|
55
|
-
setFalse = _useBoolean2$.setFalse;
|
|
56
55
|
var context = (0, _ContextProvider.useLDContext)();
|
|
56
|
+
var meta = (0, _ahooks.useCreation)(function () {
|
|
57
|
+
return (0, _lodash.isNil)(activeNode) ? null : require("../engine/meta/".concat(activeNode.node.component.toLowerCase(), ".props.json"));
|
|
58
|
+
}, [activeNode]);
|
|
57
59
|
var handleChange = (0, _ahooks.useMemoizedFn)(function (field, value, repositioning) {
|
|
58
60
|
var component = context.componentMap.get(activeNode.node.id);
|
|
59
61
|
var _component$api$getSel = component.api.getSelfAndParentLCData(),
|
|
@@ -69,85 +71,10 @@ var Panel = function Panel() {
|
|
|
69
71
|
id: activeNode.node.id
|
|
70
72
|
});
|
|
71
73
|
});
|
|
72
|
-
if (nextRef.current.autoClose) {
|
|
73
|
-
setFalse();
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
var handleStyleChange = (0, _ahooks.useMemoizedFn)(function (newStyle, newCss) {
|
|
77
|
-
console.log('style', newStyle, newCss);
|
|
78
|
-
// setCss(newCss);
|
|
79
|
-
});
|
|
80
|
-
var goNext = (0, _ahooks.useMemoizedFn)(function (_next) {
|
|
81
|
-
if (!_next) return;
|
|
82
|
-
nextRef.current = {
|
|
83
|
-
name: _next.name,
|
|
84
|
-
autoClose: _next.autoClose,
|
|
85
|
-
NextComp: renderPanelItems(_next.props)
|
|
86
|
-
};
|
|
87
|
-
setTrue();
|
|
88
|
-
});
|
|
89
|
-
var renderPanelItems = (0, _ahooks.useMemoizedFn)(function (items) {
|
|
90
|
-
return items.map(function (_ref) {
|
|
91
|
-
var type = _ref.type,
|
|
92
|
-
key = _ref.key,
|
|
93
|
-
name = _ref.name,
|
|
94
|
-
desc = _ref.desc,
|
|
95
|
-
defaultValue = _ref.default,
|
|
96
|
-
props = _ref.props,
|
|
97
|
-
panelItem = _ref.panelItem,
|
|
98
|
-
_next2 = _ref.next,
|
|
99
|
-
repositioning = _ref.repositioning,
|
|
100
|
-
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
101
|
-
var Comp = factory.current.getPanelItemFor((0, _lodash.startsWith)(type, '_') ? 'dynamic' : type, type);
|
|
102
|
-
if (type === 'group') {
|
|
103
|
-
return /*#__PURE__*/_react.default.createElement(Comp, {
|
|
104
|
-
key: key,
|
|
105
|
-
field: key,
|
|
106
|
-
label: name,
|
|
107
|
-
next: _next2 ? function () {
|
|
108
|
-
return goNext(_next2);
|
|
109
|
-
} : null,
|
|
110
|
-
defaultCollapsed: defaultValue,
|
|
111
|
-
desc: desc
|
|
112
|
-
}, renderPanelItems(props || []));
|
|
113
|
-
}
|
|
114
|
-
var _context$componentMap = context.componentMap.get(activeNode.node.id).api.getSelfAndParentLCData(),
|
|
115
|
-
node = _context$componentMap.node;
|
|
116
|
-
return /*#__PURE__*/_react.default.createElement(_PanelItem.default, (0, _extends2.default)({
|
|
117
|
-
key: key,
|
|
118
|
-
field: key,
|
|
119
|
-
label: name,
|
|
120
|
-
desc: desc
|
|
121
|
-
}, panelItem), Comp && /*#__PURE__*/_react.default.createElement(Comp, (0, _extends2.default)({
|
|
122
|
-
defaultValue: (0, _lodash.isNil)(node.props[key]) ? defaultValue : node.props[key],
|
|
123
|
-
next: function next() {
|
|
124
|
-
return goNext(_next2);
|
|
125
|
-
},
|
|
126
|
-
onChange: function onChange(value) {
|
|
127
|
-
return handleChange(key, value, repositioning);
|
|
128
|
-
},
|
|
129
|
-
size: "small"
|
|
130
|
-
}, rest)));
|
|
131
|
-
});
|
|
132
74
|
});
|
|
133
|
-
var PropsComps = (0, _ahooks.useCreation)(function () {
|
|
134
|
-
setActiveTabKey('attrs');
|
|
135
|
-
var _meta;
|
|
136
|
-
try {
|
|
137
|
-
_meta = require("../engine/meta/".concat(activeNode.node.component.toLowerCase(), ".props.json"));
|
|
138
|
-
} catch (e) {
|
|
139
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
140
|
-
}
|
|
141
|
-
return renderPanelItems(_meta.props);
|
|
142
|
-
}, [activeNode]);
|
|
143
|
-
(0, _react.useEffect)(function () {
|
|
144
|
-
if (!open) {
|
|
145
|
-
nextRef.current = null;
|
|
146
|
-
}
|
|
147
|
-
}, [open]);
|
|
148
75
|
(0, _react.useEffect)(function () {
|
|
149
76
|
var _id = context.$subscriber(context.topics.COMPONENT_ACTIVE).on(function (payload) {
|
|
150
|
-
|
|
77
|
+
setActiveTabKey('attrs');
|
|
151
78
|
if (!payload.id) {
|
|
152
79
|
setActiveNode(null);
|
|
153
80
|
return;
|
|
@@ -162,7 +89,7 @@ var Panel = function Panel() {
|
|
|
162
89
|
});
|
|
163
90
|
}).watch();
|
|
164
91
|
return function () {
|
|
165
|
-
context.$unsubscriber(context.topics.COMPONENT_ACTIVE, _id);
|
|
92
|
+
return context.$unsubscriber(context.topics.COMPONENT_ACTIVE, _id);
|
|
166
93
|
};
|
|
167
94
|
}, []);
|
|
168
95
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -177,9 +104,9 @@ var Panel = function Panel() {
|
|
|
177
104
|
style: {
|
|
178
105
|
fontSize: 12
|
|
179
106
|
}
|
|
180
|
-
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (
|
|
181
|
-
var id =
|
|
182
|
-
name =
|
|
107
|
+
}, activeNode === null || activeNode === void 0 ? void 0 : activeNode.level.map(function (_ref) {
|
|
108
|
+
var id = _ref.id,
|
|
109
|
+
name = _ref.name;
|
|
183
110
|
return /*#__PURE__*/_react.default.createElement(_antd.Breadcrumb.Item, {
|
|
184
111
|
key: id,
|
|
185
112
|
className: (0, _classnames.default)((0, _defineProperty2.default)({}, _panel.default['active-node-level'], id !== activeNode.node.id)),
|
|
@@ -204,7 +131,7 @@ var Panel = function Panel() {
|
|
|
204
131
|
className: (0, _classnames.default)(_panel.default['lc-painter-panel-tabbar'], (0, _defineProperty2.default)({}, _panel.default.hidden, !activeNode))
|
|
205
132
|
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
206
133
|
className: _panel.default.headerList
|
|
207
|
-
}, (activeNode !== null && activeNode !== void 0 && activeNode.node.
|
|
134
|
+
}, (activeNode !== null && activeNode !== void 0 && activeNode.node.css ? _TAB_LIST_ : [_TAB_LIST_[0], _TAB_LIST_[2]]).map(function (_item) {
|
|
208
135
|
return /*#__PURE__*/_react.default.createElement("li", {
|
|
209
136
|
key: _item.key,
|
|
210
137
|
ref: activeTabKey === _item.key ? activeTabRef : null,
|
|
@@ -216,38 +143,28 @@ var Panel = function Panel() {
|
|
|
216
143
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
217
144
|
ref: underLineRef,
|
|
218
145
|
className: _panel.default.underline
|
|
219
|
-
})), activeTabKey === _TAB_LIST_[0].key && /*#__PURE__*/_react.default.createElement(
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
mask: false,
|
|
225
|
-
closable: false,
|
|
226
|
-
getContainer: false,
|
|
227
|
-
destroyOnClose: true,
|
|
228
|
-
style: {
|
|
229
|
-
position: 'absolute'
|
|
230
|
-
},
|
|
231
|
-
bodyStyle: {
|
|
232
|
-
padding: 0,
|
|
233
|
-
height: '100%'
|
|
146
|
+
})), activeTabKey === _TAB_LIST_[0].key && /*#__PURE__*/_react.default.createElement(_AttrsPanel.default, {
|
|
147
|
+
meta: meta,
|
|
148
|
+
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node,
|
|
149
|
+
onChange: function onChange(field, value, repositioning) {
|
|
150
|
+
return handleChange(field, value, repositioning);
|
|
234
151
|
}
|
|
235
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
}
|
|
247
|
-
onChange: handleStyleChange,
|
|
248
|
-
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.style
|
|
249
|
-
}), activeTabKey === _TAB_LIST_[2].key && /*#__PURE__*/_react.default.createElement("div", null, "\u9AD8\u7EA7\u9762\u677F"), /*#__PURE__*/_react.default.createElement("div", {
|
|
152
|
+
}), activeTabKey === _TAB_LIST_[1].key && /*#__PURE__*/_react.default.createElement(_StylePanel.default, {
|
|
153
|
+
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node.css,
|
|
154
|
+
onChange: function onChange(_, newCss) {
|
|
155
|
+
return handleChange('css', newCss);
|
|
156
|
+
}
|
|
157
|
+
}), activeTabKey === _TAB_LIST_[2].key && /*#__PURE__*/_react.default.createElement(_AdvancePanel.default, {
|
|
158
|
+
meta: meta,
|
|
159
|
+
value: activeNode === null || activeNode === void 0 ? void 0 : activeNode.node,
|
|
160
|
+
onChange: function onChange(val) {
|
|
161
|
+
return handleChange('advance', val);
|
|
162
|
+
}
|
|
163
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
250
164
|
className: (0, _classnames.default)(_panel.default['lc-painter-panel-empty'], (0, _defineProperty2.default)({}, _panel.default.hidden, !!activeNode))
|
|
251
|
-
},
|
|
165
|
+
}, (0, _utils.formatMessage)({
|
|
166
|
+
id: "".concat(_I18N_PREFIX_, ".empty"),
|
|
167
|
+
label: '请在左侧画布选中节点'
|
|
168
|
+
})));
|
|
252
169
|
};
|
|
253
170
|
var _default = exports.default = Panel;
|