@byteluck-fe/model-driven-driven 2.3.1-beta.2 → 2.3.1-beta.3
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/Designer.js +103 -12
- package/dist/esm/Driven.js +19 -19
- package/dist/esm/Store.js +6 -6
- package/dist/esm/constants.js +1 -1
- package/dist/esm/designerUtils.js +2 -3
- package/dist/esm/utils.js +141 -40
- 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 +6 -6
package/dist/esm/Designer.js
CHANGED
|
@@ -130,7 +130,101 @@ function _createSuper(Derived) {
|
|
|
130
130
|
return _possibleConstructorReturn(this, result);
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
134
|
+
var f, y, t, g, _ = {
|
|
135
|
+
label: 0,
|
|
136
|
+
sent: function() {
|
|
137
|
+
if (t[0] & 1) throw t[1];
|
|
138
|
+
return t[1];
|
|
139
|
+
},
|
|
140
|
+
trys: [],
|
|
141
|
+
ops: []
|
|
142
|
+
};
|
|
143
|
+
return g = {
|
|
144
|
+
next: verb(0),
|
|
145
|
+
"throw": verb(1),
|
|
146
|
+
"return": verb(2)
|
|
147
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
148
|
+
return this;
|
|
149
|
+
}), g;
|
|
150
|
+
function verb(n) {
|
|
151
|
+
return function(v) {
|
|
152
|
+
return step([
|
|
153
|
+
n,
|
|
154
|
+
v
|
|
155
|
+
]);
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
function step(op) {
|
|
159
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
160
|
+
while(_)try {
|
|
161
|
+
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;
|
|
162
|
+
if (y = 0, t) op = [
|
|
163
|
+
op[0] & 2,
|
|
164
|
+
t.value
|
|
165
|
+
];
|
|
166
|
+
switch(op[0]){
|
|
167
|
+
case 0:
|
|
168
|
+
case 1:
|
|
169
|
+
t = op;
|
|
170
|
+
break;
|
|
171
|
+
case 4:
|
|
172
|
+
_.label++;
|
|
173
|
+
return {
|
|
174
|
+
value: op[1],
|
|
175
|
+
done: false
|
|
176
|
+
};
|
|
177
|
+
case 5:
|
|
178
|
+
_.label++;
|
|
179
|
+
y = op[1];
|
|
180
|
+
op = [
|
|
181
|
+
0
|
|
182
|
+
];
|
|
183
|
+
continue;
|
|
184
|
+
case 7:
|
|
185
|
+
op = _.ops.pop();
|
|
186
|
+
_.trys.pop();
|
|
187
|
+
continue;
|
|
188
|
+
default:
|
|
189
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
190
|
+
_ = 0;
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
194
|
+
_.label = op[1];
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
198
|
+
_.label = t[1];
|
|
199
|
+
t = op;
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
if (t && _.label < t[2]) {
|
|
203
|
+
_.label = t[2];
|
|
204
|
+
_.ops.push(op);
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
if (t[2]) _.ops.pop();
|
|
208
|
+
_.trys.pop();
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
op = body.call(thisArg, _);
|
|
212
|
+
} catch (e) {
|
|
213
|
+
op = [
|
|
214
|
+
6,
|
|
215
|
+
e
|
|
216
|
+
];
|
|
217
|
+
y = 0;
|
|
218
|
+
} finally{
|
|
219
|
+
f = t = 0;
|
|
220
|
+
}
|
|
221
|
+
if (op[0] & 5) throw op[1];
|
|
222
|
+
return {
|
|
223
|
+
value: op[0] ? op[1] : void 0,
|
|
224
|
+
done: true
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
};
|
|
134
228
|
import { RegisterControls, controlHooksEmitter } from "@byteluck-fe/model-driven-core";
|
|
135
229
|
import EventLogic from "./EventLogic";
|
|
136
230
|
import { FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
@@ -194,17 +288,14 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
194
288
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
195
289
|
args[_key] = arguments[_key];
|
|
196
290
|
}
|
|
197
|
-
return _asyncToGenerator(
|
|
198
|
-
return
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
}
|
|
206
|
-
}, _callee);
|
|
207
|
-
}))();
|
|
291
|
+
return _asyncToGenerator(function() {
|
|
292
|
+
return __generator(this, function(_state) {
|
|
293
|
+
return [
|
|
294
|
+
2,
|
|
295
|
+
checkSchema.apply(void 0, _toConsumableArray(args))
|
|
296
|
+
];
|
|
297
|
+
});
|
|
298
|
+
})();
|
|
208
299
|
};
|
|
209
300
|
_proto.getModelBindInfoList = function getModelBindInfoList1() {
|
|
210
301
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
package/dist/esm/Driven.js
CHANGED
|
@@ -206,7 +206,7 @@ var applyingPluginName = "";
|
|
|
206
206
|
// TODO 拿到permission_controls
|
|
207
207
|
_this.generatePermissions = generatePermissions;
|
|
208
208
|
_this.$options = Object.freeze(options);
|
|
209
|
-
var
|
|
209
|
+
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;
|
|
210
210
|
_this.eventLogic = new EventLogic();
|
|
211
211
|
_this.designer = new DesignerClass();
|
|
212
212
|
_this.store = new Store(_objectSpread({
|
|
@@ -221,7 +221,7 @@ var applyingPluginName = "";
|
|
|
221
221
|
var _proto = Driven.prototype;
|
|
222
222
|
// 挂载
|
|
223
223
|
_proto.mount = function mount() {
|
|
224
|
-
var
|
|
224
|
+
var _this_$options = this.$options, _this_$options_plugins = _this_$options.plugins, plugins = _this_$options_plugins === void 0 ? [] : _this_$options_plugins;
|
|
225
225
|
this.__plugins = plugins;
|
|
226
226
|
this.applyPlugins();
|
|
227
227
|
this.isMounted = true;
|
|
@@ -237,8 +237,8 @@ var applyingPluginName = "";
|
|
|
237
237
|
if (this.__pluginsApplied) return;
|
|
238
238
|
this.__plugins.forEach(function(plugin) {
|
|
239
239
|
try {
|
|
240
|
-
var
|
|
241
|
-
applyingPluginName = (
|
|
240
|
+
var _plugin_pluginName;
|
|
241
|
+
applyingPluginName = (_plugin_pluginName = plugin.pluginName) !== null && _plugin_pluginName !== void 0 ? _plugin_pluginName : plugin.constructor.name;
|
|
242
242
|
plugin.apply(_this);
|
|
243
243
|
applyingPluginName = "";
|
|
244
244
|
} catch (e) {
|
|
@@ -277,7 +277,7 @@ var applyingPluginName = "";
|
|
|
277
277
|
});
|
|
278
278
|
};
|
|
279
279
|
_proto.setSelectedInstanceSetting = function setSelectedInstanceSetting() {
|
|
280
|
-
var
|
|
280
|
+
var _instance_parent;
|
|
281
281
|
var instance = this.store.selected;
|
|
282
282
|
if (!instance) {
|
|
283
283
|
return;
|
|
@@ -285,9 +285,9 @@ var applyingPluginName = "";
|
|
|
285
285
|
var setting = this.getControlSetting(instance.type);
|
|
286
286
|
// console.log('iswrap:', instance.parent?.controlType, instance.parent)
|
|
287
287
|
// if (instance.parent instanceof DesignerWrapControl) {
|
|
288
|
-
if (((
|
|
289
|
-
var
|
|
290
|
-
var wrapSetting = this.getControlSetting((
|
|
288
|
+
if (((_instance_parent = instance.parent) === null || _instance_parent === void 0 ? void 0 : _instance_parent.controlType) === CONTROL_BASE_TYPE.WRAP) {
|
|
289
|
+
var _instance_parent1;
|
|
290
|
+
var wrapSetting = this.getControlSetting((_instance_parent1 = instance.parent) === null || _instance_parent1 === void 0 ? void 0 : _instance_parent1.type);
|
|
291
291
|
setting = this.concatSetting(setting, wrapSetting, instance.parent.id);
|
|
292
292
|
}
|
|
293
293
|
this.store.setSelectInstanceSettings(setting);
|
|
@@ -303,10 +303,10 @@ var applyingPluginName = "";
|
|
|
303
303
|
};
|
|
304
304
|
_proto.concatSetting = function concatSetting(settings, otherSettings, settingFromId) {
|
|
305
305
|
var _this = this;
|
|
306
|
-
var
|
|
306
|
+
var _settings_, _otherSettings_, _settings_1, _otherSettings_1;
|
|
307
307
|
var result = settings;
|
|
308
308
|
// tab
|
|
309
|
-
if (((
|
|
309
|
+
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") {
|
|
310
310
|
var tabSettings = settings;
|
|
311
311
|
var otherTabSettings = otherSettings.slice(0);
|
|
312
312
|
result = tabSettings.map(function(tab, index) {
|
|
@@ -329,7 +329,7 @@ var applyingPluginName = "";
|
|
|
329
329
|
})));
|
|
330
330
|
}
|
|
331
331
|
// group
|
|
332
|
-
} else if (((
|
|
332
|
+
} 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") {
|
|
333
333
|
var groupSettings = settings;
|
|
334
334
|
var otherGroupSettings = otherSettings;
|
|
335
335
|
result = _toConsumableArray(this.formatGroupSetting(otherGroupSettings, settingFromId)).concat(_toConsumableArray(groupSettings));
|
|
@@ -355,8 +355,8 @@ var applyingPluginName = "";
|
|
|
355
355
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
356
356
|
args[_key] = arguments[_key];
|
|
357
357
|
}
|
|
358
|
-
var
|
|
359
|
-
return (
|
|
358
|
+
var _this_designer;
|
|
359
|
+
return (_this_designer = this.designer).registerControlConfig.apply(_this_designer, _toConsumableArray(args));
|
|
360
360
|
};
|
|
361
361
|
_proto.getControlConfig = function getControlConfig(control) {
|
|
362
362
|
return this.designer.getControlConfig(control);
|
|
@@ -391,7 +391,7 @@ var applyingPluginName = "";
|
|
|
391
391
|
};
|
|
392
392
|
_proto.moveEnd = function moveEnd() {
|
|
393
393
|
var instance = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.store.movingInstance;
|
|
394
|
-
var
|
|
394
|
+
var _this_store_selected;
|
|
395
395
|
if (instance === null) return;
|
|
396
396
|
var _instance = this.getInstance(instance);
|
|
397
397
|
if (!_instance) return;
|
|
@@ -405,7 +405,7 @@ var applyingPluginName = "";
|
|
|
405
405
|
var newParent = _instance.parent;
|
|
406
406
|
// 移动之后清空movingInstance
|
|
407
407
|
this.store.setMovingInstance(null);
|
|
408
|
-
if (_instance.id !== ((
|
|
408
|
+
if (_instance.id !== ((_this_store_selected = this.store.selected) === null || _this_store_selected === void 0 ? void 0 : _this_store_selected.id)) {
|
|
409
409
|
this.selectInstance(_instance);
|
|
410
410
|
} else {
|
|
411
411
|
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", {
|
|
@@ -565,8 +565,8 @@ var applyingPluginName = "";
|
|
|
565
565
|
for(var _len = arguments.length, arg = new Array(_len), _key = 0; _key < _len; _key++){
|
|
566
566
|
arg[_key] = arguments[_key];
|
|
567
567
|
}
|
|
568
|
-
var
|
|
569
|
-
(
|
|
568
|
+
var _this_designer;
|
|
569
|
+
(_this_designer = this.designer).registerControl.apply(_this_designer, _toConsumableArray(arg));
|
|
570
570
|
return this;
|
|
571
571
|
};
|
|
572
572
|
/**
|
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;
|
|
@@ -267,7 +267,7 @@ export function isDataScopeInstance(instance) {
|
|
|
267
267
|
return [
|
|
268
268
|
CONTROL_TYPE.SUBTABLE,
|
|
269
269
|
CONTROL_TYPE.DATA_VIEW,
|
|
270
|
-
CONTROL_TYPE.LIST_VIEW
|
|
270
|
+
CONTROL_TYPE.LIST_VIEW
|
|
271
271
|
].includes(instance.type);
|
|
272
272
|
}
|
|
273
273
|
export function findInstanceDataScopeParent(instance) {
|
package/dist/esm/constants.js
CHANGED
|
@@ -3,7 +3,7 @@ import { CONTROL_TYPE, FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
|
3
3
|
export var objectDataBindControlTypes = [
|
|
4
4
|
CONTROL_TYPE.AMOUNT,
|
|
5
5
|
CONTROL_TYPE.CALC,
|
|
6
|
-
CONTROL_TYPE.DATE_RANGE
|
|
6
|
+
CONTROL_TYPE.DATE_RANGE
|
|
7
7
|
];
|
|
8
8
|
export var objectDataBindKeyToFieldType = {
|
|
9
9
|
amount: {
|
|
@@ -14,9 +14,8 @@ export function loopFormControl(control, callback) {
|
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
loopFormControl(item.props.headers, callback);
|
|
16
16
|
} else if (hasChildrenControl(item)) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
17
|
+
loopFormControl(// @ts-ignore
|
|
18
|
+
item === null || item === void 0 ? void 0 : item.children, callback);
|
|
20
19
|
// @ts-ignore
|
|
21
20
|
// } else if (item instanceof DesignerFormControl) {
|
|
22
21
|
} else if (item.controlType === CONTROL_BASE_TYPE.FORM) {
|
package/dist/esm/utils.js
CHANGED
|
@@ -85,7 +85,101 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
85
85
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
86
86
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
87
87
|
}
|
|
88
|
-
|
|
88
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
89
|
+
var f, y, t, g, _ = {
|
|
90
|
+
label: 0,
|
|
91
|
+
sent: function() {
|
|
92
|
+
if (t[0] & 1) throw t[1];
|
|
93
|
+
return t[1];
|
|
94
|
+
},
|
|
95
|
+
trys: [],
|
|
96
|
+
ops: []
|
|
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;
|
|
104
|
+
}), g;
|
|
105
|
+
function verb(n) {
|
|
106
|
+
return function(v) {
|
|
107
|
+
return step([
|
|
108
|
+
n,
|
|
109
|
+
v
|
|
110
|
+
]);
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function step(op) {
|
|
114
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
115
|
+
while(_)try {
|
|
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;
|
|
117
|
+
if (y = 0, t) op = [
|
|
118
|
+
op[0] & 2,
|
|
119
|
+
t.value
|
|
120
|
+
];
|
|
121
|
+
switch(op[0]){
|
|
122
|
+
case 0:
|
|
123
|
+
case 1:
|
|
124
|
+
t = op;
|
|
125
|
+
break;
|
|
126
|
+
case 4:
|
|
127
|
+
_.label++;
|
|
128
|
+
return {
|
|
129
|
+
value: op[1],
|
|
130
|
+
done: false
|
|
131
|
+
};
|
|
132
|
+
case 5:
|
|
133
|
+
_.label++;
|
|
134
|
+
y = op[1];
|
|
135
|
+
op = [
|
|
136
|
+
0
|
|
137
|
+
];
|
|
138
|
+
continue;
|
|
139
|
+
case 7:
|
|
140
|
+
op = _.ops.pop();
|
|
141
|
+
_.trys.pop();
|
|
142
|
+
continue;
|
|
143
|
+
default:
|
|
144
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
145
|
+
_ = 0;
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
149
|
+
_.label = op[1];
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
152
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
153
|
+
_.label = t[1];
|
|
154
|
+
t = op;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
if (t && _.label < t[2]) {
|
|
158
|
+
_.label = t[2];
|
|
159
|
+
_.ops.push(op);
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
if (t[2]) _.ops.pop();
|
|
163
|
+
_.trys.pop();
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
op = body.call(thisArg, _);
|
|
167
|
+
} catch (e) {
|
|
168
|
+
op = [
|
|
169
|
+
6,
|
|
170
|
+
e
|
|
171
|
+
];
|
|
172
|
+
y = 0;
|
|
173
|
+
} finally{
|
|
174
|
+
f = t = 0;
|
|
175
|
+
}
|
|
176
|
+
if (op[0] & 5) throw op[1];
|
|
177
|
+
return {
|
|
178
|
+
value: op[0] ? op[1] : void 0,
|
|
179
|
+
done: true
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
};
|
|
89
183
|
import { loopFormControl } from "./designerUtils";
|
|
90
184
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
|
|
91
185
|
import Designer from "./Designer";
|
|
@@ -226,35 +320,42 @@ function checkSchema(controls, messages, ignore) {
|
|
|
226
320
|
return _checkSchema.apply(this, arguments);
|
|
227
321
|
}
|
|
228
322
|
function _checkSchema() {
|
|
229
|
-
_checkSchema = _asyncToGenerator(
|
|
323
|
+
_checkSchema = _asyncToGenerator(function(controls, messages, ignore) {
|
|
230
324
|
var result;
|
|
231
|
-
return
|
|
232
|
-
|
|
325
|
+
return __generator(this, function(_state) {
|
|
326
|
+
switch(_state.label){
|
|
233
327
|
case 0:
|
|
234
|
-
if (!Array.isArray(controls))
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
328
|
+
if (!Array.isArray(controls)) return [
|
|
329
|
+
3,
|
|
330
|
+
2
|
|
331
|
+
];
|
|
332
|
+
return [
|
|
333
|
+
4,
|
|
334
|
+
Promise.all(controls.map(function(control) {
|
|
335
|
+
return control.validate(messages, ignore);
|
|
336
|
+
}))
|
|
337
|
+
];
|
|
338
|
+
case 1:
|
|
339
|
+
result = _state.sent();
|
|
340
|
+
return [
|
|
341
|
+
2,
|
|
342
|
+
result.every(function(state) {
|
|
343
|
+
return state;
|
|
344
|
+
})
|
|
345
|
+
];
|
|
346
|
+
case 2:
|
|
347
|
+
return [
|
|
348
|
+
4,
|
|
349
|
+
controls.validate(messages, ignore)
|
|
350
|
+
];
|
|
242
351
|
case 3:
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
case 5:
|
|
248
|
-
_ctx.next = 7;
|
|
249
|
-
return controls.validate(messages, ignore);
|
|
250
|
-
case 7:
|
|
251
|
-
return _ctx.abrupt("return", _ctx.sent);
|
|
252
|
-
case 8:
|
|
253
|
-
case "end":
|
|
254
|
-
return _ctx.stop();
|
|
352
|
+
return [
|
|
353
|
+
2,
|
|
354
|
+
_state.sent()
|
|
355
|
+
];
|
|
255
356
|
}
|
|
256
|
-
}
|
|
257
|
-
})
|
|
357
|
+
});
|
|
358
|
+
});
|
|
258
359
|
return _checkSchema.apply(this, arguments);
|
|
259
360
|
}
|
|
260
361
|
// 不可以被权限控制的控件
|
|
@@ -276,7 +377,7 @@ var PermissionExcludeControlTypes = [
|
|
|
276
377
|
// 暂时不能控制权限
|
|
277
378
|
CONTROL_TYPE.TAB_PANE,
|
|
278
379
|
CONTROL_TYPE.TAB,
|
|
279
|
-
CONTROL_TYPE.CARD_GROUP
|
|
380
|
+
CONTROL_TYPE.CARD_GROUP
|
|
280
381
|
];
|
|
281
382
|
// 不可以编辑的控件
|
|
282
383
|
var cannotEditControlTypes = [
|
|
@@ -307,16 +408,16 @@ function generatePermissions(controls, parent) {
|
|
|
307
408
|
}).flat()));
|
|
308
409
|
} else {
|
|
309
410
|
var type = controls.type;
|
|
310
|
-
var
|
|
411
|
+
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
|
|
311
412
|
var permissionItem;
|
|
312
413
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
313
|
-
var
|
|
414
|
+
var _parent_controlId;
|
|
314
415
|
permissionItem = {
|
|
315
416
|
controlId: controls.id,
|
|
316
417
|
caption: caption || content || controls.name,
|
|
317
418
|
type: controls.type,
|
|
318
419
|
controlType: controls.controlType,
|
|
319
|
-
parentId: (
|
|
420
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
320
421
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
321
422
|
canRead: true,
|
|
322
423
|
canHide: true,
|
|
@@ -335,29 +436,29 @@ function generatePermissions(controls, parent) {
|
|
|
335
436
|
// ) {
|
|
336
437
|
if (controls.controlType === CONTROL_BASE_TYPE.FORM || controls.controlType === CONTROL_BASE_TYPE.COLUMN) {
|
|
337
438
|
var //@ts-ignore
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (((
|
|
439
|
+
_controls_props1, _controls_props_dataBind, //@ts-ignore
|
|
440
|
+
_controls_props2, _controls_props_dataBind1;
|
|
441
|
+
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) !== "") {
|
|
341
442
|
permissionItem.group = "field";
|
|
342
443
|
}
|
|
343
444
|
}
|
|
344
445
|
result.push(permissionItem);
|
|
345
446
|
//追加vue容器权限
|
|
346
447
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
347
|
-
var
|
|
448
|
+
var _controls_props3, _controls_props_dataBind2, _controls_props4, _controls_props_dataBind3;
|
|
348
449
|
var vueFormItemGroup = "element";
|
|
349
|
-
if (((
|
|
450
|
+
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) !== "") {
|
|
350
451
|
vueFormItemGroup = "field";
|
|
351
452
|
}
|
|
352
453
|
var permissions = controls.props["permissions"];
|
|
353
454
|
permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
|
|
354
|
-
var
|
|
455
|
+
var _controls_id;
|
|
355
456
|
permissionItem = {
|
|
356
457
|
controlId: item.key,
|
|
357
458
|
caption: item.caption,
|
|
358
459
|
type: controls.type,
|
|
359
460
|
controlType: controls.controlType,
|
|
360
|
-
parentId: (
|
|
461
|
+
parentId: (_controls_id = controls.id) !== null && _controls_id !== void 0 ? _controls_id : null,
|
|
361
462
|
canEdit: true,
|
|
362
463
|
canRead: true,
|
|
363
464
|
canHide: true,
|
|
@@ -369,17 +470,17 @@ function generatePermissions(controls, parent) {
|
|
|
369
470
|
} else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
370
471
|
// 列表的操作列单独处理
|
|
371
472
|
Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
|
|
372
|
-
var _param = _slicedToArray(param, 2), key = _param[0],
|
|
473
|
+
var _param = _slicedToArray(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
|
|
373
474
|
var operationItem = controls.props[key];
|
|
374
475
|
if (operationItem && operationItem.isShow) {
|
|
375
|
-
var
|
|
476
|
+
var _parent_controlId;
|
|
376
477
|
// 只能控制是否显示
|
|
377
478
|
result.push({
|
|
378
479
|
controlId: controlId,
|
|
379
480
|
caption: caption,
|
|
380
481
|
type: controls.type,
|
|
381
482
|
controlType: controls.controlType,
|
|
382
|
-
parentId: (
|
|
483
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
383
484
|
canEdit: false,
|
|
384
485
|
canRead: false,
|
|
385
486
|
canHide: true,
|