@byteluck-fe/model-driven-driven 2.10.0-alpha.8 → 2.11.0-alpha.0
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/Driven.js +29 -29
- package/dist/esm/Store.js +30 -30
- package/dist/esm/utils.js +7 -7
- package/dist/index.umd.js +1 -1
- package/dist/types/Builder.d.ts +9 -9
- 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 +6 -6
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/Driven.js
CHANGED
|
@@ -200,8 +200,8 @@ import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from
|
|
|
200
200
|
import { Group, initSettings, Tab } from "@byteluck-fe/model-driven-settings";
|
|
201
201
|
// 当前正在注册的插件名称
|
|
202
202
|
var applyingPluginName = "";
|
|
203
|
-
/**
|
|
204
|
-
* 设计器驱动
|
|
203
|
+
/**
|
|
204
|
+
* 设计器驱动
|
|
205
205
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
206
206
|
"use strict";
|
|
207
207
|
_inherits(Driven, Watcher);
|
|
@@ -213,20 +213,20 @@ var applyingPluginName = "";
|
|
|
213
213
|
_define_property(_assert_this_initialized(_this), "mode", void 0);
|
|
214
214
|
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
215
215
|
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
216
|
-
/**
|
|
217
|
-
* 控件可选的事件
|
|
216
|
+
/**
|
|
217
|
+
* 控件可选的事件
|
|
218
218
|
* */ _define_property(_assert_this_initialized(_this), "eventLogic", void 0);
|
|
219
|
-
/**
|
|
220
|
-
* 处理数据存储,存放模型等
|
|
219
|
+
/**
|
|
220
|
+
* 处理数据存储,存放模型等
|
|
221
221
|
* */ _define_property(_assert_this_initialized(_this), "store", void 0);
|
|
222
|
-
/**
|
|
223
|
-
* 额外参数存储
|
|
222
|
+
/**
|
|
223
|
+
* 额外参数存储
|
|
224
224
|
*/ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
225
|
-
/**
|
|
226
|
-
* 处理instance,和schema存储
|
|
225
|
+
/**
|
|
226
|
+
* 处理instance,和schema存储
|
|
227
227
|
* */ _define_property(_assert_this_initialized(_this), "designer", void 0);
|
|
228
|
-
/**
|
|
229
|
-
* 插件数组
|
|
228
|
+
/**
|
|
229
|
+
* 插件数组
|
|
230
230
|
* */ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
231
231
|
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
232
232
|
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
@@ -499,10 +499,10 @@ var applyingPluginName = "";
|
|
|
499
499
|
if (instance === null) return;
|
|
500
500
|
var _instance = this.getInstance(instance);
|
|
501
501
|
if (!_instance) return;
|
|
502
|
-
/*
|
|
503
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
504
|
-
事件是否区分move和add
|
|
505
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
502
|
+
/*
|
|
503
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
504
|
+
事件是否区分move和add
|
|
505
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
506
506
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
507
507
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
508
508
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -602,8 +602,8 @@ var applyingPluginName = "";
|
|
|
602
602
|
{
|
|
603
603
|
key: "updateInstanceProps",
|
|
604
604
|
value: function updateInstanceProps(instance, props, payload) {
|
|
605
|
-
var _this = this;
|
|
606
605
|
var prevKey = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : "";
|
|
606
|
+
var _this = this;
|
|
607
607
|
Object.entries(props).forEach(function(param) {
|
|
608
608
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
609
609
|
var propName = "".concat(prevKey ? prevKey + "." : "").concat(key);
|
|
@@ -627,8 +627,8 @@ var applyingPluginName = "";
|
|
|
627
627
|
},
|
|
628
628
|
{
|
|
629
629
|
key: "removeInstance",
|
|
630
|
-
value: /**
|
|
631
|
-
* 删除控件
|
|
630
|
+
value: /**
|
|
631
|
+
* 删除控件
|
|
632
632
|
* */ function removeInstance(instance) {
|
|
633
633
|
// 删除实例,并触发事件 removed
|
|
634
634
|
var parent = instance.parent;
|
|
@@ -667,8 +667,8 @@ var applyingPluginName = "";
|
|
|
667
667
|
},
|
|
668
668
|
{
|
|
669
669
|
key: "updateInstanceType",
|
|
670
|
-
value: /**
|
|
671
|
-
* 修改控件类型
|
|
670
|
+
value: /**
|
|
671
|
+
* 修改控件类型
|
|
672
672
|
* */ function updateInstanceType(instance, type) {
|
|
673
673
|
var schema = instance.toSchema();
|
|
674
674
|
var newInstance = this.createInstance(type, {
|
|
@@ -726,16 +726,16 @@ var applyingPluginName = "";
|
|
|
726
726
|
},
|
|
727
727
|
{
|
|
728
728
|
key: "assertInstance",
|
|
729
|
-
value: /**
|
|
730
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
729
|
+
value: /**
|
|
730
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
731
731
|
* */ function assertInstance(instance, types) {
|
|
732
732
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
733
733
|
}
|
|
734
734
|
},
|
|
735
735
|
{
|
|
736
736
|
key: "getInstanceInListControl",
|
|
737
|
-
value: /**
|
|
738
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
737
|
+
value: /**
|
|
738
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
739
739
|
* */ function getInstanceInListControl(instance) {
|
|
740
740
|
var _instance = instance;
|
|
741
741
|
while(_instance){
|
|
@@ -763,8 +763,8 @@ var applyingPluginName = "";
|
|
|
763
763
|
{
|
|
764
764
|
key: "callSelectedEffect",
|
|
765
765
|
value: function callSelectedEffect(effectKey) {
|
|
766
|
-
var _this = this;
|
|
767
766
|
var payload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
767
|
+
var _this = this;
|
|
768
768
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
769
769
|
setting.callEffect(effectKey, _this, _object_spread({
|
|
770
770
|
control: _this.store.selected
|
|
@@ -775,8 +775,8 @@ var applyingPluginName = "";
|
|
|
775
775
|
{
|
|
776
776
|
key: "callSelectedScopeEffect",
|
|
777
777
|
value: function callSelectedScopeEffect() {
|
|
778
|
-
var _this = this;
|
|
779
778
|
var payload = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
779
|
+
var _this = this;
|
|
780
780
|
this.store.selectedInstanceSettingItems.forEach(function(setting) {
|
|
781
781
|
setting.callScopeEffect(_this, _object_spread({
|
|
782
782
|
control: _this.store.selected
|
|
@@ -806,7 +806,7 @@ var applyingPluginName = "";
|
|
|
806
806
|
]);
|
|
807
807
|
return Driven;
|
|
808
808
|
}(Watcher);
|
|
809
|
-
/**
|
|
810
|
-
* 控件事件定义
|
|
809
|
+
/**
|
|
810
|
+
* 控件事件定义
|
|
811
811
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
812
812
|
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
|
@@ -195,9 +195,9 @@ export function getMasterFormControls(controls) {
|
|
|
195
195
|
});
|
|
196
196
|
return formctls;
|
|
197
197
|
}
|
|
198
|
-
/**
|
|
199
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
200
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
198
|
+
/**
|
|
199
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
200
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
201
201
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
202
202
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
|
|
203
203
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
@@ -228,13 +228,13 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
|
|
|
228
228
|
}
|
|
229
229
|
return prefix + fieldCode;
|
|
230
230
|
}
|
|
231
|
-
/**
|
|
232
|
-
* @description 通过fieldType获取列表表头的type
|
|
231
|
+
/**
|
|
232
|
+
* @description 通过fieldType获取列表表头的type
|
|
233
233
|
* */ export function getColumnTypeFromFiledType(fieldType) {
|
|
234
234
|
return FieldTypeToColumnType[fieldType];
|
|
235
235
|
}
|
|
236
|
-
/**
|
|
237
|
-
* @description 通过modelBindInfoList生成多个columns
|
|
236
|
+
/**
|
|
237
|
+
* @description 通过modelBindInfoList生成多个columns
|
|
238
238
|
* */ export function getColumnsFromModelBindInfoList(modelBindInfoList) {
|
|
239
239
|
var designer = new Designer();
|
|
240
240
|
var columns = [];
|