@zhubangyun/lowcode-core 5.7.301 → 5.8.290
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/load-materials/index.js +1 -1
- package/es/components/page-loading/index.less +12 -10
- package/es/index.js +6 -2
- package/es/style.js +1 -0
- package/es/utils/api/form-api.d.ts +2 -1
- package/es/utils/api/form-api.js +44 -112
- package/es/utils/api/form-api.utils.d.ts +8 -0
- package/es/utils/api/form-api.utils.js +199 -0
- package/es/utils/api/rest-api.d.ts +9 -0
- package/es/utils/api/rest-api.js +113 -44
- package/es/utils/cache/schema.d.ts +1 -0
- package/es/utils/cache/schema.js +267 -175
- package/es/utils/data/index.d.ts +1 -0
- package/es/utils/data/index.js +20 -0
- package/es/utils/page/page-layout.js +1 -1
- package/lib/components/load-materials/index.js +1 -1
- package/lib/components/page-loading/index.less +12 -10
- package/lib/index.js +5 -2
- package/lib/style.js +1 -0
- package/lib/utils/api/form-api.d.ts +2 -1
- package/lib/utils/api/form-api.js +49 -117
- package/lib/utils/api/form-api.utils.d.ts +8 -0
- package/lib/utils/api/form-api.utils.js +208 -0
- package/lib/utils/api/rest-api.d.ts +9 -0
- package/lib/utils/api/rest-api.js +113 -44
- package/lib/utils/cache/schema.d.ts +1 -0
- package/lib/utils/cache/schema.js +269 -175
- package/lib/utils/data/index.d.ts +1 -0
- package/lib/utils/data/index.js +24 -0
- package/lib/utils/page/page-layout.js +1 -1
- package/package.json +1 -1
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.forEachFormSchema = forEachFormSchema;
|
|
6
|
+
exports.getAdminFormSchema = getAdminFormSchema;
|
|
6
7
|
exports.handleFormSchema = handleFormSchema;
|
|
7
8
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
8
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
10
|
var _index = _interopRequireDefault(require("../index"));
|
|
11
11
|
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."); }
|
|
@@ -13,32 +13,26 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
13
13
|
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; }
|
|
14
14
|
function handleFormSchema(_x) {
|
|
15
15
|
return _handleFormSchema.apply(this, arguments);
|
|
16
|
-
}
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 处理数据管理关联属性
|
|
19
|
+
* @param rootSchema
|
|
20
|
+
* @param fdmSchema
|
|
21
|
+
*/
|
|
17
22
|
function _handleFormSchema() {
|
|
18
23
|
_handleFormSchema = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(schema) {
|
|
19
|
-
var fdmItems, fieldIdMap;
|
|
24
|
+
var formFieldSchema, fdmItems, fieldIdMap, _i, _fdmItems, fdmField;
|
|
20
25
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
21
26
|
while (1) switch (_context.prev = _context.next) {
|
|
22
27
|
case 0:
|
|
23
|
-
|
|
24
|
-
_context.next = 2;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
return _context.abrupt("return");
|
|
28
|
-
case 2:
|
|
29
|
-
if (schema !== null && schema !== void 0 && schema.componentName) {
|
|
30
|
-
_context.next = 4;
|
|
31
|
-
break;
|
|
32
|
-
}
|
|
33
|
-
return _context.abrupt("return");
|
|
34
|
-
case 4:
|
|
28
|
+
formFieldSchema = new FormFieldSchema(schema.children[0], null);
|
|
35
29
|
fdmItems = [];
|
|
36
30
|
fieldIdMap = new Map();
|
|
37
31
|
schema.state = schema.state || {};
|
|
38
32
|
schema.methods = schema.methods || {};
|
|
39
|
-
_context.next =
|
|
40
|
-
return handleAssociationForm(schema);
|
|
41
|
-
case
|
|
33
|
+
_context.next = 7;
|
|
34
|
+
return handleAssociationForm(formFieldSchema, schema);
|
|
35
|
+
case 7:
|
|
42
36
|
//初次处理
|
|
43
37
|
forEachFormSchema(schema, function (field) {
|
|
44
38
|
if (field.fdmSchema) {
|
|
@@ -47,7 +41,6 @@ function _handleFormSchema() {
|
|
|
47
41
|
field.fdmSchema.props = ((_field$fdmSchema = field.fdmSchema) === null || _field$fdmSchema === void 0 ? void 0 : _field$fdmSchema.props) || {};
|
|
48
42
|
field.fdmSchema.props.style = ((_field$fdmSchema2 = field.fdmSchema) === null || _field$fdmSchema2 === void 0 ? void 0 : _field$fdmSchema2.props.style) || {};
|
|
49
43
|
field.fdmSchema.props.style.height = "100%";
|
|
50
|
-
field.fdmSchema.props.label = field.props.label;
|
|
51
44
|
}
|
|
52
45
|
if (field.props.fieldId) {
|
|
53
46
|
//删除children防止循环
|
|
@@ -59,33 +52,57 @@ function _handleFormSchema() {
|
|
|
59
52
|
});
|
|
60
53
|
|
|
61
54
|
//处理查询列
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
55
|
+
_i = 0, _fdmItems = fdmItems;
|
|
56
|
+
case 9:
|
|
57
|
+
if (!(_i < _fdmItems.length)) {
|
|
58
|
+
_context.next = 17;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
fdmField = _fdmItems[_i];
|
|
62
|
+
_context.next = 13;
|
|
63
|
+
return handleFdmAssociationAttributeFields(formFieldSchema, fdmField.fdmSchema);
|
|
64
|
+
case 13:
|
|
65
|
+
forEachFormSchema(fdmField.fdmSchema, function (field) {
|
|
66
|
+
var _field$props;
|
|
67
|
+
var findSchema = fieldIdMap.get((_field$props = field.props) === null || _field$props === void 0 ? void 0 : _field$props.fieldId);
|
|
68
|
+
if (findSchema) {
|
|
69
|
+
field.componentName = findSchema.componentName;
|
|
70
|
+
field.props = Object.assign({}, JSON.parse(JSON.stringify(findSchema.props)), field.props);
|
|
71
|
+
//处理子表查询
|
|
72
|
+
if (findSchema.componentName == "SubFormField") {
|
|
73
|
+
if (findSchema.fdmSchema) {
|
|
74
|
+
var subFormFdmSchema = JSON.parse(JSON.stringify(findSchema.fdmSchema));
|
|
75
|
+
forEachFormSchema(subFormFdmSchema, function (field) {
|
|
76
|
+
if (field.componentName === "PageFdm") {
|
|
77
|
+
field.props.layout = "inline";
|
|
78
|
+
}
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
// @ts-ignore
|
|
82
|
+
field.props.fdmSchema = subFormFdmSchema;
|
|
83
|
+
field.children = subFormFdmSchema.children[0].children;
|
|
84
|
+
field.children = field.children.filter(function (item) {
|
|
85
|
+
return !item.props.hideInSubTable;
|
|
86
|
+
});
|
|
87
|
+
//处理子列隐藏
|
|
88
|
+
forEachFormSchema(field, function (subField) {
|
|
89
|
+
if (Array.isArray(subField.children)) {
|
|
90
|
+
subField.children = subField.children.filter(function (item) {
|
|
91
|
+
return !item.props.hideInSubTable;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return true;
|
|
95
|
+
});
|
|
83
96
|
}
|
|
84
97
|
}
|
|
85
|
-
|
|
86
|
-
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
87
100
|
});
|
|
88
|
-
case
|
|
101
|
+
case 14:
|
|
102
|
+
_i++;
|
|
103
|
+
_context.next = 9;
|
|
104
|
+
break;
|
|
105
|
+
case 17:
|
|
89
106
|
case "end":
|
|
90
107
|
return _context.stop();
|
|
91
108
|
}
|
|
@@ -93,159 +110,204 @@ function _handleFormSchema() {
|
|
|
93
110
|
}));
|
|
94
111
|
return _handleFormSchema.apply(this, arguments);
|
|
95
112
|
}
|
|
96
|
-
function
|
|
113
|
+
function handleFdmAssociationAttributeFields(_x2, _x3) {
|
|
114
|
+
return _handleFdmAssociationAttributeFields.apply(this, arguments);
|
|
115
|
+
} //处理关联表单
|
|
116
|
+
function _handleFdmAssociationAttributeFields() {
|
|
117
|
+
_handleFdmAssociationAttributeFields = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(rootSchema, fdmSchema) {
|
|
118
|
+
var associationAttributeFields, _i2, _associationAttribute, _attrField$props, attrField, associationAttribute, cloneSchema;
|
|
119
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
120
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
121
|
+
case 0:
|
|
122
|
+
//关联属性
|
|
123
|
+
associationAttributeFields = [];
|
|
124
|
+
forEachFormSchema(fdmSchema, function (field) {
|
|
125
|
+
if (field.componentName == "FdmAssociationFieldColumn") {
|
|
126
|
+
associationAttributeFields.push(field);
|
|
127
|
+
}
|
|
128
|
+
return true;
|
|
129
|
+
});
|
|
130
|
+
_i2 = 0, _associationAttribute = associationAttributeFields;
|
|
131
|
+
case 3:
|
|
132
|
+
if (!(_i2 < _associationAttribute.length)) {
|
|
133
|
+
_context2.next = 13;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
attrField = _associationAttribute[_i2];
|
|
137
|
+
associationAttribute = (_attrField$props = attrField.props) === null || _attrField$props === void 0 ? void 0 : _attrField$props.associationAttribute;
|
|
138
|
+
_context2.next = 8;
|
|
139
|
+
return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
|
|
140
|
+
case 8:
|
|
141
|
+
cloneSchema = _context2.sent;
|
|
142
|
+
if (cloneSchema) {
|
|
143
|
+
//向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
|
|
144
|
+
attrField.componentName = cloneSchema.componentName;
|
|
145
|
+
attrField.props = Object.assign({}, JSON.parse(JSON.stringify(cloneSchema.props)), attrField.props);
|
|
146
|
+
attrField.props.fieldId = associationAttribute.join(".");
|
|
147
|
+
}
|
|
148
|
+
case 10:
|
|
149
|
+
_i2++;
|
|
150
|
+
_context2.next = 3;
|
|
151
|
+
break;
|
|
152
|
+
case 13:
|
|
153
|
+
case "end":
|
|
154
|
+
return _context2.stop();
|
|
155
|
+
}
|
|
156
|
+
}, _callee2);
|
|
157
|
+
}));
|
|
158
|
+
return _handleFdmAssociationAttributeFields.apply(this, arguments);
|
|
159
|
+
}
|
|
160
|
+
function handleAssociationForm(_x4, _x5) {
|
|
97
161
|
return _handleAssociationForm.apply(this, arguments);
|
|
98
162
|
}
|
|
99
|
-
/**
|
|
100
|
-
* 遍历schema
|
|
101
|
-
* @param schema
|
|
102
|
-
* @param callback 返回true 继续往下遍历
|
|
103
|
-
*/
|
|
104
163
|
function _handleAssociationForm() {
|
|
105
|
-
_handleAssociationForm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(schema) {
|
|
106
|
-
var
|
|
107
|
-
return _regenerator["default"].wrap(function _callee3$(
|
|
108
|
-
while (1) switch (
|
|
164
|
+
_handleAssociationForm = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(rootSchema, schema) {
|
|
165
|
+
var associationAttributeFields, _i3, _associationAttribute2, _attrField$props2, _attrField$props2$fie, attrField, associationAttribute, cloneSchema;
|
|
166
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
167
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
109
168
|
case 0:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
var res;
|
|
113
|
-
return _regenerator["default"].wrap(function _callee2$(_context3) {
|
|
114
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
115
|
-
case 0:
|
|
116
|
-
if (!schemaMap[id]) {
|
|
117
|
-
_context3.next = 2;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
return _context3.abrupt("return", schemaMap[id]);
|
|
121
|
-
case 2:
|
|
122
|
-
_context3.next = 4;
|
|
123
|
-
return _index["default"].api.getSchema(id);
|
|
124
|
-
case 4:
|
|
125
|
-
res = _context3.sent;
|
|
126
|
-
schemaMap[id] = res.data;
|
|
127
|
-
return _context3.abrupt("return", schemaMap[id]);
|
|
128
|
-
case 7:
|
|
129
|
-
case "end":
|
|
130
|
-
return _context3.stop();
|
|
131
|
-
}
|
|
132
|
-
}, _callee2);
|
|
133
|
-
}));
|
|
134
|
-
return _getSchema.apply(this, arguments);
|
|
135
|
-
};
|
|
136
|
-
getSchema = function _getSchema2(_x3) {
|
|
137
|
-
return _getSchema.apply(this, arguments);
|
|
138
|
-
};
|
|
139
|
-
//跟schema
|
|
140
|
-
rootSchema = new FormFieldSchema(schema.children[0], null); //关联表单单选
|
|
141
|
-
associationFields = []; //关联属性
|
|
142
|
-
associationAttributeFields = [];
|
|
169
|
+
//关联属性
|
|
170
|
+
associationAttributeFields = []; //关联查询
|
|
143
171
|
forEachFormSchema(schema, function (field) {
|
|
144
|
-
if (field.componentName == "AssociationField") {
|
|
145
|
-
associationFields.push(field);
|
|
146
|
-
}
|
|
147
172
|
if (field.componentName == "AssociationAttributeField") {
|
|
148
173
|
associationAttributeFields.push(field);
|
|
149
174
|
}
|
|
150
175
|
return true;
|
|
151
176
|
});
|
|
152
|
-
//处理关联属性schema
|
|
153
|
-
schemaMap = {};
|
|
154
|
-
schemaMap[schema.id] = schema;
|
|
155
|
-
|
|
156
|
-
//从缓存中获取schema
|
|
157
177
|
|
|
158
178
|
//处理关联属性 赋值schema
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
164
|
-
case 0:
|
|
165
|
-
attrField = _associationAttribute[_i];
|
|
166
|
-
associationAttribute = (_attrField$props = attrField.props) === null || _attrField$props === void 0 ? void 0 : (_attrField$props$fiel = _attrField$props.fieldProps) === null || _attrField$props$fiel === void 0 ? void 0 : _attrField$props$fiel.associationAttribute;
|
|
167
|
-
if (associationAttribute) {
|
|
168
|
-
_context2.next = 4;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
return _context2.abrupt("return", {
|
|
172
|
-
v: void 0
|
|
173
|
-
});
|
|
174
|
-
case 4:
|
|
175
|
-
findField = associationFields.find(function (assi) {
|
|
176
|
-
return assi.props.fieldId == (associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[0]);
|
|
177
|
-
});
|
|
178
|
-
associationForm = findField === null || findField === void 0 ? void 0 : (_findField$props = findField.props) === null || _findField$props === void 0 ? void 0 : (_findField$props$fiel = _findField$props.fieldProps) === null || _findField$props$fiel === void 0 ? void 0 : _findField$props$fiel.associationForm;
|
|
179
|
-
if (associationForm) {
|
|
180
|
-
_context2.next = 8;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
return _context2.abrupt("return", {
|
|
184
|
-
v: void 0
|
|
185
|
-
});
|
|
186
|
-
case 8:
|
|
187
|
-
_context2.next = 10;
|
|
188
|
-
return getSchema(associationForm.id);
|
|
189
|
-
case 10:
|
|
190
|
-
associationFormSchema = _context2.sent;
|
|
191
|
-
//向关联属性中注册 schema 开始
|
|
192
|
-
associationAttributeField = null;
|
|
193
|
-
forEachFormSchema(associationFormSchema, function (field) {
|
|
194
|
-
if (field.props.fieldId == (associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1])) {
|
|
195
|
-
associationAttributeField = (0, _extends2["default"])({}, field);
|
|
196
|
-
return false;
|
|
197
|
-
}
|
|
198
|
-
return true;
|
|
199
|
-
});
|
|
200
|
-
attrField.props.fieldProps.associationAttributeField = associationAttributeField;
|
|
201
|
-
//向关联属性中注册 schema 结束
|
|
202
|
-
//向关联表单中注册关联属性填充 开始
|
|
203
|
-
findField.props.fieldProps.associationAttributes = findField.props.fieldProps.associationAttributes || [];
|
|
204
|
-
field = rootSchema.findFieldById(attrField.props.fieldId);
|
|
205
|
-
associationField = rootSchema.findFieldById(associationAttribute[0]);
|
|
206
|
-
if (field && associationField) {
|
|
207
|
-
depth1 = field.getFieldPaths().split(".").length;
|
|
208
|
-
depth2 = associationField.getFieldPaths().split(".").length;
|
|
209
|
-
attrField.props.fieldProps.associationDepth = depth1 - depth2;
|
|
210
|
-
findField.props.fieldProps.associationAttributes.push({
|
|
211
|
-
key: field.getFieldPaths(),
|
|
212
|
-
value: associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1]
|
|
213
|
-
});
|
|
214
|
-
//向关联表单中注册关联属性填充 结束
|
|
215
|
-
}
|
|
216
|
-
//设置关联属性默认值 结束
|
|
217
|
-
case 18:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context2.stop();
|
|
220
|
-
}
|
|
221
|
-
}, _loop);
|
|
222
|
-
});
|
|
223
|
-
_i = 0, _associationAttribute = associationAttributeFields;
|
|
224
|
-
case 10:
|
|
225
|
-
if (!(_i < _associationAttribute.length)) {
|
|
226
|
-
_context4.next = 18;
|
|
179
|
+
_i3 = 0, _associationAttribute2 = associationAttributeFields;
|
|
180
|
+
case 3:
|
|
181
|
+
if (!(_i3 < _associationAttribute2.length)) {
|
|
182
|
+
_context3.next = 13;
|
|
227
183
|
break;
|
|
228
184
|
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
185
|
+
attrField = _associationAttribute2[_i3];
|
|
186
|
+
associationAttribute = (_attrField$props2 = attrField.props) === null || _attrField$props2 === void 0 ? void 0 : (_attrField$props2$fie = _attrField$props2.fieldProps) === null || _attrField$props2$fie === void 0 ? void 0 : _attrField$props2$fie.associationAttribute;
|
|
187
|
+
_context3.next = 8;
|
|
188
|
+
return cloneAssociationAttributeFieldSchema(rootSchema, associationAttribute);
|
|
189
|
+
case 8:
|
|
190
|
+
cloneSchema = _context3.sent;
|
|
191
|
+
if (cloneSchema) {
|
|
192
|
+
//向关联属性中注册 fieldSchema 架构会将 associationAttributeField schema 转换成 jsx
|
|
193
|
+
attrField.props.fieldProps.associationAttributeField = cloneSchema;
|
|
235
194
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
_context4.next = 10;
|
|
195
|
+
case 10:
|
|
196
|
+
_i3++;
|
|
197
|
+
_context3.next = 3;
|
|
240
198
|
break;
|
|
241
|
-
case
|
|
199
|
+
case 13:
|
|
242
200
|
case "end":
|
|
243
|
-
return
|
|
201
|
+
return _context3.stop();
|
|
244
202
|
}
|
|
245
203
|
}, _callee3);
|
|
246
204
|
}));
|
|
247
205
|
return _handleAssociationForm.apply(this, arguments);
|
|
248
206
|
}
|
|
207
|
+
function cloneAssociationAttributeFieldSchema(_x6, _x7) {
|
|
208
|
+
return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
|
|
209
|
+
}
|
|
210
|
+
function _cloneAssociationAttributeFieldSchema() {
|
|
211
|
+
_cloneAssociationAttributeFieldSchema = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(rootSchema, associationAttribute) {
|
|
212
|
+
var associationFormSchema;
|
|
213
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
214
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
215
|
+
case 0:
|
|
216
|
+
if (Array.isArray(associationAttribute)) {
|
|
217
|
+
_context4.next = 2;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
return _context4.abrupt("return", null);
|
|
221
|
+
case 2:
|
|
222
|
+
_context4.next = 4;
|
|
223
|
+
return getSchemaByAssociationFieldId(rootSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[0]);
|
|
224
|
+
case 4:
|
|
225
|
+
associationFormSchema = _context4.sent;
|
|
226
|
+
if (!associationFormSchema) {
|
|
227
|
+
_context4.next = 7;
|
|
228
|
+
break;
|
|
229
|
+
}
|
|
230
|
+
return _context4.abrupt("return", findFieldSchema(associationFormSchema, associationAttribute === null || associationAttribute === void 0 ? void 0 : associationAttribute[1]));
|
|
231
|
+
case 7:
|
|
232
|
+
return _context4.abrupt("return", null);
|
|
233
|
+
case 8:
|
|
234
|
+
case "end":
|
|
235
|
+
return _context4.stop();
|
|
236
|
+
}
|
|
237
|
+
}, _callee4);
|
|
238
|
+
}));
|
|
239
|
+
return _cloneAssociationAttributeFieldSchema.apply(this, arguments);
|
|
240
|
+
}
|
|
241
|
+
function getSchemaByAssociationFieldId(_x8, _x9) {
|
|
242
|
+
return _getSchemaByAssociationFieldId.apply(this, arguments);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* 从schema中查找field
|
|
246
|
+
* @param schema
|
|
247
|
+
* @param fieldId
|
|
248
|
+
*/
|
|
249
|
+
function _getSchemaByAssociationFieldId() {
|
|
250
|
+
_getSchemaByAssociationFieldId = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(rootSchema, associationFieldId) {
|
|
251
|
+
var lastFieldId, associationFormSchema, _findAssociationField, _findAssociationField2, _findAssociationField3, findAssociationField, formId;
|
|
252
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
253
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
254
|
+
case 0:
|
|
255
|
+
if (associationFieldId) {
|
|
256
|
+
_context5.next = 2;
|
|
257
|
+
break;
|
|
258
|
+
}
|
|
259
|
+
return _context5.abrupt("return", null);
|
|
260
|
+
case 2:
|
|
261
|
+
lastFieldId = associationFieldId.split(".").pop();
|
|
262
|
+
associationFormSchema = null;
|
|
263
|
+
if (!(lastFieldId == "parent")) {
|
|
264
|
+
_context5.next = 8;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
associationFormSchema = rootSchema.schema;
|
|
268
|
+
_context5.next = 15;
|
|
269
|
+
break;
|
|
270
|
+
case 8:
|
|
271
|
+
findAssociationField = findFieldSchema(rootSchema.schema, lastFieldId);
|
|
272
|
+
formId = findAssociationField === null || findAssociationField === void 0 ? void 0 : (_findAssociationField = findAssociationField.props) === null || _findAssociationField === void 0 ? void 0 : (_findAssociationField2 = _findAssociationField.fieldProps) === null || _findAssociationField2 === void 0 ? void 0 : (_findAssociationField3 = _findAssociationField2.associationForm) === null || _findAssociationField3 === void 0 ? void 0 : _findAssociationField3.id;
|
|
273
|
+
if (formId) {
|
|
274
|
+
_context5.next = 12;
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
return _context5.abrupt("return", null);
|
|
278
|
+
case 12:
|
|
279
|
+
_context5.next = 14;
|
|
280
|
+
return _index["default"].api.getSchema(formId);
|
|
281
|
+
case 14:
|
|
282
|
+
associationFormSchema = _context5.sent.data;
|
|
283
|
+
case 15:
|
|
284
|
+
return _context5.abrupt("return", associationFormSchema);
|
|
285
|
+
case 16:
|
|
286
|
+
case "end":
|
|
287
|
+
return _context5.stop();
|
|
288
|
+
}
|
|
289
|
+
}, _callee5);
|
|
290
|
+
}));
|
|
291
|
+
return _getSchemaByAssociationFieldId.apply(this, arguments);
|
|
292
|
+
}
|
|
293
|
+
function findFieldSchema(schema, fieldId) {
|
|
294
|
+
var associationAttributeField = null;
|
|
295
|
+
forEachFormSchema(schema, function (field) {
|
|
296
|
+
if (field.props.fieldId == fieldId) {
|
|
297
|
+
//深拷贝
|
|
298
|
+
associationAttributeField = JSON.parse(JSON.stringify(field));
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
return true;
|
|
302
|
+
});
|
|
303
|
+
return associationAttributeField;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* 遍历schema
|
|
308
|
+
* @param schema
|
|
309
|
+
* @param callback 返回true 继续往下遍历
|
|
310
|
+
*/
|
|
249
311
|
function forEachFormSchema(schema, callback) {
|
|
250
312
|
var _schema$children;
|
|
251
313
|
schema === null || schema === void 0 ? void 0 : (_schema$children = schema.children) === null || _schema$children === void 0 ? void 0 : _schema$children.forEach(function (child, index, children) {
|
|
@@ -305,4 +367,36 @@ var FormFieldSchema = /*#__PURE__*/function () {
|
|
|
305
367
|
}).join(".");
|
|
306
368
|
};
|
|
307
369
|
return FormFieldSchema;
|
|
308
|
-
}();
|
|
370
|
+
}();
|
|
371
|
+
function getAdminFormSchema(_x10) {
|
|
372
|
+
return _getAdminFormSchema.apply(this, arguments);
|
|
373
|
+
}
|
|
374
|
+
function _getAdminFormSchema() {
|
|
375
|
+
_getAdminFormSchema = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(id) {
|
|
376
|
+
var res, schema;
|
|
377
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
378
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
379
|
+
case 0:
|
|
380
|
+
_context6.next = 2;
|
|
381
|
+
return _index["default"].api.getSchema(id, true);
|
|
382
|
+
case 2:
|
|
383
|
+
res = _context6.sent;
|
|
384
|
+
if (!res.success) {
|
|
385
|
+
_context6.next = 8;
|
|
386
|
+
break;
|
|
387
|
+
}
|
|
388
|
+
schema = JSON.parse(JSON.stringify(res.data));
|
|
389
|
+
_context6.next = 7;
|
|
390
|
+
return handleFormSchema(schema);
|
|
391
|
+
case 7:
|
|
392
|
+
return _context6.abrupt("return", schema);
|
|
393
|
+
case 8:
|
|
394
|
+
return _context6.abrupt("return", null);
|
|
395
|
+
case 9:
|
|
396
|
+
case "end":
|
|
397
|
+
return _context6.stop();
|
|
398
|
+
}
|
|
399
|
+
}, _callee6);
|
|
400
|
+
}));
|
|
401
|
+
return _getAdminFormSchema.apply(this, arguments);
|
|
402
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function transformerId(value: any): any;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.transformerId = transformerId;
|
|
5
|
+
function transformerId(value) {
|
|
6
|
+
if (value == null) {
|
|
7
|
+
return null;
|
|
8
|
+
}
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
return value.map(transformerId).filter(function (value) {
|
|
11
|
+
return !!value;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (typeof value == "object") {
|
|
15
|
+
return (value === null || value === void 0 ? void 0 : value.id) || (value === null || value === void 0 ? void 0 : value.value) || value;
|
|
16
|
+
}
|
|
17
|
+
if (typeof value == "string") {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
if (typeof value == "number") {
|
|
21
|
+
return value;
|
|
22
|
+
}
|
|
23
|
+
return (value === null || value === void 0 ? void 0 : value.id) || value.value || value;
|
|
24
|
+
}
|
|
@@ -22,7 +22,7 @@ var PageLayout = exports.PageLayout = /*#__PURE__*/function (_Component) {
|
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
24
|
_this.getWith = function () {
|
|
25
|
-
return Math.min(window.innerWidth,
|
|
25
|
+
return Math.min(window.innerWidth, 1600);
|
|
26
26
|
};
|
|
27
27
|
_this.handleResize = function () {
|
|
28
28
|
if (_this.props.layout == "drawer") {
|