@byteluck-fe/model-driven-core 2.7.0-beta.4 → 2.8.0-alpha.1a
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 +4 -1
- package/dist/esm/common/BaseControl/property.js +1 -0
- package/dist/esm/common/BaseControl/runtime.js +1 -0
- package/dist/esm/common/ControlArray.js +14 -12
- package/dist/esm/common/FormControl/property.js +13 -15
- package/dist/esm/common/LayoutControl/designer.js +1 -1
- package/dist/esm/common/LayoutControl/runtime.js +1 -1
- package/dist/esm/common/ListControl/designer.js +11 -2
- package/dist/esm/common/ListControl/property.js +15 -2
- package/dist/esm/common/ListControl/runtime.js +2 -2
- package/dist/esm/framework/RegisterControls.js +104 -11
- package/dist/esm/framework/index.js +45 -17
- package/dist/esm/framework/isDataBind.js +7 -0
- package/dist/esm/index.js +1 -0
- package/dist/index.umd.js +1 -1
- package/dist/types/common/BaseControl/designer.d.ts +2 -1
- package/dist/types/common/BaseControl/property.d.ts +2 -0
- package/dist/types/common/BaseControl/runtime.d.ts +2 -1
- package/dist/types/common/ColumnControl/property.d.ts +1 -1
- package/dist/types/common/ControlArray.d.ts +4 -3
- package/dist/types/common/ListControl/property.d.ts +6 -1
- package/dist/types/framework/RegisterControls.d.ts +5 -1
- package/dist/types/framework/index.d.ts +32 -2
- package/dist/types/framework/isDataBind.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/type.d.ts +1 -1
- package/package.json +3 -3
|
@@ -475,6 +475,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
475
475
|
]);
|
|
476
476
|
return Control;
|
|
477
477
|
}();
|
|
478
|
+
_define_property(Control, "mode", "Designer");
|
|
478
479
|
_define_property(Control, "controlName", "控件");
|
|
479
480
|
_define_property(Control, "controlIcon", "icon");
|
|
480
481
|
_define_property(Control, "controlType", "control");
|
|
@@ -501,10 +502,12 @@ export { Control as DesignerControl };
|
|
|
501
502
|
keys
|
|
502
503
|
];
|
|
503
504
|
deleteKeys.forEach(function(deleteKey) {
|
|
505
|
+
var _this_setting;
|
|
504
506
|
// 是否存在子项
|
|
505
507
|
var isHasItem = typeof deleteKey !== "string";
|
|
508
|
+
// 判断setting是否是自定义控件setting项
|
|
506
509
|
// @ts-ignore
|
|
507
|
-
var settingIndex = _this.setting.findIndex(function(option) {
|
|
510
|
+
var settingIndex = (_this_setting = _this.setting) === null || _this_setting === void 0 ? void 0 : _this_setting.findIndex(function(option) {
|
|
508
511
|
return option.key === (isHasItem ? deleteKey.key : deleteKey);
|
|
509
512
|
});
|
|
510
513
|
// 移除对应选项
|
|
@@ -171,6 +171,7 @@ var PropertyRuntimeRules = /*#__PURE__*/ function(Array1) {
|
|
|
171
171
|
var _props_caption;
|
|
172
172
|
this.caption = (_props_caption = props === null || props === void 0 ? void 0 : props.caption) !== null && _props_caption !== void 0 ? _props_caption : caption;
|
|
173
173
|
};
|
|
174
|
+
_define_property(Property, "mode", void 0);
|
|
174
175
|
_define_property(Property, "Rules", PropertyRules);
|
|
175
176
|
_define_property(Property, "RuntimeRules", PropertyRuntimeRules);
|
|
176
177
|
export default Property;
|
|
@@ -85,6 +85,7 @@ var Control = /*#__PURE__*/ function _target() {
|
|
|
85
85
|
]);
|
|
86
86
|
return Control;
|
|
87
87
|
}();
|
|
88
|
+
_define_property(Control, "mode", "Runtime");
|
|
88
89
|
_define_property(Control, "controlType", "control");
|
|
89
90
|
_define_property(Control, "controlFieldType", void 0);
|
|
90
91
|
_define_property(Control, "__is_control__", true);
|
|
@@ -33,14 +33,16 @@ export function setPropertyDontEnum(obj, property) {
|
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
export function defineParent(control, parent) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
export function defineParent(control, parent, mode) {
|
|
37
|
+
if (mode === "Designer") {
|
|
38
|
+
control.parent = parent;
|
|
39
|
+
// 如果没有被设置过不允许枚举的话,说明是第一次被代理,需要设置parent属性不允许枚举
|
|
40
|
+
setPropertyDontEnum(control, "parent");
|
|
41
|
+
}
|
|
40
42
|
}
|
|
41
|
-
export function defineArrayParent(controls, parent) {
|
|
43
|
+
export function defineArrayParent(controls, parent, mode) {
|
|
42
44
|
controls.forEach(function(item) {
|
|
43
|
-
defineParent(item, parent);
|
|
45
|
+
defineParent(item, parent, mode);
|
|
44
46
|
});
|
|
45
47
|
}
|
|
46
48
|
var targetKey = Symbol("targetKey");
|
|
@@ -48,8 +50,8 @@ function getTargetValue(value) {
|
|
|
48
50
|
var _value_targetKey;
|
|
49
51
|
return (_value_targetKey = value[targetKey]) !== null && _value_targetKey !== void 0 ? _value_targetKey : value;
|
|
50
52
|
}
|
|
51
|
-
function proxyState(target, parent) {
|
|
52
|
-
defineArrayParent(target, parent);
|
|
53
|
+
function proxyState(target, parent, mode) {
|
|
54
|
+
defineArrayParent(target, parent, mode);
|
|
53
55
|
return new Proxy(target, {
|
|
54
56
|
get: function get(t, p) {
|
|
55
57
|
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
@@ -79,21 +81,21 @@ function proxyState(target, parent) {
|
|
|
79
81
|
value
|
|
80
82
|
].concat(_to_consumable_array(args)));
|
|
81
83
|
if (isPlainObject(value)) {
|
|
82
|
-
defineParent(value, parent);
|
|
84
|
+
defineParent(value, parent, mode);
|
|
83
85
|
}
|
|
84
86
|
return result;
|
|
85
87
|
}
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
|
-
export function defineControlArrayToProperty(obj, property, initialValue, parent) {
|
|
90
|
+
export function defineControlArrayToProperty(obj, property, initialValue, parent, mode) {
|
|
89
91
|
var _parent = parent !== null && parent !== void 0 ? parent : obj;
|
|
90
|
-
var value = proxyState(getTargetValue(initialValue !== null && initialValue !== void 0 ? initialValue : []), _parent);
|
|
92
|
+
var value = proxyState(getTargetValue(initialValue !== null && initialValue !== void 0 ? initialValue : []), _parent, mode);
|
|
91
93
|
Object.defineProperty(obj, property, {
|
|
92
94
|
get: function get() {
|
|
93
95
|
return value;
|
|
94
96
|
},
|
|
95
97
|
set: function set(newValue) {
|
|
96
|
-
value = proxyState(getTargetValue(newValue), _parent);
|
|
98
|
+
value = proxyState(getTargetValue(newValue), _parent, mode);
|
|
97
99
|
},
|
|
98
100
|
enumerable: true
|
|
99
101
|
});
|
|
@@ -41,13 +41,6 @@ function _inherits(subClass, superClass) {
|
|
|
41
41
|
});
|
|
42
42
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
43
43
|
}
|
|
44
|
-
function _instanceof(left, right) {
|
|
45
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
46
|
-
return !!right[Symbol.hasInstance](left);
|
|
47
|
-
} else {
|
|
48
|
-
return left instanceof right;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
44
|
function _possible_constructor_return(self, call) {
|
|
52
45
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
53
46
|
return call;
|
|
@@ -93,6 +86,7 @@ import { RulesMessage, JSONCopy } from "@byteluck-fe/model-driven-shared";
|
|
|
93
86
|
import { Property, PropertyRules, PropertyRuntimeRules } from "../BaseControl";
|
|
94
87
|
import { initOptionAndDataSourceRules } from "../initOptionAndDataSourceRules";
|
|
95
88
|
import { DataBind } from "../../framework";
|
|
89
|
+
import { isDataBind } from "../../framework/isDataBind";
|
|
96
90
|
var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
97
91
|
"use strict";
|
|
98
92
|
_inherits(BaseControlPropertyRules, PropertyRules);
|
|
@@ -151,7 +145,8 @@ var BaseControlPropertyRules = /*#__PURE__*/ function(PropertyRules) {
|
|
|
151
145
|
message: RulesMessage.getMessage("pleaseEnterFieldCode")
|
|
152
146
|
}
|
|
153
147
|
};
|
|
154
|
-
if (
|
|
148
|
+
// if (props.dataBind instanceof DataBind) {
|
|
149
|
+
if (isDataBind(props.dataBind)) {
|
|
155
150
|
_this.dataBind = {
|
|
156
151
|
type: "object",
|
|
157
152
|
required: true,
|
|
@@ -190,13 +185,16 @@ var BaseControlPropertyRuntimeRules = /*#__PURE__*/ function(PropertyRuntimeRule
|
|
|
190
185
|
_class_call_check(this, BaseControlPropertyRuntimeRules);
|
|
191
186
|
var _this;
|
|
192
187
|
_this = _super.call(this, props);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
188
|
+
var isRequired = props.isHide ? false : props.required;
|
|
189
|
+
if (isRequired) {
|
|
190
|
+
_this.push({
|
|
191
|
+
type: "string",
|
|
192
|
+
required: isRequired,
|
|
193
|
+
message: props.requiredMessage !== "" ? props.requiredMessage : RulesMessage.getMessage("runtimeRequired", {
|
|
194
|
+
caption: props.caption
|
|
195
|
+
})
|
|
196
|
+
});
|
|
197
|
+
}
|
|
200
198
|
return _this;
|
|
201
199
|
}
|
|
202
200
|
return BaseControlPropertyRuntimeRules;
|
|
@@ -335,7 +335,7 @@ var LayoutControl = /*#__PURE__*/ function _target(DesignerControl) {
|
|
|
335
335
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
336
336
|
var _ref = _instanceof(this, LayoutControl) ? this.constructor : void 0, excludes = _ref.excludes, childrenMaxLength = _ref.childrenMaxLength;
|
|
337
337
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
338
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
338
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children, undefined, "Designer");
|
|
339
339
|
_this.excludes = JSONCopy(excludes);
|
|
340
340
|
_this.childrenMaxLength = childrenMaxLength;
|
|
341
341
|
return _this;
|
|
@@ -97,7 +97,7 @@ var LayoutControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
97
97
|
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
98
98
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
99
99
|
_this.props = new LayoutControlProperty(props === null || props === void 0 ? void 0 : props.props);
|
|
100
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
100
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children, undefined, "Runtime");
|
|
101
101
|
return _this;
|
|
102
102
|
}
|
|
103
103
|
return LayoutControl;
|
|
@@ -320,7 +320,7 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
320
320
|
_this = _super.call(this, props);
|
|
321
321
|
_define_property(_assert_this_initialized(_this), "controlType", "list");
|
|
322
322
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
323
|
-
_this.props = new ListControlProperty(_assert_this_initialized(_this), props === null || props === void 0 ? void 0 : props.props);
|
|
323
|
+
_this.props = new ListControlProperty(_assert_this_initialized(_this), props === null || props === void 0 ? void 0 : props.props, "Designer");
|
|
324
324
|
return _this;
|
|
325
325
|
}
|
|
326
326
|
_create_class(ListControl, [
|
|
@@ -382,13 +382,22 @@ var ListControl = /*#__PURE__*/ function(DesignerControl) {
|
|
|
382
382
|
{
|
|
383
383
|
key: "toSchema",
|
|
384
384
|
value: function toSchema() {
|
|
385
|
+
var _this_props_footers, _this_props;
|
|
385
386
|
var superSchema = _get(_get_prototype_of(ListControl.prototype), "toSchema", this).call(this);
|
|
386
387
|
var headers = this.props.headers.map(function(item) {
|
|
387
388
|
return item.toSchema();
|
|
388
389
|
});
|
|
390
|
+
var footers = (_this_props = this.props) === null || _this_props === void 0 ? void 0 : (_this_props_footers = _this_props.footers) === null || _this_props_footers === void 0 ? void 0 : _this_props_footers.map(function(item) {
|
|
391
|
+
if (item) {
|
|
392
|
+
return item.toSchema();
|
|
393
|
+
} else {
|
|
394
|
+
return undefined;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
389
397
|
return _object_spread_props(_object_spread({}, superSchema), {
|
|
390
398
|
props: _object_spread_props(_object_spread({}, this.props), {
|
|
391
|
-
headers: headers
|
|
399
|
+
headers: headers,
|
|
400
|
+
footers: footers
|
|
392
401
|
})
|
|
393
402
|
});
|
|
394
403
|
}
|
|
@@ -88,12 +88,25 @@ var ListControlProperty = /*#__PURE__*/ function(Property) {
|
|
|
88
88
|
"use strict";
|
|
89
89
|
_inherits(ListControlProperty, Property);
|
|
90
90
|
var _super = _create_super(ListControlProperty);
|
|
91
|
-
function ListControlProperty(parent, props) {
|
|
91
|
+
function ListControlProperty(parent, props, mode) {
|
|
92
92
|
_class_call_check(this, ListControlProperty);
|
|
93
93
|
var _this;
|
|
94
94
|
_this = _super.call(this, props);
|
|
95
95
|
_define_property(_assert_this_initialized(_this), "headers", void 0);
|
|
96
|
-
|
|
96
|
+
_define_property(_assert_this_initialized(_this), "footers", void 0);
|
|
97
|
+
_define_property(_assert_this_initialized(_this), "pageIndex", void 0);
|
|
98
|
+
_define_property(_assert_this_initialized(_this), "pageSize", void 0);
|
|
99
|
+
_define_property(_assert_this_initialized(_this), "pageSizeOptions", void 0);
|
|
100
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "headers", props === null || props === void 0 ? void 0 : props.headers, parent, mode);
|
|
101
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "footers", props === null || props === void 0 ? void 0 : props.footers, parent);
|
|
102
|
+
var _props_pageIndex;
|
|
103
|
+
_this.pageIndex = (_props_pageIndex = props === null || props === void 0 ? void 0 : props.pageIndex) !== null && _props_pageIndex !== void 0 ? _props_pageIndex : 1;
|
|
104
|
+
var _props_pageSize;
|
|
105
|
+
_this.pageSize = (_props_pageSize = props === null || props === void 0 ? void 0 : props.pageSize) !== null && _props_pageSize !== void 0 ? _props_pageSize : 20;
|
|
106
|
+
var _props_pageSizeOptions;
|
|
107
|
+
_this.pageSizeOptions = (_props_pageSizeOptions = props === null || props === void 0 ? void 0 : props.pageSizeOptions) !== null && _props_pageSizeOptions !== void 0 ? _props_pageSizeOptions : [
|
|
108
|
+
20
|
|
109
|
+
];
|
|
97
110
|
return _this;
|
|
98
111
|
}
|
|
99
112
|
return ListControlProperty;
|
|
@@ -110,8 +110,8 @@ var ListControl = /*#__PURE__*/ function(RuntimeControl) {
|
|
|
110
110
|
_define_property(_assert_this_initialized(_this), "controlType", "list");
|
|
111
111
|
_define_property(_assert_this_initialized(_this), "children", void 0);
|
|
112
112
|
_define_property(_assert_this_initialized(_this), "props", void 0);
|
|
113
|
-
_this.props = new ListControlProperty(_assert_this_initialized(_this), props === null || props === void 0 ? void 0 : props.props);
|
|
114
|
-
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children);
|
|
113
|
+
_this.props = new ListControlProperty(_assert_this_initialized(_this), props === null || props === void 0 ? void 0 : props.props, "Runtime");
|
|
114
|
+
defineControlArrayToProperty(_assert_this_initialized(_this), "children", props === null || props === void 0 ? void 0 : props.children, undefined, "Runtime");
|
|
115
115
|
return _this;
|
|
116
116
|
}
|
|
117
117
|
_create_class(ListControl, [
|
|
@@ -31,6 +31,7 @@ function _define_property(obj, key, value) {
|
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
33
|
import { error, CONTROL_BASE_TYPE, warn } from "@byteluck-fe/model-driven-shared";
|
|
34
|
+
import { setPropertyDontEnum } from "../common/ControlArray";
|
|
34
35
|
var baseStaticControls = [];
|
|
35
36
|
export var RegisterControls = /*#__PURE__*/ function() {
|
|
36
37
|
"use strict";
|
|
@@ -129,13 +130,29 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
129
130
|
return _this.createControl(item, beforeCreateInstance);
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
|
-
|
|
133
|
-
if (this.isListControl(schema) && schema.props.headers) {
|
|
133
|
+
if (this.isListControl(schema)) {
|
|
134
134
|
// @ts-ignore
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
var props = schema.props;
|
|
136
|
+
if (props.headers) {
|
|
137
|
+
// @ts-ignore
|
|
138
|
+
props.headers = props.headers.map(function(item) {
|
|
139
|
+
return(// @ts-ignore
|
|
140
|
+
_this.createControl(item, beforeCreateInstance));
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// list类型的控件,允许存在footer
|
|
144
|
+
if (props.footers) {
|
|
145
|
+
// @ts-ignore
|
|
146
|
+
props.footers = props.footers.map(function(item) {
|
|
147
|
+
var newctl;
|
|
148
|
+
// footers 允许有空存在
|
|
149
|
+
if (item) {
|
|
150
|
+
// @ts-ignore
|
|
151
|
+
newctl = _this.createControl(item, beforeCreateInstance);
|
|
152
|
+
}
|
|
153
|
+
return newctl;
|
|
154
|
+
});
|
|
155
|
+
}
|
|
139
156
|
}
|
|
140
157
|
// @ts-ignore
|
|
141
158
|
var Constructor = this.getControlFormType(schema.type);
|
|
@@ -148,9 +165,15 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
148
165
|
createSchema = result;
|
|
149
166
|
}
|
|
150
167
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
168
|
+
var control;
|
|
169
|
+
if (Constructor.mode === "Runtime") {
|
|
170
|
+
control = createSchema;
|
|
171
|
+
// this.defineParentToChildren(control)
|
|
172
|
+
this._setParentPrototypeToSchema(control, this);
|
|
173
|
+
} else {
|
|
174
|
+
// @ts-ignore
|
|
175
|
+
control = new Constructor(createSchema);
|
|
176
|
+
}
|
|
154
177
|
return control;
|
|
155
178
|
} else {
|
|
156
179
|
error(// @ts-ignore
|
|
@@ -158,6 +181,60 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
158
181
|
}
|
|
159
182
|
}
|
|
160
183
|
},
|
|
184
|
+
{
|
|
185
|
+
key: "resetInstanceParent",
|
|
186
|
+
value: function resetInstanceParent(schema, parentControl) {
|
|
187
|
+
// @ts-ignore
|
|
188
|
+
delete schema.parent;
|
|
189
|
+
Object.defineProperty(schema, "parent", {
|
|
190
|
+
configurable: true,
|
|
191
|
+
get: function get() {
|
|
192
|
+
return parentControl;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
setPropertyDontEnum(schema, "parent");
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
key: "_setParentPrototypeToSchema",
|
|
200
|
+
value: function _setParentPrototypeToSchema(schema, runtime) {
|
|
201
|
+
// if (Reflect.has(schema, 'parent')) {
|
|
202
|
+
// return
|
|
203
|
+
// }
|
|
204
|
+
if (runtime._type !== "Runtime") {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
Object.defineProperty(schema, "parent", {
|
|
208
|
+
configurable: true,
|
|
209
|
+
get: function get() {
|
|
210
|
+
// @ts-ignore
|
|
211
|
+
var id = schema.id;
|
|
212
|
+
var controlParentIdMap = runtime._controlParentIdMap;
|
|
213
|
+
var instanceMap = runtime.instanceMap;
|
|
214
|
+
if (!controlParentIdMap || !instanceMap) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
var parentId = controlParentIdMap[id];
|
|
218
|
+
var selfInInstances = instanceMap[id];
|
|
219
|
+
if (!parentId && !selfInInstances) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
var selfIndex = selfInInstances.findIndex(function(item) {
|
|
223
|
+
return item == schema;
|
|
224
|
+
});
|
|
225
|
+
var parentInstances = instanceMap[parentId] || [];
|
|
226
|
+
var parentInstance;
|
|
227
|
+
if (parentInstances.length !== selfInInstances.length) {
|
|
228
|
+
parentInstance = parentInstances[0];
|
|
229
|
+
} else {
|
|
230
|
+
parentInstance = parentInstances[selfIndex];
|
|
231
|
+
}
|
|
232
|
+
return parentInstance;
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
setPropertyDontEnum(schema, "parent");
|
|
236
|
+
}
|
|
237
|
+
},
|
|
161
238
|
{
|
|
162
239
|
key: "createControlInstance",
|
|
163
240
|
value: function createControlInstance(type, initSchema) {
|
|
@@ -185,14 +262,28 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
185
262
|
var _this = this;
|
|
186
263
|
this.constructor.staticControls.forEach(function(item) {
|
|
187
264
|
_this.register(item[type]);
|
|
265
|
+
RegisterControls.staticControlsRuntimeRules.set(item.Runtime.controlType, item.Property.RuntimeRules);
|
|
266
|
+
item.Property.mode = type;
|
|
188
267
|
});
|
|
189
268
|
}
|
|
190
269
|
}
|
|
191
270
|
], [
|
|
271
|
+
{
|
|
272
|
+
key: "staticGetRules",
|
|
273
|
+
value: function staticGetRules(controlType, props) {
|
|
274
|
+
var Rules = RegisterControls.staticControlsRuntimeRules.get(controlType);
|
|
275
|
+
var result = [];
|
|
276
|
+
if (Rules) {
|
|
277
|
+
var rules = new Rules(props);
|
|
278
|
+
result = Array.from(rules);
|
|
279
|
+
}
|
|
280
|
+
return result;
|
|
281
|
+
}
|
|
282
|
+
},
|
|
192
283
|
{
|
|
193
284
|
key: "register",
|
|
194
|
-
value: function register(control) {
|
|
195
|
-
var Designer = control.Designer, Runtime = control.Runtime;
|
|
285
|
+
value: function register(control, mode) {
|
|
286
|
+
var Designer = control.Designer, Runtime = control.Runtime, Property = control.Property;
|
|
196
287
|
if (!Designer || !Runtime || !Designer.__is_control__ || !Runtime.__is_control__) {
|
|
197
288
|
error("".concat(control, " is can't register as a Control"));
|
|
198
289
|
}
|
|
@@ -205,12 +296,14 @@ export var RegisterControls = /*#__PURE__*/ function() {
|
|
|
205
296
|
}
|
|
206
297
|
this.staticRegisteredTypes.add(Designer.controlType);
|
|
207
298
|
this.staticControls.push(control);
|
|
299
|
+
Property.mode = mode;
|
|
208
300
|
return this;
|
|
209
301
|
}
|
|
210
302
|
}
|
|
211
303
|
]);
|
|
212
304
|
return RegisterControls;
|
|
213
305
|
}();
|
|
306
|
+
_define_property(RegisterControls, "staticControlsRuntimeRules", new Map());
|
|
214
307
|
_define_property(RegisterControls, "staticControls", baseStaticControls);
|
|
215
308
|
_define_property(RegisterControls, "staticRegisteredTypes", new Set(baseStaticControls.map(function(item) {
|
|
216
309
|
return item.Designer.controlType;
|
|
@@ -41,13 +41,6 @@ function _inherits(subClass, superClass) {
|
|
|
41
41
|
});
|
|
42
42
|
if (superClass) _set_prototype_of(subClass, superClass);
|
|
43
43
|
}
|
|
44
|
-
function _instanceof(left, right) {
|
|
45
|
-
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
|
|
46
|
-
return !!right[Symbol.hasInstance](left);
|
|
47
|
-
} else {
|
|
48
|
-
return left instanceof right;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
44
|
function _possible_constructor_return(self, call) {
|
|
52
45
|
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
53
46
|
return call;
|
|
@@ -112,12 +105,18 @@ export * from "./RegisterControls";
|
|
|
112
105
|
* @defaultValue ''
|
|
113
106
|
* @public
|
|
114
107
|
*/ _define_property(this, "fieldType", void 0);
|
|
108
|
+
/**
|
|
109
|
+
* 表别名
|
|
110
|
+
* @defaultValue undefined
|
|
111
|
+
* @public
|
|
112
|
+
*/ _define_property(this, "aliasCode", void 0);
|
|
115
113
|
var _props_dataCode;
|
|
116
114
|
this.dataCode = (_props_dataCode = props === null || props === void 0 ? void 0 : props.dataCode) !== null && _props_dataCode !== void 0 ? _props_dataCode : "";
|
|
117
115
|
var _props_fieldCode;
|
|
118
116
|
this.fieldCode = (_props_fieldCode = props === null || props === void 0 ? void 0 : props.fieldCode) !== null && _props_fieldCode !== void 0 ? _props_fieldCode : "";
|
|
119
117
|
var _props_fieldType;
|
|
120
118
|
this.fieldType = (_props_fieldType = props === null || props === void 0 ? void 0 : props.fieldType) !== null && _props_fieldType !== void 0 ? _props_fieldType : "";
|
|
119
|
+
this.aliasCode = props === null || props === void 0 ? void 0 : props.aliasCode;
|
|
121
120
|
};
|
|
122
121
|
export var AutoWidth = function AutoWidth(props) {
|
|
123
122
|
"use strict";
|
|
@@ -410,6 +409,18 @@ export var RightVariable = function RightVariable(props) {
|
|
|
410
409
|
this.leftVariableBo = new LeftVariable(props === null || props === void 0 ? void 0 : props.leftVariableBo);
|
|
411
410
|
this.rightVariableBo = new RightVariable(props === null || props === void 0 ? void 0 : props.rightVariableBo);
|
|
412
411
|
};
|
|
412
|
+
export var JoinRelation = function JoinRelation(props) {
|
|
413
|
+
"use strict";
|
|
414
|
+
_class_call_check(this, JoinRelation);
|
|
415
|
+
_define_property(this, "aliasCode", void 0);
|
|
416
|
+
_define_property(this, "datasourceBind", void 0);
|
|
417
|
+
_define_property(this, "relationFields", void 0);
|
|
418
|
+
var _props_aliasCode;
|
|
419
|
+
this.aliasCode = (_props_aliasCode = props === null || props === void 0 ? void 0 : props.aliasCode) !== null && _props_aliasCode !== void 0 ? _props_aliasCode : "";
|
|
420
|
+
this.datasourceBind = new DataSourceBind(props === null || props === void 0 ? void 0 : props.datasourceBind);
|
|
421
|
+
var _props_relationFields;
|
|
422
|
+
this.relationFields = (_props_relationFields = props === null || props === void 0 ? void 0 : props.relationFields) !== null && _props_relationFields !== void 0 ? _props_relationFields : [];
|
|
423
|
+
};
|
|
413
424
|
/**
|
|
414
425
|
* 数据填充项
|
|
415
426
|
* @public
|
|
@@ -533,7 +544,7 @@ export var DataSourceParamItem = function DataSourceParamItem(props) {
|
|
|
533
544
|
/**
|
|
534
545
|
* 给filters和orders赋值
|
|
535
546
|
* */ function callFiltersAndOrders(props) {
|
|
536
|
-
var _props_filters, _props_viewFilters;
|
|
547
|
+
var _props_filters, _props_viewFilters, _props_orders;
|
|
537
548
|
var _props_filters_map;
|
|
538
549
|
this.filters = (_props_filters_map = props === null || props === void 0 ? void 0 : (_props_filters = props.filters) === null || _props_filters === void 0 ? void 0 : _props_filters.map(function(item) {
|
|
539
550
|
if (item.children !== undefined) {
|
|
@@ -548,13 +559,11 @@ export var DataSourceParamItem = function DataSourceParamItem(props) {
|
|
|
548
559
|
}
|
|
549
560
|
return new FieldFilterCondition(item);
|
|
550
561
|
})) !== null && _props_viewFilters_map !== void 0 ? _props_viewFilters_map : [];
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
})) !== null && _props_orders_map !== void 0 ? _props_orders_map : [];
|
|
557
|
-
}
|
|
562
|
+
var _props_orders_map;
|
|
563
|
+
this.orders = (_props_orders_map = props === null || props === void 0 ? void 0 : (_props_orders = props.orders) === null || _props_orders === void 0 ? void 0 : _props_orders.map(function(item) {
|
|
564
|
+
return new DataSourceOrderItem(item);
|
|
565
|
+
})) !== null && _props_orders_map !== void 0 ? _props_orders_map : [];
|
|
566
|
+
// }
|
|
558
567
|
}
|
|
559
568
|
/**
|
|
560
569
|
* 数据源绑定配置
|
|
@@ -669,6 +678,7 @@ export var LinkOperationOption = function LinkOperationOption(props) {
|
|
|
669
678
|
_define_property(this, "confirmMessage", void 0);
|
|
670
679
|
_define_property(this, "defaultState", void 0);
|
|
671
680
|
_define_property(this, "formKey", void 0);
|
|
681
|
+
_define_property(this, "formType", void 0);
|
|
672
682
|
_define_property(this, "icon", void 0);
|
|
673
683
|
_define_property(this, "needConfirm", void 0);
|
|
674
684
|
_define_property(this, "openType", void 0);
|
|
@@ -685,6 +695,7 @@ export var LinkOperationOption = function LinkOperationOption(props) {
|
|
|
685
695
|
this.defaultState = (_props_defaultState = props === null || props === void 0 ? void 0 : props.defaultState) !== null && _props_defaultState !== void 0 ? _props_defaultState : "default";
|
|
686
696
|
var _props_formKey;
|
|
687
697
|
this.formKey = (_props_formKey = props === null || props === void 0 ? void 0 : props.formKey) !== null && _props_formKey !== void 0 ? _props_formKey : undefined;
|
|
698
|
+
this.formType = props === null || props === void 0 ? void 0 : props.formType;
|
|
688
699
|
var _props_icon;
|
|
689
700
|
this.icon = (_props_icon = props === null || props === void 0 ? void 0 : props.icon) !== null && _props_icon !== void 0 ? _props_icon : "iconliulan1";
|
|
690
701
|
var _props_needConfirm;
|
|
@@ -988,7 +999,7 @@ export function initImageOptions(options) {
|
|
|
988
999
|
var _props_amount;
|
|
989
1000
|
this.amount = (_props_amount = props === null || props === void 0 ? void 0 : props.amount) !== null && _props_amount !== void 0 ? _props_amount : "";
|
|
990
1001
|
var _props_currency;
|
|
991
|
-
this.currency = (_props_currency = props === null || props === void 0 ? void 0 : props.currency) !== null && _props_currency !== void 0 ? _props_currency :
|
|
1002
|
+
this.currency = (_props_currency = props === null || props === void 0 ? void 0 : props.currency) !== null && _props_currency !== void 0 ? _props_currency : "CNY";
|
|
992
1003
|
};
|
|
993
1004
|
/**
|
|
994
1005
|
* 日期区间数据绑定项
|
|
@@ -1174,7 +1185,6 @@ export var COMMON_SETTING_TYPE;
|
|
|
1174
1185
|
COMMON_SETTING_TYPE["VIEW_FORM_MODEL_TYPE"] = "viewFormModelType";
|
|
1175
1186
|
COMMON_SETTING_TYPE["SERVER_PAGINATION"] = "serverPagination";
|
|
1176
1187
|
COMMON_SETTING_TYPE["IS_SHOW_CAPTION_TIP"] = "isShowCaptionTip";
|
|
1177
|
-
COMMON_SETTING_TYPE["IS_SHOW_WATERMARK"] = "isShowWatermark";
|
|
1178
1188
|
COMMON_SETTING_TYPE["ENCRYPTED"] = "encrypted";
|
|
1179
1189
|
COMMON_SETTING_TYPE["IS_INLINE_EDIT"] = "isInlineEdit";
|
|
1180
1190
|
COMMON_SETTING_TYPE["REVISIONS_MODE"] = "revisionsMode";
|
|
@@ -1284,3 +1294,21 @@ export var BaseStyle = function BaseStyle(props) {
|
|
|
1284
1294
|
var _props_heightConfig;
|
|
1285
1295
|
this.heightConfig = (_props_heightConfig = props === null || props === void 0 ? void 0 : props.heightConfig) !== null && _props_heightConfig !== void 0 ? _props_heightConfig : "fill";
|
|
1286
1296
|
};
|
|
1297
|
+
export var OptObject = function OptObject(props) {
|
|
1298
|
+
"use strict";
|
|
1299
|
+
_class_call_check(this, OptObject);
|
|
1300
|
+
/**
|
|
1301
|
+
* 操作项编码
|
|
1302
|
+
* @defaultValue ''
|
|
1303
|
+
* @public
|
|
1304
|
+
*/ _define_property(this, "optCode", void 0);
|
|
1305
|
+
/**
|
|
1306
|
+
* 操作项类型
|
|
1307
|
+
* @defaultValue ''
|
|
1308
|
+
* @public
|
|
1309
|
+
*/ _define_property(this, "optType", void 0);
|
|
1310
|
+
var _props_optCode;
|
|
1311
|
+
this.optCode = (_props_optCode = props === null || props === void 0 ? void 0 : props.optCode) !== null && _props_optCode !== void 0 ? _props_optCode : "";
|
|
1312
|
+
var _props_optType;
|
|
1313
|
+
this.optType = (_props_optType = props === null || props === void 0 ? void 0 : props.optType) !== null && _props_optType !== void 0 ? _props_optType : "";
|
|
1314
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function isDataBind(dataBind) {
|
|
2
|
+
if ((dataBind === null || dataBind === void 0 ? void 0 : dataBind.dataCode) !== undefined && (dataBind === null || dataBind === void 0 ? void 0 : dataBind.fieldCode) !== undefined) {
|
|
3
|
+
return true;
|
|
4
|
+
} else {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
}
|
package/dist/esm/index.js
CHANGED