@byteluck-fe/model-driven-core 2.7.0-alpha.13 → 2.7.0-alpha.15a
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 +99 -243
- package/dist/esm/common/BaseControl/index.js +7 -7
- package/dist/esm/common/BaseControl/property.js +14 -42
- package/dist/esm/common/BaseControl/runtime.js +21 -41
- package/dist/esm/common/ColumnControl/designer.js +5 -19
- package/dist/esm/common/ColumnControl/index.js +6 -6
- package/dist/esm/common/ColumnControl/property.js +47 -95
- package/dist/esm/common/ColumnControl/runtime.js +5 -19
- package/dist/esm/common/ControlArray.js +21 -19
- package/dist/esm/common/FormControl/designer.js +10 -25
- package/dist/esm/common/FormControl/index.js +6 -6
- package/dist/esm/common/FormControl/property.js +95 -157
- package/dist/esm/common/FormControl/runtime.js +5 -20
- package/dist/esm/common/LayoutControl/designer.js +30 -158
- 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 +7 -22
- package/dist/esm/common/ListControl/designer.js +29 -154
- package/dist/esm/common/ListControl/index.js +6 -6
- package/dist/esm/common/ListControl/property.js +6 -21
- package/dist/esm/common/ListControl/runtime.js +8 -23
- package/dist/esm/common/SearchViewControl/designer.js +5 -19
- package/dist/esm/common/SearchViewControl/index.js +6 -6
- package/dist/esm/common/SearchViewControl/property.js +4 -18
- package/dist/esm/common/SearchViewControl/runtime.js +5 -19
- package/dist/esm/common/Validator.js +5 -5
- package/dist/esm/common/WrapControl/designer.js +5 -19
- 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 +5 -19
- 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 +84 -33
- package/dist/esm/framework/index.js +332 -769
- package/dist/esm/index.js +4 -4
- package/dist/index.umd.js +1 -1
- package/dist/types/common/BaseControl/designer.d.ts +2 -5
- package/dist/types/common/BaseControl/property.d.ts +2 -0
- package/dist/types/common/BaseControl/runtime.d.ts +2 -1
- package/dist/types/common/ControlArray.d.ts +4 -3
- package/dist/types/common/ListControl/property.d.ts +1 -1
- package/dist/types/common/Validator.d.ts +1 -1
- package/dist/types/common/controlHooksEmitter.d.ts +1 -1
- package/dist/types/framework/RegisterControls.d.ts +4 -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
|
|
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) || _nonIterableRest();
|
|
105
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
106
106
|
}
|
|
107
107
|
function _toConsumableArray(arr) {
|
|
108
108
|
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
@@ -115,147 +115,43 @@ 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
|
-
|
|
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";
|
|
118
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
119
|
+
import Property from './property';
|
|
120
|
+
import { genNonDuplicateId, JSONCopy, referenceError, updateValueFromKeys } from '@byteluck-fe/model-driven-shared';
|
|
121
|
+
import { createValidator } from '../Validator';
|
|
122
|
+
import { controlHooksEmitter } from '../controlHooksEmitter';
|
|
217
123
|
var Control = /*#__PURE__*/ function _target() {
|
|
218
124
|
"use strict";
|
|
219
125
|
function Control(props) {
|
|
220
126
|
var _this = this;
|
|
221
127
|
_classCallCheck(this, Control);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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;
|
|
128
|
+
this.setting = [];
|
|
129
|
+
this.eventKeys = [];
|
|
130
|
+
this.customEvents = [];
|
|
131
|
+
this.parent = null;
|
|
132
|
+
this.updateSetting = updateSetting;
|
|
133
|
+
this.removeSetting = removeSetting;
|
|
134
|
+
this._callControlHooks('preInstance', props);
|
|
135
|
+
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;
|
|
240
136
|
if (!(controlName && controlIcon && controlType)) {
|
|
241
137
|
referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
|
|
242
138
|
}
|
|
243
|
-
var
|
|
244
|
-
this.id = (
|
|
139
|
+
var ref1;
|
|
140
|
+
this.id = (ref1 = props === null || props === void 0 ? void 0 : props.id) !== null && ref1 !== void 0 ? ref1 : genNonDuplicateId(10);
|
|
245
141
|
this.name = controlName;
|
|
246
142
|
this.icon = controlIcon;
|
|
247
|
-
var
|
|
248
|
-
this.type = (
|
|
143
|
+
var ref2;
|
|
144
|
+
this.type = (ref2 = props === null || props === void 0 ? void 0 : props.type) !== null && ref2 !== void 0 ? ref2 : controlType;
|
|
249
145
|
this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
|
|
250
|
-
var
|
|
251
|
-
this.controlType = (
|
|
146
|
+
var ref3;
|
|
147
|
+
this.controlType = (ref3 = props === null || props === void 0 ? void 0 : props.controlType) !== null && ref3 !== void 0 ? ref3 : 'base';
|
|
252
148
|
this.setting = JSONCopy(setting);
|
|
253
|
-
var
|
|
254
|
-
this.fieldType = (
|
|
149
|
+
var ref4;
|
|
150
|
+
this.fieldType = (ref4 = props === null || props === void 0 ? void 0 : props.fieldType) !== null && ref4 !== void 0 ? ref4 : controlFieldType;
|
|
255
151
|
this.eventKeys = JSONCopy(controlEventKeys);
|
|
256
152
|
this.customEvents = JSONCopy(controlCustomEvents);
|
|
257
153
|
Promise.resolve().then(function() {
|
|
258
|
-
_this._callControlHooks(
|
|
154
|
+
_this._callControlHooks('postInstance', props);
|
|
259
155
|
});
|
|
260
156
|
}
|
|
261
157
|
_createClass(Control, [
|
|
@@ -287,14 +183,14 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
287
183
|
key: "preUpdate",
|
|
288
184
|
value: function preUpdate(key, value) {
|
|
289
185
|
// 在修改props之前
|
|
290
|
-
this._callControlHooks(
|
|
186
|
+
this._callControlHooks('preUpdateProps', key, value);
|
|
291
187
|
}
|
|
292
188
|
},
|
|
293
189
|
{
|
|
294
190
|
key: "postUpdate",
|
|
295
191
|
value: function postUpdate(key, value) {
|
|
296
192
|
// 在修改props之后
|
|
297
|
-
this._callControlHooks(
|
|
193
|
+
this._callControlHooks('postUpdateProps', key, value);
|
|
298
194
|
}
|
|
299
195
|
},
|
|
300
196
|
{
|
|
@@ -310,26 +206,24 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
310
206
|
key: "preValidate",
|
|
311
207
|
value: function preValidate() {
|
|
312
208
|
var _this = this;
|
|
313
|
-
return _asyncToGenerator(function() {
|
|
209
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
314
210
|
var rules, results, result;
|
|
315
|
-
return
|
|
316
|
-
switch(
|
|
211
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
212
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
317
213
|
case 0:
|
|
318
214
|
rules = _objectSpread({}, _this.rules);
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
case 1:
|
|
324
|
-
results = _state.sent();
|
|
215
|
+
_ctx.next = 3;
|
|
216
|
+
return _this._callControlHooks('preValidate', rules);
|
|
217
|
+
case 3:
|
|
218
|
+
results = _ctx.sent;
|
|
325
219
|
result = results[results.length - 1];
|
|
326
|
-
return
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
220
|
+
return _ctx.abrupt("return", result === false ? undefined : result);
|
|
221
|
+
case 6:
|
|
222
|
+
case "end":
|
|
223
|
+
return _ctx.stop();
|
|
330
224
|
}
|
|
331
|
-
});
|
|
332
|
-
})();
|
|
225
|
+
}, _callee);
|
|
226
|
+
}))();
|
|
333
227
|
}
|
|
334
228
|
},
|
|
335
229
|
{
|
|
@@ -337,17 +231,15 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
337
231
|
value: // property校验
|
|
338
232
|
function validate(messages, ignore) {
|
|
339
233
|
var _this = this;
|
|
340
|
-
return _asyncToGenerator(function() {
|
|
341
|
-
var result, rules, validator
|
|
342
|
-
return
|
|
343
|
-
switch(
|
|
234
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
235
|
+
var result, rules, validator;
|
|
236
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
237
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
344
238
|
case 0:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
case 1:
|
|
350
|
-
result = _state.sent();
|
|
239
|
+
_ctx.next = 2;
|
|
240
|
+
return _this.preValidate();
|
|
241
|
+
case 2:
|
|
242
|
+
result = _ctx.sent;
|
|
351
243
|
rules = result !== undefined ? result : _objectSpread({}, _this.rules);
|
|
352
244
|
if (Array.isArray(ignore)) {
|
|
353
245
|
ignore.forEach(function(key) {
|
|
@@ -357,37 +249,29 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
357
249
|
});
|
|
358
250
|
}
|
|
359
251
|
validator = createValidator(rules, messages);
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
]);
|
|
368
|
-
|
|
369
|
-
|
|
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;
|
|
252
|
+
_ctx.prev = 6;
|
|
253
|
+
_ctx.next = 9;
|
|
254
|
+
return validator.validate(_this.props);
|
|
255
|
+
case 9:
|
|
256
|
+
return _ctx.abrupt("return", true);
|
|
257
|
+
case 12:
|
|
258
|
+
_ctx.prev = 12;
|
|
259
|
+
_ctx.t0 = _ctx["catch"](6);
|
|
260
|
+
if (!_ctx.t0.control) {
|
|
261
|
+
_ctx.t0.control = _this;
|
|
382
262
|
}
|
|
383
|
-
throw
|
|
384
|
-
case
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
];
|
|
263
|
+
throw _ctx.t0;
|
|
264
|
+
case 16:
|
|
265
|
+
case "end":
|
|
266
|
+
return _ctx.stop();
|
|
388
267
|
}
|
|
389
|
-
}
|
|
390
|
-
|
|
268
|
+
}, _callee, null, [
|
|
269
|
+
[
|
|
270
|
+
6,
|
|
271
|
+
12
|
|
272
|
+
]
|
|
273
|
+
]);
|
|
274
|
+
}))();
|
|
391
275
|
}
|
|
392
276
|
},
|
|
393
277
|
{
|
|
@@ -397,7 +281,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
397
281
|
var fieldType = this.fieldType;
|
|
398
282
|
var controlId = this.id;
|
|
399
283
|
var type = this.type;
|
|
400
|
-
var
|
|
284
|
+
var _props = this.props, dataBind = _props.dataBind, datasourceBind = _props.datasourceBind, optionConfig = _props.optionConfig, caption = _props.caption, required = _props.required, maxLength = _props.maxLength, options = _props.options, encrypted = _props.encrypted, encryptedMode = _props.encryptedMode;
|
|
401
285
|
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
402
286
|
var dataBindModelType = {
|
|
403
287
|
parentId: parentId,
|
|
@@ -411,13 +295,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
411
295
|
dataBindModelType.dataBind = dataBind;
|
|
412
296
|
}
|
|
413
297
|
switch(optionConfig){
|
|
414
|
-
case
|
|
298
|
+
case 'datasource':
|
|
415
299
|
case undefined:
|
|
416
300
|
if (datasourceBind) {
|
|
417
301
|
dataBindModelType.datasourceBind = datasourceBind;
|
|
418
302
|
}
|
|
419
303
|
break;
|
|
420
|
-
case
|
|
304
|
+
case 'custom':
|
|
421
305
|
dataBindModelType.props.options = options;
|
|
422
306
|
break;
|
|
423
307
|
}
|
|
@@ -440,7 +324,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
440
324
|
key: "preToSchema",
|
|
441
325
|
value: function preToSchema() {
|
|
442
326
|
// 在处理Schema之前,预留的钩子函数,允许在toSchema之前处理一些数据
|
|
443
|
-
this._callControlHooks(
|
|
327
|
+
this._callControlHooks('preToSchema', this);
|
|
444
328
|
}
|
|
445
329
|
},
|
|
446
330
|
{
|
|
@@ -460,10 +344,10 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
460
344
|
{
|
|
461
345
|
key: "updateBasicControl",
|
|
462
346
|
value: function updateBasicControl(key, setting) {
|
|
463
|
-
if (key !==
|
|
347
|
+
if (key !== 'setting') return;
|
|
464
348
|
if (setting.add) {
|
|
465
|
-
var
|
|
466
|
-
(
|
|
349
|
+
var _setting;
|
|
350
|
+
(_setting = this.setting).push.apply(_setting, _toConsumableArray(setting.add));
|
|
467
351
|
}
|
|
468
352
|
if (setting.remove) {
|
|
469
353
|
this.removeSettingItem(setting.remove);
|
|
@@ -476,20 +360,16 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
476
360
|
]);
|
|
477
361
|
return Control;
|
|
478
362
|
}();
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
// 删除指定的settingItem
|
|
490
|
-
_defineProperty(Control, "removeSettingItem", removeSetting);
|
|
491
|
-
// 修改指定的settingItem的visible
|
|
492
|
-
_defineProperty(Control, "updateSettingItem", updateSetting);
|
|
363
|
+
Control.mode = 'Designer';
|
|
364
|
+
Control.controlName = '控件';
|
|
365
|
+
Control.controlIcon = 'icon';
|
|
366
|
+
Control.controlType = 'control';
|
|
367
|
+
Control.controlEventKeys = [];
|
|
368
|
+
Control.controlCustomEvents = [];
|
|
369
|
+
Control.setting = [];
|
|
370
|
+
Control.__is_control__ = true;
|
|
371
|
+
Control.removeSettingItem = removeSetting;
|
|
372
|
+
Control.updateSettingItem = updateSetting;
|
|
493
373
|
export default Control;
|
|
494
374
|
export { Control as DesignerControl };
|
|
495
375
|
/**
|
|
@@ -502,25 +382,23 @@ export { Control as DesignerControl };
|
|
|
502
382
|
keys
|
|
503
383
|
];
|
|
504
384
|
deleteKeys.forEach(function(deleteKey) {
|
|
505
|
-
var
|
|
385
|
+
var ref;
|
|
506
386
|
// 是否存在子项
|
|
507
|
-
var isHasItem = typeof deleteKey !==
|
|
387
|
+
var isHasItem = typeof deleteKey !== 'string';
|
|
508
388
|
// 判断setting是否是自定义控件setting项
|
|
509
389
|
// @ts-ignore
|
|
510
|
-
|
|
511
|
-
// @ts-ignore
|
|
512
|
-
var settingIndex = (_this_setting = _this.setting) === null || _this_setting === void 0 ? void 0 : _this_setting.findIndex(function(option) {
|
|
390
|
+
var settingIndex = (ref = _this.setting) === null || ref === void 0 ? void 0 : ref.findIndex(function(option) {
|
|
513
391
|
return option.key === (isHasItem ? deleteKey.key : deleteKey);
|
|
514
392
|
});
|
|
515
393
|
// 移除对应选项
|
|
516
394
|
if (settingIndex !== -1) {
|
|
517
|
-
var
|
|
518
|
-
isHasItem ? _this.setting[settingIndex].showItems = (
|
|
395
|
+
var ref5, ref6;
|
|
396
|
+
isHasItem ? _this.setting[settingIndex].showItems = (ref5 = _this.setting[settingIndex].showItems) === null || ref5 === void 0 ? void 0 : ref5.filter(function(item) {
|
|
519
397
|
return !deleteKey.hideItems.includes(item);
|
|
520
398
|
}) : _this.setting.splice(settingIndex, 1);
|
|
521
399
|
// 子项长度为0,自动移除当前设置项
|
|
522
400
|
isHasItem && // @ts-ignore
|
|
523
|
-
!((
|
|
401
|
+
!((ref6 = _this.setting[settingIndex].showItems) === null || ref6 === void 0 ? void 0 : ref6.length) && // @ts-ignore
|
|
524
402
|
_this.setting.splice(settingIndex, 1);
|
|
525
403
|
}
|
|
526
404
|
});
|
|
@@ -534,49 +412,27 @@ export { Control as DesignerControl };
|
|
|
534
412
|
* @param value.type 默认是replace替换,可以更改为push新增
|
|
535
413
|
* */ function updateSetting(settingKey, value) {
|
|
536
414
|
var _this = this;
|
|
537
|
-
var keys = typeof settingKey ===
|
|
415
|
+
var keys = typeof settingKey === 'string' ? [
|
|
538
416
|
settingKey
|
|
539
417
|
] : settingKey;
|
|
540
418
|
keys.forEach(function(key) {
|
|
541
|
-
// @ts-ignore
|
|
542
|
-
if (!Array.isArray(_this.setting)) return;
|
|
543
419
|
// @ts-ignore
|
|
544
420
|
var settingItem = _this.setting.find(function(item) {
|
|
545
421
|
return item.key === key;
|
|
546
422
|
});
|
|
547
423
|
if (settingItem) {
|
|
548
|
-
if (typeof value ===
|
|
424
|
+
if (typeof value === 'boolean') {
|
|
549
425
|
settingItem.visible = value;
|
|
550
|
-
} else if (typeof value ===
|
|
551
|
-
var
|
|
552
|
-
var type = (
|
|
553
|
-
if (type ===
|
|
426
|
+
} else if (typeof value === 'object') {
|
|
427
|
+
var _type;
|
|
428
|
+
var type = (_type = value.type) !== null && _type !== void 0 ? _type : 'replace';
|
|
429
|
+
if (type === 'replace') {
|
|
554
430
|
settingItem.showItems = value.showItems;
|
|
555
431
|
} else {
|
|
556
|
-
var
|
|
557
|
-
(
|
|
432
|
+
var _showItems;
|
|
433
|
+
(_showItems = settingItem.showItems).push.apply(_showItems, _toConsumableArray(value.showItems));
|
|
558
434
|
}
|
|
559
435
|
}
|
|
560
436
|
}
|
|
561
437
|
});
|
|
562
438
|
}
|
|
563
|
-
/**
|
|
564
|
-
* @function 新增控件或者实例上的setting的方法
|
|
565
|
-
* @description 其中的this可能是DesignerControl的类,也可以是实例
|
|
566
|
-
* @param setting 需要新增的setting或者setting项组成的数组
|
|
567
|
-
* */ function addSetting(setting) {
|
|
568
|
-
var // @ts-ignore
|
|
569
|
-
_this_setting;
|
|
570
|
-
var settings = Object.prototype.toString.call(setting) === "[object Object]" ? [
|
|
571
|
-
setting
|
|
572
|
-
] : setting;
|
|
573
|
-
(_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(settings));
|
|
574
|
-
}
|
|
575
|
-
/**
|
|
576
|
-
* @function 新增控件或者实例上的setting的方法
|
|
577
|
-
* @description 其中的this可能是DesignerControl的类,也可以是实例
|
|
578
|
-
* @param setting 需要新增的setting或者setting项组成的数组
|
|
579
|
-
* */ function replaceSetting(setting) {
|
|
580
|
-
// @ts-ignore
|
|
581
|
-
this.setting = setting;
|
|
582
|
-
}
|
|
@@ -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,19 +37,6 @@ 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
|
-
}
|
|
53
40
|
function _getPrototypeOf(o) {
|
|
54
41
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
55
42
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -139,17 +126,17 @@ function _createSuper(Derived) {
|
|
|
139
126
|
return _possibleConstructorReturn(this, result);
|
|
140
127
|
};
|
|
141
128
|
}
|
|
142
|
-
import { BaseStyle } from
|
|
129
|
+
import { BaseStyle } from '../../framework';
|
|
143
130
|
var PropertyRules = function PropertyRules(props) {
|
|
144
131
|
"use strict";
|
|
145
132
|
_classCallCheck(this, PropertyRules);
|
|
146
|
-
|
|
147
|
-
type:
|
|
148
|
-
}
|
|
133
|
+
this.isHide = {
|
|
134
|
+
type: 'boolean'
|
|
135
|
+
};
|
|
149
136
|
};
|
|
150
|
-
var PropertyRuntimeRules = /*#__PURE__*/ function(
|
|
137
|
+
var PropertyRuntimeRules = /*#__PURE__*/ function(Array) {
|
|
151
138
|
"use strict";
|
|
152
|
-
_inherits(PropertyRuntimeRules,
|
|
139
|
+
_inherits(PropertyRuntimeRules, Array);
|
|
153
140
|
var _super = _createSuper(PropertyRuntimeRules);
|
|
154
141
|
function PropertyRuntimeRules(props) {
|
|
155
142
|
_classCallCheck(this, PropertyRuntimeRules);
|
|
@@ -157,32 +144,17 @@ var PropertyRuntimeRules = /*#__PURE__*/ function(Array1) {
|
|
|
157
144
|
}
|
|
158
145
|
return PropertyRuntimeRules;
|
|
159
146
|
}(_wrapNativeSuper(Array));
|
|
160
|
-
|
|
161
|
-
* 全局属性
|
|
162
|
-
* @public
|
|
163
|
-
*/ var Property = function Property(props) {
|
|
147
|
+
var Property = function Property(props) {
|
|
164
148
|
"use strict";
|
|
165
|
-
var caption = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
149
|
+
var caption = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
166
150
|
_classCallCheck(this, Property);
|
|
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;
|
|
151
|
+
var ref;
|
|
152
|
+
this.isHide = (ref = props === null || props === void 0 ? void 0 : props.isHide) !== null && ref !== void 0 ? ref : false;
|
|
181
153
|
this.style = new BaseStyle(props === null || props === void 0 ? void 0 : props.style);
|
|
182
|
-
var
|
|
183
|
-
this.caption = (
|
|
154
|
+
var ref1;
|
|
155
|
+
this.caption = (ref1 = props === null || props === void 0 ? void 0 : props.caption) !== null && ref1 !== void 0 ? ref1 : caption;
|
|
184
156
|
};
|
|
185
|
-
|
|
186
|
-
|
|
157
|
+
Property.Rules = PropertyRules;
|
|
158
|
+
Property.RuntimeRules = PropertyRuntimeRules;
|
|
187
159
|
export default Property;
|
|
188
160
|
export { Property, PropertyRules, PropertyRuntimeRules };
|