@byteluck-fe/model-driven-driven 2.5.3 → 2.5.8
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 +26 -26
- package/dist/esm/Store.js +30 -30
- package/dist/esm/utils.js +7 -7
- 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 +4 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- 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/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);
|
|
@@ -479,10 +479,10 @@ var applyingPluginName = "";
|
|
|
479
479
|
if (instance === null) return;
|
|
480
480
|
var _instance = this.getInstance(instance);
|
|
481
481
|
if (!_instance) return;
|
|
482
|
-
/*
|
|
483
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
484
|
-
事件是否区分move和add
|
|
485
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
482
|
+
/*
|
|
483
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
484
|
+
事件是否区分move和add
|
|
485
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
486
486
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
487
487
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
488
488
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -607,8 +607,8 @@ var applyingPluginName = "";
|
|
|
607
607
|
},
|
|
608
608
|
{
|
|
609
609
|
key: "removeInstance",
|
|
610
|
-
value: /**
|
|
611
|
-
* 删除控件
|
|
610
|
+
value: /**
|
|
611
|
+
* 删除控件
|
|
612
612
|
* */ function removeInstance(instance) {
|
|
613
613
|
// 删除实例,并触发事件 removed
|
|
614
614
|
var parent = instance.parent;
|
|
@@ -647,8 +647,8 @@ var applyingPluginName = "";
|
|
|
647
647
|
},
|
|
648
648
|
{
|
|
649
649
|
key: "updateInstanceType",
|
|
650
|
-
value: /**
|
|
651
|
-
* 修改控件类型
|
|
650
|
+
value: /**
|
|
651
|
+
* 修改控件类型
|
|
652
652
|
* */ function updateInstanceType(instance, type) {
|
|
653
653
|
var schema = instance.toSchema();
|
|
654
654
|
var newInstance = this.createInstance(type, {
|
|
@@ -707,16 +707,16 @@ var applyingPluginName = "";
|
|
|
707
707
|
},
|
|
708
708
|
{
|
|
709
709
|
key: "assertInstance",
|
|
710
|
-
value: /**
|
|
711
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
710
|
+
value: /**
|
|
711
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
712
712
|
* */ function assertInstance(instance, types) {
|
|
713
713
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
714
714
|
}
|
|
715
715
|
},
|
|
716
716
|
{
|
|
717
717
|
key: "getInstanceInListControl",
|
|
718
|
-
value: /**
|
|
719
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
718
|
+
value: /**
|
|
719
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
720
720
|
* */ function getInstanceInListControl(instance) {
|
|
721
721
|
var _instance = instance;
|
|
722
722
|
while(_instance){
|
|
@@ -787,7 +787,7 @@ var applyingPluginName = "";
|
|
|
787
787
|
]);
|
|
788
788
|
return Driven;
|
|
789
789
|
}(Watcher);
|
|
790
|
-
/**
|
|
791
|
-
* 控件事件定义
|
|
790
|
+
/**
|
|
791
|
+
* 控件事件定义
|
|
792
792
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
793
793
|
export { Driven };
|
package/dist/esm/Store.js
CHANGED
|
@@ -104,42 +104,42 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
104
104
|
"use strict";
|
|
105
105
|
function Store(options) {
|
|
106
106
|
_class_call_check(this, Store);
|
|
107
|
-
/**
|
|
108
|
-
* 页面控件实例树
|
|
107
|
+
/**
|
|
108
|
+
* 页面控件实例树
|
|
109
109
|
* */ _define_property(this, "instance", void 0);
|
|
110
|
-
/**
|
|
111
|
-
* 拍平的控件数组
|
|
110
|
+
/**
|
|
111
|
+
* 拍平的控件数组
|
|
112
112
|
* */ _define_property(this, "flatInstances", void 0);
|
|
113
|
-
/**
|
|
114
|
-
* 控件id组成的map
|
|
113
|
+
/**
|
|
114
|
+
* 控件id组成的map
|
|
115
115
|
* */ _define_property(this, "instanceIdMap", void 0);
|
|
116
|
-
/**
|
|
117
|
-
* dataCode和fieldCode组成的map
|
|
118
|
-
* {
|
|
119
|
-
* [主表dataCode]: {
|
|
120
|
-
* [fieldCode]: 控件
|
|
121
|
-
* },
|
|
122
|
-
* [子表dataCode]: {
|
|
123
|
-
* [fieldCode]: 控件
|
|
124
|
-
* }
|
|
125
|
-
* }
|
|
116
|
+
/**
|
|
117
|
+
* dataCode和fieldCode组成的map
|
|
118
|
+
* {
|
|
119
|
+
* [主表dataCode]: {
|
|
120
|
+
* [fieldCode]: 控件
|
|
121
|
+
* },
|
|
122
|
+
* [子表dataCode]: {
|
|
123
|
+
* [fieldCode]: 控件
|
|
124
|
+
* }
|
|
125
|
+
* }
|
|
126
126
|
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
127
|
-
/**
|
|
128
|
-
* 当前选中的控件
|
|
127
|
+
/**
|
|
128
|
+
* 当前选中的控件
|
|
129
129
|
* */ _define_property(this, "selected", null);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中的数据作用域控件
|
|
130
|
+
/**
|
|
131
|
+
* 当前选中的数据作用域控件
|
|
132
132
|
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
133
133
|
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
134
|
-
/**
|
|
135
|
-
* 当前选中控件的setting
|
|
134
|
+
/**
|
|
135
|
+
* 当前选中控件的setting
|
|
136
136
|
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
137
137
|
_define_property(this, "selectedInstanceSettingItems", []);
|
|
138
|
-
/**
|
|
139
|
-
* 当前选中控件的数据模型
|
|
138
|
+
/**
|
|
139
|
+
* 当前选中控件的数据模型
|
|
140
140
|
* */ _define_property(this, "selectedFieldItem", null);
|
|
141
|
-
/**
|
|
142
|
-
* 扩展字段,比如appId,dataCode等
|
|
141
|
+
/**
|
|
142
|
+
* 扩展字段,比如appId,dataCode等
|
|
143
143
|
* */ _define_property(this, "external", {});
|
|
144
144
|
_define_property(this, "movingInstance", null);
|
|
145
145
|
_define_property(this, "movingInstanceOldParent", null);
|
|
@@ -155,8 +155,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
155
155
|
_create_class(Store, [
|
|
156
156
|
{
|
|
157
157
|
key: "selectedRules",
|
|
158
|
-
get: /**
|
|
159
|
-
* 当前选中控件的rules
|
|
158
|
+
get: /**
|
|
159
|
+
* 当前选中控件的rules
|
|
160
160
|
* */ function get() {
|
|
161
161
|
if (!this.selected) {
|
|
162
162
|
return null;
|
|
@@ -166,8 +166,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
168
|
key: "selectedAntdRules",
|
|
169
|
-
get: /**
|
|
170
|
-
* 当前选中控件的antd rules
|
|
169
|
+
get: /**
|
|
170
|
+
* 当前选中控件的antd rules
|
|
171
171
|
* */ function get() {
|
|
172
172
|
var rules = this.selectedRules;
|
|
173
173
|
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 = [];
|
package/dist/types/Builder.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ControlDesignerInstance } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
export declare class Builder {
|
|
3
|
-
private designer;
|
|
4
|
-
ListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
5
|
-
ProListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
6
|
-
FormPageBuilder(): ControlDesignerInstance<'data-view'>;
|
|
7
|
-
VuePageBuilder(): ControlDesignerInstance<'grid'>;
|
|
8
|
-
}
|
|
1
|
+
import { ControlDesignerInstance } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
export declare class Builder {
|
|
3
|
+
private designer;
|
|
4
|
+
ListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
5
|
+
ProListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
6
|
+
FormPageBuilder(): ControlDesignerInstance<'data-view'>;
|
|
7
|
+
VuePageBuilder(): ControlDesignerInstance<'grid'>;
|
|
8
|
+
}
|
package/dist/types/Designer.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { ControlDesigner, ControlDesignerInstance, ControlsKeys, RegisterControls, controlHooksEmitter, ControlExport } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
import EventLogic from './EventLogic';
|
|
3
|
-
import { FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
4
|
-
import { toSchema, getModelBindInfoList, checkSchema } from './utils';
|
|
5
|
-
interface ToolboxType {
|
|
6
|
-
key: string;
|
|
7
|
-
title: string;
|
|
8
|
-
children: ControlDesigner<ControlsKeys>[];
|
|
9
|
-
}
|
|
10
|
-
interface DesignerServices {
|
|
11
|
-
getUsersByIds?: (userIds: string[]) => Promise<any>;
|
|
12
|
-
remoteUserByName?: (username: string) => Promise<any>;
|
|
13
|
-
getDeptByIds?: (deptIds: string[]) => Promise<any>;
|
|
14
|
-
remoteDeptByName?: (deptName: string) => Promise<any>;
|
|
15
|
-
getAddress?: (params: any, addressType: string[]) => Promise<any>;
|
|
16
|
-
uploadFile?: (params: any) => Promise<any>;
|
|
17
|
-
}
|
|
18
|
-
export default class Designer<EventKeys extends string = string> extends RegisterControls<'Designer'> {
|
|
19
|
-
static EventLogic: typeof EventLogic;
|
|
20
|
-
toolbox: ToolboxType[];
|
|
21
|
-
readonly services: DesignerServices;
|
|
22
|
-
readonly eventLogic: EventLogic;
|
|
23
|
-
readonly fieldTypes: typeof FieldTypes;
|
|
24
|
-
controlSettingMap: Map<string, ControlExport['Setting']>;
|
|
25
|
-
constructor();
|
|
26
|
-
registerControl(control: ControlExport): void;
|
|
27
|
-
getControlSetting(type: string): any[] | null;
|
|
28
|
-
setInstance(instance: ControlDesignerInstance<ControlsKeys>, props: string, value: unknown): void;
|
|
29
|
-
eachControls(callback: (value: ControlDesigner<ControlsKeys>, index: number, array: ControlDesigner<ControlsKeys>[]) => void): void;
|
|
30
|
-
getInitControl(): ControlDesignerInstance<ControlsKeys>[];
|
|
31
|
-
checkSchema(...args: Parameters<typeof checkSchema>): Promise<ReturnType<typeof checkSchema>>;
|
|
32
|
-
getModelBindInfoList(...args: Parameters<typeof getModelBindInfoList>): ReturnType<typeof getModelBindInfoList>;
|
|
33
|
-
getSchema(...args: Parameters<typeof toSchema>): ReturnType<typeof toSchema>;
|
|
34
|
-
listenControlHook(...args: Parameters<(typeof controlHooksEmitter)['on']>): ReturnType<(typeof controlHooksEmitter)['on']>;
|
|
35
|
-
}
|
|
36
|
-
export { ToolboxType, DesignerServices, Designer };
|
|
1
|
+
import { ControlDesigner, ControlDesignerInstance, ControlsKeys, RegisterControls, controlHooksEmitter, ControlExport } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
import EventLogic from './EventLogic';
|
|
3
|
+
import { FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
4
|
+
import { toSchema, getModelBindInfoList, checkSchema } from './utils';
|
|
5
|
+
interface ToolboxType {
|
|
6
|
+
key: string;
|
|
7
|
+
title: string;
|
|
8
|
+
children: ControlDesigner<ControlsKeys>[];
|
|
9
|
+
}
|
|
10
|
+
interface DesignerServices {
|
|
11
|
+
getUsersByIds?: (userIds: string[]) => Promise<any>;
|
|
12
|
+
remoteUserByName?: (username: string) => Promise<any>;
|
|
13
|
+
getDeptByIds?: (deptIds: string[]) => Promise<any>;
|
|
14
|
+
remoteDeptByName?: (deptName: string) => Promise<any>;
|
|
15
|
+
getAddress?: (params: any, addressType: string[]) => Promise<any>;
|
|
16
|
+
uploadFile?: (params: any) => Promise<any>;
|
|
17
|
+
}
|
|
18
|
+
export default class Designer<EventKeys extends string = string> extends RegisterControls<'Designer'> {
|
|
19
|
+
static EventLogic: typeof EventLogic;
|
|
20
|
+
toolbox: ToolboxType[];
|
|
21
|
+
readonly services: DesignerServices;
|
|
22
|
+
readonly eventLogic: EventLogic;
|
|
23
|
+
readonly fieldTypes: typeof FieldTypes;
|
|
24
|
+
controlSettingMap: Map<string, ControlExport['Setting']>;
|
|
25
|
+
constructor();
|
|
26
|
+
registerControl(control: ControlExport): void;
|
|
27
|
+
getControlSetting(type: string): any[] | null;
|
|
28
|
+
setInstance(instance: ControlDesignerInstance<ControlsKeys>, props: string, value: unknown): void;
|
|
29
|
+
eachControls(callback: (value: ControlDesigner<ControlsKeys>, index: number, array: ControlDesigner<ControlsKeys>[]) => void): void;
|
|
30
|
+
getInitControl(): ControlDesignerInstance<ControlsKeys>[];
|
|
31
|
+
checkSchema(...args: Parameters<typeof checkSchema>): Promise<ReturnType<typeof checkSchema>>;
|
|
32
|
+
getModelBindInfoList(...args: Parameters<typeof getModelBindInfoList>): ReturnType<typeof getModelBindInfoList>;
|
|
33
|
+
getSchema(...args: Parameters<typeof toSchema>): ReturnType<typeof toSchema>;
|
|
34
|
+
listenControlHook(...args: Parameters<(typeof controlHooksEmitter)['on']>): ReturnType<(typeof controlHooksEmitter)['on']>;
|
|
35
|
+
}
|
|
36
|
+
export { ToolboxType, DesignerServices, Designer };
|
package/dist/types/Driven.d.ts
CHANGED
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
import { Callback, Watcher } from '@byteluck-fe/model-driven-shared';
|
|
2
|
-
import { Store, StoreOptions } from './Store';
|
|
3
|
-
import { Designer } from './Designer';
|
|
4
|
-
import EventLogic from './EventLogic';
|
|
5
|
-
import { Plugin } from './Plugin';
|
|
6
|
-
import { DesignerControl, ControlDesignerInstance, ControlsKeys, Schema, DeepPartial, Messages, BeforeCreateInstance } from '@byteluck-fe/model-driven-core';
|
|
7
|
-
import { generatePermissions, getModelBindInfoList, toSchema } from './utils';
|
|
8
|
-
import { Settings } from '@byteluck-fe/model-driven-settings';
|
|
9
|
-
type EventKeys = 'before-validate' | 'validated' | 'updated' | 'joined' | 'moved' | 'removed' | 'select' | 'field-changed';
|
|
10
|
-
type SchemaBaseType = Schema<ControlsKeys>;
|
|
11
|
-
interface DrivenOptions {
|
|
12
|
-
autoMount?: boolean;
|
|
13
|
-
plugins?: Plugin[];
|
|
14
|
-
Designer?: typeof Designer;
|
|
15
|
-
mode?: string;
|
|
16
|
-
schema: SchemaBaseType | SchemaBaseType[];
|
|
17
|
-
store?: Omit<StoreOptions, 'instance'>;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* 设计器驱动
|
|
21
|
-
* */
|
|
22
|
-
declare class Driven extends Watcher<EventKeys> {
|
|
23
|
-
/**
|
|
24
|
-
* 控件事件定义
|
|
25
|
-
* */
|
|
26
|
-
static EventLogic: typeof EventLogic;
|
|
27
|
-
readonly mode: string;
|
|
28
|
-
isMounted: boolean;
|
|
29
|
-
id: string;
|
|
30
|
-
/**
|
|
31
|
-
* 控件可选的事件
|
|
32
|
-
* */
|
|
33
|
-
readonly eventLogic: EventLogic;
|
|
34
|
-
/**
|
|
35
|
-
* 处理数据存储,存放模型等
|
|
36
|
-
* */
|
|
37
|
-
store: Store;
|
|
38
|
-
/**
|
|
39
|
-
* 额外参数存储
|
|
40
|
-
*/
|
|
41
|
-
externalParams?: Record<string, any>;
|
|
42
|
-
/**
|
|
43
|
-
* 处理instance,和schema存储
|
|
44
|
-
* */
|
|
45
|
-
private designer;
|
|
46
|
-
/**
|
|
47
|
-
* 插件数组
|
|
48
|
-
* */
|
|
49
|
-
private __plugins;
|
|
50
|
-
private __pluginsApplied;
|
|
51
|
-
private readonly $options;
|
|
52
|
-
constructor(options: DrivenOptions);
|
|
53
|
-
mount(): void;
|
|
54
|
-
use(plugin: Plugin): this;
|
|
55
|
-
private applyPlugins;
|
|
56
|
-
emit(key: EventKeys, ...payload: any[]): Promise<unknown[]>;
|
|
57
|
-
on(key: EventKeys, callback: Callback): void;
|
|
58
|
-
setInstances(schema: DrivenOptions['schema'], beforeCreateInstance?: BeforeCreateInstance): void;
|
|
59
|
-
private beforeSelectInstance;
|
|
60
|
-
private afterSelectInstance;
|
|
61
|
-
private setSelectedInstanceSetting;
|
|
62
|
-
private concatSetting;
|
|
63
|
-
private formatGroupSetting;
|
|
64
|
-
setControlConfig(...args: Parameters<Designer['registerControlConfig']>): Designer<string>;
|
|
65
|
-
getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
|
|
66
|
-
getControlSetting(type: ControlsKeys): Settings;
|
|
67
|
-
selectInstance(instance: DesignerControl | null): void;
|
|
68
|
-
setSelectedFieldItem(fieldItem: Parameters<Store['setSelectedFieldItem']>[0]): void;
|
|
69
|
-
moveStart(instance: DesignerControl | string): void;
|
|
70
|
-
moveEnd(instance?: DesignerControl | string | null): void;
|
|
71
|
-
createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlDesignerInstance<T> | undefined;
|
|
72
|
-
getInstance(instanceId: DesignerControl | string): DesignerControl | undefined;
|
|
73
|
-
getInstances(): DesignerControl[];
|
|
74
|
-
getInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core").ControlDesigner<T>>[];
|
|
75
|
-
getDataScopeInstances(): DesignerControl[];
|
|
76
|
-
getDataScopeInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core").ControlDesigner<T>>[];
|
|
77
|
-
private updateInstancePropValue;
|
|
78
|
-
private updateInstanceProps;
|
|
79
|
-
setInstance<T extends DesignerControl>(instance: T, props: DeepPartial<T['props']>, payload?: any): void;
|
|
80
|
-
setInstance<T extends DesignerControl>(instance: T, propName: string, value: unknown, payload?: any): void;
|
|
81
|
-
/**
|
|
82
|
-
* 删除控件
|
|
83
|
-
* */
|
|
84
|
-
removeInstance(instance: DesignerControl): void;
|
|
85
|
-
replaceInstance(oldInstance: DesignerControl, newInstance: DesignerControl): void;
|
|
86
|
-
/**
|
|
87
|
-
* 修改控件类型
|
|
88
|
-
* */
|
|
89
|
-
updateInstanceType<T extends ControlsKeys>(instance: DesignerControl, type: T): ControlDesignerInstance<T> | undefined;
|
|
90
|
-
validate(messages?: Messages, ignore?: string[]): Promise<boolean>;
|
|
91
|
-
getSchema: typeof toSchema;
|
|
92
|
-
getModelBindInfoList: typeof getModelBindInfoList;
|
|
93
|
-
generatePermissions: typeof generatePermissions;
|
|
94
|
-
getCustomControlsInUse(): string[];
|
|
95
|
-
assertInstanceIsCustomControl(instance: DesignerControl | string): boolean;
|
|
96
|
-
static register(...arg: Parameters<(typeof Designer)['register']>): typeof Driven;
|
|
97
|
-
static judgeControlIsRegistered(control: Parameters<(typeof Designer)['register']>[0]): boolean;
|
|
98
|
-
judgeControlIsRegistered(control: Parameters<(typeof Designer)['register']>[0]): boolean;
|
|
99
|
-
register(...arg: Parameters<(typeof Designer)['register']>): this;
|
|
100
|
-
/**
|
|
101
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
102
|
-
* */
|
|
103
|
-
assertInstance<T extends ControlsKeys>(instance: DesignerControl, types: T | T[]): instance is ControlDesignerInstance<T>;
|
|
104
|
-
/**
|
|
105
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
106
|
-
* */
|
|
107
|
-
getInstanceInListControl(instance: DesignerControl): boolean;
|
|
108
|
-
getInstanceParentControl<T extends ControlsKeys>(instance: DesignerControl, controlType: T): ControlDesignerInstance<T> | undefined;
|
|
109
|
-
private callSelectedEffect;
|
|
110
|
-
private callSelectedScopeEffect;
|
|
111
|
-
}
|
|
112
|
-
export { Driven };
|
|
1
|
+
import { Callback, Watcher } from '@byteluck-fe/model-driven-shared';
|
|
2
|
+
import { Store, StoreOptions } from './Store';
|
|
3
|
+
import { Designer } from './Designer';
|
|
4
|
+
import EventLogic from './EventLogic';
|
|
5
|
+
import { Plugin } from './Plugin';
|
|
6
|
+
import { DesignerControl, ControlDesignerInstance, ControlsKeys, Schema, DeepPartial, Messages, BeforeCreateInstance } from '@byteluck-fe/model-driven-core';
|
|
7
|
+
import { generatePermissions, getModelBindInfoList, toSchema } from './utils';
|
|
8
|
+
import { Settings } from '@byteluck-fe/model-driven-settings';
|
|
9
|
+
type EventKeys = 'before-validate' | 'validated' | 'updated' | 'joined' | 'moved' | 'removed' | 'select' | 'field-changed';
|
|
10
|
+
type SchemaBaseType = Schema<ControlsKeys>;
|
|
11
|
+
interface DrivenOptions {
|
|
12
|
+
autoMount?: boolean;
|
|
13
|
+
plugins?: Plugin[];
|
|
14
|
+
Designer?: typeof Designer;
|
|
15
|
+
mode?: string;
|
|
16
|
+
schema: SchemaBaseType | SchemaBaseType[];
|
|
17
|
+
store?: Omit<StoreOptions, 'instance'>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 设计器驱动
|
|
21
|
+
* */
|
|
22
|
+
declare class Driven extends Watcher<EventKeys> {
|
|
23
|
+
/**
|
|
24
|
+
* 控件事件定义
|
|
25
|
+
* */
|
|
26
|
+
static EventLogic: typeof EventLogic;
|
|
27
|
+
readonly mode: string;
|
|
28
|
+
isMounted: boolean;
|
|
29
|
+
id: string;
|
|
30
|
+
/**
|
|
31
|
+
* 控件可选的事件
|
|
32
|
+
* */
|
|
33
|
+
readonly eventLogic: EventLogic;
|
|
34
|
+
/**
|
|
35
|
+
* 处理数据存储,存放模型等
|
|
36
|
+
* */
|
|
37
|
+
store: Store;
|
|
38
|
+
/**
|
|
39
|
+
* 额外参数存储
|
|
40
|
+
*/
|
|
41
|
+
externalParams?: Record<string, any>;
|
|
42
|
+
/**
|
|
43
|
+
* 处理instance,和schema存储
|
|
44
|
+
* */
|
|
45
|
+
private designer;
|
|
46
|
+
/**
|
|
47
|
+
* 插件数组
|
|
48
|
+
* */
|
|
49
|
+
private __plugins;
|
|
50
|
+
private __pluginsApplied;
|
|
51
|
+
private readonly $options;
|
|
52
|
+
constructor(options: DrivenOptions);
|
|
53
|
+
mount(): void;
|
|
54
|
+
use(plugin: Plugin): this;
|
|
55
|
+
private applyPlugins;
|
|
56
|
+
emit(key: EventKeys, ...payload: any[]): Promise<unknown[]>;
|
|
57
|
+
on(key: EventKeys, callback: Callback): void;
|
|
58
|
+
setInstances(schema: DrivenOptions['schema'], beforeCreateInstance?: BeforeCreateInstance): void;
|
|
59
|
+
private beforeSelectInstance;
|
|
60
|
+
private afterSelectInstance;
|
|
61
|
+
private setSelectedInstanceSetting;
|
|
62
|
+
private concatSetting;
|
|
63
|
+
private formatGroupSetting;
|
|
64
|
+
setControlConfig(...args: Parameters<Designer['registerControlConfig']>): Designer<string>;
|
|
65
|
+
getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
|
|
66
|
+
getControlSetting(type: ControlsKeys): Settings;
|
|
67
|
+
selectInstance(instance: DesignerControl | null): void;
|
|
68
|
+
setSelectedFieldItem(fieldItem: Parameters<Store['setSelectedFieldItem']>[0]): void;
|
|
69
|
+
moveStart(instance: DesignerControl | string): void;
|
|
70
|
+
moveEnd(instance?: DesignerControl | string | null): void;
|
|
71
|
+
createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlDesignerInstance<T> | undefined;
|
|
72
|
+
getInstance(instanceId: DesignerControl | string): DesignerControl | undefined;
|
|
73
|
+
getInstances(): DesignerControl[];
|
|
74
|
+
getInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core").ControlDesigner<T>>[];
|
|
75
|
+
getDataScopeInstances(): DesignerControl[];
|
|
76
|
+
getDataScopeInstancesFromType<T extends ControlsKeys>(type: T): InstanceType<import("@byteluck-fe/model-driven-core").ControlDesigner<T>>[];
|
|
77
|
+
private updateInstancePropValue;
|
|
78
|
+
private updateInstanceProps;
|
|
79
|
+
setInstance<T extends DesignerControl>(instance: T, props: DeepPartial<T['props']>, payload?: any): void;
|
|
80
|
+
setInstance<T extends DesignerControl>(instance: T, propName: string, value: unknown, payload?: any): void;
|
|
81
|
+
/**
|
|
82
|
+
* 删除控件
|
|
83
|
+
* */
|
|
84
|
+
removeInstance(instance: DesignerControl): void;
|
|
85
|
+
replaceInstance(oldInstance: DesignerControl, newInstance: DesignerControl): void;
|
|
86
|
+
/**
|
|
87
|
+
* 修改控件类型
|
|
88
|
+
* */
|
|
89
|
+
updateInstanceType<T extends ControlsKeys>(instance: DesignerControl, type: T): ControlDesignerInstance<T> | undefined;
|
|
90
|
+
validate(messages?: Messages, ignore?: string[]): Promise<boolean>;
|
|
91
|
+
getSchema: typeof toSchema;
|
|
92
|
+
getModelBindInfoList: typeof getModelBindInfoList;
|
|
93
|
+
generatePermissions: typeof generatePermissions;
|
|
94
|
+
getCustomControlsInUse(): string[];
|
|
95
|
+
assertInstanceIsCustomControl(instance: DesignerControl | string): boolean;
|
|
96
|
+
static register(...arg: Parameters<(typeof Designer)['register']>): typeof Driven;
|
|
97
|
+
static judgeControlIsRegistered(control: Parameters<(typeof Designer)['register']>[0]): boolean;
|
|
98
|
+
judgeControlIsRegistered(control: Parameters<(typeof Designer)['register']>[0]): boolean;
|
|
99
|
+
register(...arg: Parameters<(typeof Designer)['register']>): this;
|
|
100
|
+
/**
|
|
101
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
102
|
+
* */
|
|
103
|
+
assertInstance<T extends ControlsKeys>(instance: DesignerControl, types: T | T[]): instance is ControlDesignerInstance<T>;
|
|
104
|
+
/**
|
|
105
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
106
|
+
* */
|
|
107
|
+
getInstanceInListControl(instance: DesignerControl): boolean;
|
|
108
|
+
getInstanceParentControl<T extends ControlsKeys>(instance: DesignerControl, controlType: T): ControlDesignerInstance<T> | undefined;
|
|
109
|
+
private callSelectedEffect;
|
|
110
|
+
private callSelectedScopeEffect;
|
|
111
|
+
}
|
|
112
|
+
export { Driven };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { EventLogic } from '@byteluck-fe/model-driven-shared';
|
|
2
|
-
export default EventLogic;
|
|
1
|
+
import { EventLogic } from '@byteluck-fe/model-driven-shared';
|
|
2
|
+
export default EventLogic;
|
package/dist/types/Plugin.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Driven } from './Driven';
|
|
2
|
-
declare abstract class Plugin {
|
|
3
|
-
abstract pluginName?: string;
|
|
4
|
-
abstract apply(driven: Driven): void;
|
|
5
|
-
}
|
|
6
|
-
export { Plugin };
|
|
1
|
+
import { Driven } from './Driven';
|
|
2
|
+
declare abstract class Plugin {
|
|
3
|
+
abstract pluginName?: string;
|
|
4
|
+
abstract apply(driven: Driven): void;
|
|
5
|
+
}
|
|
6
|
+
export { Plugin };
|
package/dist/types/Store.d.ts
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { DesignerControl, ControlDesignerInstance, DesignerLayoutControl, DesignerListControl } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
import { Rules } from 'async-validator';
|
|
3
|
-
import { Settings, Setting } from '@byteluck-fe/model-driven-settings';
|
|
4
|
-
export interface StoreOptions {
|
|
5
|
-
instance: DesignerControl[];
|
|
6
|
-
getParentBeforeInstanceMove?: (instance: DesignerControl) => DesignerControl | null;
|
|
7
|
-
}
|
|
8
|
-
type DataScopeControl = ControlDesignerInstance<'data-view' | 'subtable' | 'list-view'> | null;
|
|
9
|
-
export declare class Store {
|
|
10
|
-
/**
|
|
11
|
-
* 页面控件实例树
|
|
12
|
-
* */
|
|
13
|
-
instance: DesignerControl[];
|
|
14
|
-
/**
|
|
15
|
-
* 拍平的控件数组
|
|
16
|
-
* */
|
|
17
|
-
flatInstances: DesignerControl[];
|
|
18
|
-
/**
|
|
19
|
-
* 控件id组成的map
|
|
20
|
-
* */
|
|
21
|
-
instanceIdMap: Map<string, DesignerControl>;
|
|
22
|
-
/**
|
|
23
|
-
* dataCode和fieldCode组成的map
|
|
24
|
-
* {
|
|
25
|
-
* [主表dataCode]: {
|
|
26
|
-
* [fieldCode]: 控件
|
|
27
|
-
* },
|
|
28
|
-
* [子表dataCode]: {
|
|
29
|
-
* [fieldCode]: 控件
|
|
30
|
-
* }
|
|
31
|
-
* }
|
|
32
|
-
* */
|
|
33
|
-
dataFieldCodeMap: Map<string, Map<string, DesignerControl>>;
|
|
34
|
-
/**
|
|
35
|
-
* 当前选中的控件
|
|
36
|
-
* */
|
|
37
|
-
selected: DesignerControl | null;
|
|
38
|
-
/**
|
|
39
|
-
* 当前选中的数据作用域控件
|
|
40
|
-
* */
|
|
41
|
-
selectedInstanceDataScopeParent: DataScopeControl;
|
|
42
|
-
selectedDataScopeFlatInstances: DesignerControl[];
|
|
43
|
-
/**
|
|
44
|
-
* 当前选中控件的setting
|
|
45
|
-
* */
|
|
46
|
-
selectedInstanceSetting: Settings;
|
|
47
|
-
selectedInstanceSettingItems: Setting[];
|
|
48
|
-
/**
|
|
49
|
-
* 当前选中控件的数据模型
|
|
50
|
-
* */
|
|
51
|
-
selectedFieldItem: any;
|
|
52
|
-
/**
|
|
53
|
-
* 扩展字段,比如appId,dataCode等
|
|
54
|
-
* */
|
|
55
|
-
external: Record<string, any>;
|
|
56
|
-
movingInstance: DesignerControl | null;
|
|
57
|
-
movingInstanceOldParent: DesignerControl | null;
|
|
58
|
-
movingInstanceOldDataScopeParent: DataScopeControl;
|
|
59
|
-
private readonly getParentBeforeInstanceMove;
|
|
60
|
-
constructor(options: StoreOptions);
|
|
61
|
-
/**
|
|
62
|
-
* 当前选中控件的rules
|
|
63
|
-
* */
|
|
64
|
-
get selectedRules(): Rules | null;
|
|
65
|
-
/**
|
|
66
|
-
* 当前选中控件的antd rules
|
|
67
|
-
* */
|
|
68
|
-
get selectedAntdRules(): Rules | null;
|
|
69
|
-
setInstances(instances: DesignerControl[]): void;
|
|
70
|
-
setSelectInstance(instance: DesignerControl | null): void;
|
|
71
|
-
setSelectInstanceSettings(settings: Settings): void;
|
|
72
|
-
private getSettingItems;
|
|
73
|
-
setSelectedFieldItem(fieldItem: Record<string, any> | null): void;
|
|
74
|
-
setMovingInstance(instance: DesignerControl | null): void;
|
|
75
|
-
updateDataFieldCodeMap(instance: DesignerControl): void;
|
|
76
|
-
getFlatInstances(): void;
|
|
77
|
-
}
|
|
78
|
-
export declare function loop(instances: DesignerControl[] | DesignerControl, callback: (instance: DesignerControl) => void): void;
|
|
79
|
-
export declare function isDataScopeInstance(instance: DesignerControl): instance is Exclude<DataScopeControl, null>;
|
|
80
|
-
export declare function findInstanceDataScopeParent(instance: DesignerControl | null): any;
|
|
81
|
-
export declare function getDataScopeFlatInstances(dataScopeInstance: DesignerLayoutControl | DesignerListControl): DesignerControl[];
|
|
82
|
-
export {};
|
|
1
|
+
import { DesignerControl, ControlDesignerInstance, DesignerLayoutControl, DesignerListControl } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
import { Rules } from 'async-validator';
|
|
3
|
+
import { Settings, Setting } from '@byteluck-fe/model-driven-settings';
|
|
4
|
+
export interface StoreOptions {
|
|
5
|
+
instance: DesignerControl[];
|
|
6
|
+
getParentBeforeInstanceMove?: (instance: DesignerControl) => DesignerControl | null;
|
|
7
|
+
}
|
|
8
|
+
type DataScopeControl = ControlDesignerInstance<'data-view' | 'subtable' | 'list-view'> | null;
|
|
9
|
+
export declare class Store {
|
|
10
|
+
/**
|
|
11
|
+
* 页面控件实例树
|
|
12
|
+
* */
|
|
13
|
+
instance: DesignerControl[];
|
|
14
|
+
/**
|
|
15
|
+
* 拍平的控件数组
|
|
16
|
+
* */
|
|
17
|
+
flatInstances: DesignerControl[];
|
|
18
|
+
/**
|
|
19
|
+
* 控件id组成的map
|
|
20
|
+
* */
|
|
21
|
+
instanceIdMap: Map<string, DesignerControl>;
|
|
22
|
+
/**
|
|
23
|
+
* dataCode和fieldCode组成的map
|
|
24
|
+
* {
|
|
25
|
+
* [主表dataCode]: {
|
|
26
|
+
* [fieldCode]: 控件
|
|
27
|
+
* },
|
|
28
|
+
* [子表dataCode]: {
|
|
29
|
+
* [fieldCode]: 控件
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
* */
|
|
33
|
+
dataFieldCodeMap: Map<string, Map<string, DesignerControl>>;
|
|
34
|
+
/**
|
|
35
|
+
* 当前选中的控件
|
|
36
|
+
* */
|
|
37
|
+
selected: DesignerControl | null;
|
|
38
|
+
/**
|
|
39
|
+
* 当前选中的数据作用域控件
|
|
40
|
+
* */
|
|
41
|
+
selectedInstanceDataScopeParent: DataScopeControl;
|
|
42
|
+
selectedDataScopeFlatInstances: DesignerControl[];
|
|
43
|
+
/**
|
|
44
|
+
* 当前选中控件的setting
|
|
45
|
+
* */
|
|
46
|
+
selectedInstanceSetting: Settings;
|
|
47
|
+
selectedInstanceSettingItems: Setting[];
|
|
48
|
+
/**
|
|
49
|
+
* 当前选中控件的数据模型
|
|
50
|
+
* */
|
|
51
|
+
selectedFieldItem: any;
|
|
52
|
+
/**
|
|
53
|
+
* 扩展字段,比如appId,dataCode等
|
|
54
|
+
* */
|
|
55
|
+
external: Record<string, any>;
|
|
56
|
+
movingInstance: DesignerControl | null;
|
|
57
|
+
movingInstanceOldParent: DesignerControl | null;
|
|
58
|
+
movingInstanceOldDataScopeParent: DataScopeControl;
|
|
59
|
+
private readonly getParentBeforeInstanceMove;
|
|
60
|
+
constructor(options: StoreOptions);
|
|
61
|
+
/**
|
|
62
|
+
* 当前选中控件的rules
|
|
63
|
+
* */
|
|
64
|
+
get selectedRules(): Rules | null;
|
|
65
|
+
/**
|
|
66
|
+
* 当前选中控件的antd rules
|
|
67
|
+
* */
|
|
68
|
+
get selectedAntdRules(): Rules | null;
|
|
69
|
+
setInstances(instances: DesignerControl[]): void;
|
|
70
|
+
setSelectInstance(instance: DesignerControl | null): void;
|
|
71
|
+
setSelectInstanceSettings(settings: Settings): void;
|
|
72
|
+
private getSettingItems;
|
|
73
|
+
setSelectedFieldItem(fieldItem: Record<string, any> | null): void;
|
|
74
|
+
setMovingInstance(instance: DesignerControl | null): void;
|
|
75
|
+
updateDataFieldCodeMap(instance: DesignerControl): void;
|
|
76
|
+
getFlatInstances(): void;
|
|
77
|
+
}
|
|
78
|
+
export declare function loop(instances: DesignerControl[] | DesignerControl, callback: (instance: DesignerControl) => void): void;
|
|
79
|
+
export declare function isDataScopeInstance(instance: DesignerControl): instance is Exclude<DataScopeControl, null>;
|
|
80
|
+
export declare function findInstanceDataScopeParent(instance: DesignerControl | null): any;
|
|
81
|
+
export declare function getDataScopeFlatInstances(dataScopeInstance: DesignerLayoutControl | DesignerListControl): DesignerControl[];
|
|
82
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
2
|
-
export declare const objectDataBindControlTypes: CONTROL_TYPE[];
|
|
3
|
-
export declare const objectDataBindKeyToFieldType: Record<string, {
|
|
4
|
-
caption: string;
|
|
5
|
-
fieldType: FieldTypes;
|
|
6
|
-
}>;
|
|
1
|
+
import { CONTROL_TYPE, FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
2
|
+
export declare const objectDataBindControlTypes: CONTROL_TYPE[];
|
|
3
|
+
export declare const objectDataBindKeyToFieldType: Record<string, {
|
|
4
|
+
caption: string;
|
|
5
|
+
fieldType: FieldTypes;
|
|
6
|
+
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ControlsKeys, ControlDesignerInstance, DesignerFormControl, DesignerLayoutControl, DesignerControl, DesignerListControl, DesignerSearchControl, DesignerWrapControl } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
export declare function hasChildrenControl(instance: DesignerControl): instance is DesignerLayoutControl | DesignerSearchControl | DesignerWrapControl;
|
|
3
|
-
export declare function hasHeaderControl(instance: DesignerControl): instance is DesignerListControl;
|
|
4
|
-
export declare function loopFormControl(control: ControlDesignerInstance<ControlsKeys>[], callback: (item: DesignerFormControl | ControlDesignerInstance<'subtable'>, children?: DesignerFormControl[]) => any): void;
|
|
1
|
+
import { ControlsKeys, ControlDesignerInstance, DesignerFormControl, DesignerLayoutControl, DesignerControl, DesignerListControl, DesignerSearchControl, DesignerWrapControl } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
export declare function hasChildrenControl(instance: DesignerControl): instance is DesignerLayoutControl | DesignerSearchControl | DesignerWrapControl;
|
|
3
|
+
export declare function hasHeaderControl(instance: DesignerControl): instance is DesignerListControl;
|
|
4
|
+
export declare function loopFormControl(control: ControlDesignerInstance<ControlsKeys>[], callback: (item: DesignerFormControl | ControlDesignerInstance<'subtable'>, children?: DesignerFormControl[]) => any): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import Designer, { ToolboxType, DesignerServices } from './Designer';
|
|
2
|
-
export type { ToolboxType, DesignerServices };
|
|
3
|
-
export { Designer };
|
|
4
|
-
export * from './utils';
|
|
5
|
-
export * from './Builder';
|
|
6
|
-
export * from './designerUtils';
|
|
7
|
-
export * from './Driven';
|
|
8
|
-
export * from './Store';
|
|
1
|
+
import Designer, { ToolboxType, DesignerServices } from './Designer';
|
|
2
|
+
export type { ToolboxType, DesignerServices };
|
|
3
|
+
export { Designer };
|
|
4
|
+
export * from './utils';
|
|
5
|
+
export * from './Builder';
|
|
6
|
+
export * from './designerUtils';
|
|
7
|
+
export * from './Driven';
|
|
8
|
+
export * from './Store';
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { Schema, ControlsKeys, ColumnControlsKeys, DataBindModelType, ControlDesignerInstance, DesignerColumnControl, DesignerControl, DesignerFormControl, Messages } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
import { FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
3
|
-
export declare function getMasterFormControls(controls: DesignerControl[]): DesignerFormControl[];
|
|
4
|
-
/**
|
|
5
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
6
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
7
|
-
* */
|
|
8
|
-
export declare function fillModelBindInfoListFieldCode(modelBindInfoList: DataBindModelType[], dataCode?: string): DataBindModelType[];
|
|
9
|
-
/**
|
|
10
|
-
* @description 通过fieldType获取列表表头的type
|
|
11
|
-
* */
|
|
12
|
-
export declare function getColumnTypeFromFiledType(fieldType: string): ColumnControlsKeys | undefined;
|
|
13
|
-
/**
|
|
14
|
-
* @description 通过modelBindInfoList生成多个columns
|
|
15
|
-
* */
|
|
16
|
-
export declare function getColumnsFromModelBindInfoList(modelBindInfoList: DataBindModelType[]): DesignerColumnControl[];
|
|
17
|
-
/**
|
|
18
|
-
* @description 通过fieldType获取列实例
|
|
19
|
-
* */
|
|
20
|
-
export declare function getColumnsFromFiledType(fieldTypes: FieldTypes[]): ControlDesignerInstance<ColumnControlsKeys>[];
|
|
21
|
-
export declare function getColumnsFromFiledType(fieldType: FieldTypes): ControlDesignerInstance<ColumnControlsKeys>;
|
|
22
|
-
/**
|
|
23
|
-
* @description 将控件实例转换为schema
|
|
24
|
-
* */
|
|
25
|
-
declare function toSchema<T extends ControlsKeys>(instance: DesignerControl): Schema<T>;
|
|
26
|
-
declare function toSchema<T extends ControlsKeys>(instances: DesignerControl[]): Schema<T>[];
|
|
27
|
-
declare function getModelBindInfoList(controls: DesignerControl[] | DesignerControl): DataBindModelType | DataBindModelType[] | undefined;
|
|
28
|
-
declare function checkSchema(controls: DesignerControl[] | DesignerControl, messages?: Messages, ignore?: string[]): Promise<boolean>;
|
|
29
|
-
interface PermissionItem {
|
|
30
|
-
controlId: string;
|
|
31
|
-
caption: string;
|
|
32
|
-
type: string;
|
|
33
|
-
controlType: string;
|
|
34
|
-
/**
|
|
35
|
-
* 是否可编辑
|
|
36
|
-
* */
|
|
37
|
-
canEdit: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* 是否可查看
|
|
40
|
-
* */
|
|
41
|
-
canRead: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* 是否可隐藏
|
|
44
|
-
* */
|
|
45
|
-
canHide: boolean;
|
|
46
|
-
parentId: string | null;
|
|
47
|
-
/**
|
|
48
|
-
* 在表单、列表授权时将权限分组显示
|
|
49
|
-
* element = 元素分组权限 = 除了绑定字段的控件都是这种类型
|
|
50
|
-
* field = 字段分组权限 = 绑了字段的控件类型
|
|
51
|
-
*/
|
|
52
|
-
group: 'element' | 'field';
|
|
53
|
-
}
|
|
54
|
-
declare function generatePermissions(controls: DesignerControl[] | DesignerControl, parent?: PermissionItem): PermissionItem[];
|
|
55
|
-
export { toSchema, getModelBindInfoList, checkSchema, generatePermissions };
|
|
1
|
+
import { Schema, ControlsKeys, ColumnControlsKeys, DataBindModelType, ControlDesignerInstance, DesignerColumnControl, DesignerControl, DesignerFormControl, Messages } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
import { FieldTypes } from '@byteluck-fe/model-driven-shared';
|
|
3
|
+
export declare function getMasterFormControls(controls: DesignerControl[]): DesignerFormControl[];
|
|
4
|
+
/**
|
|
5
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
6
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
7
|
+
* */
|
|
8
|
+
export declare function fillModelBindInfoListFieldCode(modelBindInfoList: DataBindModelType[], dataCode?: string): DataBindModelType[];
|
|
9
|
+
/**
|
|
10
|
+
* @description 通过fieldType获取列表表头的type
|
|
11
|
+
* */
|
|
12
|
+
export declare function getColumnTypeFromFiledType(fieldType: string): ColumnControlsKeys | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* @description 通过modelBindInfoList生成多个columns
|
|
15
|
+
* */
|
|
16
|
+
export declare function getColumnsFromModelBindInfoList(modelBindInfoList: DataBindModelType[]): DesignerColumnControl[];
|
|
17
|
+
/**
|
|
18
|
+
* @description 通过fieldType获取列实例
|
|
19
|
+
* */
|
|
20
|
+
export declare function getColumnsFromFiledType(fieldTypes: FieldTypes[]): ControlDesignerInstance<ColumnControlsKeys>[];
|
|
21
|
+
export declare function getColumnsFromFiledType(fieldType: FieldTypes): ControlDesignerInstance<ColumnControlsKeys>;
|
|
22
|
+
/**
|
|
23
|
+
* @description 将控件实例转换为schema
|
|
24
|
+
* */
|
|
25
|
+
declare function toSchema<T extends ControlsKeys>(instance: DesignerControl): Schema<T>;
|
|
26
|
+
declare function toSchema<T extends ControlsKeys>(instances: DesignerControl[]): Schema<T>[];
|
|
27
|
+
declare function getModelBindInfoList(controls: DesignerControl[] | DesignerControl): DataBindModelType | DataBindModelType[] | undefined;
|
|
28
|
+
declare function checkSchema(controls: DesignerControl[] | DesignerControl, messages?: Messages, ignore?: string[]): Promise<boolean>;
|
|
29
|
+
interface PermissionItem {
|
|
30
|
+
controlId: string;
|
|
31
|
+
caption: string;
|
|
32
|
+
type: string;
|
|
33
|
+
controlType: string;
|
|
34
|
+
/**
|
|
35
|
+
* 是否可编辑
|
|
36
|
+
* */
|
|
37
|
+
canEdit: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 是否可查看
|
|
40
|
+
* */
|
|
41
|
+
canRead: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 是否可隐藏
|
|
44
|
+
* */
|
|
45
|
+
canHide: boolean;
|
|
46
|
+
parentId: string | null;
|
|
47
|
+
/**
|
|
48
|
+
* 在表单、列表授权时将权限分组显示
|
|
49
|
+
* element = 元素分组权限 = 除了绑定字段的控件都是这种类型
|
|
50
|
+
* field = 字段分组权限 = 绑了字段的控件类型
|
|
51
|
+
*/
|
|
52
|
+
group: 'element' | 'field';
|
|
53
|
+
}
|
|
54
|
+
declare function generatePermissions(controls: DesignerControl[] | DesignerControl, parent?: PermissionItem): PermissionItem[];
|
|
55
|
+
export { toSchema, getModelBindInfoList, checkSchema, generatePermissions };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byteluck-fe/model-driven-driven",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.8",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "郝晨光 <2293885211@qq.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"postpublish": "node ../../scripts/postpublish.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@byteluck-fe/model-driven-controls": "2.5.
|
|
29
|
+
"@byteluck-fe/model-driven-controls": "2.5.8",
|
|
30
30
|
"@byteluck-fe/model-driven-core": "2.5.3",
|
|
31
31
|
"@byteluck-fe/model-driven-settings": "2.5.3",
|
|
32
32
|
"@byteluck-fe/model-driven-shared": "2.5.3"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "f6110d56a16cc6652f820c2be3b4314df38c00bf"
|
|
35
35
|
}
|