@byteluck-fe/model-driven-driven 4.34.0-lx2 → 4.34.0-lx3
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/README.md +13 -13
- package/dist/esm/Designer.js +4 -8
- package/dist/esm/Driven.js +26 -26
- package/dist/esm/Store.js +30 -30
- package/dist/esm/utils.js +13 -21
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +8 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -112
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +5 -5
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Driven
|
|
2
|
-
设计态引擎
|
|
3
|
-
|
|
4
|
-
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
-
constants.ts // 常量
|
|
6
|
-
Designer.ts // 旧版designer的实现
|
|
7
|
-
designerUtils.ts // 工具函数
|
|
8
|
-
Driven.ts // 引擎
|
|
9
|
-
EventLogic.ts // 事件管理
|
|
10
|
-
index.ts
|
|
11
|
-
Plugin.ts // 插件
|
|
12
|
-
Store.ts // 仓库
|
|
13
|
-
utils.ts // 工具
|
|
1
|
+
# Driven
|
|
2
|
+
设计态引擎
|
|
3
|
+
|
|
4
|
+
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
+
constants.ts // 常量
|
|
6
|
+
Designer.ts // 旧版designer的实现
|
|
7
|
+
designerUtils.ts // 工具函数
|
|
8
|
+
Driven.ts // 引擎
|
|
9
|
+
EventLogic.ts // 事件管理
|
|
10
|
+
index.ts
|
|
11
|
+
Plugin.ts // 插件
|
|
12
|
+
Store.ts // 仓库
|
|
13
|
+
utils.ts // 工具
|
package/dist/esm/Designer.js
CHANGED
|
@@ -146,7 +146,7 @@ function _is_native_reflect_construct() {
|
|
|
146
146
|
})();
|
|
147
147
|
}
|
|
148
148
|
function _ts_generator(thisArg, body) {
|
|
149
|
-
var f, y, t,
|
|
149
|
+
var f, y, t, _ = {
|
|
150
150
|
label: 0,
|
|
151
151
|
sent: function() {
|
|
152
152
|
if (t[0] & 1) throw t[1];
|
|
@@ -154,12 +154,8 @@ function _ts_generator(thisArg, body) {
|
|
|
154
154
|
},
|
|
155
155
|
trys: [],
|
|
156
156
|
ops: []
|
|
157
|
-
};
|
|
158
|
-
return g = {
|
|
159
|
-
next: verb(0),
|
|
160
|
-
"throw": verb(1),
|
|
161
|
-
"return": verb(2)
|
|
162
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
157
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
158
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
163
159
|
return this;
|
|
164
160
|
}), g;
|
|
165
161
|
function verb(n) {
|
|
@@ -172,7 +168,7 @@ function _ts_generator(thisArg, body) {
|
|
|
172
168
|
}
|
|
173
169
|
function step(op) {
|
|
174
170
|
if (f) throw new TypeError("Generator is already executing.");
|
|
175
|
-
while(_)try {
|
|
171
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
176
172
|
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;
|
|
177
173
|
if (y = 0, t) op = [
|
|
178
174
|
op[0] & 2,
|
package/dist/esm/Driven.js
CHANGED
|
@@ -188,24 +188,24 @@ import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from
|
|
|
188
188
|
import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
|
|
189
189
|
// 当前正在注册的插件名称
|
|
190
190
|
var applyingPluginName = '';
|
|
191
|
-
/**
|
|
192
|
-
* 设计器驱动
|
|
191
|
+
/**
|
|
192
|
+
* 设计器驱动
|
|
193
193
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
194
194
|
"use strict";
|
|
195
195
|
_inherits(Driven, Watcher);
|
|
196
196
|
function Driven(options) {
|
|
197
197
|
_class_call_check(this, Driven);
|
|
198
198
|
var _this;
|
|
199
|
-
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
200
|
-
* 控件可选的事件
|
|
201
|
-
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
202
|
-
* 处理数据存储,存放模型等
|
|
203
|
-
* */ _define_property(_this, "store", void 0), /**
|
|
204
|
-
* 额外参数存储
|
|
205
|
-
*/ _define_property(_this, "externalParams", void 0), /**
|
|
206
|
-
* 处理instance,和schema存储
|
|
207
|
-
* */ _define_property(_this, "designer", void 0), /**
|
|
208
|
-
* 插件数组
|
|
199
|
+
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
200
|
+
* 控件可选的事件
|
|
201
|
+
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
202
|
+
* 处理数据存储,存放模型等
|
|
203
|
+
* */ _define_property(_this, "store", void 0), /**
|
|
204
|
+
* 额外参数存储
|
|
205
|
+
*/ _define_property(_this, "externalParams", void 0), /**
|
|
206
|
+
* 处理instance,和schema存储
|
|
207
|
+
* */ _define_property(_this, "designer", void 0), /**
|
|
208
|
+
* 插件数组
|
|
209
209
|
* */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
|
|
210
210
|
_define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
|
|
211
211
|
_define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
|
|
@@ -473,10 +473,10 @@ var applyingPluginName = '';
|
|
|
473
473
|
if (instance === null) return;
|
|
474
474
|
var _instance = this.getInstance(instance);
|
|
475
475
|
if (!_instance) return;
|
|
476
|
-
/*
|
|
477
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
478
|
-
事件是否区分move和add
|
|
479
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
476
|
+
/*
|
|
477
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
478
|
+
事件是否区分move和add
|
|
479
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
480
480
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
481
481
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
482
482
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -601,8 +601,8 @@ var applyingPluginName = '';
|
|
|
601
601
|
},
|
|
602
602
|
{
|
|
603
603
|
key: "removeInstance",
|
|
604
|
-
value: /**
|
|
605
|
-
* 删除控件
|
|
604
|
+
value: /**
|
|
605
|
+
* 删除控件
|
|
606
606
|
* */ function removeInstance(instance) {
|
|
607
607
|
// 删除实例,并触发事件 removed
|
|
608
608
|
var parent = instance.parent;
|
|
@@ -641,8 +641,8 @@ var applyingPluginName = '';
|
|
|
641
641
|
},
|
|
642
642
|
{
|
|
643
643
|
key: "updateInstanceType",
|
|
644
|
-
value: /**
|
|
645
|
-
* 修改控件类型
|
|
644
|
+
value: /**
|
|
645
|
+
* 修改控件类型
|
|
646
646
|
* */ function updateInstanceType(instance, type) {
|
|
647
647
|
var schema = instance.toSchema();
|
|
648
648
|
var newInstance = this.createInstance(type, {
|
|
@@ -700,16 +700,16 @@ var applyingPluginName = '';
|
|
|
700
700
|
},
|
|
701
701
|
{
|
|
702
702
|
key: "assertInstance",
|
|
703
|
-
value: /**
|
|
704
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
703
|
+
value: /**
|
|
704
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
705
705
|
* */ function assertInstance(instance, types) {
|
|
706
706
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
707
707
|
}
|
|
708
708
|
},
|
|
709
709
|
{
|
|
710
710
|
key: "getInstanceInListControl",
|
|
711
|
-
value: /**
|
|
712
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
711
|
+
value: /**
|
|
712
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
713
713
|
* */ function getInstanceInListControl(instance) {
|
|
714
714
|
var _instance = instance;
|
|
715
715
|
while(_instance){
|
|
@@ -780,7 +780,7 @@ var applyingPluginName = '';
|
|
|
780
780
|
]);
|
|
781
781
|
return Driven;
|
|
782
782
|
}(Watcher);
|
|
783
|
-
/**
|
|
784
|
-
* 控件事件定义
|
|
783
|
+
/**
|
|
784
|
+
* 控件事件定义
|
|
785
785
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
786
786
|
export { Driven };
|
package/dist/esm/Store.js
CHANGED
|
@@ -96,42 +96,42 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
96
96
|
"use strict";
|
|
97
97
|
function Store(options) {
|
|
98
98
|
_class_call_check(this, Store);
|
|
99
|
-
/**
|
|
100
|
-
* 页面控件实例树
|
|
99
|
+
/**
|
|
100
|
+
* 页面控件实例树
|
|
101
101
|
* */ _define_property(this, "instance", void 0);
|
|
102
|
-
/**
|
|
103
|
-
* 拍平的控件数组
|
|
102
|
+
/**
|
|
103
|
+
* 拍平的控件数组
|
|
104
104
|
* */ _define_property(this, "flatInstances", void 0);
|
|
105
|
-
/**
|
|
106
|
-
* 控件id组成的map
|
|
105
|
+
/**
|
|
106
|
+
* 控件id组成的map
|
|
107
107
|
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
|
-
/**
|
|
109
|
-
* dataCode和fieldCode组成的map
|
|
110
|
-
* {
|
|
111
|
-
* [主表dataCode]: {
|
|
112
|
-
* [fieldCode]: 控件
|
|
113
|
-
* },
|
|
114
|
-
* [子表dataCode]: {
|
|
115
|
-
* [fieldCode]: 控件
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
108
|
+
/**
|
|
109
|
+
* dataCode和fieldCode组成的map
|
|
110
|
+
* {
|
|
111
|
+
* [主表dataCode]: {
|
|
112
|
+
* [fieldCode]: 控件
|
|
113
|
+
* },
|
|
114
|
+
* [子表dataCode]: {
|
|
115
|
+
* [fieldCode]: 控件
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
118
|
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
|
-
/**
|
|
120
|
-
* 当前选中的控件
|
|
119
|
+
/**
|
|
120
|
+
* 当前选中的控件
|
|
121
121
|
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
122
|
+
/**
|
|
123
|
+
* 当前选中的数据作用域控件
|
|
124
124
|
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
125
|
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
126
|
+
/**
|
|
127
|
+
* 当前选中控件的setting
|
|
128
128
|
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
129
|
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
130
|
+
/**
|
|
131
|
+
* 当前选中控件的数据模型
|
|
132
132
|
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
133
|
+
/**
|
|
134
|
+
* 扩展字段,比如appId,dataCode等
|
|
135
135
|
* */ _define_property(this, "external", {});
|
|
136
136
|
_define_property(this, "movingInstance", null);
|
|
137
137
|
_define_property(this, "movingInstanceOldParent", null);
|
|
@@ -147,8 +147,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
147
147
|
_create_class(Store, [
|
|
148
148
|
{
|
|
149
149
|
key: "selectedRules",
|
|
150
|
-
get: /**
|
|
151
|
-
* 当前选中控件的rules
|
|
150
|
+
get: /**
|
|
151
|
+
* 当前选中控件的rules
|
|
152
152
|
* */ function get() {
|
|
153
153
|
if (!this.selected) {
|
|
154
154
|
return null;
|
|
@@ -158,8 +158,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
key: "selectedAntdRules",
|
|
161
|
-
get: /**
|
|
162
|
-
* 当前选中控件的antd rules
|
|
161
|
+
get: /**
|
|
162
|
+
* 当前选中控件的antd rules
|
|
163
163
|
* */ function get() {
|
|
164
164
|
var rules = this.selectedRules;
|
|
165
165
|
if (!rules) {
|
package/dist/esm/utils.js
CHANGED
|
@@ -86,7 +86,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
86
86
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
87
87
|
}
|
|
88
88
|
function _ts_generator(thisArg, body) {
|
|
89
|
-
var f, y, t,
|
|
89
|
+
var f, y, t, _ = {
|
|
90
90
|
label: 0,
|
|
91
91
|
sent: function() {
|
|
92
92
|
if (t[0] & 1) throw t[1];
|
|
@@ -94,12 +94,8 @@ function _ts_generator(thisArg, body) {
|
|
|
94
94
|
},
|
|
95
95
|
trys: [],
|
|
96
96
|
ops: []
|
|
97
|
-
};
|
|
98
|
-
return g = {
|
|
99
|
-
next: verb(0),
|
|
100
|
-
"throw": verb(1),
|
|
101
|
-
"return": verb(2)
|
|
102
|
-
}, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
97
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
98
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() {
|
|
103
99
|
return this;
|
|
104
100
|
}), g;
|
|
105
101
|
function verb(n) {
|
|
@@ -112,7 +108,7 @@ function _ts_generator(thisArg, body) {
|
|
|
112
108
|
}
|
|
113
109
|
function step(op) {
|
|
114
110
|
if (f) throw new TypeError("Generator is already executing.");
|
|
115
|
-
while(_)try {
|
|
111
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
116
112
|
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;
|
|
117
113
|
if (y = 0, t) op = [
|
|
118
114
|
op[0] & 2,
|
|
@@ -195,9 +191,9 @@ export function getMasterFormControls(controls) {
|
|
|
195
191
|
});
|
|
196
192
|
return formctls;
|
|
197
193
|
}
|
|
198
|
-
/**
|
|
199
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
200
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
194
|
+
/**
|
|
195
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
196
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
201
197
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
202
198
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
203
199
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
@@ -229,13 +225,13 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
|
|
|
229
225
|
}
|
|
230
226
|
return prefix + fieldCode;
|
|
231
227
|
}
|
|
232
|
-
/**
|
|
233
|
-
* @description 通过fieldType获取列表表头的type
|
|
228
|
+
/**
|
|
229
|
+
* @description 通过fieldType获取列表表头的type
|
|
234
230
|
* */ export function getColumnTypeFromFiledType(fieldType) {
|
|
235
231
|
return FieldTypeToColumnType[fieldType];
|
|
236
232
|
}
|
|
237
|
-
/**
|
|
238
|
-
* @description 通过modelBindInfoList生成多个columns
|
|
233
|
+
/**
|
|
234
|
+
* @description 通过modelBindInfoList生成多个columns
|
|
239
235
|
* */ export function getColumnsFromModelBindInfoList(modelBindInfoList) {
|
|
240
236
|
var designer = new Designer();
|
|
241
237
|
var columns = [];
|
|
@@ -318,10 +314,7 @@ function getModelBindInfoList(controls) {
|
|
|
318
314
|
return controls.toDataBindModel();
|
|
319
315
|
}
|
|
320
316
|
function checkSchema(controls, messages, ignore) {
|
|
321
|
-
return
|
|
322
|
-
}
|
|
323
|
-
function _checkSchema() {
|
|
324
|
-
_checkSchema = _async_to_generator(function(controls, messages, ignore) {
|
|
317
|
+
return _async_to_generator(function() {
|
|
325
318
|
var result;
|
|
326
319
|
return _ts_generator(this, function(_state) {
|
|
327
320
|
switch(_state.label){
|
|
@@ -356,8 +349,7 @@ function _checkSchema() {
|
|
|
356
349
|
];
|
|
357
350
|
}
|
|
358
351
|
});
|
|
359
|
-
});
|
|
360
|
-
return _checkSchema.apply(this, arguments);
|
|
352
|
+
})();
|
|
361
353
|
}
|
|
362
354
|
// 不可以被权限控制的控件
|
|
363
355
|
var PermissionExcludeControlTypes = [
|