@byteluck-fe/model-driven-core 2.7.0-alpha.28a → 2.7.0-alpha.33
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 +5 -7
- package/dist/esm/common/BaseControl/property.js +3 -5
- package/dist/esm/common/BaseControl/runtime.js +6 -8
- package/dist/esm/common/ColumnControl/designer.js +1 -2
- package/dist/esm/common/ColumnControl/property.js +10 -11
- package/dist/esm/common/ColumnControl/runtime.js +1 -2
- package/dist/esm/common/ControlArray.js +12 -14
- package/dist/esm/common/FormControl/designer.js +1 -2
- package/dist/esm/common/FormControl/property.js +18 -22
- package/dist/esm/common/FormControl/runtime.js +1 -2
- package/dist/esm/common/LayoutControl/designer.js +2 -3
- package/dist/esm/common/LayoutControl/runtime.js +2 -3
- package/dist/esm/common/ListControl/designer.js +1 -2
- package/dist/esm/common/ListControl/property.js +3 -4
- package/dist/esm/common/ListControl/runtime.js +2 -3
- package/dist/esm/common/SearchViewControl/designer.js +1 -2
- package/dist/esm/common/SearchViewControl/property.js +1 -2
- package/dist/esm/common/SearchViewControl/runtime.js +1 -2
- package/dist/esm/common/WrapControl/designer.js +1 -2
- package/dist/esm/common/WrapControl/runtime.js +1 -2
- package/dist/esm/framework/RegisterControls.js +5 -67
- package/dist/esm/framework/index.js +151 -191
- package/dist/esm/framework/isDataBind.js +1 -2
- package/dist/index.umd.js +1 -1
- package/dist/types/common/BaseControl/designer.d.ts +1 -2
- package/dist/types/common/BaseControl/property.d.ts +0 -2
- package/dist/types/common/BaseControl/runtime.d.ts +1 -2
- package/dist/types/common/ControlArray.d.ts +3 -4
- package/dist/types/common/ListControl/property.d.ts +1 -1
- package/dist/types/framework/RegisterControls.d.ts +1 -4
- package/package.json +3 -3
|
@@ -219,7 +219,6 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
219
219
|
function Control(props) {
|
|
220
220
|
var _this = this;
|
|
221
221
|
_class_call_check(this, Control);
|
|
222
|
-
var _props, _props1, _props2, _props3, _props4;
|
|
223
222
|
_define_property(this, "id", void 0 // 唯一标识符
|
|
224
223
|
);
|
|
225
224
|
_define_property(this, "name", void 0);
|
|
@@ -240,17 +239,17 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
240
239
|
referenceError("The ".concat(name, " controlName,controlIcon,controlType is not define"));
|
|
241
240
|
}
|
|
242
241
|
var _props_id;
|
|
243
|
-
this.id = (_props_id =
|
|
242
|
+
this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
|
|
244
243
|
this.name = controlName;
|
|
245
244
|
this.icon = controlIcon;
|
|
246
245
|
var _props_type;
|
|
247
|
-
this.type = (_props_type =
|
|
248
|
-
this.props = new Property(
|
|
246
|
+
this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : controlType;
|
|
247
|
+
this.props = new Property(props === null || props === void 0 ? void 0 : props.props, (_instanceof(this, Control) ? this.constructor : void 0).controlName);
|
|
249
248
|
var _props_controlType;
|
|
250
|
-
this.controlType = (_props_controlType =
|
|
249
|
+
this.controlType = (_props_controlType = props === null || props === void 0 ? void 0 : props.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
|
|
251
250
|
this.setting = JSONCopy(setting);
|
|
252
251
|
var _props_fieldType;
|
|
253
|
-
this.fieldType = (_props_fieldType =
|
|
252
|
+
this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
|
|
254
253
|
this.eventKeys = JSONCopy(controlEventKeys);
|
|
255
254
|
this.customEvents = JSONCopy(controlCustomEvents);
|
|
256
255
|
Promise.resolve().then(function() {
|
|
@@ -476,7 +475,6 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
476
475
|
]);
|
|
477
476
|
return Control;
|
|
478
477
|
}();
|
|
479
|
-
_define_property(Control, "mode", "Designer");
|
|
480
478
|
_define_property(Control, "controlName", "控件");
|
|
481
479
|
_define_property(Control, "controlIcon", "icon");
|
|
482
480
|
_define_property(Control, "controlType", "control");
|
|
@@ -153,7 +153,6 @@ var PropertyRuntimeRules = /*#__PURE__*/ function(Array1) {
|
|
|
153
153
|
"use strict";
|
|
154
154
|
var caption = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
155
155
|
_class_call_check(this, Property);
|
|
156
|
-
var _props, _props1, _props2;
|
|
157
156
|
/**
|
|
158
157
|
* 是否隐藏
|
|
159
158
|
* @public
|
|
@@ -167,12 +166,11 @@ var PropertyRuntimeRules = /*#__PURE__*/ function(Array1) {
|
|
|
167
166
|
* @defaultValue ''
|
|
168
167
|
*/ _define_property(this, "caption", void 0);
|
|
169
168
|
var _props_isHide;
|
|
170
|
-
this.isHide = (_props_isHide =
|
|
171
|
-
this.style = new BaseStyle(
|
|
169
|
+
this.isHide = (_props_isHide = props === null || props === void 0 ? void 0 : props.isHide) !== null && _props_isHide !== void 0 ? _props_isHide : false;
|
|
170
|
+
this.style = new BaseStyle(props === null || props === void 0 ? void 0 : props.style);
|
|
172
171
|
var _props_caption;
|
|
173
|
-
this.caption = (_props_caption =
|
|
172
|
+
this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : caption;
|
|
174
173
|
};
|
|
175
|
-
_define_property(Property, "mode", void 0);
|
|
176
174
|
_define_property(Property, "Rules", PropertyRules);
|
|
177
175
|
_define_property(Property, "RuntimeRules", PropertyRuntimeRules);
|
|
178
176
|
export default Property;
|
|
@@ -44,7 +44,6 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
44
44
|
"use strict";
|
|
45
45
|
function Control(props) {
|
|
46
46
|
_class_call_check(this, Control);
|
|
47
|
-
var _props, _props1, _props2, _props3, _props4, _props5;
|
|
48
47
|
_define_property(this, "id", void 0 // 唯一标识符
|
|
49
48
|
);
|
|
50
49
|
_define_property(this, "type", void 0);
|
|
@@ -59,17 +58,17 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
59
58
|
referenceError("The ".concat(name, " controlType is not define"));
|
|
60
59
|
}
|
|
61
60
|
var _props_id;
|
|
62
|
-
this.id = (_props_id =
|
|
61
|
+
this.id = (_props_id = props === null || props === void 0 ? void 0 : props.id) !== null && _props_id !== void 0 ? _props_id : genNonDuplicateId(10);
|
|
63
62
|
var _props_type;
|
|
64
|
-
this.type = (_props_type =
|
|
65
|
-
this.props = new Property(
|
|
63
|
+
this.type = (_props_type = props === null || props === void 0 ? void 0 : props.type) !== null && _props_type !== void 0 ? _props_type : controlType;
|
|
64
|
+
this.props = new Property(props === null || props === void 0 ? void 0 : props.props);
|
|
66
65
|
this.customEvents = controlCustomEvents;
|
|
67
66
|
var _props_controlType;
|
|
68
|
-
this.controlType = (_props_controlType =
|
|
67
|
+
this.controlType = (_props_controlType = props === null || props === void 0 ? void 0 : props.controlType) !== null && _props_controlType !== void 0 ? _props_controlType : "base";
|
|
69
68
|
var _props_fieldType;
|
|
70
|
-
this.fieldType = (_props_fieldType =
|
|
69
|
+
this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : controlFieldType;
|
|
71
70
|
var _props_pageStatus;
|
|
72
|
-
this.pageStatus = (_props_pageStatus =
|
|
71
|
+
this.pageStatus = (_props_pageStatus = props === null || props === void 0 ? void 0 : props.pageStatus) !== null && _props_pageStatus !== void 0 ? _props_pageStatus : PAGE_STATUS.UNKNOWN;
|
|
73
72
|
}
|
|
74
73
|
_create_class(Control, [
|
|
75
74
|
{
|
|
@@ -86,7 +85,6 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
86
85
|
]);
|
|
87
86
|
return Control;
|
|
88
87
|
}();
|
|
89
|
-
_define_property(Control, "mode", "Runtime");
|
|
90
88
|
_define_property(Control, "controlType", "control");
|
|
91
89
|
_define_property(Control, "controlFieldType", void 0);
|
|
92
90
|
_define_property(Control, "__is_control__", true);
|
|
@@ -91,11 +91,10 @@ var ColumnControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
91
91
|
function ColumnControl(props) {
|
|
92
92
|
_class_call_check(this, ColumnControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "column");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new ColumnControlProperty(
|
|
97
|
+
_this.props = new ColumnControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return ColumnControl;
|
|
@@ -119,7 +119,6 @@ var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
119
119
|
function ColumnControlProperty(props) {
|
|
120
120
|
_class_call_check(this, ColumnControlProperty);
|
|
121
121
|
var _this;
|
|
122
|
-
var _props, _props1, _props2, _props3, _props4, _props5, _props6, _props7, _props8, _props9;
|
|
123
122
|
_this = _super.call(this, props);
|
|
124
123
|
/**
|
|
125
124
|
* 宽度类型
|
|
@@ -157,20 +156,20 @@ var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
157
156
|
* @defaultValue false
|
|
158
157
|
*/ _define_property(_assert_this_initialized(_this), "autoHeight", void 0);
|
|
159
158
|
var _props_width;
|
|
160
|
-
_this.width = (_props_width =
|
|
161
|
-
_this.widthType = (
|
|
159
|
+
_this.width = (_props_width = props === null || props === void 0 ? void 0 : props.width) !== null && _props_width !== void 0 ? _props_width : 150;
|
|
160
|
+
_this.widthType = (props === null || props === void 0 ? void 0 : props.widthType) || "auto";
|
|
162
161
|
var _props_caption;
|
|
163
|
-
_this.caption = (_props_caption =
|
|
162
|
+
_this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : "";
|
|
164
163
|
var _props_fixed;
|
|
165
|
-
_this.fixed = (_props_fixed =
|
|
166
|
-
_this.autoWidth = new AutoWidth(
|
|
167
|
-
_this.dataBind = new DataBind(
|
|
164
|
+
_this.fixed = (_props_fixed = props === null || props === void 0 ? void 0 : props.fixed) !== null && _props_fixed !== void 0 ? _props_fixed : "none";
|
|
165
|
+
_this.autoWidth = new AutoWidth(props === null || props === void 0 ? void 0 : props.autoWidth);
|
|
166
|
+
_this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
|
|
168
167
|
var _props_sort;
|
|
169
|
-
_this.sort = (_props_sort =
|
|
170
|
-
_this.align =
|
|
171
|
-
_this.colSpan =
|
|
168
|
+
_this.sort = (_props_sort = props === null || props === void 0 ? void 0 : props.sort) !== null && _props_sort !== void 0 ? _props_sort : true;
|
|
169
|
+
_this.align = props === null || props === void 0 ? void 0 : props.align;
|
|
170
|
+
_this.colSpan = props === null || props === void 0 ? void 0 : props.colSpan;
|
|
172
171
|
var _props_autoHeight;
|
|
173
|
-
_this.autoHeight = (_props_autoHeight =
|
|
172
|
+
_this.autoHeight = (_props_autoHeight = props === null || props === void 0 ? void 0 : props.autoHeight) !== null && _props_autoHeight !== void 0 ? _props_autoHeight : false;
|
|
174
173
|
return _this;
|
|
175
174
|
}
|
|
176
175
|
return ColumnControlProperty;
|
|
@@ -91,11 +91,10 @@ var ColumnControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
91
91
|
function ColumnControl(props) {
|
|
92
92
|
_class_call_check(this, ColumnControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "column");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new ColumnControlProperty(
|
|
97
|
+
_this.props = new ColumnControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return ColumnControl;
|
|
@@ -33,16 +33,14 @@ export function setPropertyDontEnum(obj, property) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
export function defineParent(control, parent
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setPropertyDontEnum(control, "parent");
|
|
41
|
-
}
|
|
36
|
+
export function defineParent(control, parent) {
|
|
37
|
+
control.parent = parent;
|
|
38
|
+
// 如果没有被设置过不允许枚举的话,说明是第一次被代理,需要设置parent属性不允许枚举
|
|
39
|
+
setPropertyDontEnum(control, "parent");
|
|
42
40
|
}
|
|
43
|
-
export function defineArrayParent(controls, parent
|
|
41
|
+
export function defineArrayParent(controls, parent) {
|
|
44
42
|
controls.forEach(function(item) {
|
|
45
|
-
defineParent(item, parent
|
|
43
|
+
defineParent(item, parent);
|
|
46
44
|
});
|
|
47
45
|
}
|
|
48
46
|
var targetKey = Symbol("targetKey");
|
|
@@ -50,8 +48,8 @@ function getTargetValue(value) {
|
|
|
50
48
|
var _value_targetKey;
|
|
51
49
|
return (_value_targetKey = value[targetKey]) !== null && _value_targetKey !== void 0 ? _value_targetKey : value;
|
|
52
50
|
}
|
|
53
|
-
function proxyState(target, parent
|
|
54
|
-
defineArrayParent(target, parent
|
|
51
|
+
function proxyState(target, parent) {
|
|
52
|
+
defineArrayParent(target, parent);
|
|
55
53
|
return new Proxy(target, {
|
|
56
54
|
get: function get(t, p) {
|
|
57
55
|
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
@@ -81,21 +79,21 @@ function proxyState(target, parent, mode) {
|
|
|
81
79
|
value
|
|
82
80
|
].concat(_to_consumable_array(args)));
|
|
83
81
|
if (isPlainObject(value)) {
|
|
84
|
-
defineParent(value, parent
|
|
82
|
+
defineParent(value, parent);
|
|
85
83
|
}
|
|
86
84
|
return result;
|
|
87
85
|
}
|
|
88
86
|
});
|
|
89
87
|
}
|
|
90
|
-
export function defineControlArrayToProperty(obj, property, initialValue, parent
|
|
88
|
+
export function defineControlArrayToProperty(obj, property, initialValue, parent) {
|
|
91
89
|
var _parent = parent !== null && parent !== void 0 ? parent : obj;
|
|
92
|
-
var value = proxyState(getTargetValue(initialValue !== null && initialValue !== void 0 ? initialValue : []), _parent
|
|
90
|
+
var value = proxyState(getTargetValue(initialValue !== null && initialValue !== void 0 ? initialValue : []), _parent);
|
|
93
91
|
Object.defineProperty(obj, property, {
|
|
94
92
|
get: function get() {
|
|
95
93
|
return value;
|
|
96
94
|
},
|
|
97
95
|
set: function set(newValue) {
|
|
98
|
-
value = proxyState(getTargetValue(newValue), _parent
|
|
96
|
+
value = proxyState(getTargetValue(newValue), _parent);
|
|
99
97
|
},
|
|
100
98
|
enumerable: true
|
|
101
99
|
});
|
|
@@ -91,11 +91,10 @@ var FormControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
91
91
|
function FormControl(props) {
|
|
92
92
|
_class_call_check(this, FormControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "form");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new BaseControlProperty(
|
|
97
|
+
_this.props = new BaseControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return FormControl;
|
|
@@ -185,16 +185,13 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
185
185
|
_class_call_check(this, BaseControlPropertyRuntimeRules);
|
|
186
186
|
var _this;
|
|
187
187
|
_this = _super.call(this, props);
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
})
|
|
196
|
-
});
|
|
197
|
-
}
|
|
188
|
+
_this.push({
|
|
189
|
+
type: "string",
|
|
190
|
+
required: props.isHide ? false : props.required,
|
|
191
|
+
message: props.requiredMessage !== "" ? props.requiredMessage : RulesMessage.getMessage("runtimeRequired", {
|
|
192
|
+
caption: props.caption
|
|
193
|
+
})
|
|
194
|
+
});
|
|
198
195
|
return _this;
|
|
199
196
|
}
|
|
200
197
|
return BaseControlPropertyRuntimeRules;
|
|
@@ -209,7 +206,6 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
209
206
|
function BaseControlProperty(props) {
|
|
210
207
|
_class_call_check(this, BaseControlProperty);
|
|
211
208
|
var _this;
|
|
212
|
-
var _props, _props1, _props2, _props3, _props4, _props5, _props6, _props7, _props8, _props9, _props10;
|
|
213
209
|
_this = _super.call(this, props);
|
|
214
210
|
/**
|
|
215
211
|
* 标题
|
|
@@ -264,27 +260,27 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
264
260
|
* @defaultValue ''
|
|
265
261
|
*/ _define_property(_assert_this_initialized(_this), "requiredMessage", void 0);
|
|
266
262
|
var _props_caption;
|
|
267
|
-
_this.caption = (_props_caption =
|
|
263
|
+
_this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : "";
|
|
268
264
|
var _props_isHideCaption;
|
|
269
|
-
_this.isHideCaption = (_props_isHideCaption =
|
|
265
|
+
_this.isHideCaption = (_props_isHideCaption = props === null || props === void 0 ? void 0 : props.isHideCaption) !== null && _props_isHideCaption !== void 0 ? _props_isHideCaption : false;
|
|
270
266
|
var _props_isShowCaptionTip;
|
|
271
|
-
_this.isShowCaptionTip = (_props_isShowCaptionTip =
|
|
267
|
+
_this.isShowCaptionTip = (_props_isShowCaptionTip = props === null || props === void 0 ? void 0 : props.isShowCaptionTip) !== null && _props_isShowCaptionTip !== void 0 ? _props_isShowCaptionTip : false;
|
|
272
268
|
var _props_captionTip;
|
|
273
|
-
_this.captionTip = (_props_captionTip =
|
|
269
|
+
_this.captionTip = (_props_captionTip = props === null || props === void 0 ? void 0 : props.captionTip) !== null && _props_captionTip !== void 0 ? _props_captionTip : "";
|
|
274
270
|
var _props_defaultState;
|
|
275
|
-
_this.defaultState = (_props_defaultState =
|
|
271
|
+
_this.defaultState = (_props_defaultState = props === null || props === void 0 ? void 0 : props.defaultState) !== null && _props_defaultState !== void 0 ? _props_defaultState : "default";
|
|
276
272
|
var _props_labelPosition;
|
|
277
|
-
_this.labelPosition = (_props_labelPosition =
|
|
273
|
+
_this.labelPosition = (_props_labelPosition = props === null || props === void 0 ? void 0 : props.labelPosition) !== null && _props_labelPosition !== void 0 ? _props_labelPosition : "top";
|
|
278
274
|
var _props_placeholder;
|
|
279
|
-
_this.placeholder = (_props_placeholder =
|
|
275
|
+
_this.placeholder = (_props_placeholder = props === null || props === void 0 ? void 0 : props.placeholder) !== null && _props_placeholder !== void 0 ? _props_placeholder : "";
|
|
280
276
|
var _props_required;
|
|
281
|
-
_this.required = (_props_required =
|
|
277
|
+
_this.required = (_props_required = props === null || props === void 0 ? void 0 : props.required) !== null && _props_required !== void 0 ? _props_required : false;
|
|
282
278
|
var _props_requiredMessage;
|
|
283
|
-
_this.requiredMessage = (_props_requiredMessage =
|
|
279
|
+
_this.requiredMessage = (_props_requiredMessage = props === null || props === void 0 ? void 0 : props.requiredMessage) !== null && _props_requiredMessage !== void 0 ? _props_requiredMessage : "";
|
|
284
280
|
//form 组件优先初始化DataBind
|
|
285
|
-
_this.dataBind = new DataBind(
|
|
281
|
+
_this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
|
|
286
282
|
var _props_defaultValue;
|
|
287
|
-
_this.defaultValue = (_props_defaultValue =
|
|
283
|
+
_this.defaultValue = (_props_defaultValue = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : "";
|
|
288
284
|
return _this;
|
|
289
285
|
}
|
|
290
286
|
return BaseControlProperty;
|
|
@@ -91,12 +91,11 @@ var FormControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
91
91
|
function FormControl(props) {
|
|
92
92
|
_class_call_check(this, FormControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "form");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
97
|
_define_property(_assert_this_initialized(_this), "value", void 0);
|
|
99
|
-
_this.props = new BaseControlProperty(
|
|
98
|
+
_this.props = new BaseControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
100
99
|
return _this;
|
|
101
100
|
}
|
|
102
101
|
return FormControl;
|
|
@@ -327,7 +327,6 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
327
327
|
function LayoutControl(props) {
|
|
328
328
|
_class_call_check(this, LayoutControl);
|
|
329
329
|
var _this;
|
|
330
|
-
var _props, _props1;
|
|
331
330
|
_this = _super.call(this, props);
|
|
332
331
|
_define_property(_assert_this_initialized(_this), "controlType", "layout");
|
|
333
332
|
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
@@ -335,8 +334,8 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
335
334
|
_define_property(_assert_this_initialized(_this), "childrenMaxLength", void 0);
|
|
336
335
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
337
336
|
var _ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = _ref.excludes, childrenMaxLength = _ref.childrenMaxLength;
|
|
338
|
-
_this.props = new LayoutControlProperty(
|
|
339
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "children",
|
|
337
|
+
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
338
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
340
339
|
_this.excludes = JSONCopy(excludes);
|
|
341
340
|
_this.childrenMaxLength = childrenMaxLength;
|
|
342
341
|
return _this;
|
|
@@ -92,13 +92,12 @@ var LayoutControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
92
92
|
function LayoutControl(props) {
|
|
93
93
|
_class_call_check(this, LayoutControl);
|
|
94
94
|
var _this;
|
|
95
|
-
var _props, _props1;
|
|
96
95
|
_this = _super.call(this, props);
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "controlType", "layout");
|
|
98
97
|
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
99
98
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
100
|
-
_this.props = new LayoutControlProperty(
|
|
101
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "children",
|
|
99
|
+
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
100
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
102
101
|
return _this;
|
|
103
102
|
}
|
|
104
103
|
return LayoutControl;
|
|
@@ -317,11 +317,10 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
317
317
|
function ListControl(props) {
|
|
318
318
|
_class_call_check(this, ListControl);
|
|
319
319
|
var _this;
|
|
320
|
-
var _props;
|
|
321
320
|
_this = _super.call(this, props);
|
|
322
321
|
_define_property(_assert_this_initialized(_this), "controlType", "list");
|
|
323
322
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
324
|
-
_this.props = new ListControlProperty(_assert_this_initialized(_this),
|
|
323
|
+
_this.props = new ListControlProperty(_assert_this_initialized(_this), props === null || props === void 0 ? void 0 : props.props);
|
|
325
324
|
return _this;
|
|
326
325
|
}
|
|
327
326
|
_create_class(ListControl, [
|
|
@@ -88,15 +88,14 @@ var ListControlProperty = /*#__PURE__*/ function(Property) {
|
|
|
88
88
|
"use strict";
|
|
89
89
|
_inherits(ListControlProperty, Property);
|
|
90
90
|
var _super = _create_super(ListControlProperty);
|
|
91
|
-
function ListControlProperty(parent, props
|
|
91
|
+
function ListControlProperty(parent, props) {
|
|
92
92
|
_class_call_check(this, ListControlProperty);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props, _props1;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "headers", void 0);
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "footers", void 0);
|
|
98
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "headers",
|
|
99
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "footers",
|
|
97
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "headers", props === null || props === void 0 ? void 0 : props.headers, parent);
|
|
98
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "footers", props === null || props === void 0 ? void 0 : props.footers, parent);
|
|
100
99
|
return _this;
|
|
101
100
|
}
|
|
102
101
|
return ListControlProperty;
|
|
@@ -106,13 +106,12 @@ var ListControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
106
106
|
function ListControl(props) {
|
|
107
107
|
_class_call_check(this, ListControl);
|
|
108
108
|
var _this;
|
|
109
|
-
var _props, _props1;
|
|
110
109
|
_this = _super.call(this, props);
|
|
111
110
|
_define_property(_assert_this_initialized(_this), "controlType", "list");
|
|
112
111
|
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
113
112
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
114
|
-
_this.props = new ListControlProperty(_assert_this_initialized(_this),
|
|
115
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "children",
|
|
113
|
+
_this.props = new ListControlProperty(_assert_this_initialized(_this), props === null || props === void 0 ? void 0 : props.props);
|
|
114
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
116
115
|
return _this;
|
|
117
116
|
}
|
|
118
117
|
_create_class(ListControl, [
|
|
@@ -91,11 +91,10 @@ var SearchControl = /*#__PURE__*/ function(DesignerLayoutControl) {
|
|
|
91
91
|
function SearchControl(props) {
|
|
92
92
|
_class_call_check(this, SearchControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "search");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new SearchControlProperty(
|
|
97
|
+
_this.props = new SearchControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return SearchControl;
|
|
@@ -91,10 +91,9 @@ var SearchControlProperty = /*#__PURE__*/ function(LayoutControlProperty) {
|
|
|
91
91
|
function SearchControlProperty(props) {
|
|
92
92
|
_class_call_check(this, SearchControlProperty);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "dataBind", void 0);
|
|
97
|
-
_this.dataBind = new DataBind(
|
|
96
|
+
_this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
|
|
98
97
|
return _this;
|
|
99
98
|
}
|
|
100
99
|
return SearchControlProperty;
|
|
@@ -91,11 +91,10 @@ var SearchControl = /*#__PURE__*/ function(RuntimeLayoutControl) {
|
|
|
91
91
|
function SearchControl(props) {
|
|
92
92
|
_class_call_check(this, SearchControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "search");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new SearchControlProperty(
|
|
97
|
+
_this.props = new SearchControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return SearchControl;
|
|
@@ -91,11 +91,10 @@ var WrapControl = /*#__PURE__*/ function(DesignerLayoutControl) {
|
|
|
91
91
|
function WrapControl(props) {
|
|
92
92
|
_class_call_check(this, WrapControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "wrap");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new WrapControlProperty(
|
|
97
|
+
_this.props = new WrapControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return WrapControl;
|
|
@@ -91,11 +91,10 @@ var WrapControl = /*#__PURE__*/ function(RuntimeLayoutControl) {
|
|
|
91
91
|
function WrapControl(props) {
|
|
92
92
|
_class_call_check(this, WrapControl);
|
|
93
93
|
var _this;
|
|
94
|
-
var _props;
|
|
95
94
|
_this = _super.call(this, props);
|
|
96
95
|
_define_property(_assert_this_initialized(_this), "controlType", "wrap");
|
|
97
96
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
98
|
-
_this.props = new WrapControlProperty(
|
|
97
|
+
_this.props = new WrapControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
99
98
|
return _this;
|
|
100
99
|
}
|
|
101
100
|
return WrapControl;
|
|
@@ -31,7 +31,6 @@ function _define_property(obj, key, value) {
|
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
33
|
import { error, CONTROL_BASE_TYPE, warn } from "@byteluck-fe/model-driven-shared";
|
|
34
|
-
import { setPropertyDontEnum } from "../common/ControlArray";
|
|
35
34
|
var baseStaticControls = [];
|
|
36
35
|
export var RegisterControls = /*#__PURE__*/ function() {
|
|
37
36
|
"use strict";
|
|
@@ -165,15 +164,9 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
165
164
|
createSchema = result;
|
|
166
165
|
}
|
|
167
166
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
// this.defineParentToChildren(control)
|
|
172
|
-
this._setParentPrototypeToSchema(control, this);
|
|
173
|
-
} else {
|
|
174
|
-
// @ts-ignore
|
|
175
|
-
control = new Constructor(createSchema);
|
|
176
|
-
}
|
|
167
|
+
// @ts-ignore
|
|
168
|
+
var control = new Constructor(createSchema);
|
|
169
|
+
// this.defineParentToChildren(control)
|
|
177
170
|
return control;
|
|
178
171
|
} else {
|
|
179
172
|
error(// @ts-ignore
|
|
@@ -181,45 +174,6 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
181
174
|
}
|
|
182
175
|
}
|
|
183
176
|
},
|
|
184
|
-
{
|
|
185
|
-
key: "_setParentPrototypeToSchema",
|
|
186
|
-
value: function _setParentPrototypeToSchema(schema, runtime) {
|
|
187
|
-
// if (Reflect.has(schema, 'parent')) {
|
|
188
|
-
// return
|
|
189
|
-
// }
|
|
190
|
-
if (runtime._type !== "Runtime") {
|
|
191
|
-
return;
|
|
192
|
-
}
|
|
193
|
-
Object.defineProperty(schema, "parent", {
|
|
194
|
-
get: function get() {
|
|
195
|
-
// @ts-ignore
|
|
196
|
-
var id = schema.id;
|
|
197
|
-
var controlParentIdMap = runtime._controlParentIdMap;
|
|
198
|
-
var instanceMap = runtime.instanceMap;
|
|
199
|
-
if (!controlParentIdMap || !instanceMap) {
|
|
200
|
-
return;
|
|
201
|
-
}
|
|
202
|
-
var parentId = controlParentIdMap[id];
|
|
203
|
-
var selfInInstances = instanceMap[id];
|
|
204
|
-
if (!parentId && !selfInInstances) {
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
var selfIndex = selfInInstances.findIndex(function(item) {
|
|
208
|
-
return item == schema;
|
|
209
|
-
});
|
|
210
|
-
var parentInstances = instanceMap[parentId] || [];
|
|
211
|
-
var parentInstance;
|
|
212
|
-
if (parentInstances.length !== selfInInstances.length) {
|
|
213
|
-
parentInstance = parentInstances[0];
|
|
214
|
-
} else {
|
|
215
|
-
parentInstance = parentInstances[selfIndex];
|
|
216
|
-
}
|
|
217
|
-
return parentInstance;
|
|
218
|
-
}
|
|
219
|
-
});
|
|
220
|
-
setPropertyDontEnum(schema, "parent");
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
177
|
{
|
|
224
178
|
key: "createControlInstance",
|
|
225
179
|
value: function createControlInstance(type, initSchema) {
|
|
@@ -247,28 +201,14 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
247
201
|
var _this = this;
|
|
248
202
|
this.constructor.staticControls.forEach(function(item) {
|
|
249
203
|
_this.register(item[type]);
|
|
250
|
-
RegisterControls.staticControlsRuntimeRules.set(item.Runtime.controlType, item.Property.RuntimeRules);
|
|
251
|
-
item.Property.mode = type;
|
|
252
204
|
});
|
|
253
205
|
}
|
|
254
206
|
}
|
|
255
207
|
], [
|
|
256
|
-
{
|
|
257
|
-
key: "staticGetRules",
|
|
258
|
-
value: function staticGetRules(controlType, props) {
|
|
259
|
-
var Rules = RegisterControls.staticControlsRuntimeRules.get(controlType);
|
|
260
|
-
var result = [];
|
|
261
|
-
if (Rules) {
|
|
262
|
-
var rules = new Rules(props);
|
|
263
|
-
result = Array.from(rules);
|
|
264
|
-
}
|
|
265
|
-
return result;
|
|
266
|
-
}
|
|
267
|
-
},
|
|
268
208
|
{
|
|
269
209
|
key: "register",
|
|
270
|
-
value: function register(control
|
|
271
|
-
var Designer = control.Designer, Runtime = control.Runtime
|
|
210
|
+
value: function register(control) {
|
|
211
|
+
var Designer = control.Designer, Runtime = control.Runtime;
|
|
272
212
|
if (!Designer || !Runtime || !Designer.__is_control__ || !Runtime.__is_control__) {
|
|
273
213
|
error("".concat(control, " is can't register as a Control"));
|
|
274
214
|
}
|
|
@@ -281,14 +221,12 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
281
221
|
}
|
|
282
222
|
this.staticRegisteredTypes.add(Designer.controlType);
|
|
283
223
|
this.staticControls.push(control);
|
|
284
|
-
Property.mode = mode;
|
|
285
224
|
return this;
|
|
286
225
|
}
|
|
287
226
|
}
|
|
288
227
|
]);
|
|
289
228
|
return RegisterControls;
|
|
290
229
|
}();
|
|
291
|
-
_define_property(RegisterControls, "staticControlsRuntimeRules", new Map());
|
|
292
230
|
_define_property(RegisterControls, "staticControls", baseStaticControls);
|
|
293
231
|
_define_property(RegisterControls, "staticRegisteredTypes", new Set(baseStaticControls.map(function(item) {
|
|
294
232
|
return item.Designer.controlType;
|