@byteluck-fe/model-driven-core 2.4.1-beta.0 → 2.4.1-beta.2
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 +121 -240
- package/dist/esm/common/BaseControl/index.js +7 -7
- package/dist/esm/common/BaseControl/property.js +60 -77
- package/dist/esm/common/BaseControl/runtime.js +24 -45
- package/dist/esm/common/ColumnControl/designer.js +27 -41
- package/dist/esm/common/ColumnControl/index.js +6 -6
- package/dist/esm/common/ColumnControl/property.js +74 -122
- package/dist/esm/common/ColumnControl/runtime.js +27 -41
- package/dist/esm/common/ControlArray.js +20 -20
- package/dist/esm/common/FormControl/designer.js +32 -47
- package/dist/esm/common/FormControl/index.js +6 -6
- package/dist/esm/common/FormControl/property.js +116 -181
- package/dist/esm/common/FormControl/runtime.js +27 -42
- package/dist/esm/common/LayoutControl/designer.js +77 -205
- package/dist/esm/common/LayoutControl/index.js +6 -6
- package/dist/esm/common/LayoutControl/property.js +25 -25
- package/dist/esm/common/LayoutControl/runtime.js +29 -44
- package/dist/esm/common/ListControl/designer.js +74 -199
- package/dist/esm/common/ListControl/index.js +6 -6
- package/dist/esm/common/ListControl/property.js +27 -41
- package/dist/esm/common/ListControl/runtime.js +32 -47
- package/dist/esm/common/SearchViewControl/designer.js +27 -41
- package/dist/esm/common/SearchViewControl/index.js +6 -6
- package/dist/esm/common/SearchViewControl/property.js +26 -40
- package/dist/esm/common/SearchViewControl/runtime.js +27 -41
- package/dist/esm/common/Validator.js +5 -5
- package/dist/esm/common/WrapControl/designer.js +27 -41
- package/dist/esm/common/WrapControl/index.js +6 -6
- package/dist/esm/common/WrapControl/property.js +25 -25
- package/dist/esm/common/WrapControl/runtime.js +27 -41
- package/dist/esm/common/controlHooksEmitter.js +1 -1
- package/dist/esm/common/index.js +11 -11
- package/dist/esm/common/initOptionAndDataSourceRules.js +82 -82
- package/dist/esm/framework/RegisterControls.js +19 -31
- package/dist/esm/framework/index.js +362 -735
- package/dist/esm/index.js +3 -3
- 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/framework/index.d.ts +7 -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';
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
2
|
if (len == null || len > arr.length) len = arr.length;
|
|
3
3
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
4
|
return arr2;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
6
|
+
function _arrayWithHoles(arr) {
|
|
7
7
|
if (Array.isArray(arr)) return arr;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
if (Array.isArray(arr)) return
|
|
9
|
+
function _arrayWithoutHoles(arr) {
|
|
10
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
11
11
|
}
|
|
12
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
13
13
|
try {
|
|
@@ -23,7 +23,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
23
23
|
Promise.resolve(value).then(_next, _throw);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
function
|
|
26
|
+
function _asyncToGenerator(fn) {
|
|
27
27
|
return function() {
|
|
28
28
|
var self = this, args = arguments;
|
|
29
29
|
return new Promise(function(resolve, reject) {
|
|
@@ -38,7 +38,7 @@ function _async_to_generator(fn) {
|
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
function
|
|
41
|
+
function _classCallCheck(instance, Constructor) {
|
|
42
42
|
if (!(instance instanceof Constructor)) {
|
|
43
43
|
throw new TypeError("Cannot call a class as a function");
|
|
44
44
|
}
|
|
@@ -52,12 +52,12 @@ function _defineProperties(target, props) {
|
|
|
52
52
|
Object.defineProperty(target, descriptor.key, descriptor);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
56
56
|
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
57
57
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
58
58
|
return Constructor;
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function _defineProperty(obj, key, value) {
|
|
61
61
|
if (key in obj) {
|
|
62
62
|
Object.defineProperty(obj, key, {
|
|
63
63
|
value: value,
|
|
@@ -72,21 +72,21 @@ function _define_property(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
|
}
|
|
79
79
|
}
|
|
80
|
-
function
|
|
80
|
+
function _iterableToArray(iter) {
|
|
81
81
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function _nonIterableRest() {
|
|
84
84
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function _nonIterableSpread() {
|
|
87
87
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function _objectSpread(target) {
|
|
90
90
|
for(var i = 1; i < arguments.length; i++){
|
|
91
91
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
92
92
|
var ownKeys = Object.keys(source);
|
|
@@ -96,167 +96,65 @@ function _object_spread(target) {
|
|
|
96
96
|
}));
|
|
97
97
|
}
|
|
98
98
|
ownKeys.forEach(function(key) {
|
|
99
|
-
|
|
99
|
+
_defineProperty(target, key, source[key]);
|
|
100
100
|
});
|
|
101
101
|
}
|
|
102
102
|
return target;
|
|
103
103
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
104
|
+
function _toArray(arr) {
|
|
105
|
+
return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
106
106
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
107
|
+
function _toConsumableArray(arr) {
|
|
108
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
111
111
|
if (!o) return;
|
|
112
|
-
if (typeof o === "string") return
|
|
112
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
113
113
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
114
114
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
115
115
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
116
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return
|
|
116
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _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
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
_define_property(this, "fieldType", void 0);
|
|
231
|
-
_define_property(this, "eventKeys", []);
|
|
232
|
-
_define_property(this, "customEvents", []);
|
|
233
|
-
_define_property(this, "parent", null);
|
|
234
|
-
_define_property(this, "updateSetting", updateSetting);
|
|
235
|
-
_define_property(this, "removeSetting", removeSetting);
|
|
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;
|
|
127
|
+
_classCallCheck(this, Control);
|
|
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;
|
|
238
136
|
if (!(controlName && controlIcon && controlType)) {
|
|
239
137
|
referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
|
|
240
138
|
}
|
|
241
|
-
var
|
|
242
|
-
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);
|
|
243
141
|
this.name = controlName;
|
|
244
142
|
this.icon = controlIcon;
|
|
245
|
-
var
|
|
246
|
-
this.type = (
|
|
143
|
+
var ref2;
|
|
144
|
+
this.type = (ref2 = props === null || props === void 0 ? void 0 : props.type) !== null && ref2 !== void 0 ? ref2 : controlType;
|
|
247
145
|
this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
|
|
248
|
-
var
|
|
249
|
-
this.controlType = (
|
|
146
|
+
var ref3;
|
|
147
|
+
this.controlType = (ref3 = props === null || props === void 0 ? void 0 : props.controlType) !== null && ref3 !== void 0 ? ref3 : 'base';
|
|
250
148
|
this.setting = JSONCopy(setting);
|
|
251
|
-
var
|
|
252
|
-
this.fieldType = (
|
|
149
|
+
var ref4;
|
|
150
|
+
this.fieldType = (ref4 = props === null || props === void 0 ? void 0 : props.fieldType) !== null && ref4 !== void 0 ? ref4 : controlFieldType;
|
|
253
151
|
this.eventKeys = JSONCopy(controlEventKeys);
|
|
254
152
|
this.customEvents = JSONCopy(controlCustomEvents);
|
|
255
153
|
Promise.resolve().then(function() {
|
|
256
|
-
_this._callControlHooks(
|
|
154
|
+
_this._callControlHooks('postInstance', props);
|
|
257
155
|
});
|
|
258
156
|
}
|
|
259
|
-
|
|
157
|
+
_createClass(Control, [
|
|
260
158
|
{
|
|
261
159
|
key: "rules",
|
|
262
160
|
get: function get() {
|
|
@@ -274,25 +172,25 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
274
172
|
args[_key] = arguments[_key];
|
|
275
173
|
}
|
|
276
174
|
var _controlHooksEmitter;
|
|
277
|
-
var _args =
|
|
175
|
+
var _args = _toArray(args), key = _args[0], arg = _args.slice(1);
|
|
278
176
|
return (_controlHooksEmitter = controlHooksEmitter).emit.apply(_controlHooksEmitter, [
|
|
279
177
|
key,
|
|
280
178
|
this
|
|
281
|
-
].concat(
|
|
179
|
+
].concat(_toConsumableArray(arg)));
|
|
282
180
|
}
|
|
283
181
|
},
|
|
284
182
|
{
|
|
285
183
|
key: "preUpdate",
|
|
286
184
|
value: function preUpdate(key, value) {
|
|
287
185
|
// 在修改props之前
|
|
288
|
-
this._callControlHooks(
|
|
186
|
+
this._callControlHooks('preUpdateProps', key, value);
|
|
289
187
|
}
|
|
290
188
|
},
|
|
291
189
|
{
|
|
292
190
|
key: "postUpdate",
|
|
293
191
|
value: function postUpdate(key, value) {
|
|
294
192
|
// 在修改props之后
|
|
295
|
-
this._callControlHooks(
|
|
193
|
+
this._callControlHooks('postUpdateProps', key, value);
|
|
296
194
|
}
|
|
297
195
|
},
|
|
298
196
|
{
|
|
@@ -308,26 +206,24 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
308
206
|
key: "preValidate",
|
|
309
207
|
value: function preValidate() {
|
|
310
208
|
var _this = this;
|
|
311
|
-
return
|
|
209
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
312
210
|
var rules, results, result;
|
|
313
|
-
return
|
|
314
|
-
switch(
|
|
211
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
212
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
315
213
|
case 0:
|
|
316
|
-
rules =
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
case 1:
|
|
322
|
-
results = _state.sent();
|
|
214
|
+
rules = _objectSpread({}, _this.rules);
|
|
215
|
+
_ctx.next = 3;
|
|
216
|
+
return _this._callControlHooks('preValidate', rules);
|
|
217
|
+
case 3:
|
|
218
|
+
results = _ctx.sent;
|
|
323
219
|
result = results[results.length - 1];
|
|
324
|
-
return
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
220
|
+
return _ctx.abrupt("return", result === false ? undefined : result);
|
|
221
|
+
case 6:
|
|
222
|
+
case "end":
|
|
223
|
+
return _ctx.stop();
|
|
328
224
|
}
|
|
329
|
-
});
|
|
330
|
-
})();
|
|
225
|
+
}, _callee);
|
|
226
|
+
}))();
|
|
331
227
|
}
|
|
332
228
|
},
|
|
333
229
|
{
|
|
@@ -335,18 +231,16 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
335
231
|
value: // property校验
|
|
336
232
|
function validate(messages, ignore) {
|
|
337
233
|
var _this = this;
|
|
338
|
-
return
|
|
339
|
-
var result, rules, validator
|
|
340
|
-
return
|
|
341
|
-
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){
|
|
342
238
|
case 0:
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
result = _state.sent();
|
|
349
|
-
rules = result !== undefined ? result : _object_spread({}, _this.rules);
|
|
239
|
+
_ctx.next = 2;
|
|
240
|
+
return _this.preValidate();
|
|
241
|
+
case 2:
|
|
242
|
+
result = _ctx.sent;
|
|
243
|
+
rules = result !== undefined ? result : _objectSpread({}, _this.rules);
|
|
350
244
|
if (Array.isArray(ignore)) {
|
|
351
245
|
ignore.forEach(function(key) {
|
|
352
246
|
if (rules.hasOwnProperty(key)) {
|
|
@@ -355,37 +249,29 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
355
249
|
});
|
|
356
250
|
}
|
|
357
251
|
validator = createValidator(rules, messages);
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
]);
|
|
366
|
-
|
|
367
|
-
|
|
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;
|
|
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;
|
|
380
262
|
}
|
|
381
|
-
throw
|
|
382
|
-
case
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
];
|
|
263
|
+
throw _ctx.t0;
|
|
264
|
+
case 16:
|
|
265
|
+
case "end":
|
|
266
|
+
return _ctx.stop();
|
|
386
267
|
}
|
|
387
|
-
}
|
|
388
|
-
|
|
268
|
+
}, _callee, null, [
|
|
269
|
+
[
|
|
270
|
+
6,
|
|
271
|
+
12
|
|
272
|
+
]
|
|
273
|
+
]);
|
|
274
|
+
}))();
|
|
389
275
|
}
|
|
390
276
|
},
|
|
391
277
|
{
|
|
@@ -395,7 +281,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
395
281
|
var fieldType = this.fieldType;
|
|
396
282
|
var controlId = this.id;
|
|
397
283
|
var type = this.type;
|
|
398
|
-
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;
|
|
399
285
|
if (!fieldType && !dataBind && !datasourceBind) return;
|
|
400
286
|
var dataBindModelType = {
|
|
401
287
|
parentId: parentId,
|
|
@@ -409,13 +295,13 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
409
295
|
dataBindModelType.dataBind = dataBind;
|
|
410
296
|
}
|
|
411
297
|
switch(optionConfig){
|
|
412
|
-
case
|
|
298
|
+
case 'datasource':
|
|
413
299
|
case undefined:
|
|
414
300
|
if (datasourceBind) {
|
|
415
301
|
dataBindModelType.datasourceBind = datasourceBind;
|
|
416
302
|
}
|
|
417
303
|
break;
|
|
418
|
-
case
|
|
304
|
+
case 'custom':
|
|
419
305
|
dataBindModelType.props.options = options;
|
|
420
306
|
break;
|
|
421
307
|
}
|
|
@@ -438,7 +324,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
438
324
|
key: "preToSchema",
|
|
439
325
|
value: function preToSchema() {
|
|
440
326
|
// 在处理Schema之前,预留的钩子函数,允许在toSchema之前处理一些数据
|
|
441
|
-
this._callControlHooks(
|
|
327
|
+
this._callControlHooks('preToSchema', this);
|
|
442
328
|
}
|
|
443
329
|
},
|
|
444
330
|
{
|
|
@@ -458,10 +344,10 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
458
344
|
{
|
|
459
345
|
key: "updateBasicControl",
|
|
460
346
|
value: function updateBasicControl(key, setting) {
|
|
461
|
-
if (key !==
|
|
347
|
+
if (key !== 'setting') return;
|
|
462
348
|
if (setting.add) {
|
|
463
|
-
var
|
|
464
|
-
(
|
|
349
|
+
var _setting;
|
|
350
|
+
(_setting = this.setting).push.apply(_setting, _toConsumableArray(setting.add));
|
|
465
351
|
}
|
|
466
352
|
if (setting.remove) {
|
|
467
353
|
this.removeSettingItem(setting.remove);
|
|
@@ -474,20 +360,15 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
474
360
|
]);
|
|
475
361
|
return Control;
|
|
476
362
|
}();
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
_define_property(Control, "__is_control__", true);
|
|
487
|
-
// 删除指定的settingItem
|
|
488
|
-
_define_property(Control, "removeSettingItem", removeSetting);
|
|
489
|
-
// 修改指定的settingItem的visible
|
|
490
|
-
_define_property(Control, "updateSettingItem", updateSetting);
|
|
363
|
+
Control.controlName = '控件';
|
|
364
|
+
Control.controlIcon = 'icon';
|
|
365
|
+
Control.controlType = 'control';
|
|
366
|
+
Control.controlEventKeys = [];
|
|
367
|
+
Control.controlCustomEvents = [];
|
|
368
|
+
Control.setting = [];
|
|
369
|
+
Control.__is_control__ = true;
|
|
370
|
+
Control.removeSettingItem = removeSetting;
|
|
371
|
+
Control.updateSettingItem = updateSetting;
|
|
491
372
|
export default Control;
|
|
492
373
|
export { Control as DesignerControl };
|
|
493
374
|
/**
|
|
@@ -501,20 +382,20 @@ export { Control as DesignerControl };
|
|
|
501
382
|
];
|
|
502
383
|
deleteKeys.forEach(function(deleteKey) {
|
|
503
384
|
// 是否存在子项
|
|
504
|
-
var isHasItem = typeof deleteKey !==
|
|
385
|
+
var isHasItem = typeof deleteKey !== 'string';
|
|
505
386
|
// @ts-ignore
|
|
506
387
|
var settingIndex = _this.setting.findIndex(function(option) {
|
|
507
388
|
return option.key === (isHasItem ? deleteKey.key : deleteKey);
|
|
508
389
|
});
|
|
509
390
|
// 移除对应选项
|
|
510
391
|
if (settingIndex !== -1) {
|
|
511
|
-
var
|
|
512
|
-
isHasItem ? _this.setting[settingIndex].showItems = (
|
|
392
|
+
var ref, ref5;
|
|
393
|
+
isHasItem ? _this.setting[settingIndex].showItems = (ref = _this.setting[settingIndex].showItems) === null || ref === void 0 ? void 0 : ref.filter(function(item) {
|
|
513
394
|
return !deleteKey.hideItems.includes(item);
|
|
514
395
|
}) : _this.setting.splice(settingIndex, 1);
|
|
515
396
|
// 子项长度为0,自动移除当前设置项
|
|
516
397
|
isHasItem && // @ts-ignore
|
|
517
|
-
!((
|
|
398
|
+
!((ref5 = _this.setting[settingIndex].showItems) === null || ref5 === void 0 ? void 0 : ref5.length) && // @ts-ignore
|
|
518
399
|
_this.setting.splice(settingIndex, 1);
|
|
519
400
|
}
|
|
520
401
|
});
|
|
@@ -528,7 +409,7 @@ export { Control as DesignerControl };
|
|
|
528
409
|
* @param value.type 默认是replace替换,可以更改为push新增
|
|
529
410
|
* */ function updateSetting(settingKey, value) {
|
|
530
411
|
var _this = this;
|
|
531
|
-
var keys = typeof settingKey ===
|
|
412
|
+
var keys = typeof settingKey === 'string' ? [
|
|
532
413
|
settingKey
|
|
533
414
|
] : settingKey;
|
|
534
415
|
keys.forEach(function(key) {
|
|
@@ -537,16 +418,16 @@ export { Control as DesignerControl };
|
|
|
537
418
|
return item.key === key;
|
|
538
419
|
});
|
|
539
420
|
if (settingItem) {
|
|
540
|
-
if (typeof value ===
|
|
421
|
+
if (typeof value === 'boolean') {
|
|
541
422
|
settingItem.visible = value;
|
|
542
|
-
} else if (typeof value ===
|
|
543
|
-
var
|
|
544
|
-
var type = (
|
|
545
|
-
if (type ===
|
|
423
|
+
} else if (typeof value === 'object') {
|
|
424
|
+
var _type;
|
|
425
|
+
var type = (_type = value.type) !== null && _type !== void 0 ? _type : 'replace';
|
|
426
|
+
if (type === 'replace') {
|
|
546
427
|
settingItem.showItems = value.showItems;
|
|
547
428
|
} else {
|
|
548
|
-
var
|
|
549
|
-
(
|
|
429
|
+
var _showItems;
|
|
430
|
+
(_showItems = settingItem.showItems).push.apply(_showItems, _toConsumableArray(value.showItems));
|
|
550
431
|
}
|
|
551
432
|
}
|
|
552
433
|
}
|
|
@@ -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';
|