@byteluck-fe/model-driven-core 1.3.0-beta.28 → 1.5.0-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 +409 -0
- package/dist/esm/common/BaseControl/index.js +12 -0
- package/dist/esm/common/BaseControl/property.js +160 -0
- package/dist/esm/common/BaseControl/runtime.js +72 -0
- package/dist/esm/common/BaseControl/types.js +1 -0
- package/dist/esm/common/ColumnControl/designer.js +89 -0
- package/dist/esm/common/ColumnControl/index.js +11 -0
- package/dist/esm/common/ColumnControl/property.js +157 -0
- package/dist/esm/common/ColumnControl/runtime.js +89 -0
- package/dist/esm/common/ColumnControl/types.js +0 -0
- package/dist/esm/common/ControlArray.js +100 -0
- package/dist/esm/common/FormControl/designer.js +94 -0
- package/dist/esm/common/FormControl/index.js +11 -0
- package/dist/esm/common/FormControl/property.js +262 -0
- package/dist/esm/common/FormControl/runtime.js +89 -0
- package/dist/esm/common/FormControl/types.js +0 -0
- package/dist/esm/common/LayoutControl/designer.js +300 -0
- package/dist/esm/common/LayoutControl/index.js +11 -0
- package/dist/esm/common/LayoutControl/property.js +84 -0
- package/dist/esm/common/LayoutControl/runtime.js +91 -0
- package/dist/esm/common/LayoutControl/types.js +0 -0
- package/dist/esm/common/ListControl/designer.js +276 -0
- package/dist/esm/common/ListControl/index.js +11 -0
- package/dist/esm/common/ListControl/property.js +88 -0
- package/dist/esm/common/ListControl/runtime.js +113 -0
- package/dist/esm/common/ListControl/types.js +0 -0
- package/dist/esm/common/SearchViewControl/designer.js +89 -0
- package/dist/esm/common/SearchViewControl/index.js +11 -0
- package/dist/esm/common/SearchViewControl/property.js +88 -0
- package/dist/esm/common/SearchViewControl/runtime.js +89 -0
- package/dist/esm/common/SearchViewControl/types.js +0 -0
- package/dist/esm/common/Validator.js +16 -0
- package/dist/esm/common/WrapControl/designer.js +89 -0
- package/dist/esm/common/WrapControl/index.js +11 -0
- package/dist/esm/common/WrapControl/property.js +84 -0
- package/dist/esm/common/WrapControl/runtime.js +89 -0
- package/dist/esm/common/WrapControl/types.js +0 -0
- package/dist/esm/common/controlHooksEmitter.js +3 -0
- package/dist/esm/common/index.js +11 -0
- package/dist/esm/common/initOptionAndDataSourceRules.js +227 -0
- package/dist/esm/framework/RegisterControls.js +149 -0
- package/dist/esm/framework/index.js +690 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/type.js +1 -0
- package/dist/index.umd.js +1 -0
- package/dist/types/common/BaseControl/designer.d.ts +62 -0
- package/dist/types/common/BaseControl/index.d.ts +13 -0
- package/dist/types/common/BaseControl/property.d.ts +22 -0
- package/dist/types/common/BaseControl/runtime.d.ts +22 -0
- package/dist/types/common/BaseControl/types.d.ts +35 -0
- package/dist/types/common/ColumnControl/designer.d.ts +10 -0
- package/dist/types/common/ColumnControl/index.d.ts +12 -0
- package/dist/types/common/ColumnControl/property.d.ts +30 -0
- package/dist/types/common/ColumnControl/runtime.d.ts +10 -0
- package/dist/types/common/ColumnControl/types.d.ts +0 -0
- package/dist/types/common/ControlArray.d.ts +8 -0
- package/dist/types/common/FormControl/designer.d.ts +13 -0
- package/dist/types/common/FormControl/index.d.ts +12 -0
- package/dist/types/common/FormControl/property.d.ts +44 -0
- package/dist/types/common/FormControl/runtime.d.ts +11 -0
- package/dist/types/common/FormControl/types.d.ts +0 -0
- package/dist/types/common/LayoutControl/designer.d.ts +21 -0
- package/dist/types/common/LayoutControl/index.d.ts +12 -0
- package/dist/types/common/LayoutControl/property.d.ts +6 -0
- package/dist/types/common/LayoutControl/runtime.d.ts +11 -0
- package/dist/types/common/LayoutControl/types.d.ts +0 -0
- package/dist/types/common/ListControl/designer.d.ts +16 -0
- package/dist/types/common/ListControl/index.d.ts +12 -0
- package/dist/types/common/ListControl/property.d.ts +12 -0
- package/dist/types/common/ListControl/runtime.d.ts +12 -0
- package/dist/types/common/ListControl/types.d.ts +0 -0
- package/dist/types/common/SearchViewControl/designer.d.ts +11 -0
- package/dist/types/common/SearchViewControl/index.d.ts +12 -0
- package/dist/types/common/SearchViewControl/property.d.ts +8 -0
- package/dist/types/common/SearchViewControl/runtime.d.ts +11 -0
- package/dist/types/common/SearchViewControl/types.d.ts +0 -0
- package/dist/types/common/Validator.d.ts +15 -0
- package/dist/types/common/WrapControl/designer.d.ts +11 -0
- package/dist/types/common/WrapControl/index.d.ts +12 -0
- package/dist/types/common/WrapControl/property.d.ts +6 -0
- package/dist/types/common/WrapControl/runtime.d.ts +11 -0
- package/dist/types/common/WrapControl/types.d.ts +0 -0
- package/dist/types/common/controlHooksEmitter.d.ts +4 -0
- package/dist/types/common/index.d.ts +11 -0
- package/dist/types/common/initOptionAndDataSourceRules.d.ts +10 -0
- package/dist/types/framework/RegisterControls.d.ts +33 -0
- package/dist/types/framework/index.d.ts +349 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/type.d.ts +91 -0
- package/package.json +4 -4
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
function _assertThisInitialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function _classCallCheck(instance, Constructor) {
|
|
8
|
+
if (!(instance instanceof Constructor)) {
|
|
9
|
+
throw new TypeError("Cannot call a class as a function");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function _getPrototypeOf(o) {
|
|
13
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
15
|
+
};
|
|
16
|
+
return _getPrototypeOf(o);
|
|
17
|
+
}
|
|
18
|
+
function _inherits(subClass, superClass) {
|
|
19
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
20
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
21
|
+
}
|
|
22
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
23
|
+
constructor: {
|
|
24
|
+
value: subClass,
|
|
25
|
+
writable: true,
|
|
26
|
+
configurable: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
30
|
+
}
|
|
31
|
+
function _instanceof(left, right) {
|
|
32
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
33
|
+
return !!right[Symbol.hasInstance](left);
|
|
34
|
+
} else {
|
|
35
|
+
return left instanceof right;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function _possibleConstructorReturn(self, call) {
|
|
39
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
40
|
+
return call;
|
|
41
|
+
}
|
|
42
|
+
return _assertThisInitialized(self);
|
|
43
|
+
}
|
|
44
|
+
function _setPrototypeOf(o, p) {
|
|
45
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
46
|
+
o.__proto__ = p;
|
|
47
|
+
return o;
|
|
48
|
+
};
|
|
49
|
+
return _setPrototypeOf(o, p);
|
|
50
|
+
}
|
|
51
|
+
var _typeof = function(obj) {
|
|
52
|
+
"@swc/helpers - typeof";
|
|
53
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
54
|
+
};
|
|
55
|
+
function _isNativeReflectConstruct() {
|
|
56
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
57
|
+
if (Reflect.construct.sham) return false;
|
|
58
|
+
if (typeof Proxy === "function") return true;
|
|
59
|
+
try {
|
|
60
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
61
|
+
return true;
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function _createSuper(Derived) {
|
|
67
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
68
|
+
return function _createSuperInternal() {
|
|
69
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
70
|
+
if (hasNativeReflectConstruct) {
|
|
71
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
72
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
73
|
+
} else {
|
|
74
|
+
result = Super.apply(this, arguments);
|
|
75
|
+
}
|
|
76
|
+
return _possibleConstructorReturn(this, result);
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
import { RulesMessage, JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
80
|
+
import { Property, PropertyRules, PropertyRuntimeRules } from "../BaseControl";
|
|
81
|
+
import { initOptionAndDataSourceRules } from "../initOptionAndDataSourceRules";
|
|
82
|
+
import { DataBind } from "../../framework";
|
|
83
|
+
var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
84
|
+
"use strict";
|
|
85
|
+
_inherits(BaseControlPropertyRules, PropertyRules);
|
|
86
|
+
var _super = _createSuper(BaseControlPropertyRules);
|
|
87
|
+
function BaseControlPropertyRules(props) {
|
|
88
|
+
_classCallCheck(this, BaseControlPropertyRules);
|
|
89
|
+
var _this;
|
|
90
|
+
_this = _super.call(this, props);
|
|
91
|
+
_this.dataBind = {};
|
|
92
|
+
_this.caption = {
|
|
93
|
+
type: "string",
|
|
94
|
+
required: true,
|
|
95
|
+
message: RulesMessage.getMessage("pleaseEnterCaption")
|
|
96
|
+
};
|
|
97
|
+
_this.isHideCaption = {
|
|
98
|
+
type: "boolean"
|
|
99
|
+
};
|
|
100
|
+
_this.labelPosition = {
|
|
101
|
+
type: "enum",
|
|
102
|
+
enum: [
|
|
103
|
+
"top",
|
|
104
|
+
"left"
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
// 去掉placeholder必填校验
|
|
108
|
+
// public placeholder: RuleItem = {
|
|
109
|
+
// required: true,
|
|
110
|
+
// type: 'string',
|
|
111
|
+
// message: RulesMessage.getMessage('pleaseEnterPlaceholder'),
|
|
112
|
+
// }
|
|
113
|
+
_this.defaultState = {
|
|
114
|
+
type: "enum",
|
|
115
|
+
enum: [
|
|
116
|
+
"default",
|
|
117
|
+
"readonly"
|
|
118
|
+
]
|
|
119
|
+
};
|
|
120
|
+
_this.required = {
|
|
121
|
+
type: "boolean"
|
|
122
|
+
};
|
|
123
|
+
_this.captionTip = {
|
|
124
|
+
type: "string",
|
|
125
|
+
required: false,
|
|
126
|
+
message: RulesMessage.getMessage("pleaseEnterCaptionTip")
|
|
127
|
+
};
|
|
128
|
+
// 初始化dataBind的校验规则
|
|
129
|
+
var validateFields = {
|
|
130
|
+
fieldCode: {
|
|
131
|
+
type: "string",
|
|
132
|
+
required: true,
|
|
133
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
134
|
+
},
|
|
135
|
+
dataCode: {
|
|
136
|
+
type: "string",
|
|
137
|
+
required: true,
|
|
138
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
if (_instanceof(props.dataBind, DataBind)) {
|
|
142
|
+
_this.dataBind = {
|
|
143
|
+
type: "object",
|
|
144
|
+
required: true,
|
|
145
|
+
fields: JSONCopy(validateFields),
|
|
146
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
147
|
+
};
|
|
148
|
+
} else {
|
|
149
|
+
var dataBind = {
|
|
150
|
+
type: "object",
|
|
151
|
+
required: true,
|
|
152
|
+
fields: {},
|
|
153
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
154
|
+
};
|
|
155
|
+
Object.keys(props.dataBind).forEach(function(key) {
|
|
156
|
+
dataBind.fields[key] = {
|
|
157
|
+
type: "object",
|
|
158
|
+
required: true,
|
|
159
|
+
fields: JSONCopy(validateFields),
|
|
160
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
161
|
+
};
|
|
162
|
+
});
|
|
163
|
+
_this.dataBind = dataBind;
|
|
164
|
+
}
|
|
165
|
+
if (props.isShowCaptionTip) {
|
|
166
|
+
_this.captionTip.required = true;
|
|
167
|
+
}
|
|
168
|
+
return _this;
|
|
169
|
+
}
|
|
170
|
+
return BaseControlPropertyRules;
|
|
171
|
+
}(PropertyRules);
|
|
172
|
+
var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRules) {
|
|
173
|
+
"use strict";
|
|
174
|
+
_inherits(BaseControlPropertyRuntimeRules, PropertyRuntimeRules);
|
|
175
|
+
var _super = _createSuper(BaseControlPropertyRuntimeRules);
|
|
176
|
+
function BaseControlPropertyRuntimeRules(props) {
|
|
177
|
+
_classCallCheck(this, BaseControlPropertyRuntimeRules);
|
|
178
|
+
var _this;
|
|
179
|
+
_this = _super.call(this, props);
|
|
180
|
+
_this.push({
|
|
181
|
+
type: "string",
|
|
182
|
+
required: props.isHide ? false : props.required,
|
|
183
|
+
message: props.requiredMessage !== "" ? props.requiredMessage : RulesMessage.getMessage("runtimeRequired", {
|
|
184
|
+
caption: props.caption
|
|
185
|
+
})
|
|
186
|
+
});
|
|
187
|
+
return _this;
|
|
188
|
+
}
|
|
189
|
+
return BaseControlPropertyRuntimeRules;
|
|
190
|
+
}(PropertyRuntimeRules);
|
|
191
|
+
// 基础控件共用的属性
|
|
192
|
+
var BaseControlProperty = /*#__PURE__*/ function(Property) {
|
|
193
|
+
"use strict";
|
|
194
|
+
_inherits(BaseControlProperty, Property);
|
|
195
|
+
var _super = _createSuper(BaseControlProperty);
|
|
196
|
+
function BaseControlProperty(props) {
|
|
197
|
+
_classCallCheck(this, BaseControlProperty);
|
|
198
|
+
var _this;
|
|
199
|
+
_this = _super.call(this, props);
|
|
200
|
+
var ref;
|
|
201
|
+
_this.caption = (ref = props === null || props === void 0 ? void 0 : props.caption) !== null && ref !== void 0 ? ref : "";
|
|
202
|
+
var ref1;
|
|
203
|
+
_this.isHideCaption = (ref1 = props === null || props === void 0 ? void 0 : props.isHideCaption) !== null && ref1 !== void 0 ? ref1 : false;
|
|
204
|
+
var ref2;
|
|
205
|
+
_this.isShowCaptionTip = (ref2 = props === null || props === void 0 ? void 0 : props.isShowCaptionTip) !== null && ref2 !== void 0 ? ref2 : false;
|
|
206
|
+
var ref3;
|
|
207
|
+
_this.captionTip = (ref3 = props === null || props === void 0 ? void 0 : props.captionTip) !== null && ref3 !== void 0 ? ref3 : "";
|
|
208
|
+
var ref4;
|
|
209
|
+
_this.defaultState = (ref4 = props === null || props === void 0 ? void 0 : props.defaultState) !== null && ref4 !== void 0 ? ref4 : "default";
|
|
210
|
+
var ref5;
|
|
211
|
+
_this.labelPosition = (ref5 = props === null || props === void 0 ? void 0 : props.labelPosition) !== null && ref5 !== void 0 ? ref5 : "top";
|
|
212
|
+
var ref6;
|
|
213
|
+
_this.placeholder = (ref6 = props === null || props === void 0 ? void 0 : props.placeholder) !== null && ref6 !== void 0 ? ref6 : "";
|
|
214
|
+
var ref7;
|
|
215
|
+
_this.required = (ref7 = props === null || props === void 0 ? void 0 : props.required) !== null && ref7 !== void 0 ? ref7 : false;
|
|
216
|
+
var ref8;
|
|
217
|
+
_this.requiredMessage = (ref8 = props === null || props === void 0 ? void 0 : props.requiredMessage) !== null && ref8 !== void 0 ? ref8 : "";
|
|
218
|
+
//form 组件优先初始化DataBind
|
|
219
|
+
_this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
|
|
220
|
+
var ref9;
|
|
221
|
+
_this.defaultValue = (ref9 = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && ref9 !== void 0 ? ref9 : "";
|
|
222
|
+
return _this;
|
|
223
|
+
}
|
|
224
|
+
return BaseControlProperty;
|
|
225
|
+
}(Property);
|
|
226
|
+
BaseControlProperty.Rules = BaseControlPropertyRules;
|
|
227
|
+
BaseControlProperty.RuntimeRules = BaseControlPropertyRuntimeRules;
|
|
228
|
+
var OptionAndDataSourcePropertyRules = /*#__PURE__*/ function(BaseControlPropertyRules) {
|
|
229
|
+
"use strict";
|
|
230
|
+
_inherits(OptionAndDataSourcePropertyRules, BaseControlPropertyRules);
|
|
231
|
+
var _super = _createSuper(OptionAndDataSourcePropertyRules);
|
|
232
|
+
function OptionAndDataSourcePropertyRules(props) {
|
|
233
|
+
_classCallCheck(this, OptionAndDataSourcePropertyRules);
|
|
234
|
+
var _this;
|
|
235
|
+
_this = _super.call(this, props);
|
|
236
|
+
_this.optionConfig = {
|
|
237
|
+
type: "enum",
|
|
238
|
+
enum: [
|
|
239
|
+
"custom",
|
|
240
|
+
"datasource"
|
|
241
|
+
],
|
|
242
|
+
message: RulesMessage.getMessage("PleaseSelectTheCorrectOptionSettings")
|
|
243
|
+
};
|
|
244
|
+
_this.options = [
|
|
245
|
+
{
|
|
246
|
+
type: "array",
|
|
247
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
248
|
+
},
|
|
249
|
+
];
|
|
250
|
+
_this.datasourceBind = [
|
|
251
|
+
{
|
|
252
|
+
type: "object",
|
|
253
|
+
message: RulesMessage.getMessage("isNotObject")
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
initOptionAndDataSourceRules.call(_assertThisInitialized(_this), props);
|
|
257
|
+
return _this;
|
|
258
|
+
}
|
|
259
|
+
return OptionAndDataSourcePropertyRules;
|
|
260
|
+
}(BaseControlPropertyRules);
|
|
261
|
+
export default BaseControlProperty;
|
|
262
|
+
export { BaseControlProperty, BaseControlPropertyRules, BaseControlPropertyRuntimeRules, OptionAndDataSourcePropertyRules, };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function _assertThisInitialized(self) {
|
|
2
|
+
if (self === void 0) {
|
|
3
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
4
|
+
}
|
|
5
|
+
return self;
|
|
6
|
+
}
|
|
7
|
+
function _classCallCheck(instance, Constructor) {
|
|
8
|
+
if (!(instance instanceof Constructor)) {
|
|
9
|
+
throw new TypeError("Cannot call a class as a function");
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function _getPrototypeOf(o) {
|
|
13
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
14
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
15
|
+
};
|
|
16
|
+
return _getPrototypeOf(o);
|
|
17
|
+
}
|
|
18
|
+
function _inherits(subClass, superClass) {
|
|
19
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
20
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
21
|
+
}
|
|
22
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
23
|
+
constructor: {
|
|
24
|
+
value: subClass,
|
|
25
|
+
writable: true,
|
|
26
|
+
configurable: true
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
30
|
+
}
|
|
31
|
+
function _possibleConstructorReturn(self, call) {
|
|
32
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
33
|
+
return call;
|
|
34
|
+
}
|
|
35
|
+
return _assertThisInitialized(self);
|
|
36
|
+
}
|
|
37
|
+
function _setPrototypeOf(o, p) {
|
|
38
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
39
|
+
o.__proto__ = p;
|
|
40
|
+
return o;
|
|
41
|
+
};
|
|
42
|
+
return _setPrototypeOf(o, p);
|
|
43
|
+
}
|
|
44
|
+
var _typeof = function(obj) {
|
|
45
|
+
"@swc/helpers - typeof";
|
|
46
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
47
|
+
};
|
|
48
|
+
function _isNativeReflectConstruct() {
|
|
49
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
50
|
+
if (Reflect.construct.sham) return false;
|
|
51
|
+
if (typeof Proxy === "function") return true;
|
|
52
|
+
try {
|
|
53
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
54
|
+
return true;
|
|
55
|
+
} catch (e) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
function _createSuper(Derived) {
|
|
60
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
61
|
+
return function _createSuperInternal() {
|
|
62
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
63
|
+
if (hasNativeReflectConstruct) {
|
|
64
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
65
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
66
|
+
} else {
|
|
67
|
+
result = Super.apply(this, arguments);
|
|
68
|
+
}
|
|
69
|
+
return _possibleConstructorReturn(this, result);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
import { RuntimeControl } from "../BaseControl";
|
|
73
|
+
import BaseControlProperty from "./property";
|
|
74
|
+
var FormControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
75
|
+
"use strict";
|
|
76
|
+
_inherits(FormControl, RuntimeControl);
|
|
77
|
+
var _super = _createSuper(FormControl);
|
|
78
|
+
function FormControl(props) {
|
|
79
|
+
_classCallCheck(this, FormControl);
|
|
80
|
+
var _this;
|
|
81
|
+
_this = _super.call(this, props);
|
|
82
|
+
_this.controlType = "form";
|
|
83
|
+
_this.props = new BaseControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
84
|
+
return _this;
|
|
85
|
+
}
|
|
86
|
+
return FormControl;
|
|
87
|
+
}(RuntimeControl);
|
|
88
|
+
export default FormControl;
|
|
89
|
+
export { FormControl as RuntimeFormControl };
|
|
File without changes
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
function _arrayLikeToArray(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _arrayWithoutHoles(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
8
|
+
}
|
|
9
|
+
function _assertThisInitialized(self) {
|
|
10
|
+
if (self === void 0) {
|
|
11
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
12
|
+
}
|
|
13
|
+
return self;
|
|
14
|
+
}
|
|
15
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
16
|
+
try {
|
|
17
|
+
var info = gen[key](arg);
|
|
18
|
+
var value = info.value;
|
|
19
|
+
} catch (error) {
|
|
20
|
+
reject(error);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (info.done) {
|
|
24
|
+
resolve(value);
|
|
25
|
+
} else {
|
|
26
|
+
Promise.resolve(value).then(_next, _throw);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _asyncToGenerator(fn) {
|
|
30
|
+
return function() {
|
|
31
|
+
var self = this, args = arguments;
|
|
32
|
+
return new Promise(function(resolve, reject) {
|
|
33
|
+
var gen = fn.apply(self, args);
|
|
34
|
+
function _next(value) {
|
|
35
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
36
|
+
}
|
|
37
|
+
function _throw(err) {
|
|
38
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
39
|
+
}
|
|
40
|
+
_next(undefined);
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function _classCallCheck(instance, Constructor) {
|
|
45
|
+
if (!(instance instanceof Constructor)) {
|
|
46
|
+
throw new TypeError("Cannot call a class as a function");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
function _defineProperty(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
function _get(target, property, receiver) {
|
|
63
|
+
if (typeof Reflect !== "undefined" && Reflect.get) {
|
|
64
|
+
_get = Reflect.get;
|
|
65
|
+
} else {
|
|
66
|
+
_get = function _get(target, property, receiver) {
|
|
67
|
+
var base = _superPropBase(target, property);
|
|
68
|
+
if (!base) return;
|
|
69
|
+
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
70
|
+
if (desc.get) {
|
|
71
|
+
return desc.get.call(receiver);
|
|
72
|
+
}
|
|
73
|
+
return desc.value;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
return _get(target, property, receiver || target);
|
|
77
|
+
}
|
|
78
|
+
function _getPrototypeOf(o) {
|
|
79
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
|
|
80
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
81
|
+
};
|
|
82
|
+
return _getPrototypeOf(o);
|
|
83
|
+
}
|
|
84
|
+
function _inherits(subClass, superClass) {
|
|
85
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
86
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
87
|
+
}
|
|
88
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
89
|
+
constructor: {
|
|
90
|
+
value: subClass,
|
|
91
|
+
writable: true,
|
|
92
|
+
configurable: true
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
96
|
+
}
|
|
97
|
+
function _instanceof(left, right) {
|
|
98
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
99
|
+
return !!right[Symbol.hasInstance](left);
|
|
100
|
+
} else {
|
|
101
|
+
return left instanceof right;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function _iterableToArray(iter) {
|
|
105
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
106
|
+
}
|
|
107
|
+
function _nonIterableSpread() {
|
|
108
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
109
|
+
}
|
|
110
|
+
function _objectSpread(target) {
|
|
111
|
+
for(var i = 1; i < arguments.length; i++){
|
|
112
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
113
|
+
var ownKeys = Object.keys(source);
|
|
114
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
115
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
116
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
ownKeys.forEach(function(key) {
|
|
120
|
+
_defineProperty(target, key, source[key]);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
return target;
|
|
124
|
+
}
|
|
125
|
+
function ownKeys(object, enumerableOnly) {
|
|
126
|
+
var keys = Object.keys(object);
|
|
127
|
+
if (Object.getOwnPropertySymbols) {
|
|
128
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
129
|
+
if (enumerableOnly) {
|
|
130
|
+
symbols = symbols.filter(function(sym) {
|
|
131
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
keys.push.apply(keys, symbols);
|
|
135
|
+
}
|
|
136
|
+
return keys;
|
|
137
|
+
}
|
|
138
|
+
function _objectSpreadProps(target, source) {
|
|
139
|
+
source = source != null ? source : {};
|
|
140
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
141
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
142
|
+
} else {
|
|
143
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
144
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
return target;
|
|
148
|
+
}
|
|
149
|
+
function _possibleConstructorReturn(self, call) {
|
|
150
|
+
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
151
|
+
return call;
|
|
152
|
+
}
|
|
153
|
+
return _assertThisInitialized(self);
|
|
154
|
+
}
|
|
155
|
+
function _setPrototypeOf(o, p) {
|
|
156
|
+
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
|
|
157
|
+
o.__proto__ = p;
|
|
158
|
+
return o;
|
|
159
|
+
};
|
|
160
|
+
return _setPrototypeOf(o, p);
|
|
161
|
+
}
|
|
162
|
+
function _superPropBase(object, property) {
|
|
163
|
+
while(!Object.prototype.hasOwnProperty.call(object, property)){
|
|
164
|
+
object = _getPrototypeOf(object);
|
|
165
|
+
if (object === null) break;
|
|
166
|
+
}
|
|
167
|
+
return object;
|
|
168
|
+
}
|
|
169
|
+
function _toConsumableArray(arr) {
|
|
170
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
171
|
+
}
|
|
172
|
+
var _typeof = function(obj) {
|
|
173
|
+
"@swc/helpers - typeof";
|
|
174
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
175
|
+
};
|
|
176
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
177
|
+
if (!o) return;
|
|
178
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
179
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
180
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
181
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
182
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
183
|
+
}
|
|
184
|
+
function _isNativeReflectConstruct() {
|
|
185
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
186
|
+
if (Reflect.construct.sham) return false;
|
|
187
|
+
if (typeof Proxy === "function") return true;
|
|
188
|
+
try {
|
|
189
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
190
|
+
return true;
|
|
191
|
+
} catch (e) {
|
|
192
|
+
return false;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function _createSuper(Derived) {
|
|
196
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
197
|
+
return function _createSuperInternal() {
|
|
198
|
+
var Super = _getPrototypeOf(Derived), result;
|
|
199
|
+
if (hasNativeReflectConstruct) {
|
|
200
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
201
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
202
|
+
} else {
|
|
203
|
+
result = Super.apply(this, arguments);
|
|
204
|
+
}
|
|
205
|
+
return _possibleConstructorReturn(this, result);
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
209
|
+
import { JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
210
|
+
import { DesignerControl } from "../BaseControl";
|
|
211
|
+
import LayoutControlProperty from "./property";
|
|
212
|
+
import { defineControlArrayToProperty } from "../ControlArray";
|
|
213
|
+
// 最大可拖入数量
|
|
214
|
+
var CHILDREN_MAX_LENGTH = 10000;
|
|
215
|
+
var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
216
|
+
"use strict";
|
|
217
|
+
_inherits(LayoutControl, DesignerControl);
|
|
218
|
+
var _super = _createSuper(LayoutControl);
|
|
219
|
+
function LayoutControl(props) {
|
|
220
|
+
_classCallCheck(this, LayoutControl);
|
|
221
|
+
var _this;
|
|
222
|
+
_this = _super.call(this, props);
|
|
223
|
+
_this.controlType = "layout";
|
|
224
|
+
var ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = ref.excludes, childrenMaxLength = ref.childrenMaxLength;
|
|
225
|
+
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
226
|
+
defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
227
|
+
_this.excludes = JSONCopy(excludes);
|
|
228
|
+
_this.childrenMaxLength = childrenMaxLength;
|
|
229
|
+
return _this;
|
|
230
|
+
}
|
|
231
|
+
var _proto = LayoutControl.prototype;
|
|
232
|
+
_proto.judgeExcludesChildren = function judgeExcludesChildren(type) {
|
|
233
|
+
return this.excludes === false || Array.isArray(this.excludes) && !this.excludes.includes(type);
|
|
234
|
+
};
|
|
235
|
+
_proto.judgeJoinChildren = function judgeJoinChildren(type) {
|
|
236
|
+
var canJoin = this.judgeExcludesChildren(type);
|
|
237
|
+
if (canJoin) {
|
|
238
|
+
return this.childrenMaxLength > this.children.length;
|
|
239
|
+
}
|
|
240
|
+
return canJoin;
|
|
241
|
+
};
|
|
242
|
+
_proto.validate = function validate(messages, ignore) {
|
|
243
|
+
var _this = this;
|
|
244
|
+
var _this1 = this, _superprop_get_validate = function() {
|
|
245
|
+
return _get(_getPrototypeOf(LayoutControl.prototype), "validate", _this);
|
|
246
|
+
};
|
|
247
|
+
return _asyncToGenerator(/*#__PURE__*/ regeneratorRuntime.mark(function _callee() {
|
|
248
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
249
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
250
|
+
case 0:
|
|
251
|
+
_ctx.next = 2;
|
|
252
|
+
return _superprop_get_validate().call(_this1, messages, ignore);
|
|
253
|
+
case 2:
|
|
254
|
+
_ctx.next = 4;
|
|
255
|
+
return Promise.all(_this1.children.map(function(child) {
|
|
256
|
+
return child.validate(messages, ignore);
|
|
257
|
+
}));
|
|
258
|
+
case 4:
|
|
259
|
+
return _ctx.abrupt("return", true);
|
|
260
|
+
case 5:
|
|
261
|
+
case "end":
|
|
262
|
+
return _ctx.stop();
|
|
263
|
+
}
|
|
264
|
+
}, _callee);
|
|
265
|
+
}))();
|
|
266
|
+
};
|
|
267
|
+
_proto.toDataBindModel = function toDataBindModel() {
|
|
268
|
+
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
269
|
+
var dataBindModel = _get(_getPrototypeOf(LayoutControl.prototype), "toDataBindModel", this).call(this);
|
|
270
|
+
var result = dataBindModel ? [
|
|
271
|
+
dataBindModel
|
|
272
|
+
] : [];
|
|
273
|
+
return this.children.reduce(function(arr, current) {
|
|
274
|
+
var model = current.toDataBindModel(parentId);
|
|
275
|
+
if (Array.isArray(model)) {
|
|
276
|
+
var filteredModel = model.filter(function(item) {
|
|
277
|
+
return !!item;
|
|
278
|
+
});
|
|
279
|
+
return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
|
|
280
|
+
}
|
|
281
|
+
model && arr.push(model);
|
|
282
|
+
return arr;
|
|
283
|
+
}, result);
|
|
284
|
+
};
|
|
285
|
+
_proto.toSchema = function toSchema() {
|
|
286
|
+
var superSchema = _get(_getPrototypeOf(LayoutControl.prototype), "toSchema", this).call(this);
|
|
287
|
+
var children = this.children.map(function(item) {
|
|
288
|
+
var schema = item.toSchema();
|
|
289
|
+
return schema;
|
|
290
|
+
});
|
|
291
|
+
return _objectSpreadProps(_objectSpread({}, superSchema), {
|
|
292
|
+
children: children
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
return LayoutControl;
|
|
296
|
+
}(DesignerControl);
|
|
297
|
+
LayoutControl.excludes = false;
|
|
298
|
+
LayoutControl.childrenMaxLength = CHILDREN_MAX_LENGTH;
|
|
299
|
+
export default LayoutControl;
|
|
300
|
+
export { LayoutControl as DesignerLayoutControl };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Designer from "./designer";
|
|
2
|
+
import Runtime from "./runtime";
|
|
3
|
+
import Property from "./property";
|
|
4
|
+
export default {
|
|
5
|
+
Designer: Designer,
|
|
6
|
+
Runtime: Runtime,
|
|
7
|
+
Property: Property
|
|
8
|
+
};
|
|
9
|
+
export * from "./designer";
|
|
10
|
+
export * from "./runtime";
|
|
11
|
+
export * from "./property";
|