@byteluck-fe/model-driven-driven 1.7.11 → 1.7.12
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/dist/esm/Driven.js +15 -15
- package/dist/esm/Store.js +5 -5
- package/dist/esm/utils.js +12 -12
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +8 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -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 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- package/package.json +3 -3
package/dist/esm/Driven.js
CHANGED
|
@@ -214,7 +214,7 @@ var applyingPluginName = "";
|
|
|
214
214
|
// TODO 拿到permission_controls
|
|
215
215
|
_this.generatePermissions = generatePermissions;
|
|
216
216
|
_this.$options = Object.freeze(options);
|
|
217
|
-
var
|
|
217
|
+
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? false : _this_$options_autoMount, tmp = _this_$options.Designer, DesignerClass = tmp === void 0 ? Designer : tmp, schema = _this_$options.schema, _this_$options_mode = _this_$options.mode, mode = _this_$options_mode === void 0 ? "form" : _this_$options_mode, tmp1 = _this_$options.store, storeOptions = tmp1 === void 0 ? {} : tmp1;
|
|
218
218
|
_this.eventLogic = new EventLogic();
|
|
219
219
|
_this.designer = new DesignerClass();
|
|
220
220
|
_this.store = new Store(_objectSpread({
|
|
@@ -229,7 +229,7 @@ var applyingPluginName = "";
|
|
|
229
229
|
var _proto = Driven.prototype;
|
|
230
230
|
// 挂载
|
|
231
231
|
_proto.mount = function mount() {
|
|
232
|
-
var
|
|
232
|
+
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
233
233
|
this.__plugins = plugins;
|
|
234
234
|
this.applyPlugins();
|
|
235
235
|
this.isMounted = true;
|
|
@@ -245,8 +245,8 @@ var applyingPluginName = "";
|
|
|
245
245
|
if (this.__pluginsApplied) return;
|
|
246
246
|
this.__plugins.forEach(function(plugin) {
|
|
247
247
|
try {
|
|
248
|
-
var
|
|
249
|
-
applyingPluginName = (
|
|
248
|
+
var _plugin_pluginName;
|
|
249
|
+
applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
|
|
250
250
|
plugin.apply(_this);
|
|
251
251
|
applyingPluginName = "";
|
|
252
252
|
} catch (e) {
|
|
@@ -307,10 +307,10 @@ var applyingPluginName = "";
|
|
|
307
307
|
};
|
|
308
308
|
_proto.concatSetting = function concatSetting(settings, otherSettings, settingFromId) {
|
|
309
309
|
var _this = this;
|
|
310
|
-
var
|
|
310
|
+
var _settings_, _otherSettings_, _settings_1, _otherSettings_1;
|
|
311
311
|
var result = settings;
|
|
312
312
|
// tab
|
|
313
|
-
if (((
|
|
313
|
+
if (((_settings_ = settings[0]) === null || _settings_ === void 0 ? void 0 : _settings_.type) === "tab" && ((_otherSettings_ = otherSettings[0]) === null || _otherSettings_ === void 0 ? void 0 : _otherSettings_.type) === "tab") {
|
|
314
314
|
var tabSettings = settings;
|
|
315
315
|
var otherTabSettings = otherSettings.slice(0);
|
|
316
316
|
result = tabSettings.map(function(tab, index) {
|
|
@@ -333,7 +333,7 @@ var applyingPluginName = "";
|
|
|
333
333
|
})));
|
|
334
334
|
}
|
|
335
335
|
// group
|
|
336
|
-
} else if (((
|
|
336
|
+
} else if (((_settings_1 = settings[0]) === null || _settings_1 === void 0 ? void 0 : _settings_1.type) === "group" && ((_otherSettings_1 = otherSettings[0]) === null || _otherSettings_1 === void 0 ? void 0 : _otherSettings_1.type) === "group") {
|
|
337
337
|
var groupSettings = settings;
|
|
338
338
|
var otherGroupSettings = otherSettings;
|
|
339
339
|
result = _toConsumableArray(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_toConsumableArray(groupSettings));
|
|
@@ -359,8 +359,8 @@ var applyingPluginName = "";
|
|
|
359
359
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
360
360
|
args[_key] = arguments[_key];
|
|
361
361
|
}
|
|
362
|
-
var
|
|
363
|
-
return (
|
|
362
|
+
var _this_designer;
|
|
363
|
+
return (_this_designer = this.designer).registerControlConfig.apply(_this_designer, _toConsumableArray(args));
|
|
364
364
|
};
|
|
365
365
|
_proto.getControlConfig = function getControlConfig(control) {
|
|
366
366
|
return this.designer.getControlConfig(control);
|
|
@@ -395,7 +395,7 @@ var applyingPluginName = "";
|
|
|
395
395
|
};
|
|
396
396
|
_proto.moveEnd = function moveEnd() {
|
|
397
397
|
var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.store.movingInstance;
|
|
398
|
-
var
|
|
398
|
+
var _this_store_selected;
|
|
399
399
|
if (instance === null) return;
|
|
400
400
|
var _instance = this.getInstance(instance);
|
|
401
401
|
if (!_instance) return;
|
|
@@ -409,7 +409,7 @@ var applyingPluginName = "";
|
|
|
409
409
|
var newParent = _instance.parent;
|
|
410
410
|
// 移动之后清空movingInstance
|
|
411
411
|
this.store.setMovingInstance(null);
|
|
412
|
-
if (_instance.id !== ((
|
|
412
|
+
if (_instance.id !== ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
413
413
|
this.selectInstance(_instance);
|
|
414
414
|
} else {
|
|
415
415
|
this.store.setSelectInstance(_instance);
|
|
@@ -455,7 +455,7 @@ var applyingPluginName = "";
|
|
|
455
455
|
});
|
|
456
456
|
};
|
|
457
457
|
_proto.updateInstancePropValue = function updateInstancePropValue(instance, propName, value, payload) {
|
|
458
|
-
var
|
|
458
|
+
var _this_store_selected;
|
|
459
459
|
var result = updateValueFromKeys(instance.props, propName, value);
|
|
460
460
|
if (!result) {
|
|
461
461
|
return;
|
|
@@ -464,7 +464,7 @@ var applyingPluginName = "";
|
|
|
464
464
|
if (propName.startsWith("dataBind")) {
|
|
465
465
|
this.store.updateDataFieldCodeMap(instance);
|
|
466
466
|
}
|
|
467
|
-
if (instance.id === ((
|
|
467
|
+
if (instance.id === ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
468
468
|
this.callSelectedEffect(propName, payload);
|
|
469
469
|
}
|
|
470
470
|
this.emit("updated", {
|
|
@@ -563,8 +563,8 @@ var applyingPluginName = "";
|
|
|
563
563
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
564
564
|
arg[_key] = arguments[_key];
|
|
565
565
|
}
|
|
566
|
-
var
|
|
567
|
-
(
|
|
566
|
+
var _this_designer;
|
|
567
|
+
(_this_designer = this.designer).registerControl.apply(_this_designer, _toConsumableArray(arg));
|
|
568
568
|
return this;
|
|
569
569
|
};
|
|
570
570
|
/**
|
package/dist/esm/Store.js
CHANGED
|
@@ -111,8 +111,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
111
111
|
this.movingInstance = null;
|
|
112
112
|
this.movingInstanceOldParent = null;
|
|
113
113
|
this.movingInstanceOldDataScopeParent = null;
|
|
114
|
-
var
|
|
115
|
-
this.getParentBeforeInstanceMove = (
|
|
114
|
+
var _options_getParentBeforeInstanceMove;
|
|
115
|
+
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
116
116
|
return instance.parent;
|
|
117
117
|
};
|
|
118
118
|
this.instance = options.instance;
|
|
@@ -133,8 +133,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
133
133
|
this.selectedInstanceSetting = settings;
|
|
134
134
|
this.selectedInstanceSettingItems = [];
|
|
135
135
|
this.selectedInstanceSetting.forEach(function(group) {
|
|
136
|
-
var
|
|
137
|
-
(
|
|
136
|
+
var _this_selectedInstanceSettingItems;
|
|
137
|
+
(_this_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_this_selectedInstanceSettingItems, _toConsumableArray(_this.getSettingItems(group)));
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
140
|
_proto.getSettingItems = function getSettingItems(group) {
|
|
@@ -164,7 +164,7 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
164
164
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
165
165
|
try {
|
|
166
166
|
for(var _iterator = map.entries()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
167
|
-
var
|
|
167
|
+
var _step_value = _slicedToArray(_step.value, 2), key = _step_value[0], value = _step_value[1];
|
|
168
168
|
if (value.id === instance.id) {
|
|
169
169
|
map.delete(key);
|
|
170
170
|
break;
|
package/dist/esm/utils.js
CHANGED
|
@@ -415,16 +415,16 @@ function generatePermissions(controls, parent) {
|
|
|
415
415
|
}).flat()));
|
|
416
416
|
} else {
|
|
417
417
|
var type = controls.type;
|
|
418
|
-
var
|
|
418
|
+
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
|
|
419
419
|
var permissionItem;
|
|
420
420
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
421
|
-
var
|
|
421
|
+
var _parent_controlId;
|
|
422
422
|
permissionItem = {
|
|
423
423
|
controlId: controls.id,
|
|
424
424
|
caption: caption || content || controls.name,
|
|
425
425
|
type: controls.type,
|
|
426
426
|
controlType: controls.controlType,
|
|
427
|
-
parentId: (
|
|
427
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
428
428
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
429
429
|
canRead: true,
|
|
430
430
|
canHide: true,
|
|
@@ -438,28 +438,28 @@ function generatePermissions(controls, parent) {
|
|
|
438
438
|
permissionItem.caption = controls.props.controlExportName || controls.name;
|
|
439
439
|
}
|
|
440
440
|
if (_instanceof(controls, DesignerFormControl) || _instanceof(controls, DesignerColumnControl)) {
|
|
441
|
-
var
|
|
442
|
-
if (((
|
|
441
|
+
var _controls_props1, _controls_props_dataBind, _controls_props2, _controls_props_dataBind1;
|
|
442
|
+
if (((_controls_props1 = controls.props) === null || _controls_props1 === void 0 ? void 0 : (_controls_props_dataBind = _controls_props1.dataBind) === null || _controls_props_dataBind === void 0 ? void 0 : _controls_props_dataBind.fieldCode) !== undefined && ((_controls_props2 = controls.props) === null || _controls_props2 === void 0 ? void 0 : (_controls_props_dataBind1 = _controls_props2.dataBind) === null || _controls_props_dataBind1 === void 0 ? void 0 : _controls_props_dataBind1.fieldCode) !== "") {
|
|
443
443
|
permissionItem.group = "field";
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
result.push(permissionItem);
|
|
447
447
|
//追加vue容器权限
|
|
448
448
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
449
|
-
var
|
|
449
|
+
var _controls_props3, _controls_props_dataBind2, _controls_props4, _controls_props_dataBind3;
|
|
450
450
|
var vueFormItemGroup = "element";
|
|
451
|
-
if (((
|
|
451
|
+
if (((_controls_props3 = controls.props) === null || _controls_props3 === void 0 ? void 0 : (_controls_props_dataBind2 = _controls_props3.dataBind) === null || _controls_props_dataBind2 === void 0 ? void 0 : _controls_props_dataBind2.fieldCode) !== undefined && ((_controls_props4 = controls.props) === null || _controls_props4 === void 0 ? void 0 : (_controls_props_dataBind3 = _controls_props4.dataBind) === null || _controls_props_dataBind3 === void 0 ? void 0 : _controls_props_dataBind3.fieldCode) !== "") {
|
|
452
452
|
vueFormItemGroup = "field";
|
|
453
453
|
}
|
|
454
454
|
var permissions = controls.props["permissions"];
|
|
455
455
|
permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
|
|
456
|
-
var
|
|
456
|
+
var _controls_id;
|
|
457
457
|
permissionItem = {
|
|
458
458
|
controlId: item.key,
|
|
459
459
|
caption: item.caption,
|
|
460
460
|
type: controls.type,
|
|
461
461
|
controlType: controls.controlType,
|
|
462
|
-
parentId: (
|
|
462
|
+
parentId: (_controls_id = controls.id) !== null && _controls_id !== void 0 ? _controls_id : null,
|
|
463
463
|
canEdit: true,
|
|
464
464
|
canRead: true,
|
|
465
465
|
canHide: true,
|
|
@@ -471,17 +471,17 @@ function generatePermissions(controls, parent) {
|
|
|
471
471
|
} else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
472
472
|
// 列表的操作列单独处理
|
|
473
473
|
Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
|
|
474
|
-
var _param = _slicedToArray(param, 2), key = _param[0],
|
|
474
|
+
var _param = _slicedToArray(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
|
|
475
475
|
var operationItem = controls.props[key];
|
|
476
476
|
if (operationItem && operationItem.isShow) {
|
|
477
|
-
var
|
|
477
|
+
var _parent_controlId;
|
|
478
478
|
// 只能控制是否显示
|
|
479
479
|
result.push({
|
|
480
480
|
controlId: controlId,
|
|
481
481
|
caption: caption,
|
|
482
482
|
type: controls.type,
|
|
483
483
|
controlType: controls.controlType,
|
|
484
|
-
parentId: (
|
|
484
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
485
485
|
canEdit: false,
|
|
486
486
|
canRead: false,
|
|
487
487
|
canHide: true,
|