@byteluck-fe/model-driven-core 1.8.0-beta.2 → 1.8.0-beta.3
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 +8 -8
- 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 +236 -244
- 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 +1 -8
- 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 ref1;
|
|
234
|
+
this.id = (ref1 = props === null || props === void 0 ? void 0 : props.id) !== null && ref1 !== void 0 ? ref1 : genNonDuplicateId(10);
|
|
235
235
|
this.name = controlName;
|
|
236
236
|
this.icon = controlIcon;
|
|
237
|
-
var
|
|
238
|
-
this.type = (
|
|
237
|
+
var ref2;
|
|
238
|
+
this.type = (ref2 = props === null || props === void 0 ? void 0 : props.type) !== null && ref2 !== void 0 ? ref2 : 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 ref3;
|
|
241
|
+
this.controlType = (ref3 = props === null || props === void 0 ? void 0 : props.controlType) !== null && ref3 !== void 0 ? ref3 : "base";
|
|
242
242
|
this.setting = JSONCopy(setting);
|
|
243
|
-
var
|
|
244
|
-
this.fieldType = (
|
|
243
|
+
var ref4;
|
|
244
|
+
this.fieldType = (ref4 = props === null || props === void 0 ? void 0 : props.fieldType) !== null && ref4 !== void 0 ? ref4 : 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 _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;
|
|
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 _setting;
|
|
416
|
+
(_setting = this.setting).push.apply(_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 ref, ref1;
|
|
473
|
+
isHasItem ? _this.setting[settingIndex].showItems = (ref = _this.setting[settingIndex].showItems) === null || ref === void 0 ? void 0 : ref.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
|
+
!((ref1 = _this.setting[settingIndex].showItems) === null || ref1 === void 0 ? void 0 : ref1.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 _type;
|
|
505
|
+
var type = (_type = value.type) !== null && _type !== void 0 ? _type : "replace";
|
|
506
506
|
if (type === "replace") {
|
|
507
507
|
settingItem.showItems = value.showItems;
|
|
508
508
|
} else {
|
|
509
|
-
var
|
|
510
|
-
(
|
|
509
|
+
var _showItems;
|
|
510
|
+
(_showItems = settingItem.showItems).push.apply(_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 ref;
|
|
152
|
+
this.isHide = (ref = props === null || props === void 0 ? void 0 : props.isHide) !== null && ref !== void 0 ? ref : false;
|
|
153
153
|
this.style = new BaseStyle(props === null || props === void 0 ? void 0 : props.style);
|
|
154
|
-
var
|
|
155
|
-
this.caption = (
|
|
154
|
+
var ref1;
|
|
155
|
+
this.caption = (ref1 = props === null || props === void 0 ? void 0 : props.caption) !== null && ref1 !== void 0 ? ref1 : 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 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;
|
|
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 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;
|
|
52
52
|
}
|
|
53
53
|
_createClass(Control, [
|
|
54
54
|
{
|
|
@@ -104,16 +104,16 @@ 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 ref;
|
|
108
|
+
_this.width = (ref = props === null || props === void 0 ? void 0 : props.width) !== null && ref !== void 0 ? ref : 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 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";
|
|
114
114
|
_this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
|
|
115
|
-
var
|
|
116
|
-
_this.sort = (
|
|
115
|
+
var ref3;
|
|
116
|
+
_this.sort = (ref3 = props === null || props === void 0 ? void 0 : props.sort) !== null && ref3 !== void 0 ? ref3 : true;
|
|
117
117
|
_this.align = props === null || props === void 0 ? void 0 : props.align;
|
|
118
118
|
_this.colSpan = props === null || props === void 0 ? void 0 : props.colSpan;
|
|
119
119
|
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 ref;
|
|
29
29
|
// 如果没有被设置过不允许枚举的话,说明是第一次被设置,需要设置属性不允许枚举
|
|
30
|
-
if ((
|
|
30
|
+
if ((ref = Object.getOwnPropertyDescriptors(obj)[property]) === null || ref === void 0 ? void 0 : ref.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 _targetKey;
|
|
49
|
+
return (_targetKey = value[targetKey]) !== null && _targetKey !== void 0 ? _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 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 : "";
|
|
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 ref9;
|
|
221
|
+
_this.defaultValue = (ref9 = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && ref9 !== void 0 ? ref9 : "";
|
|
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);
|