@byteluck-fe/model-driven-core 2.7.0-alpha.2 → 2.7.0-alpha.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 +228 -191
- package/dist/esm/common/BaseControl/property.js +29 -4
- package/dist/esm/common/BaseControl/runtime.js +26 -5
- package/dist/esm/common/ColumnControl/designer.js +15 -1
- package/dist/esm/common/ColumnControl/property.js +59 -11
- package/dist/esm/common/ColumnControl/runtime.js +15 -1
- package/dist/esm/common/FormControl/designer.js +18 -3
- package/dist/esm/common/FormControl/property.js +86 -21
- package/dist/esm/common/FormControl/runtime.js +16 -1
- package/dist/esm/common/LayoutControl/designer.js +104 -70
- package/dist/esm/common/LayoutControl/runtime.js +16 -1
- package/dist/esm/common/ListControl/designer.js +86 -61
- package/dist/esm/common/ListControl/property.js +14 -0
- package/dist/esm/common/ListControl/runtime.js +16 -1
- package/dist/esm/common/SearchViewControl/designer.js +15 -1
- package/dist/esm/common/SearchViewControl/property.js +14 -0
- package/dist/esm/common/SearchViewControl/runtime.js +15 -1
- package/dist/esm/common/WrapControl/designer.js +15 -1
- package/dist/esm/common/WrapControl/runtime.js +15 -1
- package/dist/esm/framework/RegisterControls.js +197 -128
- package/dist/esm/framework/index.js +437 -3
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
|
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
|
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
function _defineProperty(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _getPrototypeOf(o) {
|
|
13
26
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
27
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -81,16 +94,16 @@ var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
81
94
|
_classCallCheck(this, ColumnControlPropertyRules);
|
|
82
95
|
var _this;
|
|
83
96
|
_this = _super.call(this, props);
|
|
84
|
-
_this
|
|
97
|
+
_defineProperty(_assertThisInitialized(_this), "caption", {
|
|
85
98
|
type: "string",
|
|
86
99
|
required: true,
|
|
87
100
|
message: RulesMessage.getMessage("pleaseEnterCaption")
|
|
88
|
-
};
|
|
89
|
-
_this
|
|
101
|
+
});
|
|
102
|
+
_defineProperty(_assertThisInitialized(_this), "width", {
|
|
90
103
|
type: "number",
|
|
91
104
|
required: false,
|
|
92
105
|
message: RulesMessage.getMessage("pleaseEnterColumnWidth")
|
|
93
|
-
};
|
|
106
|
+
});
|
|
94
107
|
_this.width.required = props.widthType === "px";
|
|
95
108
|
return _this;
|
|
96
109
|
}
|
|
@@ -107,6 +120,41 @@ var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
107
120
|
_classCallCheck(this, ColumnControlProperty);
|
|
108
121
|
var _this;
|
|
109
122
|
_this = _super.call(this, props);
|
|
123
|
+
/**
|
|
124
|
+
* 宽度类型
|
|
125
|
+
* @defaultValue 'auto'
|
|
126
|
+
*/ _defineProperty(_assertThisInitialized(_this), "widthType", void 0);
|
|
127
|
+
/**
|
|
128
|
+
* 宽度
|
|
129
|
+
* @defaultValue 150
|
|
130
|
+
*/ _defineProperty(_assertThisInitialized(_this), "width", void 0);
|
|
131
|
+
/**
|
|
132
|
+
* 标题
|
|
133
|
+
*/ _defineProperty(_assertThisInitialized(_this), "caption", void 0);
|
|
134
|
+
/**
|
|
135
|
+
* 绑定数据项
|
|
136
|
+
*/ _defineProperty(_assertThisInitialized(_this), "dataBind", void 0);
|
|
137
|
+
/**
|
|
138
|
+
* 自适应页面宽度
|
|
139
|
+
*/ _defineProperty(_assertThisInitialized(_this), "autoWidth", void 0);
|
|
140
|
+
/**
|
|
141
|
+
* 冻结
|
|
142
|
+
* @defaultValue 'none'
|
|
143
|
+
*/ _defineProperty(_assertThisInitialized(_this), "fixed", void 0);
|
|
144
|
+
/**
|
|
145
|
+
* 表头排序
|
|
146
|
+
* @defaultValue true
|
|
147
|
+
*/ _defineProperty(_assertThisInitialized(_this), "sort", void 0);
|
|
148
|
+
/**
|
|
149
|
+
* 对齐
|
|
150
|
+
*/ _defineProperty(_assertThisInitialized(_this), "align", void 0);
|
|
151
|
+
/**
|
|
152
|
+
* @internal
|
|
153
|
+
*/ _defineProperty(_assertThisInitialized(_this), "colSpan", void 0);
|
|
154
|
+
/**
|
|
155
|
+
* 自动高度
|
|
156
|
+
* @defaultValue false
|
|
157
|
+
*/ _defineProperty(_assertThisInitialized(_this), "autoHeight", void 0);
|
|
110
158
|
var _props_width;
|
|
111
159
|
_this.width = (_props_width = props === null || props === void 0 ? void 0 : props.width) !== null && _props_width !== void 0 ? _props_width : 150;
|
|
112
160
|
_this.widthType = (props === null || props === void 0 ? void 0 : props.widthType) || "auto";
|
|
@@ -126,7 +174,7 @@ var ColumnControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
126
174
|
}
|
|
127
175
|
return ColumnControlProperty;
|
|
128
176
|
}(Property);
|
|
129
|
-
ColumnControlProperty
|
|
177
|
+
_defineProperty(ColumnControlProperty, "Rules", ColumnControlPropertyRules);
|
|
130
178
|
var ColumnOptionAndDataSourcePropertyRules = /*#__PURE__*/ function(ColumnControlPropertyRules) {
|
|
131
179
|
"use strict";
|
|
132
180
|
_inherits(ColumnOptionAndDataSourcePropertyRules, ColumnControlPropertyRules);
|
|
@@ -135,7 +183,7 @@ var ColumnOptionAndDataSourcePropertyRules = /*#__PURE__*/ function(ColumnContro
|
|
|
135
183
|
_classCallCheck(this, ColumnOptionAndDataSourcePropertyRules);
|
|
136
184
|
var _this;
|
|
137
185
|
_this = _super.call(this, props);
|
|
138
|
-
_this
|
|
186
|
+
_defineProperty(_assertThisInitialized(_this), "optionConfig", {
|
|
139
187
|
type: "enum",
|
|
140
188
|
enum: [
|
|
141
189
|
"custom",
|
|
@@ -143,19 +191,19 @@ var ColumnOptionAndDataSourcePropertyRules = /*#__PURE__*/ function(ColumnContro
|
|
|
143
191
|
"none"
|
|
144
192
|
],
|
|
145
193
|
message: RulesMessage.getMessage("PleaseSelectTheCorrectOptionSettings")
|
|
146
|
-
};
|
|
147
|
-
_this
|
|
194
|
+
});
|
|
195
|
+
_defineProperty(_assertThisInitialized(_this), "options", [
|
|
148
196
|
{
|
|
149
197
|
type: "array",
|
|
150
198
|
message: RulesMessage.getMessage("isNotArray")
|
|
151
199
|
}
|
|
152
|
-
];
|
|
153
|
-
_this
|
|
200
|
+
]);
|
|
201
|
+
_defineProperty(_assertThisInitialized(_this), "datasourceBind", [
|
|
154
202
|
{
|
|
155
203
|
type: "object",
|
|
156
204
|
message: RulesMessage.getMessage("isNotObject")
|
|
157
205
|
}
|
|
158
|
-
];
|
|
206
|
+
]);
|
|
159
207
|
initOptionAndDataSourceRules.call(_assertThisInitialized(_this), props);
|
|
160
208
|
return _this;
|
|
161
209
|
}
|
|
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
|
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
function _defineProperty(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _getPrototypeOf(o) {
|
|
13
26
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
27
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -79,7 +92,8 @@ var ColumnControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
79
92
|
_classCallCheck(this, ColumnControl);
|
|
80
93
|
var _this;
|
|
81
94
|
_this = _super.call(this, props);
|
|
82
|
-
_this
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "controlType", "column");
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "props", void 0);
|
|
83
97
|
_this.props = new ColumnControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
84
98
|
return _this;
|
|
85
99
|
}
|
|
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
|
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
function _defineProperty(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _getPrototypeOf(o) {
|
|
13
26
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
27
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -79,16 +92,18 @@ var FormControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
79
92
|
_classCallCheck(this, FormControl);
|
|
80
93
|
var _this;
|
|
81
94
|
_this = _super.call(this, props);
|
|
82
|
-
_this
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "controlType", "form");
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "props", void 0);
|
|
83
97
|
_this.props = new BaseControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
84
98
|
return _this;
|
|
85
99
|
}
|
|
86
100
|
return FormControl;
|
|
87
101
|
}(DesignerControl);
|
|
88
|
-
FormControl
|
|
102
|
+
_defineProperty(FormControl, "controlEventKeys", [
|
|
89
103
|
"on_change",
|
|
90
104
|
"on_focus",
|
|
91
105
|
"on_blur"
|
|
92
|
-
];
|
|
106
|
+
]);
|
|
107
|
+
_defineProperty(FormControl, "controlCustomAttributes", void 0);
|
|
93
108
|
export default FormControl;
|
|
94
109
|
export { FormControl as DesignerFormControl };
|
|
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
|
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
function _defineProperty(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _getPrototypeOf(o) {
|
|
13
26
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
27
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -88,43 +101,43 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
88
101
|
_classCallCheck(this, BaseControlPropertyRules);
|
|
89
102
|
var _this;
|
|
90
103
|
_this = _super.call(this, props);
|
|
91
|
-
_this
|
|
92
|
-
_this
|
|
104
|
+
_defineProperty(_assertThisInitialized(_this), "dataBind", {});
|
|
105
|
+
_defineProperty(_assertThisInitialized(_this), "caption", {
|
|
93
106
|
type: "string",
|
|
94
107
|
required: true,
|
|
95
108
|
message: RulesMessage.getMessage("pleaseEnterCaption")
|
|
96
|
-
};
|
|
97
|
-
_this
|
|
109
|
+
});
|
|
110
|
+
_defineProperty(_assertThisInitialized(_this), "isHideCaption", {
|
|
98
111
|
type: "boolean"
|
|
99
|
-
};
|
|
100
|
-
_this
|
|
112
|
+
});
|
|
113
|
+
_defineProperty(_assertThisInitialized(_this), "labelPosition", {
|
|
101
114
|
type: "enum",
|
|
102
115
|
enum: [
|
|
103
116
|
"top",
|
|
104
117
|
"left"
|
|
105
118
|
]
|
|
106
|
-
};
|
|
119
|
+
});
|
|
107
120
|
// 去掉placeholder必填校验
|
|
108
121
|
// public placeholder: RuleItem = {
|
|
109
122
|
// required: true,
|
|
110
123
|
// type: 'string',
|
|
111
124
|
// message: RulesMessage.getMessage('pleaseEnterPlaceholder'),
|
|
112
125
|
// }
|
|
113
|
-
_this
|
|
126
|
+
_defineProperty(_assertThisInitialized(_this), "defaultState", {
|
|
114
127
|
type: "enum",
|
|
115
128
|
enum: [
|
|
116
129
|
"default",
|
|
117
130
|
"readonly"
|
|
118
131
|
]
|
|
119
|
-
};
|
|
120
|
-
_this
|
|
132
|
+
});
|
|
133
|
+
_defineProperty(_assertThisInitialized(_this), "required", {
|
|
121
134
|
type: "boolean"
|
|
122
|
-
};
|
|
123
|
-
_this
|
|
135
|
+
});
|
|
136
|
+
_defineProperty(_assertThisInitialized(_this), "captionTip", {
|
|
124
137
|
type: "string",
|
|
125
138
|
required: false,
|
|
126
139
|
message: RulesMessage.getMessage("pleaseEnterCaptionTip")
|
|
127
|
-
};
|
|
140
|
+
});
|
|
128
141
|
// 初始化dataBind的校验规则
|
|
129
142
|
var validateFields = {
|
|
130
143
|
fieldCode: {
|
|
@@ -199,6 +212,58 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
199
212
|
_classCallCheck(this, BaseControlProperty);
|
|
200
213
|
var _this;
|
|
201
214
|
_this = _super.call(this, props);
|
|
215
|
+
/**
|
|
216
|
+
* 标题
|
|
217
|
+
* @defaultValue ''
|
|
218
|
+
* @public
|
|
219
|
+
*/ _defineProperty(_assertThisInitialized(_this), "caption", void 0);
|
|
220
|
+
/**
|
|
221
|
+
* 隐藏标题
|
|
222
|
+
* @defaultValue false
|
|
223
|
+
* @public
|
|
224
|
+
*/ _defineProperty(_assertThisInitialized(_this), "isHideCaption", void 0);
|
|
225
|
+
/**
|
|
226
|
+
* 显示气泡提示
|
|
227
|
+
* @defaultValue false
|
|
228
|
+
* @public
|
|
229
|
+
*/ _defineProperty(_assertThisInitialized(_this), "isShowCaptionTip", void 0);
|
|
230
|
+
/**
|
|
231
|
+
* 气泡提示语
|
|
232
|
+
* @defaultValue ''
|
|
233
|
+
* @public
|
|
234
|
+
*/ _defineProperty(_assertThisInitialized(_this), "captionTip", void 0);
|
|
235
|
+
/**
|
|
236
|
+
* 标题布局
|
|
237
|
+
* @defaultValue ''
|
|
238
|
+
* @public
|
|
239
|
+
*/ _defineProperty(_assertThisInitialized(_this), "labelPosition", void 0);
|
|
240
|
+
/**
|
|
241
|
+
* 绑定数据项
|
|
242
|
+
* @public
|
|
243
|
+
*/ _defineProperty(_assertThisInitialized(_this), "dataBind", void 0);
|
|
244
|
+
/**
|
|
245
|
+
* 默认值
|
|
246
|
+
* @public
|
|
247
|
+
*/ _defineProperty(_assertThisInitialized(_this), "defaultValue", void 0);
|
|
248
|
+
/**
|
|
249
|
+
* 提示文字
|
|
250
|
+
* @defaultValue ''
|
|
251
|
+
* @public
|
|
252
|
+
*/ _defineProperty(_assertThisInitialized(_this), "placeholder", void 0);
|
|
253
|
+
/**
|
|
254
|
+
* 默认状态
|
|
255
|
+
* @defaultValue 'default'
|
|
256
|
+
* @public
|
|
257
|
+
*/ _defineProperty(_assertThisInitialized(_this), "defaultState", void 0);
|
|
258
|
+
/**
|
|
259
|
+
* 必填
|
|
260
|
+
* @defaultValue false
|
|
261
|
+
* @public
|
|
262
|
+
*/ _defineProperty(_assertThisInitialized(_this), "required", void 0);
|
|
263
|
+
/**
|
|
264
|
+
* 必填提示文案
|
|
265
|
+
* @defaultValue ''
|
|
266
|
+
*/ _defineProperty(_assertThisInitialized(_this), "requiredMessage", void 0);
|
|
202
267
|
var _props_caption;
|
|
203
268
|
_this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : "";
|
|
204
269
|
var _props_isHideCaption;
|
|
@@ -225,8 +290,8 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
225
290
|
}
|
|
226
291
|
return BaseControlProperty;
|
|
227
292
|
}(Property);
|
|
228
|
-
BaseControlProperty
|
|
229
|
-
BaseControlProperty
|
|
293
|
+
_defineProperty(BaseControlProperty, "Rules", BaseControlPropertyRules);
|
|
294
|
+
_defineProperty(BaseControlProperty, "RuntimeRules", BaseControlPropertyRuntimeRules);
|
|
230
295
|
var OptionAndDataSourcePropertyRules = /*#__PURE__*/ function(BaseControlPropertyRules) {
|
|
231
296
|
"use strict";
|
|
232
297
|
_inherits(OptionAndDataSourcePropertyRules, BaseControlPropertyRules);
|
|
@@ -235,26 +300,26 @@ var OptionAndDataSourcePropertyRules = /*#__PURE__*/ function(BaseControlPropert
|
|
|
235
300
|
_classCallCheck(this, OptionAndDataSourcePropertyRules);
|
|
236
301
|
var _this;
|
|
237
302
|
_this = _super.call(this, props);
|
|
238
|
-
_this
|
|
303
|
+
_defineProperty(_assertThisInitialized(_this), "optionConfig", {
|
|
239
304
|
type: "enum",
|
|
240
305
|
enum: [
|
|
241
306
|
"custom",
|
|
242
307
|
"datasource"
|
|
243
308
|
],
|
|
244
309
|
message: RulesMessage.getMessage("PleaseSelectTheCorrectOptionSettings")
|
|
245
|
-
};
|
|
246
|
-
_this
|
|
310
|
+
});
|
|
311
|
+
_defineProperty(_assertThisInitialized(_this), "options", [
|
|
247
312
|
{
|
|
248
313
|
type: "array",
|
|
249
314
|
message: RulesMessage.getMessage("isNotArray")
|
|
250
315
|
}
|
|
251
|
-
];
|
|
252
|
-
_this
|
|
316
|
+
]);
|
|
317
|
+
_defineProperty(_assertThisInitialized(_this), "datasourceBind", [
|
|
253
318
|
{
|
|
254
319
|
type: "object",
|
|
255
320
|
message: RulesMessage.getMessage("isNotObject")
|
|
256
321
|
}
|
|
257
|
-
];
|
|
322
|
+
]);
|
|
258
323
|
initOptionAndDataSourceRules.call(_assertThisInitialized(_this), props);
|
|
259
324
|
return _this;
|
|
260
325
|
}
|
|
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
|
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
function _defineProperty(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _getPrototypeOf(o) {
|
|
13
26
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
27
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -79,7 +92,9 @@ var FormControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
79
92
|
_classCallCheck(this, FormControl);
|
|
80
93
|
var _this;
|
|
81
94
|
_this = _super.call(this, props);
|
|
82
|
-
_this
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "controlType", "form");
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "props", void 0);
|
|
97
|
+
_defineProperty(_assertThisInitialized(_this), "value", void 0);
|
|
83
98
|
_this.props = new BaseControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
84
99
|
return _this;
|
|
85
100
|
}
|
|
@@ -46,6 +46,20 @@ function _classCallCheck(instance, Constructor) {
|
|
|
46
46
|
throw new TypeError("Cannot call a class as a function");
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
+
function _defineProperties(target, props) {
|
|
50
|
+
for(var i = 0; i < props.length; i++){
|
|
51
|
+
var descriptor = props[i];
|
|
52
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
53
|
+
descriptor.configurable = true;
|
|
54
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
55
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
59
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
60
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
61
|
+
return Constructor;
|
|
62
|
+
}
|
|
49
63
|
function _defineProperty(obj, key, value) {
|
|
50
64
|
if (key in obj) {
|
|
51
65
|
Object.defineProperty(obj, key, {
|
|
@@ -314,7 +328,11 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
314
328
|
_classCallCheck(this, LayoutControl);
|
|
315
329
|
var _this;
|
|
316
330
|
_this = _super.call(this, props);
|
|
317
|
-
_this
|
|
331
|
+
_defineProperty(_assertThisInitialized(_this), "controlType", "layout");
|
|
332
|
+
_defineProperty(_assertThisInitialized(_this), "children", void 0);
|
|
333
|
+
_defineProperty(_assertThisInitialized(_this), "excludes", void 0);
|
|
334
|
+
_defineProperty(_assertThisInitialized(_this), "childrenMaxLength", void 0);
|
|
335
|
+
_defineProperty(_assertThisInitialized(_this), "props", void 0);
|
|
318
336
|
var _ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = _ref.excludes, childrenMaxLength = _ref.childrenMaxLength;
|
|
319
337
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
320
338
|
defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
@@ -322,79 +340,95 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
322
340
|
_this.childrenMaxLength = childrenMaxLength;
|
|
323
341
|
return _this;
|
|
324
342
|
}
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
var _this1 = this, _superprop_get_validate = function() {
|
|
339
|
-
return _get(_getPrototypeOf(LayoutControl.prototype), "validate", _this);
|
|
340
|
-
};
|
|
341
|
-
return _asyncToGenerator(function() {
|
|
342
|
-
return __generator(this, function(_state) {
|
|
343
|
-
switch(_state.label){
|
|
344
|
-
case 0:
|
|
345
|
-
return [
|
|
346
|
-
4,
|
|
347
|
-
_superprop_get_validate().call(_this1, messages, ignore)
|
|
348
|
-
];
|
|
349
|
-
case 1:
|
|
350
|
-
_state.sent();
|
|
351
|
-
return [
|
|
352
|
-
4,
|
|
353
|
-
Promise.all(_this1.children.map(function(child) {
|
|
354
|
-
return child.validate(messages, ignore);
|
|
355
|
-
}))
|
|
356
|
-
];
|
|
357
|
-
case 2:
|
|
358
|
-
_state.sent();
|
|
359
|
-
return [
|
|
360
|
-
2,
|
|
361
|
-
true
|
|
362
|
-
];
|
|
343
|
+
_createClass(LayoutControl, [
|
|
344
|
+
{
|
|
345
|
+
key: "judgeExcludesChildren",
|
|
346
|
+
value: function judgeExcludesChildren(type) {
|
|
347
|
+
return this.excludes === false || Array.isArray(this.excludes) && !this.excludes.includes(type);
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
key: "judgeJoinChildren",
|
|
352
|
+
value: function judgeJoinChildren(type) {
|
|
353
|
+
var canJoin = this.judgeExcludesChildren(type);
|
|
354
|
+
if (canJoin) {
|
|
355
|
+
return this.childrenMaxLength > this.children.length;
|
|
363
356
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
357
|
+
return canJoin;
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
key: "validate",
|
|
362
|
+
value: function validate(messages, ignore) {
|
|
363
|
+
var _this = this;
|
|
364
|
+
var _this1 = this, _superprop_get_validate = function() {
|
|
365
|
+
return _get(_getPrototypeOf(LayoutControl.prototype), "validate", _this);
|
|
366
|
+
};
|
|
367
|
+
return _asyncToGenerator(function() {
|
|
368
|
+
return __generator(this, function(_state) {
|
|
369
|
+
switch(_state.label){
|
|
370
|
+
case 0:
|
|
371
|
+
return [
|
|
372
|
+
4,
|
|
373
|
+
_superprop_get_validate().call(_this1, messages, ignore)
|
|
374
|
+
];
|
|
375
|
+
case 1:
|
|
376
|
+
_state.sent();
|
|
377
|
+
return [
|
|
378
|
+
4,
|
|
379
|
+
Promise.all(_this1.children.map(function(child) {
|
|
380
|
+
return child.validate(messages, ignore);
|
|
381
|
+
}))
|
|
382
|
+
];
|
|
383
|
+
case 2:
|
|
384
|
+
_state.sent();
|
|
385
|
+
return [
|
|
386
|
+
2,
|
|
387
|
+
true
|
|
388
|
+
];
|
|
389
|
+
}
|
|
390
|
+
});
|
|
391
|
+
})();
|
|
392
|
+
}
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
key: "toDataBindModel",
|
|
396
|
+
value: function toDataBindModel() {
|
|
397
|
+
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
398
|
+
var dataBindModel = _get(_getPrototypeOf(LayoutControl.prototype), "toDataBindModel", this).call(this);
|
|
399
|
+
var result = dataBindModel ? [
|
|
400
|
+
dataBindModel
|
|
401
|
+
] : [];
|
|
402
|
+
return this.children.reduce(function(arr, current) {
|
|
403
|
+
var model = current.toDataBindModel(parentId);
|
|
404
|
+
if (Array.isArray(model)) {
|
|
405
|
+
var filteredModel = model.filter(function(item) {
|
|
406
|
+
return !!item;
|
|
407
|
+
});
|
|
408
|
+
return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
|
|
409
|
+
}
|
|
410
|
+
model && arr.push(model);
|
|
411
|
+
return arr;
|
|
412
|
+
}, result);
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
key: "toSchema",
|
|
417
|
+
value: function toSchema() {
|
|
418
|
+
var superSchema = _get(_getPrototypeOf(LayoutControl.prototype), "toSchema", this).call(this);
|
|
419
|
+
var children = this.children.map(function(item) {
|
|
420
|
+
var schema = item.toSchema();
|
|
421
|
+
return schema;
|
|
422
|
+
});
|
|
423
|
+
return _objectSpreadProps(_objectSpread({}, superSchema), {
|
|
424
|
+
children: children
|
|
378
425
|
});
|
|
379
|
-
return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
|
|
380
426
|
}
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
}, result);
|
|
384
|
-
};
|
|
385
|
-
_proto.toSchema = function toSchema() {
|
|
386
|
-
var superSchema = _get(_getPrototypeOf(LayoutControl.prototype), "toSchema", this).call(this);
|
|
387
|
-
var children = this.children.map(function(item) {
|
|
388
|
-
var schema = item.toSchema();
|
|
389
|
-
return schema;
|
|
390
|
-
});
|
|
391
|
-
return _objectSpreadProps(_objectSpread({}, superSchema), {
|
|
392
|
-
children: children
|
|
393
|
-
});
|
|
394
|
-
};
|
|
427
|
+
}
|
|
428
|
+
]);
|
|
395
429
|
return LayoutControl;
|
|
396
430
|
}(DesignerControl);
|
|
397
|
-
LayoutControl
|
|
398
|
-
LayoutControl
|
|
431
|
+
_defineProperty(LayoutControl, "excludes", false);
|
|
432
|
+
_defineProperty(LayoutControl, "childrenMaxLength", CHILDREN_MAX_LENGTH);
|
|
399
433
|
export default LayoutControl;
|
|
400
434
|
export { LayoutControl as DesignerLayoutControl };
|
|
@@ -9,6 +9,19 @@ function _classCallCheck(instance, Constructor) {
|
|
|
9
9
|
throw new TypeError("Cannot call a class as a function");
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
|
+
function _defineProperty(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value: value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _getPrototypeOf(o) {
|
|
13
26
|
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
27
|
return o.__proto__ || Object.getPrototypeOf(o);
|
|
@@ -80,7 +93,9 @@ var LayoutControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
80
93
|
_classCallCheck(this, LayoutControl);
|
|
81
94
|
var _this;
|
|
82
95
|
_this = _super.call(this, props);
|
|
83
|
-
_this
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "controlType", "layout");
|
|
97
|
+
_defineProperty(_assertThisInitialized(_this), "children", void 0);
|
|
98
|
+
_defineProperty(_assertThisInitialized(_this), "props", void 0);
|
|
84
99
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
85
100
|
defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
86
101
|
return _this;
|