@byteluck-fe/model-driven-core 2.7.0-alpha.18 → 2.7.0-alpha.20
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/api-doc-index.js +4 -4
- package/dist/esm/common/BaseControl/designer.js +217 -98
- package/dist/esm/common/BaseControl/index.js +7 -7
- package/dist/esm/common/BaseControl/property.js +42 -14
- package/dist/esm/common/BaseControl/runtime.js +41 -20
- package/dist/esm/common/ColumnControl/designer.js +19 -5
- package/dist/esm/common/ColumnControl/index.js +6 -6
- package/dist/esm/common/ColumnControl/property.js +95 -47
- package/dist/esm/common/ColumnControl/runtime.js +19 -5
- package/dist/esm/common/ControlArray.js +8 -8
- package/dist/esm/common/FormControl/designer.js +25 -10
- package/dist/esm/common/FormControl/index.js +6 -6
- package/dist/esm/common/FormControl/property.js +152 -87
- package/dist/esm/common/FormControl/runtime.js +20 -5
- package/dist/esm/common/LayoutControl/designer.js +158 -30
- package/dist/esm/common/LayoutControl/index.js +6 -6
- package/dist/esm/common/LayoutControl/property.js +3 -3
- package/dist/esm/common/LayoutControl/runtime.js +22 -7
- package/dist/esm/common/ListControl/designer.js +153 -28
- package/dist/esm/common/ListControl/index.js +6 -6
- package/dist/esm/common/ListControl/property.js +21 -6
- package/dist/esm/common/ListControl/runtime.js +22 -7
- package/dist/esm/common/SearchViewControl/designer.js +19 -5
- package/dist/esm/common/SearchViewControl/index.js +6 -6
- package/dist/esm/common/SearchViewControl/property.js +18 -4
- package/dist/esm/common/SearchViewControl/runtime.js +19 -5
- package/dist/esm/common/Validator.js +5 -5
- package/dist/esm/common/WrapControl/designer.js +19 -5
- package/dist/esm/common/WrapControl/index.js +6 -6
- package/dist/esm/common/WrapControl/property.js +3 -3
- package/dist/esm/common/WrapControl/runtime.js +19 -5
- package/dist/esm/common/controlHooksEmitter.js +1 -1
- package/dist/esm/common/index.js +12 -12
- package/dist/esm/common/initLinkOperationRules.js +6 -6
- package/dist/esm/common/initOptionAndDataSourceRules.js +82 -82
- package/dist/esm/framework/RegisterControls.js +28 -17
- package/dist/esm/framework/index.js +769 -332
- package/dist/esm/index.js +4 -4
- package/dist/index.umd.js +1 -1
- package/dist/types/common/Validator.d.ts +1 -1
- package/dist/types/common/controlHooksEmitter.d.ts +1 -1
- package/dist/types/type.d.ts +23 -23
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export { default as BaseControlProperty } from
|
|
3
|
-
export { default as ColumnControlProperty } from
|
|
4
|
-
export { default as FormControlProperty } from
|
|
1
|
+
export * from "./framework/index";
|
|
2
|
+
export { default as BaseControlProperty } from "./common/BaseControl/property";
|
|
3
|
+
export { default as ColumnControlProperty } from "./common/ColumnControl/property";
|
|
4
|
+
export { default as FormControlProperty } from "./common/FormControl/property";
|
|
@@ -72,7 +72,7 @@ function _defineProperty(obj, key, value) {
|
|
|
72
72
|
}
|
|
73
73
|
function _instanceof(left, right) {
|
|
74
74
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
75
|
-
return right[Symbol.hasInstance](left);
|
|
75
|
+
return !!right[Symbol.hasInstance](left);
|
|
76
76
|
} else {
|
|
77
77
|
return left instanceof right;
|
|
78
78
|
}
|
|
@@ -102,7 +102,7 @@ function _objectSpread(target) {
|
|
|
102
102
|
return target;
|
|
103
103
|
}
|
|
104
104
|
function _toArray(arr) {
|
|
105
|
-
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr
|
|
105
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest();
|
|
106
106
|
}
|
|
107
107
|
function _toConsumableArray(arr) {
|
|
108
108
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
@@ -115,43 +115,145 @@ function _unsupportedIterableToArray(o, minLen) {
|
|
|
115
115
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
116
116
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
117
117
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
119
|
+
var f, y, t, g, _ = {
|
|
120
|
+
label: 0,
|
|
121
|
+
sent: function() {
|
|
122
|
+
if (t[0] & 1) throw t[1];
|
|
123
|
+
return t[1];
|
|
124
|
+
},
|
|
125
|
+
trys: [],
|
|
126
|
+
ops: []
|
|
127
|
+
};
|
|
128
|
+
return g = {
|
|
129
|
+
next: verb(0),
|
|
130
|
+
"throw": verb(1),
|
|
131
|
+
"return": verb(2)
|
|
132
|
+
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
133
|
+
return this;
|
|
134
|
+
}), g;
|
|
135
|
+
function verb(n) {
|
|
136
|
+
return function(v) {
|
|
137
|
+
return step([
|
|
138
|
+
n,
|
|
139
|
+
v
|
|
140
|
+
]);
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
function step(op) {
|
|
144
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
145
|
+
while(_)try {
|
|
146
|
+
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;
|
|
147
|
+
if (y = 0, t) op = [
|
|
148
|
+
op[0] & 2,
|
|
149
|
+
t.value
|
|
150
|
+
];
|
|
151
|
+
switch(op[0]){
|
|
152
|
+
case 0:
|
|
153
|
+
case 1:
|
|
154
|
+
t = op;
|
|
155
|
+
break;
|
|
156
|
+
case 4:
|
|
157
|
+
_.label++;
|
|
158
|
+
return {
|
|
159
|
+
value: op[1],
|
|
160
|
+
done: false
|
|
161
|
+
};
|
|
162
|
+
case 5:
|
|
163
|
+
_.label++;
|
|
164
|
+
y = op[1];
|
|
165
|
+
op = [
|
|
166
|
+
0
|
|
167
|
+
];
|
|
168
|
+
continue;
|
|
169
|
+
case 7:
|
|
170
|
+
op = _.ops.pop();
|
|
171
|
+
_.trys.pop();
|
|
172
|
+
continue;
|
|
173
|
+
default:
|
|
174
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
175
|
+
_ = 0;
|
|
176
|
+
continue;
|
|
177
|
+
}
|
|
178
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
179
|
+
_.label = op[1];
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
183
|
+
_.label = t[1];
|
|
184
|
+
t = op;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
if (t && _.label < t[2]) {
|
|
188
|
+
_.label = t[2];
|
|
189
|
+
_.ops.push(op);
|
|
190
|
+
break;
|
|
191
|
+
}
|
|
192
|
+
if (t[2]) _.ops.pop();
|
|
193
|
+
_.trys.pop();
|
|
194
|
+
continue;
|
|
195
|
+
}
|
|
196
|
+
op = body.call(thisArg, _);
|
|
197
|
+
} catch (e) {
|
|
198
|
+
op = [
|
|
199
|
+
6,
|
|
200
|
+
e
|
|
201
|
+
];
|
|
202
|
+
y = 0;
|
|
203
|
+
} finally{
|
|
204
|
+
f = t = 0;
|
|
205
|
+
}
|
|
206
|
+
if (op[0] & 5) throw op[1];
|
|
207
|
+
return {
|
|
208
|
+
value: op[0] ? op[1] : void 0,
|
|
209
|
+
done: true
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
import Property from "./property";
|
|
214
|
+
import { genNonDuplicateId, JSONCopy, referenceError, updateValueFromKeys } from "@byteluck-fe/model-driven-shared";
|
|
215
|
+
import { createValidator } from "../Validator";
|
|
216
|
+
import { controlHooksEmitter } from "../controlHooksEmitter";
|
|
123
217
|
var Control = /*#__PURE__*/ function _target() {
|
|
124
218
|
"use strict";
|
|
125
219
|
function Control(props) {
|
|
126
220
|
var _this = this;
|
|
127
221
|
_classCallCheck(this, Control);
|
|
128
|
-
this
|
|
129
|
-
|
|
130
|
-
this
|
|
131
|
-
this
|
|
132
|
-
this
|
|
133
|
-
this
|
|
134
|
-
this
|
|
135
|
-
|
|
222
|
+
_defineProperty(this, "id", void 0 // 唯一标识符
|
|
223
|
+
);
|
|
224
|
+
_defineProperty(this, "name", void 0);
|
|
225
|
+
_defineProperty(this, "icon", void 0);
|
|
226
|
+
_defineProperty(this, "type", void 0);
|
|
227
|
+
_defineProperty(this, "controlType", void 0);
|
|
228
|
+
_defineProperty(this, "props", void 0);
|
|
229
|
+
_defineProperty(this, "setting", []);
|
|
230
|
+
_defineProperty(this, "fieldType", void 0);
|
|
231
|
+
_defineProperty(this, "eventKeys", []);
|
|
232
|
+
_defineProperty(this, "customEvents", []);
|
|
233
|
+
_defineProperty(this, "parent", null);
|
|
234
|
+
_defineProperty(this, "updateSetting", updateSetting);
|
|
235
|
+
_defineProperty(this, "removeSetting", removeSetting);
|
|
236
|
+
this._callControlHooks("preInstance", props);
|
|
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;
|
|
136
238
|
if (!(controlName && controlIcon && controlType)) {
|
|
137
239
|
referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
|
|
138
240
|
}
|
|
139
|
-
var
|
|
140
|
-
this.id = (
|
|
241
|
+
var _props_id;
|
|
242
|
+
this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
|
|
141
243
|
this.name = controlName;
|
|
142
244
|
this.icon = controlIcon;
|
|
143
|
-
var
|
|
144
|
-
this.type = (
|
|
245
|
+
var _props_type;
|
|
246
|
+
this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : controlType;
|
|
145
247
|
this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
|
|
146
|
-
var
|
|
147
|
-
this.controlType = (
|
|
248
|
+
var _props_controlType;
|
|
249
|
+
this.controlType = (_props_controlType = props === null || props === void 0 ? void 0 : props.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
|
|
148
250
|
this.setting = JSONCopy(setting);
|
|
149
|
-
var
|
|
150
|
-
this.fieldType = (
|
|
251
|
+
var _props_fieldType;
|
|
252
|
+
this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
|
|
151
253
|
this.eventKeys = JSONCopy(controlEventKeys);
|
|
152
254
|
this.customEvents = JSONCopy(controlCustomEvents);
|
|
153
255
|
Promise.resolve().then(function() {
|
|
154
|
-
_this._callControlHooks(
|
|
256
|
+
_this._callControlHooks("postInstance", props);
|
|
155
257
|
});
|
|
156
258
|
}
|
|
157
259
|
_createClass(Control, [
|
|
@@ -183,14 +285,14 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
183
285
|
key: "preUpdate",
|
|
184
286
|
value: function preUpdate(key, value) {
|
|
185
287
|
// 在修改props之前
|
|
186
|
-
this._callControlHooks(
|
|
288
|
+
this._callControlHooks("preUpdateProps", key, value);
|
|
187
289
|
}
|
|
188
290
|
},
|
|
189
291
|
{
|
|
190
292
|
key: "postUpdate",
|
|
191
293
|
value: function postUpdate(key, value) {
|
|
192
294
|
// 在修改props之后
|
|
193
|
-
this._callControlHooks(
|
|
295
|
+
this._callControlHooks("postUpdateProps", key, value);
|
|
194
296
|
}
|
|
195
297
|
},
|
|
196
298
|
{
|
|
@@ -206,24 +308,26 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
206
308
|
key: "preValidate",
|
|
207
309
|
value: function preValidate() {
|
|
208
310
|
var _this = this;
|
|
209
|
-
return _asyncToGenerator(
|
|
311
|
+
return _asyncToGenerator(function() {
|
|
210
312
|
var rules, results, result;
|
|
211
|
-
return
|
|
212
|
-
|
|
313
|
+
return __generator(this, function(_state) {
|
|
314
|
+
switch(_state.label){
|
|
213
315
|
case 0:
|
|
214
316
|
rules = _objectSpread({}, _this.rules);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
317
|
+
return [
|
|
318
|
+
4,
|
|
319
|
+
_this._callControlHooks("preValidate", rules)
|
|
320
|
+
];
|
|
321
|
+
case 1:
|
|
322
|
+
results = _state.sent();
|
|
219
323
|
result = results[results.length - 1];
|
|
220
|
-
return
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
324
|
+
return [
|
|
325
|
+
2,
|
|
326
|
+
result === false ? undefined : result
|
|
327
|
+
];
|
|
224
328
|
}
|
|
225
|
-
}
|
|
226
|
-
})
|
|
329
|
+
});
|
|
330
|
+
})();
|
|
227
331
|
}
|
|
228
332
|
},
|
|
229
333
|
{
|
|
@@ -231,15 +335,17 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
231
335
|
value: // property校验
|
|
232
336
|
function validate(messages, ignore) {
|
|
233
337
|
var _this = this;
|
|
234
|
-
return _asyncToGenerator(
|
|
235
|
-
var result, rules, validator;
|
|
236
|
-
return
|
|
237
|
-
|
|
338
|
+
return _asyncToGenerator(function() {
|
|
339
|
+
var result, rules, validator, err;
|
|
340
|
+
return __generator(this, function(_state) {
|
|
341
|
+
switch(_state.label){
|
|
238
342
|
case 0:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
343
|
+
return [
|
|
344
|
+
4,
|
|
345
|
+
_this.preValidate()
|
|
346
|
+
];
|
|
347
|
+
case 1:
|
|
348
|
+
result = _state.sent();
|
|
243
349
|
rules = result !== undefined ? result : _objectSpread({}, _this.rules);
|
|
244
350
|
if (Array.isArray(ignore)) {
|
|
245
351
|
ignore.forEach(function(key) {
|
|
@@ -249,29 +355,37 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
249
355
|
});
|
|
250
356
|
}
|
|
251
357
|
validator = createValidator(rules, messages);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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;
|
|
262
380
|
}
|
|
263
|
-
throw
|
|
264
|
-
case
|
|
265
|
-
|
|
266
|
-
|
|
381
|
+
throw err;
|
|
382
|
+
case 5:
|
|
383
|
+
return [
|
|
384
|
+
2
|
|
385
|
+
];
|
|
267
386
|
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
6,
|
|
271
|
-
12
|
|
272
|
-
]
|
|
273
|
-
]);
|
|
274
|
-
}))();
|
|
387
|
+
});
|
|
388
|
+
})();
|
|
275
389
|
}
|
|
276
390
|
},
|
|
277
391
|
{
|
|
@@ -281,7 +395,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
281
395
|
var fieldType = this.fieldType;
|
|
282
396
|
var controlId = this.id;
|
|
283
397
|
var type = this.type;
|
|
284
|
-
var
|
|
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;
|
|
285
399
|
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
286
400
|
var dataBindModelType = {
|
|
287
401
|
parentId: parentId,
|
|
@@ -295,13 +409,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
295
409
|
dataBindModelType.dataBind = dataBind;
|
|
296
410
|
}
|
|
297
411
|
switch(optionConfig){
|
|
298
|
-
case
|
|
412
|
+
case "datasource":
|
|
299
413
|
case undefined:
|
|
300
414
|
if (datasourceBind) {
|
|
301
415
|
dataBindModelType.datasourceBind = datasourceBind;
|
|
302
416
|
}
|
|
303
417
|
break;
|
|
304
|
-
case
|
|
418
|
+
case "custom":
|
|
305
419
|
dataBindModelType.props.options = options;
|
|
306
420
|
break;
|
|
307
421
|
}
|
|
@@ -324,7 +438,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
324
438
|
key: "preToSchema",
|
|
325
439
|
value: function preToSchema() {
|
|
326
440
|
// 在处理Schema之前,预留的钩子函数,允许在toSchema之前处理一些数据
|
|
327
|
-
this._callControlHooks(
|
|
441
|
+
this._callControlHooks("preToSchema", this);
|
|
328
442
|
}
|
|
329
443
|
},
|
|
330
444
|
{
|
|
@@ -344,10 +458,10 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
344
458
|
{
|
|
345
459
|
key: "updateBasicControl",
|
|
346
460
|
value: function updateBasicControl(key, setting) {
|
|
347
|
-
if (key !==
|
|
461
|
+
if (key !== "setting") return;
|
|
348
462
|
if (setting.add) {
|
|
349
|
-
var
|
|
350
|
-
(
|
|
463
|
+
var _this_setting;
|
|
464
|
+
(_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(setting.add));
|
|
351
465
|
}
|
|
352
466
|
if (setting.remove) {
|
|
353
467
|
this.removeSettingItem(setting.remove);
|
|
@@ -360,15 +474,20 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
360
474
|
]);
|
|
361
475
|
return Control;
|
|
362
476
|
}();
|
|
363
|
-
Control
|
|
364
|
-
Control
|
|
365
|
-
Control
|
|
366
|
-
Control
|
|
367
|
-
|
|
368
|
-
Control
|
|
369
|
-
Control
|
|
370
|
-
|
|
371
|
-
Control
|
|
477
|
+
_defineProperty(Control, "controlName", "控件");
|
|
478
|
+
_defineProperty(Control, "controlIcon", "icon");
|
|
479
|
+
_defineProperty(Control, "controlType", "control");
|
|
480
|
+
_defineProperty(Control, "controlFieldType", void 0);
|
|
481
|
+
// 控件可以触发的事件key
|
|
482
|
+
_defineProperty(Control, "controlEventKeys", []);
|
|
483
|
+
_defineProperty(Control, "controlCustomEvents", []);
|
|
484
|
+
// setting应该是全量的设置项,外部控制,在初始化的时候会deepCopy一份
|
|
485
|
+
_defineProperty(Control, "setting", []);
|
|
486
|
+
_defineProperty(Control, "__is_control__", true);
|
|
487
|
+
// 删除指定的settingItem
|
|
488
|
+
_defineProperty(Control, "removeSettingItem", removeSetting);
|
|
489
|
+
// 修改指定的settingItem的visible
|
|
490
|
+
_defineProperty(Control, "updateSettingItem", updateSetting);
|
|
372
491
|
export default Control;
|
|
373
492
|
export { Control as DesignerControl };
|
|
374
493
|
/**
|
|
@@ -381,23 +500,23 @@ export { Control as DesignerControl };
|
|
|
381
500
|
keys
|
|
382
501
|
];
|
|
383
502
|
deleteKeys.forEach(function(deleteKey) {
|
|
384
|
-
var
|
|
503
|
+
var _this_setting;
|
|
385
504
|
// 是否存在子项
|
|
386
|
-
var isHasItem = typeof deleteKey !==
|
|
505
|
+
var isHasItem = typeof deleteKey !== "string";
|
|
387
506
|
// 判断setting是否是自定义控件setting项
|
|
388
507
|
// @ts-ignore
|
|
389
|
-
var settingIndex = (
|
|
508
|
+
var settingIndex = (_this_setting = _this.setting) === null || _this_setting === void 0 ? void 0 : _this_setting.findIndex(function(option) {
|
|
390
509
|
return option.key === (isHasItem ? deleteKey.key : deleteKey);
|
|
391
510
|
});
|
|
392
511
|
// 移除对应选项
|
|
393
512
|
if (settingIndex !== -1) {
|
|
394
|
-
var
|
|
395
|
-
isHasItem ? _this.setting[settingIndex].showItems = (
|
|
513
|
+
var _this_setting_settingIndex_showItems, _this_setting_settingIndex_showItems1;
|
|
514
|
+
isHasItem ? _this.setting[settingIndex].showItems = (_this_setting_settingIndex_showItems = _this.setting[settingIndex].showItems) === null || _this_setting_settingIndex_showItems === void 0 ? void 0 : _this_setting_settingIndex_showItems.filter(function(item) {
|
|
396
515
|
return !deleteKey.hideItems.includes(item);
|
|
397
516
|
}) : _this.setting.splice(settingIndex, 1);
|
|
398
517
|
// 子项长度为0,自动移除当前设置项
|
|
399
518
|
isHasItem && // @ts-ignore
|
|
400
|
-
!((
|
|
519
|
+
!((_this_setting_settingIndex_showItems1 = _this.setting[settingIndex].showItems) === null || _this_setting_settingIndex_showItems1 === void 0 ? void 0 : _this_setting_settingIndex_showItems1.length) && // @ts-ignore
|
|
401
520
|
_this.setting.splice(settingIndex, 1);
|
|
402
521
|
}
|
|
403
522
|
});
|
|
@@ -411,7 +530,7 @@ export { Control as DesignerControl };
|
|
|
411
530
|
* @param value.type 默认是replace替换,可以更改为push新增
|
|
412
531
|
* */ function updateSetting(settingKey, value) {
|
|
413
532
|
var _this = this;
|
|
414
|
-
var keys = typeof settingKey ===
|
|
533
|
+
var keys = typeof settingKey === "string" ? [
|
|
415
534
|
settingKey
|
|
416
535
|
] : settingKey;
|
|
417
536
|
keys.forEach(function(key) {
|
|
@@ -420,16 +539,16 @@ export { Control as DesignerControl };
|
|
|
420
539
|
return item.key === key;
|
|
421
540
|
});
|
|
422
541
|
if (settingItem) {
|
|
423
|
-
if (typeof value ===
|
|
542
|
+
if (typeof value === "boolean") {
|
|
424
543
|
settingItem.visible = value;
|
|
425
|
-
} else if (typeof value ===
|
|
426
|
-
var
|
|
427
|
-
var type = (
|
|
428
|
-
if (type ===
|
|
544
|
+
} else if (typeof value === "object") {
|
|
545
|
+
var _value_type;
|
|
546
|
+
var type = (_value_type = value.type) !== null && _value_type !== void 0 ? _value_type : "replace";
|
|
547
|
+
if (type === "replace") {
|
|
429
548
|
settingItem.showItems = value.showItems;
|
|
430
549
|
} else {
|
|
431
|
-
var
|
|
432
|
-
(
|
|
550
|
+
var _settingItem_showItems;
|
|
551
|
+
(_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems, _toConsumableArray(value.showItems));
|
|
433
552
|
}
|
|
434
553
|
}
|
|
435
554
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import Designer from
|
|
2
|
-
import Runtime from
|
|
3
|
-
import Property from
|
|
1
|
+
import Designer from "./designer";
|
|
2
|
+
import Runtime from "./runtime";
|
|
3
|
+
import Property from "./property";
|
|
4
4
|
export default {
|
|
5
5
|
Designer: Designer,
|
|
6
6
|
Runtime: Runtime,
|
|
7
7
|
Property: Property
|
|
8
8
|
};
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
9
|
+
export * from "./designer";
|
|
10
|
+
export * from "./runtime";
|
|
11
|
+
export * from "./property";
|
|
12
|
+
export * from "./types";
|
|
@@ -37,6 +37,19 @@ function _construct(Parent, args, Class) {
|
|
|
37
37
|
}
|
|
38
38
|
return _construct.apply(null, arguments);
|
|
39
39
|
}
|
|
40
|
+
function _defineProperty(obj, key, value) {
|
|
41
|
+
if (key in obj) {
|
|
42
|
+
Object.defineProperty(obj, key, {
|
|
43
|
+
value: value,
|
|
44
|
+
enumerable: true,
|
|
45
|
+
configurable: true,
|
|
46
|
+
writable: true
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
obj[key] = value;
|
|
50
|
+
}
|
|
51
|
+
return obj;
|
|
52
|
+
}
|
|
40
53
|
function _getPrototypeOf(o) {
|
|
41
54
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
42
55
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -126,17 +139,17 @@ function _createSuper(Derived) {
|
|
|
126
139
|
return _possibleConstructorReturn(this, result);
|
|
127
140
|
};
|
|
128
141
|
}
|
|
129
|
-
import { BaseStyle } from
|
|
142
|
+
import { BaseStyle } from "../../framework";
|
|
130
143
|
var PropertyRules = function PropertyRules(props) {
|
|
131
144
|
"use strict";
|
|
132
145
|
_classCallCheck(this, PropertyRules);
|
|
133
|
-
this
|
|
134
|
-
type:
|
|
135
|
-
};
|
|
146
|
+
_defineProperty(this, "isHide", {
|
|
147
|
+
type: "boolean"
|
|
148
|
+
});
|
|
136
149
|
};
|
|
137
|
-
var PropertyRuntimeRules = /*#__PURE__*/ function(
|
|
150
|
+
var PropertyRuntimeRules = /*#__PURE__*/ function(Array1) {
|
|
138
151
|
"use strict";
|
|
139
|
-
_inherits(PropertyRuntimeRules,
|
|
152
|
+
_inherits(PropertyRuntimeRules, Array1);
|
|
140
153
|
var _super = _createSuper(PropertyRuntimeRules);
|
|
141
154
|
function PropertyRuntimeRules(props) {
|
|
142
155
|
_classCallCheck(this, PropertyRuntimeRules);
|
|
@@ -144,17 +157,32 @@ var PropertyRuntimeRules = /*#__PURE__*/ function(Array) {
|
|
|
144
157
|
}
|
|
145
158
|
return PropertyRuntimeRules;
|
|
146
159
|
}(_wrapNativeSuper(Array));
|
|
147
|
-
|
|
160
|
+
/**
|
|
161
|
+
* 全局属性
|
|
162
|
+
* @public
|
|
163
|
+
*/ var Property = function Property(props) {
|
|
148
164
|
"use strict";
|
|
149
|
-
var caption = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
165
|
+
var caption = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
150
166
|
_classCallCheck(this, Property);
|
|
151
|
-
|
|
152
|
-
|
|
167
|
+
/**
|
|
168
|
+
* 是否隐藏
|
|
169
|
+
* @public
|
|
170
|
+
* @defaultValue false
|
|
171
|
+
*/ _defineProperty(this, "isHide", void 0);
|
|
172
|
+
_defineProperty(this, "className", void 0);
|
|
173
|
+
_defineProperty(this, "style", void 0);
|
|
174
|
+
/**
|
|
175
|
+
* 标题
|
|
176
|
+
* @public
|
|
177
|
+
* @defaultValue ''
|
|
178
|
+
*/ _defineProperty(this, "caption", void 0);
|
|
179
|
+
var _props_isHide;
|
|
180
|
+
this.isHide = (_props_isHide = props === null || props === void 0 ? void 0 : props.isHide) !== null && _props_isHide !== void 0 ? _props_isHide : false;
|
|
153
181
|
this.style = new BaseStyle(props === null || props === void 0 ? void 0 : props.style);
|
|
154
|
-
var
|
|
155
|
-
this.caption = (
|
|
182
|
+
var _props_caption;
|
|
183
|
+
this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : caption;
|
|
156
184
|
};
|
|
157
|
-
Property
|
|
158
|
-
Property
|
|
185
|
+
_defineProperty(Property, "Rules", PropertyRules);
|
|
186
|
+
_defineProperty(Property, "RuntimeRules", PropertyRuntimeRules);
|
|
159
187
|
export default Property;
|
|
160
188
|
export { Property, PropertyRules, PropertyRuntimeRules };
|