@byteluck-fe/model-driven-driven 2.23.0-beta.0 → 2.23.0-beta.1
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 +3 -3
- package/dist/types/Builder.d.ts +9 -9
- package/dist/types/Designer.d.ts +36 -36
- package/dist/types/Driven.d.ts +112 -112
- package/dist/types/EventLogic.d.ts +2 -2
- package/dist/types/Plugin.d.ts +6 -6
- package/dist/types/Store.d.ts +82 -82
- package/dist/types/constants.d.ts +6 -6
- package/dist/types/designerUtils.d.ts +4 -4
- package/dist/types/index.d.ts +8 -8
- package/dist/types/utils.d.ts +41 -41
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
# Driven
|
|
2
|
-
设计态引擎
|
|
3
|
-
|
|
4
|
-
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
-
constants.ts // 常量
|
|
6
|
-
Designer.ts // 旧版designer的实现
|
|
7
|
-
designerUtils.ts // 工具函数
|
|
8
|
-
Driven.ts // 引擎
|
|
9
|
-
EventLogic.ts // 事件管理
|
|
10
|
-
index.ts
|
|
11
|
-
Plugin.ts // 插件
|
|
12
|
-
Store.ts // 仓库
|
|
13
|
-
utils.ts // 工具
|
|
1
|
+
# Driven
|
|
2
|
+
设计态引擎
|
|
3
|
+
|
|
4
|
+
Builder.ts // 兼容旧版Designer,提供页面初始化
|
|
5
|
+
constants.ts // 常量
|
|
6
|
+
Designer.ts // 旧版designer的实现
|
|
7
|
+
designerUtils.ts // 工具函数
|
|
8
|
+
Driven.ts // 引擎
|
|
9
|
+
EventLogic.ts // 事件管理
|
|
10
|
+
index.ts
|
|
11
|
+
Plugin.ts // 插件
|
|
12
|
+
Store.ts // 仓库
|
|
13
|
+
utils.ts // 工具
|
package/dist/esm/Driven.js
CHANGED
|
@@ -200,8 +200,8 @@ import { checkSchema, generatePermissions, getModelBindInfoList, toSchema } from
|
|
|
200
200
|
import { Group, initSettings, Tab } from '@byteluck-fe/model-driven-settings';
|
|
201
201
|
// 当前正在注册的插件名称
|
|
202
202
|
var applyingPluginName = '';
|
|
203
|
-
/**
|
|
204
|
-
* 设计器驱动
|
|
203
|
+
/**
|
|
204
|
+
* 设计器驱动
|
|
205
205
|
* */ var Driven = /*#__PURE__*/ function(Watcher) {
|
|
206
206
|
"use strict";
|
|
207
207
|
_inherits(Driven, Watcher);
|
|
@@ -213,20 +213,20 @@ var applyingPluginName = '';
|
|
|
213
213
|
_define_property(_assert_this_initialized(_this), "mode", void 0);
|
|
214
214
|
_define_property(_assert_this_initialized(_this), "isMounted", false);
|
|
215
215
|
_define_property(_assert_this_initialized(_this), "id", genNonDuplicateId(8));
|
|
216
|
-
/**
|
|
217
|
-
* 控件可选的事件
|
|
216
|
+
/**
|
|
217
|
+
* 控件可选的事件
|
|
218
218
|
* */ _define_property(_assert_this_initialized(_this), "eventLogic", void 0);
|
|
219
|
-
/**
|
|
220
|
-
* 处理数据存储,存放模型等
|
|
219
|
+
/**
|
|
220
|
+
* 处理数据存储,存放模型等
|
|
221
221
|
* */ _define_property(_assert_this_initialized(_this), "store", void 0);
|
|
222
|
-
/**
|
|
223
|
-
* 额外参数存储
|
|
222
|
+
/**
|
|
223
|
+
* 额外参数存储
|
|
224
224
|
*/ _define_property(_assert_this_initialized(_this), "externalParams", void 0);
|
|
225
|
-
/**
|
|
226
|
-
* 处理instance,和schema存储
|
|
225
|
+
/**
|
|
226
|
+
* 处理instance,和schema存储
|
|
227
227
|
* */ _define_property(_assert_this_initialized(_this), "designer", void 0);
|
|
228
|
-
/**
|
|
229
|
-
* 插件数组
|
|
228
|
+
/**
|
|
229
|
+
* 插件数组
|
|
230
230
|
* */ _define_property(_assert_this_initialized(_this), "__plugins", void 0);
|
|
231
231
|
_define_property(_assert_this_initialized(_this), "__pluginsApplied", false);
|
|
232
232
|
_define_property(_assert_this_initialized(_this), "$options", void 0);
|
|
@@ -499,10 +499,10 @@ var applyingPluginName = '';
|
|
|
499
499
|
if (instance === null) return;
|
|
500
500
|
var _instance = this.getInstance(instance);
|
|
501
501
|
if (!_instance) return;
|
|
502
|
-
/*
|
|
503
|
-
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
504
|
-
事件是否区分move和add
|
|
505
|
-
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
502
|
+
/*
|
|
503
|
+
移动之后,拿到控件新的位置,并触发事件, 如果是新增的控件的话,就没有原始位置和父级,
|
|
504
|
+
事件是否区分move和add
|
|
505
|
+
move是从主表移动到子表或子表移动到主表才触发,还是所有移动都触发
|
|
506
506
|
*/ var oldDataScopeParent = this.store.movingInstanceOldDataScopeParent;
|
|
507
507
|
var newDataScopeParent = findInstanceDataScopeParent(_instance);
|
|
508
508
|
var oldParent = this.store.movingInstanceOldParent;
|
|
@@ -627,8 +627,8 @@ var applyingPluginName = '';
|
|
|
627
627
|
},
|
|
628
628
|
{
|
|
629
629
|
key: "removeInstance",
|
|
630
|
-
value: /**
|
|
631
|
-
* 删除控件
|
|
630
|
+
value: /**
|
|
631
|
+
* 删除控件
|
|
632
632
|
* */ function removeInstance(instance) {
|
|
633
633
|
// 删除实例,并触发事件 removed
|
|
634
634
|
var parent = instance.parent;
|
|
@@ -667,8 +667,8 @@ var applyingPluginName = '';
|
|
|
667
667
|
},
|
|
668
668
|
{
|
|
669
669
|
key: "updateInstanceType",
|
|
670
|
-
value: /**
|
|
671
|
-
* 修改控件类型
|
|
670
|
+
value: /**
|
|
671
|
+
* 修改控件类型
|
|
672
672
|
* */ function updateInstanceType(instance, type) {
|
|
673
673
|
var schema = instance.toSchema();
|
|
674
674
|
var newInstance = this.createInstance(type, {
|
|
@@ -726,16 +726,16 @@ var applyingPluginName = '';
|
|
|
726
726
|
},
|
|
727
727
|
{
|
|
728
728
|
key: "assertInstance",
|
|
729
|
-
value: /**
|
|
730
|
-
* 判断控件的类型,返回当前控件的正确类型
|
|
729
|
+
value: /**
|
|
730
|
+
* 判断控件的类型,返回当前控件的正确类型
|
|
731
731
|
* */ function assertInstance(instance, types) {
|
|
732
732
|
return isString(types) ? instance.type === types : types.includes(instance.type);
|
|
733
733
|
}
|
|
734
734
|
},
|
|
735
735
|
{
|
|
736
736
|
key: "getInstanceInListControl",
|
|
737
|
-
value: /**
|
|
738
|
-
* 控件在列表控件内,如明细子表或列表控件
|
|
737
|
+
value: /**
|
|
738
|
+
* 控件在列表控件内,如明细子表或列表控件
|
|
739
739
|
* */ function getInstanceInListControl(instance) {
|
|
740
740
|
var _instance = instance;
|
|
741
741
|
while(_instance){
|
|
@@ -806,7 +806,7 @@ var applyingPluginName = '';
|
|
|
806
806
|
]);
|
|
807
807
|
return Driven;
|
|
808
808
|
}(Watcher);
|
|
809
|
-
/**
|
|
810
|
-
* 控件事件定义
|
|
809
|
+
/**
|
|
810
|
+
* 控件事件定义
|
|
811
811
|
* */ _define_property(Driven, "EventLogic", EventLogic);
|
|
812
812
|
export { Driven };
|
package/dist/esm/Store.js
CHANGED
|
@@ -96,42 +96,42 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
96
96
|
"use strict";
|
|
97
97
|
function Store(options) {
|
|
98
98
|
_class_call_check(this, Store);
|
|
99
|
-
/**
|
|
100
|
-
* 页面控件实例树
|
|
99
|
+
/**
|
|
100
|
+
* 页面控件实例树
|
|
101
101
|
* */ _define_property(this, "instance", void 0);
|
|
102
|
-
/**
|
|
103
|
-
* 拍平的控件数组
|
|
102
|
+
/**
|
|
103
|
+
* 拍平的控件数组
|
|
104
104
|
* */ _define_property(this, "flatInstances", void 0);
|
|
105
|
-
/**
|
|
106
|
-
* 控件id组成的map
|
|
105
|
+
/**
|
|
106
|
+
* 控件id组成的map
|
|
107
107
|
* */ _define_property(this, "instanceIdMap", void 0);
|
|
108
|
-
/**
|
|
109
|
-
* dataCode和fieldCode组成的map
|
|
110
|
-
* {
|
|
111
|
-
* [主表dataCode]: {
|
|
112
|
-
* [fieldCode]: 控件
|
|
113
|
-
* },
|
|
114
|
-
* [子表dataCode]: {
|
|
115
|
-
* [fieldCode]: 控件
|
|
116
|
-
* }
|
|
117
|
-
* }
|
|
108
|
+
/**
|
|
109
|
+
* dataCode和fieldCode组成的map
|
|
110
|
+
* {
|
|
111
|
+
* [主表dataCode]: {
|
|
112
|
+
* [fieldCode]: 控件
|
|
113
|
+
* },
|
|
114
|
+
* [子表dataCode]: {
|
|
115
|
+
* [fieldCode]: 控件
|
|
116
|
+
* }
|
|
117
|
+
* }
|
|
118
118
|
* */ _define_property(this, "dataFieldCodeMap", void 0);
|
|
119
|
-
/**
|
|
120
|
-
* 当前选中的控件
|
|
119
|
+
/**
|
|
120
|
+
* 当前选中的控件
|
|
121
121
|
* */ _define_property(this, "selected", null);
|
|
122
|
-
/**
|
|
123
|
-
* 当前选中的数据作用域控件
|
|
122
|
+
/**
|
|
123
|
+
* 当前选中的数据作用域控件
|
|
124
124
|
* */ _define_property(this, "selectedInstanceDataScopeParent", null);
|
|
125
125
|
_define_property(this, "selectedDataScopeFlatInstances", []);
|
|
126
|
-
/**
|
|
127
|
-
* 当前选中控件的setting
|
|
126
|
+
/**
|
|
127
|
+
* 当前选中控件的setting
|
|
128
128
|
* */ _define_property(this, "selectedInstanceSetting", []);
|
|
129
129
|
_define_property(this, "selectedInstanceSettingItems", []);
|
|
130
|
-
/**
|
|
131
|
-
* 当前选中控件的数据模型
|
|
130
|
+
/**
|
|
131
|
+
* 当前选中控件的数据模型
|
|
132
132
|
* */ _define_property(this, "selectedFieldItem", null);
|
|
133
|
-
/**
|
|
134
|
-
* 扩展字段,比如appId,dataCode等
|
|
133
|
+
/**
|
|
134
|
+
* 扩展字段,比如appId,dataCode等
|
|
135
135
|
* */ _define_property(this, "external", {});
|
|
136
136
|
_define_property(this, "movingInstance", null);
|
|
137
137
|
_define_property(this, "movingInstanceOldParent", null);
|
|
@@ -147,8 +147,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
147
147
|
_create_class(Store, [
|
|
148
148
|
{
|
|
149
149
|
key: "selectedRules",
|
|
150
|
-
get: /**
|
|
151
|
-
* 当前选中控件的rules
|
|
150
|
+
get: /**
|
|
151
|
+
* 当前选中控件的rules
|
|
152
152
|
* */ function get() {
|
|
153
153
|
if (!this.selected) {
|
|
154
154
|
return null;
|
|
@@ -158,8 +158,8 @@ export var Store = /*#__PURE__*/ function() {
|
|
|
158
158
|
},
|
|
159
159
|
{
|
|
160
160
|
key: "selectedAntdRules",
|
|
161
|
-
get: /**
|
|
162
|
-
* 当前选中控件的antd rules
|
|
161
|
+
get: /**
|
|
162
|
+
* 当前选中控件的antd rules
|
|
163
163
|
* */ function get() {
|
|
164
164
|
var rules = this.selectedRules;
|
|
165
165
|
if (!rules) {
|
package/dist/esm/utils.js
CHANGED
|
@@ -196,9 +196,9 @@ export function getMasterFormControls(controls) {
|
|
|
196
196
|
});
|
|
197
197
|
return formctls;
|
|
198
198
|
}
|
|
199
|
-
/**
|
|
200
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
201
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
199
|
+
/**
|
|
200
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
201
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
202
202
|
* */ export function fillModelBindInfoListFieldCode(modelBindInfoList) {
|
|
203
203
|
var dataCode = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : '';
|
|
204
204
|
if (!modelBindInfoList || !Array.isArray(modelBindInfoList)) return [];
|
package/dist/types/Builder.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ControlDesignerInstance } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
3
|
-
export declare class Builder {
|
|
4
|
-
private designer;
|
|
5
|
-
ListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
6
|
-
ProListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
7
|
-
FormPageBuilder(): ControlDesignerInstance<'data-view'>;
|
|
8
|
-
VuePageBuilder(): ControlDesignerInstance<CONTROL_TYPE.VUE_PAGE>;
|
|
9
|
-
}
|
|
1
|
+
import { ControlDesignerInstance } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
import { CONTROL_TYPE } from '@byteluck-fe/model-driven-shared';
|
|
3
|
+
export declare class Builder {
|
|
4
|
+
private designer;
|
|
5
|
+
ListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
6
|
+
ProListPageBuilder(): ControlDesignerInstance<'list-view'>;
|
|
7
|
+
FormPageBuilder(): ControlDesignerInstance<'data-view'>;
|
|
8
|
+
VuePageBuilder(): ControlDesignerInstance<CONTROL_TYPE.VUE_PAGE>;
|
|
9
|
+
}
|
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,41 +1,41 @@
|
|
|
1
|
-
import { Schema, ControlsKeys, DataBindModelType, DesignerControl, DesignerFormControl, Messages } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
export declare function getMasterFormControls(controls: DesignerControl[]): DesignerFormControl[];
|
|
3
|
-
/**
|
|
4
|
-
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
5
|
-
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
6
|
-
* */
|
|
7
|
-
export declare function fillModelBindInfoListFieldCode(modelBindInfoList: DataBindModelType[], dataCode?: string): DataBindModelType[];
|
|
8
|
-
/**
|
|
9
|
-
* @description 将控件实例转换为schema
|
|
10
|
-
* */
|
|
11
|
-
declare function toSchema<T extends ControlsKeys>(instance: DesignerControl): Schema<T>;
|
|
12
|
-
declare function toSchema<T extends ControlsKeys>(instances: DesignerControl[]): Schema<T>[];
|
|
13
|
-
declare function getModelBindInfoList(controls: DesignerControl[] | DesignerControl): DataBindModelType | DataBindModelType[] | undefined;
|
|
14
|
-
declare function checkSchema(controls: DesignerControl[] | DesignerControl, messages?: Messages, ignore?: string[]): Promise<boolean>;
|
|
15
|
-
interface PermissionItem {
|
|
16
|
-
controlId: string;
|
|
17
|
-
caption: string;
|
|
18
|
-
type: string;
|
|
19
|
-
controlType: string;
|
|
20
|
-
/**
|
|
21
|
-
* 是否可编辑
|
|
22
|
-
* */
|
|
23
|
-
canEdit: boolean;
|
|
24
|
-
/**
|
|
25
|
-
* 是否可查看
|
|
26
|
-
* */
|
|
27
|
-
canRead: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* 是否可隐藏
|
|
30
|
-
* */
|
|
31
|
-
canHide: boolean;
|
|
32
|
-
parentId: string | null;
|
|
33
|
-
/**
|
|
34
|
-
* 在表单、列表授权时将权限分组显示
|
|
35
|
-
* element = 元素分组权限 = 除了绑定字段的控件都是这种类型
|
|
36
|
-
* field = 字段分组权限 = 绑了字段的控件类型
|
|
37
|
-
*/
|
|
38
|
-
group: 'element' | 'field';
|
|
39
|
-
}
|
|
40
|
-
declare function generatePermissions(controls: DesignerControl[] | DesignerControl, parent?: PermissionItem): PermissionItem[];
|
|
41
|
-
export { toSchema, getModelBindInfoList, checkSchema, generatePermissions };
|
|
1
|
+
import { Schema, ControlsKeys, DataBindModelType, DesignerControl, DesignerFormControl, Messages } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
export declare function getMasterFormControls(controls: DesignerControl[]): DesignerFormControl[];
|
|
3
|
+
/**
|
|
4
|
+
* @description 给modelBindInfoList中填充fieldCode和dataCode
|
|
5
|
+
* @description 我们生成fieldCode的规则是:DataBind的控件,取`field_${id}`,ObjectDataBind的控件,取`field_${id}_${key}`, key指的是ObjectDataBind.keys()
|
|
6
|
+
* */
|
|
7
|
+
export declare function fillModelBindInfoListFieldCode(modelBindInfoList: DataBindModelType[], dataCode?: string): DataBindModelType[];
|
|
8
|
+
/**
|
|
9
|
+
* @description 将控件实例转换为schema
|
|
10
|
+
* */
|
|
11
|
+
declare function toSchema<T extends ControlsKeys>(instance: DesignerControl): Schema<T>;
|
|
12
|
+
declare function toSchema<T extends ControlsKeys>(instances: DesignerControl[]): Schema<T>[];
|
|
13
|
+
declare function getModelBindInfoList(controls: DesignerControl[] | DesignerControl): DataBindModelType | DataBindModelType[] | undefined;
|
|
14
|
+
declare function checkSchema(controls: DesignerControl[] | DesignerControl, messages?: Messages, ignore?: string[]): Promise<boolean>;
|
|
15
|
+
interface PermissionItem {
|
|
16
|
+
controlId: string;
|
|
17
|
+
caption: string;
|
|
18
|
+
type: string;
|
|
19
|
+
controlType: string;
|
|
20
|
+
/**
|
|
21
|
+
* 是否可编辑
|
|
22
|
+
* */
|
|
23
|
+
canEdit: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 是否可查看
|
|
26
|
+
* */
|
|
27
|
+
canRead: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 是否可隐藏
|
|
30
|
+
* */
|
|
31
|
+
canHide: boolean;
|
|
32
|
+
parentId: string | null;
|
|
33
|
+
/**
|
|
34
|
+
* 在表单、列表授权时将权限分组显示
|
|
35
|
+
* element = 元素分组权限 = 除了绑定字段的控件都是这种类型
|
|
36
|
+
* field = 字段分组权限 = 绑了字段的控件类型
|
|
37
|
+
*/
|
|
38
|
+
group: 'element' | 'field';
|
|
39
|
+
}
|
|
40
|
+
declare function generatePermissions(controls: DesignerControl[] | DesignerControl, parent?: PermissionItem): PermissionItem[];
|
|
41
|
+
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.23.0-beta.
|
|
3
|
+
"version": "2.23.0-beta.1",
|
|
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.23.0-beta.
|
|
29
|
+
"@byteluck-fe/model-driven-controls": "2.23.0-beta.1",
|
|
30
30
|
"@byteluck-fe/model-driven-core": "2.22.1-beta.2",
|
|
31
31
|
"@byteluck-fe/model-driven-settings": "2.22.1-beta.2",
|
|
32
32
|
"@byteluck-fe/model-driven-shared": "2.22.1-beta.2"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "73168cf7a11e0aa2b6b060545ff23e194a041fe1"
|
|
35
35
|
}
|