@zhubangyun/lowcode-core 5.10.82 → 5.10.91

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.
Files changed (61) hide show
  1. package/es/components/load-materials/index.js +3 -4
  2. package/es/components/log-error-content.d.ts +5 -0
  3. package/es/components/log-error-content.js +32 -0
  4. package/es/components/typing.d.ts +1 -1
  5. package/es/index.js +0 -1
  6. package/es/style.js +1 -1
  7. package/es/utils/api/form-api.js +8 -5
  8. package/es/utils/api/form-api.utils.js +19 -32
  9. package/es/utils/api/rest-api.d.ts +6 -6
  10. package/es/utils/api/rest-api.js +24 -52
  11. package/es/utils/api/schema-api.d.ts +1 -0
  12. package/es/utils/api/schema-api.js +10 -8
  13. package/es/utils/common/LoadPlugins.js +16 -9
  14. package/es/utils/common/SingletonInstanceMap.d.ts +1 -0
  15. package/es/utils/common/SingletonInstanceMap.js +3 -0
  16. package/es/utils/designer/assets/assets.typing.d.ts +3 -3
  17. package/es/utils/designer/assets/index.d.ts +1 -1
  18. package/es/utils/page/page-form-data-manager-group.d.ts +1 -1
  19. package/es/utils/page/page-form-data-manager.d.ts +1 -1
  20. package/es/utils/page/page-form.d.ts +2 -1
  21. package/es/utils/page/page-layout.d.ts +2 -2
  22. package/es/utils/page/page-layout.js +7 -4
  23. package/es/utils/page/page-load-schema.js +8 -0
  24. package/es/utils/page/page-render.js +10 -11
  25. package/es/utils/page/page-show.d.ts +1 -4
  26. package/es/utils/page/page-show.js +3 -3
  27. package/lib/components/load-materials/index.js +3 -4
  28. package/lib/components/log-error-content.d.ts +5 -0
  29. package/lib/components/log-error-content.js +37 -0
  30. package/lib/components/typing.d.ts +1 -1
  31. package/lib/index.js +0 -2
  32. package/lib/style.js +1 -1
  33. package/lib/utils/api/form-api.js +8 -5
  34. package/lib/utils/api/form-api.utils.js +19 -32
  35. package/lib/utils/api/rest-api.d.ts +6 -6
  36. package/lib/utils/api/rest-api.js +24 -52
  37. package/lib/utils/api/schema-api.d.ts +1 -0
  38. package/lib/utils/api/schema-api.js +11 -8
  39. package/lib/utils/common/LoadPlugins.js +16 -9
  40. package/lib/utils/common/SingletonInstanceMap.d.ts +1 -0
  41. package/lib/utils/common/SingletonInstanceMap.js +3 -0
  42. package/lib/utils/designer/assets/assets.typing.d.ts +3 -3
  43. package/lib/utils/designer/assets/index.d.ts +1 -1
  44. package/lib/utils/page/page-form-data-manager-group.d.ts +1 -1
  45. package/lib/utils/page/page-form-data-manager.d.ts +1 -1
  46. package/lib/utils/page/page-form.d.ts +2 -1
  47. package/lib/utils/page/page-layout.d.ts +2 -2
  48. package/lib/utils/page/page-layout.js +7 -4
  49. package/lib/utils/page/page-load-schema.js +8 -0
  50. package/lib/utils/page/page-render.js +10 -11
  51. package/lib/utils/page/page-show.d.ts +1 -4
  52. package/lib/utils/page/page-show.js +3 -3
  53. package/package.json +7 -7
  54. package/es/utils/common/LoadMaterials.d.ts +0 -1
  55. package/es/utils/common/LoadMaterials.js +0 -37
  56. package/es/utils/common/ProcessHandler.d.ts +0 -30
  57. package/es/utils/common/ProcessHandler.js +0 -303
  58. package/lib/utils/common/LoadMaterials.d.ts +0 -1
  59. package/lib/utils/common/LoadMaterials.js +0 -42
  60. package/lib/utils/common/ProcessHandler.d.ts +0 -30
  61. package/lib/utils/common/ProcessHandler.js +0 -308
@@ -1,303 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import _Modal from "antd/es/modal";
3
- import _message from "antd/es/message";
4
- import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
- import _regeneratorRuntime from "@babel/runtime/regenerator";
6
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
9
- import { isEqual } from "lodash";
10
- export function exeProcessScript(_x, _x2) {
11
- return _exeProcessScript.apply(this, arguments);
12
- }
13
- function _exeProcessScript() {
14
- _exeProcessScript = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(options, scriptType) {
15
- var form, changeValues, script, nodeTitle, exeFormOperation, _exeFormOperation, exeNode, _exeNode;
16
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
17
- while (1) switch (_context3.prev = _context3.next) {
18
- case 0:
19
- _exeNode = function _exeNode3() {
20
- _exeNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(nodeProps) {
21
- var nodeType;
22
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
23
- while (1) switch (_context2.prev = _context2.next) {
24
- case 0:
25
- nodeType = nodeProps.nodeType;
26
- _context2.prev = 1;
27
- _context2.t0 = nodeType;
28
- _context2.next = _context2.t0 === "formOperation" ? 5 : _context2.t0 === "formModal" ? 8 : _context2.t0 === "findOne" ? 11 : _context2.t0 === "findMore" ? 14 : _context2.t0 === "insert" ? 17 : _context2.t0 === "update" ? 17 : _context2.t0 === "delete" ? 17 : _context2.t0 === "break" ? 17 : _context2.t0 === "parallel" ? 18 : _context2.t0 === "condition" ? 18 : _context2.t0 === "branchRouter" ? 21 : _context2.t0 === "loop" ? 22 : _context2.t0 === "trigger" ? 23 : _context2.t0 === "conditionLast" ? 24 : 25;
29
- break;
30
- case 5:
31
- _context2.next = 7;
32
- return exeFormOperation(nodeProps);
33
- case 7:
34
- return _context2.abrupt("return", _context2.sent);
35
- case 8:
36
- _context2.next = 10;
37
- return exeFormModal(nodeProps);
38
- case 10:
39
- return _context2.abrupt("return", _context2.sent);
40
- case 11:
41
- _context2.next = 13;
42
- return exeFindOne(nodeProps);
43
- case 13:
44
- return _context2.abrupt("return", _context2.sent);
45
- case 14:
46
- _context2.next = 16;
47
- return exeFindMore(nodeProps);
48
- case 16:
49
- return _context2.abrupt("return", _context2.sent);
50
- case 17:
51
- return _context2.abrupt("break", 25);
52
- case 18:
53
- _context2.next = 20;
54
- return exeConditions(nodeProps);
55
- case 20:
56
- return _context2.abrupt("return", _context2.sent);
57
- case 21:
58
- return _context2.abrupt("break", 25);
59
- case 22:
60
- return _context2.abrupt("break", 25);
61
- case 23:
62
- return _context2.abrupt("break", 25);
63
- case 24:
64
- return _context2.abrupt("break", 25);
65
- case 25:
66
- _context2.next = 30;
67
- break;
68
- case 27:
69
- _context2.prev = 27;
70
- _context2.t1 = _context2["catch"](1);
71
- throw new Error("\u6267\u884C'" + nodeTitle + "'\u65F6\u8282\u70B9'" + nodeProps.nodeTitle + "'\u53D1\u751F\u5F02\u5E38:" + (_context2.t1 === null || _context2.t1 === void 0 ? void 0 : _context2.t1.message));
72
- case 30:
73
- case "end":
74
- return _context2.stop();
75
- }
76
- }, _callee2, null, [[1, 27]]);
77
- }));
78
- return _exeNode.apply(this, arguments);
79
- };
80
- exeNode = function _exeNode2(_x7) {
81
- return _exeNode.apply(this, arguments);
82
- };
83
- _exeFormOperation = function _exeFormOperation3() {
84
- _exeFormOperation = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(nodeProps) {
85
- var _nodeProps$assignment, assignments, _nodeProps$statues, statues, script;
86
- return _regeneratorRuntime.wrap(function _callee$(_context) {
87
- while (1) switch (_context.prev = _context.next) {
88
- case 0:
89
- _nodeProps$assignment = nodeProps.assignments, assignments = _nodeProps$assignment === void 0 ? [] : _nodeProps$assignment, _nodeProps$statues = nodeProps.statues, statues = _nodeProps$statues === void 0 ? [] : _nodeProps$statues, script = nodeProps.script;
90
- assignments.forEach(function (item) {
91
- //TODO 区分type
92
- form.setFieldValue(item.field, item.value);
93
- });
94
- statues.forEach(function (item) {
95
- var msg = [];
96
- if (item.message) {
97
- msg.push(item.message);
98
- }
99
- if (item.status == "error") {
100
- form.setFields([{
101
- name: item.field,
102
- errors: msg
103
- }]);
104
- } else if (item.status == "warning") {
105
- form.setFields([{
106
- name: item.field,
107
- warnings: msg
108
- }]);
109
- }
110
- });
111
- if (!script) {
112
- _context.next = 12;
113
- break;
114
- }
115
- _context.prev = 4;
116
- _context.next = 7;
117
- return eval("(async () => {" + script + "})()");
118
- case 7:
119
- _context.next = 12;
120
- break;
121
- case 9:
122
- _context.prev = 9;
123
- _context.t0 = _context["catch"](4);
124
- throw new Error(_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.message);
125
- case 12:
126
- case "end":
127
- return _context.stop();
128
- }
129
- }, _callee, null, [[4, 9]]);
130
- }));
131
- return _exeFormOperation.apply(this, arguments);
132
- };
133
- exeFormOperation = function _exeFormOperation2(_x6) {
134
- return _exeFormOperation.apply(this, arguments);
135
- };
136
- form = options.form, changeValues = options.changeValues;
137
- script = scriptType.script, nodeTitle = scriptType.nodeTitle;
138
- /**
139
- * 此处提供 eval script里的 exeNode 方法不可删除
140
- * @param nodeProps
141
- */
142
- _context3.prev = 6;
143
- _context3.next = 9;
144
- return eval("(async () => {" + script + "})()");
145
- case 9:
146
- _context3.next = 14;
147
- break;
148
- case 11:
149
- _context3.prev = 11;
150
- _context3.t0 = _context3["catch"](6);
151
- _message.error(_context3.t0 === null || _context3.t0 === void 0 ? void 0 : _context3.t0.message);
152
- case 14:
153
- case "end":
154
- return _context3.stop();
155
- }
156
- }, _callee3, null, [[6, 11]]);
157
- }));
158
- return _exeProcessScript.apply(this, arguments);
159
- }
160
- function exeFindOne(_x3) {
161
- return _exeFindOne.apply(this, arguments);
162
- }
163
- function _exeFindOne() {
164
- _exeFindOne = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(nodeProps) {
165
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
166
- while (1) switch (_context4.prev = _context4.next) {
167
- case 0:
168
- case "end":
169
- return _context4.stop();
170
- }
171
- }, _callee4);
172
- }));
173
- return _exeFindOne.apply(this, arguments);
174
- }
175
- function exeFindMore(_x4) {
176
- return _exeFindMore.apply(this, arguments);
177
- }
178
- function _exeFindMore() {
179
- _exeFindMore = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(nodeProps) {
180
- return _regeneratorRuntime.wrap(function _callee5$(_context5) {
181
- while (1) switch (_context5.prev = _context5.next) {
182
- case 0:
183
- case "end":
184
- return _context5.stop();
185
- }
186
- }, _callee5);
187
- }));
188
- return _exeFindMore.apply(this, arguments);
189
- }
190
- function exeFormModal(_x5) {
191
- return _exeFormModal.apply(this, arguments);
192
- }
193
- function _exeFormModal() {
194
- _exeFormModal = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(nodeProps) {
195
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
196
- while (1) switch (_context6.prev = _context6.next) {
197
- case 0:
198
- return _context6.abrupt("return", new Promise(function (resolve) {
199
- var _Modal$type;
200
- var type = nodeProps.type;
201
- (_Modal$type = _Modal[type]) === null || _Modal$type === void 0 ? void 0 : _Modal$type.call(_Modal, _extends({}, nodeProps, {
202
- onOk: function onOk() {
203
- resolve(true);
204
- },
205
- onCancel: function onCancel() {
206
- resolve(false);
207
- }
208
- }));
209
- }));
210
- case 1:
211
- case "end":
212
- return _context6.stop();
213
- }
214
- }, _callee6);
215
- }));
216
- return _exeFormModal.apply(this, arguments);
217
- }
218
- function exeConditions(nodeProps) {
219
- function loopCondition(conditions) {
220
- var ops = "";
221
- if (!Array.isArray(conditions)) return ops;
222
- var index = -1;
223
- for (var _iterator = _createForOfIteratorHelperLoose(conditions), _step; !(_step = _iterator()).done;) {
224
- var _condition$children;
225
- var condition = _step.value;
226
- index++;
227
- var b = false;
228
- if ((_condition$children = condition.children) !== null && _condition$children !== void 0 && _condition$children.length) {
229
- b = loopCondition(condition.children);
230
- } else {
231
- b = exeCondition(condition);
232
- }
233
- if (index == 0) {
234
- ops += " " + b;
235
- } else if (condition.type == "or") {
236
- ops += " || " + b;
237
- } else {
238
- ops += " && " + b;
239
- }
240
- }
241
- return "(" + ops + ")";
242
- }
243
- return eval(loopCondition(nodeProps.conditions));
244
- }
245
- function exeCondition(condition) {
246
- var _value$includes, _value$includes2;
247
- var op = condition.op;
248
- var value = mapId(condition.field);
249
- var other = mapId(condition.value);
250
- switch (op) {
251
- case "seq":
252
- case "eq":
253
- return isEqual(value, other);
254
- case "ne":
255
- return !isEqual(value, other);
256
- case "gt":
257
- return value > other;
258
- case "goe":
259
- return value >= other;
260
- case "lt":
261
- return value < other;
262
- case "loe":
263
- return value <= other;
264
- case "like":
265
- return (value === null || value === void 0 ? void 0 : (_value$includes = value.includes) === null || _value$includes === void 0 ? void 0 : _value$includes.call(value, other)) || false;
266
- case "notLike":
267
- return !(value !== null && value !== void 0 && (_value$includes2 = value.includes) !== null && _value$includes2 !== void 0 && _value$includes2.call(value, other) || false);
268
- case "in":
269
- return handleIn(value, other);
270
- case "notIn":
271
- return !handleIn(value, other);
272
- case "isNull":
273
- return value == null;
274
- case "isNotNull":
275
- return value != null;
276
- }
277
- return false;
278
- }
279
- function handleIn(value, other) {
280
- if (Array.isArray(other)) {
281
- if (Array.isArray(value)) {
282
- return !!value.find(function (v) {
283
- return other.includes(v);
284
- });
285
- } else {
286
- return other.includes(value);
287
- }
288
- } else {
289
- if (Array.isArray(value)) {
290
- return value.includes(other);
291
- } else {
292
- return other == value;
293
- }
294
- }
295
- }
296
- function mapId(value) {
297
- if (Array.isArray(value)) {
298
- return value.map(mapId);
299
- } else if (typeof value == "object") {
300
- return (value === null || value === void 0 ? void 0 : value.id) || (value === null || value === void 0 ? void 0 : value.value) || value;
301
- }
302
- return value;
303
- }
@@ -1 +0,0 @@
1
- export declare function loadMaterials(): Promise<Record<string, React.FC>>;
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- exports.__esModule = true;
5
- exports.loadMaterials = loadMaterials;
6
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
7
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
8
- var _LoadPlugins = require("./LoadPlugins");
9
- function loadMaterials() {
10
- return _loadMaterials.apply(this, arguments);
11
- }
12
- function _loadMaterials() {
13
- _loadMaterials = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
14
- var urls, components;
15
- return _regenerator["default"].wrap(function _callee$(_context) {
16
- while (1) switch (_context.prev = _context.next) {
17
- case 0:
18
- urls = ["https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/root/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd/view.css", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.js", "https://cdn.zhiyunhe.com/plugin/lowcode/materials/antd-pro/view.css"];
19
- _context.next = 3;
20
- return (0, _LoadPlugins.loadPlugins)(urls);
21
- case 3:
22
- components = {};
23
- ["RootMaterial", "AntdMaterial", "AntdProMaterial"].forEach(function (lib) {
24
- var data = window[lib];
25
- if (data) {
26
- Object.entries(data).forEach(function (_ref) {
27
- var key = _ref[0],
28
- value = _ref[1];
29
- // @ts-ignore
30
- components[key] = value;
31
- });
32
- }
33
- });
34
- return _context.abrupt("return", components);
35
- case 6:
36
- case "end":
37
- return _context.stop();
38
- }
39
- }, _callee);
40
- }));
41
- return _loadMaterials.apply(this, arguments);
42
- }
@@ -1,30 +0,0 @@
1
- import { FormInstance } from "antd/lib";
2
- export declare type ProcessScriptOptions = {
3
- depth: number;
4
- form: FormInstance;
5
- changeValues: any;
6
- };
7
- export declare type ProcessScriptType = {
8
- timing: "change" | "submit";
9
- script: string;
10
- nodeTitle: string;
11
- };
12
- export declare function exeProcessScript(options: ProcessScriptOptions, scriptType: ProcessScriptType): Promise<void>;
13
- export declare type ProcessNodeProps = {
14
- type: any;
15
- branchType: "condition" | "parallel";
16
- nodeTitle: string;
17
- message: string;
18
- notFoundDataAction: "ctn" | "ins";
19
- actionType?: "direct" | "business";
20
- breakType: "continue" | "break" | "return" | "exception";
21
- nodeId?: string;
22
- formId: string;
23
- events?: ("ins" | "upd" | "del")[];
24
- timing?: "bef" | "aft";
25
- conditions: any[];
26
- assignments: any[];
27
- filters: any[];
28
- sorts: any[];
29
- pageSize: number;
30
- };