@byteluck-fe/model-driven-driven 4.41.0-lx0 → 5.5.0-1-beta1
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/Builder.js +46 -31
- package/dist/esm/Driven.js +28 -27
- package/dist/esm/Store.js +39 -39
- package/dist/esm/constants.js +7 -6
- package/dist/esm/designerUtils.js +8 -3
- package/dist/esm/utils.js +11 -78
- package/dist/index.umd.js +3 -3
- package/dist/types/Builder.d.ts +9 -8
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +114 -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 +4 -5
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +41 -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/Builder.js
CHANGED
|
@@ -30,6 +30,7 @@ function _define_property(obj, key, value) {
|
|
|
30
30
|
}
|
|
31
31
|
return obj;
|
|
32
32
|
}
|
|
33
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
33
34
|
import Designer from './Designer';
|
|
34
35
|
import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
35
36
|
export var Builder = /*#__PURE__*/ function() {
|
|
@@ -97,39 +98,53 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
97
98
|
listview.children.push(simpleSearch);
|
|
98
99
|
// @ts-ignore
|
|
99
100
|
listview.children.push(gridTable);
|
|
100
|
-
listview.props.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
listview.props.rowStyle = {
|
|
102
|
+
type: 'rules',
|
|
103
|
+
"interval": {
|
|
104
|
+
"color": ""
|
|
105
|
+
},
|
|
106
|
+
rules: [
|
|
105
107
|
{
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
'
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
108
|
+
id: 'default',
|
|
109
|
+
name: getLocaleText('CMD.approvedDocuments', null, '审批通过单据'),
|
|
110
|
+
color: 'theme',
|
|
111
|
+
filters: [
|
|
112
|
+
{
|
|
113
|
+
ruleId: 1,
|
|
114
|
+
symbol: 'op_equal',
|
|
115
|
+
leftVariableBo: {
|
|
116
|
+
type: 'varchar',
|
|
117
|
+
value: 'process_status',
|
|
118
|
+
name: getLocaleText('CMD.processStatus', null, '流程状态')
|
|
119
|
+
},
|
|
120
|
+
checked: false,
|
|
121
|
+
describe: 'ruleLine',
|
|
122
|
+
type: 'condition',
|
|
123
|
+
rightVariableBo: {
|
|
124
|
+
type: 'custom',
|
|
125
|
+
value: [
|
|
126
|
+
'COMPLETE'
|
|
127
|
+
],
|
|
128
|
+
displayBos: []
|
|
129
|
+
},
|
|
130
|
+
isLowPerformance: false,
|
|
131
|
+
isMoreRelation: false
|
|
132
|
+
}
|
|
133
|
+
],
|
|
134
|
+
"settings": [
|
|
135
|
+
{
|
|
136
|
+
"color": "theme",
|
|
137
|
+
"field_codes": [
|
|
138
|
+
"process_status"
|
|
139
|
+
],
|
|
140
|
+
"type": "fontColor",
|
|
141
|
+
"scope": "col"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
script: "(SpecialMatch(data,sys,'process_status','varchar','op_equal','COMPLETE'))"
|
|
125
145
|
}
|
|
126
146
|
]
|
|
127
|
-
}
|
|
128
|
-
listview.props.rowStyleRulesScript.push({
|
|
129
|
-
id: 'default',
|
|
130
|
-
script: "(params.data['process_status']==='COMPLETE')",
|
|
131
|
-
color: 'theme'
|
|
132
|
-
});
|
|
147
|
+
};
|
|
133
148
|
return listview;
|
|
134
149
|
}
|
|
135
150
|
},
|
|
@@ -157,7 +172,7 @@ export var Builder = /*#__PURE__*/ function() {
|
|
|
157
172
|
var grid = this.designer.createControlInstance(// @ts-ignore
|
|
158
173
|
CONTROL_TYPE.GRID);
|
|
159
174
|
var vueFormItem = this.designer.createControlInstance(// @ts-ignore
|
|
160
|
-
CONTROL_TYPE.
|
|
175
|
+
CONTROL_TYPE.VUE_PAGE);
|
|
161
176
|
// @ts-ignore
|
|
162
177
|
vueFormItem.props.isHideCaption = true;
|
|
163
178
|
// @ts-ignore
|
package/dist/esm/Driven.js
CHANGED
|
@@ -186,32 +186,33 @@ import { Designer } from './Designer';
|
|
|
186
186
|
import EventLogic from './EventLogic';
|
|
187
187
|
import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from './utils';
|
|
188
188
|
import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
|
|
189
|
+
import { DEFAULT_LOCALE } from '@byteluck-fe/model-driven-shared';
|
|
189
190
|
// 当前正在注册的插件名称
|
|
190
191
|
var applyingPluginName = '';
|
|
191
|
-
/**
|
|
192
|
-
* 设计器驱动
|
|
192
|
+
/**
|
|
193
|
+
* 设计器驱动
|
|
193
194
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
194
195
|
"use strict";
|
|
195
196
|
_inherits(Driven, Watcher);
|
|
196
197
|
function Driven(options) {
|
|
197
198
|
_class_call_check(this, Driven);
|
|
198
199
|
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
|
-
* 插件数组
|
|
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
|
+
* 插件数组
|
|
209
210
|
* */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
|
|
210
211
|
_define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
|
|
211
212
|
_define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
|
|
212
213
|
_define_property(_this, "generatePermissions", generatePermissions);
|
|
213
214
|
_this.$options = Object.freeze(options);
|
|
214
|
-
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? false : _this_$options_autoMount, tmp = _this_$options.Designer, DesignerClass = tmp === void 0 ? Designer : tmp, schema = _this_$options.schema, _this_$options_mode = _this_$options.mode, mode = _this_$options_mode === void 0 ? 'form' : _this_$options_mode, tmp1 = _this_$options.store, storeOptions = tmp1 === void 0 ? {} : tmp1;
|
|
215
|
+
var _this_$options = _this.$options, _this_$options_autoMount = _this_$options.autoMount, autoMount = _this_$options_autoMount === void 0 ? false : _this_$options_autoMount, tmp = _this_$options.Designer, DesignerClass = tmp === void 0 ? Designer : tmp, schema = _this_$options.schema, _this_$options_mode = _this_$options.mode, mode = _this_$options_mode === void 0 ? 'form' : _this_$options_mode, tmp1 = _this_$options.store, storeOptions = tmp1 === void 0 ? {} : tmp1, messagesI18n = _this_$options.messagesI18n, _this_$options_language = _this_$options.language, language = _this_$options_language === void 0 ? DEFAULT_LOCALE : _this_$options_language;
|
|
215
216
|
_this.eventLogic = new EventLogic();
|
|
216
217
|
_this.designer = new DesignerClass();
|
|
217
218
|
_this.store = new Store(_object_spread({
|
|
@@ -473,10 +474,10 @@ var applyingPluginName = '';
|
|
|
473
474
|
if (instance === null) return;
|
|
474
475
|
var _instance = this.getInstance(instance);
|
|
475
476
|
if (!_instance) return;
|
|
476
|
-
/*
|
|
477
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
478
|
-
事件是否区分move和add
|
|
479
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
477
|
+
/*
|
|
478
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
479
|
+
事件是否区分move和add
|
|
480
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
480
481
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
481
482
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
482
483
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -601,8 +602,8 @@ var applyingPluginName = '';
|
|
|
601
602
|
},
|
|
602
603
|
{
|
|
603
604
|
key: "removeInstance",
|
|
604
|
-
value: /**
|
|
605
|
-
* 删除控件
|
|
605
|
+
value: /**
|
|
606
|
+
* 删除控件
|
|
606
607
|
* */ function removeInstance(instance) {
|
|
607
608
|
// 删除实例,并触发事件 removed
|
|
608
609
|
var parent = instance.parent;
|
|
@@ -641,8 +642,8 @@ var applyingPluginName = '';
|
|
|
641
642
|
},
|
|
642
643
|
{
|
|
643
644
|
key: "updateInstanceType",
|
|
644
|
-
value: /**
|
|
645
|
-
* 修改控件类型
|
|
645
|
+
value: /**
|
|
646
|
+
* 修改控件类型
|
|
646
647
|
* */ function updateInstanceType(instance, type) {
|
|
647
648
|
var schema = instance.toSchema();
|
|
648
649
|
var newInstance = this.createInstance(type, {
|
|
@@ -700,16 +701,16 @@ var applyingPluginName = '';
|
|
|
700
701
|
},
|
|
701
702
|
{
|
|
702
703
|
key: "assertInstance",
|
|
703
|
-
value: /**
|
|
704
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
704
|
+
value: /**
|
|
705
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
705
706
|
* */ function assertInstance(instance, types) {
|
|
706
707
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
707
708
|
}
|
|
708
709
|
},
|
|
709
710
|
{
|
|
710
711
|
key: "getInstanceInListControl",
|
|
711
|
-
value: /**
|
|
712
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
712
|
+
value: /**
|
|
713
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
713
714
|
* */ function getInstanceInListControl(instance) {
|
|
714
715
|
var _instance = instance;
|
|
715
716
|
while(_instance){
|
|
@@ -780,7 +781,7 @@ var applyingPluginName = '';
|
|
|
780
781
|
]);
|
|
781
782
|
return Driven;
|
|
782
783
|
}(Watcher);
|
|
783
|
-
/**
|
|
784
|
-
* 控件事件定义
|
|
784
|
+
/**
|
|
785
|
+
* 控件事件定义
|
|
785
786
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
786
787
|
export { Driven };
|
package/dist/esm/Store.js
CHANGED
|
@@ -89,49 +89,49 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
89
89
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
90
90
|
}
|
|
91
91
|
import { isDataBind } from '@byteluck-fe/model-driven-core';
|
|
92
|
-
import { hasChildrenControl,
|
|
92
|
+
import { hasChildrenControl, hasHeaderControl } from './designerUtils';
|
|
93
93
|
import { CONTROL_BASE_TYPE, CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
94
94
|
// 维护当前selected,。。 selectedControlSetting
|
|
95
95
|
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) {
|
|
@@ -294,9 +294,11 @@ function setInstanceInDataFieldCodeMap(instance, dataFieldCodeMap) {
|
|
|
294
294
|
if (isDataBind(dataBind)) {
|
|
295
295
|
setDataFieldCodeMap(dataFieldCodeMap, dataBind, instance);
|
|
296
296
|
} else {
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
297
|
+
if (dataBind) {
|
|
298
|
+
Object.values(dataBind).forEach(function(subDataBind) {
|
|
299
|
+
setDataFieldCodeMap(dataFieldCodeMap, subDataBind, instance);
|
|
300
|
+
});
|
|
301
|
+
}
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
}
|
|
@@ -312,11 +314,9 @@ export function loop(instances, callback) {
|
|
|
312
314
|
if (hasHeaderControl(item)) {
|
|
313
315
|
loop(item.props.headers, callback);
|
|
314
316
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
loop((_item_props_footers = (_item_props = item.props) === null || _item_props === void 0 ? void 0 : _item_props.footers) !== null && _item_props_footers !== void 0 ? _item_props_footers : [], callback);
|
|
319
|
-
}
|
|
317
|
+
// if(item)) {
|
|
318
|
+
// loop(item.props?.footers ?? [], callback)
|
|
319
|
+
// }
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
322
|
export function isDataScopeInstance(instance) {
|
package/dist/esm/constants.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
1
2
|
import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
2
3
|
// 使用ObjectDataBind 的控件
|
|
3
4
|
export var objectDataBindControlTypes = [
|
|
@@ -7,27 +8,27 @@ export var objectDataBindControlTypes = [
|
|
|
7
8
|
];
|
|
8
9
|
export var objectDataBindKeyToFieldType = {
|
|
9
10
|
amount: {
|
|
10
|
-
caption: '金额',
|
|
11
|
+
caption: getLocaleText('CMD.amount', null, '金额'),
|
|
11
12
|
fieldType: FieldTypes.DECIMAL
|
|
12
13
|
},
|
|
13
14
|
currency: {
|
|
14
|
-
caption: '币种',
|
|
15
|
+
caption: getLocaleText('CMD.currency', null, '币种'),
|
|
15
16
|
fieldType: FieldTypes.VARCHAR
|
|
16
17
|
},
|
|
17
18
|
result: {
|
|
18
|
-
caption: '结果',
|
|
19
|
+
caption: getLocaleText('CMD.result', null, '结果'),
|
|
19
20
|
fieldType: FieldTypes.DECIMAL
|
|
20
21
|
},
|
|
21
22
|
unit: {
|
|
22
|
-
caption: '单位',
|
|
23
|
+
caption: getLocaleText('CMD.unit', null, '单位'),
|
|
23
24
|
fieldType: FieldTypes.VARCHAR
|
|
24
25
|
},
|
|
25
26
|
min: {
|
|
26
|
-
caption: '开始时间',
|
|
27
|
+
caption: getLocaleText('CMD.startTime', null, '开始时间'),
|
|
27
28
|
fieldType: FieldTypes.TIMESTAMP
|
|
28
29
|
},
|
|
29
30
|
max: {
|
|
30
|
-
caption: '结束时间',
|
|
31
|
+
caption: getLocaleText('CMD.endTime', null, '结束时间'),
|
|
31
32
|
fieldType: FieldTypes.TIMESTAMP
|
|
32
33
|
}
|
|
33
34
|
};
|
|
@@ -5,9 +5,14 @@ export function hasChildrenControl(instance) {
|
|
|
5
5
|
export function hasHeaderControl(instance) {
|
|
6
6
|
return 'headers' in instance.props && isArray(instance.props.headers);
|
|
7
7
|
}
|
|
8
|
-
export function hasFooterControl(
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
// export function hasFooterControl(
|
|
9
|
+
// instance: DesignerControl
|
|
10
|
+
// ): instance is DesignerListControl {
|
|
11
|
+
// return (
|
|
12
|
+
// 'footers' in instance.props &&
|
|
13
|
+
// isArray((instance as DesignerListControl).props.footers)
|
|
14
|
+
// )
|
|
15
|
+
// }
|
|
11
16
|
export function loopFormControl(control, callback) {
|
|
12
17
|
if (Array.isArray(control)) {
|
|
13
18
|
control.map(function(item) {
|
package/dist/esm/utils.js
CHANGED
|
@@ -177,9 +177,11 @@ function _ts_generator(thisArg, body) {
|
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
import { loopFormControl } from './designerUtils';
|
|
180
|
-
import { CONTROL_BASE_TYPE, CONTROL_TYPE,
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
import { CONTROL_BASE_TYPE, CONTROL_TYPE, // FieldTypes,
|
|
181
|
+
// FieldTypeToColumnType,
|
|
182
|
+
isArray } from '@byteluck-fe/model-driven-shared';
|
|
183
|
+
import { objectDataBindControlTypes } from './constants';
|
|
184
|
+
import { getLocaleText } from '@byteluck-fe/locale-message';
|
|
183
185
|
export function getMasterFormControls(controls) {
|
|
184
186
|
var formctls = [];
|
|
185
187
|
// @ts-ignore
|
|
@@ -191,9 +193,9 @@ export function getMasterFormControls(controls) {
|
|
|
191
193
|
});
|
|
192
194
|
return formctls;
|
|
193
195
|
}
|
|
194
|
-
/**
|
|
195
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
196
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
196
|
+
/**
|
|
197
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
198
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
197
199
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
198
200
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
199
201
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
@@ -225,75 +227,6 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
|
|
|
225
227
|
}
|
|
226
228
|
return prefix + fieldCode;
|
|
227
229
|
}
|
|
228
|
-
/**
|
|
229
|
-
* @description 通过fieldType获取列表表头的type
|
|
230
|
-
* */ export function getColumnTypeFromFiledType(fieldType) {
|
|
231
|
-
return FieldTypeToColumnType[fieldType];
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @description 通过modelBindInfoList生成多个columns
|
|
235
|
-
* */ export function getColumnsFromModelBindInfoList(modelBindInfoList) {
|
|
236
|
-
var designer = new Designer();
|
|
237
|
-
var columns = [];
|
|
238
|
-
modelBindInfoList.forEach(function(item) {
|
|
239
|
-
// 控件在明细子表内或者没有dataBind的话 不做生成
|
|
240
|
-
if (item.parentId || !item.dataBind) return;
|
|
241
|
-
// 如果是对象形式的dataBind的话
|
|
242
|
-
if (objectDataBindControlTypes.includes(item.type)) {
|
|
243
|
-
var objectDataBind = item.dataBind;
|
|
244
|
-
var datasourceBind = item.datasourceBind;
|
|
245
|
-
// 对象的每一个key生成一个column
|
|
246
|
-
Object.keys(objectDataBind).forEach(function(key) {
|
|
247
|
-
// 对应的dataBind
|
|
248
|
-
var dataBind = objectDataBind[key];
|
|
249
|
-
// 当前key对应的fieldType
|
|
250
|
-
var fieldType = objectDataBindKeyToFieldType[key].fieldType;
|
|
251
|
-
// 拼接当前列的caption
|
|
252
|
-
var caption = item.caption + '_' + objectDataBindKeyToFieldType[key].caption;
|
|
253
|
-
// 通过fieldType获取列类型
|
|
254
|
-
var controlType = getColumnTypeFromFiledType(fieldType);
|
|
255
|
-
if (!controlType) return;
|
|
256
|
-
var props = {
|
|
257
|
-
caption: caption,
|
|
258
|
-
dataBind: dataBind
|
|
259
|
-
};
|
|
260
|
-
if (key === 'currency') {
|
|
261
|
-
props.optionConfig = 'datasource';
|
|
262
|
-
props.datasourceBind = datasourceBind;
|
|
263
|
-
}
|
|
264
|
-
// @ts-ignore
|
|
265
|
-
var column = designer.createControlInstance(controlType, {
|
|
266
|
-
props: props
|
|
267
|
-
});
|
|
268
|
-
column && columns.push(column);
|
|
269
|
-
});
|
|
270
|
-
} else {
|
|
271
|
-
var controlType = getColumnTypeFromFiledType(item.fieldType);
|
|
272
|
-
if (!controlType) return;
|
|
273
|
-
// @ts-ignore
|
|
274
|
-
var column = designer.createControlInstance(controlType, {
|
|
275
|
-
props: {
|
|
276
|
-
caption: item.caption,
|
|
277
|
-
dataBind: item.dataBind,
|
|
278
|
-
datasourceBind: item.datasourceBind
|
|
279
|
-
}
|
|
280
|
-
});
|
|
281
|
-
column && columns.push(column);
|
|
282
|
-
}
|
|
283
|
-
});
|
|
284
|
-
return columns;
|
|
285
|
-
}
|
|
286
|
-
export function getColumnsFromFiledType(fieldTypes) {
|
|
287
|
-
var designer = new Designer();
|
|
288
|
-
var fieldTypesMap = Array.isArray(fieldTypes) ? fieldTypes : [
|
|
289
|
-
fieldTypes
|
|
290
|
-
];
|
|
291
|
-
var result = fieldTypesMap.map(function(fieldType) {
|
|
292
|
-
var columnType = getColumnTypeFromFiledType(fieldType);
|
|
293
|
-
return designer.createControlInstance(columnType);
|
|
294
|
-
});
|
|
295
|
-
return Array.isArray(fieldTypes) ? result : result[0];
|
|
296
|
-
}
|
|
297
230
|
function toSchema(schema) {
|
|
298
231
|
if (Array.isArray(schema)) {
|
|
299
232
|
return schema.map(function(item) {
|
|
@@ -383,15 +316,15 @@ var cannotEditControlTypes = [
|
|
|
383
316
|
var LIST_OPERATION_BUTTON_PERMISSIONS_MAPS = {
|
|
384
317
|
check: {
|
|
385
318
|
id: 'listPageCheckBtnId',
|
|
386
|
-
caption: '查看'
|
|
319
|
+
caption: getLocaleText('CMD.view', null, '查看')
|
|
387
320
|
},
|
|
388
321
|
edit: {
|
|
389
322
|
id: 'listPageEditBtnId',
|
|
390
|
-
caption: '编辑'
|
|
323
|
+
caption: getLocaleText('CMD.edit', null, '编辑')
|
|
391
324
|
},
|
|
392
325
|
delete: {
|
|
393
326
|
id: 'listPageDeleteBtnId',
|
|
394
|
-
caption: '删除'
|
|
327
|
+
caption: getLocaleText('CMD.delete', null, '删除')
|
|
395
328
|
}
|
|
396
329
|
};
|
|
397
330
|
// 生成权限字段
|