@quicktvui/naddons 1.0.0-alpha.3 → 1.0.0-alpha.5
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/components/DatePicker/DatePicker.vue.d.ts +26 -0
- package/dist/components/DatePicker/index.d.ts +13 -0
- package/dist/components/GridTabs/PortalItem.vue.d.ts +35 -0
- package/dist/components/GridTabs/PortalPool.vue.d.ts +79 -0
- package/dist/components/GridTabs/index.d.ts +8 -1
- package/dist/components/GridTabs/useGridTabs.d.ts +51 -0
- package/dist/components/GridTabs/useGridTabsData.d.ts +20 -0
- package/dist/components/GridTabs/useGridTabsUpdater.d.ts +24 -0
- package/dist/components/Keyboard/Keyboard.vue.d.ts +48 -0
- package/dist/components/Keyboard/index.d.ts +13 -0
- package/dist/components/NumericKeyboard/NumericKeyboard.vue.d.ts +26 -0
- package/dist/components/NumericKeyboard/index.d.ts +13 -0
- package/dist/components/RatingBar/RatingBar.vue.d.ts +32 -0
- package/dist/components/RatingBar/index.d.ts +13 -0
- package/dist/core/withAsyncPlugin.d.ts +17 -2
- package/dist/index.d.ts +18 -1
- package/dist/naddons.cjs.js +1 -1
- package/dist/naddons.es.js +858 -149
- package/dist/style.css +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
initialDate?: string | undefined;
|
|
3
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
onDateChanged: (payload?: any) => void;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
initialDate?: string | undefined;
|
|
7
|
+
}>>> & Readonly<{
|
|
8
|
+
onOnDateChanged?: ((payload?: any) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
10
|
+
default?(_: {}): any;
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import DatePicker from './DatePicker.vue';
|
|
3
|
+
export declare const DatePickerPlugin: {
|
|
4
|
+
install: (app: App) => void;
|
|
5
|
+
};
|
|
6
|
+
export { DatePicker };
|
|
7
|
+
export default DatePickerPlugin;
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
interface GlobalComponents {
|
|
10
|
+
DatePicker: typeof DatePicker;
|
|
11
|
+
'qt-date-picker': typeof DatePicker;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
2
|
+
portalId: {
|
|
3
|
+
type: StringConstructor;
|
|
4
|
+
required: true;
|
|
5
|
+
};
|
|
6
|
+
width: {
|
|
7
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
8
|
+
required: true;
|
|
9
|
+
};
|
|
10
|
+
height: {
|
|
11
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
12
|
+
required: true;
|
|
13
|
+
};
|
|
14
|
+
}>, {
|
|
15
|
+
itemStyle: import("vue").ComputedRef<{
|
|
16
|
+
width: string;
|
|
17
|
+
height: string;
|
|
18
|
+
display: string;
|
|
19
|
+
flexDirection: string;
|
|
20
|
+
}>;
|
|
21
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
portalId: {
|
|
23
|
+
type: StringConstructor;
|
|
24
|
+
required: true;
|
|
25
|
+
};
|
|
26
|
+
width: {
|
|
27
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
28
|
+
required: true;
|
|
29
|
+
};
|
|
30
|
+
height: {
|
|
31
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { PropType } from 'vue';
|
|
2
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
3
|
+
data: {
|
|
4
|
+
type: PropType<any[]>;
|
|
5
|
+
default: () => never[];
|
|
6
|
+
};
|
|
7
|
+
presenceMap: {
|
|
8
|
+
type: PropType<Record<string, string>>;
|
|
9
|
+
default: () => {};
|
|
10
|
+
};
|
|
11
|
+
gridBasis: {
|
|
12
|
+
type: NumberConstructor;
|
|
13
|
+
default: number;
|
|
14
|
+
};
|
|
15
|
+
totalWidth: {
|
|
16
|
+
type: NumberConstructor;
|
|
17
|
+
default: number;
|
|
18
|
+
};
|
|
19
|
+
}>, {
|
|
20
|
+
activePortals: import("vue").Ref<any[], any[]>;
|
|
21
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
data: {
|
|
23
|
+
type: PropType<any[]>;
|
|
24
|
+
default: () => never[];
|
|
25
|
+
};
|
|
26
|
+
presenceMap: {
|
|
27
|
+
type: PropType<Record<string, string>>;
|
|
28
|
+
default: () => {};
|
|
29
|
+
};
|
|
30
|
+
gridBasis: {
|
|
31
|
+
type: NumberConstructor;
|
|
32
|
+
default: number;
|
|
33
|
+
};
|
|
34
|
+
totalWidth: {
|
|
35
|
+
type: NumberConstructor;
|
|
36
|
+
default: number;
|
|
37
|
+
};
|
|
38
|
+
}>> & Readonly<{}>, {
|
|
39
|
+
data: any[];
|
|
40
|
+
presenceMap: Record<string, string>;
|
|
41
|
+
gridBasis: number;
|
|
42
|
+
totalWidth: number;
|
|
43
|
+
}, {}, {
|
|
44
|
+
PortalItem: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
45
|
+
portalId: {
|
|
46
|
+
type: StringConstructor;
|
|
47
|
+
required: true;
|
|
48
|
+
};
|
|
49
|
+
width: {
|
|
50
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
51
|
+
required: true;
|
|
52
|
+
};
|
|
53
|
+
height: {
|
|
54
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
}>, {
|
|
58
|
+
itemStyle: import("vue").ComputedRef<{
|
|
59
|
+
width: string;
|
|
60
|
+
height: string;
|
|
61
|
+
display: string;
|
|
62
|
+
flexDirection: string;
|
|
63
|
+
}>;
|
|
64
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
65
|
+
portalId: {
|
|
66
|
+
type: StringConstructor;
|
|
67
|
+
required: true;
|
|
68
|
+
};
|
|
69
|
+
width: {
|
|
70
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
71
|
+
required: true;
|
|
72
|
+
};
|
|
73
|
+
height: {
|
|
74
|
+
type: (StringConstructor | NumberConstructor)[];
|
|
75
|
+
required: true;
|
|
76
|
+
};
|
|
77
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
78
|
+
}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
79
|
+
export default _default;
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import type { App } from 'vue';
|
|
2
2
|
import GridTabs from './GridTabs.vue';
|
|
3
|
+
import PortalItem from './PortalItem.vue';
|
|
4
|
+
import PortalPool from './PortalPool.vue';
|
|
3
5
|
export declare const GridTabsPlugin: {
|
|
4
6
|
install: (app: App) => void;
|
|
5
7
|
};
|
|
6
|
-
export { GridTabs };
|
|
8
|
+
export { GridTabs, PortalItem, PortalPool };
|
|
7
9
|
export * from './useGridItemPresence';
|
|
10
|
+
export * from './useGridTabsUpdater';
|
|
11
|
+
export * from './useGridTabsData';
|
|
8
12
|
export default GridTabsPlugin;
|
|
9
13
|
declare module 'vue' {
|
|
10
14
|
interface GlobalComponents {
|
|
11
15
|
GridTabs: typeof GridTabs;
|
|
16
|
+
'gt-tabs': typeof GridTabs;
|
|
12
17
|
'qt-grid-tabs': typeof GridTabs;
|
|
18
|
+
'qt-portal-pool': typeof PortalPool;
|
|
19
|
+
'qt-portal-item': typeof PortalItem;
|
|
13
20
|
}
|
|
14
21
|
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface GTAction {
|
|
2
|
+
op: 'UPDATE_ITEM' | 'APPEND_SUB_ITEMS' | 'REMOVE_ITEM';
|
|
3
|
+
itemId: string;
|
|
4
|
+
payload?: any;
|
|
5
|
+
}
|
|
6
|
+
export interface GTConfig {
|
|
7
|
+
gridBasis?: number;
|
|
8
|
+
unitType?: string;
|
|
9
|
+
layoutConfig?: any;
|
|
10
|
+
navConfig?: any;
|
|
11
|
+
referenceResolution?: any;
|
|
12
|
+
}
|
|
13
|
+
export interface GTItemContent {
|
|
14
|
+
title?: string;
|
|
15
|
+
subTitle?: string;
|
|
16
|
+
poster?: string;
|
|
17
|
+
[key: string]: any;
|
|
18
|
+
}
|
|
19
|
+
export interface GTItem {
|
|
20
|
+
id: string;
|
|
21
|
+
viewType: string;
|
|
22
|
+
span?: number;
|
|
23
|
+
content?: GTItemContent;
|
|
24
|
+
[key: string]: any;
|
|
25
|
+
}
|
|
26
|
+
export interface GTTab {
|
|
27
|
+
tabId: string;
|
|
28
|
+
title: string;
|
|
29
|
+
items?: GTItem[];
|
|
30
|
+
hidden?: boolean;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export interface GTCallbacks {
|
|
34
|
+
onTabNeedsData?: (tabId: string, index: number, reason: string) => Promise<GTItem[]>;
|
|
35
|
+
onLoadMore?: (tabId: string, cursor: number, itemId: string) => Promise<GTItem[]>;
|
|
36
|
+
}
|
|
37
|
+
export declare function useGridTabs(gridRef: any, defaultConfig?: GTConfig): {
|
|
38
|
+
tabsDataStr: import("vue").Ref<string, string>;
|
|
39
|
+
actionPayloadStr: import("vue").Ref<string, string>;
|
|
40
|
+
bindings: import("vue").ComputedRef<{
|
|
41
|
+
tabsData: string;
|
|
42
|
+
actionPayload: string;
|
|
43
|
+
onTabNeedsData: (e: any) => Promise<void>;
|
|
44
|
+
onLoadMore: (e: any) => Promise<void>;
|
|
45
|
+
}>;
|
|
46
|
+
tabs: import("vue").ShallowRef<GTTab[], GTTab[]>;
|
|
47
|
+
items: import("vue").ShallowRef<GTItem[], GTItem[]>;
|
|
48
|
+
initData: (data: any[]) => void;
|
|
49
|
+
setCallbacks: (callbacks: GTCallbacks) => void;
|
|
50
|
+
dispatchAction: (action: GTAction | GTAction[]) => void;
|
|
51
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GridTabsAction } from './useGridTabsUpdater';
|
|
3
|
+
/**
|
|
4
|
+
* 核心 Diff 算法:比对两份 GridTabs 数据,生成局部更新指令。
|
|
5
|
+
* 如果发现结构突变(如 viewType 改变、中间插入、乱序),则返回 'FULL_RELOAD'。
|
|
6
|
+
*/
|
|
7
|
+
export declare function diffGridTabsData(oldData: any, newData: any): GridTabsAction[] | 'FULL_RELOAD';
|
|
8
|
+
/**
|
|
9
|
+
* 终极武器:传入响应式的对象数据,内部自动监听并执行 Diff。
|
|
10
|
+
* 能够完美将微小的增删改转化为 actionPayload 指令发送给 Native,
|
|
11
|
+
* 遇到大范围突变时自动降级为 tabsData 全量刷新。
|
|
12
|
+
*
|
|
13
|
+
* 使用方式:
|
|
14
|
+
* const { tabsDataStr, actionPayloadStr } = useGridTabsData(myReactiveData);
|
|
15
|
+
* <qt-grid-tabs :tabsData="tabsDataStr" :actionPayload="actionPayloadStr" />
|
|
16
|
+
*/
|
|
17
|
+
export declare function useGridTabsData(sourceDataRef: Ref<any>): {
|
|
18
|
+
tabsDataStr: Ref<string, string>;
|
|
19
|
+
actionPayloadStr: Ref<string, string>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* 局部更新指令结构 (对应 Native 层的 DynamicAction)
|
|
4
|
+
*/
|
|
5
|
+
export interface GridTabsAction {
|
|
6
|
+
op: 'UPDATE_ITEM' | 'APPEND_SUB_ITEMS' | 'REMOVE_ITEM';
|
|
7
|
+
itemId: string;
|
|
8
|
+
payload?: any;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 封装 GridTabs 的局部更新能力 (基于 actionPayload 指令)
|
|
12
|
+
*
|
|
13
|
+
* 使用方式:
|
|
14
|
+
* const { actionPayloadStr, updateItem, appendItems, removeItem } = useGridTabsUpdater();
|
|
15
|
+
*
|
|
16
|
+
* <qt-grid-tabs :actionPayload="actionPayloadStr" />
|
|
17
|
+
*/
|
|
18
|
+
export declare function useGridTabsUpdater(): {
|
|
19
|
+
actionPayloadStr: Ref<string, string>;
|
|
20
|
+
dispatchAction: (action: GridTabsAction | GridTabsAction[]) => void;
|
|
21
|
+
updateItem: (itemId: string, payload: Record<string, any>) => void;
|
|
22
|
+
appendItems: (containerId: string, subItems: any[]) => void;
|
|
23
|
+
removeItem: (itemId: string) => void;
|
|
24
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
backgroundColor?: string | undefined;
|
|
3
|
+
textColor?: string | undefined;
|
|
4
|
+
weakTextColor?: string | undefined;
|
|
5
|
+
focusBackgroundColor?: string | undefined;
|
|
6
|
+
focusTextColor?: string | undefined;
|
|
7
|
+
placeholder?: string | undefined;
|
|
8
|
+
textFullKeyboard?: string | undefined;
|
|
9
|
+
textT9Keyboard?: string | undefined;
|
|
10
|
+
textClear?: string | undefined;
|
|
11
|
+
textDelete?: string | undefined;
|
|
12
|
+
currentInput?: string | undefined;
|
|
13
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
onInputChanged: (payload?: any) => void;
|
|
15
|
+
onKeyPressed: (payload?: any) => void;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
17
|
+
backgroundColor?: string | undefined;
|
|
18
|
+
textColor?: string | undefined;
|
|
19
|
+
weakTextColor?: string | undefined;
|
|
20
|
+
focusBackgroundColor?: string | undefined;
|
|
21
|
+
focusTextColor?: string | undefined;
|
|
22
|
+
placeholder?: string | undefined;
|
|
23
|
+
textFullKeyboard?: string | undefined;
|
|
24
|
+
textT9Keyboard?: string | undefined;
|
|
25
|
+
textClear?: string | undefined;
|
|
26
|
+
textDelete?: string | undefined;
|
|
27
|
+
currentInput?: string | undefined;
|
|
28
|
+
}>>> & Readonly<{
|
|
29
|
+
onOnInputChanged?: ((payload?: any) => any) | undefined;
|
|
30
|
+
onOnKeyPressed?: ((payload?: any) => any) | undefined;
|
|
31
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
32
|
+
default?(_: {}): any;
|
|
33
|
+
}>;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
36
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
37
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
38
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
39
|
+
} : {
|
|
40
|
+
type: import('vue').PropType<T[K]>;
|
|
41
|
+
required: true;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
45
|
+
new (): {
|
|
46
|
+
$slots: S;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import Keyboard from './Keyboard.vue';
|
|
3
|
+
export declare const KeyboardPlugin: {
|
|
4
|
+
install: (app: App) => void;
|
|
5
|
+
};
|
|
6
|
+
export { Keyboard };
|
|
7
|
+
export default KeyboardPlugin;
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
interface GlobalComponents {
|
|
10
|
+
Keyboard: typeof Keyboard;
|
|
11
|
+
'qt-keyboard': typeof Keyboard;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
maxLength?: any;
|
|
3
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
4
|
+
onNumberPressed: (payload?: any) => void;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
6
|
+
maxLength?: any;
|
|
7
|
+
}>>> & Readonly<{
|
|
8
|
+
onOnNumberPressed?: ((payload?: any) => any) | undefined;
|
|
9
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
10
|
+
default?(_: {}): any;
|
|
11
|
+
}>;
|
|
12
|
+
export default _default;
|
|
13
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
14
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
15
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
16
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
17
|
+
} : {
|
|
18
|
+
type: import('vue').PropType<T[K]>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
23
|
+
new (): {
|
|
24
|
+
$slots: S;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import NumericKeyboard from './NumericKeyboard.vue';
|
|
3
|
+
export declare const NumericKeyboardPlugin: {
|
|
4
|
+
install: (app: App) => void;
|
|
5
|
+
};
|
|
6
|
+
export { NumericKeyboard };
|
|
7
|
+
export default NumericKeyboardPlugin;
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
interface GlobalComponents {
|
|
10
|
+
NumericKeyboard: typeof NumericKeyboard;
|
|
11
|
+
'qt-numeric-keyboard': typeof NumericKeyboard;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
numStars?: any;
|
|
3
|
+
rating?: any;
|
|
4
|
+
stepSize?: any;
|
|
5
|
+
isIndicator?: boolean | undefined;
|
|
6
|
+
}>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
onRatingChanged: (payload?: any) => void;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
9
|
+
numStars?: any;
|
|
10
|
+
rating?: any;
|
|
11
|
+
stepSize?: any;
|
|
12
|
+
isIndicator?: boolean | undefined;
|
|
13
|
+
}>>> & Readonly<{
|
|
14
|
+
onOnRatingChanged?: ((payload?: any) => any) | undefined;
|
|
15
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
16
|
+
default?(_: {}): any;
|
|
17
|
+
}>;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: import('vue').PropType<T[K]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import RatingBar from './RatingBar.vue';
|
|
3
|
+
export declare const RatingBarPlugin: {
|
|
4
|
+
install: (app: App) => void;
|
|
5
|
+
};
|
|
6
|
+
export { RatingBar };
|
|
7
|
+
export default RatingBarPlugin;
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
interface GlobalComponents {
|
|
10
|
+
RatingBar: typeof RatingBar;
|
|
11
|
+
'qt-rating-bar': typeof RatingBar;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,7 +1,22 @@
|
|
|
1
|
+
export declare const QuickTVUINAddonsConfig: {
|
|
2
|
+
skipPluginCheck: boolean;
|
|
3
|
+
};
|
|
1
4
|
/**
|
|
2
5
|
* 提供统一的异步插件安装和降级包装器。
|
|
3
6
|
* 这个组件不会被暴露给最终用户,只被 auto-generated 的组件代码调用。
|
|
4
7
|
*/
|
|
5
|
-
export declare function withAsyncPlugin(NativeTag: string, pluginPkgName?: string, pluginInitClass?: string): import("vue").DefineComponent<
|
|
8
|
+
export declare function withAsyncPlugin(NativeTag: string, pluginPkgName?: string, pluginInitClass?: string): import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
9
|
+
skipPluginCheck: {
|
|
10
|
+
type: BooleanConstructor;
|
|
11
|
+
default: boolean;
|
|
12
|
+
};
|
|
13
|
+
}>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
6
14
|
[key: string]: any;
|
|
7
|
-
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<
|
|
15
|
+
}>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
|
+
skipPluginCheck: {
|
|
17
|
+
type: BooleanConstructor;
|
|
18
|
+
default: boolean;
|
|
19
|
+
};
|
|
20
|
+
}>> & Readonly<{}>, {
|
|
21
|
+
skipPluginCheck: boolean;
|
|
22
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
export * from './components/GridTabs';
|
|
2
|
+
export { useGridTabs } from './components/GridTabs/useGridTabs';
|
|
3
|
+
export * from './components/RatingBar';
|
|
4
|
+
export * from './components/Keyboard';
|
|
5
|
+
export * from './components/NumericKeyboard';
|
|
6
|
+
export * from './components/DatePicker';
|
|
2
7
|
import { GridTabs } from './components/GridTabs';
|
|
3
|
-
|
|
8
|
+
import { RatingBar } from './components/RatingBar';
|
|
9
|
+
import { Keyboard } from './components/Keyboard';
|
|
10
|
+
import { NumericKeyboard } from './components/NumericKeyboard';
|
|
11
|
+
import { DatePicker } from './components/DatePicker';
|
|
12
|
+
export { withAsyncPlugin, QuickTVUINAddonsConfig } from './core/withAsyncPlugin';
|
|
4
13
|
import { App } from 'vue';
|
|
5
14
|
export declare const QuickTVUINAddons: {
|
|
6
15
|
install: (app: App) => void;
|
|
@@ -10,5 +19,13 @@ declare module 'vue' {
|
|
|
10
19
|
interface GlobalComponents {
|
|
11
20
|
GridTabs: typeof GridTabs;
|
|
12
21
|
'qt-grid-tabs': typeof GridTabs;
|
|
22
|
+
RatingBar: typeof RatingBar;
|
|
23
|
+
'qt-rating-bar': typeof RatingBar;
|
|
24
|
+
Keyboard: typeof Keyboard;
|
|
25
|
+
'qt-keyboard': typeof Keyboard;
|
|
26
|
+
NumericKeyboard: typeof NumericKeyboard;
|
|
27
|
+
'qt-numeric-keyboard': typeof NumericKeyboard;
|
|
28
|
+
DatePicker: typeof DatePicker;
|
|
29
|
+
'qt-date-picker': typeof DatePicker;
|
|
13
30
|
}
|
|
14
31
|
}
|
package/dist/naddons.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),T=require("@extscreen/es3-core"),P=require("@extscreen/es3-vue"),E=s.defineComponent({__name:"GridTabs",props:{tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused"],setup(r,{expose:e,emit:d}){const f=s.ref(),w=p("QtGridTabs","com.quicktvui.plugin.glintui"),v=d;function l(c,t){console.log(`[GridTabs.vue] received event from AsyncWrapper: ${c}`,t);const n=t&&t.nativeEvent!==void 0?t.nativeEvent:t;console.log(`[GridTabs.vue] emitting to parent: ${c}`,n),v(c,n)}return e({scrollToTop:(...c)=>{var t;return(t=f.value)==null?void 0:t.scrollToTop(...c)}}),(c,t)=>(s.openBlock(),s.createBlock(s.unref(w),s.mergeProps({ref_key:"nativeRef",ref:f,tabsData:r.tabsData,actionPayload:r.actionPayload,onOnTabSelected:t[0]||(t[0]=n=>l("onTabSelected",n)),onOnTabNeedsData:t[1]||(t[1]=n=>l("onTabNeedsData",n)),onOnLoadMore:t[2]||(t[2]=n=>l("onLoadMore",n)),onOnItemPresence:t[3]||(t[3]=n=>l("onItemPresence",n)),onOnTabFocused:t[4]||(t[4]=n=>l("onTabFocused",n)),onOnItemClick:t[5]||(t[5]=n=>l("onItemClick",n)),onOnItemFocused:t[6]||(t[6]=n=>l("onItemFocused",n))},c.$attrs),{default:s.withCtx(()=>[s.renderSlot(c.$slots,"default")]),_:3},16,["tabsData","actionPayload"]))}});function R(r,e){const d=s.ref(!1),f=s.ref(!1);return{isIntersecting:d,isVisible:f,handlePresenceState:v=>{var l,c,t;switch(v){case"enter":d.value=!0,(l=e==null?void 0:e.onEnter)==null||l.call(e);break;case"visible":f.value=!0,(c=e==null?void 0:e.onVisible)==null||c.call(e);break;case"leave":d.value=!1,f.value=!1,(t=e==null?void 0:e.onLeave)==null||t.call(e);break}}}}let b;var S;try{const r=require("@extscreen/es3-vue");b=r.registerElement||((S=r.default)==null?void 0:S.registerElement)}catch{}const I={install:r=>{globalThis.__QtGridTabs_registered||(b?(b("qt-grid-tabs",{component:{name:"QtGridTabs",processEventData(e,d,f){return{handler:d,nativeEvent:f}}}}),b("QtGridTabs",{component:{name:"QtGridTabs",processEventData(e,d,f){return{handler:d,nativeEvent:f}}}}),globalThis.__QtGridTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtGridTabs")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),r.component("GridTabs",E),r.component("qt-grid-tabs",E)}},A=new Set;function p(r,e,d){return s.defineComponent({name:`${r}AsyncWrapper`,inheritAttrs:!1,setup(f,{slots:w,attrs:v}){const l=s.ref("loading"),c=s.ref("");let t=null,n=null;try{t=T.useES(),n=T.useESPlugin()}catch(o){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",o)}const G=async()=>{if(!t||typeof t.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const o=await t.isComponentRegistered(r);if(console.log(`[withAsyncPlugin] isComponentRegistered('${r}') 返回:`,o),o===!0||o&&typeof o=="object"&&(o.registered===!0||o.isRegistered===!0))return!0;try{const i=await P.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(i&&i.core_version){const u=i.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${u}`);const a=u.split(".").map(g=>parseInt(g,10));if(a.length>=3&&!isNaN(a[0])&&!isNaN(a[1])&&!isNaN(a[2]))if(a[0]*1e6+a[1]*1e3+a[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${r}`);const y=r.split("-").map($=>$.charAt(0).toUpperCase()+$.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${r}, ${y}`);const[m,h]=await Promise.all([P.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",r).catch(()=>!1),P.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",y).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${m}, ${h}]`),m===!0||h===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${u} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${u}`)}}catch(i){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",i)}return!1}catch(o){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",o),!1}},M=async()=>{if(!e){l.value="ready";return}const o=await G();if(console.log(`[withAsyncPlugin] 拦截检查 - ${r} 是否已注册:`,o),o||A.has(e)){l.value="ready",A.add(e),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!n){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${r}`),l.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${e}`);try{await new Promise((i,u)=>{let a;const g={onPluginInstallSuccess(y,m,h){y===e&&(clearTimeout(a),n.removeListener(g),console.log(`[withAsyncPlugin] 安装成功 pkg=${y} 状态码=${m}`),m==1003||m==1001?(d?(console.log(`[withAsyncPlugin] 触发反射初始化: ${d}`),P.Native.callNative("EsNativeModule","callReflect",{entry:{from:d,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),i()):u(new Error(`安装失败 pkg=${y} status=${m} msg=${h}`)))},onPluginInstallError(y,m,h){y===e&&(clearTimeout(a),n.removeListener(g),u(new Error(`安装失败 pkg=${y} status=${m} msg=${h}`)))}};n.addListener({pkg:e},g),a=setTimeout(()=>{n.removeListener(g),u(new Error(`插件安装超时: ${e}`))},8e3),typeof n.installPlugin=="function"?n.installPlugin({pkg:e}):typeof n.install=="function"?n.install(e):u(new Error("当前运行时不支持 install / installPlugin"))}),await s.nextTick(),A.add(e),l.value="ready"}catch(i){console.error("[withAsyncPlugin] 插件加载失败:",i),c.value=(i==null?void 0:i.message)||String(i),l.value="error"}};return s.onMounted(()=>{M()}),()=>{const o={width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...v.style||{}};if(l.value==="loading")return s.h("div",{class:"qt-plugin-container",style:o},[s.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(l.value==="error")return s.h("div",{class:"qt-plugin-container",style:o},[s.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${c.value}`)]);const i={};for(const[u,a]of Object.entries(v))u.startsWith("on")&&typeof a=="function"?i[u]=(...g)=>(console.log(`[withAsyncPlugin] NativeTag=${r} 收到事件 ${u}:`,g),a(...g)):i[u]=a;return s.h("div",{class:"qt-plugin-container",style:o},[s.h(r,{...i,style:{width:"100%",height:"100%",backgroundColor:"transparent"}},w.default?w.default():[])])}}})}const C={install:r=>{r.use(I)}};exports.GridTabs=E;exports.GridTabsPlugin=I;exports.QuickTVUINAddons=C;exports.default=C;exports.useGridItemPresence=R;exports.withAsyncPlugin=p;
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("vue"),V=require("@extscreen/es3-core"),D=require("@extscreen/es3-vue"),C=r.defineComponent({__name:"GridTabs",props:{tabsData:{},actionPayload:{}},emits:["onTabSelected","onTabNeedsData","onLoadMore","onItemPresence","onTabFocused","onItemClick","onItemFocused"],setup(e,{expose:o}){const a=r.ref(),t=x("GTTabs","com.quicktvui.plugin.glintui");return o({scrollToTop:(...s)=>{var n;return(n=a.value)==null?void 0:n.scrollToTop(...s)}}),(s,n)=>(r.openBlock(),r.createBlock(r.unref(t),r.mergeProps({ref_key:"nativeRef",ref:a,tabsData:e.tabsData,actionPayload:e.actionPayload,onOnTabSelected:n[0]||(n[0]=l=>s.$emit("onTabSelected",l.nativeEvent)),onOnTabNeedsData:n[1]||(n[1]=l=>s.$emit("onTabNeedsData",l.nativeEvent)),onOnLoadMore:n[2]||(n[2]=l=>s.$emit("onLoadMore",l.nativeEvent)),onOnItemPresence:n[3]||(n[3]=l=>s.$emit("onItemPresence",l.nativeEvent)),onOnTabFocused:n[4]||(n[4]=l=>s.$emit("onTabFocused",l.nativeEvent)),onOnItemClick:n[5]||(n[5]=l=>s.$emit("onItemClick",l.nativeEvent)),onOnItemFocused:n[6]||(n[6]=l=>s.$emit("onItemFocused",l.nativeEvent))},s.$attrs),{default:r.withCtx(()=>[r.renderSlot(s.$slots,"default")]),_:3},16,["tabsData","actionPayload"]))}}),ae=r.defineComponent({name:"PortalItem",props:{portalId:{type:String,required:!0},width:{type:[Number,String],required:!0},height:{type:[Number,String],required:!0}},setup(e){return{itemStyle:r.computed(()=>{const a=typeof e.width=="number"?`${e.width}px`:e.width,t=typeof e.height=="number"?`${e.height}px`:e.height;return{width:a,height:t,display:"flex",flexDirection:"column"}})}}}),X=(e,o)=>{const a=e.__vccOpts||e;for(const[t,s]of o)a[t]=s;return a};function le(e,o,a,t,s,n){const l=r.resolveComponent("qt-portal-item-native");return r.openBlock(),r.createBlock(l,{portalId:e.portalId,style:r.normalizeStyle(e.itemStyle)},{default:r.withCtx(()=>[r.renderSlot(e.$slots,"default")]),_:3},8,["portalId","style"])}const L=X(ae,[["render",le]]),ce=r.defineComponent({name:"PortalPool",components:{PortalItem:L},props:{data:{type:Array,default:()=>[]},presenceMap:{type:Object,default:()=>({})},gridBasis:{type:Number,default:24},totalWidth:{type:Number,default:1920}},setup(e){const o=r.ref([]),a=()=>{var s;const t=[];for(const n of e.data)if(n.viewType&&n.viewType.startsWith("portal:")&&n.portalId){const l=e.presenceMap[n.itemId]||"leave";if(l!=="leave"&&l!=="null"&&l){const h=n.span||e.gridBasis,b=Math.round(e.totalWidth/e.gridBasis*h),T=((s=n.layoutConfig)==null?void 0:s.aspectRatio)||1,A=Math.round(b/T);t.push({...n,presenceState:l,width:b,height:A})}}o.value=t};return r.watch(()=>e.data,a,{deep:!0,immediate:!0}),r.watch(()=>e.presenceMap,a,{deep:!0}),{activePortals:o}}});function ue(e,o,a,t,s,n){const l=r.resolveComponent("PortalItem"),h=r.resolveComponent("qt-portal-pool-native");return r.openBlock(),r.createBlock(h,{class:"qt-portal-pool-hidden"},{default:r.withCtx(()=>[(r.openBlock(!0),r.createElementBlock(r.Fragment,null,r.renderList(e.activePortals,b=>(r.openBlock(),r.createBlock(l,{key:b.portalId,portalId:b.portalId,width:b.width,height:b.height},{default:r.withCtx(()=>[r.renderSlot(e.$slots,"default",{portal:b,presenceState:b.presenceState})]),_:2},1032,["portalId","width","height"]))),128))]),_:3})}const G=X(ce,[["render",ue]]);function de(e,o){const a=r.ref(!1),t=r.ref(!1);return{isIntersecting:a,isVisible:t,handlePresenceState:n=>{var l,h,b;switch(n){case"enter":a.value=!0,(l=o==null?void 0:o.onEnter)==null||l.call(o);break;case"visible":t.value=!0,(h=o==null?void 0:o.onVisible)==null||h.call(o);break;case"leave":a.value=!1,t.value=!1,(b=o==null?void 0:o.onLeave)==null||b.call(o);break}}}}function fe(){const e=r.ref(""),o=n=>{const l=Array.isArray(n)?n:[n];e.value=JSON.stringify(l)};return{actionPayloadStr:e,dispatchAction:o,updateItem:(n,l)=>{o({op:"UPDATE_ITEM",itemId:n,payload:l})},appendItems:(n,l)=>{o({op:"APPEND_SUB_ITEMS",itemId:n,payload:{subItems:l}})},removeItem:n=>{o({op:"REMOVE_ITEM",itemId:n})}}}function Y(e,o){if(JSON.stringify(e.page_spec)!==JSON.stringify(o.page_spec)||JSON.stringify(e.navConfig)!==JSON.stringify(o.navConfig))return"FULL_RELOAD";const a=e.tabs||[],t=o.tabs||[];if(a.length!==t.length)return"FULL_RELOAD";for(let n=0;n<t.length;n++)if(a[n].tabId!==t[n].tabId)return"FULL_RELOAD";const s=[];for(let n=0;n<t.length;n++){const l=a[n].items||[],h=t[n].items||[],b=t[n].tabId,T=new Map(l.map(d=>[d.id||d.itemId,d])),A=new Map(h.map(d=>[d.id||d.itemId,d]));let $=-1;const v=[];for(let d=0;d<h.length;d++){const y=h[d],P=y.id||y.itemId,c=T.get(P);if(c){const u=l.findIndex(S=>(S.id||S.itemId)===P);if(u<=$||($=u,c.viewType!==y.viewType||c.span!==y.span))return"FULL_RELOAD";const k=JSON.stringify(c.content)!==JSON.stringify(y.content),w=c.state!==y.state;(k||w)&&s.push({op:"UPDATE_ITEM",itemId:P,payload:{content:k?y.content:void 0,state:w?y.state:void 0}})}else{let u=!0;for(let k=d+1;k<h.length;k++)if(T.has(h[k].id||h[k].itemId)){u=!1;break}if(!u)return"FULL_RELOAD";v.push(y)}}v.length>0&&s.push({op:"APPEND_SUB_ITEMS",itemId:b,payload:{subItems:v}});for(const d of l){const y=d.id||d.itemId;A.has(y)||s.push({op:"REMOVE_ITEM",itemId:y})}}return s}function me(e){const o=r.ref(""),a=r.ref("");let t="";return r.watch(e,s=>{if(!s){o.value="",t="";return}const n=JSON.stringify(s);if(n!==t){if(!t){o.value=n,t=n;return}try{const l=JSON.parse(t),h=JSON.parse(n),b=Y(l,h);b==="FULL_RELOAD"?(console.log("[@quicktvui/naddons] Auto-Diff: 结构突变,执行全量刷新 (FULL_RELOAD)"),o.value=n):b.length>0&&(console.log("[@quicktvui/naddons] Auto-Diff: 命中局部更新,生成 Patch 指令 ->",b),a.value=JSON.stringify(b)),t=n}catch(l){console.warn("[@quicktvui/naddons] Auto-Diff failed, falling back to FULL_RELOAD",l),o.value=n,t=n}}},{deep:!0,immediate:!0}),{tabsDataStr:o,actionPayloadStr:a}}let _;var W;try{const e=require("@extscreen/es3-vue");_=e.registerElement||((W=e.default)==null?void 0:W.registerElement)}catch{}const Z={install:e=>{globalThis.__GTTabs_registered||(_?(_("gt-tabs",{component:{name:"GTTabs",processEventData(o,a){const t=o.handler||o,s=a||t.nativeParams||{};return t&&(t.nativeEvent=s),t}}}),_("qt-portal-pool-native",{component:{name:"QtPortalPool"}}),_("qt-portal-item-native",{component:{name:"QtPortalItem"}}),_("qt-grid-tabs",{component:{name:"GTTabs",defaultNativeProps:{},processEventData(o,a,t){return{...o,...t}}}}),globalThis.__GTTabs_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tags for GridTabs & Portals")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("GridTabs",C),e.component("gt-tabs",C),e.component("qt-grid-tabs",C),e.component("QtPortalItem",L),e.component("qt-portal-item",L),e.component("QtPortalPool",G),e.component("qt-portal-pool",G)}};function ge(e,o){const a=r.ref(""),t=r.ref(""),s=r.shallowRef([]),n=r.shallowRef([]);let l=!1,h=!1;const b="__virtual_single_tab__",T=r.ref({}),A=i=>{const m=Array.isArray(i)?i:[i];t.value=JSON.stringify(m)},$=(i,m)=>{if(!i)return!1;let f=!0;return i.id||(console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): 卡片缺失必填字段 'id'。每个卡片必须有唯一标识才能进行后续更新!`,i),f=!1),i.viewType||(console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): 卡片缺失必填字段 'viewType' (id: ${i.id||"未知"})。必须指定 Native 注册的视图类型或 Portal 标识!`,i),f=!1),f},v=(i,m)=>{if(!i)return!1;let f=!0;return i.tabId||(console.error(`[useGridTabs] ❌ 数据格式错误 (${m}): Tab 缺失必填字段 'tabId'。每个 Tab 必须有唯一标识!`,i),f=!1),(i.title===void 0||i.title===null)&&console.warn(`[useGridTabs] ⚠️ 数据格式警告 (${m}): Tab 缺失 'title' 字段 (tabId: ${i.tabId||"未知"}),导航栏可能显示为空。`,i),f},d=(i,m)=>{if(!i||i.length===0)return;const f=i[0].hasOwnProperty("tabId")||i[0].hasOwnProperty("items")&&Array.isArray(i[0].items);l=m==="1d",m==="1d"&&f?console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `items.value` (一维瀑布流) 赋值二维 Tabs 数据结构!请改用 `tabs.value = ...`"):m==="2d"&&!f&&console.error("[useGridTabs] ❌ 赋值错误: 你正在向 `tabs.value` (二维导航) 赋值一维卡片列表数据结构!请改用 `items.value = ...`"),m==="1d"?i.forEach((p,g)=>$(p,`items.value[${g}]`)):i.forEach((p,g)=>{v(p,`tabs.value[${g}]`),p.items&&Array.isArray(p.items)&&p.items.forEach((I,E)=>$(I,`tabs.value[${g}].items[${E}]`))}),h=!0,y()},y=()=>{if(!h)return;let i={gridBasis:(o==null?void 0:o.gridBasis)??30,unitType:(o==null?void 0:o.unitType)??"px",layoutConfig:(o==null?void 0:o.layoutConfig)??{screenPadding:{left:60,right:60,top:0,bottom:60},navContentGapNormal:0,itemGap:24},navConfig:(o==null?void 0:o.navConfig)??{placement:"left",mode:"fixed",renderType:"classic",baseSize:200,expandedSize:300},referenceResolution:(o==null?void 0:o.referenceResolution)??{w:1920,h:1080}},m=[];l?(i.navConfig={...i.navConfig,renderType:"none"},m=[{tabId:b,title:"Virtual Tab",hidden:!0,items:n.value}]):m=s.value,a.value=JSON.stringify({page_spec:i,tabs:m})},P=(i,m)=>new Proxy(i,{get(f,p,g){return p==="push"?(...I)=>{I.forEach((B,ie)=>$(B,`push(${ie})`)),h||console.error("[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时调用了 push()。请先对 items.value 或 tabs.value 进行全量赋值!");const E=Array.prototype.push.apply(f,I);return A({op:"APPEND_SUB_ITEMS",itemId:m,payload:{subItems:I}}),E}:Reflect.get(f,p,g)},set(f,p,g,I){if(p!=="length"&&!isNaN(Number(p))){h||console.error(`[useGridTabs] ❌ 时机错误: 在底层还未完成初始化时直接修改了索引 [${String(p)}]。请先对 items.value 或 tabs.value 进行全量赋值!`),$(g,`索引赋值 [${String(p)}]`);const E=Reflect.set(f,p,g,I);return g&&g.id&&A({op:"UPDATE_ITEM",itemId:g.id,payload:g}),E}return Reflect.set(f,p,g,I)}}),c=i=>(i.items&&Array.isArray(i.items)&&!i.items.__isGridTabsProxy&&(i.items=P(i.items,i.tabId),Object.defineProperty(i.items,"__isGridTabsProxy",{value:!0,enumerable:!1})),new Proxy(i,{set(m,f,p,g){if(f==="items"){let I=p;Array.isArray(p)&&!p.__isGridTabsProxy&&(I=P(p,m.tabId),Object.defineProperty(I,"__isGridTabsProxy",{value:!0,enumerable:!1}));const E=Reflect.set(m,f,I,g);return y(),E}return Reflect.set(m,f,p,g)}})),u=i=>{const m=i.map(f=>c(f));return new Proxy(m,{set(f,p,g,I){if(p!=="length"&&!isNaN(Number(p))){let E=g;g.__isGridTabsProxy||(E=c(g),Object.defineProperty(E,"__isGridTabsProxy",{value:!0,enumerable:!1}));const B=Reflect.set(f,p,E,I);return y(),B}return Reflect.set(f,p,g,I)}})};r.watch(s,(i,m)=>{if(!i||i.length===0){a.value="",h=!1;return}if(i.__isGridTabsProxy)y();else{d(i,"2d");const f=u(i);Object.defineProperty(f,"__isGridTabsProxy",{value:!0,enumerable:!1}),s.value=f}},{flush:"sync"}),r.watch(n,(i,m)=>{if(!i||i.length===0){a.value="",h=!1;return}if(i.__isGridTabsProxy)y();else{d(i,"1d");const f=P(i,b);Object.defineProperty(f,"__isGridTabsProxy",{value:!0,enumerable:!1}),n.value=f}},{flush:"sync"});const k=i=>{if(!i||i.length===0){a.value="",h=!1;return}i[0].hasOwnProperty("tabId")||i[0].hasOwnProperty("items")&&Array.isArray(i[0].items)?s.value=i:n.value=i},w=i=>{T.value=i},S=r.computed(()=>({tabsData:a.value,actionPayload:t.value,onTabNeedsData:async i=>{if(!T.value.onTabNeedsData)return;const{tabId:m,index:f,reason:p}=i,g=await T.value.onTabNeedsData(m,f,p);if(g&&Array.isArray(g)){const I=s.value.find(E=>E.tabId===m);I&&(I.items=g)}},onLoadMore:async i=>{if(!T.value.onLoadMore)return;const{tabId:m,cursor:f,itemId:p}=i,g=await T.value.onLoadMore(m,f,p);if(g&&Array.isArray(g)&&g.length>0)if(l)n.value.push(...g);else{const I=s.value.find(E=>E.tabId===m);I&&I.items&&I.items.push(...g)}}}));return{tabsDataStr:a,actionPayloadStr:t,bindings:S,tabs:s,items:n,initData:k,setCallbacks:w,dispatchAction:A}}const K=r.defineComponent({__name:"RatingBar",props:{numStars:{},rating:{},stepSize:{},isIndicator:{type:Boolean}},emits:["onRatingChanged"],setup(e){const o=r.ref(),a=x("QtRatingBar","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,numStars:e.numStars,rating:e.rating,stepSize:e.stepSize,isIndicator:e.isIndicator,onOnRatingChanged:s[0]||(s[0]=n=>t.$emit("onRatingChanged",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["numStars","rating","stepSize","isIndicator"]))}});let R;var j;try{const e=require("@extscreen/es3-vue");R=e.registerElement||((j=e.default)==null?void 0:j.registerElement)}catch{}const ee={install:e=>{globalThis.__QtRatingBar_registered||(R?(R("qt-rating-bar",{component:{name:"QtRatingBar",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),R("QtRatingBar",{component:{name:"QtRatingBar",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtRatingBar_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtRatingBar")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("RatingBar",K),e.component("qt-rating-bar",K)}},Q=r.defineComponent({__name:"Keyboard",props:{backgroundColor:{},textColor:{},weakTextColor:{},focusBackgroundColor:{},focusTextColor:{},placeholder:{},textFullKeyboard:{},textT9Keyboard:{},textClear:{},textDelete:{},currentInput:{}},emits:["onInputChanged","onKeyPressed"],setup(e){const o=r.ref(),a=x("QtKeyboard","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,backgroundColor:e.backgroundColor,textColor:e.textColor,weakTextColor:e.weakTextColor,focusBackgroundColor:e.focusBackgroundColor,focusTextColor:e.focusTextColor,placeholder:e.placeholder,textFullKeyboard:e.textFullKeyboard,textT9Keyboard:e.textT9Keyboard,textClear:e.textClear,textDelete:e.textDelete,currentInput:e.currentInput,onOnInputChanged:s[0]||(s[0]=n=>t.$emit("onInputChanged",n.nativeEvent)),onOnKeyPressed:s[1]||(s[1]=n=>t.$emit("onKeyPressed",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["backgroundColor","textColor","weakTextColor","focusBackgroundColor","focusTextColor","placeholder","textFullKeyboard","textT9Keyboard","textClear","textDelete","currentInput"]))}});let N;var J;try{const e=require("@extscreen/es3-vue");N=e.registerElement||((J=e.default)==null?void 0:J.registerElement)}catch{}const te={install:e=>{globalThis.__QtKeyboard_registered||(N?(N("qt-keyboard",{component:{name:"QtKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),N("QtKeyboard",{component:{name:"QtKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtKeyboard")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("Keyboard",Q),e.component("qt-keyboard",Q)}},F=r.defineComponent({__name:"NumericKeyboard",props:{maxLength:{}},emits:["onNumberPressed"],setup(e){const o=r.ref(),a=x("QtNumericKeyboard","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,maxLength:e.maxLength,onOnNumberPressed:s[0]||(s[0]=n=>t.$emit("onNumberPressed",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["maxLength"]))}});let O;var z;try{const e=require("@extscreen/es3-vue");O=e.registerElement||((z=e.default)==null?void 0:z.registerElement)}catch{}const ne={install:e=>{globalThis.__QtNumericKeyboard_registered||(O?(O("qt-numeric-keyboard",{component:{name:"QtNumericKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),O("QtNumericKeyboard",{component:{name:"QtNumericKeyboard",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtNumericKeyboard_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtNumericKeyboard")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("NumericKeyboard",F),e.component("qt-numeric-keyboard",F)}},U=r.defineComponent({__name:"DatePicker",props:{initialDate:{}},emits:["onDateChanged"],setup(e){const o=r.ref(),a=x("QtDatePicker","com.quicktvui.plugin.extraui","com.quicktvui.plugin.extraui.ExtraUIPluginApp");return(t,s)=>(r.openBlock(),r.createBlock(r.unref(a),r.mergeProps({ref_key:"nativeRef",ref:o,initialDate:e.initialDate,onOnDateChanged:s[0]||(s[0]=n=>t.$emit("onDateChanged",n.nativeEvent))},t.$attrs),{default:r.withCtx(()=>[r.renderSlot(t.$slots,"default")]),_:3},16,["initialDate"]))}});let q;var H;try{const e=require("@extscreen/es3-vue");q=e.registerElement||((H=e.default)==null?void 0:H.registerElement)}catch{}const oe={install:e=>{globalThis.__QtDatePicker_registered||(q?(q("qt-date-picker",{component:{name:"QtDatePicker",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),q("QtDatePicker",{component:{name:"QtDatePicker",processEventData(o,a){const t=o.handler||o,s=a||(t==null?void 0:t.nativeParams)||{};return t&&(t.nativeEvent=s),t}}}),globalThis.__QtDatePicker_registered=!0,console.log("[@quicktvui/naddons] Successfully registered Native tag:","QtDatePicker")):console.warn("[@quicktvui/naddons] Failed to find registerElement from @extscreen/es3-vue")),e.component("DatePicker",U),e.component("qt-date-picker",U)}},re={skipPluginCheck:!1},M=new Set;function x(e,o,a){return r.defineComponent({name:`${e}AsyncWrapper`,inheritAttrs:!1,props:{skipPluginCheck:{type:Boolean,default:!1}},setup(t,{slots:s,attrs:n}){const l=r.ref("loading"),h=r.ref("");let b=null,T=null;try{b=V.useES(),T=V.useESPlugin()}catch(v){console.warn("[withAsyncPlugin] 获取 useES 或 useESPlugin 失败,可能处于非 ES 环境。",v)}const A=async()=>{if(!b||typeof b.isComponentRegistered!="function")return console.log("[withAsyncPlugin] es.isComponentRegistered 不可用"),!1;try{const v=await b.isComponentRegistered(e);if(console.log(`[withAsyncPlugin] isComponentRegistered('${e}') 返回:`,v),v===!0||v&&typeof v=="object"&&(v.registered===!0||v.isRegistered===!0))return!0;try{const d=await D.Native.callNativeWithPromise("ExtendModule","getCoreSDKInfo");if(d&&d.core_version){const y=d.core_version;console.log(`[withAsyncPlugin] 当前引擎核心版本: ${y}`);const P=y.split(".").map(c=>parseInt(c,10));if(P.length>=3&&!isNaN(P[0])&&!isNaN(P[1])&&!isNaN(P[2]))if(P[0]*1e6+P[1]*1e3+P[2]>=1011205){console.log(`[withAsyncPlugin] 引擎 >= 1.11.205,使用 ExtendModule 检查 Controller: ${e}`);const u=e.split("-").map(S=>S.charAt(0).toUpperCase()+S.slice(1)).join("");console.log(`[withAsyncPlugin] 同时检查原名和驼峰名: ${e}, ${u}`);const[k,w]=await Promise.all([D.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",e).catch(()=>!1),D.Native.callNativeWithPromise("ExtendModule","isComponentRegistered",u).catch(()=>!1)]);if(console.log(`[withAsyncPlugin] ExtendModule.isComponentRegistered 返回: [${k}, ${w}]`),k===!0||w===!0)return!0}else console.log(`[withAsyncPlugin] 引擎版本 ${y} < 1.11.205,跳过 ExtendModule 检查`);else console.log(`[withAsyncPlugin] 无法解析引擎版本号: ${y}`)}}catch(d){console.log("[withAsyncPlugin] 获取引擎版本或检查 Controller 失败:",d)}return!1}catch(v){return console.warn("[withAsyncPlugin] 检查组件注册状态异常:",v),!1}},$=async()=>{if(re.skipPluginCheck||t.skipPluginCheck){console.log(`[withAsyncPlugin] 跳过 ${e} 插件检查 (skipPluginCheck = true)`),l.value="ready";return}if(!o){l.value="ready";return}const v=await A();if(console.log(`[withAsyncPlugin] 拦截检查 - ${e} 是否已注册:`,v),v||M.has(o)){l.value="ready",M.add(o),console.log("[withAsyncPlugin] 组件已注册,跳过安装流程");return}if(!T){console.warn(`[withAsyncPlugin] 无法获取 useESPlugin 实例,可能处于内置 AAR 环境或非插件环境,尝试直接渲染 ${e}`),l.value="ready";return}console.log(`[withAsyncPlugin] 开始动态安装插件: ${o}`);try{await new Promise((d,y)=>{let P;const c={onPluginInstallSuccess(u,k,w){u===o&&(clearTimeout(P),T.removeListener(c),console.log(`[withAsyncPlugin] 安装成功 pkg=${u} 状态码=${k}`),k==1003||k==1001?(a?(console.log(`[withAsyncPlugin] 触发反射初始化: ${a}`),D.Native.callNative("EsNativeModule","callReflect",{entry:{from:a,method:"setup"}})):console.log("[withAsyncPlugin] 安装成功,跳过反射初始化(无 pluginInitClass)"),d()):y(new Error(`安装失败 pkg=${u} status=${k} msg=${w}`)))},onPluginInstallError(u,k,w){u===o&&(clearTimeout(P),T.removeListener(c),y(new Error(`安装失败 pkg=${u} status=${k} msg=${w}`)))}};T.addListener({pkg:o},c),P=setTimeout(()=>{T.removeListener(c),y(new Error(`插件安装超时: ${o}`))},8e3),typeof T.installPlugin=="function"?T.installPlugin({pkg:o}):typeof T.install=="function"?T.install(o):y(new Error("当前运行时不支持 install / installPlugin"))}),await r.nextTick(),M.add(o),l.value="ready"}catch(d){console.error("[withAsyncPlugin] 插件加载失败:",d),h.value=(d==null?void 0:d.message)||String(d),l.value="error"}};return r.onMounted(()=>{$()}),()=>{const v={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",...n.style||{}},d=n.class?`qt-plugin-container ${n.class}`:"qt-plugin-container";if(l.value==="loading")return r.h("div",{class:d,style:v},[r.h("div",{style:{color:"white",fontSize:"30px"}},"插件加载中...")]);if(l.value==="error")return r.h("div",{class:d,style:v},[r.h("div",{style:{color:"white",fontSize:"30px",backgroundColor:"rgba(255,0,0,0.5)"}},`插件加载失败: ${h.value}`)]);const y={};for(const[c,u]of Object.entries(n)){const k=c.startsWith("on")&&c!=="onItemPresence"&&c!=="onTabSelected"&&c!=="onTabNeedsData"&&c!=="onLoadMore"&&c!=="onTabFocused"&&c!=="onItemClick"&&c!=="onItemFocused";c==="class"||c==="style"||!c.startsWith("onOn")&&!k&&(y[c]=u)}const P={...y,style:{width:"100%",height:"100%",backgroundColor:"transparent"},onItemPresence:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemPresence:`,c);const u=n.onOnItemPresence||n.onItemPresence||n["onItem-presence"]||n.onitempresence;typeof u=="function"&&u(c)},onTabSelected:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabSelected:`,c);const u=n.onOnTabSelected||n.onTabSelected||n["onTab-selected"]||n.ontabselected;typeof u=="function"&&u(c)},onTabNeedsData:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabNeedsData:`,c);const u=n.onOnTabNeedsData||n.onTabNeedsData||n["onTab-needs-data"]||n.ontabneedsdata;typeof u=="function"&&u(c)},onLoadMore:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onLoadMore:`,c);const u=n.onOnLoadMore||n.onLoadMore||n["onLoad-more"]||n.onloadmore;typeof u=="function"&&u(c)},onTabFocused:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onTabFocused:`,c);const u=n.onOnTabFocused||n.onTabFocused||n["onTab-focused"]||n.ontabfocused;typeof u=="function"&&u(c)},onItemClick:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemClick:`,c);const u=n.onOnItemClick||n.onItemClick||n["onItem-click"]||n.onitemclick;typeof u=="function"&&u(c)},onItemFocused:c=>{console.log(`[withAsyncPlugin] NativeTag=${e} 收到事件 onItemFocused:`,c);const u=n.onOnItemFocused||n.onItemFocused||n["onItem-focused"]||n.onitemfocused;typeof u=="function"&&u(c)}};return console.log("[withAsyncPlugin] 最终准备传递给 h() 的属性键集合:",Object.keys(P)),r.h("div",{class:d,style:v},[r.h(e,P,s.default?s.default():[])])}}})}const se={install:e=>{e.use(Z),e.use(ee),e.use(te),e.use(ne),e.use(oe)}};exports.DatePicker=U;exports.DatePickerPlugin=oe;exports.GridTabs=C;exports.GridTabsPlugin=Z;exports.Keyboard=Q;exports.KeyboardPlugin=te;exports.NumericKeyboard=F;exports.NumericKeyboardPlugin=ne;exports.PortalItem=L;exports.PortalPool=G;exports.QuickTVUINAddons=se;exports.QuickTVUINAddonsConfig=re;exports.RatingBar=K;exports.RatingBarPlugin=ee;exports.default=se;exports.diffGridTabsData=Y;exports.useGridItemPresence=de;exports.useGridTabs=ge;exports.useGridTabsData=me;exports.useGridTabsUpdater=fe;exports.withAsyncPlugin=x;
|