@byteluck-fe/model-driven-core 2.7.0-alpha.12 → 2.7.0-alpha.15
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 -124
- 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/BaseControl/designer.d.ts +0 -4
- 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,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
|
-
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
|
+
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;
|
|
138
238
|
if (!(controlName && controlIcon && controlType)) {
|
|
139
239
|
referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
|
|
140
240
|
}
|
|
141
|
-
var
|
|
142
|
-
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);
|
|
143
243
|
this.name = controlName;
|
|
144
244
|
this.icon = controlIcon;
|
|
145
|
-
var
|
|
146
|
-
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;
|
|
147
247
|
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 = (
|
|
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";
|
|
150
250
|
this.setting = JSONCopy(setting);
|
|
151
|
-
var
|
|
152
|
-
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;
|
|
153
253
|
this.eventKeys = JSONCopy(controlEventKeys);
|
|
154
254
|
this.customEvents = JSONCopy(controlCustomEvents);
|
|
155
255
|
Promise.resolve().then(function() {
|
|
156
|
-
_this._callControlHooks(
|
|
256
|
+
_this._callControlHooks("postInstance", props);
|
|
157
257
|
});
|
|
158
258
|
}
|
|
159
259
|
_createClass(Control, [
|
|
@@ -185,14 +285,14 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
185
285
|
key: "preUpdate",
|
|
186
286
|
value: function preUpdate(key, value) {
|
|
187
287
|
// 在修改props之前
|
|
188
|
-
this._callControlHooks(
|
|
288
|
+
this._callControlHooks("preUpdateProps", key, value);
|
|
189
289
|
}
|
|
190
290
|
},
|
|
191
291
|
{
|
|
192
292
|
key: "postUpdate",
|
|
193
293
|
value: function postUpdate(key, value) {
|
|
194
294
|
// 在修改props之后
|
|
195
|
-
this._callControlHooks(
|
|
295
|
+
this._callControlHooks("postUpdateProps", key, value);
|
|
196
296
|
}
|
|
197
297
|
},
|
|
198
298
|
{
|
|
@@ -208,24 +308,26 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
208
308
|
key: "preValidate",
|
|
209
309
|
value: function preValidate() {
|
|
210
310
|
var _this = this;
|
|
211
|
-
return _asyncToGenerator(
|
|
311
|
+
return _asyncToGenerator(function() {
|
|
212
312
|
var rules, results, result;
|
|
213
|
-
return
|
|
214
|
-
|
|
313
|
+
return __generator(this, function(_state) {
|
|
314
|
+
switch(_state.label){
|
|
215
315
|
case 0:
|
|
216
316
|
rules = _objectSpread({}, _this.rules);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
317
|
+
return [
|
|
318
|
+
4,
|
|
319
|
+
_this._callControlHooks("preValidate", rules)
|
|
320
|
+
];
|
|
321
|
+
case 1:
|
|
322
|
+
results = _state.sent();
|
|
221
323
|
result = results[results.length - 1];
|
|
222
|
-
return
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
324
|
+
return [
|
|
325
|
+
2,
|
|
326
|
+
result === false ? undefined : result
|
|
327
|
+
];
|
|
226
328
|
}
|
|
227
|
-
}
|
|
228
|
-
})
|
|
329
|
+
});
|
|
330
|
+
})();
|
|
229
331
|
}
|
|
230
332
|
},
|
|
231
333
|
{
|
|
@@ -233,15 +335,17 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
233
335
|
value: // property校验
|
|
234
336
|
function validate(messages, ignore) {
|
|
235
337
|
var _this = this;
|
|
236
|
-
return _asyncToGenerator(
|
|
237
|
-
var result, rules, validator;
|
|
238
|
-
return
|
|
239
|
-
|
|
338
|
+
return _asyncToGenerator(function() {
|
|
339
|
+
var result, rules, validator, err;
|
|
340
|
+
return __generator(this, function(_state) {
|
|
341
|
+
switch(_state.label){
|
|
240
342
|
case 0:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
343
|
+
return [
|
|
344
|
+
4,
|
|
345
|
+
_this.preValidate()
|
|
346
|
+
];
|
|
347
|
+
case 1:
|
|
348
|
+
result = _state.sent();
|
|
245
349
|
rules = result !== undefined ? result : _objectSpread({}, _this.rules);
|
|
246
350
|
if (Array.isArray(ignore)) {
|
|
247
351
|
ignore.forEach(function(key) {
|
|
@@ -251,29 +355,37 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
251
355
|
});
|
|
252
356
|
}
|
|
253
357
|
validator = createValidator(rules, messages);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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;
|
|
264
380
|
}
|
|
265
|
-
throw
|
|
266
|
-
case
|
|
267
|
-
|
|
268
|
-
|
|
381
|
+
throw err;
|
|
382
|
+
case 5:
|
|
383
|
+
return [
|
|
384
|
+
2
|
|
385
|
+
];
|
|
269
386
|
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
6,
|
|
273
|
-
12
|
|
274
|
-
]
|
|
275
|
-
]);
|
|
276
|
-
}))();
|
|
387
|
+
});
|
|
388
|
+
})();
|
|
277
389
|
}
|
|
278
390
|
},
|
|
279
391
|
{
|
|
@@ -283,7 +395,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
283
395
|
var fieldType = this.fieldType;
|
|
284
396
|
var controlId = this.id;
|
|
285
397
|
var type = this.type;
|
|
286
|
-
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;
|
|
287
399
|
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
288
400
|
var dataBindModelType = {
|
|
289
401
|
parentId: parentId,
|
|
@@ -297,13 +409,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
297
409
|
dataBindModelType.dataBind = dataBind;
|
|
298
410
|
}
|
|
299
411
|
switch(optionConfig){
|
|
300
|
-
case
|
|
412
|
+
case "datasource":
|
|
301
413
|
case undefined:
|
|
302
414
|
if (datasourceBind) {
|
|
303
415
|
dataBindModelType.datasourceBind = datasourceBind;
|
|
304
416
|
}
|
|
305
417
|
break;
|
|
306
|
-
case
|
|
418
|
+
case "custom":
|
|
307
419
|
dataBindModelType.props.options = options;
|
|
308
420
|
break;
|
|
309
421
|
}
|
|
@@ -326,7 +438,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
326
438
|
key: "preToSchema",
|
|
327
439
|
value: function preToSchema() {
|
|
328
440
|
// 在处理Schema之前,预留的钩子函数,允许在toSchema之前处理一些数据
|
|
329
|
-
this._callControlHooks(
|
|
441
|
+
this._callControlHooks("preToSchema", this);
|
|
330
442
|
}
|
|
331
443
|
},
|
|
332
444
|
{
|
|
@@ -346,10 +458,10 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
346
458
|
{
|
|
347
459
|
key: "updateBasicControl",
|
|
348
460
|
value: function updateBasicControl(key, setting) {
|
|
349
|
-
if (key !==
|
|
461
|
+
if (key !== "setting") return;
|
|
350
462
|
if (setting.add) {
|
|
351
|
-
var
|
|
352
|
-
(
|
|
463
|
+
var _this_setting;
|
|
464
|
+
(_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(setting.add));
|
|
353
465
|
}
|
|
354
466
|
if (setting.remove) {
|
|
355
467
|
this.removeSettingItem(setting.remove);
|
|
@@ -362,15 +474,20 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
362
474
|
]);
|
|
363
475
|
return Control;
|
|
364
476
|
}();
|
|
365
|
-
Control
|
|
366
|
-
Control
|
|
367
|
-
Control
|
|
368
|
-
Control
|
|
369
|
-
|
|
370
|
-
Control
|
|
371
|
-
Control
|
|
372
|
-
|
|
373
|
-
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);
|
|
374
491
|
export default Control;
|
|
375
492
|
export { Control as DesignerControl };
|
|
376
493
|
/**
|
|
@@ -383,25 +500,23 @@ export { Control as DesignerControl };
|
|
|
383
500
|
keys
|
|
384
501
|
];
|
|
385
502
|
deleteKeys.forEach(function(deleteKey) {
|
|
386
|
-
var
|
|
503
|
+
var _this_setting;
|
|
387
504
|
// 是否存在子项
|
|
388
|
-
var isHasItem = typeof deleteKey !==
|
|
505
|
+
var isHasItem = typeof deleteKey !== "string";
|
|
389
506
|
// 判断setting是否是自定义控件setting项
|
|
390
507
|
// @ts-ignore
|
|
391
|
-
|
|
392
|
-
// @ts-ignore
|
|
393
|
-
var settingIndex = (ref = _this.setting) === null || ref === void 0 ? void 0 : ref.findIndex(function(option) {
|
|
508
|
+
var settingIndex = (_this_setting = _this.setting) === null || _this_setting === void 0 ? void 0 : _this_setting.findIndex(function(option) {
|
|
394
509
|
return option.key === (isHasItem ? deleteKey.key : deleteKey);
|
|
395
510
|
});
|
|
396
511
|
// 移除对应选项
|
|
397
512
|
if (settingIndex !== -1) {
|
|
398
|
-
var
|
|
399
|
-
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) {
|
|
400
515
|
return !deleteKey.hideItems.includes(item);
|
|
401
516
|
}) : _this.setting.splice(settingIndex, 1);
|
|
402
517
|
// 子项长度为0,自动移除当前设置项
|
|
403
518
|
isHasItem && // @ts-ignore
|
|
404
|
-
!((
|
|
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
|
|
405
520
|
_this.setting.splice(settingIndex, 1);
|
|
406
521
|
}
|
|
407
522
|
});
|
|
@@ -415,49 +530,27 @@ export { Control as DesignerControl };
|
|
|
415
530
|
* @param value.type 默认是replace替换,可以更改为push新增
|
|
416
531
|
* */ function updateSetting(settingKey, value) {
|
|
417
532
|
var _this = this;
|
|
418
|
-
var keys = typeof settingKey ===
|
|
533
|
+
var keys = typeof settingKey === "string" ? [
|
|
419
534
|
settingKey
|
|
420
535
|
] : settingKey;
|
|
421
536
|
keys.forEach(function(key) {
|
|
422
|
-
// @ts-ignore
|
|
423
|
-
if (!Array.isArray(_this.setting)) return;
|
|
424
537
|
// @ts-ignore
|
|
425
538
|
var settingItem = _this.setting.find(function(item) {
|
|
426
539
|
return item.key === key;
|
|
427
540
|
});
|
|
428
541
|
if (settingItem) {
|
|
429
|
-
if (typeof value ===
|
|
542
|
+
if (typeof value === "boolean") {
|
|
430
543
|
settingItem.visible = value;
|
|
431
|
-
} else if (typeof value ===
|
|
432
|
-
var
|
|
433
|
-
var type = (
|
|
434
|
-
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") {
|
|
435
548
|
settingItem.showItems = value.showItems;
|
|
436
549
|
} else {
|
|
437
|
-
var
|
|
438
|
-
(
|
|
550
|
+
var _settingItem_showItems;
|
|
551
|
+
(_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems, _toConsumableArray(value.showItems));
|
|
439
552
|
}
|
|
440
553
|
}
|
|
441
554
|
}
|
|
442
555
|
});
|
|
443
556
|
}
|
|
444
|
-
/**
|
|
445
|
-
* @function 新增控件或者实例上的setting的方法
|
|
446
|
-
* @description 其中的this可能是DesignerControl的类,也可以是实例
|
|
447
|
-
* @param setting 需要新增的setting或者setting项组成的数组
|
|
448
|
-
* */ function addSetting(setting) {
|
|
449
|
-
var // @ts-ignore
|
|
450
|
-
_setting;
|
|
451
|
-
var settings = Object.prototype.toString.call(setting) === '[object Object]' ? [
|
|
452
|
-
setting
|
|
453
|
-
] : setting;
|
|
454
|
-
(_setting = this.setting).push.apply(_setting, _toConsumableArray(settings));
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* @function 新增控件或者实例上的setting的方法
|
|
458
|
-
* @description 其中的this可能是DesignerControl的类,也可以是实例
|
|
459
|
-
* @param setting 需要新增的setting或者setting项组成的数组
|
|
460
|
-
* */ function replaceSetting(setting) {
|
|
461
|
-
// @ts-ignore
|
|
462
|
-
this.setting = setting;
|
|
463
|
-
}
|
|
@@ -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 };
|