@zhubangyun/lowcode-core 6.3.20 → 6.3.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/utils/api/form-api/form-api.assemble-entity.js +9 -3
- package/es/utils/api/form-api/form-api.utils.js +9 -19
- package/es/utils/api/index.d.ts +6 -1
- package/es/utils/api/rest-api.d.ts +1 -0
- package/es/utils/page/page-form-group.js +10 -4
- package/es/utils/page/page-schema-utils.js +18 -2
- package/lib/utils/api/form-api/form-api.assemble-entity.js +9 -3
- package/lib/utils/api/form-api/form-api.utils.js +9 -19
- package/lib/utils/api/index.d.ts +6 -1
- package/lib/utils/api/rest-api.d.ts +1 -0
- package/lib/utils/page/page-form-group.js +10 -4
- package/lib/utils/page/page-schema-utils.js +18 -2
- package/package.json +1 -1
|
@@ -23,7 +23,7 @@ function assembleData(data, dataMap) {
|
|
|
23
23
|
for (var _iterator2 = _createForOfIteratorHelperLoose(data), _step2; !(_step2 = _iterator2()).done;) {
|
|
24
24
|
var item = _step2.value;
|
|
25
25
|
assembleObject(item, dataMap, {
|
|
26
|
-
maxDepth:
|
|
26
|
+
maxDepth: 3,
|
|
27
27
|
depth: 1
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -40,7 +40,7 @@ function assembleRefs(refs, dataMap) {
|
|
|
40
40
|
for (var _iterator4 = _createForOfIteratorHelperLoose(data), _step4; !(_step4 = _iterator4()).done;) {
|
|
41
41
|
var item = _step4.value;
|
|
42
42
|
assembleObject(item, dataMap, {
|
|
43
|
-
maxDepth:
|
|
43
|
+
maxDepth: 3,
|
|
44
44
|
depth: 1
|
|
45
45
|
});
|
|
46
46
|
}
|
|
@@ -73,7 +73,7 @@ function assembleObject(values, dataMap, options) {
|
|
|
73
73
|
var valueElement = _step5.value;
|
|
74
74
|
assembleObject(valueElement, dataMap, {
|
|
75
75
|
maxDepth: maxDepth,
|
|
76
|
-
depth: depth
|
|
76
|
+
depth: depth
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -82,6 +82,12 @@ function assembleObject(values, dataMap, options) {
|
|
|
82
82
|
if (dataMap.hasEntity(value)) {
|
|
83
83
|
values[key] = dataMap.getEntity(value);
|
|
84
84
|
}
|
|
85
|
+
} else if (key == "parent") {
|
|
86
|
+
//values.parent = dataMap.getEntity(value);
|
|
87
|
+
Object.defineProperty(values, "parent", {
|
|
88
|
+
value: dataMap.getEntity(value),
|
|
89
|
+
writable: true
|
|
90
|
+
});
|
|
85
91
|
}
|
|
86
92
|
}
|
|
87
93
|
}
|
|
@@ -16,15 +16,20 @@ export function convertSaveData(data) {
|
|
|
16
16
|
} else if (Array.isArray(value)) {
|
|
17
17
|
return value;
|
|
18
18
|
} else if (typeof value == "object") {
|
|
19
|
+
if (key == "form") {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
19
22
|
if (SimpleSerialFieldNames.includes(key)) {
|
|
20
23
|
var id = value === null || value === void 0 ? void 0 : value.id;
|
|
21
24
|
return id ? {
|
|
22
|
-
id: id
|
|
25
|
+
id: id,
|
|
26
|
+
form: value === null || value === void 0 ? void 0 : value.form
|
|
23
27
|
} : undefined;
|
|
24
28
|
} else if (seen.has(value)) {
|
|
25
|
-
if (value.id) {
|
|
29
|
+
if (value.id && value.form) {
|
|
26
30
|
return {
|
|
27
|
-
id: value.id
|
|
31
|
+
id: value.id,
|
|
32
|
+
form: value.form
|
|
28
33
|
};
|
|
29
34
|
} else {
|
|
30
35
|
return value;
|
|
@@ -155,24 +160,9 @@ export function handleEntityLabel(data) {
|
|
|
155
160
|
}
|
|
156
161
|
}
|
|
157
162
|
}
|
|
158
|
-
function valueToFormDataArray(value) {
|
|
159
|
-
if (typeof value == null || typeof value !== "object") {
|
|
160
|
-
return [];
|
|
161
|
-
}
|
|
162
|
-
if (Array.isArray(value)) {
|
|
163
|
-
return value === null || value === void 0 ? void 0 : value.filter(function (item) {
|
|
164
|
-
var _item$form;
|
|
165
|
-
return (item === null || item === void 0 ? void 0 : item.id) && (item === null || item === void 0 ? void 0 : (_item$form = item.form) === null || _item$form === void 0 ? void 0 : _item$form.id);
|
|
166
|
-
});
|
|
167
|
-
} else if (typeof value == "object" && value !== null) {
|
|
168
|
-
return valueToFormDataArray([value]);
|
|
169
|
-
} else {
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
163
|
export function assembleAssociationField(data, refs) {
|
|
174
164
|
var start = Date.now();
|
|
175
|
-
if (isLocalhost() || isTemplateHost()) {
|
|
165
|
+
if (isLocalhost() || isTemplateHost() || window.__mock) {
|
|
176
166
|
formApiAssembleEntity(data, refs);
|
|
177
167
|
return Date.now() - start;
|
|
178
168
|
}
|
package/es/utils/api/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export { getUserinfo } from "./user-info";
|
|
|
6
6
|
export * as files from "./file-api";
|
|
7
7
|
export * as scrips from "./script-api";
|
|
8
8
|
export declare const apiRequest: import("axios").AxiosInstance;
|
|
9
|
-
|
|
9
|
+
interface RequestResult {
|
|
10
|
+
success: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
data: any;
|
|
13
|
+
}
|
|
14
|
+
export declare const request: (config: import("axios").AxiosRequestConfig<any>) => Promise<RequestResult>;
|
|
10
15
|
export declare function onFulfilled(res: AxiosResponse): any;
|
|
11
16
|
export declare function onRejected(error: any): any;
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
3
3
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
4
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
5
|
-
var _excluded = ["layout", "form", "
|
|
5
|
+
var _excluded = ["layout", "form", "onClose", "onSubmitOk"],
|
|
6
6
|
_excluded2 = ["container", "onClose"];
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
8
|
import { PageLayout } from "./page-layout";
|
|
@@ -55,8 +55,8 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
55
55
|
var _this$props = this.props,
|
|
56
56
|
layout = _this$props.layout,
|
|
57
57
|
form = _this$props.form,
|
|
58
|
-
items = _this$props.items,
|
|
59
58
|
onClose = _this$props.onClose,
|
|
59
|
+
onSubmitOk = _this$props.onSubmitOk,
|
|
60
60
|
restProps = _objectWithoutPropertiesLoose(_this$props, _excluded);
|
|
61
61
|
// @ts-ignore
|
|
62
62
|
restProps.layout = layout || "modal";
|
|
@@ -66,6 +66,12 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
66
66
|
(_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
|
|
67
67
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
68
68
|
};
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
restProps.onSubmitOk = function (data) {
|
|
71
|
+
var _self$layoutRef2;
|
|
72
|
+
onSubmitOk === null || onSubmitOk === void 0 ? void 0 : onSubmitOk(data);
|
|
73
|
+
(_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
|
|
74
|
+
};
|
|
69
75
|
return /*#__PURE__*/React.createElement(PageLayout, {
|
|
70
76
|
ref: function ref(layout) {
|
|
71
77
|
return _this2.layoutRef = layout;
|
|
@@ -85,9 +91,9 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
85
91
|
children: [{
|
|
86
92
|
componentName: "PageFormGroup",
|
|
87
93
|
props: {
|
|
94
|
+
mode: "show",
|
|
88
95
|
title: schema.label,
|
|
89
|
-
form: form
|
|
90
|
-
items: items
|
|
96
|
+
form: form
|
|
91
97
|
}
|
|
92
98
|
}]
|
|
93
99
|
}
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
function replacer(key, value) {
|
|
3
|
+
if (value == null) {
|
|
4
|
+
return null;
|
|
5
|
+
} else if (Array.isArray(value)) {
|
|
6
|
+
return value;
|
|
7
|
+
} else if (value !== null && value !== void 0 && value.id) {
|
|
8
|
+
return {
|
|
9
|
+
id: value.id,
|
|
10
|
+
label: value.label,
|
|
11
|
+
form: value.form
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
return value;
|
|
15
|
+
}
|
|
2
16
|
export function cloneDataView(dataView, extraProps) {
|
|
3
17
|
if (!dataView) {
|
|
4
18
|
return {};
|
|
@@ -61,10 +75,12 @@ function compileFilterRules(rules) {
|
|
|
61
75
|
value = "undefined";
|
|
62
76
|
}
|
|
63
77
|
} else if (rule.valueType == "value" || rule.valueType == "column" || !rule.valueType || typeof value === "object") {
|
|
64
|
-
value = JSON.stringify(value);
|
|
78
|
+
value = JSON.stringify(value, replacer);
|
|
65
79
|
}
|
|
66
80
|
scripts.push("\"key\":\"" + rule.key + "\",");
|
|
67
|
-
|
|
81
|
+
if (rule.valueType) {
|
|
82
|
+
scripts.push("\"valueType\":\"" + rule.valueType + "\",");
|
|
83
|
+
}
|
|
68
84
|
scripts.push("\"operator\":\"" + rule.operator + "\",");
|
|
69
85
|
scripts.push("\"value\":" + value + ",");
|
|
70
86
|
}
|
|
@@ -27,7 +27,7 @@ function assembleData(data, dataMap) {
|
|
|
27
27
|
for (var _iterator2 = _createForOfIteratorHelperLoose(data), _step2; !(_step2 = _iterator2()).done;) {
|
|
28
28
|
var item = _step2.value;
|
|
29
29
|
assembleObject(item, dataMap, {
|
|
30
|
-
maxDepth:
|
|
30
|
+
maxDepth: 3,
|
|
31
31
|
depth: 1
|
|
32
32
|
});
|
|
33
33
|
}
|
|
@@ -44,7 +44,7 @@ function assembleRefs(refs, dataMap) {
|
|
|
44
44
|
for (var _iterator4 = _createForOfIteratorHelperLoose(data), _step4; !(_step4 = _iterator4()).done;) {
|
|
45
45
|
var item = _step4.value;
|
|
46
46
|
assembleObject(item, dataMap, {
|
|
47
|
-
maxDepth:
|
|
47
|
+
maxDepth: 3,
|
|
48
48
|
depth: 1
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -77,7 +77,7 @@ function assembleObject(values, dataMap, options) {
|
|
|
77
77
|
var valueElement = _step5.value;
|
|
78
78
|
assembleObject(valueElement, dataMap, {
|
|
79
79
|
maxDepth: maxDepth,
|
|
80
|
-
depth: depth
|
|
80
|
+
depth: depth
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -86,6 +86,12 @@ function assembleObject(values, dataMap, options) {
|
|
|
86
86
|
if (dataMap.hasEntity(value)) {
|
|
87
87
|
values[key] = dataMap.getEntity(value);
|
|
88
88
|
}
|
|
89
|
+
} else if (key == "parent") {
|
|
90
|
+
//values.parent = dataMap.getEntity(value);
|
|
91
|
+
Object.defineProperty(values, "parent", {
|
|
92
|
+
value: dataMap.getEntity(value),
|
|
93
|
+
writable: true
|
|
94
|
+
});
|
|
89
95
|
}
|
|
90
96
|
}
|
|
91
97
|
}
|
|
@@ -28,15 +28,20 @@ function convertSaveData(data) {
|
|
|
28
28
|
} else if (Array.isArray(value)) {
|
|
29
29
|
return value;
|
|
30
30
|
} else if (typeof value == "object") {
|
|
31
|
+
if (key == "form") {
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
31
34
|
if (SimpleSerialFieldNames.includes(key)) {
|
|
32
35
|
var id = value === null || value === void 0 ? void 0 : value.id;
|
|
33
36
|
return id ? {
|
|
34
|
-
id: id
|
|
37
|
+
id: id,
|
|
38
|
+
form: value === null || value === void 0 ? void 0 : value.form
|
|
35
39
|
} : undefined;
|
|
36
40
|
} else if (seen.has(value)) {
|
|
37
|
-
if (value.id) {
|
|
41
|
+
if (value.id && value.form) {
|
|
38
42
|
return {
|
|
39
|
-
id: value.id
|
|
43
|
+
id: value.id,
|
|
44
|
+
form: value.form
|
|
40
45
|
};
|
|
41
46
|
} else {
|
|
42
47
|
return value;
|
|
@@ -167,24 +172,9 @@ function handleEntityLabel(data) {
|
|
|
167
172
|
}
|
|
168
173
|
}
|
|
169
174
|
}
|
|
170
|
-
function valueToFormDataArray(value) {
|
|
171
|
-
if (typeof value == null || typeof value !== "object") {
|
|
172
|
-
return [];
|
|
173
|
-
}
|
|
174
|
-
if (Array.isArray(value)) {
|
|
175
|
-
return value === null || value === void 0 ? void 0 : value.filter(function (item) {
|
|
176
|
-
var _item$form;
|
|
177
|
-
return (item === null || item === void 0 ? void 0 : item.id) && (item === null || item === void 0 ? void 0 : (_item$form = item.form) === null || _item$form === void 0 ? void 0 : _item$form.id);
|
|
178
|
-
});
|
|
179
|
-
} else if (typeof value == "object" && value !== null) {
|
|
180
|
-
return valueToFormDataArray([value]);
|
|
181
|
-
} else {
|
|
182
|
-
return [];
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
175
|
function assembleAssociationField(data, refs) {
|
|
186
176
|
var start = Date.now();
|
|
187
|
-
if ((0, _common.isLocalhost)() || (0, _util.isTemplateHost)()) {
|
|
177
|
+
if ((0, _common.isLocalhost)() || (0, _util.isTemplateHost)() || window.__mock) {
|
|
188
178
|
(0, _formApi.formApiAssembleEntity)(data, refs);
|
|
189
179
|
return Date.now() - start;
|
|
190
180
|
}
|
package/lib/utils/api/index.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ export { getUserinfo } from "./user-info";
|
|
|
6
6
|
export * as files from "./file-api";
|
|
7
7
|
export * as scrips from "./script-api";
|
|
8
8
|
export declare const apiRequest: import("axios").AxiosInstance;
|
|
9
|
-
|
|
9
|
+
interface RequestResult {
|
|
10
|
+
success: boolean;
|
|
11
|
+
message?: string;
|
|
12
|
+
data: any;
|
|
13
|
+
}
|
|
14
|
+
export declare const request: (config: import("axios").AxiosRequestConfig<any>) => Promise<RequestResult>;
|
|
10
15
|
export declare function onFulfilled(res: AxiosResponse): any;
|
|
11
16
|
export declare function onRejected(error: any): any;
|
|
@@ -14,7 +14,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
14
14
|
var _reactRender = require("../../components/react-render");
|
|
15
15
|
var _pageLoadSchema = require("./page-load-schema");
|
|
16
16
|
var _common = require("../common");
|
|
17
|
-
var _excluded = ["layout", "form", "
|
|
17
|
+
var _excluded = ["layout", "form", "onClose", "onSubmitOk"],
|
|
18
18
|
_excluded2 = ["container", "onClose"];
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
function showFormGroup(_x) {
|
|
@@ -61,8 +61,8 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
61
61
|
var _this$props = this.props,
|
|
62
62
|
layout = _this$props.layout,
|
|
63
63
|
form = _this$props.form,
|
|
64
|
-
items = _this$props.items,
|
|
65
64
|
onClose = _this$props.onClose,
|
|
65
|
+
onSubmitOk = _this$props.onSubmitOk,
|
|
66
66
|
restProps = (0, _objectWithoutPropertiesLoose2["default"])(_this$props, _excluded);
|
|
67
67
|
// @ts-ignore
|
|
68
68
|
restProps.layout = layout || "modal";
|
|
@@ -72,6 +72,12 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
72
72
|
(_self$layoutRef = self.layoutRef) === null || _self$layoutRef === void 0 ? void 0 : _self$layoutRef.close();
|
|
73
73
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
74
74
|
};
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
restProps.onSubmitOk = function (data) {
|
|
77
|
+
var _self$layoutRef2;
|
|
78
|
+
onSubmitOk === null || onSubmitOk === void 0 ? void 0 : onSubmitOk(data);
|
|
79
|
+
(_self$layoutRef2 = self.layoutRef) === null || _self$layoutRef2 === void 0 ? void 0 : _self$layoutRef2.close();
|
|
80
|
+
};
|
|
75
81
|
return /*#__PURE__*/_react["default"].createElement(_pageLayout.PageLayout, {
|
|
76
82
|
ref: function ref(layout) {
|
|
77
83
|
return _this2.layoutRef = layout;
|
|
@@ -91,9 +97,9 @@ var FormGroupRender = /*#__PURE__*/function (_Component) {
|
|
|
91
97
|
children: [{
|
|
92
98
|
componentName: "PageFormGroup",
|
|
93
99
|
props: {
|
|
100
|
+
mode: "show",
|
|
94
101
|
title: schema.label,
|
|
95
|
-
form: form
|
|
96
|
-
items: items
|
|
102
|
+
form: form
|
|
97
103
|
}
|
|
98
104
|
}]
|
|
99
105
|
}
|
|
@@ -4,6 +4,20 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.cloneDataView = cloneDataView;
|
|
6
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
|
+
function replacer(key, value) {
|
|
8
|
+
if (value == null) {
|
|
9
|
+
return null;
|
|
10
|
+
} else if (Array.isArray(value)) {
|
|
11
|
+
return value;
|
|
12
|
+
} else if (value !== null && value !== void 0 && value.id) {
|
|
13
|
+
return {
|
|
14
|
+
id: value.id,
|
|
15
|
+
label: value.label,
|
|
16
|
+
form: value.form
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
7
21
|
function cloneDataView(dataView, extraProps) {
|
|
8
22
|
if (!dataView) {
|
|
9
23
|
return {};
|
|
@@ -66,10 +80,12 @@ function compileFilterRules(rules) {
|
|
|
66
80
|
value = "undefined";
|
|
67
81
|
}
|
|
68
82
|
} else if (rule.valueType == "value" || rule.valueType == "column" || !rule.valueType || typeof value === "object") {
|
|
69
|
-
value = JSON.stringify(value);
|
|
83
|
+
value = JSON.stringify(value, replacer);
|
|
70
84
|
}
|
|
71
85
|
scripts.push("\"key\":\"" + rule.key + "\",");
|
|
72
|
-
|
|
86
|
+
if (rule.valueType) {
|
|
87
|
+
scripts.push("\"valueType\":\"" + rule.valueType + "\",");
|
|
88
|
+
}
|
|
73
89
|
scripts.push("\"operator\":\"" + rule.operator + "\",");
|
|
74
90
|
scripts.push("\"value\":" + value + ",");
|
|
75
91
|
}
|