@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.
- package/dist/esm/common/BaseControl/designer.js +19 -19
- package/dist/esm/common/BaseControl/property.js +4 -4
- package/dist/esm/common/BaseControl/runtime.js +11 -11
- package/dist/esm/common/ColumnControl/property.js +10 -9
- package/dist/esm/common/ControlArray.js +4 -4
- package/dist/esm/common/FormControl/property.js +20 -20
- package/dist/esm/common/LayoutControl/designer.js +1 -1
- package/dist/esm/framework/index.js +246 -236
- package/dist/index.umd.js +1 -1
- package/dist/types/common/ColumnControl/property.d.ts +2 -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 +6 -0
- package/dist/types/type.d.ts +23 -23
- package/package.json +3 -3
|
@@ -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
|
|
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
|
|
234
|
-
this.id = (
|
|
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
|
|
238
|
-
this.type = (
|
|
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
|
|
241
|
-
this.controlType = (
|
|
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
|
|
244
|
-
this.fieldType = (
|
|
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
|
|
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
|
|
416
|
-
(
|
|
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
|
|
473
|
-
isHasItem ? _this.setting[settingIndex].showItems = (
|
|
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
|
-
!((
|
|
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
|
|
505
|
-
var type = (
|
|
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
|
|
510
|
-
(
|
|
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
|
|
152
|
-
this.isHide = (
|
|
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
|
|
155
|
-
this.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
|
|
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
|
|
41
|
-
this.id = (
|
|
42
|
-
var
|
|
43
|
-
this.type = (
|
|
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
|
|
47
|
-
this.controlType = (
|
|
48
|
-
var
|
|
49
|
-
this.fieldType = (
|
|
50
|
-
var
|
|
51
|
-
this.pageStatus = (
|
|
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
|
|
108
|
-
_this.width = (
|
|
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
|
|
111
|
-
_this.caption = (
|
|
112
|
-
var
|
|
113
|
-
_this.fixed = (
|
|
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
|
|
116
|
-
_this.sort = (
|
|
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
|
|
28
|
+
var _Object_getOwnPropertyDescriptors_property;
|
|
29
29
|
// 如果没有被设置过不允许枚举的话,说明是第一次被设置,需要设置属性不允许枚举
|
|
30
|
-
if ((
|
|
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
|
|
49
|
-
return (
|
|
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
|
|
201
|
-
_this.caption = (
|
|
202
|
-
var
|
|
203
|
-
_this.isHideCaption = (
|
|
204
|
-
var
|
|
205
|
-
_this.isShowCaptionTip = (
|
|
206
|
-
var
|
|
207
|
-
_this.captionTip = (
|
|
208
|
-
var
|
|
209
|
-
_this.defaultState = (
|
|
210
|
-
var
|
|
211
|
-
_this.labelPosition = (
|
|
212
|
-
var
|
|
213
|
-
_this.placeholder = (
|
|
214
|
-
var
|
|
215
|
-
_this.required = (
|
|
216
|
-
var
|
|
217
|
-
_this.requiredMessage = (
|
|
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
|
|
221
|
-
_this.defaultValue = (
|
|
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
|
|
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);
|