@byteluck-fe/model-driven-core 2.3.1-beta.8 → 2.4.1-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/common/BaseControl/designer.js +252 -213
- package/dist/esm/common/BaseControl/property.js +68 -51
- package/dist/esm/common/BaseControl/runtime.js +30 -9
- package/dist/esm/common/ColumnControl/designer.js +37 -23
- package/dist/esm/common/ColumnControl/property.js +86 -38
- package/dist/esm/common/ColumnControl/runtime.js +37 -23
- package/dist/esm/common/ControlArray.js +12 -12
- package/dist/esm/common/FormControl/designer.js +40 -25
- package/dist/esm/common/FormControl/property.js +119 -52
- package/dist/esm/common/FormControl/runtime.js +38 -23
- package/dist/esm/common/LayoutControl/designer.js +149 -115
- package/dist/esm/common/LayoutControl/property.js +22 -22
- package/dist/esm/common/LayoutControl/runtime.js +39 -24
- package/dist/esm/common/ListControl/designer.js +131 -106
- package/dist/esm/common/ListControl/property.js +37 -23
- package/dist/esm/common/ListControl/runtime.js +42 -27
- package/dist/esm/common/SearchViewControl/designer.js +37 -23
- package/dist/esm/common/SearchViewControl/property.js +36 -22
- package/dist/esm/common/SearchViewControl/runtime.js +37 -23
- package/dist/esm/common/WrapControl/designer.js +37 -23
- package/dist/esm/common/WrapControl/property.js +22 -22
- package/dist/esm/common/WrapControl/runtime.js +37 -23
- package/dist/esm/framework/RegisterControls.js +199 -130
- package/dist/esm/framework/index.js +513 -93
- package/dist/index.umd.js +1 -1
- package/dist/types/common/BaseControl/property.d.ts +14 -0
- package/dist/types/common/FormControl/property.d.ts +4 -0
- package/dist/types/framework/index.d.ts +205 -0
- package/package.json +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _array_without_holes(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _array_like_to_array(arr);
|
|
11
11
|
}
|
|
12
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
13
|
try {
|
|
@@ -23,7 +23,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
23
23
|
Promise.resolve(value).then(_next, _throw);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _async_to_generator(fn) {
|
|
27
27
|
return function() {
|
|
28
28
|
var self = this, args = arguments;
|
|
29
29
|
return new Promise(function(resolve, reject) {
|
|
@@ -38,7 +38,7 @@ function _asyncToGenerator(fn) {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _class_call_check(instance, Constructor) {
|
|
42
42
|
if (!(instance instanceof Constructor)) {
|
|
43
43
|
throw new TypeError("Cannot call a class as a function");
|
|
44
44
|
}
|
|
@@ -52,12 +52,12 @@ function _defineProperties(target, props) {
|
|
|
52
52
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function _create_class(Constructor, protoProps, staticProps) {
|
|
56
56
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
57
57
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
58
58
|
return Constructor;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function _define_property(obj, key, value) {
|
|
61
61
|
if (key in obj) {
|
|
62
62
|
Object.defineProperty(obj, key, {
|
|
63
63
|
value: value,
|
|
@@ -77,16 +77,16 @@ function _instanceof(left, right) {
|
|
|
77
77
|
return left instanceof right;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function _iterable_to_array(iter) {
|
|
81
81
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function _non_iterable_rest() {
|
|
84
84
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function _non_iterable_spread() {
|
|
87
87
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function _object_spread(target) {
|
|
90
90
|
for(var i = 1; i < arguments.length; i++){
|
|
91
91
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
92
92
|
var ownKeys = Object.keys(source);
|
|
@@ -96,26 +96,26 @@ function _objectSpread(target) {
|
|
|
96
96
|
}));
|
|
97
97
|
}
|
|
98
98
|
ownKeys.forEach(function(key) {
|
|
99
|
-
|
|
99
|
+
_define_property(target, key, source[key]);
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
return target;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
104
|
+
function _to_array(arr) {
|
|
105
|
+
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
107
|
+
function _to_consumable_array(arr) {
|
|
108
|
+
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
111
111
|
if (!o) return;
|
|
112
|
-
if (typeof o === "string") return
|
|
112
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
113
113
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
114
114
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
115
115
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
116
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
116
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
117
117
|
}
|
|
118
|
-
|
|
118
|
+
function _ts_generator(thisArg, body) {
|
|
119
119
|
var f, y, t, g, _ = {
|
|
120
120
|
label: 0,
|
|
121
121
|
sent: function() {
|
|
@@ -209,7 +209,7 @@ var __generator = this && this.__generator || function(thisArg, body) {
|
|
|
209
209
|
done: true
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
}
|
|
212
|
+
}
|
|
213
213
|
import Property from "./property";
|
|
214
214
|
import { genNonDuplicateId, JSONCopy, referenceError, updateValueFromKeys } from "@byteluck-fe/model-driven-shared";
|
|
215
215
|
import { createValidator } from "../Validator";
|
|
@@ -218,13 +218,21 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
218
218
|
"use strict";
|
|
219
219
|
function Control(props) {
|
|
220
220
|
var _this = this;
|
|
221
|
-
|
|
222
|
-
this
|
|
223
|
-
|
|
224
|
-
this
|
|
225
|
-
this
|
|
226
|
-
this
|
|
227
|
-
this
|
|
221
|
+
_class_call_check(this, Control);
|
|
222
|
+
_define_property(this, "id", void 0 // 唯一标识符
|
|
223
|
+
);
|
|
224
|
+
_define_property(this, "name", void 0);
|
|
225
|
+
_define_property(this, "icon", void 0);
|
|
226
|
+
_define_property(this, "type", void 0);
|
|
227
|
+
_define_property(this, "controlType", void 0);
|
|
228
|
+
_define_property(this, "props", void 0);
|
|
229
|
+
_define_property(this, "setting", []);
|
|
230
|
+
_define_property(this, "fieldType", void 0);
|
|
231
|
+
_define_property(this, "eventKeys", []);
|
|
232
|
+
_define_property(this, "customEvents", []);
|
|
233
|
+
_define_property(this, "parent", null);
|
|
234
|
+
_define_property(this, "updateSetting", updateSetting);
|
|
235
|
+
_define_property(this, "removeSetting", removeSetting);
|
|
228
236
|
this._callControlHooks("preInstance", props);
|
|
229
237
|
var _ref = _instanceof(this, Control) ? this.constructor : void 0, controlName = _ref.controlName, controlIcon = _ref.controlIcon, controlType = _ref.controlType, controlFieldType = _ref.controlFieldType, controlEventKeys = _ref.controlEventKeys, controlCustomEvents = _ref.controlCustomEvents, name = _ref.name, setting = _ref.setting;
|
|
230
238
|
if (!(controlName && controlIcon && controlType)) {
|
|
@@ -248,207 +256,238 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
248
256
|
_this._callControlHooks("postInstance", props);
|
|
249
257
|
});
|
|
250
258
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
return (_controlHooksEmitter = controlHooksEmitter).emit.apply(_controlHooksEmitter, [
|
|
259
|
-
key,
|
|
260
|
-
this
|
|
261
|
-
].concat(_toConsumableArray(arg)));
|
|
262
|
-
};
|
|
263
|
-
_proto.preUpdate = function preUpdate(key, value) {
|
|
264
|
-
// 在修改props之前
|
|
265
|
-
this._callControlHooks("preUpdateProps", key, value);
|
|
266
|
-
};
|
|
267
|
-
_proto.postUpdate = function postUpdate(key, value) {
|
|
268
|
-
// 在修改props之后
|
|
269
|
-
this._callControlHooks("postUpdateProps", key, value);
|
|
270
|
-
};
|
|
271
|
-
// 修改实例上的props,key可以是caption,caption.zh...
|
|
272
|
-
_proto.updateProps = function updateProps(key, value) {
|
|
273
|
-
this.preUpdate(key, value);
|
|
274
|
-
updateValueFromKeys(this.props, key, value);
|
|
275
|
-
this.postUpdate(key, value);
|
|
276
|
-
};
|
|
277
|
-
_proto.preValidate = function preValidate() {
|
|
278
|
-
var _this = this;
|
|
279
|
-
return _asyncToGenerator(function() {
|
|
280
|
-
var rules, results, result;
|
|
281
|
-
return __generator(this, function(_state) {
|
|
282
|
-
switch(_state.label){
|
|
283
|
-
case 0:
|
|
284
|
-
rules = _objectSpread({}, _this.rules);
|
|
285
|
-
return [
|
|
286
|
-
4,
|
|
287
|
-
_this._callControlHooks("preValidate", rules)
|
|
288
|
-
];
|
|
289
|
-
case 1:
|
|
290
|
-
results = _state.sent();
|
|
291
|
-
result = results[results.length - 1];
|
|
292
|
-
return [
|
|
293
|
-
2,
|
|
294
|
-
result === false ? undefined : result
|
|
295
|
-
];
|
|
259
|
+
_create_class(Control, [
|
|
260
|
+
{
|
|
261
|
+
key: "rules",
|
|
262
|
+
get: function get() {
|
|
263
|
+
var Rules = this.props.constructor.Rules;
|
|
264
|
+
if (Rules) {
|
|
265
|
+
return new Rules(this.props);
|
|
296
266
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
267
|
+
return {};
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
key: "_callControlHooks",
|
|
272
|
+
value: function _callControlHooks() {
|
|
273
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
274
|
+
args[_key] = arguments[_key];
|
|
275
|
+
}
|
|
276
|
+
var _controlHooksEmitter;
|
|
277
|
+
var _args = _to_array(args), key = _args[0], arg = _args.slice(1);
|
|
278
|
+
return (_controlHooksEmitter = controlHooksEmitter).emit.apply(_controlHooksEmitter, [
|
|
279
|
+
key,
|
|
280
|
+
this
|
|
281
|
+
].concat(_to_consumable_array(arg)));
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
key: "preUpdate",
|
|
286
|
+
value: function preUpdate(key, value) {
|
|
287
|
+
// 在修改props之前
|
|
288
|
+
this._callControlHooks("preUpdateProps", key, value);
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
key: "postUpdate",
|
|
293
|
+
value: function postUpdate(key, value) {
|
|
294
|
+
// 在修改props之后
|
|
295
|
+
this._callControlHooks("postUpdateProps", key, value);
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
key: "updateProps",
|
|
300
|
+
value: // 修改实例上的props,key可以是caption,caption.zh...
|
|
301
|
+
function updateProps(key, value) {
|
|
302
|
+
this.preUpdate(key, value);
|
|
303
|
+
updateValueFromKeys(this.props, key, value);
|
|
304
|
+
this.postUpdate(key, value);
|
|
305
|
+
}
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
key: "preValidate",
|
|
309
|
+
value: function preValidate() {
|
|
310
|
+
var _this = this;
|
|
311
|
+
return _async_to_generator(function() {
|
|
312
|
+
var rules, results, result;
|
|
313
|
+
return _ts_generator(this, function(_state) {
|
|
314
|
+
switch(_state.label){
|
|
315
|
+
case 0:
|
|
316
|
+
rules = _object_spread({}, _this.rules);
|
|
317
|
+
return [
|
|
318
|
+
4,
|
|
319
|
+
_this._callControlHooks("preValidate", rules)
|
|
320
|
+
];
|
|
321
|
+
case 1:
|
|
322
|
+
results = _state.sent();
|
|
323
|
+
result = results[results.length - 1];
|
|
324
|
+
return [
|
|
325
|
+
2,
|
|
326
|
+
result === false ? undefined : result
|
|
327
|
+
];
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
})();
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
{
|
|
334
|
+
key: "validate",
|
|
335
|
+
value: // property校验
|
|
336
|
+
function validate(messages, ignore) {
|
|
337
|
+
var _this = this;
|
|
338
|
+
return _async_to_generator(function() {
|
|
339
|
+
var result, rules, validator, err;
|
|
340
|
+
return _ts_generator(this, function(_state) {
|
|
341
|
+
switch(_state.label){
|
|
342
|
+
case 0:
|
|
343
|
+
return [
|
|
344
|
+
4,
|
|
345
|
+
_this.preValidate()
|
|
346
|
+
];
|
|
347
|
+
case 1:
|
|
348
|
+
result = _state.sent();
|
|
349
|
+
rules = result !== undefined ? result : _object_spread({}, _this.rules);
|
|
350
|
+
if (Array.isArray(ignore)) {
|
|
351
|
+
ignore.forEach(function(key) {
|
|
352
|
+
if (rules.hasOwnProperty(key)) {
|
|
353
|
+
delete rules[key];
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
validator = createValidator(rules, messages);
|
|
358
|
+
_state.label = 2;
|
|
359
|
+
case 2:
|
|
360
|
+
_state.trys.push([
|
|
361
|
+
2,
|
|
362
|
+
4,
|
|
363
|
+
,
|
|
364
|
+
5
|
|
365
|
+
]);
|
|
366
|
+
return [
|
|
367
|
+
4,
|
|
368
|
+
validator.validate(_this.props)
|
|
369
|
+
];
|
|
370
|
+
case 3:
|
|
371
|
+
_state.sent();
|
|
372
|
+
return [
|
|
373
|
+
2,
|
|
374
|
+
true
|
|
375
|
+
];
|
|
376
|
+
case 4:
|
|
377
|
+
err = _state.sent();
|
|
378
|
+
if (!err.control) {
|
|
379
|
+
err.control = _this;
|
|
319
380
|
}
|
|
320
|
-
|
|
381
|
+
throw err;
|
|
382
|
+
case 5:
|
|
383
|
+
return [
|
|
384
|
+
2
|
|
385
|
+
];
|
|
321
386
|
}
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
387
|
+
});
|
|
388
|
+
})();
|
|
389
|
+
}
|
|
390
|
+
},
|
|
391
|
+
{
|
|
392
|
+
key: "toDataBindModel",
|
|
393
|
+
value: function toDataBindModel() {
|
|
394
|
+
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
395
|
+
var fieldType = this.fieldType;
|
|
396
|
+
var controlId = this.id;
|
|
397
|
+
var type = this.type;
|
|
398
|
+
var _this_props = this.props, dataBind = _this_props.dataBind, datasourceBind = _this_props.datasourceBind, optionConfig = _this_props.optionConfig, caption = _this_props.caption, required = _this_props.required, maxLength = _this_props.maxLength, options = _this_props.options, encrypted = _this_props.encrypted, encryptedMode = _this_props.encryptedMode;
|
|
399
|
+
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
400
|
+
var dataBindModelType = {
|
|
401
|
+
parentId: parentId,
|
|
402
|
+
fieldType: fieldType,
|
|
403
|
+
controlId: controlId,
|
|
404
|
+
caption: caption,
|
|
405
|
+
type: type,
|
|
406
|
+
props: {}
|
|
407
|
+
};
|
|
408
|
+
if (dataBind) {
|
|
409
|
+
dataBindModelType.dataBind = dataBind;
|
|
410
|
+
}
|
|
411
|
+
switch(optionConfig){
|
|
412
|
+
case "datasource":
|
|
413
|
+
case undefined:
|
|
414
|
+
if (datasourceBind) {
|
|
415
|
+
dataBindModelType.datasourceBind = datasourceBind;
|
|
345
416
|
}
|
|
346
|
-
|
|
347
|
-
case
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
];
|
|
417
|
+
break;
|
|
418
|
+
case "custom":
|
|
419
|
+
dataBindModelType.props.options = options;
|
|
420
|
+
break;
|
|
351
421
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
};
|
|
355
|
-
_proto.toDataBindModel = function toDataBindModel() {
|
|
356
|
-
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
357
|
-
var fieldType = this.fieldType;
|
|
358
|
-
var controlId = this.id;
|
|
359
|
-
var type = this.type;
|
|
360
|
-
var _this_props = this.props, dataBind = _this_props.dataBind, datasourceBind = _this_props.datasourceBind, optionConfig = _this_props.optionConfig, caption = _this_props.caption, required = _this_props.required, maxLength = _this_props.maxLength, options = _this_props.options, encrypted = _this_props.encrypted, encryptedMode = _this_props.encryptedMode;
|
|
361
|
-
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
362
|
-
var dataBindModelType = {
|
|
363
|
-
parentId: parentId,
|
|
364
|
-
fieldType: fieldType,
|
|
365
|
-
controlId: controlId,
|
|
366
|
-
caption: caption,
|
|
367
|
-
type: type,
|
|
368
|
-
props: {}
|
|
369
|
-
};
|
|
370
|
-
if (dataBind) {
|
|
371
|
-
dataBindModelType.dataBind = dataBind;
|
|
372
|
-
}
|
|
373
|
-
switch(optionConfig){
|
|
374
|
-
case "datasource":
|
|
375
|
-
case undefined:
|
|
376
|
-
if (datasourceBind) {
|
|
377
|
-
dataBindModelType.datasourceBind = datasourceBind;
|
|
422
|
+
if (required !== undefined) {
|
|
423
|
+
dataBindModelType.required = required;
|
|
378
424
|
}
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
};
|
|
411
|
-
};
|
|
412
|
-
Control.updateBasicControl = function updateBasicControl(key, setting) {
|
|
413
|
-
if (key !== "setting") return;
|
|
414
|
-
if (setting.add) {
|
|
415
|
-
var _this_setting;
|
|
416
|
-
(_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(setting.add));
|
|
417
|
-
}
|
|
418
|
-
if (setting.remove) {
|
|
419
|
-
this.removeSettingItem(setting.remove);
|
|
420
|
-
}
|
|
421
|
-
if (setting.update) {
|
|
422
|
-
// this.updateSettingItem(setting.update, false)
|
|
425
|
+
if (maxLength !== undefined) {
|
|
426
|
+
dataBindModelType.maxLength = maxLength;
|
|
427
|
+
}
|
|
428
|
+
if (encrypted !== undefined) {
|
|
429
|
+
dataBindModelType.encrypted = encrypted;
|
|
430
|
+
}
|
|
431
|
+
if (encryptedMode !== undefined) {
|
|
432
|
+
dataBindModelType.encryptedMode = encryptedMode;
|
|
433
|
+
}
|
|
434
|
+
return dataBindModelType;
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
key: "preToSchema",
|
|
439
|
+
value: function preToSchema() {
|
|
440
|
+
// 在处理Schema之前,预留的钩子函数,允许在toSchema之前处理一些数据
|
|
441
|
+
this._callControlHooks("preToSchema", this);
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
key: "toSchema",
|
|
446
|
+
value: function toSchema() {
|
|
447
|
+
this.preToSchema();
|
|
448
|
+
return {
|
|
449
|
+
id: this.id,
|
|
450
|
+
type: this.type,
|
|
451
|
+
props: JSONCopy(this.props),
|
|
452
|
+
fieldType: this.fieldType,
|
|
453
|
+
controlType: this.controlType
|
|
454
|
+
};
|
|
455
|
+
}
|
|
423
456
|
}
|
|
424
|
-
|
|
425
|
-
_createClass(Control, [
|
|
457
|
+
], [
|
|
426
458
|
{
|
|
427
|
-
key: "
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
if (
|
|
431
|
-
|
|
459
|
+
key: "updateBasicControl",
|
|
460
|
+
value: function updateBasicControl(key, setting) {
|
|
461
|
+
if (key !== "setting") return;
|
|
462
|
+
if (setting.add) {
|
|
463
|
+
var _this_setting;
|
|
464
|
+
(_this_setting = this.setting).push.apply(_this_setting, _to_consumable_array(setting.add));
|
|
465
|
+
}
|
|
466
|
+
if (setting.remove) {
|
|
467
|
+
this.removeSettingItem(setting.remove);
|
|
468
|
+
}
|
|
469
|
+
if (setting.update) {
|
|
470
|
+
// this.updateSettingItem(setting.update, false)
|
|
432
471
|
}
|
|
433
|
-
return {};
|
|
434
472
|
}
|
|
435
473
|
}
|
|
436
474
|
]);
|
|
437
475
|
return Control;
|
|
438
476
|
}();
|
|
439
|
-
Control
|
|
440
|
-
Control
|
|
441
|
-
Control
|
|
477
|
+
_define_property(Control, "controlName", "控件");
|
|
478
|
+
_define_property(Control, "controlIcon", "icon");
|
|
479
|
+
_define_property(Control, "controlType", "control");
|
|
480
|
+
_define_property(Control, "controlFieldType", void 0);
|
|
442
481
|
// 控件可以触发的事件key
|
|
443
|
-
Control
|
|
444
|
-
Control
|
|
482
|
+
_define_property(Control, "controlEventKeys", []);
|
|
483
|
+
_define_property(Control, "controlCustomEvents", []);
|
|
445
484
|
// setting应该是全量的设置项,外部控制,在初始化的时候会deepCopy一份
|
|
446
|
-
Control
|
|
447
|
-
Control
|
|
485
|
+
_define_property(Control, "setting", []);
|
|
486
|
+
_define_property(Control, "__is_control__", true);
|
|
448
487
|
// 删除指定的settingItem
|
|
449
|
-
Control
|
|
488
|
+
_define_property(Control, "removeSettingItem", removeSetting);
|
|
450
489
|
// 修改指定的settingItem的visible
|
|
451
|
-
Control
|
|
490
|
+
_define_property(Control, "updateSettingItem", updateSetting);
|
|
452
491
|
export default Control;
|
|
453
492
|
export { Control as DesignerControl };
|
|
454
493
|
/**
|
|
@@ -507,7 +546,7 @@ export { Control as DesignerControl };
|
|
|
507
546
|
settingItem.showItems = value.showItems;
|
|
508
547
|
} else {
|
|
509
548
|
var _settingItem_showItems;
|
|
510
|
-
(_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems,
|
|
549
|
+
(_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems, _to_consumable_array(value.showItems));
|
|
511
550
|
}
|
|
512
551
|
}
|
|
513
552
|
}
|