@byteluck-fe/model-driven-driven 6.1.0-2-beta.1 → 6.1.0-2-beta.6
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 +11 -3
- package/dist/esm/Driven.js +26 -26
- package/dist/esm/Store.js +31 -31
- package/dist/esm/utils.js +20 -12
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +9 -9
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +114 -114
- 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 +4 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +41 -41
- package/package.json +3 -3
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
|
@@ -154,9 +154,17 @@ function _ts_generator(thisArg, body) {
|
|
|
154
154
|
},
|
|
155
155
|
trys: [],
|
|
156
156
|
ops: []
|
|
157
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
158
|
-
return
|
|
159
|
-
|
|
157
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
158
|
+
return d(g, "next", {
|
|
159
|
+
value: verb(0)
|
|
160
|
+
}), d(g, "throw", {
|
|
161
|
+
value: verb(1)
|
|
162
|
+
}), d(g, "return", {
|
|
163
|
+
value: verb(2)
|
|
164
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
165
|
+
value: function() {
|
|
166
|
+
return this;
|
|
167
|
+
}
|
|
160
168
|
}), g;
|
|
161
169
|
function verb(n) {
|
|
162
170
|
return function(v) {
|
package/dist/esm/Driven.js
CHANGED
|
@@ -189,24 +189,24 @@ import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
|
|
|
189
189
|
import { DEFAULT_LOCALE } from '@byteluck-fe/model-driven-shared';
|
|
190
190
|
// 当前正在注册的插件名称
|
|
191
191
|
var applyingPluginName = '';
|
|
192
|
-
/**
|
|
193
|
-
* 设计器驱动
|
|
192
|
+
/**
|
|
193
|
+
* 设计器驱动
|
|
194
194
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
195
195
|
"use strict";
|
|
196
196
|
_inherits(Driven, Watcher);
|
|
197
197
|
function Driven(options) {
|
|
198
198
|
_class_call_check(this, Driven);
|
|
199
199
|
var _this;
|
|
200
|
-
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
201
|
-
* 控件可选的事件
|
|
202
|
-
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
203
|
-
* 处理数据存储,存放模型等
|
|
204
|
-
* */ _define_property(_this, "store", void 0), /**
|
|
205
|
-
* 额外参数存储
|
|
206
|
-
*/ _define_property(_this, "externalParams", void 0), /**
|
|
207
|
-
* 处理instance,和schema存储
|
|
208
|
-
* */ _define_property(_this, "designer", void 0), /**
|
|
209
|
-
* 插件数组
|
|
200
|
+
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
201
|
+
* 控件可选的事件
|
|
202
|
+
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
203
|
+
* 处理数据存储,存放模型等
|
|
204
|
+
* */ _define_property(_this, "store", void 0), /**
|
|
205
|
+
* 额外参数存储
|
|
206
|
+
*/ _define_property(_this, "externalParams", void 0), /**
|
|
207
|
+
* 处理instance,和schema存储
|
|
208
|
+
* */ _define_property(_this, "designer", void 0), /**
|
|
209
|
+
* 插件数组
|
|
210
210
|
* */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
|
|
211
211
|
_define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
|
|
212
212
|
_define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
|
|
@@ -474,10 +474,10 @@ var applyingPluginName = '';
|
|
|
474
474
|
if (instance === null) return;
|
|
475
475
|
var _instance = this.getInstance(instance);
|
|
476
476
|
if (!_instance) return;
|
|
477
|
-
/*
|
|
478
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
479
|
-
事件是否区分move和add
|
|
480
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
477
|
+
/*
|
|
478
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
479
|
+
事件是否区分move和add
|
|
480
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
481
481
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
482
482
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
483
483
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -602,8 +602,8 @@ var applyingPluginName = '';
|
|
|
602
602
|
},
|
|
603
603
|
{
|
|
604
604
|
key: "removeInstance",
|
|
605
|
-
value: /**
|
|
606
|
-
* 删除控件
|
|
605
|
+
value: /**
|
|
606
|
+
* 删除控件
|
|
607
607
|
* */ function removeInstance(instance) {
|
|
608
608
|
// 删除实例,并触发事件 removed
|
|
609
609
|
var parent = instance.parent;
|
|
@@ -642,8 +642,8 @@ var applyingPluginName = '';
|
|
|
642
642
|
},
|
|
643
643
|
{
|
|
644
644
|
key: "updateInstanceType",
|
|
645
|
-
value: /**
|
|
646
|
-
* 修改控件类型
|
|
645
|
+
value: /**
|
|
646
|
+
* 修改控件类型
|
|
647
647
|
* */ function updateInstanceType(instance, type) {
|
|
648
648
|
var schema = instance.toSchema();
|
|
649
649
|
var newInstance = this.createInstance(type, {
|
|
@@ -701,16 +701,16 @@ var applyingPluginName = '';
|
|
|
701
701
|
},
|
|
702
702
|
{
|
|
703
703
|
key: "assertInstance",
|
|
704
|
-
value: /**
|
|
705
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
704
|
+
value: /**
|
|
705
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
706
706
|
* */ function assertInstance(instance, types) {
|
|
707
707
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
708
708
|
}
|
|
709
709
|
},
|
|
710
710
|
{
|
|
711
711
|
key: "getInstanceInListControl",
|
|
712
|
-
value: /**
|
|
713
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
712
|
+
value: /**
|
|
713
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
714
714
|
* */ function getInstanceInListControl(instance) {
|
|
715
715
|
var _instance = instance;
|
|
716
716
|
while(_instance){
|
|
@@ -781,7 +781,7 @@ var applyingPluginName = '';
|
|
|
781
781
|
]);
|
|
782
782
|
return Driven;
|
|
783
783
|
}(Watcher);
|
|
784
|
-
/**
|
|
785
|
-
* 控件事件定义
|
|
784
|
+
/**
|
|
785
|
+
* 控件事件定义
|
|
786
786
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
787
787
|
export { Driven };
|
package/dist/esm/Store.js
CHANGED
|
@@ -96,48 +96,48 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
96
96
|
"use strict";
|
|
97
97
|
function Store(options) {
|
|
98
98
|
_class_call_check(this, Store);
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
var _options_getParentBeforeInstanceMove;
|
|
100
|
+
/**
|
|
101
|
+
* 页面控件实例树
|
|
101
102
|
* */ _define_property(this, "instance", void 0);
|
|
102
|
-
/**
|
|
103
|
-
* 拍平的控件数组
|
|
103
|
+
/**
|
|
104
|
+
* 拍平的控件数组
|
|
104
105
|
* */ _define_property(this, "flatInstances", void 0);
|
|
105
|
-
/**
|
|
106
|
-
* 控件id组成的map
|
|
106
|
+
/**
|
|
107
|
+
* 控件id组成的map
|
|
107
108
|
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
|
-
/**
|
|
109
|
-
* dataCode和fieldCode组成的map
|
|
110
|
-
* {
|
|
111
|
-
* [主表dataCode]: {
|
|
112
|
-
* [fieldCode]: 控件
|
|
113
|
-
* },
|
|
114
|
-
* [子表dataCode]: {
|
|
115
|
-
* [fieldCode]: 控件
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
109
|
+
/**
|
|
110
|
+
* dataCode和fieldCode组成的map
|
|
111
|
+
* {
|
|
112
|
+
* [主表dataCode]: {
|
|
113
|
+
* [fieldCode]: 控件
|
|
114
|
+
* },
|
|
115
|
+
* [子表dataCode]: {
|
|
116
|
+
* [fieldCode]: 控件
|
|
117
|
+
* }
|
|
118
|
+
* }
|
|
118
119
|
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
|
-
/**
|
|
120
|
-
* 当前选中的控件
|
|
120
|
+
/**
|
|
121
|
+
* 当前选中的控件
|
|
121
122
|
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
123
|
+
/**
|
|
124
|
+
* 当前选中的数据作用域控件
|
|
124
125
|
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
126
|
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
127
|
+
/**
|
|
128
|
+
* 当前选中控件的setting
|
|
128
129
|
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
130
|
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
131
|
+
/**
|
|
132
|
+
* 当前选中控件的数据模型
|
|
132
133
|
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
134
|
+
/**
|
|
135
|
+
* 扩展字段,比如appId,dataCode等
|
|
135
136
|
* */ _define_property(this, "external", {});
|
|
136
137
|
_define_property(this, "movingInstance", null);
|
|
137
138
|
_define_property(this, "movingInstanceOldParent", null);
|
|
138
139
|
_define_property(this, "movingInstanceOldDataScopeParent", null);
|
|
139
140
|
_define_property(this, "getParentBeforeInstanceMove", void 0);
|
|
140
|
-
var _options_getParentBeforeInstanceMove;
|
|
141
141
|
this.getParentBeforeInstanceMove = (_options_getParentBeforeInstanceMove = options.getParentBeforeInstanceMove) !== null && _options_getParentBeforeInstanceMove !== void 0 ? _options_getParentBeforeInstanceMove : function(instance) {
|
|
142
142
|
return instance.parent;
|
|
143
143
|
};
|
|
@@ -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
|
@@ -94,9 +94,17 @@ function _ts_generator(thisArg, body) {
|
|
|
94
94
|
},
|
|
95
95
|
trys: [],
|
|
96
96
|
ops: []
|
|
97
|
-
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
98
|
-
return
|
|
99
|
-
|
|
97
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
98
|
+
return d(g, "next", {
|
|
99
|
+
value: verb(0)
|
|
100
|
+
}), d(g, "throw", {
|
|
101
|
+
value: verb(1)
|
|
102
|
+
}), d(g, "return", {
|
|
103
|
+
value: verb(2)
|
|
104
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
105
|
+
value: function() {
|
|
106
|
+
return this;
|
|
107
|
+
}
|
|
100
108
|
}), g;
|
|
101
109
|
function verb(n) {
|
|
102
110
|
return function(v) {
|
|
@@ -193,9 +201,9 @@ export function getMasterFormControls(controls) {
|
|
|
193
201
|
});
|
|
194
202
|
return formctls;
|
|
195
203
|
}
|
|
196
|
-
/**
|
|
197
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
198
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
204
|
+
/**
|
|
205
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
206
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
199
207
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
200
208
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
201
209
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
@@ -337,16 +345,16 @@ function generatePermissions(controls, parent) {
|
|
|
337
345
|
}).flat()));
|
|
338
346
|
} else {
|
|
339
347
|
var type = controls.type;
|
|
340
|
-
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content;
|
|
348
|
+
var _controls_props = controls.props, caption = _controls_props.caption, content = _controls_props.content, title = _controls_props.title;
|
|
341
349
|
var permissionItem;
|
|
342
350
|
if (!PermissionExcludeControlTypes.includes(type)) {
|
|
343
|
-
var
|
|
351
|
+
var _ref;
|
|
344
352
|
permissionItem = {
|
|
345
353
|
controlId: controls.id,
|
|
346
|
-
caption: caption || content || controls.name,
|
|
354
|
+
caption: caption || content || title || controls.name,
|
|
347
355
|
type: controls.type,
|
|
348
356
|
controlType: controls.controlType,
|
|
349
|
-
parentId: (
|
|
357
|
+
parentId: (_ref = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _ref !== void 0 ? _ref : null,
|
|
350
358
|
canEdit: !cannotEditControlTypes.includes(type),
|
|
351
359
|
canRead: true,
|
|
352
360
|
canHide: true,
|
|
@@ -402,14 +410,14 @@ function generatePermissions(controls, parent) {
|
|
|
402
410
|
var _param = _sliced_to_array(param, 2), key = _param[0], _param_ = _param[1], caption = _param_.caption, controlId = _param_.id;
|
|
403
411
|
var operationItem = controls.props[key];
|
|
404
412
|
if (operationItem && operationItem.isShow) {
|
|
405
|
-
var
|
|
413
|
+
var _ref;
|
|
406
414
|
// 只能控制是否显示
|
|
407
415
|
result.push({
|
|
408
416
|
controlId: controlId,
|
|
409
417
|
caption: caption,
|
|
410
418
|
type: controls.type,
|
|
411
419
|
controlType: controls.controlType,
|
|
412
|
-
parentId: (
|
|
420
|
+
parentId: (_ref = parent === null || parent === void 0 ? void 0 : parent.controlId) !== null && _ref !== void 0 ? _ref : null,
|
|
413
421
|
canEdit: false,
|
|
414
422
|
canRead: false,
|
|
415
423
|
canHide: true,
|