@byteluck-fe/model-driven-engine 6.2.0-1-beta.24 → 6.2.0-1-beta-tree-data.2

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.
@@ -1,201 +1,201 @@
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 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
- messagesI18n: any;
44
- children: {
45
- [key: string]: Engine;
46
- };
47
- };
48
- 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' | 'engine-initialized' | 'engine-after-initialized' | 'file-actions' | string;
49
- declare class Engine extends Watcher<EventKeys> {
50
- private store;
51
- rawStore: Record<string, any>;
52
- parent?: Engine;
53
- runtime: Runtime;
54
- isMounted: boolean;
55
- id: string;
56
- readonly externalParams?: Record<string, any>;
57
- children: {
58
- [key: string]: Engine;
59
- };
60
- private __plugins;
61
- private __pluginsApplied;
62
- private readonly $options;
63
- private actionManager;
64
- private dataManager?;
65
- private _jobTasks;
66
- constructor(props: EngineProps);
67
- private debugLog;
68
- use(plugin: Plugin): this;
69
- registerControl(...arg: Parameters<Runtime['register']>): this;
70
- static register(control: ControlExport): typeof import("@byteluck-fe/model-driven-core").RegisterControls;
71
- static judgeControlIsRegistered(control: Parameters<(typeof Runtime)['register']>[0]): boolean;
72
- mount(): void;
73
- destroy(): void;
74
- private _handlerProxyState;
75
- private _proxyStateBeforeSetCallback;
76
- private _proxyStateCallback;
77
- private _handlerArrayUpdate;
78
- private _handlerSubtableUpdateUid;
79
- private _handlerObjectUpdate;
80
- private applyPlugins;
81
- listControlCreateRow<RowType extends ControlsKeys>(instance: RuntimeListControl, rowType: RowType): RuntimeControl | NonNullable<InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<RowType, "Runtime">>> | undefined;
82
- listControlAddRow(instance: RuntimeListControl, rowType?: ControlsKeys): void;
83
- emit(eventKey: EventKeys, payload: EventPayload): Promise<unknown[]>;
84
- on(key: EventKeys, callback: Callback): void;
85
- createControl(...args: Parameters<Runtime['createControl']>): never[];
86
- createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlsInstance<T, 'Runtime'> | undefined;
87
- 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;
88
- schemaEvent(eventKey: 'schema-change', payload: SchemaEventPayload): void;
89
- updateInstanceProps(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
90
- getRule(controlType: string, props: any): any[];
91
- getAllRules(controlId?: string): {
92
- rules: Record<string, import("async-validator").RuleItem>;
93
- antdRules: Record<string, import("async-validator").RuleItem>;
94
- fieldCodeRules: Record<string, import("async-validator").RuleItem>;
95
- defaultAntdRules: Record<string, import("async-validator").RuleItem>;
96
- defaultRule: Record<string, import("async-validator").RuleItem>;
97
- defaultFieldRules: Record<string, import("async-validator").RuleItem>;
98
- } | {
99
- rules: import("async-validator").Rules | undefined;
100
- antdRules: import("async-validator").Rules | undefined;
101
- };
102
- getRules(controlId?: string, isGetFieldCodeRules?: boolean): import("async-validator").RuleItem | import("async-validator").RuleItem[] | import("async-validator").Rules | undefined;
103
- getAntdRules(controlId?: string): import("async-validator").Rules | undefined;
104
- getState(controlId?: string, rowIndex?: number): any;
105
- getEmptyState(controlId?: string): any;
106
- /**
107
- * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
108
- * @param options 需要携带的options
109
- * */
110
- setPayloadOptions(options: object | null): void;
111
- setState(controlId: string, value: unknown, rowIndex?: number, options?: any): void;
112
- /**
113
- * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
114
- * @param states
115
- */
116
- setStates(states: StatesType | StateType, rowIndex?: number, options?: any): void;
117
- /**
118
- * 通过dataCode和fieldCode来获取控件的值
119
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
120
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
121
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
122
- * */
123
- getField(dataCode: string, fieldCode?: string, rowIndex?: number): unknown;
124
- getData(dataCode: string): any;
125
- /**
126
- * 通过dataCode和fieldCode来设置控件的值
127
- * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
128
- * @param fieldCode 字段编码 - 控件绑定的数据项的编码
129
- * @param value 修改的值
130
- * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
131
- * @param options 触发事件携带的参数
132
- * */
133
- setField(dataCode: string, fieldCode: string, value: unknown, rowIndex?: number, options?: EventPayload['options']): void;
134
- /**
135
- * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
136
- * @param dataCode 需要赋值的目标模型
137
- * @param state 赋值对象,以fieldCode为key组成的对象
138
- * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
139
- * @param options 触发事件携带的参数
140
- * */
141
- setFields(dataCode: string, state: FieldSetType, rowIndex?: number, options?: EventPayload['options']): void;
142
- /**
143
- * 通过dataCode来将state转化为标准的state结构
144
- * @param dataCode 需要转换的目标模型code
145
- * @param state 值对象,以fieldCode为key组成的对象
146
- * */
147
- buildFields(dataCode: string, state: FieldSetType): StateType | undefined;
148
- /**
149
- * 向Store设置一组值,并触发事件携带options
150
- * @param dataSet
151
- * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
152
- */
153
- setData(dataSet: dataSetType, options?: any): void;
154
- /**
155
- * 获取控件的dataBind
156
- * @param controlId
157
- * */
158
- getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
159
- /**
160
- * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
161
- * @param controlId
162
- * @param rowIndex
163
- */
164
- getInstance(controlId?: string, rowIndex?: number): ControlRuntimeInstance<ControlsKeys> | undefined;
165
- /**
166
- * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
167
- * @param controlId
168
- * @param header 明细表内是否获取表头的控件
169
- */
170
- getInstances(controlId?: string, header?: boolean): ControlRuntimeInstance<ControlsKeys>[];
171
- setInstance(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
172
- getControlIdMapping(): import("./Store").controlIdMappingType;
173
- getDataBindMapping(): dataBindMappingType;
174
- getDataBindMapping(dataCode: string): DataBindMappingTypeItem | undefined;
175
- getDataBindMapping(dataCode: string, fieldCode: string): DataBindMappingFieldItem | undefined;
176
- getAction(): ActionManager;
177
- initDataManager(callbackExecuter: (payload: EventPayload) => Promise<any>): void;
178
- getDataManager(): DataManager | undefined;
179
- /**
180
- * 判断控件的类型,返回当前控件的正确类型
181
- * */
182
- assertInstance<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, types: T | T[]): instance is ControlRuntimeInstance<T>;
183
- /**
184
- * 判断控件或控件类型是一个自定义控件
185
- * */
186
- assertInstanceIsCustomControl(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl): boolean;
187
- /**
188
- * 获取控件在明细子表中的行下标,
189
- * 如果控件在表头内,则返回-1
190
- * 如果控件在表内,则返回行下标
191
- * 如果控件不在明细表内,则返回undefined
192
- * */
193
- getInstanceRowIndex<T extends ControlRuntimeInstance<ControlsKeys>>(instance: T | RuntimeControl): number | undefined;
194
- getInstanceParentControl<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, controlType: T): ControlRuntimeInstance<T> | undefined;
195
- getInstanceInSubtableHeader<T extends ControlsKeys, K extends ControlRuntimeInstance<T>, U extends ControlRuntimeInstance<ControlsKeys>>(instance: K | RuntimeControl): K | undefined;
196
- setControlConfig(...args: Parameters<Runtime['registerControlConfig']>): Runtime;
197
- getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
198
- inList(controlId: string): string | undefined;
199
- findSubtableHeadersControl(controlId: string): undefined;
200
- }
201
- export { Engine, EventPayload, SchemaEventPayload, EngineProps };
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 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
+ messagesI18n: any;
44
+ children: {
45
+ [key: string]: Engine;
46
+ };
47
+ };
48
+ 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' | 'engine-initialized' | 'engine-after-initialized' | 'file-actions' | string;
49
+ declare class Engine extends Watcher<EventKeys> {
50
+ private store;
51
+ rawStore: Record<string, any>;
52
+ parent?: Engine;
53
+ runtime: Runtime;
54
+ isMounted: boolean;
55
+ id: string;
56
+ readonly externalParams?: Record<string, any>;
57
+ children: {
58
+ [key: string]: Engine;
59
+ };
60
+ private __plugins;
61
+ private __pluginsApplied;
62
+ private readonly $options;
63
+ private actionManager;
64
+ private dataManager?;
65
+ private _jobTasks;
66
+ constructor(props: EngineProps);
67
+ private debugLog;
68
+ use(plugin: Plugin): this;
69
+ registerControl(...arg: Parameters<Runtime['register']>): this;
70
+ static register(control: ControlExport): typeof import("@byteluck-fe/model-driven-core").RegisterControls;
71
+ static judgeControlIsRegistered(control: Parameters<(typeof Runtime)['register']>[0]): boolean;
72
+ mount(): void;
73
+ destroy(): void;
74
+ private _handlerProxyState;
75
+ private _proxyStateBeforeSetCallback;
76
+ private _proxyStateCallback;
77
+ private _handlerArrayUpdate;
78
+ private _handlerSubtableUpdateUid;
79
+ private _handlerObjectUpdate;
80
+ private applyPlugins;
81
+ listControlCreateRow<RowType extends ControlsKeys>(instance: RuntimeListControl, rowType: RowType): RuntimeControl | NonNullable<InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<RowType, "Runtime">>> | undefined;
82
+ listControlAddRow(instance: RuntimeListControl, rowType?: ControlsKeys): void;
83
+ emit(eventKey: EventKeys, payload: EventPayload): Promise<unknown[]>;
84
+ on(key: EventKeys, callback: Callback): void;
85
+ createControl(...args: Parameters<Runtime['createControl']>): never[];
86
+ createInstance<T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>): ControlsInstance<T, 'Runtime'> | undefined;
87
+ createControlInstance: <T extends ControlsKeys>(type: T, initSchema?: DeepPartial<Schema<T>>) => ControlsInstance<T, "Runtime"> | undefined;
88
+ schemaEvent(eventKey: 'schema-change', payload: SchemaEventPayload): void;
89
+ updateInstanceProps(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
90
+ getRule(controlType: string, props: any): any[];
91
+ getAllRules(controlId?: string): {
92
+ rules: Record<string, import("async-validator").RuleItem>;
93
+ antdRules: Record<string, import("async-validator").RuleItem>;
94
+ fieldCodeRules: Record<string, import("async-validator").RuleItem>;
95
+ defaultAntdRules: Record<string, import("async-validator").RuleItem>;
96
+ defaultRule: Record<string, import("async-validator").RuleItem>;
97
+ defaultFieldRules: Record<string, import("async-validator").RuleItem>;
98
+ } | {
99
+ rules: import("async-validator").Rules | undefined;
100
+ antdRules: import("async-validator").Rules | undefined;
101
+ };
102
+ getRules(controlId?: string, isGetFieldCodeRules?: boolean): import("async-validator").RuleItem | import("async-validator").RuleItem[] | import("async-validator").Rules | undefined;
103
+ getAntdRules(controlId?: string): import("async-validator").Rules | undefined;
104
+ getState(controlId?: string, rowIndex?: number): any;
105
+ getEmptyState(controlId?: string): any;
106
+ /**
107
+ * 设置payload的options,提供在不是使用标准api修改state的时候可以传递options,会在本次任务执行完成之后清空
108
+ * @param options 需要携带的options
109
+ * */
110
+ setPayloadOptions(options: object | null): void;
111
+ setState(controlId: string, value: unknown, rowIndex?: number, options?: any): void;
112
+ /**
113
+ * 向Store设置一组值,明细表必须全量赋值,并触发事件(触发事件是根据组件在页面中的顺序逐个触发)
114
+ * @param states
115
+ */
116
+ setStates(states: StatesType | StateType, rowIndex?: number, options?: any): void;
117
+ /**
118
+ * 通过dataCode和fieldCode来获取控件的值
119
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
120
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
121
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
122
+ * */
123
+ getField(dataCode: string, fieldCode?: string, rowIndex?: number): unknown;
124
+ getData(dataCode: string): any;
125
+ /**
126
+ * 通过dataCode和fieldCode来设置控件的值
127
+ * @param dataCode 模型编码 - 如果是主表的话就是主表的模型编码,明细子表的话就是子表的模型编码
128
+ * @param fieldCode 字段编码 - 控件绑定的数据项的编码
129
+ * @param value 修改的值
130
+ * @param rowIndex 行下标 - 如果是明细子表中的控件需要提供
131
+ * @param options 触发事件携带的参数
132
+ * */
133
+ setField(dataCode: string, fieldCode: string, value: unknown, rowIndex?: number, options?: EventPayload['options']): void;
134
+ /**
135
+ * 通过dataCode和 state来给一组控件赋值,并触发事件携带options
136
+ * @param dataCode 需要赋值的目标模型
137
+ * @param state 赋值对象,以fieldCode为key组成的对象
138
+ * @param rowIndex 行下标,给明细子表赋值时指定赋值某行
139
+ * @param options 触发事件携带的参数
140
+ * */
141
+ setFields(dataCode: string, state: FieldSetType, rowIndex?: number, options?: EventPayload['options']): void;
142
+ /**
143
+ * 通过dataCode来将state转化为标准的state结构
144
+ * @param dataCode 需要转换的目标模型code
145
+ * @param state 值对象,以fieldCode为key组成的对象
146
+ * */
147
+ buildFields(dataCode: string, state: FieldSetType): StateType | undefined;
148
+ /**
149
+ * 向Store设置一组值,并触发事件携带options
150
+ * @param dataSet
151
+ * @options 传递给关联事件中 EventPayload中的options,一般在plugin中监听使用
152
+ */
153
+ setData(dataSet: dataSetType, options?: any): void;
154
+ /**
155
+ * 获取控件的dataBind
156
+ * @param controlId
157
+ * */
158
+ getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
159
+ /**
160
+ * 获取组件实例,传入rowIndex代表获取明细表内的控件实例,rowIndex传入-1代表获取表头内的实例
161
+ * @param controlId
162
+ * @param rowIndex
163
+ */
164
+ getInstance(controlId?: string, rowIndex?: number): ControlRuntimeInstance<ControlsKeys> | undefined;
165
+ /**
166
+ * 获取组件实例,明细表中的组件将会得到数组, 第二个参数为(false/不传入)则获取到的是明细表内不包含表头内实例的所有控件实例,传入true则获取到包含表头内实例的所有控件实例,表头内实例永远在下标0的位置
167
+ * @param controlId
168
+ * @param header 明细表内是否获取表头的控件
169
+ */
170
+ getInstances(controlId?: string, header?: boolean): ControlRuntimeInstance<ControlsKeys>[];
171
+ setInstance(instance: SchemaEventPayload['instance'] | string, props: string, value: unknown, rowIndex?: number): void;
172
+ getControlIdMapping(): import("./Store").controlIdMappingType;
173
+ getDataBindMapping(): dataBindMappingType;
174
+ getDataBindMapping(dataCode: string): DataBindMappingTypeItem | undefined;
175
+ getDataBindMapping(dataCode: string, fieldCode: string): DataBindMappingFieldItem | undefined;
176
+ getAction(): ActionManager;
177
+ initDataManager(callbackExecuter: (payload: EventPayload) => Promise<any>): void;
178
+ getDataManager(): DataManager | undefined;
179
+ /**
180
+ * 判断控件的类型,返回当前控件的正确类型
181
+ * */
182
+ assertInstance<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, types: T | T[]): instance is ControlRuntimeInstance<T>;
183
+ /**
184
+ * 判断控件或控件类型是一个自定义控件
185
+ * */
186
+ assertInstanceIsCustomControl(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl): boolean;
187
+ /**
188
+ * 获取控件在明细子表中的行下标,
189
+ * 如果控件在表头内,则返回-1
190
+ * 如果控件在表内,则返回行下标
191
+ * 如果控件不在明细表内,则返回undefined
192
+ * */
193
+ getInstanceRowIndex<T extends ControlRuntimeInstance<ControlsKeys>>(instance: T | RuntimeControl): number | undefined;
194
+ getInstanceParentControl<T extends ControlsKeys>(instance: ControlRuntimeInstance<ControlsKeys> | RuntimeControl, controlType: T): ControlRuntimeInstance<T> | undefined;
195
+ getInstanceInSubtableHeader<T extends ControlsKeys, K extends ControlRuntimeInstance<T>, U extends ControlRuntimeInstance<ControlsKeys>>(instance: K | RuntimeControl): K | undefined;
196
+ setControlConfig(...args: Parameters<Runtime['registerControlConfig']>): Runtime;
197
+ getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
198
+ inList(controlId: string): string | undefined;
199
+ findSubtableHeadersControl(controlId: string): undefined;
200
+ }
201
+ 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,31 +1,31 @@
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
- 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
- fieldCodeRules: Record<string, RuleItem>;
24
- defaultAntdRules: Record<string, RuleItem>;
25
- defaultRule: Record<string, RuleItem>;
26
- defaultFieldRules: Record<string, RuleItem>;
27
- };
28
- get rules(): Record<string, RuleItem>;
29
- get fieldCodeRules(): Record<string, RuleItem>;
30
- get antdRules(): Record<string, RuleItem>;
31
- }
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
+ 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
+ fieldCodeRules: Record<string, RuleItem>;
24
+ defaultAntdRules: Record<string, RuleItem>;
25
+ defaultRule: Record<string, RuleItem>;
26
+ defaultFieldRules: Record<string, RuleItem>;
27
+ };
28
+ get rules(): Record<string, RuleItem>;
29
+ get fieldCodeRules(): Record<string, RuleItem>;
30
+ get antdRules(): Record<string, RuleItem>;
31
+ }
@@ -1,54 +1,54 @@
1
- import { RuntimeControl, DataBind, ObjectDataBind, OptionSetting, ControlRuntimeInstance, ControlsKeys } 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
- export type SubtableHeadersControlIdMapping = {
31
- [controlId: string]: ControlRuntimeInstance<ControlsKeys>;
32
- };
33
- type StoreProps = {
34
- instance: RuntimeControl[];
35
- };
36
- declare class Store {
37
- readonly emptyState: StatesType;
38
- state: StatesType;
39
- dataBindMapping: dataBindMappingType;
40
- controlIdMapping: controlIdMappingType;
41
- subtableHeadersControlIdMapping: SubtableHeadersControlIdMapping;
42
- readonly defaultState: StatesType;
43
- constructor(props: StoreProps);
44
- /**
45
- * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
46
- * @param controlId 组件ID
47
- * @param value
48
- */
49
- setState(controlId: string, value: unknown, rowIndex?: number): void;
50
- getState(controlId: string, rowIndex?: number): any;
51
- getEmptyState(controlId: string): Object | undefined;
52
- getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
53
- }
54
- export { Store };
1
+ import { RuntimeControl, DataBind, ObjectDataBind, OptionSetting, ControlRuntimeInstance, ControlsKeys } 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
+ export type SubtableHeadersControlIdMapping = {
31
+ [controlId: string]: ControlRuntimeInstance<ControlsKeys>;
32
+ };
33
+ type StoreProps = {
34
+ instance: RuntimeControl[];
35
+ };
36
+ declare class Store {
37
+ readonly emptyState: StatesType;
38
+ state: StatesType;
39
+ dataBindMapping: dataBindMappingType;
40
+ controlIdMapping: controlIdMappingType;
41
+ subtableHeadersControlIdMapping: SubtableHeadersControlIdMapping;
42
+ readonly defaultState: StatesType;
43
+ constructor(props: StoreProps);
44
+ /**
45
+ * 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
46
+ * @param controlId 组件ID
47
+ * @param value
48
+ */
49
+ setState(controlId: string, value: unknown, rowIndex?: number): void;
50
+ getState(controlId: string, rowIndex?: number): any;
51
+ getEmptyState(controlId: string): Object | undefined;
52
+ getDataBind(controlId: string): DataBind | ObjectDataBind | undefined;
53
+ }
54
+ 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';