@byteluck-fe/model-driven-driven 3.0.0-beta.6 → 3.0.0-beta.7

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.
@@ -0,0 +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 {};
@@ -0,0 +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
+ }>;
@@ -0,0 +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;
@@ -0,0 +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';
@@ -0,0 +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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteluck-fe/model-driven-driven",
3
- "version": "3.0.0-beta.6",
3
+ "version": "3.0.0-beta.7",
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": "3.0.0-beta.6",
30
- "@byteluck-fe/model-driven-core": "3.0.0-beta.6",
31
- "@byteluck-fe/model-driven-settings": "3.0.0-beta.6",
32
- "@byteluck-fe/model-driven-shared": "3.0.0-beta.6"
29
+ "@byteluck-fe/model-driven-controls": "3.0.0-beta.7",
30
+ "@byteluck-fe/model-driven-core": "3.0.0-beta.7",
31
+ "@byteluck-fe/model-driven-settings": "3.0.0-beta.7",
32
+ "@byteluck-fe/model-driven-shared": "3.0.0-beta.7"
33
33
  },
34
- "gitHead": "df89198b192db9e30fa31961e6688feb053e8958"
34
+ "gitHead": "cd0189dbbaf540d9369eb89b41384516a59d28d0"
35
35
  }