@byteluck-fe/model-driven-core 1.8.0-beta.3 → 1.8.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.
@@ -226,22 +226,22 @@ var Control = /*#__PURE__*/ function _target() {
226
226
  this.updateSetting = updateSetting;
227
227
  this.removeSetting = removeSetting;
228
228
  this._callControlHooks("preInstance", props);
229
- 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;
229
+ 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;
230
230
  if (!(controlName && controlIcon && controlType)) {
231
231
  referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
232
232
  }
233
- var ref1;
234
- this.id = (ref1 = props === null || props === void 0 ? void 0 : props.id) !== null && ref1 !== void 0 ? ref1 : genNonDuplicateId(10);
233
+ var _props_id;
234
+ this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
235
235
  this.name = controlName;
236
236
  this.icon = controlIcon;
237
- var ref2;
238
- this.type = (ref2 = props === null || props === void 0 ? void 0 : props.type) !== null && ref2 !== void 0 ? ref2 : controlType;
237
+ var _props_type;
238
+ this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : controlType;
239
239
  this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
240
- var ref3;
241
- this.controlType = (ref3 = props === null || props === void 0 ? void 0 : props.controlType) !== null && ref3 !== void 0 ? ref3 : "base";
240
+ var _props_controlType;
241
+ this.controlType = (_props_controlType = props === null || props === void 0 ? void 0 : props.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
242
242
  this.setting = JSONCopy(setting);
243
- var ref4;
244
- this.fieldType = (ref4 = props === null || props === void 0 ? void 0 : props.fieldType) !== null && ref4 !== void 0 ? ref4 : controlFieldType;
243
+ var _props_fieldType;
244
+ this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
245
245
  this.eventKeys = JSONCopy(controlEventKeys);
246
246
  this.customEvents = JSONCopy(controlCustomEvents);
247
247
  Promise.resolve().then(function() {
@@ -357,7 +357,7 @@ var Control = /*#__PURE__*/ function _target() {
357
357
  var fieldType = this.fieldType;
358
358
  var controlId = this.id;
359
359
  var type = this.type;
360
- 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;
360
+ 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;
361
361
  if (!fieldType && !dataBind && !datasourceBind) return;
362
362
  var dataBindModelType = {
363
363
  parentId: parentId,
@@ -412,8 +412,8 @@ var Control = /*#__PURE__*/ function _target() {
412
412
  Control.updateBasicControl = function updateBasicControl(key, setting) {
413
413
  if (key !== "setting") return;
414
414
  if (setting.add) {
415
- var _setting;
416
- (_setting = this.setting).push.apply(_setting, _toConsumableArray(setting.add));
415
+ var _this_setting;
416
+ (_this_setting = this.setting).push.apply(_this_setting, _toConsumableArray(setting.add));
417
417
  }
418
418
  if (setting.remove) {
419
419
  this.removeSettingItem(setting.remove);
@@ -469,13 +469,13 @@ export { Control as DesignerControl };
469
469
  });
470
470
  // 移除对应选项
471
471
  if (settingIndex !== -1) {
472
- var ref, ref1;
473
- isHasItem ? _this.setting[settingIndex].showItems = (ref = _this.setting[settingIndex].showItems) === null || ref === void 0 ? void 0 : ref.filter(function(item) {
472
+ var _this_setting_settingIndex_showItems, _this_setting_settingIndex_showItems1;
473
+ 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) {
474
474
  return !deleteKey.hideItems.includes(item);
475
475
  }) : _this.setting.splice(settingIndex, 1);
476
476
  // 子项长度为0,自动移除当前设置项
477
477
  isHasItem && // @ts-ignore
478
- !((ref1 = _this.setting[settingIndex].showItems) === null || ref1 === void 0 ? void 0 : ref1.length) && // @ts-ignore
478
+ !((_this_setting_settingIndex_showItems1 = _this.setting[settingIndex].showItems) === null || _this_setting_settingIndex_showItems1 === void 0 ? void 0 : _this_setting_settingIndex_showItems1.length) && // @ts-ignore
479
479
  _this.setting.splice(settingIndex, 1);
480
480
  }
481
481
  });
@@ -501,13 +501,13 @@ export { Control as DesignerControl };
501
501
  if (typeof value === "boolean") {
502
502
  settingItem.visible = value;
503
503
  } else if (typeof value === "object") {
504
- var _type;
505
- var type = (_type = value.type) !== null && _type !== void 0 ? _type : "replace";
504
+ var _value_type;
505
+ var type = (_value_type = value.type) !== null && _value_type !== void 0 ? _value_type : "replace";
506
506
  if (type === "replace") {
507
507
  settingItem.showItems = value.showItems;
508
508
  } else {
509
- var _showItems;
510
- (_showItems = settingItem.showItems).push.apply(_showItems, _toConsumableArray(value.showItems));
509
+ var _settingItem_showItems;
510
+ (_settingItem_showItems = settingItem.showItems).push.apply(_settingItem_showItems, _toConsumableArray(value.showItems));
511
511
  }
512
512
  }
513
513
  }
@@ -148,11 +148,11 @@ var Property = function Property(props) {
148
148
  "use strict";
149
149
  var caption = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
150
150
  _classCallCheck(this, Property);
151
- var ref;
152
- this.isHide = (ref = props === null || props === void 0 ? void 0 : props.isHide) !== null && ref !== void 0 ? ref : false;
151
+ var _props_isHide;
152
+ this.isHide = (_props_isHide = props === null || props === void 0 ? void 0 : props.isHide) !== null && _props_isHide !== void 0 ? _props_isHide : false;
153
153
  this.style = new BaseStyle(props === null || props === void 0 ? void 0 : props.style);
154
- var ref1;
155
- this.caption = (ref1 = props === null || props === void 0 ? void 0 : props.caption) !== null && ref1 !== void 0 ? ref1 : caption;
154
+ var _props_caption;
155
+ this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : caption;
156
156
  };
157
157
  Property.Rules = PropertyRules;
158
158
  Property.RuntimeRules = PropertyRuntimeRules;
@@ -33,22 +33,22 @@ var Control = /*#__PURE__*/ function _target() {
33
33
  _classCallCheck(this, Control);
34
34
  this.customEvents = [];
35
35
  this.parent = null;
36
- var ref = _instanceof(this, Control) ? this.constructor : void 0, controlType = ref.controlType, controlFieldType = ref.controlFieldType, name = ref.name, controlCustomEvents = ref.controlCustomEvents;
36
+ var _ref = _instanceof(this, Control) ? this.constructor : void 0, controlType = _ref.controlType, controlFieldType = _ref.controlFieldType, name = _ref.name, controlCustomEvents = _ref.controlCustomEvents;
37
37
  if (!controlType) {
38
38
  referenceError("The ".concat(name, " controlType is not define"));
39
39
  }
40
- var ref1;
41
- this.id = (ref1 = props === null || props === void 0 ? void 0 : props.id) !== null && ref1 !== void 0 ? ref1 : genNonDuplicateId(10);
42
- var ref2;
43
- this.type = (ref2 = props === null || props === void 0 ? void 0 : props.type) !== null && ref2 !== void 0 ? ref2 : controlType;
40
+ var _props_id;
41
+ this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
42
+ var _props_type;
43
+ this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : controlType;
44
44
  this.props = new Property(props === null || props === void 0 ? void 0 : props.props);
45
45
  this.customEvents = controlCustomEvents;
46
- var ref3;
47
- this.controlType = (ref3 = props === null || props === void 0 ? void 0 : props.controlType) !== null && ref3 !== void 0 ? ref3 : "base";
48
- var ref4;
49
- this.fieldType = (ref4 = props === null || props === void 0 ? void 0 : props.fieldType) !== null && ref4 !== void 0 ? ref4 : controlFieldType;
50
- var ref5;
51
- this.pageStatus = (ref5 = props === null || props === void 0 ? void 0 : props.pageStatus) !== null && ref5 !== void 0 ? ref5 : PAGE_STATUS.UNKNOWN;
46
+ var _props_controlType;
47
+ this.controlType = (_props_controlType = props === null || props === void 0 ? void 0 : props.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
48
+ var _props_fieldType;
49
+ this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
50
+ var _props_pageStatus;
51
+ this.pageStatus = (_props_pageStatus = props === null || props === void 0 ? void 0 : props.pageStatus) !== null && _props_pageStatus !== void 0 ? _props_pageStatus : PAGE_STATUS.UNKNOWN;
52
52
  }
53
53
  _createClass(Control, [
54
54
  {
@@ -72,7 +72,7 @@ function _createSuper(Derived) {
72
72
  import { Property, PropertyRules } from "../BaseControl";
73
73
  import { RulesMessage } from "@byteluck-fe/model-driven-shared";
74
74
  import { initOptionAndDataSourceRules } from "../initOptionAndDataSourceRules";
75
- import { DataBind } from "../../framework";
75
+ import { DataBind, AutoWidth } from "../../framework";
76
76
  var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
77
77
  "use strict";
78
78
  _inherits(ColumnControlPropertyRules, PropertyRules);
@@ -104,16 +104,17 @@ var ColumnControlProperty = /*#__PURE__*/ function(Property) {
104
104
  _classCallCheck(this, ColumnControlProperty);
105
105
  var _this;
106
106
  _this = _super.call(this, props);
107
- var ref;
108
- _this.width = (ref = props === null || props === void 0 ? void 0 : props.width) !== null && ref !== void 0 ? ref : 150;
107
+ var _props_width;
108
+ _this.width = (_props_width = props === null || props === void 0 ? void 0 : props.width) !== null && _props_width !== void 0 ? _props_width : 150;
109
109
  _this.widthType = (props === null || props === void 0 ? void 0 : props.widthType) || "auto";
110
- var ref1;
111
- _this.caption = (ref1 = props === null || props === void 0 ? void 0 : props.caption) !== null && ref1 !== void 0 ? ref1 : "";
112
- var ref2;
113
- _this.fixed = (ref2 = props === null || props === void 0 ? void 0 : props.fixed) !== null && ref2 !== void 0 ? ref2 : "none";
110
+ var _props_caption;
111
+ _this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : "";
112
+ var _props_fixed;
113
+ _this.fixed = (_props_fixed = props === null || props === void 0 ? void 0 : props.fixed) !== null && _props_fixed !== void 0 ? _props_fixed : "none";
114
+ _this.autoWidth = new AutoWidth(props === null || props === void 0 ? void 0 : props.autoWidth);
114
115
  _this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
115
- var ref3;
116
- _this.sort = (ref3 = props === null || props === void 0 ? void 0 : props.sort) !== null && ref3 !== void 0 ? ref3 : true;
116
+ var _props_sort;
117
+ _this.sort = (_props_sort = props === null || props === void 0 ? void 0 : props.sort) !== null && _props_sort !== void 0 ? _props_sort : true;
117
118
  _this.align = props === null || props === void 0 ? void 0 : props.align;
118
119
  _this.colSpan = props === null || props === void 0 ? void 0 : props.colSpan;
119
120
  return _this;
@@ -25,9 +25,9 @@ function _unsupportedIterableToArray(o, minLen) {
25
25
  }
26
26
  import { isArray, isPlainObject } from "@byteluck-fe/model-driven-shared";
27
27
  export function setPropertyDontEnum(obj, property) {
28
- var ref;
28
+ var _Object_getOwnPropertyDescriptors_property;
29
29
  // 如果没有被设置过不允许枚举的话,说明是第一次被设置,需要设置属性不允许枚举
30
- if ((ref = Object.getOwnPropertyDescriptors(obj)[property]) === null || ref === void 0 ? void 0 : ref.enumerable) {
30
+ if ((_Object_getOwnPropertyDescriptors_property = Object.getOwnPropertyDescriptors(obj)[property]) === null || _Object_getOwnPropertyDescriptors_property === void 0 ? void 0 : _Object_getOwnPropertyDescriptors_property.enumerable) {
31
31
  Object.defineProperty(obj, property, {
32
32
  enumerable: false
33
33
  });
@@ -45,8 +45,8 @@ export function defineArrayParent(controls, parent) {
45
45
  }
46
46
  var targetKey = Symbol("targetKey");
47
47
  function getTargetValue(value) {
48
- var _targetKey;
49
- return (_targetKey = value[targetKey]) !== null && _targetKey !== void 0 ? _targetKey : value;
48
+ var _value_targetKey;
49
+ return (_value_targetKey = value[targetKey]) !== null && _value_targetKey !== void 0 ? _value_targetKey : value;
50
50
  }
51
51
  function proxyState(target, parent) {
52
52
  defineArrayParent(target, parent);
@@ -197,28 +197,28 @@ var BaseControlProperty = /*#__PURE__*/ function(Property) {
197
197
  _classCallCheck(this, BaseControlProperty);
198
198
  var _this;
199
199
  _this = _super.call(this, props);
200
- var ref;
201
- _this.caption = (ref = props === null || props === void 0 ? void 0 : props.caption) !== null && ref !== void 0 ? ref : "";
202
- var ref1;
203
- _this.isHideCaption = (ref1 = props === null || props === void 0 ? void 0 : props.isHideCaption) !== null && ref1 !== void 0 ? ref1 : false;
204
- var ref2;
205
- _this.isShowCaptionTip = (ref2 = props === null || props === void 0 ? void 0 : props.isShowCaptionTip) !== null && ref2 !== void 0 ? ref2 : false;
206
- var ref3;
207
- _this.captionTip = (ref3 = props === null || props === void 0 ? void 0 : props.captionTip) !== null && ref3 !== void 0 ? ref3 : "";
208
- var ref4;
209
- _this.defaultState = (ref4 = props === null || props === void 0 ? void 0 : props.defaultState) !== null && ref4 !== void 0 ? ref4 : "default";
210
- var ref5;
211
- _this.labelPosition = (ref5 = props === null || props === void 0 ? void 0 : props.labelPosition) !== null && ref5 !== void 0 ? ref5 : "top";
212
- var ref6;
213
- _this.placeholder = (ref6 = props === null || props === void 0 ? void 0 : props.placeholder) !== null && ref6 !== void 0 ? ref6 : "";
214
- var ref7;
215
- _this.required = (ref7 = props === null || props === void 0 ? void 0 : props.required) !== null && ref7 !== void 0 ? ref7 : false;
216
- var ref8;
217
- _this.requiredMessage = (ref8 = props === null || props === void 0 ? void 0 : props.requiredMessage) !== null && ref8 !== void 0 ? ref8 : "";
200
+ var _props_caption;
201
+ _this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : "";
202
+ var _props_isHideCaption;
203
+ _this.isHideCaption = (_props_isHideCaption = props === null || props === void 0 ? void 0 : props.isHideCaption) !== null && _props_isHideCaption !== void 0 ? _props_isHideCaption : false;
204
+ var _props_isShowCaptionTip;
205
+ _this.isShowCaptionTip = (_props_isShowCaptionTip = props === null || props === void 0 ? void 0 : props.isShowCaptionTip) !== null && _props_isShowCaptionTip !== void 0 ? _props_isShowCaptionTip : false;
206
+ var _props_captionTip;
207
+ _this.captionTip = (_props_captionTip = props === null || props === void 0 ? void 0 : props.captionTip) !== null && _props_captionTip !== void 0 ? _props_captionTip : "";
208
+ var _props_defaultState;
209
+ _this.defaultState = (_props_defaultState = props === null || props === void 0 ? void 0 : props.defaultState) !== null && _props_defaultState !== void 0 ? _props_defaultState : "default";
210
+ var _props_labelPosition;
211
+ _this.labelPosition = (_props_labelPosition = props === null || props === void 0 ? void 0 : props.labelPosition) !== null && _props_labelPosition !== void 0 ? _props_labelPosition : "top";
212
+ var _props_placeholder;
213
+ _this.placeholder = (_props_placeholder = props === null || props === void 0 ? void 0 : props.placeholder) !== null && _props_placeholder !== void 0 ? _props_placeholder : "";
214
+ var _props_required;
215
+ _this.required = (_props_required = props === null || props === void 0 ? void 0 : props.required) !== null && _props_required !== void 0 ? _props_required : false;
216
+ var _props_requiredMessage;
217
+ _this.requiredMessage = (_props_requiredMessage = props === null || props === void 0 ? void 0 : props.requiredMessage) !== null && _props_requiredMessage !== void 0 ? _props_requiredMessage : "";
218
218
  //form 组件优先初始化DataBind
219
219
  _this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
220
- var ref9;
221
- _this.defaultValue = (ref9 = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && ref9 !== void 0 ? ref9 : "";
220
+ var _props_defaultValue;
221
+ _this.defaultValue = (_props_defaultValue = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : "";
222
222
  return _this;
223
223
  }
224
224
  return BaseControlProperty;
@@ -315,7 +315,7 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
315
315
  var _this;
316
316
  _this = _super.call(this, props);
317
317
  _this.controlType = "layout";
318
- var ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = ref.excludes, childrenMaxLength = ref.childrenMaxLength;
318
+ var _ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = _ref.excludes, childrenMaxLength = _ref.childrenMaxLength;
319
319
  _this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
320
320
  defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
321
321
  _this.excludes = JSONCopy(excludes);