@byteluck-fe/model-driven-engine 6.1.0-1-beta.7 → 6.1.0-2-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 +30 -30
- package/dist/esm/common/Engine.js +52 -52
- package/dist/esm/common/Runtime.js +2 -2
- package/dist/esm/common/Store.js +5 -6
- package/dist/esm/common/proxyState.js +18 -18
- package/dist/esm/plugins/CalcPlugin.js +43 -43
- package/dist/esm/plugins/StylePlugin.js +6 -6
- package/dist/index.umd.js +1 -1
- package/dist/types/common/ActionManager.d.ts +14 -14
- package/dist/types/common/DataManager.d.ts +10 -10
- package/dist/types/common/Engine.d.ts +201 -201
- package/dist/types/common/OkWorker.d.ts +13 -13
- package/dist/types/common/Plugin.d.ts +6 -6
- package/dist/types/common/Runtime.d.ts +31 -31
- package/dist/types/common/Store.d.ts +54 -54
- package/dist/types/common/checkerValue.d.ts +3 -3
- package/dist/types/common/index.d.ts +2 -2
- package/dist/types/common/proxyState.d.ts +30 -30
- package/dist/types/index.d.ts +3 -3
- package/dist/types/plugins/CalcPlugin.d.ts +121 -121
- package/dist/types/plugins/ControlsEventPlugin.d.ts +17 -17
- package/dist/types/plugins/ES6ModulePlugin.d.ts +27 -27
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +15 -15
- package/dist/types/plugins/StylePlugin.d.ts +13 -13
- package/dist/types/plugins/index.d.ts +5 -5
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/runtimeUtils.d.ts +5 -5
- package/package.json +3 -3
|
@@ -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';
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { RuntimeControl, RuntimeFormControl, ControlRuntimeInstance } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
import { InstanceMap } from './Runtime';
|
|
3
|
-
export type ArrayApi = 'splice' | 'push' | 'shift' | 'pop' | 'unshift' | 'reverse';
|
|
4
|
-
/**
|
|
5
|
-
* @param state 当前正在操作的state数据
|
|
6
|
-
* @param key 当前操作的state的key 这个key是从store.state开始的
|
|
7
|
-
* @param type 如果state是数组,并且直接操作api的话,会携带type参数,代表当前操作的数组的某个api
|
|
8
|
-
* @param args 如果state是数组,并且直接操作api的话,会携带args参数,代表当前操作的api的参数
|
|
9
|
-
*/
|
|
10
|
-
type Callback = (state: object, key: string, type?: ArrayApi | unknown, args?: unknown[], result?: unknown) => void;
|
|
11
|
-
type BeforeSetCallback = (state: object, key: string, newValue: unknown, oldValue: unknown) => never | unknown;
|
|
12
|
-
export declare const engineProxyFlag: unique symbol;
|
|
13
|
-
export declare const engineTargetKey: unique symbol;
|
|
14
|
-
export declare const engineArrayBeforeSetCallbackFlag: unique symbol;
|
|
15
|
-
export declare const engineProxyThisKey: unique symbol;
|
|
16
|
-
/**
|
|
17
|
-
* 代理state数据
|
|
18
|
-
* @param state 数据对象
|
|
19
|
-
* @param callback 触发set时候的回调函数
|
|
20
|
-
* @param beforeSetCallback
|
|
21
|
-
* @param prevKey 递归对象的key
|
|
22
|
-
* */
|
|
23
|
-
export declare function proxyState<T extends object>(state: T, callback: Callback, beforeSetCallback: BeforeSetCallback, prevKey?: string): T;
|
|
24
|
-
/**
|
|
25
|
-
* 在flatInstance中通过key查找出对应的instance
|
|
26
|
-
* @param flatInstance 拍平的instance数组
|
|
27
|
-
* @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
|
|
28
|
-
* */
|
|
29
|
-
export declare function findItem(flatInstance: RuntimeControl[], key: string, instanceMap: InstanceMap): undefined | RuntimeFormControl | ControlRuntimeInstance<'subtable'>;
|
|
30
|
-
export {};
|
|
1
|
+
import { RuntimeControl, RuntimeFormControl, ControlRuntimeInstance } from '@byteluck-fe/model-driven-core';
|
|
2
|
+
import { InstanceMap } from './Runtime';
|
|
3
|
+
export type ArrayApi = 'splice' | 'push' | 'shift' | 'pop' | 'unshift' | 'reverse';
|
|
4
|
+
/**
|
|
5
|
+
* @param state 当前正在操作的state数据
|
|
6
|
+
* @param key 当前操作的state的key 这个key是从store.state开始的
|
|
7
|
+
* @param type 如果state是数组,并且直接操作api的话,会携带type参数,代表当前操作的数组的某个api
|
|
8
|
+
* @param args 如果state是数组,并且直接操作api的话,会携带args参数,代表当前操作的api的参数
|
|
9
|
+
*/
|
|
10
|
+
type Callback = (state: object, key: string, type?: ArrayApi | unknown, args?: unknown[], result?: unknown) => void;
|
|
11
|
+
type BeforeSetCallback = (state: object, key: string, newValue: unknown, oldValue: unknown) => never | unknown;
|
|
12
|
+
export declare const engineProxyFlag: unique symbol;
|
|
13
|
+
export declare const engineTargetKey: unique symbol;
|
|
14
|
+
export declare const engineArrayBeforeSetCallbackFlag: unique symbol;
|
|
15
|
+
export declare const engineProxyThisKey: unique symbol;
|
|
16
|
+
/**
|
|
17
|
+
* 代理state数据
|
|
18
|
+
* @param state 数据对象
|
|
19
|
+
* @param callback 触发set时候的回调函数
|
|
20
|
+
* @param beforeSetCallback
|
|
21
|
+
* @param prevKey 递归对象的key
|
|
22
|
+
* */
|
|
23
|
+
export declare function proxyState<T extends object>(state: T, callback: Callback, beforeSetCallback: BeforeSetCallback, prevKey?: string): T;
|
|
24
|
+
/**
|
|
25
|
+
* 在flatInstance中通过key查找出对应的instance
|
|
26
|
+
* @param flatInstance 拍平的instance数组
|
|
27
|
+
* @param key 操作的数据在state的key - 可以是深层次的 subtable.0.input等
|
|
28
|
+
* */
|
|
29
|
+
export declare function findItem(flatInstance: RuntimeControl[], key: string, instanceMap: InstanceMap): undefined | RuntimeFormControl | ControlRuntimeInstance<'subtable'>;
|
|
30
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './common';
|
|
2
|
-
export * from './plugins';
|
|
3
|
-
export * from './utils';
|
|
1
|
+
export * from './common';
|
|
2
|
+
export * from './plugins';
|
|
3
|
+
export * from './utils';
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
import { Engine, Plugin } from '../common';
|
|
2
|
-
import { Language } from '@byteluck-fe/model-driven-core';
|
|
3
|
-
declare enum DisplayType {
|
|
4
|
-
/**
|
|
5
|
-
* 完全等于
|
|
6
|
-
*/
|
|
7
|
-
EQ = "EQ",
|
|
8
|
-
/**
|
|
9
|
-
* 包含
|
|
10
|
-
* */
|
|
11
|
-
IN = "IN"
|
|
12
|
-
}
|
|
13
|
-
interface DisplayItem {
|
|
14
|
-
id: string;
|
|
15
|
-
show_edit: boolean;
|
|
16
|
-
explain: Language;
|
|
17
|
-
control_id: string;
|
|
18
|
-
control_in_subtable: boolean;
|
|
19
|
-
type: DisplayType;
|
|
20
|
-
option_ids: string[];
|
|
21
|
-
is_remember: boolean;
|
|
22
|
-
show_controls: string[];
|
|
23
|
-
hide_controls: string[];
|
|
24
|
-
}
|
|
25
|
-
interface BehaviorItem {
|
|
26
|
-
/**
|
|
27
|
-
* 0: 不控制,走控件 1: 隐藏 2:只读 6:可编辑
|
|
28
|
-
* */
|
|
29
|
-
ctrlBehavior: 0 | 1 | 2 | 6;
|
|
30
|
-
ctrlId: string;
|
|
31
|
-
}
|
|
32
|
-
interface CalcPluginProps {
|
|
33
|
-
displayBoList: DisplayItem[];
|
|
34
|
-
behavior: BehaviorItem[];
|
|
35
|
-
}
|
|
36
|
-
export declare class CalcPlugin implements Plugin {
|
|
37
|
-
private engine;
|
|
38
|
-
private options;
|
|
39
|
-
/**
|
|
40
|
-
* 所有的计算公式控件
|
|
41
|
-
* */
|
|
42
|
-
private calcControls;
|
|
43
|
-
/**
|
|
44
|
-
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
45
|
-
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
46
|
-
* */
|
|
47
|
-
private dependenciesTriggerMap;
|
|
48
|
-
/**
|
|
49
|
-
* 隐藏以后需要被计算的控件
|
|
50
|
-
* */
|
|
51
|
-
private hideNotRememberControlIds;
|
|
52
|
-
private dontHasPermissionControlIds;
|
|
53
|
-
private cacheComputedResult;
|
|
54
|
-
constructor(options: CalcPluginProps);
|
|
55
|
-
/**
|
|
56
|
-
* @description 获取显隐控制的需要被记住值的控件id
|
|
57
|
-
* */
|
|
58
|
-
private getNeedHideRememberControlIds;
|
|
59
|
-
/**
|
|
60
|
-
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
61
|
-
* */
|
|
62
|
-
private getDontHasPermissionControlIds;
|
|
63
|
-
/**
|
|
64
|
-
* @description 判断控件是否需要被计算
|
|
65
|
-
* @param control 控件
|
|
66
|
-
* */
|
|
67
|
-
private controlNeedComputedValue;
|
|
68
|
-
/**
|
|
69
|
-
* @description 获取控件是否被隐藏
|
|
70
|
-
* @param control 控件
|
|
71
|
-
* */
|
|
72
|
-
private getControlIsHide;
|
|
73
|
-
apply(engine: Engine): void;
|
|
74
|
-
/**
|
|
75
|
-
* @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
|
|
76
|
-
* */
|
|
77
|
-
private resetDependencies;
|
|
78
|
-
/**
|
|
79
|
-
* @description 执行所有计算公式控件的计算
|
|
80
|
-
* */
|
|
81
|
-
private allCalcControlComputed;
|
|
82
|
-
/**
|
|
83
|
-
* @description 获取所有的计算公式控件
|
|
84
|
-
* */
|
|
85
|
-
private getAllCalcControl;
|
|
86
|
-
/**
|
|
87
|
-
* @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
|
|
88
|
-
* */
|
|
89
|
-
private getCalcDependencies;
|
|
90
|
-
private setDependenciesTriggerMapItem;
|
|
91
|
-
private getCalcControlsFromSubtableRows;
|
|
92
|
-
/**
|
|
93
|
-
* @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
|
|
94
|
-
* */
|
|
95
|
-
private watchSchemaHideChange;
|
|
96
|
-
/**
|
|
97
|
-
* @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
|
|
98
|
-
* */
|
|
99
|
-
private watchSubtableChange;
|
|
100
|
-
/**
|
|
101
|
-
* @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
|
|
102
|
-
* */
|
|
103
|
-
private watchControlChange;
|
|
104
|
-
/**
|
|
105
|
-
* @description 控件在明细子表内
|
|
106
|
-
* */
|
|
107
|
-
private controlInSubtable;
|
|
108
|
-
/**
|
|
109
|
-
* @description 执行计算公式的计算
|
|
110
|
-
* */
|
|
111
|
-
private computedCalcValue;
|
|
112
|
-
/**
|
|
113
|
-
* @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
|
|
114
|
-
* */
|
|
115
|
-
private getNumberValue;
|
|
116
|
-
/**
|
|
117
|
-
* 计算明细子表最大值最小值平均值总和
|
|
118
|
-
* */
|
|
119
|
-
private getAggregateTypeValue;
|
|
120
|
-
}
|
|
121
|
-
export {};
|
|
1
|
+
import { Engine, Plugin } from '../common';
|
|
2
|
+
import { Language } from '@byteluck-fe/model-driven-core';
|
|
3
|
+
declare enum DisplayType {
|
|
4
|
+
/**
|
|
5
|
+
* 完全等于
|
|
6
|
+
*/
|
|
7
|
+
EQ = "EQ",
|
|
8
|
+
/**
|
|
9
|
+
* 包含
|
|
10
|
+
* */
|
|
11
|
+
IN = "IN"
|
|
12
|
+
}
|
|
13
|
+
interface DisplayItem {
|
|
14
|
+
id: string;
|
|
15
|
+
show_edit: boolean;
|
|
16
|
+
explain: Language;
|
|
17
|
+
control_id: string;
|
|
18
|
+
control_in_subtable: boolean;
|
|
19
|
+
type: DisplayType;
|
|
20
|
+
option_ids: string[];
|
|
21
|
+
is_remember: boolean;
|
|
22
|
+
show_controls: string[];
|
|
23
|
+
hide_controls: string[];
|
|
24
|
+
}
|
|
25
|
+
interface BehaviorItem {
|
|
26
|
+
/**
|
|
27
|
+
* 0: 不控制,走控件 1: 隐藏 2:只读 6:可编辑
|
|
28
|
+
* */
|
|
29
|
+
ctrlBehavior: 0 | 1 | 2 | 6;
|
|
30
|
+
ctrlId: string;
|
|
31
|
+
}
|
|
32
|
+
interface CalcPluginProps {
|
|
33
|
+
displayBoList: DisplayItem[];
|
|
34
|
+
behavior: BehaviorItem[];
|
|
35
|
+
}
|
|
36
|
+
export declare class CalcPlugin implements Plugin {
|
|
37
|
+
private engine;
|
|
38
|
+
private options;
|
|
39
|
+
/**
|
|
40
|
+
* 所有的计算公式控件
|
|
41
|
+
* */
|
|
42
|
+
private calcControls;
|
|
43
|
+
/**
|
|
44
|
+
* key=控件id value=控件修改后需要触发重新计算的计算公式控件组成的数组
|
|
45
|
+
* 存储为一个Map,用于在控件change的时候,重新计算依赖的calc
|
|
46
|
+
* */
|
|
47
|
+
private dependenciesTriggerMap;
|
|
48
|
+
/**
|
|
49
|
+
* 隐藏以后需要被计算的控件
|
|
50
|
+
* */
|
|
51
|
+
private hideNotRememberControlIds;
|
|
52
|
+
private dontHasPermissionControlIds;
|
|
53
|
+
private cacheComputedResult;
|
|
54
|
+
constructor(options: CalcPluginProps);
|
|
55
|
+
/**
|
|
56
|
+
* @description 获取显隐控制的需要被记住值的控件id
|
|
57
|
+
* */
|
|
58
|
+
private getNeedHideRememberControlIds;
|
|
59
|
+
/**
|
|
60
|
+
* @description 获取权限控制的隐藏的字段,不需要参与计算
|
|
61
|
+
* */
|
|
62
|
+
private getDontHasPermissionControlIds;
|
|
63
|
+
/**
|
|
64
|
+
* @description 判断控件是否需要被计算
|
|
65
|
+
* @param control 控件
|
|
66
|
+
* */
|
|
67
|
+
private controlNeedComputedValue;
|
|
68
|
+
/**
|
|
69
|
+
* @description 获取控件是否被隐藏
|
|
70
|
+
* @param control 控件
|
|
71
|
+
* */
|
|
72
|
+
private getControlIsHide;
|
|
73
|
+
apply(engine: Engine): void;
|
|
74
|
+
/**
|
|
75
|
+
* @description 重置依赖,获取所有的计算公式控件,并根据计算公式获取控件依赖关系
|
|
76
|
+
* */
|
|
77
|
+
private resetDependencies;
|
|
78
|
+
/**
|
|
79
|
+
* @description 执行所有计算公式控件的计算
|
|
80
|
+
* */
|
|
81
|
+
private allCalcControlComputed;
|
|
82
|
+
/**
|
|
83
|
+
* @description 获取所有的计算公式控件
|
|
84
|
+
* */
|
|
85
|
+
private getAllCalcControl;
|
|
86
|
+
/**
|
|
87
|
+
* @description 获取计算公式控件依赖,组成 依赖=>[计算公式] 的Map结构
|
|
88
|
+
* */
|
|
89
|
+
private getCalcDependencies;
|
|
90
|
+
private setDependenciesTriggerMapItem;
|
|
91
|
+
private getCalcControlsFromSubtableRows;
|
|
92
|
+
/**
|
|
93
|
+
* @description 监听控件的显隐事件,把显隐会影响的控件触发一遍计算
|
|
94
|
+
* */
|
|
95
|
+
private watchSchemaHideChange;
|
|
96
|
+
/**
|
|
97
|
+
* @description 监听明细子表的change事件,把明细表会影响的控件触发一遍计算
|
|
98
|
+
* */
|
|
99
|
+
private watchSubtableChange;
|
|
100
|
+
/**
|
|
101
|
+
* @description 监听控件的change事件,当控件change的时候,取到控件会影响的计算公式,然后执行对应的计算
|
|
102
|
+
* */
|
|
103
|
+
private watchControlChange;
|
|
104
|
+
/**
|
|
105
|
+
* @description 控件在明细子表内
|
|
106
|
+
* */
|
|
107
|
+
private controlInSubtable;
|
|
108
|
+
/**
|
|
109
|
+
* @description 执行计算公式的计算
|
|
110
|
+
* */
|
|
111
|
+
private computedCalcValue;
|
|
112
|
+
/**
|
|
113
|
+
* @description 获取数字值,因为计算公式可以依赖计算公式和金额,所以需要从value中取到对应的值
|
|
114
|
+
* */
|
|
115
|
+
private getNumberValue;
|
|
116
|
+
/**
|
|
117
|
+
* 计算明细子表最大值最小值平均值总和
|
|
118
|
+
* */
|
|
119
|
+
private getAggregateTypeValue;
|
|
120
|
+
}
|
|
121
|
+
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Engine } from '../common/Engine';
|
|
2
|
-
import { Plugin } from '../common/Plugin';
|
|
3
|
-
import { CustomEventItem } from '@byteluck-fe/model-driven-shared';
|
|
4
|
-
export type ControlsEvent = {
|
|
5
|
-
[controlId: string]: {
|
|
6
|
-
[eventName: string]: string[];
|
|
7
|
-
};
|
|
8
|
-
};
|
|
9
|
-
export declare class ControlsEventPlugin implements Plugin {
|
|
10
|
-
private config;
|
|
11
|
-
private engine;
|
|
12
|
-
private customEvents;
|
|
13
|
-
constructor(config: ControlsEvent, customEvents: CustomEventItem[]);
|
|
14
|
-
apply(engine: Engine): void;
|
|
15
|
-
private engineAddEventListener;
|
|
16
|
-
private callControlEvent;
|
|
17
|
-
}
|
|
1
|
+
import { Engine } from '../common/Engine';
|
|
2
|
+
import { Plugin } from '../common/Plugin';
|
|
3
|
+
import { CustomEventItem } from '@byteluck-fe/model-driven-shared';
|
|
4
|
+
export type ControlsEvent = {
|
|
5
|
+
[controlId: string]: {
|
|
6
|
+
[eventName: string]: string[];
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare class ControlsEventPlugin implements Plugin {
|
|
10
|
+
private config;
|
|
11
|
+
private engine;
|
|
12
|
+
private customEvents;
|
|
13
|
+
constructor(config: ControlsEvent, customEvents: CustomEventItem[]);
|
|
14
|
+
apply(engine: Engine): void;
|
|
15
|
+
private engineAddEventListener;
|
|
16
|
+
private callControlEvent;
|
|
17
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { Engine, Plugin } from '../common';
|
|
2
|
-
export type VariableMap = {
|
|
3
|
-
[key: string]: any;
|
|
4
|
-
};
|
|
5
|
-
export type ActionConfig = {
|
|
6
|
-
module: {
|
|
7
|
-
compiled: string;
|
|
8
|
-
source: string;
|
|
9
|
-
type: 'FUNCTION';
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export type FuncMap = {
|
|
13
|
-
[key: string]: Function;
|
|
14
|
-
};
|
|
15
|
-
export type Module = {
|
|
16
|
-
funcMap: FuncMap;
|
|
17
|
-
variables: VariableMap;
|
|
18
|
-
};
|
|
19
|
-
export declare class ES6ModulePlugin implements Plugin {
|
|
20
|
-
private config;
|
|
21
|
-
private engine;
|
|
22
|
-
private env;
|
|
23
|
-
private eventJs;
|
|
24
|
-
constructor(config: ActionConfig, env: any, eventJs?: any);
|
|
25
|
-
apply(engine: Engine): void;
|
|
26
|
-
}
|
|
27
|
-
export declare function parseModule(action: ActionConfig, engine: Engine, env: any): Module | undefined;
|
|
1
|
+
import { Engine, Plugin } from '../common';
|
|
2
|
+
export type VariableMap = {
|
|
3
|
+
[key: string]: any;
|
|
4
|
+
};
|
|
5
|
+
export type ActionConfig = {
|
|
6
|
+
module: {
|
|
7
|
+
compiled: string;
|
|
8
|
+
source: string;
|
|
9
|
+
type: 'FUNCTION';
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export type FuncMap = {
|
|
13
|
+
[key: string]: Function;
|
|
14
|
+
};
|
|
15
|
+
export type Module = {
|
|
16
|
+
funcMap: FuncMap;
|
|
17
|
+
variables: VariableMap;
|
|
18
|
+
};
|
|
19
|
+
export declare class ES6ModulePlugin implements Plugin {
|
|
20
|
+
private config;
|
|
21
|
+
private engine;
|
|
22
|
+
private env;
|
|
23
|
+
private eventJs;
|
|
24
|
+
constructor(config: ActionConfig, env: any, eventJs?: any);
|
|
25
|
+
apply(engine: Engine): void;
|
|
26
|
+
}
|
|
27
|
+
export declare function parseModule(action: ActionConfig, engine: Engine, env: any): Module | undefined;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Engine, Plugin } from '../common';
|
|
2
|
-
export type LifecycleEvent = {
|
|
3
|
-
did_init: string[];
|
|
4
|
-
did_mount: string[];
|
|
5
|
-
did_submit: string[];
|
|
6
|
-
will_submit: string[];
|
|
7
|
-
do_submit: string[];
|
|
8
|
-
};
|
|
9
|
-
export declare class LifecycleEventPlugin implements Plugin {
|
|
10
|
-
private config;
|
|
11
|
-
private engine;
|
|
12
|
-
constructor(config: LifecycleEvent);
|
|
13
|
-
apply(engine: Engine): void;
|
|
14
|
-
private callLifecycleEvent;
|
|
15
|
-
}
|
|
1
|
+
import { Engine, Plugin } from '../common';
|
|
2
|
+
export type LifecycleEvent = {
|
|
3
|
+
did_init: string[];
|
|
4
|
+
did_mount: string[];
|
|
5
|
+
did_submit: string[];
|
|
6
|
+
will_submit: string[];
|
|
7
|
+
do_submit: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare class LifecycleEventPlugin implements Plugin {
|
|
10
|
+
private config;
|
|
11
|
+
private engine;
|
|
12
|
+
constructor(config: LifecycleEvent);
|
|
13
|
+
apply(engine: Engine): void;
|
|
14
|
+
private callLifecycleEvent;
|
|
15
|
+
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Engine, Plugin } from '../common';
|
|
2
|
-
export type StyleConfig = {
|
|
3
|
-
compiled: string;
|
|
4
|
-
source: string;
|
|
5
|
-
type: 'CSS';
|
|
6
|
-
};
|
|
7
|
-
export declare class StylePlugin implements Plugin {
|
|
8
|
-
private config;
|
|
9
|
-
private engine;
|
|
10
|
-
private isPc;
|
|
11
|
-
constructor(config: StyleConfig, isPC?: boolean);
|
|
12
|
-
apply(engine: Engine): void;
|
|
13
|
-
}
|
|
1
|
+
import { Engine, Plugin } from '../common';
|
|
2
|
+
export type StyleConfig = {
|
|
3
|
+
compiled: string;
|
|
4
|
+
source: string;
|
|
5
|
+
type: 'CSS';
|
|
6
|
+
};
|
|
7
|
+
export declare class StylePlugin implements Plugin {
|
|
8
|
+
private config;
|
|
9
|
+
private engine;
|
|
10
|
+
private isPc;
|
|
11
|
+
constructor(config: StyleConfig, isPC?: boolean);
|
|
12
|
+
apply(engine: Engine): void;
|
|
13
|
+
}
|