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