@byteluck-fe/model-driven-driven 4.54.0-lx2 → 4.69.0-lx0
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/README.md +13 -13
- package/dist/esm/Builder.js +46 -31
- package/dist/esm/Designer.js +9 -14
- package/dist/esm/Driven.js +28 -27
- package/dist/esm/Store.js +40 -40
- package/dist/esm/constants.js +7 -6
- package/dist/esm/designerUtils.js +8 -3
- package/dist/esm/utils.js +32 -99
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +9 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +114 -112
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +4 -5
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +41 -55
- package/package.json +3 -3
package/dist/esm/utils.js
CHANGED
|
@@ -86,7 +86,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
86
86
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
87
87
|
}
|
|
88
88
|
function _ts_generator(thisArg, body) {
|
|
89
|
-
var f, y, t, _ = {
|
|
89
|
+
var f, y, t, g, _ = {
|
|
90
90
|
label: 0,
|
|
91
91
|
sent: function() {
|
|
92
92
|
if (t[0] & 1) throw t[1];
|
|
@@ -94,17 +94,13 @@ function _ts_generator(thisArg, body) {
|
|
|
94
94
|
},
|
|
95
95
|
trys: [],
|
|
96
96
|
ops: []
|
|
97
|
-
}
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
105
|
-
value: function() {
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
97
|
+
};
|
|
98
|
+
return g = {
|
|
99
|
+
next: verb(0),
|
|
100
|
+
"throw": verb(1),
|
|
101
|
+
"return": verb(2)
|
|
102
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
103
|
+
return this;
|
|
108
104
|
}), g;
|
|
109
105
|
function verb(n) {
|
|
110
106
|
return function(v) {
|
|
@@ -116,7 +112,7 @@ function _ts_generator(thisArg, body) {
|
|
|
116
112
|
}
|
|
117
113
|
function step(op) {
|
|
118
114
|
if (f) throw new TypeError("Generator is already executing.");
|
|
119
|
-
while(
|
|
115
|
+
while(_)try {
|
|
120
116
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
121
117
|
if (y = 0, t) op = [
|
|
122
118
|
op[0] & 2,
|
|
@@ -185,9 +181,11 @@ function _ts_generator(thisArg, body) {
|
|
|
185
181
|
}
|
|
186
182
|
}
|
|
187
183
|
import { loopFormControl } from './designerUtils';
|
|
188
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE,
|
|
189
|
-
|
|
190
|
-
|
|
184
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, // FieldTypes,
|
|
185
|
+
// FieldTypeToColumnType,
|
|
186
|
+
isArray } from '@byteluck-fe/model-driven-shared';
|
|
187
|
+
import { objectDataBindControlTypes } from './constants';
|
|
188
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
191
189
|
export function getMasterFormControls(controls) {
|
|
192
190
|
var formctls = [];
|
|
193
191
|
// @ts-ignore
|
|
@@ -199,9 +197,9 @@ export function getMasterFormControls(controls) {
|
|
|
199
197
|
});
|
|
200
198
|
return formctls;
|
|
201
199
|
}
|
|
202
|
-
/**
|
|
203
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
204
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
200
|
+
/**
|
|
201
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
202
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
205
203
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
206
204
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
207
205
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
@@ -233,75 +231,6 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
|
|
|
233
231
|
}
|
|
234
232
|
return prefix + fieldCode;
|
|
235
233
|
}
|
|
236
|
-
/**
|
|
237
|
-
* @description 通过fieldType获取列表表头的type
|
|
238
|
-
* */ export function getColumnTypeFromFiledType(fieldType) {
|
|
239
|
-
return FieldTypeToColumnType[fieldType];
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* @description 通过modelBindInfoList生成多个columns
|
|
243
|
-
* */ export function getColumnsFromModelBindInfoList(modelBindInfoList) {
|
|
244
|
-
var designer = new Designer();
|
|
245
|
-
var columns = [];
|
|
246
|
-
modelBindInfoList.forEach(function(item) {
|
|
247
|
-
// 控件在明细子表内或者没有dataBind的话 不做生成
|
|
248
|
-
if (item.parentId || !item.dataBind) return;
|
|
249
|
-
// 如果是对象形式的dataBind的话
|
|
250
|
-
if (objectDataBindControlTypes.includes(item.type)) {
|
|
251
|
-
var objectDataBind = item.dataBind;
|
|
252
|
-
var datasourceBind = item.datasourceBind;
|
|
253
|
-
// 对象的每一个key生成一个column
|
|
254
|
-
Object.keys(objectDataBind).forEach(function(key) {
|
|
255
|
-
// 对应的dataBind
|
|
256
|
-
var dataBind = objectDataBind[key];
|
|
257
|
-
// 当前key对应的fieldType
|
|
258
|
-
var fieldType = objectDataBindKeyToFieldType[key].fieldType;
|
|
259
|
-
// 拼接当前列的caption
|
|
260
|
-
var caption = item.caption + '_' + objectDataBindKeyToFieldType[key].caption;
|
|
261
|
-
// 通过fieldType获取列类型
|
|
262
|
-
var controlType = getColumnTypeFromFiledType(fieldType);
|
|
263
|
-
if (!controlType) return;
|
|
264
|
-
var props = {
|
|
265
|
-
caption: caption,
|
|
266
|
-
dataBind: dataBind
|
|
267
|
-
};
|
|
268
|
-
if (key === 'currency') {
|
|
269
|
-
props.optionConfig = 'datasource';
|
|
270
|
-
props.datasourceBind = datasourceBind;
|
|
271
|
-
}
|
|
272
|
-
// @ts-ignore
|
|
273
|
-
var column = designer.createControlInstance(controlType, {
|
|
274
|
-
props: props
|
|
275
|
-
});
|
|
276
|
-
column && columns.push(column);
|
|
277
|
-
});
|
|
278
|
-
} else {
|
|
279
|
-
var controlType = getColumnTypeFromFiledType(item.fieldType);
|
|
280
|
-
if (!controlType) return;
|
|
281
|
-
// @ts-ignore
|
|
282
|
-
var column = designer.createControlInstance(controlType, {
|
|
283
|
-
props: {
|
|
284
|
-
caption: item.caption,
|
|
285
|
-
dataBind: item.dataBind,
|
|
286
|
-
datasourceBind: item.datasourceBind
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
column && columns.push(column);
|
|
290
|
-
}
|
|
291
|
-
});
|
|
292
|
-
return columns;
|
|
293
|
-
}
|
|
294
|
-
export function getColumnsFromFiledType(fieldTypes) {
|
|
295
|
-
var designer = new Designer();
|
|
296
|
-
var fieldTypesMap = Array.isArray(fieldTypes) ? fieldTypes : [
|
|
297
|
-
fieldTypes
|
|
298
|
-
];
|
|
299
|
-
var result = fieldTypesMap.map(function(fieldType) {
|
|
300
|
-
var columnType = getColumnTypeFromFiledType(fieldType);
|
|
301
|
-
return designer.createControlInstance(columnType);
|
|
302
|
-
});
|
|
303
|
-
return Array.isArray(fieldTypes) ? result : result[0];
|
|
304
|
-
}
|
|
305
234
|
function toSchema(schema) {
|
|
306
235
|
if (Array.isArray(schema)) {
|
|
307
236
|
return schema.map(function(item) {
|
|
@@ -322,7 +251,10 @@ function getModelBindInfoList(controls) {
|
|
|
322
251
|
return controls.toDataBindModel();
|
|
323
252
|
}
|
|
324
253
|
function checkSchema(controls, messages, ignore) {
|
|
325
|
-
return
|
|
254
|
+
return _checkSchema.apply(this, arguments);
|
|
255
|
+
}
|
|
256
|
+
function _checkSchema() {
|
|
257
|
+
_checkSchema = _async_to_generator(function(controls, messages, ignore) {
|
|
326
258
|
var result;
|
|
327
259
|
return _ts_generator(this, function(_state) {
|
|
328
260
|
switch(_state.label){
|
|
@@ -357,7 +289,8 @@ function checkSchema(controls, messages, ignore) {
|
|
|
357
289
|
];
|
|
358
290
|
}
|
|
359
291
|
});
|
|
360
|
-
})
|
|
292
|
+
});
|
|
293
|
+
return _checkSchema.apply(this, arguments);
|
|
361
294
|
}
|
|
362
295
|
// 不可以被权限控制的控件
|
|
363
296
|
var PermissionExcludeControlTypes = [
|
|
@@ -391,15 +324,15 @@ var cannotEditControlTypes = [
|
|
|
391
324
|
var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
|
|
392
325
|
check: {
|
|
393
326
|
id: 'listPageCheckBtnId',
|
|
394
|
-
caption: '查看'
|
|
327
|
+
caption: getLocaleText('CMD.view', null, '查看')
|
|
395
328
|
},
|
|
396
329
|
edit: {
|
|
397
330
|
id: 'listPageEditBtnId',
|
|
398
|
-
caption: '编辑'
|
|
331
|
+
caption: getLocaleText('CMD.edit', null, '编辑')
|
|
399
332
|
},
|
|
400
333
|
delete: {
|
|
401
334
|
id: 'listPageDeleteBtnId',
|
|
402
|
-
caption: '删除'
|
|
335
|
+
caption: getLocaleText('CMD.delete', null, '删除')
|
|
403
336
|
}
|
|
404
337
|
};
|
|
405
338
|
// 生成权限字段
|
|
@@ -412,16 +345,16 @@ function generatePermissions(controls, parent) {
|
|
|
412
345
|
}).flat()));
|
|
413
346
|
} else {
|
|
414
347
|
var type = controls.type;
|
|
415
|
-
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
|
|
348
|
+
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content, title = _controls_props.title;
|
|
416
349
|
var permissionItem;
|
|
417
350
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
418
|
-
var
|
|
351
|
+
var _parent_controlId;
|
|
419
352
|
permissionItem = {
|
|
420
353
|
controlId: controls.id,
|
|
421
|
-
caption: caption || content || controls.name,
|
|
354
|
+
caption: caption || content || title || controls.name,
|
|
422
355
|
type: controls.type,
|
|
423
356
|
controlType: controls.controlType,
|
|
424
|
-
parentId: (
|
|
357
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
425
358
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
426
359
|
canRead: true,
|
|
427
360
|
canHide: true,
|
|
@@ -477,14 +410,14 @@ function generatePermissions(controls, parent) {
|
|
|
477
410
|
var _param = _sliced_to_array(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
|
|
478
411
|
var operationItem = controls.props[key];
|
|
479
412
|
if (operationItem && operationItem.isShow) {
|
|
480
|
-
var
|
|
413
|
+
var _parent_controlId;
|
|
481
414
|
// 只能控制是否显示
|
|
482
415
|
result.push({
|
|
483
416
|
controlId: controlId,
|
|
484
417
|
caption: caption,
|
|
485
418
|
type: controls.type,
|
|
486
419
|
controlType: controls.controlType,
|
|
487
|
-
parentId: (
|
|
420
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
488
421
|
canEdit: false,
|
|
489
422
|
canRead: false,
|
|
490
423
|
canHide: true,
|