@byteluck-fe/model-driven-core 2.7.0-alpha.28a → 2.7.0-alpha.31b

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.
Files changed (83) hide show
  1. package/README.md +69 -69
  2. package/dist/esm/api-doc-index.js +4 -4
  3. package/dist/esm/common/BaseControl/designer.js +136 -257
  4. package/dist/esm/common/BaseControl/index.js +7 -7
  5. package/dist/esm/common/BaseControl/property.js +61 -80
  6. package/dist/esm/common/BaseControl/runtime.js +26 -48
  7. package/dist/esm/common/ColumnControl/designer.js +28 -43
  8. package/dist/esm/common/ColumnControl/index.js +6 -6
  9. package/dist/esm/common/ColumnControl/property.js +80 -129
  10. package/dist/esm/common/ColumnControl/runtime.js +28 -43
  11. package/dist/esm/common/ControlArray.js +21 -21
  12. package/dist/esm/common/FormControl/designer.js +33 -49
  13. package/dist/esm/common/FormControl/index.js +6 -6
  14. package/dist/esm/common/FormControl/property.js +119 -185
  15. package/dist/esm/common/FormControl/runtime.js +28 -44
  16. package/dist/esm/common/LayoutControl/designer.js +78 -207
  17. package/dist/esm/common/LayoutControl/index.js +6 -6
  18. package/dist/esm/common/LayoutControl/property.js +25 -25
  19. package/dist/esm/common/LayoutControl/runtime.js +30 -46
  20. package/dist/esm/common/ListControl/designer.js +76 -202
  21. package/dist/esm/common/ListControl/index.js +6 -6
  22. package/dist/esm/common/ListControl/property.js +28 -44
  23. package/dist/esm/common/ListControl/runtime.js +32 -48
  24. package/dist/esm/common/SearchViewControl/designer.js +28 -43
  25. package/dist/esm/common/SearchViewControl/index.js +6 -6
  26. package/dist/esm/common/SearchViewControl/property.js +27 -42
  27. package/dist/esm/common/SearchViewControl/runtime.js +28 -43
  28. package/dist/esm/common/Validator.js +5 -5
  29. package/dist/esm/common/WrapControl/designer.js +28 -43
  30. package/dist/esm/common/WrapControl/index.js +6 -6
  31. package/dist/esm/common/WrapControl/property.js +25 -25
  32. package/dist/esm/common/WrapControl/runtime.js +28 -43
  33. package/dist/esm/common/controlHooksEmitter.js +1 -1
  34. package/dist/esm/common/index.js +12 -12
  35. package/dist/esm/common/initLinkOperationRules.js +6 -6
  36. package/dist/esm/common/initOptionAndDataSourceRules.js +82 -82
  37. package/dist/esm/framework/RegisterControls.js +41 -37
  38. package/dist/esm/framework/index.js +515 -993
  39. package/dist/esm/framework/isDataBind.js +1 -2
  40. package/dist/esm/index.js +4 -4
  41. package/dist/index.umd.js +1 -1
  42. package/dist/types/api-doc-index.d.ts +4 -4
  43. package/dist/types/common/BaseControl/designer.d.ts +63 -63
  44. package/dist/types/common/BaseControl/index.d.ts +13 -13
  45. package/dist/types/common/BaseControl/property.d.ts +38 -38
  46. package/dist/types/common/BaseControl/runtime.d.ts +23 -23
  47. package/dist/types/common/BaseControl/types.d.ts +35 -35
  48. package/dist/types/common/ColumnControl/designer.d.ts +10 -10
  49. package/dist/types/common/ColumnControl/index.d.ts +12 -12
  50. package/dist/types/common/ColumnControl/property.d.ts +73 -73
  51. package/dist/types/common/ColumnControl/runtime.d.ts +10 -10
  52. package/dist/types/common/ControlArray.d.ts +9 -9
  53. package/dist/types/common/FormControl/designer.d.ts +13 -13
  54. package/dist/types/common/FormControl/index.d.ts +12 -12
  55. package/dist/types/common/FormControl/property.d.ts +100 -100
  56. package/dist/types/common/FormControl/runtime.d.ts +11 -11
  57. package/dist/types/common/LayoutControl/designer.d.ts +21 -21
  58. package/dist/types/common/LayoutControl/index.d.ts +12 -12
  59. package/dist/types/common/LayoutControl/property.d.ts +6 -6
  60. package/dist/types/common/LayoutControl/runtime.d.ts +11 -11
  61. package/dist/types/common/ListControl/designer.d.ts +16 -16
  62. package/dist/types/common/ListControl/index.d.ts +12 -12
  63. package/dist/types/common/ListControl/property.d.ts +14 -14
  64. package/dist/types/common/ListControl/runtime.d.ts +12 -12
  65. package/dist/types/common/SearchViewControl/designer.d.ts +11 -11
  66. package/dist/types/common/SearchViewControl/index.d.ts +12 -12
  67. package/dist/types/common/SearchViewControl/property.d.ts +8 -8
  68. package/dist/types/common/SearchViewControl/runtime.d.ts +11 -11
  69. package/dist/types/common/Validator.d.ts +15 -15
  70. package/dist/types/common/WrapControl/designer.d.ts +11 -11
  71. package/dist/types/common/WrapControl/index.d.ts +12 -12
  72. package/dist/types/common/WrapControl/property.d.ts +6 -6
  73. package/dist/types/common/WrapControl/runtime.d.ts +11 -11
  74. package/dist/types/common/controlHooksEmitter.d.ts +4 -4
  75. package/dist/types/common/index.d.ts +12 -12
  76. package/dist/types/common/initLinkOperationRules.d.ts +6 -6
  77. package/dist/types/common/initOptionAndDataSourceRules.d.ts +10 -10
  78. package/dist/types/framework/RegisterControls.d.ts +37 -36
  79. package/dist/types/framework/index.d.ts +844 -844
  80. package/dist/types/framework/isDataBind.d.ts +2 -2
  81. package/dist/types/index.d.ts +4 -4
  82. package/dist/types/type.d.ts +91 -91
  83. package/package.json +2 -2
@@ -1,13 +1,13 @@
1
- function _array_like_to_array(arr, len) {
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 _array_with_holes(arr) {
6
+ function _arrayWithHoles(arr) {
7
7
  if (Array.isArray(arr)) return arr;
8
8
  }
9
- function _array_without_holes(arr) {
10
- if (Array.isArray(arr)) return _array_like_to_array(arr);
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 _async_to_generator(fn) {
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 _class_call_check(instance, Constructor) {
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 _create_class(Constructor, protoProps, staticProps) {
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 _define_property(obj, key, value) {
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 !!right[Symbol.hasInstance](left);
75
+ return right[Symbol.hasInstance](left);
76
76
  } else {
77
77
  return left instanceof right;
78
78
  }
79
79
  }
80
- function _iterable_to_array(iter) {
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 _non_iterable_rest() {
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 _non_iterable_spread() {
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 _object_spread(target) {
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,168 +96,65 @@ function _object_spread(target) {
96
96
  }));
97
97
  }
98
98
  ownKeys.forEach(function(key) {
99
- _define_property(target, key, source[key]);
99
+ _defineProperty(target, key, source[key]);
100
100
  });
101
101
  }
102
102
  return target;
103
103
  }
104
- function _to_array(arr) {
105
- return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
104
+ function _toArray(arr) {
105
+ return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
106
106
  }
107
- function _to_consumable_array(arr) {
108
- return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
107
+ function _toConsumableArray(arr) {
108
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
109
109
  }
110
- function _unsupported_iterable_to_array(o, minLen) {
110
+ function _unsupportedIterableToArray(o, minLen) {
111
111
  if (!o) return;
112
- if (typeof o === "string") return _array_like_to_array(o, minLen);
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 _array_like_to_array(o, minLen);
116
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
117
117
  }
118
- function _ts_generator(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";
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
- _class_call_check(this, Control);
222
- var _props, _props1, _props2, _props3, _props4;
223
- _define_property(this, "id", void 0 // 唯一标识符
224
- );
225
- _define_property(this, "name", void 0);
226
- _define_property(this, "icon", void 0);
227
- _define_property(this, "type", void 0);
228
- _define_property(this, "controlType", void 0);
229
- _define_property(this, "props", void 0);
230
- _define_property(this, "setting", []);
231
- _define_property(this, "fieldType", void 0);
232
- _define_property(this, "eventKeys", []);
233
- _define_property(this, "customEvents", []);
234
- _define_property(this, "parent", null);
235
- _define_property(this, "updateSetting", updateSetting);
236
- _define_property(this, "removeSetting", removeSetting);
237
- this._callControlHooks("preInstance", props);
238
- 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;
239
136
  if (!(controlName && controlIcon && controlType)) {
240
137
  referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
241
138
  }
242
- var _props_id;
243
- this.id = (_props_id = (_props = props) === null || _props === void 0 ? void 0 : _props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
139
+ var ref1;
140
+ this.id = (ref1 = props === null || props === void 0 ? void 0 : props.id) !== null && ref1 !== void 0 ? ref1 : genNonDuplicateId(10);
244
141
  this.name = controlName;
245
142
  this.icon = controlIcon;
246
- var _props_type;
247
- this.type = (_props_type = (_props1 = props) === null || _props1 === void 0 ? void 0 : _props1.type) !== null && _props_type !== void 0 ? _props_type : controlType;
248
- this.props = new Property((_props2 = props) === null || _props2 === void 0 ? void 0 : _props2.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
249
- var _props_controlType;
250
- this.controlType = (_props_controlType = (_props3 = props) === null || _props3 === void 0 ? void 0 : _props3.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
143
+ var ref2;
144
+ this.type = (ref2 = props === null || props === void 0 ? void 0 : props.type) !== null && ref2 !== void 0 ? ref2 : controlType;
145
+ this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
146
+ var ref3;
147
+ this.controlType = (ref3 = props === null || props === void 0 ? void 0 : props.controlType) !== null && ref3 !== void 0 ? ref3 : 'base';
251
148
  this.setting = JSONCopy(setting);
252
- var _props_fieldType;
253
- this.fieldType = (_props_fieldType = (_props4 = props) === null || _props4 === void 0 ? void 0 : _props4.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
149
+ var ref4;
150
+ this.fieldType = (ref4 = props === null || props === void 0 ? void 0 : props.fieldType) !== null && ref4 !== void 0 ? ref4 : controlFieldType;
254
151
  this.eventKeys = JSONCopy(controlEventKeys);
255
152
  this.customEvents = JSONCopy(controlCustomEvents);
256
153
  Promise.resolve().then(function() {
257
- _this._callControlHooks("postInstance", props);
154
+ _this._callControlHooks('postInstance', props);
258
155
  });
259
156
  }
260
- _create_class(Control, [
157
+ _createClass(Control, [
261
158
  {
262
159
  key: "rules",
263
160
  get: function get() {
@@ -275,25 +172,25 @@ var Control = /*#__PURE__*/ function _target() {
275
172
  args[_key] = arguments[_key];
276
173
  }
277
174
  var _controlHooksEmitter;
278
- var _args = _to_array(args), key = _args[0], arg = _args.slice(1);
175
+ var _args = _toArray(args), key = _args[0], arg = _args.slice(1);
279
176
  return (_controlHooksEmitter = controlHooksEmitter).emit.apply(_controlHooksEmitter, [
280
177
  key,
281
178
  this
282
- ].concat(_to_consumable_array(arg)));
179
+ ].concat(_toConsumableArray(arg)));
283
180
  }
284
181
  },
285
182
  {
286
183
  key: "preUpdate",
287
184
  value: function preUpdate(key, value) {
288
185
  // 在修改props之前
289
- this._callControlHooks("preUpdateProps", key, value);
186
+ this._callControlHooks('preUpdateProps', key, value);
290
187
  }
291
188
  },
292
189
  {
293
190
  key: "postUpdate",
294
191
  value: function postUpdate(key, value) {
295
192
  // 在修改props之后
296
- this._callControlHooks("postUpdateProps", key, value);
193
+ this._callControlHooks('postUpdateProps', key, value);
297
194
  }
298
195
  },
299
196
  {
@@ -309,27 +206,24 @@ var Control = /*#__PURE__*/ function _target() {
309
206
  key: "preValidate",
310
207
  value: function preValidate() {
311
208
  var _this = this;
312
- return _async_to_generator(function() {
209
+ return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
313
210
  var rules, results, result;
314
- return _ts_generator(this, function(_state) {
315
- switch(_state.label){
211
+ return regeneratorRuntime.wrap(function _callee$(_ctx) {
212
+ while(1)switch(_ctx.prev = _ctx.next){
316
213
  case 0:
317
- // 在处理validate之前,预留的钩子函数,允许在validate之前处理一些数据
318
- rules = _object_spread({}, _this.rules);
319
- return [
320
- 4,
321
- _this._callControlHooks("preValidate", rules)
322
- ];
323
- case 1:
324
- 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;
325
219
  result = results[results.length - 1];
326
- return [
327
- 2,
328
- result === false ? undefined : result
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,18 +231,16 @@ var Control = /*#__PURE__*/ function _target() {
337
231
  value: // property校验
338
232
  function validate(messages, ignore) {
339
233
  var _this = this;
340
- return _async_to_generator(function() {
341
- var result, rules, validator, err;
342
- return _ts_generator(this, function(_state) {
343
- switch(_state.label){
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
- return [
346
- 4,
347
- _this.preValidate()
348
- ];
349
- case 1:
350
- result = _state.sent();
351
- 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);
352
244
  if (Array.isArray(ignore)) {
353
245
  ignore.forEach(function(key) {
354
246
  if (rules.hasOwnProperty(key)) {
@@ -357,37 +249,29 @@ var Control = /*#__PURE__*/ function _target() {
357
249
  });
358
250
  }
359
251
  validator = createValidator(rules, messages);
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;
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 err;
384
- case 5:
385
- return [
386
- 2
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 _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;
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 "datasource":
298
+ case 'datasource':
415
299
  case undefined:
416
300
  if (datasourceBind) {
417
301
  dataBindModelType.datasourceBind = datasourceBind;
418
302
  }
419
303
  break;
420
- case "custom":
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("preToSchema", this);
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 !== "setting") return;
347
+ if (key !== 'setting') return;
464
348
  if (setting.add) {
465
- var _this_setting;
466
- (_this_setting = this.setting).push.apply(_this_setting, _to_consumable_array(setting.add));
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,64 +360,59 @@ var Control = /*#__PURE__*/ function _target() {
476
360
  ]);
477
361
  return Control;
478
362
  }();
479
- _define_property(Control, "mode", "Designer");
480
- _define_property(Control, "controlName", "控件");
481
- _define_property(Control, "controlIcon", "icon");
482
- _define_property(Control, "controlType", "control");
483
- _define_property(Control, "controlFieldType", void 0);
484
- // 控件可以触发的事件key
485
- _define_property(Control, "controlEventKeys", []);
486
- _define_property(Control, "controlCustomEvents", []);
487
- // setting应该是全量的设置项,外部控制,在初始化的时候会deepCopy一份
488
- _define_property(Control, "setting", []);
489
- _define_property(Control, "__is_control__", true);
490
- // 删除指定的settingItem
491
- _define_property(Control, "removeSettingItem", removeSetting);
492
- // 修改指定的settingItem的visible
493
- _define_property(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;
494
373
  export default Control;
495
374
  export { Control as DesignerControl };
496
- /**
497
- * @function 删除控件或者实例上的setting的方法
498
- * @description 其中的this可能是DesignerControl的类,也可以是实例
499
- * @param keys 需要删除的key或key组成的数组
375
+ /**
376
+ * @function 删除控件或者实例上的setting的方法
377
+ * @description 其中的this可能是DesignerControl的类,也可以是实例
378
+ * @param keys 需要删除的key或key组成的数组
500
379
  * */ function removeSetting(keys) {
501
380
  var _this = this;
502
381
  var deleteKeys = Array.isArray(keys) ? keys : [
503
382
  keys
504
383
  ];
505
384
  deleteKeys.forEach(function(deleteKey) {
506
- var _this_setting;
385
+ var ref;
507
386
  // 是否存在子项
508
- var isHasItem = typeof deleteKey !== "string";
387
+ var isHasItem = typeof deleteKey !== 'string';
509
388
  // 判断setting是否是自定义控件setting项
510
389
  // @ts-ignore
511
- 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) {
512
391
  return option.key === (isHasItem ? deleteKey.key : deleteKey);
513
392
  });
514
393
  // 移除对应选项
515
394
  if (settingIndex !== -1) {
516
- var _this_setting_settingIndex_showItems, _this_setting_settingIndex_showItems1;
517
- 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) {
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) {
518
397
  return !deleteKey.hideItems.includes(item);
519
398
  }) : _this.setting.splice(settingIndex, 1);
520
399
  // 子项长度为0,自动移除当前设置项
521
400
  isHasItem && // @ts-ignore
522
- !((_this_setting_settingIndex_showItems1 = _this.setting[settingIndex].showItems) === null || _this_setting_settingIndex_showItems1 === void 0 ? void 0 : _this_setting_settingIndex_showItems1.length) && // @ts-ignore
401
+ !((ref6 = _this.setting[settingIndex].showItems) === null || ref6 === void 0 ? void 0 : ref6.length) && // @ts-ignore
523
402
  _this.setting.splice(settingIndex, 1);
524
403
  }
525
404
  });
526
405
  }
527
- /**
528
- * @function 修改控件或者实例上的setting的方法
529
- * @description 其中的this可能是DesignerControl的类,也可以是实例
530
- * @param settingKey 需要修改的key或者key组成的数组
531
- * @param value 修改之后的visible值
532
- * @param value.showItems 需要添加或替换的showItems
533
- * @param value.type 默认是replace替换,可以更改为push新增
406
+ /**
407
+ * @function 修改控件或者实例上的setting的方法
408
+ * @description 其中的this可能是DesignerControl的类,也可以是实例
409
+ * @param settingKey 需要修改的key或者key组成的数组
410
+ * @param value 修改之后的visible值
411
+ * @param value.showItems 需要添加或替换的showItems
412
+ * @param value.type 默认是replace替换,可以更改为push新增
534
413
  * */ function updateSetting(settingKey, value) {
535
414
  var _this = this;
536
- var keys = typeof settingKey === "string" ? [
415
+ var keys = typeof settingKey === 'string' ? [
537
416
  settingKey
538
417
  ] : settingKey;
539
418
  keys.forEach(function(key) {
@@ -542,16 +421,16 @@ export { Control as DesignerControl };
542
421
  return item.key === key;
543
422
  });
544
423
  if (settingItem) {
545
- if (typeof value === "boolean") {
424
+ if (typeof value === 'boolean') {
546
425
  settingItem.visible = value;
547
- } else if (typeof value === "object") {
548
- var _value_type;
549
- var type = (_value_type = value.type) !== null && _value_type !== void 0 ? _value_type : "replace";
550
- if (type === "replace") {
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') {
551
430
  settingItem.showItems = value.showItems;
552
431
  } else {
553
- var _settingItem_showItems;
554
- (_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems, _to_consumable_array(value.showItems));
432
+ var _showItems;
433
+ (_showItems = settingItem.showItems).push.apply(_showItems, _toConsumableArray(value.showItems));
555
434
  }
556
435
  }
557
436
  }
@@ -1,12 +1,12 @@
1
- import Designer from "./designer";
2
- import Runtime from "./runtime";
3
- import Property from "./property";
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 "./designer";
10
- export * from "./runtime";
11
- export * from "./property";
12
- export * from "./types";
9
+ export * from './designer';
10
+ export * from './runtime';
11
+ export * from './property';
12
+ export * from './types';