@uzum-tech/ui 1.11.2 → 1.12.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/index.js +10829 -6652
- package/dist/index.prod.js +4 -4
- package/es/_internal/icons/BurgerMenuIcon.d.ts +2 -0
- package/es/_internal/icons/BurgerMenuIcon.js +4 -0
- package/es/_internal/icons/Logout.d.ts +2 -0
- package/es/_internal/icons/Logout.js +4 -0
- package/es/_internal/icons/OzbekFlag.d.ts +2 -0
- package/es/_internal/icons/OzbekFlag.js +15 -0
- package/es/_internal/icons/RussiaFlag.d.ts +2 -0
- package/es/_internal/icons/RussiaFlag.js +11 -0
- package/es/_internal/icons/SendFilled.d.ts +2 -0
- package/es/_internal/icons/SendFilled.js +9 -0
- package/es/_internal/icons/index.d.ts +5 -0
- package/es/_internal/icons/index.js +5 -0
- package/es/_styles/common/dark.js +1 -1
- package/es/_styles/common/light.d.ts +1 -0
- package/es/_styles/common/light.js +1 -1
- package/es/chat/src/Chat.d.ts +464 -83
- package/es/chat/src/Chat.js +17 -2
- package/es/chat/src/ChatListItems.d.ts +497 -94
- package/es/chat/src/ChatListItems.js +1 -1
- package/es/chat/src/ChatMessages.d.ts +501 -94
- package/es/chat/src/ChatMessages.js +115 -22
- package/es/chat/src/ChatParts/MainArea.d.ts +7 -3
- package/es/chat/src/ChatParts/MainArea.js +110 -14
- package/es/chat/src/ChatParts/Sidebar.d.ts +64 -11
- package/es/chat/src/interface.d.ts +18 -0
- package/es/chat/src/interface.js +6 -0
- package/es/chat/src/styles/index.cssr.js +22 -1
- package/es/chat/styles/dark.d.ts +41 -8
- package/es/chat/styles/dark.js +6 -2
- package/es/chat/styles/light.d.ts +42 -8
- package/es/chat/styles/light.js +7 -2
- package/es/components.d.ts +3 -0
- package/es/components.js +3 -0
- package/es/config-provider/src/internal-interface.d.ts +17 -0
- package/es/dialog/src/DialogProvider.d.ts +2 -0
- package/es/form/src/FormItemCol.d.ts +2 -2
- package/es/form/src/FormItemGridItem.d.ts +2 -2
- package/es/form/src/FormItemRow.d.ts +1 -1
- package/es/grid/src/Grid.d.ts +1 -1
- package/es/grid/src/GridItem.d.ts +2 -2
- package/es/header/demos/mock.d.ts +2 -0
- package/es/header/demos/mock.js +235 -0
- package/es/header/index.d.ts +12 -0
- package/es/header/index.js +10 -0
- package/es/header/src/Header.d.ts +604 -0
- package/es/header/src/Header.js +320 -0
- package/es/header/src/HeaderActions.d.ts +120 -0
- package/es/header/src/HeaderActions.js +166 -0
- package/es/header/src/HeaderDesktopLayout.d.ts +25 -0
- package/es/header/src/HeaderDesktopLayout.js +24 -0
- package/es/header/src/HeaderMobileLayout.d.ts +25 -0
- package/es/header/src/HeaderMobileLayout.js +21 -0
- package/es/header/src/HeaderNavigation.d.ts +128 -0
- package/es/header/src/HeaderNavigation.js +172 -0
- package/es/header/src/HeaderSearchDesktop.d.ts +79 -0
- package/es/header/src/HeaderSearchDesktop.js +77 -0
- package/es/header/src/HeaderSearchMobile.d.ts +73 -0
- package/es/header/src/HeaderSearchMobile.js +126 -0
- package/es/header/src/HeaderSearchResults.d.ts +81 -0
- package/es/header/src/HeaderSearchResults.js +74 -0
- package/es/header/src/constants.d.ts +1 -0
- package/es/header/src/constants.js +1 -0
- package/es/header/src/interface.d.ts +58 -0
- package/es/header/src/interface.js +1 -0
- package/es/header/src/mobile/HeaderMobile.d.ts +218 -0
- package/es/header/src/mobile/HeaderMobile.js +241 -0
- package/es/header/src/styles/index.cssr.d.ts +6 -0
- package/es/header/src/styles/index.cssr.js +519 -0
- package/es/header/src/utils.d.ts +12 -0
- package/es/header/src/utils.js +47 -0
- package/es/header/styles/dark.d.ts +36 -0
- package/es/header/styles/dark.js +9 -0
- package/es/header/styles/index.d.ts +3 -0
- package/es/header/styles/index.js +2 -0
- package/es/header/styles/light.d.ts +72 -0
- package/es/header/styles/light.js +45 -0
- package/es/icon/src/Icon.d.ts +3 -0
- package/es/icon/src/Icon.js +3 -2
- package/es/icon-bar/index.d.ts +4 -0
- package/es/icon-bar/index.js +2 -0
- package/es/icon-bar/src/IconBar.d.ts +175 -0
- package/es/icon-bar/src/IconBar.js +57 -0
- package/es/icon-bar/src/IconBarItem.d.ts +163 -0
- package/es/icon-bar/src/IconBarItem.js +50 -0
- package/es/icon-bar/src/styles/index.cssr.d.ts +2 -0
- package/es/icon-bar/src/styles/index.cssr.js +62 -0
- package/es/icon-bar/styles/dark.d.ts +3 -0
- package/es/icon-bar/styles/dark.js +8 -0
- package/es/icon-bar/styles/index.d.ts +3 -0
- package/es/icon-bar/styles/index.js +2 -0
- package/es/icon-bar/styles/light.d.ts +19 -0
- package/es/icon-bar/styles/light.js +23 -0
- package/es/locales/common/arDZ.js +11 -1
- package/es/locales/common/deDE.js +11 -1
- package/es/locales/common/enGB.js +11 -1
- package/es/locales/common/enUS.d.ts +10 -0
- package/es/locales/common/enUS.js +11 -1
- package/es/locales/common/eo.js +11 -1
- package/es/locales/common/esAR.js +11 -1
- package/es/locales/common/faIR.js +11 -1
- package/es/locales/common/frFR.js +11 -1
- package/es/locales/common/idID.js +11 -1
- package/es/locales/common/itIT.js +11 -1
- package/es/locales/common/jaJP.js +11 -1
- package/es/locales/common/koKR.js +11 -1
- package/es/locales/common/nbNO.js +11 -1
- package/es/locales/common/nlNL.js +11 -1
- package/es/locales/common/plPL.js +11 -1
- package/es/locales/common/ptBR.js +11 -1
- package/es/locales/common/ruRU.js +11 -1
- package/es/locales/common/skSK.js +11 -1
- package/es/locales/common/svSE.js +11 -1
- package/es/locales/common/thTH.js +11 -1
- package/es/locales/common/trTR.js +11 -1
- package/es/locales/common/ukUA.js +11 -1
- package/es/locales/common/viVN.js +11 -1
- package/es/locales/common/zhCN.js +11 -1
- package/es/locales/common/zhTW.js +11 -1
- package/es/qr-code/index.d.ts +2 -0
- package/es/qr-code/index.js +1 -0
- package/es/qr-code/src/QrCode.d.ts +171 -0
- package/es/qr-code/src/QrCode.js +229 -0
- package/es/qr-code/src/qrcodegen.d.ts +95 -0
- package/es/qr-code/src/qrcodegen.js +949 -0
- package/es/qr-code/src/styles/index.cssr.d.ts +2 -0
- package/es/qr-code/src/styles/index.cssr.js +8 -0
- package/es/qr-code/styles/dark.d.ts +3 -0
- package/es/qr-code/styles/dark.js +11 -0
- package/es/qr-code/styles/index.d.ts +3 -0
- package/es/qr-code/styles/index.js +2 -0
- package/es/qr-code/styles/light.d.ts +9 -0
- package/es/qr-code/styles/light.js +12 -0
- package/es/theme-editor/src/ThemeEditor.d.ts +1 -0
- package/es/themes/dark.js +7 -1
- package/es/themes/light.js +7 -1
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/_internal/icons/BurgerMenuIcon.d.ts +2 -0
- package/lib/_internal/icons/BurgerMenuIcon.js +6 -0
- package/lib/_internal/icons/Logout.d.ts +2 -0
- package/lib/_internal/icons/Logout.js +6 -0
- package/lib/_internal/icons/OzbekFlag.d.ts +2 -0
- package/lib/_internal/icons/OzbekFlag.js +17 -0
- package/lib/_internal/icons/RussiaFlag.d.ts +2 -0
- package/lib/_internal/icons/RussiaFlag.js +13 -0
- package/lib/_internal/icons/SendFilled.d.ts +2 -0
- package/lib/_internal/icons/SendFilled.js +11 -0
- package/lib/_internal/icons/index.d.ts +5 -0
- package/lib/_internal/icons/index.js +11 -1
- package/lib/_styles/common/dark.js +1 -1
- package/lib/_styles/common/light.d.ts +1 -0
- package/lib/_styles/common/light.js +1 -1
- package/lib/chat/src/Chat.d.ts +464 -83
- package/lib/chat/src/Chat.js +17 -2
- package/lib/chat/src/ChatListItems.d.ts +497 -94
- package/lib/chat/src/ChatListItems.js +1 -1
- package/lib/chat/src/ChatMessages.d.ts +501 -94
- package/lib/chat/src/ChatMessages.js +113 -20
- package/lib/chat/src/ChatParts/MainArea.d.ts +7 -3
- package/lib/chat/src/ChatParts/MainArea.js +108 -12
- package/lib/chat/src/ChatParts/Sidebar.d.ts +64 -11
- package/lib/chat/src/interface.d.ts +18 -0
- package/lib/chat/src/interface.js +7 -1
- package/lib/chat/src/styles/index.cssr.js +22 -1
- package/lib/chat/styles/dark.d.ts +41 -8
- package/lib/chat/styles/dark.js +6 -2
- package/lib/chat/styles/light.d.ts +42 -8
- package/lib/chat/styles/light.js +7 -2
- package/lib/components.d.ts +3 -0
- package/lib/components.js +3 -0
- package/lib/config-provider/src/internal-interface.d.ts +17 -0
- package/lib/dialog/src/DialogProvider.d.ts +2 -0
- package/lib/form/src/FormItemCol.d.ts +2 -2
- package/lib/form/src/FormItemGridItem.d.ts +2 -2
- package/lib/form/src/FormItemRow.d.ts +1 -1
- package/lib/grid/src/Grid.d.ts +1 -1
- package/lib/grid/src/GridItem.d.ts +2 -2
- package/lib/header/demos/mock.d.ts +2 -0
- package/lib/header/demos/mock.js +238 -0
- package/lib/header/index.d.ts +12 -0
- package/lib/header/index.js +48 -0
- package/lib/header/src/Header.d.ts +604 -0
- package/lib/header/src/Header.js +349 -0
- package/lib/header/src/HeaderActions.d.ts +120 -0
- package/lib/header/src/HeaderActions.js +172 -0
- package/lib/header/src/HeaderDesktopLayout.d.ts +25 -0
- package/lib/header/src/HeaderDesktopLayout.js +27 -0
- package/lib/header/src/HeaderMobileLayout.d.ts +25 -0
- package/lib/header/src/HeaderMobileLayout.js +24 -0
- package/lib/header/src/HeaderNavigation.d.ts +128 -0
- package/lib/header/src/HeaderNavigation.js +175 -0
- package/lib/header/src/HeaderSearchDesktop.d.ts +79 -0
- package/lib/header/src/HeaderSearchDesktop.js +83 -0
- package/lib/header/src/HeaderSearchMobile.d.ts +73 -0
- package/lib/header/src/HeaderSearchMobile.js +132 -0
- package/lib/header/src/HeaderSearchResults.d.ts +81 -0
- package/lib/header/src/HeaderSearchResults.js +77 -0
- package/lib/header/src/constants.d.ts +1 -0
- package/lib/header/src/constants.js +4 -0
- package/lib/header/src/interface.d.ts +58 -0
- package/lib/header/src/interface.js +2 -0
- package/lib/header/src/mobile/HeaderMobile.d.ts +218 -0
- package/lib/header/src/mobile/HeaderMobile.js +244 -0
- package/lib/header/src/styles/index.cssr.d.ts +6 -0
- package/lib/header/src/styles/index.cssr.js +525 -0
- package/lib/header/src/utils.d.ts +12 -0
- package/lib/header/src/utils.js +58 -0
- package/lib/header/styles/dark.d.ts +36 -0
- package/lib/header/styles/dark.js +11 -0
- package/lib/header/styles/index.d.ts +3 -0
- package/lib/header/styles/index.js +10 -0
- package/lib/header/styles/light.d.ts +72 -0
- package/lib/header/styles/light.js +49 -0
- package/lib/icon/src/Icon.d.ts +3 -0
- package/lib/icon/src/Icon.js +3 -2
- package/lib/icon-bar/index.d.ts +4 -0
- package/lib/icon-bar/index.js +12 -0
- package/lib/icon-bar/src/IconBar.d.ts +175 -0
- package/lib/icon-bar/src/IconBar.js +63 -0
- package/lib/icon-bar/src/IconBarItem.d.ts +163 -0
- package/lib/icon-bar/src/IconBarItem.js +56 -0
- package/lib/icon-bar/src/styles/index.cssr.d.ts +2 -0
- package/lib/icon-bar/src/styles/index.cssr.js +67 -0
- package/lib/icon-bar/styles/dark.d.ts +3 -0
- package/lib/icon-bar/styles/dark.js +10 -0
- package/lib/icon-bar/styles/index.d.ts +3 -0
- package/lib/icon-bar/styles/index.js +10 -0
- package/lib/icon-bar/styles/light.d.ts +19 -0
- package/lib/icon-bar/styles/light.js +27 -0
- package/lib/locales/common/arDZ.js +11 -1
- package/lib/locales/common/deDE.js +11 -1
- package/lib/locales/common/enGB.js +11 -1
- package/lib/locales/common/enUS.d.ts +10 -0
- package/lib/locales/common/enUS.js +11 -1
- package/lib/locales/common/eo.js +11 -1
- package/lib/locales/common/esAR.js +11 -1
- package/lib/locales/common/faIR.js +11 -1
- package/lib/locales/common/frFR.js +11 -1
- package/lib/locales/common/idID.js +11 -1
- package/lib/locales/common/itIT.js +11 -1
- package/lib/locales/common/jaJP.js +11 -1
- package/lib/locales/common/koKR.js +11 -1
- package/lib/locales/common/nbNO.js +11 -1
- package/lib/locales/common/nlNL.js +11 -1
- package/lib/locales/common/plPL.js +11 -1
- package/lib/locales/common/ptBR.js +11 -1
- package/lib/locales/common/ruRU.js +11 -1
- package/lib/locales/common/skSK.js +11 -1
- package/lib/locales/common/svSE.js +11 -1
- package/lib/locales/common/thTH.js +11 -1
- package/lib/locales/common/trTR.js +11 -1
- package/lib/locales/common/ukUA.js +11 -1
- package/lib/locales/common/viVN.js +11 -1
- package/lib/locales/common/zhCN.js +11 -1
- package/lib/locales/common/zhTW.js +11 -1
- package/lib/qr-code/index.d.ts +2 -0
- package/lib/qr-code/index.js +9 -0
- package/lib/qr-code/src/QrCode.d.ts +171 -0
- package/lib/qr-code/src/QrCode.js +235 -0
- package/lib/qr-code/src/qrcodegen.d.ts +95 -0
- package/lib/qr-code/src/qrcodegen.js +950 -0
- package/lib/qr-code/src/styles/index.cssr.d.ts +2 -0
- package/lib/qr-code/src/styles/index.cssr.js +13 -0
- package/lib/qr-code/styles/dark.d.ts +3 -0
- package/lib/qr-code/styles/dark.js +13 -0
- package/lib/qr-code/styles/index.d.ts +3 -0
- package/lib/qr-code/styles/index.js +10 -0
- package/lib/qr-code/styles/light.d.ts +9 -0
- package/lib/qr-code/styles/light.js +14 -0
- package/lib/theme-editor/src/ThemeEditor.d.ts +1 -0
- package/lib/themes/dark.js +7 -1
- package/lib/themes/light.js +7 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/volar.d.ts +166 -153
- package/web-types.json +854 -2
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type PropType, type CSSProperties } from 'vue';
|
|
2
|
+
import type { HeaderSearchResult } from './interface';
|
|
3
|
+
export declare const headerSearchResultsProps: {
|
|
4
|
+
readonly version: {
|
|
5
|
+
readonly type: PropType<"desktop" | "mobile">;
|
|
6
|
+
readonly default: "desktop";
|
|
7
|
+
};
|
|
8
|
+
readonly results: {
|
|
9
|
+
readonly type: PropType<HeaderSearchResult[]>;
|
|
10
|
+
readonly default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
readonly loading: {
|
|
13
|
+
readonly type: BooleanConstructor;
|
|
14
|
+
readonly default: false;
|
|
15
|
+
};
|
|
16
|
+
readonly query: {
|
|
17
|
+
readonly type: StringConstructor;
|
|
18
|
+
readonly default: "";
|
|
19
|
+
};
|
|
20
|
+
readonly mergedClsPrefix: {
|
|
21
|
+
readonly type: PropType<string>;
|
|
22
|
+
readonly required: true;
|
|
23
|
+
};
|
|
24
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
25
|
+
readonly onSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
26
|
+
};
|
|
27
|
+
declare const _default: import("vue").DefineComponent<{
|
|
28
|
+
readonly version: {
|
|
29
|
+
readonly type: PropType<"desktop" | "mobile">;
|
|
30
|
+
readonly default: "desktop";
|
|
31
|
+
};
|
|
32
|
+
readonly results: {
|
|
33
|
+
readonly type: PropType<HeaderSearchResult[]>;
|
|
34
|
+
readonly default: () => never[];
|
|
35
|
+
};
|
|
36
|
+
readonly loading: {
|
|
37
|
+
readonly type: BooleanConstructor;
|
|
38
|
+
readonly default: false;
|
|
39
|
+
};
|
|
40
|
+
readonly query: {
|
|
41
|
+
readonly type: StringConstructor;
|
|
42
|
+
readonly default: "";
|
|
43
|
+
};
|
|
44
|
+
readonly mergedClsPrefix: {
|
|
45
|
+
readonly type: PropType<string>;
|
|
46
|
+
readonly required: true;
|
|
47
|
+
};
|
|
48
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
49
|
+
readonly onSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
50
|
+
}, {
|
|
51
|
+
placeholder: import("vue").ComputedRef<string>;
|
|
52
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
53
|
+
readonly version: {
|
|
54
|
+
readonly type: PropType<"desktop" | "mobile">;
|
|
55
|
+
readonly default: "desktop";
|
|
56
|
+
};
|
|
57
|
+
readonly results: {
|
|
58
|
+
readonly type: PropType<HeaderSearchResult[]>;
|
|
59
|
+
readonly default: () => never[];
|
|
60
|
+
};
|
|
61
|
+
readonly loading: {
|
|
62
|
+
readonly type: BooleanConstructor;
|
|
63
|
+
readonly default: false;
|
|
64
|
+
};
|
|
65
|
+
readonly query: {
|
|
66
|
+
readonly type: StringConstructor;
|
|
67
|
+
readonly default: "";
|
|
68
|
+
};
|
|
69
|
+
readonly mergedClsPrefix: {
|
|
70
|
+
readonly type: PropType<string>;
|
|
71
|
+
readonly required: true;
|
|
72
|
+
};
|
|
73
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
74
|
+
readonly onSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
75
|
+
}>>, {
|
|
76
|
+
readonly loading: boolean;
|
|
77
|
+
readonly results: HeaderSearchResult[];
|
|
78
|
+
readonly version: "mobile" | "desktop";
|
|
79
|
+
readonly query: string;
|
|
80
|
+
}, {}>;
|
|
81
|
+
export default _default;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { h, defineComponent, computed } from 'vue';
|
|
2
|
+
import { UEmpty } from '../../empty';
|
|
3
|
+
import { USpin } from '../../spin';
|
|
4
|
+
import { useLocale } from '../../_mixins';
|
|
5
|
+
export const headerSearchResultsProps = {
|
|
6
|
+
version: {
|
|
7
|
+
type: String,
|
|
8
|
+
default: 'desktop'
|
|
9
|
+
},
|
|
10
|
+
results: {
|
|
11
|
+
type: Array,
|
|
12
|
+
default: () => []
|
|
13
|
+
},
|
|
14
|
+
loading: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: false
|
|
17
|
+
},
|
|
18
|
+
query: {
|
|
19
|
+
type: String,
|
|
20
|
+
default: ''
|
|
21
|
+
},
|
|
22
|
+
mergedClsPrefix: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: true
|
|
25
|
+
},
|
|
26
|
+
cssVars: Object,
|
|
27
|
+
onSelect: Function
|
|
28
|
+
};
|
|
29
|
+
export default defineComponent({
|
|
30
|
+
name: 'HeaderSearchResults',
|
|
31
|
+
props: headerSearchResultsProps,
|
|
32
|
+
setup() {
|
|
33
|
+
const { localeRef } = useLocale('Header');
|
|
34
|
+
const placeholder = computed(() => localeRef.value.searchPlaceholder);
|
|
35
|
+
return {
|
|
36
|
+
placeholder
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
render() {
|
|
40
|
+
const blockClass = `${this.mergedClsPrefix}-header-search-results`;
|
|
41
|
+
const versionClass = `${blockClass}--${this.version}`;
|
|
42
|
+
if (this.loading) {
|
|
43
|
+
return (h("div", { class: [blockClass, versionClass], style: this.cssVars },
|
|
44
|
+
h("div", { class: `${blockClass}__loading` },
|
|
45
|
+
h(USpin, { size: "small" }),
|
|
46
|
+
h("span", null, this.placeholder))));
|
|
47
|
+
}
|
|
48
|
+
if (!this.results.length && this.query) {
|
|
49
|
+
return (h("div", { class: [blockClass, versionClass], style: this.cssVars },
|
|
50
|
+
h("div", { class: `${blockClass}__empty` },
|
|
51
|
+
h(UEmpty, { size: "small", description: "\u041D\u0438\u0447\u0435\u0433\u043E \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E" }))));
|
|
52
|
+
}
|
|
53
|
+
if (!this.results.length) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
return (h("div", { class: [blockClass, versionClass], style: this.cssVars },
|
|
57
|
+
h("div", { class: `${blockClass}__list` }, this.results.map((result) => (h("div", { key: result.key, class: [
|
|
58
|
+
`${blockClass}__item`,
|
|
59
|
+
result.disabled && `${blockClass}__item--disabled`
|
|
60
|
+
], onClick: () => {
|
|
61
|
+
var _a;
|
|
62
|
+
if (!result.disabled) {
|
|
63
|
+
(_a = this.onSelect) === null || _a === void 0 ? void 0 : _a.call(this, result);
|
|
64
|
+
}
|
|
65
|
+
} },
|
|
66
|
+
result.icon ? (h("span", { class: `${blockClass}__item-icon` }, typeof result.icon === 'function'
|
|
67
|
+
? result.icon()
|
|
68
|
+
: result.icon)) : null,
|
|
69
|
+
h("div", { class: `${blockClass}__item-content` },
|
|
70
|
+
h("div", { class: `${blockClass}__item-label` }, result.label),
|
|
71
|
+
result.description ? (h("div", { class: `${blockClass}__item-description` }, result.description)) : null),
|
|
72
|
+
result.extra ? (h("span", { class: `${blockClass}__item-extra` }, result.extra)) : null))))));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SEARCH_DEBOUNCE_MS = 300;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const SEARCH_DEBOUNCE_MS = 300;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type VNodeChild } from 'vue';
|
|
2
|
+
import type { MenuOption as BaseMenuOption, MenuGroupOption, MenuDividerOption, Key } from '../../menu/src/interface';
|
|
3
|
+
import type { TabsProps } from '../../tabs';
|
|
4
|
+
import { ImageProps } from '../../image';
|
|
5
|
+
export type HeaderMenuGroupOption = MenuGroupOption;
|
|
6
|
+
export type HeaderMenuDividerOption = MenuDividerOption;
|
|
7
|
+
export interface HeaderProps {
|
|
8
|
+
menuOptions?: HeaderMenuOption[];
|
|
9
|
+
langOptions?: LangOption[];
|
|
10
|
+
defaultLang?: string | number;
|
|
11
|
+
menuPlacement?: HeaderMenuPlacement;
|
|
12
|
+
menuTrigger?: HeaderMenuTrigger;
|
|
13
|
+
menuValue?: string | number | null;
|
|
14
|
+
defaultMenuValue?: string | number | null;
|
|
15
|
+
menuTabsProps?: HeaderMenuTabsProps;
|
|
16
|
+
menuCardMinColumnWidth?: string | number;
|
|
17
|
+
logoSrc?: string;
|
|
18
|
+
logoAlt?: string;
|
|
19
|
+
logoProps?: Partial<ImageProps>;
|
|
20
|
+
responsive?: boolean;
|
|
21
|
+
mobileMenuType?: 'drawer' | 'dropdown';
|
|
22
|
+
mobileActionsCollapse?: boolean;
|
|
23
|
+
mobileShowFooterActions?: boolean;
|
|
24
|
+
mobilePrimaryActionText?: string;
|
|
25
|
+
mobileSecondaryActionText?: string;
|
|
26
|
+
mobileShowHeaderActions?: boolean;
|
|
27
|
+
onSearch?: HeaderSearchHandler;
|
|
28
|
+
onUpdateMenuValue: (value: string | number | null) => void;
|
|
29
|
+
}
|
|
30
|
+
export interface HeaderMenuColumnOption {
|
|
31
|
+
type: 'column';
|
|
32
|
+
key?: Key;
|
|
33
|
+
children?: HeaderMenuChildOption[];
|
|
34
|
+
}
|
|
35
|
+
export interface LangOption {
|
|
36
|
+
label: string | (() => VNodeChild);
|
|
37
|
+
key: string | number;
|
|
38
|
+
icon?: () => VNodeChild;
|
|
39
|
+
}
|
|
40
|
+
export interface HeaderSearchResult {
|
|
41
|
+
key: string | number;
|
|
42
|
+
label: string;
|
|
43
|
+
description?: string;
|
|
44
|
+
icon?: () => VNodeChild;
|
|
45
|
+
extra?: string;
|
|
46
|
+
onClick?: () => void;
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export type HeaderSearchHandler = (query: string) => Promise<HeaderSearchResult[]> | HeaderSearchResult[];
|
|
50
|
+
export type HeaderMenuChildOption = HeaderMenuColumnOption | HeaderMenuGroupOption | HeaderMenuDividerOption | HeaderMenuOption;
|
|
51
|
+
export type HeaderMenuOption = Omit<BaseMenuOption, 'children'> & {
|
|
52
|
+
children?: HeaderMenuChildOption[];
|
|
53
|
+
onClick?: () => void;
|
|
54
|
+
hide?: boolean;
|
|
55
|
+
};
|
|
56
|
+
export type HeaderMenuPlacement = 'horizontal' | 'vertical' | 'top' | 'bottom' | 'left' | 'right';
|
|
57
|
+
export type HeaderMenuTrigger = 'click' | 'hover';
|
|
58
|
+
export type HeaderMenuTabsProps = Partial<TabsProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { type PropType, type VNodeChild, type CSSProperties } from 'vue';
|
|
2
|
+
import type { HeaderMenuOption, HeaderSearchHandler, HeaderSearchResult } from '../interface';
|
|
3
|
+
interface LangOption {
|
|
4
|
+
label: string | (() => VNodeChild);
|
|
5
|
+
key: string | number;
|
|
6
|
+
icon?: () => VNodeChild;
|
|
7
|
+
}
|
|
8
|
+
interface NormalizedMenuItem {
|
|
9
|
+
key: string | number;
|
|
10
|
+
option: HeaderMenuOption;
|
|
11
|
+
}
|
|
12
|
+
export declare const headerMobileProps: {
|
|
13
|
+
readonly visible: {
|
|
14
|
+
readonly type: BooleanConstructor;
|
|
15
|
+
readonly default: false;
|
|
16
|
+
};
|
|
17
|
+
readonly menuOptions: {
|
|
18
|
+
readonly type: PropType<NormalizedMenuItem[]>;
|
|
19
|
+
readonly default: () => never[];
|
|
20
|
+
};
|
|
21
|
+
readonly activeMenuValue: PropType<string | number | null>;
|
|
22
|
+
readonly langOptions: {
|
|
23
|
+
readonly type: PropType<LangOption[]>;
|
|
24
|
+
readonly required: true;
|
|
25
|
+
};
|
|
26
|
+
readonly currentLang: {
|
|
27
|
+
readonly type: PropType<LangOption>;
|
|
28
|
+
readonly required: true;
|
|
29
|
+
};
|
|
30
|
+
readonly mergedClsPrefix: {
|
|
31
|
+
readonly type: PropType<string>;
|
|
32
|
+
readonly required: true;
|
|
33
|
+
};
|
|
34
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
35
|
+
readonly menuType: {
|
|
36
|
+
readonly type: PropType<"drawer" | "dropdown">;
|
|
37
|
+
readonly default: "drawer";
|
|
38
|
+
};
|
|
39
|
+
readonly drawerPlacement: {
|
|
40
|
+
readonly type: PropType<"left" | "right">;
|
|
41
|
+
readonly default: "right";
|
|
42
|
+
};
|
|
43
|
+
readonly drawerWidth: {
|
|
44
|
+
readonly type: StringConstructor;
|
|
45
|
+
readonly default: "84%";
|
|
46
|
+
};
|
|
47
|
+
readonly showFooterActions: {
|
|
48
|
+
readonly type: BooleanConstructor;
|
|
49
|
+
readonly default: true;
|
|
50
|
+
};
|
|
51
|
+
readonly primaryActionText: {
|
|
52
|
+
readonly type: StringConstructor;
|
|
53
|
+
readonly default: undefined;
|
|
54
|
+
};
|
|
55
|
+
readonly secondaryActionText: {
|
|
56
|
+
readonly type: StringConstructor;
|
|
57
|
+
readonly default: undefined;
|
|
58
|
+
};
|
|
59
|
+
readonly showHeaderActions: {
|
|
60
|
+
readonly type: BooleanConstructor;
|
|
61
|
+
readonly default: true;
|
|
62
|
+
};
|
|
63
|
+
readonly onToggle: PropType<() => void>;
|
|
64
|
+
readonly onClose: PropType<() => void>;
|
|
65
|
+
readonly onMenuItemClick: PropType<(option: HeaderMenuOption) => void>;
|
|
66
|
+
readonly onLanguageSelect: PropType<(key: string | number) => void>;
|
|
67
|
+
readonly onPrimaryAction: PropType<() => void>;
|
|
68
|
+
readonly onSecondaryAction: PropType<() => void>;
|
|
69
|
+
readonly onSearchClick: PropType<() => void>;
|
|
70
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
71
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
72
|
+
readonly onPreview: PropType<() => void>;
|
|
73
|
+
readonly onLogout: PropType<() => void>;
|
|
74
|
+
};
|
|
75
|
+
declare const _default: import("vue").DefineComponent<{
|
|
76
|
+
readonly visible: {
|
|
77
|
+
readonly type: BooleanConstructor;
|
|
78
|
+
readonly default: false;
|
|
79
|
+
};
|
|
80
|
+
readonly menuOptions: {
|
|
81
|
+
readonly type: PropType<NormalizedMenuItem[]>;
|
|
82
|
+
readonly default: () => never[];
|
|
83
|
+
};
|
|
84
|
+
readonly activeMenuValue: PropType<string | number | null>;
|
|
85
|
+
readonly langOptions: {
|
|
86
|
+
readonly type: PropType<LangOption[]>;
|
|
87
|
+
readonly required: true;
|
|
88
|
+
};
|
|
89
|
+
readonly currentLang: {
|
|
90
|
+
readonly type: PropType<LangOption>;
|
|
91
|
+
readonly required: true;
|
|
92
|
+
};
|
|
93
|
+
readonly mergedClsPrefix: {
|
|
94
|
+
readonly type: PropType<string>;
|
|
95
|
+
readonly required: true;
|
|
96
|
+
};
|
|
97
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
98
|
+
readonly menuType: {
|
|
99
|
+
readonly type: PropType<"drawer" | "dropdown">;
|
|
100
|
+
readonly default: "drawer";
|
|
101
|
+
};
|
|
102
|
+
readonly drawerPlacement: {
|
|
103
|
+
readonly type: PropType<"left" | "right">;
|
|
104
|
+
readonly default: "right";
|
|
105
|
+
};
|
|
106
|
+
readonly drawerWidth: {
|
|
107
|
+
readonly type: StringConstructor;
|
|
108
|
+
readonly default: "84%";
|
|
109
|
+
};
|
|
110
|
+
readonly showFooterActions: {
|
|
111
|
+
readonly type: BooleanConstructor;
|
|
112
|
+
readonly default: true;
|
|
113
|
+
};
|
|
114
|
+
readonly primaryActionText: {
|
|
115
|
+
readonly type: StringConstructor;
|
|
116
|
+
readonly default: undefined;
|
|
117
|
+
};
|
|
118
|
+
readonly secondaryActionText: {
|
|
119
|
+
readonly type: StringConstructor;
|
|
120
|
+
readonly default: undefined;
|
|
121
|
+
};
|
|
122
|
+
readonly showHeaderActions: {
|
|
123
|
+
readonly type: BooleanConstructor;
|
|
124
|
+
readonly default: true;
|
|
125
|
+
};
|
|
126
|
+
readonly onToggle: PropType<() => void>;
|
|
127
|
+
readonly onClose: PropType<() => void>;
|
|
128
|
+
readonly onMenuItemClick: PropType<(option: HeaderMenuOption) => void>;
|
|
129
|
+
readonly onLanguageSelect: PropType<(key: string | number) => void>;
|
|
130
|
+
readonly onPrimaryAction: PropType<() => void>;
|
|
131
|
+
readonly onSecondaryAction: PropType<() => void>;
|
|
132
|
+
readonly onSearchClick: PropType<() => void>;
|
|
133
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
134
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
135
|
+
readonly onPreview: PropType<() => void>;
|
|
136
|
+
readonly onLogout: PropType<() => void>;
|
|
137
|
+
}, {
|
|
138
|
+
blockClass: import("vue").ComputedRef<string>;
|
|
139
|
+
mobileMenuClass: import("vue").ComputedRef<string>;
|
|
140
|
+
expandedKeys: import("vue").Ref<Set<string | number>>;
|
|
141
|
+
normalizeMobileMenuOptions: import("vue").ComputedRef<NormalizedMenuItem[]>;
|
|
142
|
+
primaryActionTextRef: import("vue").ComputedRef<string>;
|
|
143
|
+
secondaryActionTextRef: import("vue").ComputedRef<string>;
|
|
144
|
+
toggleExpand: (key: string | number) => void;
|
|
145
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
146
|
+
readonly visible: {
|
|
147
|
+
readonly type: BooleanConstructor;
|
|
148
|
+
readonly default: false;
|
|
149
|
+
};
|
|
150
|
+
readonly menuOptions: {
|
|
151
|
+
readonly type: PropType<NormalizedMenuItem[]>;
|
|
152
|
+
readonly default: () => never[];
|
|
153
|
+
};
|
|
154
|
+
readonly activeMenuValue: PropType<string | number | null>;
|
|
155
|
+
readonly langOptions: {
|
|
156
|
+
readonly type: PropType<LangOption[]>;
|
|
157
|
+
readonly required: true;
|
|
158
|
+
};
|
|
159
|
+
readonly currentLang: {
|
|
160
|
+
readonly type: PropType<LangOption>;
|
|
161
|
+
readonly required: true;
|
|
162
|
+
};
|
|
163
|
+
readonly mergedClsPrefix: {
|
|
164
|
+
readonly type: PropType<string>;
|
|
165
|
+
readonly required: true;
|
|
166
|
+
};
|
|
167
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
168
|
+
readonly menuType: {
|
|
169
|
+
readonly type: PropType<"drawer" | "dropdown">;
|
|
170
|
+
readonly default: "drawer";
|
|
171
|
+
};
|
|
172
|
+
readonly drawerPlacement: {
|
|
173
|
+
readonly type: PropType<"left" | "right">;
|
|
174
|
+
readonly default: "right";
|
|
175
|
+
};
|
|
176
|
+
readonly drawerWidth: {
|
|
177
|
+
readonly type: StringConstructor;
|
|
178
|
+
readonly default: "84%";
|
|
179
|
+
};
|
|
180
|
+
readonly showFooterActions: {
|
|
181
|
+
readonly type: BooleanConstructor;
|
|
182
|
+
readonly default: true;
|
|
183
|
+
};
|
|
184
|
+
readonly primaryActionText: {
|
|
185
|
+
readonly type: StringConstructor;
|
|
186
|
+
readonly default: undefined;
|
|
187
|
+
};
|
|
188
|
+
readonly secondaryActionText: {
|
|
189
|
+
readonly type: StringConstructor;
|
|
190
|
+
readonly default: undefined;
|
|
191
|
+
};
|
|
192
|
+
readonly showHeaderActions: {
|
|
193
|
+
readonly type: BooleanConstructor;
|
|
194
|
+
readonly default: true;
|
|
195
|
+
};
|
|
196
|
+
readonly onToggle: PropType<() => void>;
|
|
197
|
+
readonly onClose: PropType<() => void>;
|
|
198
|
+
readonly onMenuItemClick: PropType<(option: HeaderMenuOption) => void>;
|
|
199
|
+
readonly onLanguageSelect: PropType<(key: string | number) => void>;
|
|
200
|
+
readonly onPrimaryAction: PropType<() => void>;
|
|
201
|
+
readonly onSecondaryAction: PropType<() => void>;
|
|
202
|
+
readonly onSearchClick: PropType<() => void>;
|
|
203
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
204
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
205
|
+
readonly onPreview: PropType<() => void>;
|
|
206
|
+
readonly onLogout: PropType<() => void>;
|
|
207
|
+
}>>, {
|
|
208
|
+
readonly primaryActionText: string;
|
|
209
|
+
readonly secondaryActionText: string;
|
|
210
|
+
readonly visible: boolean;
|
|
211
|
+
readonly menuOptions: NormalizedMenuItem[];
|
|
212
|
+
readonly menuType: "drawer" | "dropdown";
|
|
213
|
+
readonly drawerPlacement: "left" | "right";
|
|
214
|
+
readonly drawerWidth: string;
|
|
215
|
+
readonly showFooterActions: boolean;
|
|
216
|
+
readonly showHeaderActions: boolean;
|
|
217
|
+
}, {}>;
|
|
218
|
+
export default _default;
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import { h, defineComponent, computed, ref, Fragment } from 'vue';
|
|
2
|
+
import { UButton } from '../../../button';
|
|
3
|
+
import { UIcon } from '../../../icon';
|
|
4
|
+
import { UDrawer } from '../../../drawer';
|
|
5
|
+
import { UDropdown } from '../../../dropdown';
|
|
6
|
+
import { EyeIcon, CloseIcon, LogoutIcon, SearchIcon, ChevronDownIcon, BurgerMenuIcon } from '../../../_internal/icons';
|
|
7
|
+
import { UFlex } from '../../../flex';
|
|
8
|
+
import { renderOptionLabel, renderBadge, hasChildren } from '../utils';
|
|
9
|
+
import { useLocale } from '../../../_mixins';
|
|
10
|
+
export const headerMobileProps = {
|
|
11
|
+
visible: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: false
|
|
14
|
+
},
|
|
15
|
+
menuOptions: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
activeMenuValue: [String, Number],
|
|
20
|
+
langOptions: {
|
|
21
|
+
type: Array,
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
currentLang: {
|
|
25
|
+
type: Object,
|
|
26
|
+
required: true
|
|
27
|
+
},
|
|
28
|
+
mergedClsPrefix: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
cssVars: Object,
|
|
33
|
+
menuType: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: 'drawer'
|
|
36
|
+
},
|
|
37
|
+
drawerPlacement: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'right'
|
|
40
|
+
},
|
|
41
|
+
drawerWidth: {
|
|
42
|
+
type: String,
|
|
43
|
+
default: '84%'
|
|
44
|
+
},
|
|
45
|
+
showFooterActions: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: true
|
|
48
|
+
},
|
|
49
|
+
primaryActionText: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: undefined
|
|
52
|
+
},
|
|
53
|
+
secondaryActionText: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: undefined
|
|
56
|
+
},
|
|
57
|
+
showHeaderActions: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: true
|
|
60
|
+
},
|
|
61
|
+
onToggle: Function,
|
|
62
|
+
onClose: Function,
|
|
63
|
+
onMenuItemClick: Function,
|
|
64
|
+
onLanguageSelect: Function,
|
|
65
|
+
onPrimaryAction: Function,
|
|
66
|
+
onSecondaryAction: Function,
|
|
67
|
+
onSearchClick: Function,
|
|
68
|
+
onSearch: Function,
|
|
69
|
+
onSearchResultSelect: Function,
|
|
70
|
+
onPreview: Function,
|
|
71
|
+
onLogout: Function
|
|
72
|
+
};
|
|
73
|
+
export default defineComponent({
|
|
74
|
+
name: 'HeaderMobile',
|
|
75
|
+
props: headerMobileProps,
|
|
76
|
+
setup(props) {
|
|
77
|
+
const { localeRef } = useLocale('Header');
|
|
78
|
+
const blockClassRef = computed(() => `${props.mergedClsPrefix}-header`);
|
|
79
|
+
const mobileMenuClassRef = computed(() => `${props.mergedClsPrefix}-header-mobile-menu`);
|
|
80
|
+
const expandedKeysRef = ref(new Set());
|
|
81
|
+
const toggleExpand = (key) => {
|
|
82
|
+
const newSet = new Set(expandedKeysRef.value);
|
|
83
|
+
if (newSet.has(key)) {
|
|
84
|
+
newSet.delete(key);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
newSet.add(key);
|
|
88
|
+
}
|
|
89
|
+
expandedKeysRef.value = newSet;
|
|
90
|
+
};
|
|
91
|
+
const normalizeMobileMenuOptions = computed(() => {
|
|
92
|
+
return props.menuOptions.map((item) => {
|
|
93
|
+
const option = item.option;
|
|
94
|
+
if (!option.children || !Array.isArray(option.children)) {
|
|
95
|
+
return item;
|
|
96
|
+
}
|
|
97
|
+
const hasColumns = option.children.some((child) => child.type === 'column');
|
|
98
|
+
if (!hasColumns) {
|
|
99
|
+
return item;
|
|
100
|
+
}
|
|
101
|
+
const flattenedChildren = [];
|
|
102
|
+
option.children.forEach((child) => {
|
|
103
|
+
if (child.type === 'column' && Array.isArray(child.children)) {
|
|
104
|
+
flattenedChildren.push(...child.children);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
flattenedChildren.push(child);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
return Object.assign(Object.assign({}, item), { option: Object.assign(Object.assign({}, option), { children: flattenedChildren }) });
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
const primaryActionTextRef = computed(() => { var _a; return (_a = props.primaryActionText) !== null && _a !== void 0 ? _a : localeRef.value.primaryActionText; });
|
|
114
|
+
const secondaryActionTextRef = computed(() => { var _a; return (_a = props.secondaryActionText) !== null && _a !== void 0 ? _a : localeRef.value.secondaryActionText; });
|
|
115
|
+
return {
|
|
116
|
+
blockClass: blockClassRef,
|
|
117
|
+
mobileMenuClass: mobileMenuClassRef,
|
|
118
|
+
expandedKeys: expandedKeysRef,
|
|
119
|
+
normalizeMobileMenuOptions,
|
|
120
|
+
primaryActionTextRef,
|
|
121
|
+
secondaryActionTextRef,
|
|
122
|
+
toggleExpand
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
render() {
|
|
126
|
+
const blockClass = this.blockClass;
|
|
127
|
+
const mobileMenuClass = this.mobileMenuClass;
|
|
128
|
+
const renderGroupItem = (child, parentKey, index) => {
|
|
129
|
+
const childKey = typeof child.key === 'string' || typeof child.key === 'number'
|
|
130
|
+
? child.key
|
|
131
|
+
: `${parentKey}-child-${index}`;
|
|
132
|
+
const isGroup = child.type === 'group';
|
|
133
|
+
const hasGroupChildren = isGroup && Array.isArray(child.children) && child.children.length > 0;
|
|
134
|
+
if (isGroup && hasGroupChildren && child.children) {
|
|
135
|
+
return (h("div", { key: childKey, class: `${mobileMenuClass}__group` },
|
|
136
|
+
h("div", { class: `${mobileMenuClass}__group-title` }, renderOptionLabel(child)),
|
|
137
|
+
h("div", { class: `${mobileMenuClass}__group-items` }, child.children.map((groupChild, groupIndex) => {
|
|
138
|
+
const groupChildKey = typeof groupChild.key === 'string' ||
|
|
139
|
+
typeof groupChild.key === 'number'
|
|
140
|
+
? groupChild.key
|
|
141
|
+
: `${childKey}-item-${groupIndex}`;
|
|
142
|
+
return (h("div", { key: groupChildKey, class: [
|
|
143
|
+
`${mobileMenuClass}__group-item`,
|
|
144
|
+
this.activeMenuValue === groupChild.key &&
|
|
145
|
+
`${mobileMenuClass}__group-item--active`
|
|
146
|
+
], onClick: () => {
|
|
147
|
+
var _a;
|
|
148
|
+
if (!groupChild.disabled) {
|
|
149
|
+
(_a = this.onMenuItemClick) === null || _a === void 0 ? void 0 : _a.call(this, groupChild);
|
|
150
|
+
}
|
|
151
|
+
} },
|
|
152
|
+
h("span", { class: `${mobileMenuClass}__group-item-label` }, renderOptionLabel(groupChild)),
|
|
153
|
+
renderBadge(groupChild, `${blockClass}__badge`)));
|
|
154
|
+
}))));
|
|
155
|
+
}
|
|
156
|
+
return (h("div", { key: childKey, class: [
|
|
157
|
+
`${mobileMenuClass}__child-item`,
|
|
158
|
+
this.activeMenuValue === child.key &&
|
|
159
|
+
`${mobileMenuClass}__child-item--active`
|
|
160
|
+
], onClick: () => {
|
|
161
|
+
var _a;
|
|
162
|
+
if (!child.disabled) {
|
|
163
|
+
(_a = this.onMenuItemClick) === null || _a === void 0 ? void 0 : _a.call(this, child);
|
|
164
|
+
}
|
|
165
|
+
} },
|
|
166
|
+
h("span", { class: `${mobileMenuClass}__child-item-label` }, renderOptionLabel(child)),
|
|
167
|
+
renderBadge(child, `${blockClass}__badge`)));
|
|
168
|
+
};
|
|
169
|
+
const renderMobileMenuItem = (item) => {
|
|
170
|
+
const option = item.option;
|
|
171
|
+
const isExpandable = hasChildren(option);
|
|
172
|
+
const isExpanded = this.expandedKeys.has(item.key);
|
|
173
|
+
const handleClick = () => {
|
|
174
|
+
var _a;
|
|
175
|
+
if (option.disabled)
|
|
176
|
+
return;
|
|
177
|
+
if (isExpandable) {
|
|
178
|
+
this.toggleExpand(item.key);
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
(_a = this.onMenuItemClick) === null || _a === void 0 ? void 0 : _a.call(this, option);
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
return (h("div", { key: item.key },
|
|
185
|
+
h("div", { class: [
|
|
186
|
+
`${mobileMenuClass}__item`,
|
|
187
|
+
isExpandable && `${mobileMenuClass}__item--expandable`,
|
|
188
|
+
isExpanded && `${mobileMenuClass}__item--expanded`,
|
|
189
|
+
this.activeMenuValue === item.key &&
|
|
190
|
+
`${mobileMenuClass}__item--active`,
|
|
191
|
+
option.disabled && `${mobileMenuClass}__item--disabled`
|
|
192
|
+
], onClick: handleClick },
|
|
193
|
+
option.icon ? (h("span", { class: `${mobileMenuClass}__item-icon` }, typeof option.icon === 'function'
|
|
194
|
+
? option.icon()
|
|
195
|
+
: option.icon)) : null,
|
|
196
|
+
h("span", { class: `${mobileMenuClass}__item-label` }, renderOptionLabel(option)),
|
|
197
|
+
renderBadge(option, `${blockClass}__badge`)),
|
|
198
|
+
isExpandable && isExpanded && option.children && (h("div", { class: `${mobileMenuClass}__children` }, option.children.map((child, index) => renderGroupItem(child, item.key, index))))));
|
|
199
|
+
};
|
|
200
|
+
const mobileMenuContent = (h("div", { class: mobileMenuClass, style: this.cssVars },
|
|
201
|
+
h("div", { class: `${mobileMenuClass}__header` },
|
|
202
|
+
this.$slots.actions ? (h("div", { class: `${mobileMenuClass}__actions` }, this.$slots.actions())) : this.showHeaderActions ? (h("div", { class: `${mobileMenuClass}__actions` },
|
|
203
|
+
h(UDropdown, { trigger: "click", options: this.langOptions, onSelect: this.onLanguageSelect }, {
|
|
204
|
+
default: () => (h(UButton, { text: true, size: "small", renderIcon: () => (h(UIcon, { size: 24 }, () => h(ChevronDownIcon, null))), iconPlacement: "right" }, {
|
|
205
|
+
default: () => (h(UFlex, { size: 14, align: "center", class: `${mobileMenuClass}__lang-content` }, {
|
|
206
|
+
default: () => {
|
|
207
|
+
var _a, _b;
|
|
208
|
+
return ((_a = this.currentLang) === null || _a === void 0 ? void 0 : _a.icon) ? (h(Fragment, null,
|
|
209
|
+
h(UFlex, null, {
|
|
210
|
+
default: () => { var _a, _b; return (_b = (_a = this.currentLang) === null || _a === void 0 ? void 0 : _a.icon) === null || _b === void 0 ? void 0 : _b.call(_a); }
|
|
211
|
+
}),
|
|
212
|
+
h("span", null, (_b = this.currentLang) === null || _b === void 0 ? void 0 : _b.label))) : null;
|
|
213
|
+
}
|
|
214
|
+
}))
|
|
215
|
+
}))
|
|
216
|
+
}),
|
|
217
|
+
h(UFlex, { size: 24 }, {
|
|
218
|
+
default: () => (h(Fragment, null,
|
|
219
|
+
h(UButton, { text: true, onClick: this.onSearchClick }, () => h(UIcon, { size: 24 }, () => h(SearchIcon, null))),
|
|
220
|
+
h(UButton, { text: true, onClick: this.onPreview }, () => h(UIcon, { size: 24 }, () => h(EyeIcon, null))),
|
|
221
|
+
h(UButton, { text: true, onClick: this.onLogout }, () => h(UIcon, { size: 24 }, () => h(LogoutIcon, null)))))
|
|
222
|
+
}))) : null,
|
|
223
|
+
h(UButton, { text: true, class: `${mobileMenuClass}__close`, onClick: this.onClose }, () => h(UIcon, { size: 24 }, () => h(CloseIcon, null)))),
|
|
224
|
+
h("div", { class: `${mobileMenuClass}__body` },
|
|
225
|
+
h("div", { class: `${mobileMenuClass}__list` }, this.normalizeMobileMenuOptions.map(renderMobileMenuItem))),
|
|
226
|
+
this.$slots.footer ? (h("div", { class: `${mobileMenuClass}__footer` }, this.$slots.footer())) : this.showFooterActions ? (h("div", { class: `${mobileMenuClass}__footer` },
|
|
227
|
+
h(UButton, { type: "primary", size: "large", block: true, round: true, onClick: this.onPrimaryAction }, () => this.primaryActionTextRef),
|
|
228
|
+
h(UButton, { size: "large", block: true, round: true, onClick: this.onSecondaryAction }, () => this.secondaryActionTextRef))) : null));
|
|
229
|
+
const burgerButton = (h(UButton, { text: true, class: `${blockClass}__burger`, onClick: this.onToggle }, () => h(UIcon, { size: 24 }, () => h(BurgerMenuIcon, null))));
|
|
230
|
+
return (h(UFlex, null, {
|
|
231
|
+
default: () => (h(Fragment, null,
|
|
232
|
+
burgerButton,
|
|
233
|
+
this.menuType === 'drawer' ? (h(UDrawer, { show: this.visible, width: this.drawerWidth, placement: this.drawerPlacement, "auto-focus": false, onUpdateShow: (show) => {
|
|
234
|
+
var _a;
|
|
235
|
+
if (!show) {
|
|
236
|
+
(_a = this.onClose) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
237
|
+
}
|
|
238
|
+
} }, () => mobileMenuContent)) : null))
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
});
|