@byteluck-fe/model-driven-core 2.5.0-beta.1 → 2.5.0-beta.4
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 +225 -305
- package/dist/esm/common/BaseControl/index.js +7 -7
- package/dist/esm/common/BaseControl/property.js +10 -13
- package/dist/esm/common/BaseControl/runtime.js +16 -16
- package/dist/esm/common/ColumnControl/designer.js +5 -5
- package/dist/esm/common/ColumnControl/index.js +6 -6
- package/dist/esm/common/ColumnControl/property.js +36 -36
- package/dist/esm/common/ColumnControl/runtime.js +5 -5
- package/dist/esm/common/ControlArray.js +8 -8
- package/dist/esm/common/FormControl/designer.js +8 -8
- package/dist/esm/common/FormControl/index.js +6 -6
- package/dist/esm/common/FormControl/property.js +66 -66
- package/dist/esm/common/FormControl/runtime.js +5 -5
- package/dist/esm/common/LayoutControl/designer.js +102 -196
- 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 +7 -7
- package/dist/esm/common/ListControl/designer.js +84 -184
- package/dist/esm/common/ListControl/index.js +6 -6
- package/dist/esm/common/ListControl/property.js +5 -5
- package/dist/esm/common/ListControl/runtime.js +7 -7
- package/dist/esm/common/SearchViewControl/designer.js +5 -5
- package/dist/esm/common/SearchViewControl/index.js +6 -6
- package/dist/esm/common/SearchViewControl/property.js +4 -4
- package/dist/esm/common/SearchViewControl/runtime.js +5 -5
- package/dist/esm/common/Validator.js +5 -5
- package/dist/esm/common/WrapControl/designer.js +5 -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 +5 -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 +179 -122
- package/dist/esm/framework/index.js +325 -328
- package/dist/esm/index.js +3 -3
- package/dist/index.umd.js +1 -1
- package/dist/types/api-doc-index.d.ts +4 -4
- package/dist/types/common/BaseControl/designer.d.ts +62 -62
- package/dist/types/common/BaseControl/index.d.ts +13 -13
- package/dist/types/common/BaseControl/property.d.ts +36 -36
- package/dist/types/common/BaseControl/runtime.d.ts +22 -22
- package/dist/types/common/BaseControl/types.d.ts +35 -35
- package/dist/types/common/ColumnControl/designer.d.ts +10 -10
- package/dist/types/common/ColumnControl/index.d.ts +12 -12
- package/dist/types/common/ColumnControl/property.d.ts +73 -73
- package/dist/types/common/ColumnControl/runtime.d.ts +10 -10
- package/dist/types/common/ControlArray.d.ts +8 -8
- package/dist/types/common/FormControl/designer.d.ts +13 -13
- package/dist/types/common/FormControl/index.d.ts +12 -12
- package/dist/types/common/FormControl/property.d.ts +100 -100
- package/dist/types/common/FormControl/runtime.d.ts +11 -11
- package/dist/types/common/LayoutControl/designer.d.ts +21 -21
- package/dist/types/common/LayoutControl/index.d.ts +12 -12
- package/dist/types/common/LayoutControl/property.d.ts +6 -6
- package/dist/types/common/LayoutControl/runtime.d.ts +11 -11
- package/dist/types/common/ListControl/designer.d.ts +16 -16
- package/dist/types/common/ListControl/index.d.ts +12 -12
- package/dist/types/common/ListControl/property.d.ts +12 -12
- package/dist/types/common/ListControl/runtime.d.ts +12 -12
- package/dist/types/common/SearchViewControl/designer.d.ts +11 -11
- package/dist/types/common/SearchViewControl/index.d.ts +12 -12
- package/dist/types/common/SearchViewControl/property.d.ts +8 -8
- package/dist/types/common/SearchViewControl/runtime.d.ts +11 -11
- package/dist/types/common/Validator.d.ts +15 -15
- package/dist/types/common/WrapControl/designer.d.ts +11 -11
- package/dist/types/common/WrapControl/index.d.ts +12 -12
- package/dist/types/common/WrapControl/property.d.ts +6 -6
- package/dist/types/common/WrapControl/runtime.d.ts +11 -11
- package/dist/types/common/controlHooksEmitter.d.ts +4 -4
- package/dist/types/common/index.d.ts +12 -12
- package/dist/types/common/initLinkOperationRules.d.ts +6 -6
- package/dist/types/common/initOptionAndDataSourceRules.d.ts +10 -10
- package/dist/types/framework/RegisterControls.d.ts +33 -33
- package/dist/types/framework/index.d.ts +812 -812
- package/dist/types/index.d.ts +3 -3
- package/dist/types/type.d.ts +91 -91
- package/package.json +3 -3
|
@@ -30,7 +30,7 @@ function _inherits(subClass, superClass) {
|
|
|
30
30
|
}
|
|
31
31
|
function _instanceof(left, right) {
|
|
32
32
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
33
|
-
return
|
|
33
|
+
return right[Symbol.hasInstance](left);
|
|
34
34
|
} else {
|
|
35
35
|
return left instanceof right;
|
|
36
36
|
}
|
|
@@ -76,13 +76,13 @@ function _createSuper(Derived) {
|
|
|
76
76
|
return _possibleConstructorReturn(this, result);
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
-
import { RulesMessage, JSONCopy } from
|
|
80
|
-
import { Property, PropertyRules, PropertyRuntimeRules } from
|
|
81
|
-
import { initOptionAndDataSourceRules } from
|
|
82
|
-
import { DataBind } from
|
|
83
|
-
var BaseControlPropertyRules = /*#__PURE__*/ function(
|
|
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(PropertyRules1) {
|
|
84
84
|
"use strict";
|
|
85
|
-
_inherits(BaseControlPropertyRules,
|
|
85
|
+
_inherits(BaseControlPropertyRules, PropertyRules1);
|
|
86
86
|
var _super = _createSuper(BaseControlPropertyRules);
|
|
87
87
|
function BaseControlPropertyRules(props) {
|
|
88
88
|
_classCallCheck(this, BaseControlPropertyRules);
|
|
@@ -90,18 +90,18 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
90
90
|
_this = _super.call(this, props);
|
|
91
91
|
_this.dataBind = {};
|
|
92
92
|
_this.caption = {
|
|
93
|
-
type:
|
|
93
|
+
type: 'string',
|
|
94
94
|
required: true,
|
|
95
|
-
message: RulesMessage.getMessage(
|
|
95
|
+
message: RulesMessage.getMessage('pleaseEnterCaption')
|
|
96
96
|
};
|
|
97
97
|
_this.isHideCaption = {
|
|
98
|
-
type:
|
|
98
|
+
type: 'boolean'
|
|
99
99
|
};
|
|
100
100
|
_this.labelPosition = {
|
|
101
|
-
type:
|
|
101
|
+
type: 'enum',
|
|
102
102
|
enum: [
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
'top',
|
|
104
|
+
'left'
|
|
105
105
|
]
|
|
106
106
|
};
|
|
107
107
|
// 去掉placeholder必填校验
|
|
@@ -111,53 +111,53 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
111
111
|
// message: RulesMessage.getMessage('pleaseEnterPlaceholder'),
|
|
112
112
|
// }
|
|
113
113
|
_this.defaultState = {
|
|
114
|
-
type:
|
|
114
|
+
type: 'enum',
|
|
115
115
|
enum: [
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
'default',
|
|
117
|
+
'readonly'
|
|
118
118
|
]
|
|
119
119
|
};
|
|
120
120
|
_this.required = {
|
|
121
|
-
type:
|
|
121
|
+
type: 'boolean'
|
|
122
122
|
};
|
|
123
123
|
_this.captionTip = {
|
|
124
|
-
type:
|
|
124
|
+
type: 'string',
|
|
125
125
|
required: false,
|
|
126
|
-
message: RulesMessage.getMessage(
|
|
126
|
+
message: RulesMessage.getMessage('pleaseEnterCaptionTip')
|
|
127
127
|
};
|
|
128
128
|
// 初始化dataBind的校验规则
|
|
129
129
|
var validateFields = {
|
|
130
130
|
fieldCode: {
|
|
131
|
-
type:
|
|
131
|
+
type: 'string',
|
|
132
132
|
required: true,
|
|
133
|
-
message: RulesMessage.getMessage(
|
|
133
|
+
message: RulesMessage.getMessage('pleaseEnterFieldCode')
|
|
134
134
|
},
|
|
135
135
|
dataCode: {
|
|
136
|
-
type:
|
|
136
|
+
type: 'string',
|
|
137
137
|
required: true,
|
|
138
|
-
message: RulesMessage.getMessage(
|
|
138
|
+
message: RulesMessage.getMessage('pleaseEnterFieldCode')
|
|
139
139
|
}
|
|
140
140
|
};
|
|
141
141
|
if (_instanceof(props.dataBind, DataBind)) {
|
|
142
142
|
_this.dataBind = {
|
|
143
|
-
type:
|
|
143
|
+
type: 'object',
|
|
144
144
|
required: true,
|
|
145
145
|
fields: JSONCopy(validateFields),
|
|
146
|
-
message: RulesMessage.getMessage(
|
|
146
|
+
message: RulesMessage.getMessage('pleaseEnterFieldCode')
|
|
147
147
|
};
|
|
148
148
|
} else {
|
|
149
149
|
var dataBind = {
|
|
150
|
-
type:
|
|
150
|
+
type: 'object',
|
|
151
151
|
required: true,
|
|
152
152
|
fields: {},
|
|
153
|
-
message: RulesMessage.getMessage(
|
|
153
|
+
message: RulesMessage.getMessage('pleaseEnterFieldCode')
|
|
154
154
|
};
|
|
155
155
|
Object.keys(props.dataBind).forEach(function(key) {
|
|
156
156
|
dataBind.fields[key] = {
|
|
157
|
-
type:
|
|
157
|
+
type: 'object',
|
|
158
158
|
required: true,
|
|
159
159
|
fields: JSONCopy(validateFields),
|
|
160
|
-
message: RulesMessage.getMessage(
|
|
160
|
+
message: RulesMessage.getMessage('pleaseEnterFieldCode')
|
|
161
161
|
};
|
|
162
162
|
});
|
|
163
163
|
_this.dataBind = dataBind;
|
|
@@ -169,18 +169,18 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
169
169
|
}
|
|
170
170
|
return BaseControlPropertyRules;
|
|
171
171
|
}(PropertyRules);
|
|
172
|
-
var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(
|
|
172
|
+
var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRules1) {
|
|
173
173
|
"use strict";
|
|
174
|
-
_inherits(BaseControlPropertyRuntimeRules,
|
|
174
|
+
_inherits(BaseControlPropertyRuntimeRules, PropertyRuntimeRules1);
|
|
175
175
|
var _super = _createSuper(BaseControlPropertyRuntimeRules);
|
|
176
176
|
function BaseControlPropertyRuntimeRules(props) {
|
|
177
177
|
_classCallCheck(this, BaseControlPropertyRuntimeRules);
|
|
178
178
|
var _this;
|
|
179
179
|
_this = _super.call(this, props);
|
|
180
180
|
_this.push({
|
|
181
|
-
type:
|
|
181
|
+
type: 'string',
|
|
182
182
|
required: props.isHide ? false : props.required,
|
|
183
|
-
message: props.requiredMessage !==
|
|
183
|
+
message: props.requiredMessage !== '' ? props.requiredMessage : RulesMessage.getMessage('runtimeRequired', {
|
|
184
184
|
caption: props.caption
|
|
185
185
|
})
|
|
186
186
|
});
|
|
@@ -188,39 +188,39 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
188
188
|
}
|
|
189
189
|
return BaseControlPropertyRuntimeRules;
|
|
190
190
|
}(PropertyRuntimeRules);
|
|
191
|
-
/**
|
|
191
|
+
var BaseControlProperty = /**
|
|
192
192
|
* 表单控件公共属性
|
|
193
193
|
* @public
|
|
194
|
-
*/
|
|
194
|
+
*/ /*#__PURE__*/ function(Property1) {
|
|
195
195
|
"use strict";
|
|
196
|
-
_inherits(BaseControlProperty,
|
|
196
|
+
_inherits(BaseControlProperty, Property1);
|
|
197
197
|
var _super = _createSuper(BaseControlProperty);
|
|
198
198
|
function BaseControlProperty(props) {
|
|
199
199
|
_classCallCheck(this, BaseControlProperty);
|
|
200
200
|
var _this;
|
|
201
201
|
_this = _super.call(this, props);
|
|
202
|
-
var
|
|
203
|
-
_this.caption = (
|
|
204
|
-
var
|
|
205
|
-
_this.isHideCaption = (
|
|
206
|
-
var
|
|
207
|
-
_this.isShowCaptionTip = (
|
|
208
|
-
var
|
|
209
|
-
_this.captionTip = (
|
|
210
|
-
var
|
|
211
|
-
_this.defaultState = (
|
|
212
|
-
var
|
|
213
|
-
_this.labelPosition = (
|
|
214
|
-
var
|
|
215
|
-
_this.placeholder = (
|
|
216
|
-
var
|
|
217
|
-
_this.required = (
|
|
218
|
-
var
|
|
219
|
-
_this.requiredMessage = (
|
|
202
|
+
var ref;
|
|
203
|
+
_this.caption = (ref = props === null || props === void 0 ? void 0 : props.caption) !== null && ref !== void 0 ? ref : '';
|
|
204
|
+
var ref1;
|
|
205
|
+
_this.isHideCaption = (ref1 = props === null || props === void 0 ? void 0 : props.isHideCaption) !== null && ref1 !== void 0 ? ref1 : false;
|
|
206
|
+
var ref2;
|
|
207
|
+
_this.isShowCaptionTip = (ref2 = props === null || props === void 0 ? void 0 : props.isShowCaptionTip) !== null && ref2 !== void 0 ? ref2 : false;
|
|
208
|
+
var ref3;
|
|
209
|
+
_this.captionTip = (ref3 = props === null || props === void 0 ? void 0 : props.captionTip) !== null && ref3 !== void 0 ? ref3 : '';
|
|
210
|
+
var ref4;
|
|
211
|
+
_this.defaultState = (ref4 = props === null || props === void 0 ? void 0 : props.defaultState) !== null && ref4 !== void 0 ? ref4 : 'default';
|
|
212
|
+
var ref5;
|
|
213
|
+
_this.labelPosition = (ref5 = props === null || props === void 0 ? void 0 : props.labelPosition) !== null && ref5 !== void 0 ? ref5 : 'top';
|
|
214
|
+
var ref6;
|
|
215
|
+
_this.placeholder = (ref6 = props === null || props === void 0 ? void 0 : props.placeholder) !== null && ref6 !== void 0 ? ref6 : '';
|
|
216
|
+
var ref7;
|
|
217
|
+
_this.required = (ref7 = props === null || props === void 0 ? void 0 : props.required) !== null && ref7 !== void 0 ? ref7 : false;
|
|
218
|
+
var ref8;
|
|
219
|
+
_this.requiredMessage = (ref8 = props === null || props === void 0 ? void 0 : props.requiredMessage) !== null && ref8 !== void 0 ? ref8 : '';
|
|
220
220
|
//form 组件优先初始化DataBind
|
|
221
221
|
_this.dataBind = new DataBind(props === null || props === void 0 ? void 0 : props.dataBind);
|
|
222
|
-
var
|
|
223
|
-
_this.defaultValue = (
|
|
222
|
+
var ref9;
|
|
223
|
+
_this.defaultValue = (ref9 = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && ref9 !== void 0 ? ref9 : '';
|
|
224
224
|
return _this;
|
|
225
225
|
}
|
|
226
226
|
return BaseControlProperty;
|
|
@@ -236,24 +236,24 @@ var OptionAndDataSourcePropertyRules = /*#__PURE__*/ function(BaseControlPropert
|
|
|
236
236
|
var _this;
|
|
237
237
|
_this = _super.call(this, props);
|
|
238
238
|
_this.optionConfig = {
|
|
239
|
-
type:
|
|
239
|
+
type: 'enum',
|
|
240
240
|
enum: [
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
'custom',
|
|
242
|
+
'datasource'
|
|
243
243
|
],
|
|
244
|
-
message: RulesMessage.getMessage(
|
|
244
|
+
message: RulesMessage.getMessage('PleaseSelectTheCorrectOptionSettings')
|
|
245
245
|
};
|
|
246
246
|
_this.options = [
|
|
247
247
|
{
|
|
248
|
-
type:
|
|
249
|
-
message: RulesMessage.getMessage(
|
|
250
|
-
}
|
|
248
|
+
type: 'array',
|
|
249
|
+
message: RulesMessage.getMessage('isNotArray')
|
|
250
|
+
},
|
|
251
251
|
];
|
|
252
252
|
_this.datasourceBind = [
|
|
253
253
|
{
|
|
254
|
-
type:
|
|
255
|
-
message: RulesMessage.getMessage(
|
|
256
|
-
}
|
|
254
|
+
type: 'object',
|
|
255
|
+
message: RulesMessage.getMessage('isNotObject')
|
|
256
|
+
},
|
|
257
257
|
];
|
|
258
258
|
initOptionAndDataSourceRules.call(_assertThisInitialized(_this), props);
|
|
259
259
|
return _this;
|
|
@@ -69,17 +69,17 @@ function _createSuper(Derived) {
|
|
|
69
69
|
return _possibleConstructorReturn(this, result);
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
import { RuntimeControl } from
|
|
73
|
-
import BaseControlProperty from
|
|
74
|
-
var FormControl = /*#__PURE__*/ function(
|
|
72
|
+
import { RuntimeControl } from '../BaseControl';
|
|
73
|
+
import BaseControlProperty from './property';
|
|
74
|
+
var FormControl = /*#__PURE__*/ function(RuntimeControl1) {
|
|
75
75
|
"use strict";
|
|
76
|
-
_inherits(FormControl,
|
|
76
|
+
_inherits(FormControl, RuntimeControl1);
|
|
77
77
|
var _super = _createSuper(FormControl);
|
|
78
78
|
function FormControl(props) {
|
|
79
79
|
_classCallCheck(this, FormControl);
|
|
80
80
|
var _this;
|
|
81
81
|
_this = _super.call(this, props);
|
|
82
|
-
_this.controlType =
|
|
82
|
+
_this.controlType = 'form';
|
|
83
83
|
_this.props = new BaseControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
84
84
|
return _this;
|
|
85
85
|
}
|
|
@@ -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, {
|
|
@@ -96,7 +110,7 @@ function _inherits(subClass, superClass) {
|
|
|
96
110
|
}
|
|
97
111
|
function _instanceof(left, right) {
|
|
98
112
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
99
|
-
return
|
|
113
|
+
return right[Symbol.hasInstance](left);
|
|
100
114
|
} else {
|
|
101
115
|
return left instanceof right;
|
|
102
116
|
}
|
|
@@ -122,30 +136,6 @@ function _objectSpread(target) {
|
|
|
122
136
|
}
|
|
123
137
|
return target;
|
|
124
138
|
}
|
|
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
139
|
function _possibleConstructorReturn(self, call) {
|
|
150
140
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
151
141
|
return call;
|
|
@@ -205,193 +195,109 @@ function _createSuper(Derived) {
|
|
|
205
195
|
return _possibleConstructorReturn(this, result);
|
|
206
196
|
};
|
|
207
197
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
return t[1];
|
|
214
|
-
},
|
|
215
|
-
trys: [],
|
|
216
|
-
ops: []
|
|
217
|
-
};
|
|
218
|
-
return g = {
|
|
219
|
-
next: verb(0),
|
|
220
|
-
"throw": verb(1),
|
|
221
|
-
"return": verb(2)
|
|
222
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
223
|
-
return this;
|
|
224
|
-
}), g;
|
|
225
|
-
function verb(n) {
|
|
226
|
-
return function(v) {
|
|
227
|
-
return step([
|
|
228
|
-
n,
|
|
229
|
-
v
|
|
230
|
-
]);
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
function step(op) {
|
|
234
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
235
|
-
while(_)try {
|
|
236
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
237
|
-
if (y = 0, t) op = [
|
|
238
|
-
op[0] & 2,
|
|
239
|
-
t.value
|
|
240
|
-
];
|
|
241
|
-
switch(op[0]){
|
|
242
|
-
case 0:
|
|
243
|
-
case 1:
|
|
244
|
-
t = op;
|
|
245
|
-
break;
|
|
246
|
-
case 4:
|
|
247
|
-
_.label++;
|
|
248
|
-
return {
|
|
249
|
-
value: op[1],
|
|
250
|
-
done: false
|
|
251
|
-
};
|
|
252
|
-
case 5:
|
|
253
|
-
_.label++;
|
|
254
|
-
y = op[1];
|
|
255
|
-
op = [
|
|
256
|
-
0
|
|
257
|
-
];
|
|
258
|
-
continue;
|
|
259
|
-
case 7:
|
|
260
|
-
op = _.ops.pop();
|
|
261
|
-
_.trys.pop();
|
|
262
|
-
continue;
|
|
263
|
-
default:
|
|
264
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
265
|
-
_ = 0;
|
|
266
|
-
continue;
|
|
267
|
-
}
|
|
268
|
-
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
269
|
-
_.label = op[1];
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
if (op[0] === 6 && _.label < t[1]) {
|
|
273
|
-
_.label = t[1];
|
|
274
|
-
t = op;
|
|
275
|
-
break;
|
|
276
|
-
}
|
|
277
|
-
if (t && _.label < t[2]) {
|
|
278
|
-
_.label = t[2];
|
|
279
|
-
_.ops.push(op);
|
|
280
|
-
break;
|
|
281
|
-
}
|
|
282
|
-
if (t[2]) _.ops.pop();
|
|
283
|
-
_.trys.pop();
|
|
284
|
-
continue;
|
|
285
|
-
}
|
|
286
|
-
op = body.call(thisArg, _);
|
|
287
|
-
} catch (e) {
|
|
288
|
-
op = [
|
|
289
|
-
6,
|
|
290
|
-
e
|
|
291
|
-
];
|
|
292
|
-
y = 0;
|
|
293
|
-
} finally{
|
|
294
|
-
f = t = 0;
|
|
295
|
-
}
|
|
296
|
-
if (op[0] & 5) throw op[1];
|
|
297
|
-
return {
|
|
298
|
-
value: op[0] ? op[1] : void 0,
|
|
299
|
-
done: true
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
};
|
|
303
|
-
import { JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
304
|
-
import { DesignerControl } from "../BaseControl";
|
|
305
|
-
import LayoutControlProperty from "./property";
|
|
306
|
-
import { defineControlArrayToProperty } from "../ControlArray";
|
|
198
|
+
import regeneratorRuntime from "regenerator-runtime";
|
|
199
|
+
import { JSONCopy } from '@byteluck-fe/model-driven-shared';
|
|
200
|
+
import { DesignerControl } from '../BaseControl';
|
|
201
|
+
import LayoutControlProperty from './property';
|
|
202
|
+
import { defineControlArrayToProperty } from '../ControlArray';
|
|
307
203
|
// 最大可拖入数量
|
|
308
204
|
var CHILDREN_MAX_LENGTH = 10000;
|
|
309
|
-
var LayoutControl = /*#__PURE__*/ function _target(
|
|
205
|
+
var LayoutControl = /*#__PURE__*/ function _target(DesignerControl1) {
|
|
310
206
|
"use strict";
|
|
311
|
-
_inherits(LayoutControl,
|
|
207
|
+
_inherits(LayoutControl, DesignerControl1);
|
|
312
208
|
var _super = _createSuper(LayoutControl);
|
|
313
209
|
function LayoutControl(props) {
|
|
314
210
|
_classCallCheck(this, LayoutControl);
|
|
315
211
|
var _this;
|
|
316
212
|
_this = _super.call(this, props);
|
|
317
|
-
_this.controlType =
|
|
318
|
-
var
|
|
213
|
+
_this.controlType = 'layout';
|
|
214
|
+
var ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = ref.excludes, childrenMaxLength = ref.childrenMaxLength;
|
|
319
215
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
320
|
-
defineControlArrayToProperty(_assertThisInitialized(_this),
|
|
216
|
+
defineControlArrayToProperty(_assertThisInitialized(_this), 'children', props === null || props === void 0 ? void 0 : props.children);
|
|
321
217
|
_this.excludes = JSONCopy(excludes);
|
|
322
218
|
_this.childrenMaxLength = childrenMaxLength;
|
|
323
219
|
return _this;
|
|
324
220
|
}
|
|
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
|
-
];
|
|
221
|
+
_createClass(LayoutControl, [
|
|
222
|
+
{
|
|
223
|
+
key: "judgeExcludesChildren",
|
|
224
|
+
value: function judgeExcludesChildren(type) {
|
|
225
|
+
return this.excludes === false || Array.isArray(this.excludes) && !this.excludes.includes(type);
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
key: "judgeJoinChildren",
|
|
230
|
+
value: function judgeJoinChildren(type) {
|
|
231
|
+
var canJoin = this.judgeExcludesChildren(type);
|
|
232
|
+
if (canJoin) {
|
|
233
|
+
return this.childrenMaxLength > this.children.length;
|
|
363
234
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
235
|
+
return canJoin;
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
key: "validate",
|
|
240
|
+
value: function validate(messages, ignore) {
|
|
241
|
+
var _this = this;
|
|
242
|
+
var _this1 = this, _superprop_get_validate = function() {
|
|
243
|
+
return _get(_getPrototypeOf(LayoutControl.prototype), "validate", _this);
|
|
244
|
+
};
|
|
245
|
+
return _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
|
246
|
+
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
|
247
|
+
while(1)switch(_ctx.prev = _ctx.next){
|
|
248
|
+
case 0:
|
|
249
|
+
_ctx.next = 2;
|
|
250
|
+
return _superprop_get_validate().call(_this1, messages, ignore);
|
|
251
|
+
case 2:
|
|
252
|
+
_ctx.next = 4;
|
|
253
|
+
return Promise.all(_this1.children.map(function(child) {
|
|
254
|
+
return child.validate(messages, ignore);
|
|
255
|
+
}));
|
|
256
|
+
case 4:
|
|
257
|
+
return _ctx.abrupt("return", true);
|
|
258
|
+
case 5:
|
|
259
|
+
case "end":
|
|
260
|
+
return _ctx.stop();
|
|
261
|
+
}
|
|
262
|
+
}, _callee);
|
|
263
|
+
}))();
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
key: "toDataBindModel",
|
|
268
|
+
value: function toDataBindModel() {
|
|
269
|
+
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
270
|
+
var dataBindModel = _get(_getPrototypeOf(LayoutControl.prototype), "toDataBindModel", this).call(this);
|
|
271
|
+
var result = dataBindModel ? [
|
|
272
|
+
dataBindModel
|
|
273
|
+
] : [];
|
|
274
|
+
return this.children.reduce(function(arr, current) {
|
|
275
|
+
var model = current.toDataBindModel(parentId);
|
|
276
|
+
if (Array.isArray(model)) {
|
|
277
|
+
var filteredModel = model.filter(function(item) {
|
|
278
|
+
return !!item;
|
|
279
|
+
});
|
|
280
|
+
return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
|
|
281
|
+
}
|
|
282
|
+
model && arr.push(model);
|
|
283
|
+
return arr;
|
|
284
|
+
}, result);
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
key: "toSchema",
|
|
289
|
+
value: function toSchema() {
|
|
290
|
+
var superSchema = _get(_getPrototypeOf(LayoutControl.prototype), "toSchema", this).call(this);
|
|
291
|
+
var children = this.children.map(function(item) {
|
|
292
|
+
var schema = item.toSchema();
|
|
293
|
+
return schema;
|
|
294
|
+
});
|
|
295
|
+
return _objectSpread({}, superSchema, {
|
|
296
|
+
children: children
|
|
378
297
|
});
|
|
379
|
-
return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
|
|
380
298
|
}
|
|
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
|
-
};
|
|
299
|
+
}
|
|
300
|
+
]);
|
|
395
301
|
return LayoutControl;
|
|
396
302
|
}(DesignerControl);
|
|
397
303
|
LayoutControl.excludes = false;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import Designer from
|
|
2
|
-
import Runtime from
|
|
3
|
-
import Property from
|
|
1
|
+
import Designer from './designer';
|
|
2
|
+
import Runtime from './runtime';
|
|
3
|
+
import Property from './property';
|
|
4
4
|
export default {
|
|
5
5
|
Designer: Designer,
|
|
6
6
|
Runtime: Runtime,
|
|
7
7
|
Property: Property
|
|
8
8
|
};
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
9
|
+
export * from './designer';
|
|
10
|
+
export * from './runtime';
|
|
11
|
+
export * from './property';
|
|
@@ -69,10 +69,10 @@ function _createSuper(Derived) {
|
|
|
69
69
|
return _possibleConstructorReturn(this, result);
|
|
70
70
|
};
|
|
71
71
|
}
|
|
72
|
-
import { Property } from
|
|
73
|
-
var LayoutControlProperty = /*#__PURE__*/ function(
|
|
72
|
+
import { Property } from '../BaseControl';
|
|
73
|
+
var LayoutControlProperty = /*#__PURE__*/ function(Property1) {
|
|
74
74
|
"use strict";
|
|
75
|
-
_inherits(LayoutControlProperty,
|
|
75
|
+
_inherits(LayoutControlProperty, Property1);
|
|
76
76
|
var _super = _createSuper(LayoutControlProperty);
|
|
77
77
|
function LayoutControlProperty(props) {
|
|
78
78
|
_classCallCheck(this, LayoutControlProperty);
|