@byteluck-fe/model-driven-core 2.7.0-alpha.0 → 2.7.0-alpha.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/api-doc-index.js +4 -4
- package/dist/esm/common/BaseControl/designer.js +309 -226
- package/dist/esm/common/BaseControl/index.js +7 -7
- package/dist/esm/common/BaseControl/property.js +13 -10
- 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 +196 -102
- 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 +184 -84
- 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 +122 -179
- package/dist/esm/framework/index.js +336 -333
- 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/type.d.ts +23 -23
- 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 right[Symbol.hasInstance](left);
|
|
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(PropertyRules) {
|
|
84
84
|
"use strict";
|
|
85
|
-
_inherits(BaseControlPropertyRules,
|
|
85
|
+
_inherits(BaseControlPropertyRules, PropertyRules);
|
|
86
86
|
var _super = _createSuper(BaseControlPropertyRules);
|
|
87
87
|
function BaseControlPropertyRules(props) {
|
|
88
88
|
_classCallCheck(this, BaseControlPropertyRules);
|
|
@@ -90,18 +90,18 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules1) {
|
|
|
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(PropertyRules1) {
|
|
|
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(PropertyRules1) {
|
|
|
169
169
|
}
|
|
170
170
|
return BaseControlPropertyRules;
|
|
171
171
|
}(PropertyRules);
|
|
172
|
-
var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(
|
|
172
|
+
var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRules) {
|
|
173
173
|
"use strict";
|
|
174
|
-
_inherits(BaseControlPropertyRuntimeRules,
|
|
174
|
+
_inherits(BaseControlPropertyRuntimeRules, PropertyRuntimeRules);
|
|
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
|
+
/**
|
|
192
192
|
* 表单控件公共属性
|
|
193
193
|
* @public
|
|
194
|
-
*/ /*#__PURE__*/ function(
|
|
194
|
+
*/ var BaseControlProperty = /*#__PURE__*/ function(Property) {
|
|
195
195
|
"use strict";
|
|
196
|
-
_inherits(BaseControlProperty,
|
|
196
|
+
_inherits(BaseControlProperty, Property);
|
|
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 _props_caption;
|
|
203
|
+
_this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : "";
|
|
204
|
+
var _props_isHideCaption;
|
|
205
|
+
_this.isHideCaption = (_props_isHideCaption = props === null || props === void 0 ? void 0 : props.isHideCaption) !== null && _props_isHideCaption !== void 0 ? _props_isHideCaption : false;
|
|
206
|
+
var _props_isShowCaptionTip;
|
|
207
|
+
_this.isShowCaptionTip = (_props_isShowCaptionTip = props === null || props === void 0 ? void 0 : props.isShowCaptionTip) !== null && _props_isShowCaptionTip !== void 0 ? _props_isShowCaptionTip : false;
|
|
208
|
+
var _props_captionTip;
|
|
209
|
+
_this.captionTip = (_props_captionTip = props === null || props === void 0 ? void 0 : props.captionTip) !== null && _props_captionTip !== void 0 ? _props_captionTip : "";
|
|
210
|
+
var _props_defaultState;
|
|
211
|
+
_this.defaultState = (_props_defaultState = props === null || props === void 0 ? void 0 : props.defaultState) !== null && _props_defaultState !== void 0 ? _props_defaultState : "default";
|
|
212
|
+
var _props_labelPosition;
|
|
213
|
+
_this.labelPosition = (_props_labelPosition = props === null || props === void 0 ? void 0 : props.labelPosition) !== null && _props_labelPosition !== void 0 ? _props_labelPosition : "top";
|
|
214
|
+
var _props_placeholder;
|
|
215
|
+
_this.placeholder = (_props_placeholder = props === null || props === void 0 ? void 0 : props.placeholder) !== null && _props_placeholder !== void 0 ? _props_placeholder : "";
|
|
216
|
+
var _props_required;
|
|
217
|
+
_this.required = (_props_required = props === null || props === void 0 ? void 0 : props.required) !== null && _props_required !== void 0 ? _props_required : false;
|
|
218
|
+
var _props_requiredMessage;
|
|
219
|
+
_this.requiredMessage = (_props_requiredMessage = props === null || props === void 0 ? void 0 : props.requiredMessage) !== null && _props_requiredMessage !== void 0 ? _props_requiredMessage : "";
|
|
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 _props_defaultValue;
|
|
223
|
+
_this.defaultValue = (_props_defaultValue = props === null || props === void 0 ? void 0 : props.defaultValue) !== null && _props_defaultValue !== void 0 ? _props_defaultValue : "";
|
|
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(RuntimeControl) {
|
|
75
75
|
"use strict";
|
|
76
|
-
_inherits(FormControl,
|
|
76
|
+
_inherits(FormControl, RuntimeControl);
|
|
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,20 +46,6 @@ 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
|
-
}
|
|
63
49
|
function _defineProperty(obj, key, value) {
|
|
64
50
|
if (key in obj) {
|
|
65
51
|
Object.defineProperty(obj, key, {
|
|
@@ -110,7 +96,7 @@ function _inherits(subClass, superClass) {
|
|
|
110
96
|
}
|
|
111
97
|
function _instanceof(left, right) {
|
|
112
98
|
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
113
|
-
return right[Symbol.hasInstance](left);
|
|
99
|
+
return !!right[Symbol.hasInstance](left);
|
|
114
100
|
} else {
|
|
115
101
|
return left instanceof right;
|
|
116
102
|
}
|
|
@@ -136,6 +122,30 @@ function _objectSpread(target) {
|
|
|
136
122
|
}
|
|
137
123
|
return target;
|
|
138
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
|
+
}
|
|
139
149
|
function _possibleConstructorReturn(self, call) {
|
|
140
150
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
141
151
|
return call;
|
|
@@ -195,109 +205,193 @@ function _createSuper(Derived) {
|
|
|
195
205
|
return _possibleConstructorReturn(this, result);
|
|
196
206
|
};
|
|
197
207
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
208
|
+
var __generator = this && this.__generator || function(thisArg, body) {
|
|
209
|
+
var f, y, t, g, _ = {
|
|
210
|
+
label: 0,
|
|
211
|
+
sent: function() {
|
|
212
|
+
if (t[0] & 1) throw t[1];
|
|
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";
|
|
203
307
|
// 最大可拖入数量
|
|
204
308
|
var CHILDREN_MAX_LENGTH = 10000;
|
|
205
|
-
var LayoutControl = /*#__PURE__*/ function _target(
|
|
309
|
+
var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
206
310
|
"use strict";
|
|
207
|
-
_inherits(LayoutControl,
|
|
311
|
+
_inherits(LayoutControl, DesignerControl);
|
|
208
312
|
var _super = _createSuper(LayoutControl);
|
|
209
313
|
function LayoutControl(props) {
|
|
210
314
|
_classCallCheck(this, LayoutControl);
|
|
211
315
|
var _this;
|
|
212
316
|
_this = _super.call(this, props);
|
|
213
|
-
_this.controlType =
|
|
214
|
-
var
|
|
317
|
+
_this.controlType = "layout";
|
|
318
|
+
var _ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = _ref.excludes, childrenMaxLength = _ref.childrenMaxLength;
|
|
215
319
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
216
|
-
defineControlArrayToProperty(_assertThisInitialized(_this),
|
|
320
|
+
defineControlArrayToProperty(_assertThisInitialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
217
321
|
_this.excludes = JSONCopy(excludes);
|
|
218
322
|
_this.childrenMaxLength = childrenMaxLength;
|
|
219
323
|
return _this;
|
|
220
324
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
325
|
+
var _proto = LayoutControl.prototype;
|
|
326
|
+
_proto.judgeExcludesChildren = function judgeExcludesChildren(type) {
|
|
327
|
+
return this.excludes === false || Array.isArray(this.excludes) && !this.excludes.includes(type);
|
|
328
|
+
};
|
|
329
|
+
_proto.judgeJoinChildren = function judgeJoinChildren(type) {
|
|
330
|
+
var canJoin = this.judgeExcludesChildren(type);
|
|
331
|
+
if (canJoin) {
|
|
332
|
+
return this.childrenMaxLength > this.children.length;
|
|
333
|
+
}
|
|
334
|
+
return canJoin;
|
|
335
|
+
};
|
|
336
|
+
_proto.validate = function validate(messages, ignore) {
|
|
337
|
+
var _this = this;
|
|
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
|
+
];
|
|
234
363
|
}
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
|
364
|
+
});
|
|
365
|
+
})();
|
|
366
|
+
};
|
|
367
|
+
_proto.toDataBindModel = function toDataBindModel() {
|
|
368
|
+
var parentId = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : null;
|
|
369
|
+
var dataBindModel = _get(_getPrototypeOf(LayoutControl.prototype), "toDataBindModel", this).call(this);
|
|
370
|
+
var result = dataBindModel ? [
|
|
371
|
+
dataBindModel
|
|
372
|
+
] : [];
|
|
373
|
+
return this.children.reduce(function(arr, current) {
|
|
374
|
+
var model = current.toDataBindModel(parentId);
|
|
375
|
+
if (Array.isArray(model)) {
|
|
376
|
+
var filteredModel = model.filter(function(item) {
|
|
377
|
+
return !!item;
|
|
297
378
|
});
|
|
379
|
+
return _toConsumableArray(arr).concat(_toConsumableArray(filteredModel));
|
|
298
380
|
}
|
|
299
|
-
|
|
300
|
-
|
|
381
|
+
model && arr.push(model);
|
|
382
|
+
return arr;
|
|
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
|
+
};
|
|
301
395
|
return LayoutControl;
|
|
302
396
|
}(DesignerControl);
|
|
303
397
|
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(Property) {
|
|
74
74
|
"use strict";
|
|
75
|
-
_inherits(LayoutControlProperty,
|
|
75
|
+
_inherits(LayoutControlProperty, Property);
|
|
76
76
|
var _super = _createSuper(LayoutControlProperty);
|
|
77
77
|
function LayoutControlProperty(props) {
|
|
78
78
|
_classCallCheck(this, LayoutControlProperty);
|