@byteluck-fe/model-driven-engine 2.5.0-alpha.9 → 2.5.0-beta.4
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/dist/esm/common/ActionManager.js +40 -157
- package/dist/esm/common/DataManager.js +20 -129
- package/dist/esm/common/Engine.js +261 -379
- package/dist/esm/common/OkWorker.js +13 -27
- package/dist/esm/common/Runtime.js +11 -26
- package/dist/esm/common/Store.js +72 -51
- package/dist/esm/common/checkerValue.js +40 -40
- package/dist/esm/common/index.js +2 -2
- package/dist/esm/common/proxyState.js +47 -47
- package/dist/esm/index.js +3 -3
- package/dist/esm/plugins/CalcPlugin.js +66 -70
- package/dist/esm/plugins/ControlsEventPlugin.js +68 -191
- package/dist/esm/plugins/ES6ModulePlugin.js +8 -24
- package/dist/esm/plugins/LifecycleEventPlugin.js +64 -183
- package/dist/esm/plugins/StylePlugin.js +7 -22
- package/dist/esm/plugins/index.js +5 -5
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/runtimeUtils.js +7 -5
- package/dist/index.umd.js +8 -8
- package/dist/types/common/Engine.d.ts +7 -7
- package/dist/types/common/Runtime.d.ts +1 -1
- package/dist/types/common/Store.d.ts +6 -5
- package/dist/types/common/proxyState.d.ts +3 -3
- package/dist/types/plugins/ControlsEventPlugin.d.ts +1 -1
- package/dist/types/plugins/ES6ModulePlugin.d.ts +4 -4
- package/dist/types/plugins/LifecycleEventPlugin.d.ts +1 -1
- package/dist/types/plugins/StylePlugin.d.ts +1 -1
- package/package.json +4 -4
|
@@ -5,17 +5,17 @@ import { Runtime, RuntimeProps } from './Runtime';
|
|
|
5
5
|
import { DataBindMappingFieldItem, dataBindMappingType, DataBindMappingTypeItem, StatesType, StateType } from './Store';
|
|
6
6
|
import { ActionManager } from './ActionManager';
|
|
7
7
|
import { DataManager } from './DataManager';
|
|
8
|
-
export type getDataControlIdMappingType = {
|
|
8
|
+
export declare type getDataControlIdMappingType = {
|
|
9
9
|
[controlId: string]: {
|
|
10
10
|
dataBind: any;
|
|
11
11
|
dataView: string;
|
|
12
12
|
children: getDataControlIdMappingType;
|
|
13
13
|
};
|
|
14
14
|
};
|
|
15
|
-
type dataSetType = {
|
|
15
|
+
declare type dataSetType = {
|
|
16
16
|
[dataCode: string]: Record<string, unknown> | Record<string, unknown>[];
|
|
17
17
|
};
|
|
18
|
-
type FieldSetType = {
|
|
18
|
+
declare type FieldSetType = {
|
|
19
19
|
[fieldCode: string]: unknown;
|
|
20
20
|
};
|
|
21
21
|
interface EventPayload {
|
|
@@ -32,7 +32,7 @@ interface SchemaEventPayload {
|
|
|
32
32
|
props: string;
|
|
33
33
|
rowIndex?: number;
|
|
34
34
|
}
|
|
35
|
-
type EngineProps<T extends keyof LayoutControls = keyof LayoutControls> = {
|
|
35
|
+
declare type EngineProps<T extends keyof LayoutControls = keyof LayoutControls> = {
|
|
36
36
|
schema: RuntimeProps['schema'];
|
|
37
37
|
beforeCreateInstance?: RuntimeProps['beforeCreateInstance'];
|
|
38
38
|
plugins?: Plugin[];
|
|
@@ -41,7 +41,7 @@ type EngineProps<T extends keyof LayoutControls = keyof LayoutControls> = {
|
|
|
41
41
|
debug?: boolean;
|
|
42
42
|
externalParams?: Record<string, unknown>;
|
|
43
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;
|
|
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
45
|
declare class Engine extends Watcher<EventKeys> {
|
|
46
46
|
private store;
|
|
47
47
|
rawStore: Record<string, any>;
|
|
@@ -70,7 +70,7 @@ declare class Engine extends Watcher<EventKeys> {
|
|
|
70
70
|
private _handlerArrayUpdate;
|
|
71
71
|
private _handlerObjectUpdate;
|
|
72
72
|
private applyPlugins;
|
|
73
|
-
listControlCreateRow<RowType extends ControlsKeys>(instance: RuntimeListControl, rowType: RowType):
|
|
73
|
+
listControlCreateRow<RowType extends ControlsKeys>(instance: RuntimeListControl, rowType: RowType): InstanceType<import("@byteluck-fe/model-driven-core").ControlsConstructor<RowType, "Runtime">> | undefined;
|
|
74
74
|
listControlAddRow(instance: RuntimeListControl, rowType?: ControlsKeys): void;
|
|
75
75
|
emit(eventKey: EventKeys, payload: EventPayload): Promise<unknown[]>;
|
|
76
76
|
on(key: EventKeys, callback: Callback): void;
|
|
@@ -175,6 +175,6 @@ declare class Engine extends Watcher<EventKeys> {
|
|
|
175
175
|
getInstanceInSubtableHeader<T extends ControlsKeys>(instance: ControlRuntimeInstance<T> | RuntimeControl): ControlRuntimeInstance<T> | undefined;
|
|
176
176
|
setControlConfig(...args: Parameters<Runtime['registerControlConfig']>): Runtime;
|
|
177
177
|
getControlConfig(control: ControlsKeys): Readonly<Record<string, unknown>> | undefined;
|
|
178
|
-
inList(controlId: string):
|
|
178
|
+
inList(controlId: string): undefined;
|
|
179
179
|
}
|
|
180
180
|
export { Engine, EventPayload, SchemaEventPayload, EngineProps };
|
|
@@ -4,7 +4,7 @@ export interface RuntimeProps {
|
|
|
4
4
|
schema: any;
|
|
5
5
|
beforeCreateInstance?: BeforeCreateInstance;
|
|
6
6
|
}
|
|
7
|
-
export type InstanceMap = Record<string, ControlRuntimeInstance<ControlsKeys>[]>;
|
|
7
|
+
export declare type InstanceMap = Record<string, ControlRuntimeInstance<ControlsKeys>[]>;
|
|
8
8
|
export declare class Runtime extends RegisterControls<'Runtime'> {
|
|
9
9
|
private _schema;
|
|
10
10
|
private _instance;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { RuntimeControl, DataBind, ObjectDataBind, OptionSetting } from '@byteluck-fe/model-driven-core';
|
|
2
|
-
export type StateType = {
|
|
2
|
+
export declare type StateType = {
|
|
3
3
|
[controlId: string]: unknown;
|
|
4
4
|
};
|
|
5
|
-
export type StatesType = {
|
|
5
|
+
export declare type StatesType = {
|
|
6
6
|
[dataViewId: string]: StateType;
|
|
7
7
|
};
|
|
8
|
-
export type controlIdMappingType = {
|
|
8
|
+
export declare type controlIdMappingType = {
|
|
9
9
|
[controlId: string]: {
|
|
10
10
|
dataBind: DataBind | ObjectDataBind;
|
|
11
11
|
dataView: string;
|
|
@@ -24,10 +24,10 @@ export interface DataBindMappingFieldItem {
|
|
|
24
24
|
dataBind: DataBind | ObjectDataBind;
|
|
25
25
|
dataViewId: string[];
|
|
26
26
|
}
|
|
27
|
-
export type dataBindMappingType = {
|
|
27
|
+
export declare type dataBindMappingType = {
|
|
28
28
|
[dataCode: string]: DataBindMappingTypeItem;
|
|
29
29
|
};
|
|
30
|
-
type StoreProps = {
|
|
30
|
+
declare type StoreProps = {
|
|
31
31
|
instance: RuntimeControl[];
|
|
32
32
|
};
|
|
33
33
|
declare class Store {
|
|
@@ -35,6 +35,7 @@ declare class Store {
|
|
|
35
35
|
state: StatesType;
|
|
36
36
|
dataBindMapping: dataBindMappingType;
|
|
37
37
|
controlIdMapping: controlIdMappingType;
|
|
38
|
+
readonly defaultState: StatesType;
|
|
38
39
|
constructor(props: StoreProps);
|
|
39
40
|
/**
|
|
40
41
|
* 使用该方法仅改变数据,不会表单触发事件。明细表可全量赋值也可根据rowIndex进行单独设置
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { RuntimeControl, RuntimeFormControl, ControlRuntimeInstance } from '@byteluck-fe/model-driven-core';
|
|
2
2
|
import { InstanceMap } from './Runtime';
|
|
3
|
-
export type ArrayApi = 'splice' | 'push' | 'shift' | 'pop' | 'unshift' | 'reverse';
|
|
3
|
+
export declare type ArrayApi = 'splice' | 'push' | 'shift' | 'pop' | 'unshift' | 'reverse';
|
|
4
4
|
/**
|
|
5
5
|
* @param state 当前正在操作的state数据
|
|
6
6
|
* @param key 当前操作的state的key 这个key是从store.state开始的
|
|
7
7
|
* @param type 如果state是数组,并且直接操作api的话,会携带type参数,代表当前操作的数组的某个api
|
|
8
8
|
* @param args 如果state是数组,并且直接操作api的话,会携带args参数,代表当前操作的api的参数
|
|
9
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;
|
|
10
|
+
declare type Callback = (state: object, key: string, type?: ArrayApi | unknown, args?: unknown[], result?: unknown) => void;
|
|
11
|
+
declare type BeforeSetCallback = (state: object, key: string, newValue: unknown, oldValue: unknown) => never | unknown;
|
|
12
12
|
export declare const engineProxyFlag: unique symbol;
|
|
13
13
|
export declare const engineTargetKey: unique symbol;
|
|
14
14
|
export declare const engineArrayBeforeSetCallbackFlag: unique symbol;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Engine, Plugin } from '../common';
|
|
2
|
-
export type VariableMap = {
|
|
2
|
+
export declare type VariableMap = {
|
|
3
3
|
[key: string]: any;
|
|
4
4
|
};
|
|
5
|
-
export type ActionConfig = {
|
|
5
|
+
export declare type ActionConfig = {
|
|
6
6
|
module: {
|
|
7
7
|
compiled: string;
|
|
8
8
|
source: string;
|
|
9
9
|
type: 'FUNCTION';
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
export type FuncMap = {
|
|
12
|
+
export declare type FuncMap = {
|
|
13
13
|
[key: string]: Function;
|
|
14
14
|
};
|
|
15
|
-
export type Module = {
|
|
15
|
+
export declare type Module = {
|
|
16
16
|
funcMap: FuncMap;
|
|
17
17
|
variables: VariableMap;
|
|
18
18
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@byteluck-fe/model-driven-engine",
|
|
3
|
-
"version": "2.5.0-
|
|
3
|
+
"version": "2.5.0-beta.4",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "郝晨光 <2293885211@qq.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -26,13 +26,13 @@
|
|
|
26
26
|
"postpublish": "node ../../scripts/postpublish.js"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@byteluck-fe/model-driven-core": "2.5.0-
|
|
30
|
-
"@byteluck-fe/model-driven-shared": "2.5.0-
|
|
29
|
+
"@byteluck-fe/model-driven-core": "2.5.0-beta.4",
|
|
30
|
+
"@byteluck-fe/model-driven-shared": "2.5.0-beta.1",
|
|
31
31
|
"@types/mathjs": "^9.4.2",
|
|
32
32
|
"mathjs": "^11.3.3"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "~18.0.6"
|
|
36
36
|
},
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "9eab5e07d7c76a24510fe03a0fd768aecab71635"
|
|
38
38
|
}
|