@byteluck-fe/model-driven-driven 2.0.1 → 2.0.7-beta.0
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 +15 -15
- 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 +140 -39
- package/dist/index.umd.js +3 -3
- package/dist/types/Driven.d.ts +2 -2
- package/dist/types/Store.d.ts +1 -1
- package/package.json +3 -3
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
|
@@ -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;
|
|
@@ -266,7 +266,7 @@ export function isDataScopeInstance(instance) {
|
|
|
266
266
|
return [
|
|
267
267
|
CONTROL_TYPE.SUBTABLE,
|
|
268
268
|
CONTROL_TYPE.DATA_VIEW,
|
|
269
|
-
CONTROL_TYPE.LIST_VIEW
|
|
269
|
+
CONTROL_TYPE.LIST_VIEW
|
|
270
270
|
].includes(instance.type);
|
|
271
271
|
}
|
|
272
272
|
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: {
|
|
@@ -22,9 +22,8 @@ export function loopFormControl(control, callback) {
|
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
loopFormControl(item.props.headers, callback);
|
|
24
24
|
} else if (hasChildrenControl(item)) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
25
|
+
loopFormControl(// @ts-ignore
|
|
26
|
+
item === null || item === void 0 ? void 0 : item.children, callback);
|
|
28
27
|
// @ts-ignore
|
|
29
28
|
} else if (_instanceof(item, DesignerFormControl)) {
|
|
30
29
|
callback(item);
|
package/dist/esm/utils.js
CHANGED
|
@@ -92,7 +92,101 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
92
92
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
93
93
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
94
94
|
}
|
|
95
|
-
|
|
95
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
96
|
+
var f, y, t, g, _ = {
|
|
97
|
+
label: 0,
|
|
98
|
+
sent: function() {
|
|
99
|
+
if (t[0] & 1) throw t[1];
|
|
100
|
+
return t[1];
|
|
101
|
+
},
|
|
102
|
+
trys: [],
|
|
103
|
+
ops: []
|
|
104
|
+
};
|
|
105
|
+
return g = {
|
|
106
|
+
next: verb(0),
|
|
107
|
+
"throw": verb(1),
|
|
108
|
+
"return": verb(2)
|
|
109
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
110
|
+
return this;
|
|
111
|
+
}), g;
|
|
112
|
+
function verb(n) {
|
|
113
|
+
return function(v) {
|
|
114
|
+
return step([
|
|
115
|
+
n,
|
|
116
|
+
v
|
|
117
|
+
]);
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function step(op) {
|
|
121
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
122
|
+
while(_)try {
|
|
123
|
+
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;
|
|
124
|
+
if (y = 0, t) op = [
|
|
125
|
+
op[0] & 2,
|
|
126
|
+
t.value
|
|
127
|
+
];
|
|
128
|
+
switch(op[0]){
|
|
129
|
+
case 0:
|
|
130
|
+
case 1:
|
|
131
|
+
t = op;
|
|
132
|
+
break;
|
|
133
|
+
case 4:
|
|
134
|
+
_.label++;
|
|
135
|
+
return {
|
|
136
|
+
value: op[1],
|
|
137
|
+
done: false
|
|
138
|
+
};
|
|
139
|
+
case 5:
|
|
140
|
+
_.label++;
|
|
141
|
+
y = op[1];
|
|
142
|
+
op = [
|
|
143
|
+
0
|
|
144
|
+
];
|
|
145
|
+
continue;
|
|
146
|
+
case 7:
|
|
147
|
+
op = _.ops.pop();
|
|
148
|
+
_.trys.pop();
|
|
149
|
+
continue;
|
|
150
|
+
default:
|
|
151
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
152
|
+
_ = 0;
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
156
|
+
_.label = op[1];
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
160
|
+
_.label = t[1];
|
|
161
|
+
t = op;
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
if (t && _.label < t[2]) {
|
|
165
|
+
_.label = t[2];
|
|
166
|
+
_.ops.push(op);
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
if (t[2]) _.ops.pop();
|
|
170
|
+
_.trys.pop();
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
op = body.call(thisArg, _);
|
|
174
|
+
} catch (e) {
|
|
175
|
+
op = [
|
|
176
|
+
6,
|
|
177
|
+
e
|
|
178
|
+
];
|
|
179
|
+
y = 0;
|
|
180
|
+
} finally{
|
|
181
|
+
f = t = 0;
|
|
182
|
+
}
|
|
183
|
+
if (op[0] & 5) throw op[1];
|
|
184
|
+
return {
|
|
185
|
+
value: op[0] ? op[1] : void 0,
|
|
186
|
+
done: true
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
};
|
|
96
190
|
import { loopFormControl } from "./designerUtils";
|
|
97
191
|
import { DesignerColumnControl, DesignerListControl, DesignerFormControl } from "@byteluck-fe/model-driven-core";
|
|
98
192
|
import { CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
|
|
@@ -233,35 +327,42 @@ function checkSchema(controls, messages, ignore) {
|
|
|
233
327
|
return _checkSchema.apply(this, arguments);
|
|
234
328
|
}
|
|
235
329
|
function _checkSchema() {
|
|
236
|
-
_checkSchema = _asyncToGenerator(
|
|
330
|
+
_checkSchema = _asyncToGenerator(function(controls, messages, ignore) {
|
|
237
331
|
var result;
|
|
238
|
-
return
|
|
239
|
-
|
|
332
|
+
return __generator(this, function(_state) {
|
|
333
|
+
switch(_state.label){
|
|
240
334
|
case 0:
|
|
241
|
-
if (!Array.isArray(controls))
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
335
|
+
if (!Array.isArray(controls)) return [
|
|
336
|
+
3,
|
|
337
|
+
2
|
|
338
|
+
];
|
|
339
|
+
return [
|
|
340
|
+
4,
|
|
341
|
+
Promise.all(controls.map(function(control) {
|
|
342
|
+
return control.validate(messages, ignore);
|
|
343
|
+
}))
|
|
344
|
+
];
|
|
345
|
+
case 1:
|
|
346
|
+
result = _state.sent();
|
|
347
|
+
return [
|
|
348
|
+
2,
|
|
349
|
+
result.every(function(state) {
|
|
350
|
+
return state;
|
|
351
|
+
})
|
|
352
|
+
];
|
|
353
|
+
case 2:
|
|
354
|
+
return [
|
|
355
|
+
4,
|
|
356
|
+
controls.validate(messages, ignore)
|
|
357
|
+
];
|
|
249
358
|
case 3:
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
case 5:
|
|
255
|
-
_ctx.next = 7;
|
|
256
|
-
return controls.validate(messages, ignore);
|
|
257
|
-
case 7:
|
|
258
|
-
return _ctx.abrupt("return", _ctx.sent);
|
|
259
|
-
case 8:
|
|
260
|
-
case "end":
|
|
261
|
-
return _ctx.stop();
|
|
359
|
+
return [
|
|
360
|
+
2,
|
|
361
|
+
_state.sent()
|
|
362
|
+
];
|
|
262
363
|
}
|
|
263
|
-
}
|
|
264
|
-
})
|
|
364
|
+
});
|
|
365
|
+
});
|
|
265
366
|
return _checkSchema.apply(this, arguments);
|
|
266
367
|
}
|
|
267
368
|
// 不可以被权限控制的控件
|
|
@@ -283,7 +384,7 @@ var PermissionExcludeControlTypes = [
|
|
|
283
384
|
// 暂时不能控制权限
|
|
284
385
|
CONTROL_TYPE.TAB_PANE,
|
|
285
386
|
CONTROL_TYPE.TAB,
|
|
286
|
-
CONTROL_TYPE.CARD_GROUP
|
|
387
|
+
CONTROL_TYPE.CARD_GROUP
|
|
287
388
|
];
|
|
288
389
|
// 不可以编辑的控件
|
|
289
390
|
var cannotEditControlTypes = [
|
|
@@ -314,16 +415,16 @@ function generatePermissions(controls, parent) {
|
|
|
314
415
|
}).flat()));
|
|
315
416
|
} else {
|
|
316
417
|
var type = controls.type;
|
|
317
|
-
var
|
|
418
|
+
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
|
|
318
419
|
var permissionItem;
|
|
319
420
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
320
|
-
var
|
|
421
|
+
var _parent_controlId;
|
|
321
422
|
permissionItem = {
|
|
322
423
|
controlId: controls.id,
|
|
323
424
|
caption: caption || content || controls.name,
|
|
324
425
|
type: controls.type,
|
|
325
426
|
controlType: controls.controlType,
|
|
326
|
-
parentId: (
|
|
427
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
327
428
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
328
429
|
canRead: true,
|
|
329
430
|
canHide: true,
|
|
@@ -337,28 +438,28 @@ function generatePermissions(controls, parent) {
|
|
|
337
438
|
permissionItem.caption = controls.props.controlExportName || controls.name;
|
|
338
439
|
}
|
|
339
440
|
if (_instanceof(controls, DesignerFormControl) || _instanceof(controls, DesignerColumnControl)) {
|
|
340
|
-
var
|
|
341
|
-
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) !== "") {
|
|
342
443
|
permissionItem.group = "field";
|
|
343
444
|
}
|
|
344
445
|
}
|
|
345
446
|
result.push(permissionItem);
|
|
346
447
|
//追加vue容器权限
|
|
347
448
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
348
|
-
var
|
|
449
|
+
var _controls_props3, _controls_props_dataBind2, _controls_props4, _controls_props_dataBind3;
|
|
349
450
|
var vueFormItemGroup = "element";
|
|
350
|
-
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) !== "") {
|
|
351
452
|
vueFormItemGroup = "field";
|
|
352
453
|
}
|
|
353
454
|
var permissions = controls.props["permissions"];
|
|
354
455
|
permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
|
|
355
|
-
var
|
|
456
|
+
var _controls_id;
|
|
356
457
|
permissionItem = {
|
|
357
458
|
controlId: item.key,
|
|
358
459
|
caption: item.caption,
|
|
359
460
|
type: controls.type,
|
|
360
461
|
controlType: controls.controlType,
|
|
361
|
-
parentId: (
|
|
462
|
+
parentId: (_controls_id = controls.id) !== null && _controls_id !== void 0 ? _controls_id : null,
|
|
362
463
|
canEdit: true,
|
|
363
464
|
canRead: true,
|
|
364
465
|
canHide: true,
|
|
@@ -370,17 +471,17 @@ function generatePermissions(controls, parent) {
|
|
|
370
471
|
} else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
371
472
|
// 列表的操作列单独处理
|
|
372
473
|
Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
|
|
373
|
-
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;
|
|
374
475
|
var operationItem = controls.props[key];
|
|
375
476
|
if (operationItem && operationItem.isShow) {
|
|
376
|
-
var
|
|
477
|
+
var _parent_controlId;
|
|
377
478
|
// 只能控制是否显示
|
|
378
479
|
result.push({
|
|
379
480
|
controlId: controlId,
|
|
380
481
|
caption: caption,
|
|
381
482
|
type: controls.type,
|
|
382
483
|
controlType: controls.controlType,
|
|
383
|
-
parentId: (
|
|
484
|
+
parentId: (_parent_controlId = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _parent_controlId !== void 0 ? _parent_controlId : null,
|
|
384
485
|
canEdit: false,
|
|
385
486
|
canRead: false,
|
|
386
487
|
canHide: true,
|