@byteluck-fe/model-driven-core 2.7.0-alpha.12 → 2.7.0-alpha.13
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 +222 -103
- 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 +20 -5
- 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 +3 -3
|
@@ -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,45 +115,147 @@ 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
|
-
this
|
|
136
|
-
this
|
|
137
|
-
|
|
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
|
+
_defineProperty(this, "addSetting", addSetting);
|
|
237
|
+
_defineProperty(this, "replaceSetting", replaceSetting);
|
|
238
|
+
this._callControlHooks("preInstance", props);
|
|
239
|
+
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;
|
|
138
240
|
if (!(controlName && controlIcon && controlType)) {
|
|
139
241
|
referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
|
|
140
242
|
}
|
|
141
|
-
var
|
|
142
|
-
this.id = (
|
|
243
|
+
var _props_id;
|
|
244
|
+
this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
|
|
143
245
|
this.name = controlName;
|
|
144
246
|
this.icon = controlIcon;
|
|
145
|
-
var
|
|
146
|
-
this.type = (
|
|
247
|
+
var _props_type;
|
|
248
|
+
this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : controlType;
|
|
147
249
|
this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
|
|
148
|
-
var
|
|
149
|
-
this.controlType = (
|
|
250
|
+
var _props_controlType;
|
|
251
|
+
this.controlType = (_props_controlType = props === null || props === void 0 ? void 0 : props.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
|
|
150
252
|
this.setting = JSONCopy(setting);
|
|
151
|
-
var
|
|
152
|
-
this.fieldType = (
|
|
253
|
+
var _props_fieldType;
|
|
254
|
+
this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
|
|
153
255
|
this.eventKeys = JSONCopy(controlEventKeys);
|
|
154
256
|
this.customEvents = JSONCopy(controlCustomEvents);
|
|
155
257
|
Promise.resolve().then(function() {
|
|
156
|
-
_this._callControlHooks(
|
|
258
|
+
_this._callControlHooks("postInstance", props);
|
|
157
259
|
});
|
|
158
260
|
}
|
|
159
261
|
_createClass(Control, [
|
|
@@ -185,14 +287,14 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
185
287
|
key: "preUpdate",
|
|
186
288
|
value: function preUpdate(key, value) {
|
|
187
289
|
// 在修改props之前
|
|
188
|
-
this._callControlHooks(
|
|
290
|
+
this._callControlHooks("preUpdateProps", key, value);
|
|
189
291
|
}
|
|
190
292
|
},
|
|
191
293
|
{
|
|
192
294
|
key: "postUpdate",
|
|
193
295
|
value: function postUpdate(key, value) {
|
|
194
296
|
// 在修改props之后
|
|
195
|
-
this._callControlHooks(
|
|
297
|
+
this._callControlHooks("postUpdateProps", key, value);
|
|
196
298
|
}
|
|
197
299
|
},
|
|
198
300
|
{
|
|
@@ -208,24 +310,26 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
208
310
|
key: "preValidate",
|
|
209
311
|
value: function preValidate() {
|
|
210
312
|
var _this = this;
|
|
211
|
-
return _asyncToGenerator(
|
|
313
|
+
return _asyncToGenerator(function() {
|
|
212
314
|
var rules, results, result;
|
|
213
|
-
return
|
|
214
|
-
|
|
315
|
+
return __generator(this, function(_state) {
|
|
316
|
+
switch(_state.label){
|
|
215
317
|
case 0:
|
|
216
318
|
rules = _objectSpread({}, _this.rules);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
319
|
+
return [
|
|
320
|
+
4,
|
|
321
|
+
_this._callControlHooks("preValidate", rules)
|
|
322
|
+
];
|
|
323
|
+
case 1:
|
|
324
|
+
results = _state.sent();
|
|
221
325
|
result = results[results.length - 1];
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
326
|
+
return [
|
|
327
|
+
2,
|
|
328
|
+
result === false ? undefined : result
|
|
329
|
+
];
|
|
226
330
|
}
|
|
227
|
-
}
|
|
228
|
-
})
|
|
331
|
+
});
|
|
332
|
+
})();
|
|
229
333
|
}
|
|
230
334
|
},
|
|
231
335
|
{
|
|
@@ -233,15 +337,17 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
233
337
|
value: // property校验
|
|
234
338
|
function validate(messages, ignore) {
|
|
235
339
|
var _this = this;
|
|
236
|
-
return _asyncToGenerator(
|
|
237
|
-
var result, rules, validator;
|
|
238
|
-
return
|
|
239
|
-
|
|
340
|
+
return _asyncToGenerator(function() {
|
|
341
|
+
var result, rules, validator, err;
|
|
342
|
+
return __generator(this, function(_state) {
|
|
343
|
+
switch(_state.label){
|
|
240
344
|
case 0:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
345
|
+
return [
|
|
346
|
+
4,
|
|
347
|
+
_this.preValidate()
|
|
348
|
+
];
|
|
349
|
+
case 1:
|
|
350
|
+
result = _state.sent();
|
|
245
351
|
rules = result !== undefined ? result : _objectSpread({}, _this.rules);
|
|
246
352
|
if (Array.isArray(ignore)) {
|
|
247
353
|
ignore.forEach(function(key) {
|
|
@@ -251,29 +357,37 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
251
357
|
});
|
|
252
358
|
}
|
|
253
359
|
validator = createValidator(rules, messages);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
360
|
+
_state.label = 2;
|
|
361
|
+
case 2:
|
|
362
|
+
_state.trys.push([
|
|
363
|
+
2,
|
|
364
|
+
4,
|
|
365
|
+
,
|
|
366
|
+
5
|
|
367
|
+
]);
|
|
368
|
+
return [
|
|
369
|
+
4,
|
|
370
|
+
validator.validate(_this.props)
|
|
371
|
+
];
|
|
372
|
+
case 3:
|
|
373
|
+
_state.sent();
|
|
374
|
+
return [
|
|
375
|
+
2,
|
|
376
|
+
true
|
|
377
|
+
];
|
|
378
|
+
case 4:
|
|
379
|
+
err = _state.sent();
|
|
380
|
+
if (!err.control) {
|
|
381
|
+
err.control = _this;
|
|
264
382
|
}
|
|
265
|
-
throw
|
|
266
|
-
case
|
|
267
|
-
|
|
268
|
-
|
|
383
|
+
throw err;
|
|
384
|
+
case 5:
|
|
385
|
+
return [
|
|
386
|
+
2
|
|
387
|
+
];
|
|
269
388
|
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
6,
|
|
273
|
-
12
|
|
274
|
-
]
|
|
275
|
-
]);
|
|
276
|
-
}))();
|
|
389
|
+
});
|
|
390
|
+
})();
|
|
277
391
|
}
|
|
278
392
|
},
|
|
279
393
|
{
|
|
@@ -283,7 +397,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
283
397
|
var fieldType = this.fieldType;
|
|
284
398
|
var controlId = this.id;
|
|
285
399
|
var type = this.type;
|
|
286
|
-
var
|
|
400
|
+
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;
|
|
287
401
|
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
288
402
|
var dataBindModelType = {
|
|
289
403
|
parentId: parentId,
|
|
@@ -297,13 +411,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
297
411
|
dataBindModelType.dataBind = dataBind;
|
|
298
412
|
}
|
|
299
413
|
switch(optionConfig){
|
|
300
|
-
case
|
|
414
|
+
case "datasource":
|
|
301
415
|
case undefined:
|
|
302
416
|
if (datasourceBind) {
|
|
303
417
|
dataBindModelType.datasourceBind = datasourceBind;
|
|
304
418
|
}
|
|
305
419
|
break;
|
|
306
|
-
case
|
|
420
|
+
case "custom":
|
|
307
421
|
dataBindModelType.props.options = options;
|
|
308
422
|
break;
|
|
309
423
|
}
|
|
@@ -326,7 +440,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
326
440
|
key: "preToSchema",
|
|
327
441
|
value: function preToSchema() {
|
|
328
442
|
// 在处理Schema之前,预留的钩子函数,允许在toSchema之前处理一些数据
|
|
329
|
-
this._callControlHooks(
|
|
443
|
+
this._callControlHooks("preToSchema", this);
|
|
330
444
|
}
|
|
331
445
|
},
|
|
332
446
|
{
|
|
@@ -346,10 +460,10 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
346
460
|
{
|
|
347
461
|
key: "updateBasicControl",
|
|
348
462
|
value: function updateBasicControl(key, setting) {
|
|
349
|
-
if (key !==
|
|
463
|
+
if (key !== "setting") return;
|
|
350
464
|
if (setting.add) {
|
|
351
|
-
var
|
|
352
|
-
(
|
|
465
|
+
var _this_setting;
|
|
466
|
+
(_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(setting.add));
|
|
353
467
|
}
|
|
354
468
|
if (setting.remove) {
|
|
355
469
|
this.removeSettingItem(setting.remove);
|
|
@@ -362,15 +476,20 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
362
476
|
]);
|
|
363
477
|
return Control;
|
|
364
478
|
}();
|
|
365
|
-
Control
|
|
366
|
-
Control
|
|
367
|
-
Control
|
|
368
|
-
Control
|
|
369
|
-
|
|
370
|
-
Control
|
|
371
|
-
Control
|
|
372
|
-
|
|
373
|
-
Control
|
|
479
|
+
_defineProperty(Control, "controlName", "控件");
|
|
480
|
+
_defineProperty(Control, "controlIcon", "icon");
|
|
481
|
+
_defineProperty(Control, "controlType", "control");
|
|
482
|
+
_defineProperty(Control, "controlFieldType", void 0);
|
|
483
|
+
// 控件可以触发的事件key
|
|
484
|
+
_defineProperty(Control, "controlEventKeys", []);
|
|
485
|
+
_defineProperty(Control, "controlCustomEvents", []);
|
|
486
|
+
// setting应该是全量的设置项,外部控制,在初始化的时候会deepCopy一份
|
|
487
|
+
_defineProperty(Control, "setting", []);
|
|
488
|
+
_defineProperty(Control, "__is_control__", true);
|
|
489
|
+
// 删除指定的settingItem
|
|
490
|
+
_defineProperty(Control, "removeSettingItem", removeSetting);
|
|
491
|
+
// 修改指定的settingItem的visible
|
|
492
|
+
_defineProperty(Control, "updateSettingItem", updateSetting);
|
|
374
493
|
export default Control;
|
|
375
494
|
export { Control as DesignerControl };
|
|
376
495
|
/**
|
|
@@ -383,25 +502,25 @@ export { Control as DesignerControl };
|
|
|
383
502
|
keys
|
|
384
503
|
];
|
|
385
504
|
deleteKeys.forEach(function(deleteKey) {
|
|
386
|
-
var
|
|
505
|
+
var _this_setting;
|
|
387
506
|
// 是否存在子项
|
|
388
|
-
var isHasItem = typeof deleteKey !==
|
|
507
|
+
var isHasItem = typeof deleteKey !== "string";
|
|
389
508
|
// 判断setting是否是自定义控件setting项
|
|
390
509
|
// @ts-ignore
|
|
391
510
|
if (!Array.isArray(_this.setting)) return;
|
|
392
511
|
// @ts-ignore
|
|
393
|
-
var settingIndex = (
|
|
512
|
+
var settingIndex = (_this_setting = _this.setting) === null || _this_setting === void 0 ? void 0 : _this_setting.findIndex(function(option) {
|
|
394
513
|
return option.key === (isHasItem ? deleteKey.key : deleteKey);
|
|
395
514
|
});
|
|
396
515
|
// 移除对应选项
|
|
397
516
|
if (settingIndex !== -1) {
|
|
398
|
-
var
|
|
399
|
-
isHasItem ? _this.setting[settingIndex].showItems = (
|
|
517
|
+
var _this_setting_settingIndex_showItems, _this_setting_settingIndex_showItems1;
|
|
518
|
+
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) {
|
|
400
519
|
return !deleteKey.hideItems.includes(item);
|
|
401
520
|
}) : _this.setting.splice(settingIndex, 1);
|
|
402
521
|
// 子项长度为0,自动移除当前设置项
|
|
403
522
|
isHasItem && // @ts-ignore
|
|
404
|
-
!((
|
|
523
|
+
!((_this_setting_settingIndex_showItems1 = _this.setting[settingIndex].showItems) === null || _this_setting_settingIndex_showItems1 === void 0 ? void 0 : _this_setting_settingIndex_showItems1.length) && // @ts-ignore
|
|
405
524
|
_this.setting.splice(settingIndex, 1);
|
|
406
525
|
}
|
|
407
526
|
});
|
|
@@ -415,7 +534,7 @@ export { Control as DesignerControl };
|
|
|
415
534
|
* @param value.type 默认是replace替换,可以更改为push新增
|
|
416
535
|
* */ function updateSetting(settingKey, value) {
|
|
417
536
|
var _this = this;
|
|
418
|
-
var keys = typeof settingKey ===
|
|
537
|
+
var keys = typeof settingKey === "string" ? [
|
|
419
538
|
settingKey
|
|
420
539
|
] : settingKey;
|
|
421
540
|
keys.forEach(function(key) {
|
|
@@ -426,16 +545,16 @@ export { Control as DesignerControl };
|
|
|
426
545
|
return item.key === key;
|
|
427
546
|
});
|
|
428
547
|
if (settingItem) {
|
|
429
|
-
if (typeof value ===
|
|
548
|
+
if (typeof value === "boolean") {
|
|
430
549
|
settingItem.visible = value;
|
|
431
|
-
} else if (typeof value ===
|
|
432
|
-
var
|
|
433
|
-
var type = (
|
|
434
|
-
if (type ===
|
|
550
|
+
} else if (typeof value === "object") {
|
|
551
|
+
var _value_type;
|
|
552
|
+
var type = (_value_type = value.type) !== null && _value_type !== void 0 ? _value_type : "replace";
|
|
553
|
+
if (type === "replace") {
|
|
435
554
|
settingItem.showItems = value.showItems;
|
|
436
555
|
} else {
|
|
437
|
-
var
|
|
438
|
-
(
|
|
556
|
+
var _settingItem_showItems;
|
|
557
|
+
(_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems, _toConsumableArray(value.showItems));
|
|
439
558
|
}
|
|
440
559
|
}
|
|
441
560
|
}
|
|
@@ -447,11 +566,11 @@ export { Control as DesignerControl };
|
|
|
447
566
|
* @param setting 需要新增的setting或者setting项组成的数组
|
|
448
567
|
* */ function addSetting(setting) {
|
|
449
568
|
var // @ts-ignore
|
|
450
|
-
|
|
451
|
-
var settings = Object.prototype.toString.call(setting) ===
|
|
569
|
+
_this_setting;
|
|
570
|
+
var settings = Object.prototype.toString.call(setting) === "[object Object]" ? [
|
|
452
571
|
setting
|
|
453
572
|
] : setting;
|
|
454
|
-
(
|
|
573
|
+
(_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(settings));
|
|
455
574
|
}
|
|
456
575
|
/**
|
|
457
576
|
* @function 新增控件或者实例上的setting的方法
|
|
@@ -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 };
|