@byteluck-fe/model-driven-engine 2.7.0-alpha.31b → 2.7.0-alpha.35

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.
Files changed (41) hide show
  1. package/README.md +30 -30
  2. package/dist/esm/common/ActionManager.js +177 -60
  3. package/dist/esm/common/DataManager.js +134 -25
  4. package/dist/esm/common/Engine.js +480 -406
  5. package/dist/esm/common/OkWorker.js +31 -17
  6. package/dist/esm/common/Plugin.js +2 -2
  7. package/dist/esm/common/Runtime.js +80 -104
  8. package/dist/esm/common/Store.js +63 -62
  9. package/dist/esm/common/checkerValue.js +108 -108
  10. package/dist/esm/common/index.js +2 -2
  11. package/dist/esm/common/proxyState.js +76 -76
  12. package/dist/esm/index.js +3 -3
  13. package/dist/esm/plugins/CalcPlugin.js +128 -120
  14. package/dist/esm/plugins/ControlsEventPlugin.js +196 -73
  15. package/dist/esm/plugins/ES6ModulePlugin.js +54 -66
  16. package/dist/esm/plugins/LifecycleEventPlugin.js +198 -79
  17. package/dist/esm/plugins/StylePlugin.js +26 -11
  18. package/dist/esm/plugins/index.js +5 -5
  19. package/dist/esm/utils/index.js +1 -1
  20. package/dist/esm/utils/runtimeUtils.js +5 -7
  21. package/dist/index.umd.js +8 -8
  22. package/dist/types/common/ActionManager.d.ts +14 -14
  23. package/dist/types/common/DataManager.d.ts +10 -10
  24. package/dist/types/common/Engine.d.ts +184 -181
  25. package/dist/types/common/OkWorker.d.ts +13 -13
  26. package/dist/types/common/Plugin.d.ts +6 -6
  27. package/dist/types/common/Runtime.d.ts +25 -26
  28. package/dist/types/common/Store.d.ts +50 -50
  29. package/dist/types/common/checkerValue.d.ts +3 -3
  30. package/dist/types/common/index.d.ts +2 -2
  31. package/dist/types/common/proxyState.d.ts +30 -30
  32. package/dist/types/index.d.ts +3 -3
  33. package/dist/types/plugins/CalcPlugin.d.ts +121 -121
  34. package/dist/types/plugins/ControlsEventPlugin.d.ts +15 -15
  35. package/dist/types/plugins/ES6ModulePlugin.d.ts +26 -27
  36. package/dist/types/plugins/LifecycleEventPlugin.d.ts +14 -14
  37. package/dist/types/plugins/StylePlugin.d.ts +12 -12
  38. package/dist/types/plugins/index.d.ts +5 -5
  39. package/dist/types/utils/index.d.ts +1 -1
  40. package/dist/types/utils/runtimeUtils.d.ts +5 -5
  41. package/package.json +4 -4
@@ -1,14 +1,14 @@
1
- export declare class ActionManager {
2
- private actionMap;
3
- private buildinActions;
4
- /**
5
- * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
6
- */
7
- actionUtils: {};
8
- /**
9
- * 用于存储es module解析出来的源码,CustomVueControlPlugin
10
- */
11
- sources: {};
12
- execAction(name: string, context: any, ...args: any[]): Promise<any>;
13
- addAction(name: string, func: Function): void;
14
- }
1
+ export declare class ActionManager {
2
+ private actionMap;
3
+ private buildinActions;
4
+ /**
5
+ * 执行action的时候,作为第二个参数传递给方法,可以通过外部挂载
6
+ */
7
+ actionUtils: {};
8
+ /**
9
+ * 用于存储es module解析出来的源码,CustomVueControlPlugin
10
+ */
11
+ sources: {};
12
+ execAction(name: string, context: any, ...args: any[]): Promise<any>;
13
+ addAction(name: string, func: Function): void;
14
+ }
@@ -1,10 +1,10 @@
1
- import { EventPayload } from './Engine';
2
- export declare class DataManager {
3
- private _dataStore;
4
- private executer?;
5
- constructor(callbackExecuter: (payload: EventPayload) => Promise<any>);
6
- add(key: string, data: any): void;
7
- get(key: string): any;
8
- remove(key: string): void;
9
- getRemoteData(payload: EventPayload): Promise<any>;
10
- }
1
+ import { EventPayload } from './Engine';
2
+ export declare class DataManager {
3
+ private _dataStore;
4
+ private executer?;
5
+ constructor(callbackExecuter: (payload: EventPayload) => Promise<any>);
6
+ add(key: string, data: any): void;
7
+ get(key: string): any;
8
+ remove(key: string): void;
9
+ getRemoteData(payload: EventPayload): Promise<any>;
10
+ }
@@ -1,181 +1,184 @@
1
- import { ControlExport, ControlRuntimeInstance, ControlsInstance, ControlsKeys, DataBind, DeepPartial, LayoutControls, ObjectDataBind, RuntimeControl, RuntimeListControl, Schema } from '@byteluck-fe/model-driven-core';
2
- import { Callback, Watcher } from '@byteluck-fe/model-driven-shared';
3
- import { Plugin } from './Plugin';
4
- import { Runtime, RuntimeProps } from './Runtime';
5
- import { DataBindMappingFieldItem, dataBindMappingType, DataBindMappingTypeItem, StatesType, StateType } from './Store';
6
- import { ActionManager } from './ActionManager';
7
- import { DataManager } from './DataManager';
8
- export declare type getDataControlIdMappingType = {
9
- [controlId: string]: {
10
- dataBind: any;
11
- dataView: string;
12
- children: getDataControlIdMappingType;
13
- };
14
- };
15
- declare type dataSetType = {
16
- [dataCode: string]: Record<string, unknown> | Record<string, unknown>[];
17
- };
18
- declare type FieldSetType = {
19
- [fieldCode: string]: unknown;
20
- };
21
- interface EventPayload {
22
- instance?: RuntimeControl;
23
- value?: unknown;
24
- rowIndex?: number;
25
- options?: {
26
- [key: string]: any;
27
- };
28
- }
29
- interface SchemaEventPayload {
30
- instance: RuntimeControl;
31
- value: unknown;
32
- props: string;
33
- rowIndex?: number;
34
- }
35
- declare type EngineProps<T extends keyof LayoutControls = keyof LayoutControls> = {
36
- schema: RuntimeProps['schema'];
37
- beforeCreateInstance?: RuntimeProps['beforeCreateInstance'];
38
- plugins?: Plugin[];
39
- language?: string;
40
- autoMount?: boolean;
41
- debug?: boolean;
42
- externalParams?: Record<string, unknown>;
43
- };
44
- declare type EventKeys = 'click' | 'click-finish' | 'wps-open' | 'wps-save' | 'wps-rename' | 'change' | 'schema-change' | 'search' | 'checked' | 'input' | 'focus' | 'blur' | 'list-change' | 'list-splice' | 'list-delete' | 'list-before-insert' | 'list-search' | 'list-mounted' | 'list-actions' | 'engine-mounted' | 'engine-submit' | 'engine-submit-params' | 'engine-submitted' | string;
45
- declare class Engine extends Watcher<EventKeys> {
46
- private store;
47
- rawStore: Record<string, any>;
48
- parent?: Engine;
49
- runtime: Runtime;
50
- isMounted: boolean;
51
- id: string;
52
- readonly externalParams?: Record<string, any>;
53
- private __plugins;
54
- private __pluginsApplied;
55
- private readonly $options;
56
- private actionManager;
57
- private dataManager?;
58
- private _jobTasks;
59
- constructor(props: EngineProps);
60
- private debugLog;
61
- use(plugin: Plugin): this;
62
- registerControl(...arg: Parameters<Runtime['register']>): this;
63
- static register(control: ControlExport): typeof import("@byteluck-fe/model-driven-core").RegisterControls;
64
- static judgeControlIsRegistered(control: Parameters<typeof Runtime['register']>[0]): boolean;
65
- mount(): void;
66
- destroy(): void;
67
- private _handlerProxyState;
68
- private _proxyStateBeforeSetCallback;
69
- private _proxyStateCallback;
70
- private _handlerArrayUpdate;
71
- private _handlerObjectUpdate;
72
- private applyPlugins;
73
- listControlCreateRow<RowType extends ControlsKeys>(instance: RuntimeListControl, rowType: RowType): InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<RowType, "Runtime">> | undefined;
74
- listControlAddRow(instance: RuntimeListControl, rowType?: ControlsKeys): void;
75
- emit(eventKey: EventKeys, payload: EventPayload): Promise<unknown[]>;
76
- on(key: EventKeys, callback: Callback): void;
77
- createControl(...args: Parameters<Runtime['createControl']>): never[];
78
- createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlsInstance<T, 'Runtime'> | undefined;
79
- createControlInstance: <T extends never>(type: T, initSchema?: DeepPartial<Schema<T, InstanceType<import("@byteluck-fe/model-driven-core").Controls[T]["Property"]>>> | undefined) => InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<T, "Runtime">> | undefined;
80
- schemaEvent(eventKey: 'schema-change', payload: SchemaEventPayload): void;
81
- updateInstanceProps(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
82
- getRule(controlType: string, props: any): any[];
83
- getAllRules(controlId?: string): {
84
- rules: import("async-validator").Rules | undefined;
85
- antdRules: import("async-validator").Rules | undefined;
86
- };
87
- getRules(controlId?: string): import("async-validator").Rules | undefined;
88
- getAntdRules(controlId?: string): import("async-validator").Rules | undefined;
89
- getState(controlId?: string, rowIndex?: number): unknown;
90
- getEmptyState(controlId?: string): any;
91
- /**
92
- * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
93
- * @param options 需要携带的options
94
- * */
95
- setPayloadOptions(options: object | null): void;
96
- setState(controlId: string, value: unknown, rowIndex?: number, options?: any): void;
97
- /**
98
- * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
99
- * @param states
100
- */
101
- setStates(states: StatesType | StateType, rowIndex?: number, options?: any): void;
102
- /**
103
- * 通过dataCode和fieldCode来获取控件的值
104
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
105
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
106
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
107
- * */
108
- getField(dataCode: string, fieldCode?: string, rowIndex?: number): unknown;
109
- getData(dataCode: string): any;
110
- /**
111
- * 通过dataCode和fieldCode来设置控件的值
112
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
113
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
114
- * @param value 修改的值
115
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
116
- * @param options 触发事件携带的参数
117
- * */
118
- setField(dataCode: string, fieldCode: string, value: unknown, rowIndex?: number, options?: EventPayload['options']): void;
119
- /**
120
- * 通过dataCode state来给一组控件赋值,并触发事件携带options
121
- * @param dataCode 需要赋值的目标模型
122
- * @param state 赋值对象,以fieldCode为key组成的对象
123
- * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
124
- * @param options 触发事件携带的参数
125
- * */
126
- setFields(dataCode: string, state: FieldSetType, rowIndex?: number, options?: EventPayload['options']): void;
127
- /**
128
- * 通过dataCode来将state转化为标准的state结构
129
- * @param dataCode 需要转换的目标模型code
130
- * @param state 值对象,以fieldCode为key组成的对象
131
- * */
132
- buildFields(dataCode: string, state: FieldSetType): StateType | undefined;
133
- /**
134
- * 向Store设置一组值,并触发事件携带options
135
- * @param dataSet
136
- * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
137
- */
138
- setData(dataSet: dataSetType, options?: any): void;
139
- /**
140
- * 获取控件的dataBind
141
- * @param controlId
142
- * */
143
- getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
144
- /**
145
- * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
146
- * @param controlId
147
- * @param rowIndex
148
- */
149
- getInstance(controlId: string, rowIndex?: number): ControlRuntimeInstance<ControlsKeys> | undefined;
150
- /**
151
- * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
152
- * @param controlId
153
- * @param header 明细表内是否获取表头的控件
154
- */
155
- getInstances(controlId?: string, header?: boolean): ControlRuntimeInstance<ControlsKeys>[];
156
- setInstance(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
157
- getControlIdMapping(): import("./Store").controlIdMappingType;
158
- getDataBindMapping(): dataBindMappingType;
159
- getDataBindMapping(dataCode: string): DataBindMappingTypeItem | undefined;
160
- getDataBindMapping(dataCode: string, fieldCode: string): DataBindMappingFieldItem | undefined;
161
- getAction(): ActionManager;
162
- initDataManager(callbackExecuter: (payload: EventPayload) => Promise<any>): void;
163
- getDataManager(): DataManager | undefined;
164
- /**
165
- * 判断控件的类型,返回当前控件的正确类型
166
- * */
167
- assertInstance<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, types: T | T[]): instance is ControlRuntimeInstance<T>;
168
- /**
169
- * 获取控件在明细子表中的行下标,
170
- * 如果控件在表头内,则返回-1
171
- * 如果控件在表内,则返回行下标
172
- * 如果控件不在明细表内,则返回undefined
173
- * */
174
- getInstanceRowIndex(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl): number | undefined;
175
- getInstanceParentControl<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, controlType: T): ControlRuntimeInstance<T> | undefined;
176
- getInstanceInSubtableHeader<T extends ControlsKeys>(instance: ControlRuntimeInstance<T> | RuntimeControl): ControlRuntimeInstance<T> | undefined;
177
- setControlConfig(...args: Parameters<Runtime['registerControlConfig']>): Runtime;
178
- getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
179
- inList(controlId: string): undefined;
180
- }
181
- export { Engine, EventPayload, SchemaEventPayload, EngineProps };
1
+ import { ControlRuntimeInstance, ControlsInstance, ControlsKeys, DataBind, DeepPartial, LayoutControls, ObjectDataBind, RuntimeControl, RuntimeListControl, Schema } from '@byteluck-fe/model-driven-core';
2
+ import { Callback, Watcher } from '@byteluck-fe/model-driven-shared';
3
+ import { Plugin } from './Plugin';
4
+ import { Runtime, RuntimeProps } from './Runtime';
5
+ import { DataBindMappingFieldItem, dataBindMappingType, DataBindMappingTypeItem, StatesType, StateType } from './Store';
6
+ import { ActionManager } from './ActionManager';
7
+ import { DataManager } from './DataManager';
8
+ export type getDataControlIdMappingType = {
9
+ [controlId: string]: {
10
+ dataBind: any;
11
+ dataView: string;
12
+ children: getDataControlIdMappingType;
13
+ };
14
+ };
15
+ type dataSetType = {
16
+ [dataCode: string]: Record<string, unknown> | Record<string, unknown>[];
17
+ };
18
+ type FieldSetType = {
19
+ [fieldCode: string]: unknown;
20
+ };
21
+ interface EventPayload {
22
+ instance?: RuntimeControl;
23
+ value?: unknown;
24
+ rowIndex?: number;
25
+ options?: {
26
+ [key: string]: any;
27
+ };
28
+ }
29
+ interface SchemaEventPayload {
30
+ instance: RuntimeControl;
31
+ value: unknown;
32
+ props: string;
33
+ rowIndex?: number;
34
+ }
35
+ type EngineProps<T extends keyof LayoutControls = keyof LayoutControls> = {
36
+ schema: RuntimeProps['schema'];
37
+ beforeCreateInstance?: RuntimeProps['beforeCreateInstance'];
38
+ plugins?: Plugin[];
39
+ language?: string;
40
+ autoMount?: boolean;
41
+ debug?: boolean;
42
+ externalParams?: Record<string, unknown>;
43
+ };
44
+ type EventKeys = 'click' | 'click-finish' | 'wps-open' | 'wps-save' | 'wps-rename' | 'change' | 'schema-change' | 'search' | 'checked' | 'input' | 'focus' | 'blur' | 'list-change' | 'list-splice' | 'list-delete' | 'list-before-insert' | 'list-search' | 'list-mounted' | 'list-actions' | 'engine-mounted' | 'engine-submit' | 'engine-submit-params' | 'engine-submitted' | string;
45
+ declare class Engine extends Watcher<EventKeys> {
46
+ private store;
47
+ rawStore: Record<string, any>;
48
+ parent?: Engine;
49
+ runtime: Runtime;
50
+ isMounted: boolean;
51
+ id: string;
52
+ readonly externalParams?: Record<string, any>;
53
+ private __plugins;
54
+ private __pluginsApplied;
55
+ private readonly $options;
56
+ private actionManager;
57
+ private dataManager?;
58
+ private _jobTasks;
59
+ constructor(props: EngineProps);
60
+ private debugLog;
61
+ use(plugin: Plugin): this;
62
+ registerControl(...arg: Parameters<Runtime['register']>): this;
63
+ static register(...arg: Parameters<(typeof Runtime)['register']>): typeof import("@byteluck-fe/model-driven-core").RegisterControls;
64
+ static judgeControlIsRegistered(control: Parameters<(typeof Runtime)['register']>[0]): boolean;
65
+ mount(): void;
66
+ destroy(): void;
67
+ private _handlerProxyState;
68
+ private _proxyStateBeforeSetCallback;
69
+ private _proxyStateCallback;
70
+ private _handlerArrayUpdate;
71
+ private _handlerObjectUpdate;
72
+ private applyPlugins;
73
+ listControlCreateRow<RowType extends ControlsKeys>(instance: RuntimeListControl, rowType: RowType): NonNullable<InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<RowType, "Runtime">>> | undefined;
74
+ listControlAddRow(instance: RuntimeListControl, rowType?: ControlsKeys): void;
75
+ emit(eventKey: EventKeys, payload: EventPayload): Promise<unknown[]>;
76
+ on(key: EventKeys, callback: Callback): void;
77
+ createControl(...args: Parameters<Runtime['createControl']>): never[];
78
+ createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlsInstance<T, 'Runtime'> | undefined;
79
+ createControlInstance: <T extends never>(type: T, initSchema?: DeepPartial<Schema<T, InstanceType<import("@byteluck-fe/model-driven-core").Controls[T]["Property"]>>> | undefined) => InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<T, "Runtime">> | undefined;
80
+ schemaEvent(eventKey: 'schema-change', payload: SchemaEventPayload): void;
81
+ updateInstanceProps(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
82
+ getAllRules(controlId?: string): {
83
+ rules: import("async-validator").Rules | undefined;
84
+ antdRules: import("async-validator").Rules | undefined;
85
+ };
86
+ getRules(controlId?: string): import("async-validator").Rules | undefined;
87
+ getAntdRules(controlId?: string): import("async-validator").Rules | undefined;
88
+ getState(controlId?: string, rowIndex?: number): unknown;
89
+ getEmptyState(controlId?: string): any;
90
+ /**
91
+ * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
92
+ * @param options 需要携带的options
93
+ * */
94
+ setPayloadOptions(options: object | null): void;
95
+ setState(controlId: string, value: unknown, rowIndex?: number, options?: any): void;
96
+ /**
97
+ * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
98
+ * @param states
99
+ */
100
+ setStates(states: StatesType | StateType, rowIndex?: number, options?: any): void;
101
+ /**
102
+ * 通过dataCode和fieldCode来获取控件的值
103
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
104
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
105
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
106
+ * */
107
+ getField(dataCode: string, fieldCode?: string, rowIndex?: number): unknown;
108
+ getData(dataCode: string): any;
109
+ /**
110
+ * 通过dataCode和fieldCode来设置控件的值
111
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
112
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
113
+ * @param value 修改的值
114
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
115
+ * @param options 触发事件携带的参数
116
+ * */
117
+ setField(dataCode: string, fieldCode: string, value: unknown, rowIndex?: number, options?: EventPayload['options']): void;
118
+ /**
119
+ * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
120
+ * @param dataCode 需要赋值的目标模型
121
+ * @param state 赋值对象,以fieldCode为key组成的对象
122
+ * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
123
+ * @param options 触发事件携带的参数
124
+ * */
125
+ setFields(dataCode: string, state: FieldSetType, rowIndex?: number, options?: EventPayload['options']): void;
126
+ /**
127
+ * 通过dataCode来将state转化为标准的state结构
128
+ * @param dataCode 需要转换的目标模型code
129
+ * @param state 值对象,以fieldCode为key组成的对象
130
+ * */
131
+ buildFields(dataCode: string, state: FieldSetType): StateType | undefined;
132
+ /**
133
+ * 向Store设置一组值,并触发事件携带options
134
+ * @param dataSet
135
+ * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
136
+ */
137
+ setData(dataSet: dataSetType, options?: any): void;
138
+ /**
139
+ * 获取控件的dataBind
140
+ * @param controlId
141
+ * */
142
+ getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
143
+ /**
144
+ * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
145
+ * @param controlId
146
+ * @param rowIndex
147
+ */
148
+ getInstance(controlId: string, rowIndex?: number): ControlRuntimeInstance<ControlsKeys> | undefined;
149
+ /**
150
+ * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
151
+ * @param controlId
152
+ * @param header 明细表内是否获取表头的控件
153
+ */
154
+ getInstances(controlId?: string, header?: boolean): ControlRuntimeInstance<ControlsKeys>[];
155
+ setInstance(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
156
+ getControlIdMapping(): import("./Store").controlIdMappingType;
157
+ getDataBindMapping(): dataBindMappingType;
158
+ getDataBindMapping(dataCode: string): DataBindMappingTypeItem | undefined;
159
+ getDataBindMapping(dataCode: string, fieldCode: string): DataBindMappingFieldItem | undefined;
160
+ getAction(): ActionManager;
161
+ initDataManager(callbackExecuter: (payload: EventPayload) => Promise<any>): void;
162
+ getDataManager(): DataManager | undefined;
163
+ /**
164
+ * 判断控件的类型,返回当前控件的正确类型
165
+ * */
166
+ assertInstance<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, types: T | T[]): instance is ControlRuntimeInstance<T>;
167
+ /**
168
+ * 判断控件或控件类型是一个自定义控件
169
+ * */
170
+ assertInstanceIsCustomControl(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl): boolean;
171
+ /**
172
+ * 获取控件在明细子表中的行下标,
173
+ * 如果控件在表头内,则返回-1
174
+ * 如果控件在表内,则返回行下标
175
+ * 如果控件不在明细表内,则返回undefined
176
+ * */
177
+ getInstanceRowIndex(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl): number | undefined;
178
+ getInstanceParentControl<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, controlType: T): ControlRuntimeInstance<T> | undefined;
179
+ getInstanceInSubtableHeader<T extends ControlsKeys>(instance: ControlRuntimeInstance<T> | RuntimeControl): ControlRuntimeInstance<T> | undefined;
180
+ setControlConfig(...args: Parameters<Runtime['registerControlConfig']>): Runtime;
181
+ getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
182
+ inList(controlId: string): undefined;
183
+ }
184
+ export { Engine, EventPayload, SchemaEventPayload, EngineProps };
@@ -1,13 +1,13 @@
1
- interface WorkerMessage {
2
- action: string;
3
- payload: unknown;
4
- }
5
- declare class OkWorker {
6
- worker?: Worker;
7
- run(initState: any): void;
8
- destroy(): void;
9
- postMessage(message: WorkerMessage): void;
10
- private static createWorker;
11
- private static createWorkerFunction;
12
- }
13
- export { OkWorker };
1
+ interface WorkerMessage {
2
+ action: string;
3
+ payload: unknown;
4
+ }
5
+ declare class OkWorker {
6
+ worker?: Worker;
7
+ run(initState: any): void;
8
+ destroy(): void;
9
+ postMessage(message: WorkerMessage): void;
10
+ private static createWorker;
11
+ private static createWorkerFunction;
12
+ }
13
+ export { OkWorker };
@@ -1,6 +1,6 @@
1
- import { Engine } from './Engine';
2
- declare abstract class Plugin {
3
- abstract pluginName?: string;
4
- abstract apply(engine: Engine): void;
5
- }
6
- export { Plugin };
1
+ import { Engine } from './Engine';
2
+ declare abstract class Plugin {
3
+ abstract pluginName?: string;
4
+ abstract apply(engine: Engine): void;
5
+ }
6
+ export { Plugin };
@@ -1,26 +1,25 @@
1
- import { RuleItem } from 'async-validator';
2
- import { ControlRuntimeInstance, ControlsKeys, RegisterControls, BeforeCreateInstance } from '@byteluck-fe/model-driven-core';
3
- export interface RuntimeProps {
4
- schema: any;
5
- beforeCreateInstance?: BeforeCreateInstance;
6
- }
7
- export declare type InstanceMap = Record<string, ControlRuntimeInstance<ControlsKeys>[]>;
8
- export declare class Runtime extends RegisterControls<'Runtime'> {
9
- private _schema;
10
- private _instance;
11
- private _flatInstances;
12
- private _instanceMap;
13
- private _controlParentIdMap;
14
- constructor(props: RuntimeProps);
15
- getFlatInstances(): ControlRuntimeInstance<ControlsKeys>[];
16
- get schema(): any;
17
- get instance(): ControlRuntimeInstance<ControlsKeys>[];
18
- get flatInstances(): ControlRuntimeInstance<ControlsKeys>[];
19
- get instanceMap(): InstanceMap;
20
- get allRules(): {
21
- rules: Record<string, RuleItem>;
22
- antdRules: Record<string, RuleItem>;
23
- };
24
- get rules(): Record<string, RuleItem>;
25
- get antdRules(): Record<string, RuleItem>;
26
- }
1
+ import { RuleItem } from 'async-validator';
2
+ import { ControlRuntimeInstance, ControlsKeys, RegisterControls, BeforeCreateInstance } from '@byteluck-fe/model-driven-core';
3
+ export interface RuntimeProps {
4
+ schema: any;
5
+ beforeCreateInstance?: BeforeCreateInstance;
6
+ }
7
+ export type InstanceMap = Record<string, ControlRuntimeInstance<ControlsKeys>[]>;
8
+ export declare class Runtime extends RegisterControls<'Runtime'> {
9
+ private _schema;
10
+ private _instance;
11
+ private _flatInstances;
12
+ private _instanceMap;
13
+ constructor(props: RuntimeProps);
14
+ getFlatInstances(): ControlRuntimeInstance<ControlsKeys>[];
15
+ get schema(): any;
16
+ get instance(): ControlRuntimeInstance<ControlsKeys>[];
17
+ get flatInstances(): ControlRuntimeInstance<ControlsKeys>[];
18
+ get instanceMap(): InstanceMap;
19
+ get allRules(): {
20
+ rules: Record<string, RuleItem>;
21
+ antdRules: Record<string, RuleItem>;
22
+ };
23
+ get rules(): Record<string, RuleItem>;
24
+ get antdRules(): Record<string, RuleItem>;
25
+ }
@@ -1,50 +1,50 @@
1
- import { RuntimeControl, DataBind, ObjectDataBind, OptionSetting } from '@byteluck-fe/model-driven-core';
2
- export declare type StateType = {
3
- [controlId: string]: unknown;
4
- };
5
- export declare type StatesType = {
6
- [dataViewId: string]: StateType;
7
- };
8
- export declare type controlIdMappingType = {
9
- [controlId: string]: {
10
- dataBind: DataBind | ObjectDataBind;
11
- dataView: string;
12
- children?: controlIdMappingType;
13
- options: Array<OptionSetting>;
14
- };
15
- };
16
- export interface DataBindMappingTypeItem {
17
- controlId: string;
18
- dataViewId: string;
19
- fields: Array<DataBindMappingFieldItem>;
20
- }
21
- export interface DataBindMappingFieldItem {
22
- fieldCode: string;
23
- controlId: string;
24
- dataBind: DataBind | ObjectDataBind;
25
- dataViewId: string[];
26
- }
27
- export declare type dataBindMappingType = {
28
- [dataCode: string]: DataBindMappingTypeItem;
29
- };
30
- declare type StoreProps = {
31
- instance: RuntimeControl[];
32
- };
33
- declare class Store {
34
- readonly emptyState: StatesType;
35
- state: StatesType;
36
- dataBindMapping: dataBindMappingType;
37
- controlIdMapping: controlIdMappingType;
38
- readonly defaultState: StatesType;
39
- constructor(props: StoreProps);
40
- /**
41
- * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
42
- * @param controlId 组件ID
43
- * @param value
44
- */
45
- setState(controlId: string, value: unknown, rowIndex?: number): void;
46
- getState(controlId: string, rowIndex?: number): unknown;
47
- getEmptyState(controlId: string): Object | undefined;
48
- getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
49
- }
50
- export { Store };
1
+ import { RuntimeControl, DataBind, ObjectDataBind, OptionSetting } from '@byteluck-fe/model-driven-core';
2
+ export type StateType = {
3
+ [controlId: string]: unknown;
4
+ };
5
+ export type StatesType = {
6
+ [dataViewId: string]: StateType;
7
+ };
8
+ export type controlIdMappingType = {
9
+ [controlId: string]: {
10
+ dataBind: DataBind | ObjectDataBind;
11
+ dataView: string;
12
+ children?: controlIdMappingType;
13
+ options: Array<OptionSetting>;
14
+ };
15
+ };
16
+ export interface DataBindMappingTypeItem {
17
+ controlId: string;
18
+ dataViewId: string;
19
+ fields: Array<DataBindMappingFieldItem>;
20
+ }
21
+ export interface DataBindMappingFieldItem {
22
+ fieldCode: string;
23
+ controlId: string;
24
+ dataBind: DataBind | ObjectDataBind;
25
+ dataViewId: string[];
26
+ }
27
+ export type dataBindMappingType = {
28
+ [dataCode: string]: DataBindMappingTypeItem;
29
+ };
30
+ type StoreProps = {
31
+ instance: RuntimeControl[];
32
+ };
33
+ declare class Store {
34
+ readonly emptyState: StatesType;
35
+ state: StatesType;
36
+ dataBindMapping: dataBindMappingType;
37
+ controlIdMapping: controlIdMappingType;
38
+ readonly defaultState: StatesType;
39
+ constructor(props: StoreProps);
40
+ /**
41
+ * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
42
+ * @param controlId 组件ID
43
+ * @param value
44
+ */
45
+ setState(controlId: string, value: unknown, rowIndex?: number): void;
46
+ getState(controlId: string, rowIndex?: number): unknown;
47
+ getEmptyState(controlId: string): Object | undefined;
48
+ getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
49
+ }
50
+ export { Store };
@@ -1,3 +1,3 @@
1
- import { FieldTypes } from '@byteluck-fe/model-driven-shared';
2
- export declare function checkerValue(fieldType: FieldTypes, key: string, value: unknown, oldValue: unknown): unknown;
3
- export declare function checkerSubtableValue(fieldTypeMap: Record<string, FieldTypes>, value: Record<string, any>, emptyValue: Record<string, any>): Record<string, any>;
1
+ import { FieldTypes } from '@byteluck-fe/model-driven-shared';
2
+ export declare function checkerValue(fieldType: FieldTypes, key: string, value: unknown, oldValue: unknown): unknown;
3
+ export declare function checkerSubtableValue(fieldTypeMap: Record<string, FieldTypes>, value: Record<string, any>, emptyValue: Record<string, any>): Record<string, any>;
@@ -1,2 +1,2 @@
1
- export * from './Engine';
2
- export * from './Plugin';
1
+ export * from './Engine';
2
+ export * from './Plugin';