@byteluck-fe/model-driven-driven 4.35.0-lx5 → 4.36.0-lx1
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 +5 -5
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +55 -55
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Driven
|
|
2
|
-
设计态引擎
|
|
3
|
-
|
|
4
|
-
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
-
constants.ts // 常量
|
|
6
|
-
Designer.ts // 旧版designer的实现
|
|
7
|
-
designerUtils.ts // 工具函数
|
|
8
|
-
Driven.ts // 引擎
|
|
9
|
-
EventLogic.ts // 事件管理
|
|
10
|
-
index.ts
|
|
11
|
-
Plugin.ts // 插件
|
|
12
|
-
Store.ts // 仓库
|
|
13
|
-
utils.ts // 工具
|
|
1
|
+
# Driven
|
|
2
|
+
设计态引擎
|
|
3
|
+
|
|
4
|
+
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
+
constants.ts // 常量
|
|
6
|
+
Designer.ts // 旧版designer的实现
|
|
7
|
+
designerUtils.ts // 工具函数
|
|
8
|
+
Driven.ts // 引擎
|
|
9
|
+
EventLogic.ts // 事件管理
|
|
10
|
+
index.ts
|
|
11
|
+
Plugin.ts // 插件
|
|
12
|
+
Store.ts // 仓库
|
|
13
|
+
utils.ts // 工具
|
package/dist/esm/Driven.js
CHANGED
|
@@ -188,24 +188,24 @@ import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from
|
|
|
188
188
|
import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
|
|
189
189
|
// 当前正在注册的插件名称
|
|
190
190
|
var applyingPluginName = '';
|
|
191
|
-
/**
|
|
192
|
-
* 设计器驱动
|
|
191
|
+
/**
|
|
192
|
+
* 设计器驱动
|
|
193
193
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
194
194
|
"use strict";
|
|
195
195
|
_inherits(Driven, Watcher);
|
|
196
196
|
function Driven(options) {
|
|
197
197
|
_class_call_check(this, Driven);
|
|
198
198
|
var _this;
|
|
199
|
-
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
200
|
-
* 控件可选的事件
|
|
201
|
-
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
202
|
-
* 处理数据存储,存放模型等
|
|
203
|
-
* */ _define_property(_this, "store", void 0), /**
|
|
204
|
-
* 额外参数存储
|
|
205
|
-
*/ _define_property(_this, "externalParams", void 0), /**
|
|
206
|
-
* 处理instance,和schema存储
|
|
207
|
-
* */ _define_property(_this, "designer", void 0), /**
|
|
208
|
-
* 插件数组
|
|
199
|
+
_this = _call_super(this, Driven), _define_property(_this, "mode", void 0), _define_property(_this, "isMounted", false), _define_property(_this, "id", genNonDuplicateId(8)), /**
|
|
200
|
+
* 控件可选的事件
|
|
201
|
+
* */ _define_property(_this, "eventLogic", void 0), /**
|
|
202
|
+
* 处理数据存储,存放模型等
|
|
203
|
+
* */ _define_property(_this, "store", void 0), /**
|
|
204
|
+
* 额外参数存储
|
|
205
|
+
*/ _define_property(_this, "externalParams", void 0), /**
|
|
206
|
+
* 处理instance,和schema存储
|
|
207
|
+
* */ _define_property(_this, "designer", void 0), /**
|
|
208
|
+
* 插件数组
|
|
209
209
|
* */ _define_property(_this, "__plugins", void 0), _define_property(_this, "__pluginsApplied", false), _define_property(_this, "$options", void 0), // TODO 拿到schema
|
|
210
210
|
_define_property(_this, "getSchema", toSchema), // TODO 拿到model_bind_info_list
|
|
211
211
|
_define_property(_this, "getModelBindInfoList", getModelBindInfoList), // TODO 拿到permission_controls
|
|
@@ -473,10 +473,10 @@ var applyingPluginName = '';
|
|
|
473
473
|
if (instance === null) return;
|
|
474
474
|
var _instance = this.getInstance(instance);
|
|
475
475
|
if (!_instance) return;
|
|
476
|
-
/*
|
|
477
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
478
|
-
事件是否区分move和add
|
|
479
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
476
|
+
/*
|
|
477
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
478
|
+
事件是否区分move和add
|
|
479
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
480
480
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
481
481
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
482
482
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -601,8 +601,8 @@ var applyingPluginName = '';
|
|
|
601
601
|
},
|
|
602
602
|
{
|
|
603
603
|
key: "removeInstance",
|
|
604
|
-
value: /**
|
|
605
|
-
* 删除控件
|
|
604
|
+
value: /**
|
|
605
|
+
* 删除控件
|
|
606
606
|
* */ function removeInstance(instance) {
|
|
607
607
|
// 删除实例,并触发事件 removed
|
|
608
608
|
var parent = instance.parent;
|
|
@@ -641,8 +641,8 @@ var applyingPluginName = '';
|
|
|
641
641
|
},
|
|
642
642
|
{
|
|
643
643
|
key: "updateInstanceType",
|
|
644
|
-
value: /**
|
|
645
|
-
* 修改控件类型
|
|
644
|
+
value: /**
|
|
645
|
+
* 修改控件类型
|
|
646
646
|
* */ function updateInstanceType(instance, type) {
|
|
647
647
|
var schema = instance.toSchema();
|
|
648
648
|
var newInstance = this.createInstance(type, {
|
|
@@ -700,16 +700,16 @@ var applyingPluginName = '';
|
|
|
700
700
|
},
|
|
701
701
|
{
|
|
702
702
|
key: "assertInstance",
|
|
703
|
-
value: /**
|
|
704
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
703
|
+
value: /**
|
|
704
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
705
705
|
* */ function assertInstance(instance, types) {
|
|
706
706
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
707
707
|
}
|
|
708
708
|
},
|
|
709
709
|
{
|
|
710
710
|
key: "getInstanceInListControl",
|
|
711
|
-
value: /**
|
|
712
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
711
|
+
value: /**
|
|
712
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
713
713
|
* */ function getInstanceInListControl(instance) {
|
|
714
714
|
var _instance = instance;
|
|
715
715
|
while(_instance){
|
|
@@ -780,7 +780,7 @@ var applyingPluginName = '';
|
|
|
780
780
|
]);
|
|
781
781
|
return Driven;
|
|
782
782
|
}(Watcher);
|
|
783
|
-
/**
|
|
784
|
-
* 控件事件定义
|
|
783
|
+
/**
|
|
784
|
+
* 控件事件定义
|
|
785
785
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
786
786
|
export { Driven };
|
package/dist/esm/Store.js
CHANGED
|
@@ -96,42 +96,42 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
96
96
|
"use strict";
|
|
97
97
|
function Store(options) {
|
|
98
98
|
_class_call_check(this, Store);
|
|
99
|
-
/**
|
|
100
|
-
* 页面控件实例树
|
|
99
|
+
/**
|
|
100
|
+
* 页面控件实例树
|
|
101
101
|
* */ _define_property(this, "instance", void 0);
|
|
102
|
-
/**
|
|
103
|
-
* 拍平的控件数组
|
|
102
|
+
/**
|
|
103
|
+
* 拍平的控件数组
|
|
104
104
|
* */ _define_property(this, "flatInstances", void 0);
|
|
105
|
-
/**
|
|
106
|
-
* 控件id组成的map
|
|
105
|
+
/**
|
|
106
|
+
* 控件id组成的map
|
|
107
107
|
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
|
-
/**
|
|
109
|
-
* dataCode和fieldCode组成的map
|
|
110
|
-
* {
|
|
111
|
-
* [主表dataCode]: {
|
|
112
|
-
* [fieldCode]: 控件
|
|
113
|
-
* },
|
|
114
|
-
* [子表dataCode]: {
|
|
115
|
-
* [fieldCode]: 控件
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
108
|
+
/**
|
|
109
|
+
* dataCode和fieldCode组成的map
|
|
110
|
+
* {
|
|
111
|
+
* [主表dataCode]: {
|
|
112
|
+
* [fieldCode]: 控件
|
|
113
|
+
* },
|
|
114
|
+
* [子表dataCode]: {
|
|
115
|
+
* [fieldCode]: 控件
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
118
|
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
|
-
/**
|
|
120
|
-
* 当前选中的控件
|
|
119
|
+
/**
|
|
120
|
+
* 当前选中的控件
|
|
121
121
|
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
122
|
+
/**
|
|
123
|
+
* 当前选中的数据作用域控件
|
|
124
124
|
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
125
|
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
126
|
+
/**
|
|
127
|
+
* 当前选中控件的setting
|
|
128
128
|
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
129
|
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
130
|
+
/**
|
|
131
|
+
* 当前选中控件的数据模型
|
|
132
132
|
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
133
|
+
/**
|
|
134
|
+
* 扩展字段,比如appId,dataCode等
|
|
135
135
|
* */ _define_property(this, "external", {});
|
|
136
136
|
_define_property(this, "movingInstance", null);
|
|
137
137
|
_define_property(this, "movingInstanceOldParent", null);
|
|
@@ -147,8 +147,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
147
147
|
_create_class(Store, [
|
|
148
148
|
{
|
|
149
149
|
key: "selectedRules",
|
|
150
|
-
get: /**
|
|
151
|
-
* 当前选中控件的rules
|
|
150
|
+
get: /**
|
|
151
|
+
* 当前选中控件的rules
|
|
152
152
|
* */ function get() {
|
|
153
153
|
if (!this.selected) {
|
|
154
154
|
return null;
|
|
@@ -158,8 +158,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
key: "selectedAntdRules",
|
|
161
|
-
get: /**
|
|
162
|
-
* 当前选中控件的antd rules
|
|
161
|
+
get: /**
|
|
162
|
+
* 当前选中控件的antd rules
|
|
163
163
|
* */ function get() {
|
|
164
164
|
var rules = this.selectedRules;
|
|
165
165
|
if (!rules) {
|
package/dist/esm/utils.js
CHANGED
|
@@ -191,9 +191,9 @@ export function getMasterFormControls(controls) {
|
|
|
191
191
|
});
|
|
192
192
|
return formctls;
|
|
193
193
|
}
|
|
194
|
-
/**
|
|
195
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
196
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
194
|
+
/**
|
|
195
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
196
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
197
197
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
198
198
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
199
199
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
|
@@ -225,13 +225,13 @@ function fieldCodeBeforeAddPrefix(fieldCode) {
|
|
|
225
225
|
}
|
|
226
226
|
return prefix + fieldCode;
|
|
227
227
|
}
|
|
228
|
-
/**
|
|
229
|
-
* @description 通过fieldType获取列表表头的type
|
|
228
|
+
/**
|
|
229
|
+
* @description 通过fieldType获取列表表头的type
|
|
230
230
|
* */ export function getColumnTypeFromFiledType(fieldType) {
|
|
231
231
|
return FieldTypeToColumnType[fieldType];
|
|
232
232
|
}
|
|
233
|
-
/**
|
|
234
|
-
* @description 通过modelBindInfoList生成多个columns
|
|
233
|
+
/**
|
|
234
|
+
* @description 通过modelBindInfoList生成多个columns
|
|
235
235
|
* */ export function getColumnsFromModelBindInfoList(modelBindInfoList) {
|
|
236
236
|
var designer = new Designer();
|
|
237
237
|
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,5 +1,5 @@
|
|
|
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 hasFooterControl(instance: DesignerControl): instance is DesignerListControl;
|
|
5
|
-
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 hasFooterControl(instance: DesignerControl): instance is DesignerListControl;
|
|
5
|
+
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": "4.
|
|
3
|
+
"version": "4.36.0-lx1",
|
|
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": "4.
|
|
30
|
-
"@byteluck-fe/model-driven-core": "4.
|
|
31
|
-
"@byteluck-fe/model-driven-settings": "4.
|
|
29
|
+
"@byteluck-fe/model-driven-controls": "4.36.0-lx1",
|
|
30
|
+
"@byteluck-fe/model-driven-core": "4.36.0-lx1",
|
|
31
|
+
"@byteluck-fe/model-driven-settings": "4.36.0-lx1",
|
|
32
32
|
"@byteluck-fe/model-driven-shared": "2.9.1-beta.1"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "e025fedefd536dab28b2d153831869d6ec5b4645"
|
|
35
35
|
}
|