@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
package/src/state/global.ts
CHANGED
|
@@ -1,13 +1,24 @@
|
|
|
1
1
|
import { reactive } from 'vue';
|
|
2
|
+
import { type OioAnyViewState, OioGlobalState } from './typing';
|
|
3
|
+
import { getViewState } from './view';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
5
|
+
const globalStateMethods: Record<string, Function> = {
|
|
6
|
+
getMainViewState
|
|
7
|
+
};
|
|
6
8
|
|
|
7
9
|
function createGlobalState(): OioGlobalState {
|
|
8
|
-
|
|
10
|
+
const state = {
|
|
9
11
|
fullscreen: false
|
|
10
|
-
}
|
|
12
|
+
} as OioGlobalState;
|
|
13
|
+
const proxy = reactive<OioGlobalState>(state);
|
|
14
|
+
for (const [method, fn] of Object.entries(globalStateMethods)) {
|
|
15
|
+
state[method] = fn.bind(proxy);
|
|
16
|
+
}
|
|
17
|
+
return proxy;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function getMainViewState(this: OioGlobalState): OioAnyViewState | undefined {
|
|
21
|
+
return getViewState(this.mainViewHandle);
|
|
11
22
|
}
|
|
12
23
|
|
|
13
24
|
export const globalState = createGlobalState();
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { DEFAULT_SLOT_NAME } from '@oinone/kunlun-dsl';
|
|
2
2
|
import { reactive } from 'vue';
|
|
3
3
|
import { Widget } from '../../basic';
|
|
4
|
-
import { executeInvisible, InvisibleSupported } from '../../feature';
|
|
5
|
-
import {
|
|
4
|
+
import { executeInvisible, type InvisibleSupported } from '../../feature';
|
|
5
|
+
import {
|
|
6
|
+
hasActionBarViewState,
|
|
7
|
+
hasRowActionBarViewState,
|
|
8
|
+
type OioActionBarState,
|
|
9
|
+
type OioAnyViewState
|
|
10
|
+
} from '../typing';
|
|
6
11
|
|
|
7
12
|
export function createActionBarState(
|
|
8
13
|
this: OioAnyViewState,
|
package/src/state/typing.ts
CHANGED
|
@@ -13,6 +13,15 @@ export interface RenderPosition {
|
|
|
13
13
|
rowIndex?: number; // fixme @zbh 20251205 rowIndex 无法准确设置,暂不可用
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
+
export interface OioGlobalState {
|
|
17
|
+
fullscreen: boolean;
|
|
18
|
+
disabledRelationQuery?: boolean;
|
|
19
|
+
|
|
20
|
+
mainViewHandle?: string;
|
|
21
|
+
|
|
22
|
+
getMainViewState(): OioAnyViewState | undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
16
25
|
export interface OioViewState extends StateEntity {
|
|
17
26
|
/**
|
|
18
27
|
* Vue生命周期时可能有值,用于获取渲染参数处理属性多态的问题
|
|
@@ -77,6 +86,7 @@ export interface OioDetailViewState extends OioViewState {
|
|
|
77
86
|
actionBar?: OioActionBarState;
|
|
78
87
|
actionBars?: Record<string, OioActionBarState>;
|
|
79
88
|
detail?: string;
|
|
89
|
+
disabledRelationQuery?: boolean;
|
|
80
90
|
fields?: string[];
|
|
81
91
|
fieldWidgets?: Record<string, string>;
|
|
82
92
|
}
|
package/src/state/use-state.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { globalState
|
|
2
|
-
import { OioAnyViewState } from './typing';
|
|
1
|
+
import { globalState } from './global';
|
|
2
|
+
import type { OioAnyViewState, OioGlobalState } from './typing';
|
|
3
3
|
import { clearViewState, createViewState, getViewState, setViewState } from './view';
|
|
4
4
|
|
|
5
5
|
export function useOioState(): {
|
package/src/state/view.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { reactive } from 'vue';
|
|
2
2
|
import { useInjectMetaContext } from './context';
|
|
3
3
|
import { createActionBarState, getActionBarState, popAction, popField, pushAction, pushField } from './method';
|
|
4
|
-
import { OioAnyViewState } from './typing';
|
|
4
|
+
import type { OioAnyViewState } from './typing';
|
|
5
5
|
|
|
6
6
|
const viewStateStorage: Record<string, OioAnyViewState> = {};
|
|
7
7
|
|
|
@@ -31,7 +31,7 @@ export function createViewState(handle: string): OioAnyViewState {
|
|
|
31
31
|
|
|
32
32
|
export function getViewState(handle?: string): OioAnyViewState | undefined {
|
|
33
33
|
if (!handle) {
|
|
34
|
-
handle = useInjectMetaContext()
|
|
34
|
+
handle = useInjectMetaContext().rootHandle.value;
|
|
35
35
|
if (!handle) {
|
|
36
36
|
console.warn('Invalid root handle.');
|
|
37
37
|
return undefined;
|
|
@@ -46,7 +46,7 @@ export function setViewState(state: OioAnyViewState): void {
|
|
|
46
46
|
|
|
47
47
|
export function clearViewState(handle?: string): OioAnyViewState | undefined {
|
|
48
48
|
if (!handle) {
|
|
49
|
-
handle = useInjectMetaContext()
|
|
49
|
+
handle = useInjectMetaContext().rootHandle.value;
|
|
50
50
|
if (!handle) {
|
|
51
51
|
console.warn('Invalid root handle.');
|
|
52
52
|
return undefined;
|
package/src/token/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DslDefinition } from '@oinone/kunlun-dsl';
|
|
2
|
-
import { Slots } from 'vue';
|
|
1
|
+
import type { DslDefinition } from '@oinone/kunlun-dsl';
|
|
2
|
+
import type { Slots } from 'vue';
|
|
3
3
|
import { VueWidget } from '../basic';
|
|
4
|
-
import { DslDefinitionWidgetProps } from '../dsl';
|
|
4
|
+
import type { DslDefinitionWidgetProps } from '../dsl';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* 渲染组件
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_SLOT_NAME,
|
|
3
|
+
DslDefinitionType,
|
|
4
|
+
type ElementDslDefinition,
|
|
5
|
+
type PackDslDefinition,
|
|
6
|
+
type TemplateDslDefinition
|
|
7
|
+
} from '@oinone/kunlun-dsl';
|
|
8
|
+
import type { Component } from 'vue';
|
|
9
|
+
import { DslRender, DEFAULT_TAG_PREFIX } from '../dsl-render';
|
|
10
|
+
|
|
11
|
+
jest.mock('vue', () => {
|
|
12
|
+
const actual = jest.requireActual('vue');
|
|
13
|
+
return {
|
|
14
|
+
...actual,
|
|
15
|
+
resolveDynamicComponent: (name: string | Component) => {
|
|
16
|
+
if (typeof name === 'string') {
|
|
17
|
+
return name;
|
|
18
|
+
}
|
|
19
|
+
return name;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe('DslRender', () => {
|
|
25
|
+
it('fetchComponent: VIEW 类型应使用前缀和 dslNodeType 组合', () => {
|
|
26
|
+
const dsl = { dslNodeType: DslDefinitionType.VIEW } as any;
|
|
27
|
+
const component = DslRender.fetchComponent(dsl);
|
|
28
|
+
expect(component).toBe(`${DEFAULT_TAG_PREFIX}-${DslDefinitionType.VIEW}`);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('fetchComponent: PACK 类型应优先使用 widget 字段, 失败时回退到 dslNodeType', () => {
|
|
32
|
+
const dsl: PackDslDefinition = {
|
|
33
|
+
dslNodeType: DslDefinitionType.PACK,
|
|
34
|
+
widget: 'MyWidget'
|
|
35
|
+
} as any;
|
|
36
|
+
const component = DslRender.fetchComponent(dsl);
|
|
37
|
+
expect(component).toBe('pack');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('fetchComponent: ELEMENT 类型应优先使用 widget 字段, 失败时回退到 dslNodeType', () => {
|
|
41
|
+
const dsl: ElementDslDefinition = {
|
|
42
|
+
dslNodeType: DslDefinitionType.ELEMENT,
|
|
43
|
+
widget: 'MyElement'
|
|
44
|
+
} as any;
|
|
45
|
+
const component = DslRender.fetchComponent(dsl);
|
|
46
|
+
expect(component).toBe('element');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('fetchComponent: UNKNOWN/SLOT/TEMPLATE 类型返回 null, 其他未知类型走公共解析逻辑', () => {
|
|
50
|
+
expect(
|
|
51
|
+
DslRender.fetchComponent({
|
|
52
|
+
dslNodeType: DslDefinitionType.SLOT
|
|
53
|
+
} as any)
|
|
54
|
+
).toBeNull();
|
|
55
|
+
|
|
56
|
+
const unknownComponent = DslRender.fetchComponent({
|
|
57
|
+
dslNodeType: 'CustomType' as any
|
|
58
|
+
} as any);
|
|
59
|
+
expect(unknownComponent).toBe('CustomType');
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('renderSlots: 应根据 dslSlots 生成对应插槽', () => {
|
|
63
|
+
const dslSlots = {
|
|
64
|
+
default: {
|
|
65
|
+
dslNodeType: DslDefinitionType.TEMPLATE,
|
|
66
|
+
slot: DEFAULT_SLOT_NAME,
|
|
67
|
+
widgets: [
|
|
68
|
+
{
|
|
69
|
+
dslNodeType: DslDefinitionType.ELEMENT,
|
|
70
|
+
widget: 'div'
|
|
71
|
+
} as any
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
} as any;
|
|
75
|
+
|
|
76
|
+
const slots = DslRender.renderSlots(dslSlots);
|
|
77
|
+
expect(slots.default).toBeInstanceOf(Function);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('fetchVNodeSlots: 有缓存时直接返回, 无缓存时根据 TemplateDslDefinition 推导插槽名', () => {
|
|
81
|
+
const dsl: any = {
|
|
82
|
+
dslNodeType: DslDefinitionType.VIEW,
|
|
83
|
+
widgets: [
|
|
84
|
+
{
|
|
85
|
+
dslNodeType: DslDefinitionType.TEMPLATE,
|
|
86
|
+
slot: 'header'
|
|
87
|
+
} as TemplateDslDefinition,
|
|
88
|
+
{
|
|
89
|
+
dslNodeType: DslDefinitionType.TEMPLATE
|
|
90
|
+
} as TemplateDslDefinition
|
|
91
|
+
]
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const slots = DslRender.fetchVNodeSlots(dsl);
|
|
95
|
+
expect(slots).toBeDefined();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('render: component 不存在时返回 undefined, 存在时调用 createVNodeWithDslDefinition', () => {
|
|
99
|
+
const dsl: any = {
|
|
100
|
+
dslNodeType: DslDefinitionType.UNKNOWN
|
|
101
|
+
};
|
|
102
|
+
expect(DslRender.render(dsl)).toBeUndefined();
|
|
103
|
+
|
|
104
|
+
const elementDsl: ElementDslDefinition = {
|
|
105
|
+
dslNodeType: DslDefinitionType.ELEMENT,
|
|
106
|
+
widget: 'div'
|
|
107
|
+
} as any;
|
|
108
|
+
|
|
109
|
+
const vnode = DslRender.render(elementDsl, DEFAULT_SLOT_NAME);
|
|
110
|
+
expect(vnode).toBeTruthy();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Slots, VNode } from 'vue';
|
|
2
|
+
import { renderWidgets } from '../render';
|
|
3
|
+
import { VueWidget } from '../../basic';
|
|
4
|
+
|
|
5
|
+
class RenderTestWidget extends VueWidget {
|
|
6
|
+
private renderFn?: (context?: Record<string, unknown>, slots?: Slots) => VNode | VNode[];
|
|
7
|
+
|
|
8
|
+
public setRenderFn(fn: (context?: Record<string, unknown>, slots?: Slots) => VNode | VNode[]) {
|
|
9
|
+
this.renderFn = fn;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
public render(context?: Record<string, unknown>, slots?: Slots): VNode | VNode[] {
|
|
13
|
+
if (!this.renderFn) {
|
|
14
|
+
return [] as unknown as VNode[];
|
|
15
|
+
}
|
|
16
|
+
return this.renderFn(context, slots);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('renderWidgets', () => {
|
|
21
|
+
it('单个 widget 时应使用传入插槽进行渲染', () => {
|
|
22
|
+
const widget = new RenderTestWidget().initialize() as RenderTestWidget;
|
|
23
|
+
let receivedContext: Record<string, unknown> | undefined;
|
|
24
|
+
let receivedSlots: Slots | undefined;
|
|
25
|
+
|
|
26
|
+
widget.setRenderFn((context, slots) => {
|
|
27
|
+
receivedContext = context;
|
|
28
|
+
receivedSlots = slots;
|
|
29
|
+
return {} as VNode;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const ctx = { foo: 'bar' };
|
|
33
|
+
const slots: Slots = {
|
|
34
|
+
default: () => [{ key: 'slot' } as unknown as VNode]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const vNode = renderWidgets([widget], ctx, slots);
|
|
38
|
+
|
|
39
|
+
expect(vNode).toBeTruthy();
|
|
40
|
+
expect(receivedContext).toBe(ctx);
|
|
41
|
+
expect(receivedSlots).toBeDefined();
|
|
42
|
+
expect(receivedSlots && receivedSlots.default).toBe(slots.default);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('多个 widget 时应将前一个渲染结果作为下一个的 default 插槽', () => {
|
|
46
|
+
const innerWidget = new RenderTestWidget().initialize() as RenderTestWidget;
|
|
47
|
+
const innerVNode = { key: 'inner' } as unknown as VNode;
|
|
48
|
+
innerWidget.setRenderFn(() => {
|
|
49
|
+
return innerVNode;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
const outerWidget = new RenderTestWidget().initialize() as RenderTestWidget;
|
|
53
|
+
let receivedChildren: VNode[] | undefined;
|
|
54
|
+
|
|
55
|
+
outerWidget.setRenderFn((_context, slots) => {
|
|
56
|
+
const children = slots?.default ? (slots.default() as VNode[]) : [];
|
|
57
|
+
receivedChildren = children;
|
|
58
|
+
return { key: 'outer' } as unknown as VNode;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const ctx = {};
|
|
62
|
+
|
|
63
|
+
const vNode = renderWidgets([outerWidget, innerWidget], ctx);
|
|
64
|
+
|
|
65
|
+
expect(vNode).toBeTruthy();
|
|
66
|
+
expect(receivedChildren).toBeDefined();
|
|
67
|
+
expect(receivedChildren && receivedChildren[0]).toBe(innerVNode);
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { VueWidget } from '../../basic';
|
|
2
|
+
import { getWidget, getWidgetNotNull, newVueWidget } from '../widget-manager';
|
|
3
|
+
|
|
4
|
+
describe('widget-manager', () => {
|
|
5
|
+
it('newVueWidget 应创建 VueWidget 实例', () => {
|
|
6
|
+
const widget = newVueWidget();
|
|
7
|
+
|
|
8
|
+
expect(widget).toBeInstanceOf(VueWidget);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
it('getWidget 应根据 handle 返回已注册的 Widget 实例', () => {
|
|
12
|
+
const widget = new VueWidget().initialize();
|
|
13
|
+
const handle = widget.getHandle();
|
|
14
|
+
|
|
15
|
+
const result = getWidget(handle);
|
|
16
|
+
|
|
17
|
+
expect(result).toBe(widget);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('getWidgetNotNull 在未找到 handle 时返回新的 VueWidget', () => {
|
|
21
|
+
const handle = 'not-exist-handle';
|
|
22
|
+
|
|
23
|
+
const result = getWidgetNotNull(handle);
|
|
24
|
+
|
|
25
|
+
expect(result).toBeInstanceOf(VueWidget);
|
|
26
|
+
});
|
|
27
|
+
});
|
package/src/util/dsl-render.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_SLOT_NAME,
|
|
3
|
-
DslDefinition,
|
|
3
|
+
type DslDefinition,
|
|
4
4
|
DslDefinitionHelper,
|
|
5
5
|
DslDefinitionType,
|
|
6
|
-
DslSlots,
|
|
6
|
+
type DslSlots,
|
|
7
7
|
DslSlotUtils,
|
|
8
|
-
ElementDslDefinition,
|
|
9
|
-
PackDslDefinition,
|
|
10
|
-
TemplateDslDefinition
|
|
8
|
+
type ElementDslDefinition,
|
|
9
|
+
type PackDslDefinition,
|
|
10
|
+
type TemplateDslDefinition
|
|
11
11
|
} from '@oinone/kunlun-dsl';
|
|
12
12
|
import { StringHelper, uniqueKeyGenerator } from '@oinone/kunlun-shared';
|
|
13
13
|
import { PropRecordHelper } from '@oinone/kunlun-vue-ui-common';
|
|
14
14
|
import { intersection, isNil, isString } from 'lodash-es';
|
|
15
|
-
import { Component, createVNode, resolveDynamicComponent, Slots, VNode, withCtx } from 'vue';
|
|
15
|
+
import { type Component, createVNode, resolveDynamicComponent, type Slots, type VNode, withCtx } from 'vue';
|
|
16
16
|
|
|
17
17
|
export const DEFAULT_TAG_PREFIX = 'oinone';
|
|
18
18
|
|
|
@@ -289,7 +289,6 @@ export class DslRender {
|
|
|
289
289
|
}
|
|
290
290
|
case DslDefinitionType.UNKNOWN:
|
|
291
291
|
case DslDefinitionType.TEMPLATE:
|
|
292
|
-
// eslint-disable-next-line no-continue
|
|
293
292
|
continue;
|
|
294
293
|
default:
|
|
295
294
|
console.error('Invalid component.');
|
package/src/util/install.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RuntimeContextManager } from '@oinone/kunlun-engine';
|
|
2
2
|
import { isDev } from '@oinone/kunlun-router';
|
|
3
|
-
import { App, Component, Directive, Plugin } from 'vue';
|
|
3
|
+
import type { App, Component, Directive, Plugin } from 'vue';
|
|
4
4
|
|
|
5
5
|
export function componentInstall(component: Component, name?: string | string[]): void {
|
|
6
6
|
if (!name) {
|
package/src/util/render.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Slots, VNode } from 'vue';
|
|
1
|
+
import type { Slots, VNode } from 'vue';
|
|
3
2
|
import { VueWidget } from '../basic';
|
|
4
3
|
|
|
5
4
|
export function renderWidgets(widgets: VueWidget[], ctx: Record<string, unknown>, slots?: Slots) {
|
|
@@ -9,12 +8,9 @@ export function renderWidgets(widgets: VueWidget[], ctx: Record<string, unknown>
|
|
|
9
8
|
const widget = widgets[i];
|
|
10
9
|
if (vNodes) {
|
|
11
10
|
const finalVNodes = Array.isArray(vNodes) ? vNodes : [vNodes];
|
|
12
|
-
vNodes = widget.render(ctx, { default: () => finalVNodes
|
|
11
|
+
vNodes = widget.render(ctx, { default: () => finalVNodes });
|
|
13
12
|
} else {
|
|
14
|
-
vNodes = widget.render(ctx,
|
|
15
|
-
...slots,
|
|
16
|
-
...StableSlotProp
|
|
17
|
-
});
|
|
13
|
+
vNodes = widget.render(ctx, slots);
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
return vNodes;
|
package/src/view/index.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
import { EntityBody, IViewProps, ListVM, ObjectVM, RuntimeModel, ViewVM } from '@oinone/kunlun-engine';
|
|
2
|
-
import { LifeCycleTypes, ViewEventName } from '@oinone/kunlun-event';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type EntityBody, type IViewProps, ListVM, ObjectVM, type RuntimeModel, ViewVM } from '@oinone/kunlun-engine';
|
|
2
|
+
import { LifeCycleTypes, type ViewEventName } from '@oinone/kunlun-event';
|
|
3
|
+
import {
|
|
4
|
+
createViewElement,
|
|
5
|
+
type Entity,
|
|
6
|
+
type IDslNode,
|
|
7
|
+
type IModel,
|
|
8
|
+
type IView,
|
|
9
|
+
ViewElement,
|
|
10
|
+
type ViewId,
|
|
11
|
+
ViewType
|
|
12
|
+
} from '@oinone/kunlun-meta';
|
|
13
|
+
import { type Matched, useMatched } from '@oinone/kunlun-router';
|
|
14
|
+
import type { Constructor } from '@oinone/kunlun-shared';
|
|
15
|
+
import { SPI, type SPIOptions, type SPISingleSelector, type SPITokenFactory } from '@oinone/kunlun-spi';
|
|
7
16
|
import { Subscription } from '@oinone/kunlun-state';
|
|
8
|
-
|
|
9
17
|
import { Widget } from '../basic';
|
|
10
|
-
|
|
11
18
|
import { DslNodeWidget } from '../dsl/DslNodeWidget';
|
|
12
19
|
|
|
13
20
|
export interface IViewFilterOptions extends SPIOptions {
|
package/rollup.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import pkg from './package.json';
|
|
2
|
-
import rollupConfig from '../../scripts/build.config.js';
|
|
3
|
-
|
|
4
|
-
export default rollupConfig(
|
|
5
|
-
pkg.name,
|
|
6
|
-
[
|
|
7
|
-
'@oinone/kunlun-dsl',
|
|
8
|
-
'@oinone/kunlun-engine',
|
|
9
|
-
'@oinone/kunlun-event',
|
|
10
|
-
'@oinone/kunlun-meta',
|
|
11
|
-
'@oinone/kunlun-router',
|
|
12
|
-
'@oinone/kunlun-shared',
|
|
13
|
-
'@oinone/kunlun-spi',
|
|
14
|
-
'@oinone/kunlun-state',
|
|
15
|
-
'@oinone/kunlun-vue-ui-common',
|
|
16
|
-
'@oinone/kunlun-config',
|
|
17
|
-
'lodash',
|
|
18
|
-
'lodash-es',
|
|
19
|
-
'vue'
|
|
20
|
-
],
|
|
21
|
-
false
|
|
22
|
-
);
|