@oinone/kunlun-vue-widget 6.4.9 → 7.2.0
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/oinone-kunlun-vue-widget.esm.js +1 -16
- package/dist/types/index.d.ts +1 -1
- package/dist/types/src/basic/AsyncVueWidget.d.ts +7 -7
- package/dist/types/src/basic/VueFragment.vue.d.ts +2 -2
- package/dist/types/src/basic/VueWidget.d.ts +339 -331
- package/dist/types/src/basic/Widget.d.ts +260 -257
- package/dist/types/src/basic/index.d.ts +3 -3
- package/dist/types/src/data/ActiveRecordsWidget.d.ts +271 -261
- package/dist/types/src/data/PathWidget.d.ts +34 -34
- package/dist/types/src/data/index.d.ts +2 -2
- package/dist/types/src/dsl/DslDefinitionWidget.d.ts +66 -68
- package/dist/types/src/dsl/DslNodeWidget.d.ts +42 -42
- package/dist/types/src/dsl/DslRenderWidget.d.ts +47 -44
- package/dist/types/src/dsl/index.d.ts +3 -3
- package/dist/types/src/feature/index.d.ts +1 -1
- package/dist/types/src/feature/invisible-supported.d.ts +11 -11
- package/dist/types/src/hooks/all-mounted.d.ts +20 -20
- package/dist/types/src/hooks/index.d.ts +1 -1
- package/dist/types/src/index.d.ts +10 -10
- package/dist/types/src/state/context.d.ts +41 -41
- package/dist/types/src/state/global.d.ts +3 -4
- package/dist/types/src/state/index.d.ts +3 -3
- package/dist/types/src/state/method/action.d.ts +18 -18
- package/dist/types/src/state/method/field.d.ts +3 -3
- package/dist/types/src/state/method/index.d.ts +2 -2
- package/dist/types/src/state/typing.d.ts +112 -105
- package/dist/types/src/state/use-state.d.ts +15 -16
- package/dist/types/src/state/view.d.ts +5 -5
- package/dist/types/src/token/index.d.ts +2 -2
- package/dist/types/src/typing/WidgetTagContext.d.ts +39 -39
- package/dist/types/src/typing/WidgetTagProps.d.ts +23 -23
- package/dist/types/src/typing/index.d.ts +3 -3
- package/dist/types/src/typing/typing.d.ts +7 -7
- package/dist/types/src/util/dsl-render.d.ts +106 -106
- package/dist/types/src/util/index.d.ts +4 -4
- package/dist/types/src/util/install.d.ts +4 -4
- package/dist/types/src/util/render.d.ts +7 -7
- package/dist/types/src/util/widget-manager.d.ts +4 -4
- package/dist/types/src/view/index.d.ts +161 -161
- package/package.json +29 -18
- package/src/basic/AsyncVueWidget.ts +2 -2
- package/src/basic/VueWidget.ts +67 -31
- package/src/basic/Widget.ts +11 -9
- package/src/basic/__tests__/Widget.spec.ts +82 -0
- package/src/data/ActiveRecordsWidget.ts +51 -21
- package/src/data/PathWidget.ts +1 -1
- package/src/dsl/DslDefinitionWidget.ts +10 -33
- package/src/dsl/DslNodeWidget.ts +3 -3
- package/src/dsl/DslRenderWidget.ts +32 -3
- package/src/feature/__tests__/invisible-supported.spec.ts +31 -0
- package/src/hooks/__tests__/all-mounted.spec.ts +41 -0
- package/src/hooks/all-mounted.ts +1 -1
- package/src/shim-translate.d.ts +5 -2
- package/src/state/__tests__/state.spec.ts +114 -0
- package/src/state/context.ts +6 -2
- package/src/state/global.ts +16 -5
- package/src/state/method/action.ts +7 -2
- package/src/state/method/field.ts +1 -1
- package/src/state/typing.ts +10 -0
- package/src/state/use-state.ts +2 -2
- package/src/state/view.ts +3 -3
- package/src/token/index.ts +1 -1
- package/src/typing/WidgetTagContext.ts +3 -3
- package/src/typing/WidgetTagProps.ts +2 -2
- package/src/util/__tests__/dsl-render.spec.ts +112 -0
- package/src/util/__tests__/render.spec.ts +69 -0
- package/src/util/__tests__/widget-manager.spec.ts +27 -0
- package/src/util/dsl-render.ts +6 -7
- package/src/util/install.ts +1 -1
- package/src/util/render.ts +3 -7
- package/src/view/index.ts +15 -8
- package/rollup.config.js +0 -22
|
@@ -1,105 +1,112 @@
|
|
|
1
|
-
import { ViewType } from '@oinone/kunlun-meta';
|
|
2
|
-
import { ButtonBizStyle, ButtonType } from '@oinone/kunlun-vue-ui-common';
|
|
3
|
-
|
|
4
|
-
readonly handle: string;
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
};
|
|
7
|
-
export interface RenderPosition {
|
|
8
|
-
handle: string;
|
|
9
|
-
slotName?: string;
|
|
10
|
-
rowIndex?: number;
|
|
11
|
-
}
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
export interface
|
|
85
|
-
searchView?: string;
|
|
86
|
-
actionBar?: OioActionBarState;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
export
|
|
99
|
-
export
|
|
100
|
-
export
|
|
101
|
-
export declare function
|
|
102
|
-
export declare function
|
|
103
|
-
export declare function
|
|
104
|
-
export declare function
|
|
105
|
-
export
|
|
1
|
+
import { ViewType } from '@oinone/kunlun-meta';
|
|
2
|
+
import { ButtonBizStyle, ButtonType } from '@oinone/kunlun-vue-ui-common';
|
|
3
|
+
type StateEntity = {
|
|
4
|
+
readonly handle: string;
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
export interface RenderPosition {
|
|
8
|
+
handle: string;
|
|
9
|
+
slotName?: string;
|
|
10
|
+
rowIndex?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface OioGlobalState {
|
|
13
|
+
fullscreen: boolean;
|
|
14
|
+
disabledRelationQuery?: boolean;
|
|
15
|
+
mainViewHandle?: string;
|
|
16
|
+
getMainViewState(): OioAnyViewState | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface OioViewState extends StateEntity {
|
|
19
|
+
/**
|
|
20
|
+
* Vue生命周期时可能有值,用于获取渲染参数处理属性多态的问题
|
|
21
|
+
*/
|
|
22
|
+
__position: RenderPosition[];
|
|
23
|
+
fullscreen: boolean;
|
|
24
|
+
viewType?: ViewType;
|
|
25
|
+
popupScene?: string;
|
|
26
|
+
createActionBarState(options: {
|
|
27
|
+
handle: string;
|
|
28
|
+
} & Partial<Omit<OioActionBarState, 'handle'>>): OioActionBarState;
|
|
29
|
+
/**
|
|
30
|
+
* 此获取方法仅能用在Vue生命周期,否则无法准确获取真实的ActionBar状态变量
|
|
31
|
+
*/
|
|
32
|
+
getActionBarState(rowIndex?: number): OioActionBarState | undefined;
|
|
33
|
+
pushField(handle: string, rowIndex?: number): void;
|
|
34
|
+
popField(handle: string, rowIndex?: number): void;
|
|
35
|
+
pushAction(handle: string, rowIndex?: number): void;
|
|
36
|
+
popAction(handle: string, rowIndex?: number): void;
|
|
37
|
+
}
|
|
38
|
+
export interface OioActionBarState extends StateEntity {
|
|
39
|
+
inline?: boolean;
|
|
40
|
+
actions: string[];
|
|
41
|
+
visibleActions: string[];
|
|
42
|
+
bizStyle?: string;
|
|
43
|
+
getActionBarBizStyle?(actionHandle: string): {
|
|
44
|
+
type: ButtonType;
|
|
45
|
+
bizStyle: ButtonBizStyle;
|
|
46
|
+
} | undefined;
|
|
47
|
+
}
|
|
48
|
+
export interface OioTableViewState extends OioViewState {
|
|
49
|
+
searchView?: string;
|
|
50
|
+
actionBar?: OioActionBarState;
|
|
51
|
+
actionBars?: Record<string, OioActionBarState>;
|
|
52
|
+
inlineActionBars?: OioActionBarState[];
|
|
53
|
+
table?: string;
|
|
54
|
+
fields?: string[];
|
|
55
|
+
fieldWidgets?: Record<string, string>;
|
|
56
|
+
}
|
|
57
|
+
export interface OioSearchViewState extends OioViewState {
|
|
58
|
+
search?: string;
|
|
59
|
+
fields?: string[];
|
|
60
|
+
fieldWidgets?: Record<string, string>;
|
|
61
|
+
}
|
|
62
|
+
export interface OioFormViewState extends OioViewState {
|
|
63
|
+
draftCode?: string;
|
|
64
|
+
actionBar?: OioActionBarState;
|
|
65
|
+
actionBars?: Record<string, OioActionBarState>;
|
|
66
|
+
form?: string;
|
|
67
|
+
fields?: string[];
|
|
68
|
+
fieldWidgets?: Record<string, string>;
|
|
69
|
+
}
|
|
70
|
+
export interface OioDetailViewState extends OioViewState {
|
|
71
|
+
actionBar?: OioActionBarState;
|
|
72
|
+
actionBars?: Record<string, OioActionBarState>;
|
|
73
|
+
detail?: string;
|
|
74
|
+
disabledRelationQuery?: boolean;
|
|
75
|
+
fields?: string[];
|
|
76
|
+
fieldWidgets?: Record<string, string>;
|
|
77
|
+
}
|
|
78
|
+
export interface OioCardState extends StateEntity {
|
|
79
|
+
titleProps?: Record<string, unknown>;
|
|
80
|
+
contentProps?: Record<string, unknown>;
|
|
81
|
+
fields?: string[];
|
|
82
|
+
fieldWidgets?: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
export interface OioGalleryViewState extends OioViewState {
|
|
85
|
+
searchView?: string;
|
|
86
|
+
actionBar?: OioActionBarState;
|
|
87
|
+
inlineActionBars?: OioActionBarState[];
|
|
88
|
+
gallery?: string;
|
|
89
|
+
cards?: OioCardState[];
|
|
90
|
+
}
|
|
91
|
+
export interface OioTreeViewState extends OioViewState {
|
|
92
|
+
searchView?: string;
|
|
93
|
+
actionBar?: OioActionBarState;
|
|
94
|
+
tree?: string;
|
|
95
|
+
fields?: string[];
|
|
96
|
+
fieldWidgets?: Record<string, string>;
|
|
97
|
+
}
|
|
98
|
+
export type OioAnyViewState = OioTableViewState | OioSearchViewState | OioFormViewState | OioDetailViewState | OioGalleryViewState | OioTreeViewState;
|
|
99
|
+
export type OioListViewState = OioTableViewState | OioGalleryViewState;
|
|
100
|
+
export type OioObjectViewState = OioFormViewState | OioDetailViewState | OioSearchViewState;
|
|
101
|
+
export declare function isTableViewState(state: OioAnyViewState): state is OioTableViewState;
|
|
102
|
+
export declare function isSearchViewState(state: OioAnyViewState): state is OioSearchViewState;
|
|
103
|
+
export declare function isFormViewState(state: OioAnyViewState): state is OioFormViewState;
|
|
104
|
+
export declare function isDetailViewState(state: OioAnyViewState): state is OioDetailViewState;
|
|
105
|
+
export declare function isGalleryViewState(state: OioAnyViewState): state is OioGalleryViewState;
|
|
106
|
+
export declare function isTreeViewState(state: OioAnyViewState): state is OioTreeViewState;
|
|
107
|
+
export declare function isListViewState(state: OioAnyViewState): state is OioListViewState;
|
|
108
|
+
export declare function isObjectViewState(state: OioAnyViewState): state is OioObjectViewState;
|
|
109
|
+
export declare function hasFieldsViewState(state: OioAnyViewState): state is OioTableViewState | OioFormViewState | OioDetailViewState;
|
|
110
|
+
export declare function hasActionBarViewState(state: OioAnyViewState): state is OioTableViewState | OioFormViewState | OioDetailViewState | OioGalleryViewState | OioTreeViewState;
|
|
111
|
+
export declare function hasRowActionBarViewState(state: OioAnyViewState): state is OioTableViewState | OioGalleryViewState;
|
|
112
|
+
export {};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { OioGlobalState } from './
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
};
|
|
1
|
+
import type { OioAnyViewState, OioGlobalState } from './typing';
|
|
2
|
+
export declare function useOioState(): {
|
|
3
|
+
globalState: OioGlobalState;
|
|
4
|
+
viewState: OioAnyViewState | undefined;
|
|
5
|
+
createViewState: (handle: string) => OioAnyViewState;
|
|
6
|
+
getViewState: (handle: string) => OioAnyViewState | undefined;
|
|
7
|
+
clearViewState: (handle: string) => OioAnyViewState | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare function useOioState(handle: string): {
|
|
10
|
+
globalState: OioGlobalState;
|
|
11
|
+
viewState: OioAnyViewState | undefined;
|
|
12
|
+
createViewState: () => OioAnyViewState;
|
|
13
|
+
getViewState: () => OioAnyViewState | undefined;
|
|
14
|
+
clearViewState: () => OioAnyViewState | undefined;
|
|
15
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { OioAnyViewState } from './typing';
|
|
2
|
-
export declare function createViewState(handle: string): OioAnyViewState;
|
|
3
|
-
export declare function getViewState(handle?: string): OioAnyViewState | undefined;
|
|
4
|
-
export declare function setViewState(state: OioAnyViewState): void;
|
|
5
|
-
export declare function clearViewState(handle?: string): OioAnyViewState | undefined;
|
|
1
|
+
import type { OioAnyViewState } from './typing';
|
|
2
|
+
export declare function createViewState(handle: string): OioAnyViewState;
|
|
3
|
+
export declare function getViewState(handle?: string): OioAnyViewState | undefined;
|
|
4
|
+
export declare function setViewState(state: OioAnyViewState): void;
|
|
5
|
+
export declare function clearViewState(handle?: string): OioAnyViewState | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { InjectionKey } from 'vue';
|
|
2
|
-
export declare const genToken: <T>(name: string) => InjectionKey<T>;
|
|
1
|
+
import type { InjectionKey } from 'vue';
|
|
2
|
+
export declare const genToken: <T>(name: string) => InjectionKey<T>;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { DslDefinition } from '@oinone/kunlun-dsl';
|
|
2
|
-
import { Slots } from 'vue';
|
|
3
|
-
import { VueWidget } from '../basic';
|
|
4
|
-
import { DslDefinitionWidgetProps } from '../dsl';
|
|
5
|
-
/**
|
|
6
|
-
* 渲染组件
|
|
7
|
-
*/
|
|
8
|
-
export interface RenderWidget {
|
|
9
|
-
/**
|
|
10
|
-
* 当前组件唯一键
|
|
11
|
-
*/
|
|
12
|
-
handle: string;
|
|
13
|
-
/**
|
|
14
|
-
* 主要组件
|
|
15
|
-
*/
|
|
16
|
-
widget: VueWidget;
|
|
17
|
-
/**
|
|
18
|
-
* 混入组件
|
|
19
|
-
*/
|
|
20
|
-
widgets: VueWidget[];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 组件标签上下文
|
|
24
|
-
*/
|
|
25
|
-
export interface WidgetTagContext extends Record<string, unknown> {
|
|
26
|
-
dslDefinition: DslDefinition;
|
|
27
|
-
slotName: string;
|
|
28
|
-
widgetHandle: string;
|
|
29
|
-
widget: VueWidget;
|
|
30
|
-
widgets: VueWidget[];
|
|
31
|
-
slotContext?: Record<string, unknown>;
|
|
32
|
-
getWidgetTag(): string;
|
|
33
|
-
getParentHandle(): string;
|
|
34
|
-
getDslDefinition(): DslDefinition | undefined;
|
|
35
|
-
getSlotName(): string;
|
|
36
|
-
getProps(): DslDefinitionWidgetProps;
|
|
37
|
-
getCurrentSlots(): Slots | undefined;
|
|
38
|
-
createWidget(slots?: Slots): RenderWidget | undefined;
|
|
39
|
-
}
|
|
1
|
+
import type { DslDefinition } from '@oinone/kunlun-dsl';
|
|
2
|
+
import type { Slots } from 'vue';
|
|
3
|
+
import { VueWidget } from '../basic';
|
|
4
|
+
import type { DslDefinitionWidgetProps } from '../dsl';
|
|
5
|
+
/**
|
|
6
|
+
* 渲染组件
|
|
7
|
+
*/
|
|
8
|
+
export interface RenderWidget {
|
|
9
|
+
/**
|
|
10
|
+
* 当前组件唯一键
|
|
11
|
+
*/
|
|
12
|
+
handle: string;
|
|
13
|
+
/**
|
|
14
|
+
* 主要组件
|
|
15
|
+
*/
|
|
16
|
+
widget: VueWidget;
|
|
17
|
+
/**
|
|
18
|
+
* 混入组件
|
|
19
|
+
*/
|
|
20
|
+
widgets: VueWidget[];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* 组件标签上下文
|
|
24
|
+
*/
|
|
25
|
+
export interface WidgetTagContext extends Record<string, unknown> {
|
|
26
|
+
dslDefinition: DslDefinition;
|
|
27
|
+
slotName: string;
|
|
28
|
+
widgetHandle: string;
|
|
29
|
+
widget: VueWidget;
|
|
30
|
+
widgets: VueWidget[];
|
|
31
|
+
slotContext?: Record<string, unknown>;
|
|
32
|
+
getWidgetTag(): string;
|
|
33
|
+
getParentHandle(): string;
|
|
34
|
+
getDslDefinition(): DslDefinition | undefined;
|
|
35
|
+
getSlotName(): string;
|
|
36
|
+
getProps(): DslDefinitionWidgetProps;
|
|
37
|
+
getCurrentSlots(): Slots | undefined;
|
|
38
|
+
createWidget(slots?: Slots): RenderWidget | undefined;
|
|
39
|
+
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { DslDefinition } from '@oinone/kunlun-dsl';
|
|
2
|
-
import { PropType } from 'vue';
|
|
3
|
-
/**
|
|
4
|
-
* 组件标签属性
|
|
5
|
-
*/
|
|
6
|
-
export declare const WidgetTagProps: {
|
|
7
|
-
handle: {
|
|
8
|
-
type: StringConstructor;
|
|
9
|
-
};
|
|
10
|
-
dslDefinition: {
|
|
11
|
-
type: PropType<DslDefinition>;
|
|
12
|
-
};
|
|
13
|
-
slotName: {
|
|
14
|
-
type: StringConstructor;
|
|
15
|
-
};
|
|
16
|
-
inline: {
|
|
17
|
-
type: BooleanConstructor;
|
|
18
|
-
default: undefined;
|
|
19
|
-
};
|
|
20
|
-
slotContext: {
|
|
21
|
-
type: ObjectConstructor;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
1
|
+
import type { DslDefinition } from '@oinone/kunlun-dsl';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
/**
|
|
4
|
+
* 组件标签属性
|
|
5
|
+
*/
|
|
6
|
+
export declare const WidgetTagProps: {
|
|
7
|
+
handle: {
|
|
8
|
+
type: StringConstructor;
|
|
9
|
+
};
|
|
10
|
+
dslDefinition: {
|
|
11
|
+
type: PropType<DslDefinition>;
|
|
12
|
+
};
|
|
13
|
+
slotName: {
|
|
14
|
+
type: StringConstructor;
|
|
15
|
+
};
|
|
16
|
+
inline: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: undefined;
|
|
19
|
+
};
|
|
20
|
+
slotContext: {
|
|
21
|
+
type: ObjectConstructor;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './WidgetTagProps';
|
|
2
|
-
export * from './WidgetTagContext';
|
|
3
|
-
export * from './typing';
|
|
1
|
+
export * from './WidgetTagProps';
|
|
2
|
+
export * from './WidgetTagContext';
|
|
3
|
+
export * from './typing';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare enum InnerWidgetType {
|
|
2
|
-
Action = "Action",
|
|
3
|
-
Field = "Field",
|
|
4
|
-
Element = "Element",
|
|
5
|
-
View = "View",
|
|
6
|
-
Mask = "Mask"
|
|
7
|
-
}
|
|
1
|
+
export declare enum InnerWidgetType {
|
|
2
|
+
Action = "Action",
|
|
3
|
+
Field = "Field",
|
|
4
|
+
Element = "Element",
|
|
5
|
+
View = "View",
|
|
6
|
+
Mask = "Mask"
|
|
7
|
+
}
|
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
import { DslDefinition, DslSlots } from '@oinone/kunlun-dsl';
|
|
2
|
-
import { Component, Slots, VNode } from 'vue';
|
|
3
|
-
export declare const DEFAULT_TAG_PREFIX = "oinone";
|
|
4
|
-
export declare const SLOTS_KEY = "__slots";
|
|
5
|
-
export declare const RENDER_OPTIONS_KEY = "__render__options";
|
|
6
|
-
export declare const SLOT_CONTEXT_KEY = "slotContext";
|
|
7
|
-
/**
|
|
8
|
-
* 渲染可选项
|
|
9
|
-
*/
|
|
10
|
-
export interface DslRenderOptions {
|
|
11
|
-
/**
|
|
12
|
-
* 动态key
|
|
13
|
-
* 当key不存在时进行自动生成
|
|
14
|
-
*/
|
|
15
|
-
dynamicKey?: boolean;
|
|
16
|
-
/**
|
|
17
|
-
* 是否强制更新
|
|
18
|
-
* 永远使用新的key进行渲染
|
|
19
|
-
*/
|
|
20
|
-
focusUpdate?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* 是否递归渲染
|
|
23
|
-
* 递归渲染有性能损耗,但可以解决某些渲染问题,建议在明确递归层数的情况下局部使用该参数
|
|
24
|
-
*/
|
|
25
|
-
recursion?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* vue createVNode patchFlag
|
|
28
|
-
*/
|
|
29
|
-
patchFlag?: number;
|
|
30
|
-
/**
|
|
31
|
-
* vue createVNode dynamicProps
|
|
32
|
-
*/
|
|
33
|
-
dynamicProps?: string[] | null;
|
|
34
|
-
/**
|
|
35
|
-
* vue createVNode isBlockNode
|
|
36
|
-
*/
|
|
37
|
-
isBlockNode?: boolean;
|
|
38
|
-
/**
|
|
39
|
-
* 插槽上下文
|
|
40
|
-
*/
|
|
41
|
-
slotContext?: Record<string, unknown>;
|
|
42
|
-
}
|
|
43
|
-
export
|
|
44
|
-
/**
|
|
45
|
-
* dsl扩展属性
|
|
46
|
-
*/
|
|
47
|
-
export
|
|
48
|
-
__slots?: DslChildren;
|
|
49
|
-
__render__options?: DslRenderOptions;
|
|
50
|
-
};
|
|
51
|
-
export
|
|
52
|
-
export
|
|
53
|
-
dslDefinition: DslRenderDefinition;
|
|
54
|
-
slotName: string;
|
|
55
|
-
slotContext?: Record<string, unknown>;
|
|
56
|
-
[key: string]: any;
|
|
57
|
-
} & DslRenderExtendProp;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* dsl渲染
|
|
61
|
-
*/
|
|
62
|
-
export declare class DslRender {
|
|
63
|
-
private static resolveComponentCache;
|
|
64
|
-
private static resolveCommonComponentCache;
|
|
65
|
-
/**
|
|
66
|
-
* 渲染指定dsl定义到对应插槽
|
|
67
|
-
* @param dsl 指定dsl
|
|
68
|
-
* @param slotName 插槽名称 默认为: default
|
|
69
|
-
* @param children 插槽
|
|
70
|
-
* @param options 渲染可选项
|
|
71
|
-
*/
|
|
72
|
-
static render(dsl: DslRenderDefinition, slotName?: string, children?: DslChildren, options?: DslRenderOptions): VNode | undefined;
|
|
73
|
-
/**
|
|
74
|
-
* 渲染dsl插槽
|
|
75
|
-
* @param dslSlots dsl插槽
|
|
76
|
-
*/
|
|
77
|
-
static renderSlots(dslSlots: DslSlots): Slots;
|
|
78
|
-
/**
|
|
79
|
-
* 通过指定dsl获取VNode插槽
|
|
80
|
-
* @param dsl 指定dsl
|
|
81
|
-
* @param supportedSlotNames
|
|
82
|
-
*/
|
|
83
|
-
static fetchVNodeSlots(dsl: DslDefinition | undefined, supportedSlotNames?: string[]): Slots | undefined;
|
|
84
|
-
/**
|
|
85
|
-
* 根据dsl节点类型获取对应组件
|
|
86
|
-
*
|
|
87
|
-
* @remarks
|
|
88
|
-
* - {@link DslDefinitionType#VIEW} resolve rule: `{@link DEFAULT_TAG_PREFIX}-{@link DslDefinition#dslNodeType}` (Unsupported auto resolve methods)<br />
|
|
89
|
-
* - {@link DslDefinitionType#PACK} resolve rule: `{@link PackDslDefinition#widget}` (Supported auto resolve methods)<br>
|
|
90
|
-
* - {@link DslDefinitionType#ELEMENT} resolve rule: `{@link ElementDslDefinition#widget}` (Supported auto resolve methods)<br>
|
|
91
|
-
* - Others resolve rule: `{@link DslDefinition#dslNodeType}` (Unsupported auto resolve methods)
|
|
92
|
-
*
|
|
93
|
-
* @param dslDefinition dsl定义
|
|
94
|
-
* @return
|
|
95
|
-
* - 正确获取组件时返回: Component | string;
|
|
96
|
-
* - 未知类型、插槽或模板类型返回: null;
|
|
97
|
-
* - 无效的dslNodeType返回: undefined
|
|
98
|
-
*/
|
|
99
|
-
static fetchComponent(dslDefinition: DslDefinition): ResolveComponentType | null | undefined;
|
|
100
|
-
private static createVNodeChildren;
|
|
101
|
-
private static createVNodeWithDslDefinition;
|
|
102
|
-
private static resolveMethods;
|
|
103
|
-
private static resolveCommonWidgetComponent;
|
|
104
|
-
private static resolveWidgetComponent;
|
|
105
|
-
}
|
|
106
|
-
export {};
|
|
1
|
+
import { type DslDefinition, type DslSlots } from '@oinone/kunlun-dsl';
|
|
2
|
+
import { type Component, type Slots, type VNode } from 'vue';
|
|
3
|
+
export declare const DEFAULT_TAG_PREFIX = "oinone";
|
|
4
|
+
export declare const SLOTS_KEY = "__slots";
|
|
5
|
+
export declare const RENDER_OPTIONS_KEY = "__render__options";
|
|
6
|
+
export declare const SLOT_CONTEXT_KEY = "slotContext";
|
|
7
|
+
/**
|
|
8
|
+
* 渲染可选项
|
|
9
|
+
*/
|
|
10
|
+
export interface DslRenderOptions {
|
|
11
|
+
/**
|
|
12
|
+
* 动态key
|
|
13
|
+
* 当key不存在时进行自动生成
|
|
14
|
+
*/
|
|
15
|
+
dynamicKey?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* 是否强制更新
|
|
18
|
+
* 永远使用新的key进行渲染
|
|
19
|
+
*/
|
|
20
|
+
focusUpdate?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* 是否递归渲染
|
|
23
|
+
* 递归渲染有性能损耗,但可以解决某些渲染问题,建议在明确递归层数的情况下局部使用该参数
|
|
24
|
+
*/
|
|
25
|
+
recursion?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* vue createVNode patchFlag
|
|
28
|
+
*/
|
|
29
|
+
patchFlag?: number;
|
|
30
|
+
/**
|
|
31
|
+
* vue createVNode dynamicProps
|
|
32
|
+
*/
|
|
33
|
+
dynamicProps?: string[] | null;
|
|
34
|
+
/**
|
|
35
|
+
* vue createVNode isBlockNode
|
|
36
|
+
*/
|
|
37
|
+
isBlockNode?: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* 插槽上下文
|
|
40
|
+
*/
|
|
41
|
+
slotContext?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export type DslChildren = string | VNode[] | Slots;
|
|
44
|
+
/**
|
|
45
|
+
* dsl扩展属性
|
|
46
|
+
*/
|
|
47
|
+
export type DslRenderExtendProp = {
|
|
48
|
+
__slots?: DslChildren;
|
|
49
|
+
__render__options?: DslRenderOptions;
|
|
50
|
+
};
|
|
51
|
+
export type DslRenderDefinition = DslDefinition & DslRenderExtendProp;
|
|
52
|
+
export type DslPropType = {
|
|
53
|
+
dslDefinition: DslRenderDefinition;
|
|
54
|
+
slotName: string;
|
|
55
|
+
slotContext?: Record<string, unknown>;
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
} & DslRenderExtendProp;
|
|
58
|
+
type ResolveComponentType = Component | string;
|
|
59
|
+
/**
|
|
60
|
+
* dsl渲染
|
|
61
|
+
*/
|
|
62
|
+
export declare class DslRender {
|
|
63
|
+
private static resolveComponentCache;
|
|
64
|
+
private static resolveCommonComponentCache;
|
|
65
|
+
/**
|
|
66
|
+
* 渲染指定dsl定义到对应插槽
|
|
67
|
+
* @param dsl 指定dsl
|
|
68
|
+
* @param slotName 插槽名称 默认为: default
|
|
69
|
+
* @param children 插槽
|
|
70
|
+
* @param options 渲染可选项
|
|
71
|
+
*/
|
|
72
|
+
static render(dsl: DslRenderDefinition, slotName?: string, children?: DslChildren, options?: DslRenderOptions): VNode | undefined;
|
|
73
|
+
/**
|
|
74
|
+
* 渲染dsl插槽
|
|
75
|
+
* @param dslSlots dsl插槽
|
|
76
|
+
*/
|
|
77
|
+
static renderSlots(dslSlots: DslSlots): Slots;
|
|
78
|
+
/**
|
|
79
|
+
* 通过指定dsl获取VNode插槽
|
|
80
|
+
* @param dsl 指定dsl
|
|
81
|
+
* @param supportedSlotNames
|
|
82
|
+
*/
|
|
83
|
+
static fetchVNodeSlots(dsl: DslDefinition | undefined, supportedSlotNames?: string[]): Slots | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* 根据dsl节点类型获取对应组件
|
|
86
|
+
*
|
|
87
|
+
* @remarks
|
|
88
|
+
* - {@link DslDefinitionType#VIEW} resolve rule: `{@link DEFAULT_TAG_PREFIX}-{@link DslDefinition#dslNodeType}` (Unsupported auto resolve methods)<br />
|
|
89
|
+
* - {@link DslDefinitionType#PACK} resolve rule: `{@link PackDslDefinition#widget}` (Supported auto resolve methods)<br>
|
|
90
|
+
* - {@link DslDefinitionType#ELEMENT} resolve rule: `{@link ElementDslDefinition#widget}` (Supported auto resolve methods)<br>
|
|
91
|
+
* - Others resolve rule: `{@link DslDefinition#dslNodeType}` (Unsupported auto resolve methods)
|
|
92
|
+
*
|
|
93
|
+
* @param dslDefinition dsl定义
|
|
94
|
+
* @return
|
|
95
|
+
* - 正确获取组件时返回: Component | string;
|
|
96
|
+
* - 未知类型、插槽或模板类型返回: null;
|
|
97
|
+
* - 无效的dslNodeType返回: undefined
|
|
98
|
+
*/
|
|
99
|
+
static fetchComponent(dslDefinition: DslDefinition): ResolveComponentType | null | undefined;
|
|
100
|
+
private static createVNodeChildren;
|
|
101
|
+
private static createVNodeWithDslDefinition;
|
|
102
|
+
private static resolveMethods;
|
|
103
|
+
private static resolveCommonWidgetComponent;
|
|
104
|
+
private static resolveWidgetComponent;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './dsl-render';
|
|
2
|
-
export * from './install';
|
|
3
|
-
export * from './render';
|
|
4
|
-
export * from './widget-manager';
|
|
1
|
+
export * from './dsl-render';
|
|
2
|
+
export * from './install';
|
|
3
|
+
export * from './render';
|
|
4
|
+
export * from './widget-manager';
|