@byteluck-fe/model-driven-driven 1.8.1-beta.4 → 2.0.1
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 +12 -103
- 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 +3 -2
- package/dist/esm/utils.js +39 -140
- 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 +6 -6
package/dist/esm/Designer.js
CHANGED
|
@@ -130,101 +130,7 @@ function _createSuper(Derived) {
|
|
|
130
130
|
return _possibleConstructorReturn(this, result);
|
|
131
131
|
};
|
|
132
132
|
}
|
|
133
|
-
|
|
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
|
-
};
|
|
133
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
228
134
|
import { RegisterControls, controlHooksEmitter } from "@byteluck-fe/model-driven-core";
|
|
229
135
|
import EventLogic from "./EventLogic";
|
|
230
136
|
import { FieldTypes } from "@byteluck-fe/model-driven-shared";
|
|
@@ -288,14 +194,17 @@ var Designer = /*#__PURE__*/ function _target(RegisterControls) {
|
|
|
288
194
|
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
289
195
|
args[_key] = arguments[_key];
|
|
290
196
|
}
|
|
291
|
-
return _asyncToGenerator(function() {
|
|
292
|
-
return
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
197
|
+
return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
|
|
198
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
199
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
200
|
+
case 0:
|
|
201
|
+
return _ctx.abrupt("return", checkSchema.apply(void 0, _toConsumableArray(args)));
|
|
202
|
+
case 1:
|
|
203
|
+
case "end":
|
|
204
|
+
return _ctx.stop();
|
|
205
|
+
}
|
|
206
|
+
}, _callee);
|
|
207
|
+
}))();
|
|
299
208
|
};
|
|
300
209
|
_proto.getModelBindInfoList = function getModelBindInfoList1() {
|
|
301
210
|
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 _$options = _this.$options, _autoMount = _$options.autoMount, autoMount = _autoMount === void 0 ? false : _autoMount, tmp = _$options.Designer, DesignerClass = tmp === void 0 ? Designer : tmp, schema = _$options.schema, _mode = _$options.mode, mode = _mode === void 0 ? "form" : _mode, tmp1 = _$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 _$options = this.$options, _plugins = _$options.plugins, plugins = _plugins === void 0 ? [] : _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 _pluginName;
|
|
249
|
+
applyingPluginName = (_pluginName = plugin.pluginName) !== null && _pluginName !== void 0 ? _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 ref, ref1, ref2, ref3;
|
|
311
311
|
var result = settings;
|
|
312
312
|
// tab
|
|
313
|
-
if (((
|
|
313
|
+
if (((ref = settings[0]) === null || ref === void 0 ? void 0 : ref.type) === "tab" && ((ref1 = otherSettings[0]) === null || ref1 === void 0 ? void 0 : ref1.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 (((ref2 = settings[0]) === null || ref2 === void 0 ? void 0 : ref2.type) === "group" && ((ref3 = otherSettings[0]) === null || ref3 === void 0 ? void 0 : ref3.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 _designer;
|
|
363
|
+
return (_designer = this.designer).registerControlConfig.apply(_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 ref;
|
|
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 !== ((ref = this.store.selected) === null || ref === void 0 ? void 0 : ref.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 ref;
|
|
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 === ((ref = this.store.selected) === null || ref === void 0 ? void 0 : ref.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 _designer;
|
|
567
|
+
(_designer = this.designer).registerControl.apply(_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 _getParentBeforeInstanceMove;
|
|
115
|
+
this.getParentBeforeInstanceMove = (_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _getParentBeforeInstanceMove !== void 0 ? _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 _selectedInstanceSettingItems;
|
|
137
|
+
(_selectedInstanceSettingItems = _this.selectedInstanceSettingItems).push.apply(_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 _value = _slicedToArray(_step.value, 2), key = _value[0], value = _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,8 +22,9 @@ export function loopFormControl(control, callback) {
|
|
|
22
22
|
// @ts-ignore
|
|
23
23
|
loopFormControl(item.props.headers, callback);
|
|
24
24
|
} else if (hasChildrenControl(item)) {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var // @ts-ignore
|
|
26
|
+
ref;
|
|
27
|
+
loopFormControl((ref = (item)) === null || ref === void 0 ? void 0 : ref.children, callback);
|
|
27
28
|
// @ts-ignore
|
|
28
29
|
} else if (_instanceof(item, DesignerFormControl)) {
|
|
29
30
|
callback(item);
|
package/dist/esm/utils.js
CHANGED
|
@@ -92,101 +92,7 @@ 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
|
-
|
|
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
|
-
};
|
|
95
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
190
96
|
import { loopFormControl } from "./designerUtils";
|
|
191
97
|
import { DesignerColumnControl, DesignerListControl, DesignerFormControl } from "@byteluck-fe/model-driven-core";
|
|
192
98
|
import { CONTROL_TYPE, FieldTypeToColumnType, isArray } from "@byteluck-fe/model-driven-shared";
|
|
@@ -327,42 +233,35 @@ function checkSchema(controls, messages, ignore) {
|
|
|
327
233
|
return _checkSchema.apply(this, arguments);
|
|
328
234
|
}
|
|
329
235
|
function _checkSchema() {
|
|
330
|
-
_checkSchema = _asyncToGenerator(function(controls, messages, ignore) {
|
|
236
|
+
_checkSchema = _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee(controls, messages, ignore) {
|
|
331
237
|
var result;
|
|
332
|
-
return
|
|
333
|
-
switch(
|
|
238
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
239
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
334
240
|
case 0:
|
|
335
|
-
if (!Array.isArray(controls))
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
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
|
-
];
|
|
241
|
+
if (!Array.isArray(controls)) {
|
|
242
|
+
_ctx.next = 5;
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
_ctx.next = 3;
|
|
246
|
+
return Promise.all(controls.map(function(control) {
|
|
247
|
+
return control.validate(messages, ignore);
|
|
248
|
+
}));
|
|
358
249
|
case 3:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
250
|
+
result = _ctx.sent;
|
|
251
|
+
return _ctx.abrupt("return", result.every(function(state) {
|
|
252
|
+
return state;
|
|
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();
|
|
363
262
|
}
|
|
364
|
-
});
|
|
365
|
-
});
|
|
263
|
+
}, _callee);
|
|
264
|
+
}));
|
|
366
265
|
return _checkSchema.apply(this, arguments);
|
|
367
266
|
}
|
|
368
267
|
// 不可以被权限控制的控件
|
|
@@ -384,7 +283,7 @@ var PermissionExcludeControlTypes = [
|
|
|
384
283
|
// 暂时不能控制权限
|
|
385
284
|
CONTROL_TYPE.TAB_PANE,
|
|
386
285
|
CONTROL_TYPE.TAB,
|
|
387
|
-
CONTROL_TYPE.CARD_GROUP
|
|
286
|
+
CONTROL_TYPE.CARD_GROUP,
|
|
388
287
|
];
|
|
389
288
|
// 不可以编辑的控件
|
|
390
289
|
var cannotEditControlTypes = [
|
|
@@ -415,16 +314,16 @@ function generatePermissions(controls, parent) {
|
|
|
415
314
|
}).flat()));
|
|
416
315
|
} else {
|
|
417
316
|
var type = controls.type;
|
|
418
|
-
var
|
|
317
|
+
var _props = controls.props, caption = _props.caption, content = _props.content;
|
|
419
318
|
var permissionItem;
|
|
420
319
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
421
|
-
var
|
|
320
|
+
var ref;
|
|
422
321
|
permissionItem = {
|
|
423
322
|
controlId: controls.id,
|
|
424
323
|
caption: caption || content || controls.name,
|
|
425
324
|
type: controls.type,
|
|
426
325
|
controlType: controls.controlType,
|
|
427
|
-
parentId: (
|
|
326
|
+
parentId: (ref = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && ref !== void 0 ? ref : null,
|
|
428
327
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
429
328
|
canRead: true,
|
|
430
329
|
canHide: true,
|
|
@@ -438,28 +337,28 @@ function generatePermissions(controls, parent) {
|
|
|
438
337
|
permissionItem.caption = controls.props.controlExportName || controls.name;
|
|
439
338
|
}
|
|
440
339
|
if (_instanceof(controls, DesignerFormControl) || _instanceof(controls, DesignerColumnControl)) {
|
|
441
|
-
var
|
|
442
|
-
if (((
|
|
340
|
+
var ref1, ref2, ref3, ref4;
|
|
341
|
+
if (((ref1 = controls.props) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.dataBind) === null || ref2 === void 0 ? void 0 : ref2.fieldCode) !== undefined && ((ref3 = controls.props) === null || ref3 === void 0 ? void 0 : (ref4 = ref3.dataBind) === null || ref4 === void 0 ? void 0 : ref4.fieldCode) !== "") {
|
|
443
342
|
permissionItem.group = "field";
|
|
444
343
|
}
|
|
445
344
|
}
|
|
446
345
|
result.push(permissionItem);
|
|
447
346
|
//追加vue容器权限
|
|
448
347
|
if (type === CONTROL_TYPE.VUE_FORM_ITEM) {
|
|
449
|
-
var
|
|
348
|
+
var ref5, ref6, ref7, ref8;
|
|
450
349
|
var vueFormItemGroup = "element";
|
|
451
|
-
if (((
|
|
350
|
+
if (((ref5 = controls.props) === null || ref5 === void 0 ? void 0 : (ref6 = ref5.dataBind) === null || ref6 === void 0 ? void 0 : ref6.fieldCode) !== undefined && ((ref7 = controls.props) === null || ref7 === void 0 ? void 0 : (ref8 = ref7.dataBind) === null || ref8 === void 0 ? void 0 : ref8.fieldCode) !== "") {
|
|
452
351
|
vueFormItemGroup = "field";
|
|
453
352
|
}
|
|
454
353
|
var permissions = controls.props["permissions"];
|
|
455
354
|
permissions === null || permissions === void 0 ? void 0 : permissions.map(function(item) {
|
|
456
|
-
var
|
|
355
|
+
var _id;
|
|
457
356
|
permissionItem = {
|
|
458
357
|
controlId: item.key,
|
|
459
358
|
caption: item.caption,
|
|
460
359
|
type: controls.type,
|
|
461
360
|
controlType: controls.controlType,
|
|
462
|
-
parentId: (
|
|
361
|
+
parentId: (_id = controls.id) !== null && _id !== void 0 ? _id : null,
|
|
463
362
|
canEdit: true,
|
|
464
363
|
canRead: true,
|
|
465
364
|
canHide: true,
|
|
@@ -471,17 +370,17 @@ function generatePermissions(controls, parent) {
|
|
|
471
370
|
} else if (type === CONTROL_TYPE.OPERATION_COLUMN) {
|
|
472
371
|
// 列表的操作列单独处理
|
|
473
372
|
Object.entries(LIST_OPERATION_BUTTON_PERMISSIONS_MAPS).reduce(function(result, param) {
|
|
474
|
-
var _param = _slicedToArray(param, 2), key = _param[0],
|
|
373
|
+
var _param = _slicedToArray(param, 2), key = _param[0], ref = _param[1], caption = ref.caption, controlId = ref.id;
|
|
475
374
|
var operationItem = controls.props[key];
|
|
476
375
|
if (operationItem && operationItem.isShow) {
|
|
477
|
-
var
|
|
376
|
+
var ref1;
|
|
478
377
|
// 只能控制是否显示
|
|
479
378
|
result.push({
|
|
480
379
|
controlId: controlId,
|
|
481
380
|
caption: caption,
|
|
482
381
|
type: controls.type,
|
|
483
382
|
controlType: controls.controlType,
|
|
484
|
-
parentId: (
|
|
383
|
+
parentId: (ref1 = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && ref1 !== void 0 ? ref1 : null,
|
|
485
384
|
canEdit: false,
|
|
486
385
|
canRead: false,
|
|
487
386
|
canHide: true,
|