@byteluck-fe/model-driven-core 2.5.0-beta.4 → 2.5.1-alpha.1
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/api-doc-index.js +4 -4
- package/dist/esm/common/BaseControl/designer.js +215 -96
- package/dist/esm/common/BaseControl/index.js +7 -7
- package/dist/esm/common/BaseControl/property.js +42 -14
- package/dist/esm/common/BaseControl/runtime.js +41 -20
- package/dist/esm/common/ColumnControl/designer.js +19 -5
- package/dist/esm/common/ColumnControl/index.js +6 -6
- package/dist/esm/common/ColumnControl/property.js +95 -47
- package/dist/esm/common/ColumnControl/runtime.js +19 -5
- package/dist/esm/common/ControlArray.js +8 -8
- package/dist/esm/common/FormControl/designer.js +25 -10
- package/dist/esm/common/FormControl/index.js +6 -6
- package/dist/esm/common/FormControl/property.js +152 -87
- package/dist/esm/common/FormControl/runtime.js +20 -5
- package/dist/esm/common/LayoutControl/designer.js +158 -30
- package/dist/esm/common/LayoutControl/index.js +6 -6
- package/dist/esm/common/LayoutControl/property.js +3 -3
- package/dist/esm/common/LayoutControl/runtime.js +22 -7
- package/dist/esm/common/ListControl/designer.js +151 -26
- package/dist/esm/common/ListControl/index.js +6 -6
- package/dist/esm/common/ListControl/property.js +19 -5
- package/dist/esm/common/ListControl/runtime.js +22 -7
- package/dist/esm/common/SearchViewControl/designer.js +19 -5
- package/dist/esm/common/SearchViewControl/index.js +6 -6
- package/dist/esm/common/SearchViewControl/property.js +18 -4
- package/dist/esm/common/SearchViewControl/runtime.js +19 -5
- package/dist/esm/common/Validator.js +5 -5
- package/dist/esm/common/WrapControl/designer.js +19 -5
- package/dist/esm/common/WrapControl/index.js +6 -6
- package/dist/esm/common/WrapControl/property.js +3 -3
- package/dist/esm/common/WrapControl/runtime.js +19 -5
- package/dist/esm/common/controlHooksEmitter.js +1 -1
- package/dist/esm/common/index.js +12 -12
- package/dist/esm/common/initLinkOperationRules.js +6 -6
- package/dist/esm/common/initOptionAndDataSourceRules.js +82 -82
- package/dist/esm/framework/RegisterControls.js +40 -17
- package/dist/esm/framework/index.js +744 -325
- package/dist/esm/index.js +3 -3
- package/dist/index.umd.js +1 -1
- package/dist/types/common/Validator.d.ts +1 -1
- package/dist/types/common/controlHooksEmitter.d.ts +1 -1
- package/dist/types/framework/RegisterControls.d.ts +2 -0
- package/dist/types/type.d.ts +23 -23
- package/package.json +3 -3
|
@@ -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);
|
|
@@ -69,17 +82,18 @@ function _createSuper(Derived) {
|
|
|
69
82
|
return _possibleConstructorReturn(this, result);
|
|
70
83
|
};
|
|
71
84
|
}
|
|
72
|
-
import WrapControlProperty from
|
|
73
|
-
import { RuntimeLayoutControl } from
|
|
74
|
-
var WrapControl = /*#__PURE__*/ function(
|
|
85
|
+
import WrapControlProperty from "./property";
|
|
86
|
+
import { RuntimeLayoutControl } from "../LayoutControl";
|
|
87
|
+
var WrapControl = /*#__PURE__*/ function(RuntimeLayoutControl) {
|
|
75
88
|
"use strict";
|
|
76
|
-
_inherits(WrapControl,
|
|
89
|
+
_inherits(WrapControl, RuntimeLayoutControl);
|
|
77
90
|
var _super = _createSuper(WrapControl);
|
|
78
91
|
function WrapControl(props) {
|
|
79
92
|
_classCallCheck(this, WrapControl);
|
|
80
93
|
var _this;
|
|
81
94
|
_this = _super.call(this, props);
|
|
82
|
-
_this
|
|
95
|
+
_defineProperty(_assertThisInitialized(_this), "controlType", "wrap");
|
|
96
|
+
_defineProperty(_assertThisInitialized(_this), "props", void 0);
|
|
83
97
|
_this.props = new WrapControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
84
98
|
return _this;
|
|
85
99
|
}
|
package/dist/esm/common/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
1
|
+
export * from "./BaseControl";
|
|
2
|
+
export * from "./FormControl";
|
|
3
|
+
export * from "./LayoutControl";
|
|
4
|
+
export * from "./ListControl";
|
|
5
|
+
export * from "./ColumnControl";
|
|
6
|
+
export * from "./SearchViewControl";
|
|
7
|
+
export * from "./WrapControl";
|
|
8
|
+
export * from "./Validator";
|
|
9
|
+
export * from "./ControlArray";
|
|
10
|
+
export * from "./initOptionAndDataSourceRules";
|
|
11
|
+
export * from "./initLinkOperationRules";
|
|
12
|
+
export * from "./controlHooksEmitter";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { RulesMessage } from
|
|
1
|
+
import { RulesMessage } from "@byteluck-fe/model-driven-shared";
|
|
2
2
|
export function initLinkOperationRules(props) {
|
|
3
|
-
if (props.hasOwnProperty(
|
|
3
|
+
if (props.hasOwnProperty("linkOperationOption") && props.hasOwnProperty("showLinkOperation") && props.showLinkOperation) {
|
|
4
4
|
this.linkOperationOption = [
|
|
5
5
|
{
|
|
6
|
-
type:
|
|
6
|
+
type: "object",
|
|
7
7
|
fields: {
|
|
8
8
|
formKey: {
|
|
9
|
-
type:
|
|
9
|
+
type: "string",
|
|
10
10
|
required: true,
|
|
11
|
-
message: RulesMessage.getMessage(
|
|
11
|
+
message: RulesMessage.getMessage("pleaseEnterForm")
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
|
-
}
|
|
14
|
+
}
|
|
15
15
|
];
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import { getNotRepeatItems, RulesMessage } from
|
|
1
|
+
import { getNotRepeatItems, RulesMessage } from "@byteluck-fe/model-driven-shared";
|
|
2
2
|
export function initOptionAndDataSourceRules(props) {
|
|
3
|
-
if (!props.hasOwnProperty(
|
|
3
|
+
if (!props.hasOwnProperty("optionConfig")) {
|
|
4
4
|
this.optionConfig = {
|
|
5
|
-
type:
|
|
5
|
+
type: "any"
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
-
if (!props.hasOwnProperty(
|
|
8
|
+
if (!props.hasOwnProperty("options")) {
|
|
9
9
|
this.options = {
|
|
10
|
-
type:
|
|
10
|
+
type: "any"
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
if (!props.hasOwnProperty(
|
|
13
|
+
if (!props.hasOwnProperty("datasourceBind")) {
|
|
14
14
|
this.datasourceBind = {
|
|
15
|
-
type:
|
|
15
|
+
type: "any"
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
// 有options属性,并且没有optionConfig或者有options并且optionConfig===custom
|
|
19
|
-
if (props.hasOwnProperty(
|
|
19
|
+
if (props.hasOwnProperty("options") && (!props.hasOwnProperty("optionConfig") || props.hasOwnProperty("optionConfig") && props.optionConfig === "custom")) {
|
|
20
20
|
this.options = [
|
|
21
21
|
{
|
|
22
|
-
type:
|
|
23
|
-
message: RulesMessage.getMessage(
|
|
22
|
+
type: "array",
|
|
23
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
|
-
type:
|
|
26
|
+
type: "array",
|
|
27
27
|
defaultField: {
|
|
28
|
-
type:
|
|
28
|
+
type: "object",
|
|
29
29
|
fields: {
|
|
30
30
|
label: {
|
|
31
|
-
type:
|
|
31
|
+
type: "string",
|
|
32
32
|
required: true,
|
|
33
|
-
message: RulesMessage.getMessage(
|
|
33
|
+
message: RulesMessage.getMessage("pleaseEnterLabel")
|
|
34
34
|
},
|
|
35
35
|
value: {
|
|
36
|
-
type:
|
|
36
|
+
type: "string",
|
|
37
37
|
required: true,
|
|
38
|
-
message: RulesMessage.getMessage(
|
|
38
|
+
message: RulesMessage.getMessage("pleaseEnterValue")
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
type:
|
|
44
|
+
type: "array",
|
|
45
45
|
validator: function validator(rule, value, callback) {
|
|
46
46
|
if (value.length === 0) {
|
|
47
|
-
callback(RulesMessage.getMessage(
|
|
47
|
+
callback(RulesMessage.getMessage("optionIsRequired"));
|
|
48
48
|
}
|
|
49
49
|
callback();
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
type:
|
|
53
|
+
type: "array",
|
|
54
54
|
validator: function validator(rule, value, callback) {
|
|
55
55
|
var ids = value.map(function(item) {
|
|
56
56
|
return item.value;
|
|
57
57
|
});
|
|
58
58
|
var notRepeatIds = getNotRepeatItems(ids);
|
|
59
59
|
if (ids.length !== notRepeatIds.length) {
|
|
60
|
-
callback(RulesMessage.getMessage(
|
|
60
|
+
callback(RulesMessage.getMessage("optionIdIsRepeat"));
|
|
61
61
|
} else {
|
|
62
62
|
callback();
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
|
-
message: RulesMessage.getMessage(
|
|
66
|
-
}
|
|
65
|
+
message: RulesMessage.getMessage("optionIdIsRepeat")
|
|
66
|
+
}
|
|
67
67
|
];
|
|
68
|
-
} else if (props.hasOwnProperty(
|
|
68
|
+
} else if (props.hasOwnProperty("datasourceBind") && (!props.hasOwnProperty("optionConfig") || props.hasOwnProperty("optionConfig") && props.optionConfig === "datasource")) {
|
|
69
69
|
this.datasourceBind = [
|
|
70
70
|
{
|
|
71
|
-
type:
|
|
72
|
-
message: RulesMessage.getMessage(
|
|
71
|
+
type: "object",
|
|
72
|
+
message: RulesMessage.getMessage("isNotObject")
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
|
-
type:
|
|
75
|
+
type: "object",
|
|
76
76
|
fields: {
|
|
77
77
|
dataCode: {
|
|
78
|
-
type:
|
|
78
|
+
type: "string",
|
|
79
79
|
required: true,
|
|
80
|
-
message: RulesMessage.getMessage(
|
|
80
|
+
message: RulesMessage.getMessage("pleaseEnterDataCode")
|
|
81
81
|
},
|
|
82
82
|
valueFieldCode: {
|
|
83
|
-
type:
|
|
83
|
+
type: "string",
|
|
84
84
|
required: true,
|
|
85
|
-
message: RulesMessage.getMessage(
|
|
85
|
+
message: RulesMessage.getMessage("pleaseEnterValueFieldCode")
|
|
86
86
|
},
|
|
87
87
|
svcCode: {
|
|
88
|
-
type:
|
|
88
|
+
type: "string",
|
|
89
89
|
required: true,
|
|
90
|
-
message: RulesMessage.getMessage(
|
|
90
|
+
message: RulesMessage.getMessage("pleaseEnterSvcCode")
|
|
91
91
|
},
|
|
92
92
|
displayBoList: [
|
|
93
93
|
{
|
|
94
|
-
type:
|
|
95
|
-
message: RulesMessage.getMessage(
|
|
94
|
+
type: "array",
|
|
95
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
96
96
|
},
|
|
97
97
|
{
|
|
98
|
-
type:
|
|
98
|
+
type: "array",
|
|
99
99
|
validator: function validator(rule, value, callback) {
|
|
100
100
|
if (value.length === 0) {
|
|
101
|
-
callback(RulesMessage.getMessage(
|
|
101
|
+
callback(RulesMessage.getMessage("pleaseBindAtLeastOneDisplayValue"));
|
|
102
102
|
}
|
|
103
103
|
callback();
|
|
104
104
|
},
|
|
105
|
-
message: RulesMessage.getMessage(
|
|
106
|
-
}
|
|
105
|
+
message: RulesMessage.getMessage("pleaseBindAtLeastOneDisplayValue")
|
|
106
|
+
}
|
|
107
107
|
],
|
|
108
108
|
orders: [
|
|
109
109
|
{
|
|
110
|
-
type:
|
|
111
|
-
message: RulesMessage.getMessage(
|
|
110
|
+
type: "array",
|
|
111
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
112
112
|
},
|
|
113
113
|
{
|
|
114
|
-
type:
|
|
114
|
+
type: "array",
|
|
115
115
|
defaultField: {
|
|
116
|
-
type:
|
|
116
|
+
type: "object",
|
|
117
117
|
fields: {
|
|
118
118
|
columnName: {
|
|
119
|
-
type:
|
|
119
|
+
type: "string",
|
|
120
120
|
required: true,
|
|
121
|
-
message: RulesMessage.getMessage(
|
|
121
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
122
122
|
},
|
|
123
123
|
desc: {
|
|
124
|
-
type:
|
|
125
|
-
message: RulesMessage.getMessage(
|
|
124
|
+
type: "boolean",
|
|
125
|
+
message: RulesMessage.getMessage("isNotBoolean")
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
}
|
|
129
|
+
}
|
|
130
130
|
]
|
|
131
131
|
}
|
|
132
|
-
}
|
|
132
|
+
}
|
|
133
133
|
];
|
|
134
134
|
}
|
|
135
135
|
}
|
|
@@ -137,91 +137,91 @@ export function initSuperDataSourceRules(props, attributes) {
|
|
|
137
137
|
var messageInDataSetting = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
138
138
|
this.datasourceBind = [
|
|
139
139
|
{
|
|
140
|
-
type:
|
|
141
|
-
message: RulesMessage.getMessage(
|
|
140
|
+
type: "object",
|
|
141
|
+
message: RulesMessage.getMessage("isNotObject")
|
|
142
142
|
},
|
|
143
143
|
{
|
|
144
|
-
type:
|
|
144
|
+
type: "object",
|
|
145
145
|
fields: {
|
|
146
146
|
dataCode: {
|
|
147
|
-
type:
|
|
147
|
+
type: "string",
|
|
148
148
|
required: true,
|
|
149
|
-
message: RulesMessage.getMessage(messageInDataSetting ?
|
|
149
|
+
message: RulesMessage.getMessage(messageInDataSetting ? "pleaseEnterDataCodeInDataSetting" : "pleaseEnterDataCode")
|
|
150
150
|
},
|
|
151
151
|
valueFieldCode: {
|
|
152
|
-
type:
|
|
152
|
+
type: "string",
|
|
153
153
|
required: true,
|
|
154
|
-
message: RulesMessage.getMessage(messageInDataSetting ?
|
|
154
|
+
message: RulesMessage.getMessage(messageInDataSetting ? "pleaseEnterValueFieldCodeInDataSetting" : "pleaseEnterValueFieldCode")
|
|
155
155
|
},
|
|
156
156
|
svcCode: {
|
|
157
|
-
type:
|
|
157
|
+
type: "string",
|
|
158
158
|
required: true,
|
|
159
|
-
message: RulesMessage.getMessage(messageInDataSetting ?
|
|
159
|
+
message: RulesMessage.getMessage(messageInDataSetting ? "pleaseEnterSvcCodeInDataSetting" : "pleaseEnterSvcCode")
|
|
160
160
|
},
|
|
161
161
|
attributes: [
|
|
162
162
|
{
|
|
163
|
-
type:
|
|
164
|
-
message: RulesMessage.getMessage(
|
|
163
|
+
type: "array",
|
|
164
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
165
165
|
},
|
|
166
166
|
{
|
|
167
|
-
type:
|
|
167
|
+
type: "array",
|
|
168
168
|
defaultField: {
|
|
169
|
-
type:
|
|
169
|
+
type: "object",
|
|
170
170
|
fields: {
|
|
171
171
|
name: {
|
|
172
|
-
type:
|
|
172
|
+
type: "string",
|
|
173
173
|
required: true,
|
|
174
|
-
message: RulesMessage.getMessage(
|
|
174
|
+
message: RulesMessage.getMessage("isNotString")
|
|
175
175
|
},
|
|
176
176
|
key: {
|
|
177
|
-
type:
|
|
177
|
+
type: "string",
|
|
178
178
|
required: true,
|
|
179
|
-
message: RulesMessage.getMessage(
|
|
179
|
+
message: RulesMessage.getMessage("isNotString")
|
|
180
180
|
},
|
|
181
181
|
value: [
|
|
182
182
|
{
|
|
183
|
-
type:
|
|
184
|
-
message: RulesMessage.getMessage(
|
|
183
|
+
type: "array",
|
|
184
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
185
185
|
},
|
|
186
186
|
{
|
|
187
|
-
type:
|
|
187
|
+
type: "array",
|
|
188
188
|
validator: function validator(rule, value, callback) {
|
|
189
189
|
if (value.length === 0) {
|
|
190
|
-
callback(RulesMessage.getMessage(messageInDataSetting ?
|
|
190
|
+
callback(RulesMessage.getMessage(messageInDataSetting ? "pleaseBindAtLeastOneDisplayValueInDataSetting" : "pleaseBindAtLeastOneDisplayValue"));
|
|
191
191
|
}
|
|
192
192
|
callback();
|
|
193
193
|
},
|
|
194
|
-
message: RulesMessage.getMessage(messageInDataSetting ?
|
|
195
|
-
}
|
|
194
|
+
message: RulesMessage.getMessage(messageInDataSetting ? "pleaseBindAtLeastOneDisplayValueInDataSetting" : "pleaseBindAtLeastOneDisplayValue")
|
|
195
|
+
}
|
|
196
196
|
]
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
|
-
}
|
|
199
|
+
}
|
|
200
200
|
],
|
|
201
201
|
orders: [
|
|
202
202
|
{
|
|
203
|
-
type:
|
|
204
|
-
message: RulesMessage.getMessage(
|
|
203
|
+
type: "array",
|
|
204
|
+
message: RulesMessage.getMessage("isNotArray")
|
|
205
205
|
},
|
|
206
206
|
{
|
|
207
|
-
type:
|
|
207
|
+
type: "array",
|
|
208
208
|
defaultField: {
|
|
209
|
-
type:
|
|
209
|
+
type: "object",
|
|
210
210
|
fields: {
|
|
211
211
|
columnName: {
|
|
212
|
-
type:
|
|
212
|
+
type: "string",
|
|
213
213
|
required: true,
|
|
214
|
-
message: RulesMessage.getMessage(
|
|
214
|
+
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
215
215
|
},
|
|
216
216
|
desc: {
|
|
217
|
-
type:
|
|
218
|
-
message: RulesMessage.getMessage(
|
|
217
|
+
type: "boolean",
|
|
218
|
+
message: RulesMessage.getMessage("isNotBoolean")
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
}
|
|
222
|
+
}
|
|
223
223
|
]
|
|
224
224
|
}
|
|
225
|
-
}
|
|
225
|
+
}
|
|
226
226
|
];
|
|
227
227
|
}
|
|
@@ -17,15 +17,30 @@ function _createClass(Constructor, protoProps, staticProps) {
|
|
|
17
17
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
18
18
|
return Constructor;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
function _defineProperty(obj, key, value) {
|
|
21
|
+
if (key in obj) {
|
|
22
|
+
Object.defineProperty(obj, key, {
|
|
23
|
+
value: value,
|
|
24
|
+
enumerable: true,
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true
|
|
27
|
+
});
|
|
28
|
+
} else {
|
|
29
|
+
obj[key] = value;
|
|
30
|
+
}
|
|
31
|
+
return obj;
|
|
32
|
+
}
|
|
33
|
+
import { error, CONTROL_BASE_TYPE, warn } from "@byteluck-fe/model-driven-shared";
|
|
21
34
|
var baseStaticControls = [];
|
|
22
35
|
export var RegisterControls = /*#__PURE__*/ function() {
|
|
23
36
|
"use strict";
|
|
24
37
|
function RegisterControls(type) {
|
|
25
38
|
_classCallCheck(this, RegisterControls);
|
|
26
|
-
this
|
|
27
|
-
this
|
|
28
|
-
this
|
|
39
|
+
_defineProperty(this, "registeredControlTypes", new Set());
|
|
40
|
+
_defineProperty(this, "controlConfigMap", new Map());
|
|
41
|
+
_defineProperty(this, "_controls", []);
|
|
42
|
+
_defineProperty(this, "_cacheControlInstance", {});
|
|
43
|
+
_defineProperty(this, "_type", void 0);
|
|
29
44
|
this._type = type;
|
|
30
45
|
this._initControls(type);
|
|
31
46
|
}
|
|
@@ -102,27 +117,25 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
102
117
|
{
|
|
103
118
|
key: "createControl",
|
|
104
119
|
value: function createControl(schema, beforeCreateInstance) {
|
|
120
|
+
var _this = this;
|
|
105
121
|
if (Array.isArray(schema)) {
|
|
106
|
-
var _this = this;
|
|
107
122
|
return schema.map(function(item) {
|
|
108
123
|
return _this.createControl(item, beforeCreateInstance);
|
|
109
124
|
});
|
|
110
125
|
}
|
|
111
126
|
// @ts-ignore
|
|
112
127
|
if (schema.children) {
|
|
113
|
-
var _this1 = this;
|
|
114
128
|
// @ts-ignore
|
|
115
129
|
schema.children = schema.children.map(function(item) {
|
|
116
|
-
return
|
|
130
|
+
return _this.createControl(item, beforeCreateInstance);
|
|
117
131
|
});
|
|
118
132
|
}
|
|
119
133
|
// @ts-ignore
|
|
120
134
|
if (this.isListControl(schema) && schema.props.headers) {
|
|
121
|
-
var _this2 = this;
|
|
122
135
|
// @ts-ignore
|
|
123
136
|
schema.props.headers = schema.props.headers.map(function(item) {
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
|
|
137
|
+
return(// @ts-ignore
|
|
138
|
+
_this.createControl(item, beforeCreateInstance));
|
|
126
139
|
});
|
|
127
140
|
}
|
|
128
141
|
// @ts-ignore
|
|
@@ -130,14 +143,14 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
130
143
|
if (Constructor) {
|
|
131
144
|
// @ts-ignore
|
|
132
145
|
var createSchema = schema;
|
|
133
|
-
if (typeof beforeCreateInstance ===
|
|
146
|
+
if (typeof beforeCreateInstance === "function") {
|
|
134
147
|
var result = beforeCreateInstance(createSchema);
|
|
135
148
|
if (result) {
|
|
136
149
|
createSchema = result;
|
|
137
150
|
}
|
|
138
151
|
}
|
|
139
152
|
// @ts-ignore
|
|
140
|
-
var control =
|
|
153
|
+
var control = RegisterControls.getControlInstance(createSchema, Constructor);
|
|
141
154
|
// this.defineParentToChildren(control)
|
|
142
155
|
return control;
|
|
143
156
|
} else {
|
|
@@ -146,13 +159,23 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
146
159
|
}
|
|
147
160
|
}
|
|
148
161
|
},
|
|
162
|
+
{
|
|
163
|
+
key: "getControlInstance",
|
|
164
|
+
value: function getControlInstance(schema, Constructor) {
|
|
165
|
+
if (schema.id in this._cacheControlInstance) {
|
|
166
|
+
return this._cacheControlInstance[schema.id];
|
|
167
|
+
}
|
|
168
|
+
Reflect.set(this._cacheControlInstance, schema.id, new Constructor(schema));
|
|
169
|
+
return this._cacheControlInstance[schema.id];
|
|
170
|
+
}
|
|
171
|
+
},
|
|
149
172
|
{
|
|
150
173
|
key: "createControlInstance",
|
|
151
174
|
value: function createControlInstance(type, initSchema) {
|
|
152
175
|
var Constructor = this.getControlFormType(type);
|
|
153
176
|
if (Constructor) {
|
|
154
177
|
// @ts-ignore
|
|
155
|
-
return
|
|
178
|
+
return RegisterControls.getControlInstance(initSchema, Constructor);
|
|
156
179
|
}
|
|
157
180
|
}
|
|
158
181
|
},
|
|
@@ -199,8 +222,8 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
199
222
|
]);
|
|
200
223
|
return RegisterControls;
|
|
201
224
|
}();
|
|
202
|
-
RegisterControls
|
|
203
|
-
RegisterControls
|
|
225
|
+
_defineProperty(RegisterControls, "staticControls", baseStaticControls);
|
|
226
|
+
_defineProperty(RegisterControls, "staticRegisteredTypes", new Set(baseStaticControls.map(function(item) {
|
|
204
227
|
return item.Designer.controlType;
|
|
205
|
-
}));
|
|
206
|
-
RegisterControls
|
|
228
|
+
})));
|
|
229
|
+
_defineProperty(RegisterControls, "staticRegisteredConfigs", new Map());
|