@uzum-tech/ui 1.11.1 → 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 +10830 -6653
- 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/modal-fullscreen/src/ModalFull.js +1 -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/modal-fullscreen/src/ModalFull.js +1 -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 +12 -0
- package/web-types.json +854 -2
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { h, Fragment, defineComponent, computed, ref, toRef, onBeforeMount } from 'vue';
|
|
11
|
+
import { useMergedState } from 'vooks';
|
|
12
|
+
import style, { headerMobileMenuStyle, headerSearchMobileStyle, headerSearchDesktopStyle, headerSearchResultsStyle } from './styles/index.cssr';
|
|
13
|
+
import { useConfig, useTheme, useThemeClass } from '../../_mixins';
|
|
14
|
+
import { headerLight } from '../styles';
|
|
15
|
+
import { formatLength, resolveWrappedSlot, call } from '../../_utils';
|
|
16
|
+
import { getMenuItemKey } from './utils';
|
|
17
|
+
import { useIsMobile } from '../../_utils/composable/composables';
|
|
18
|
+
import { UIcon } from '../../icon';
|
|
19
|
+
import HeaderNavigation from './HeaderNavigation';
|
|
20
|
+
import HeaderMobile from './mobile/HeaderMobile';
|
|
21
|
+
import HeaderActions from './HeaderActions';
|
|
22
|
+
import HeaderDesktopLayout from './HeaderDesktopLayout';
|
|
23
|
+
import HeaderMobileLayout from './HeaderMobileLayout';
|
|
24
|
+
import HeaderSearchMobile from './HeaderSearchMobile';
|
|
25
|
+
import { RussiaFlag, OzbekFlag } from '../../_internal/icons';
|
|
26
|
+
const defaultLogoSrc = '/demo/assets/images/logo.svg';
|
|
27
|
+
const defaultLangOptions = [
|
|
28
|
+
{
|
|
29
|
+
label: 'Русский',
|
|
30
|
+
key: 'ru',
|
|
31
|
+
icon: () => h(UIcon, { size: 18 }, {
|
|
32
|
+
default: () => h(RussiaFlag)
|
|
33
|
+
})
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
label: "O'zbek",
|
|
37
|
+
key: 'uz',
|
|
38
|
+
icon: () => h(UIcon, { size: 18 }, {
|
|
39
|
+
default: () => h(OzbekFlag)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
];
|
|
43
|
+
export const headerProps = Object.assign(Object.assign({}, useTheme.props), { menuOptions: {
|
|
44
|
+
type: Array,
|
|
45
|
+
default: () => []
|
|
46
|
+
}, langOptions: {
|
|
47
|
+
type: Array,
|
|
48
|
+
default: () => defaultLangOptions
|
|
49
|
+
}, defaultLang: [String, Number], menuPlacement: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'horizontal'
|
|
52
|
+
}, menuTrigger: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'hover'
|
|
55
|
+
}, menuValue: [String, Number], defaultMenuValue: [String, Number], menuTabsProps: {
|
|
56
|
+
type: Object,
|
|
57
|
+
default: () => ({})
|
|
58
|
+
}, menuCardMinColumnWidth: {
|
|
59
|
+
type: [Number, String],
|
|
60
|
+
default: 220
|
|
61
|
+
}, logoSrc: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: () => defaultLogoSrc
|
|
64
|
+
}, logoAlt: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: 'Header logo'
|
|
67
|
+
}, responsive: {
|
|
68
|
+
type: Boolean,
|
|
69
|
+
default: true
|
|
70
|
+
}, mobileMenuType: {
|
|
71
|
+
type: String,
|
|
72
|
+
default: 'drawer'
|
|
73
|
+
}, mobileActionsCollapse: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: true
|
|
76
|
+
}, mobileShowFooterActions: {
|
|
77
|
+
type: Boolean,
|
|
78
|
+
default: true
|
|
79
|
+
}, mobilePrimaryActionText: {
|
|
80
|
+
type: String,
|
|
81
|
+
default: undefined
|
|
82
|
+
}, mobileSecondaryActionText: {
|
|
83
|
+
type: String,
|
|
84
|
+
default: undefined
|
|
85
|
+
}, mobileShowHeaderActions: {
|
|
86
|
+
type: Boolean,
|
|
87
|
+
default: true
|
|
88
|
+
}, onSearch: Function, 'onUpdate:menuValue': [Function, Array], onUpdateMenuValue: [Function, Array] });
|
|
89
|
+
export default defineComponent({
|
|
90
|
+
name: 'Header',
|
|
91
|
+
props: headerProps,
|
|
92
|
+
emits: [
|
|
93
|
+
'search',
|
|
94
|
+
'search-result-select',
|
|
95
|
+
'preview',
|
|
96
|
+
'logout',
|
|
97
|
+
'language-select',
|
|
98
|
+
'mobile-primary-action',
|
|
99
|
+
'mobile-secondary-action'
|
|
100
|
+
],
|
|
101
|
+
setup(props, { emit }) {
|
|
102
|
+
var _a, _b, _c;
|
|
103
|
+
const { mergedClsPrefixRef } = useConfig(props);
|
|
104
|
+
const themeRef = useTheme('Header', '-header', style, headerLight, props, mergedClsPrefixRef);
|
|
105
|
+
const isMobileRef = useIsMobile();
|
|
106
|
+
const mobileMenuVisibleRef = ref(false);
|
|
107
|
+
const searchVisibleRef = ref(false);
|
|
108
|
+
onBeforeMount(() => {
|
|
109
|
+
headerMobileMenuStyle.mount({
|
|
110
|
+
id: `${mergedClsPrefixRef.value}-header-mobile-menu`,
|
|
111
|
+
head: true
|
|
112
|
+
});
|
|
113
|
+
headerSearchMobileStyle.mount({
|
|
114
|
+
id: `${mergedClsPrefixRef.value}-header-search-mobile`,
|
|
115
|
+
head: true
|
|
116
|
+
});
|
|
117
|
+
headerSearchDesktopStyle.mount({
|
|
118
|
+
id: `${mergedClsPrefixRef.value}-header-search-desktop`,
|
|
119
|
+
head: true
|
|
120
|
+
});
|
|
121
|
+
headerSearchResultsStyle.mount({
|
|
122
|
+
id: `${mergedClsPrefixRef.value}-header-search-results`,
|
|
123
|
+
head: true
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
const currentLang = ref(((_a = props.langOptions) === null || _a === void 0 ? void 0 : _a.find((opt) => opt.key === props.defaultLang)) ||
|
|
127
|
+
((_b = props.langOptions) === null || _b === void 0 ? void 0 : _b[0]) ||
|
|
128
|
+
defaultLangOptions[0]);
|
|
129
|
+
const controlledMenuValueRef = toRef(props, 'menuValue');
|
|
130
|
+
const uncontrolledMenuValueRef = ref((_c = props.defaultMenuValue) !== null && _c !== void 0 ? _c : null);
|
|
131
|
+
const mergedMenuValueRef = useMergedState(controlledMenuValueRef, uncontrolledMenuValueRef);
|
|
132
|
+
const normalizedMenuItemsRef = computed(() => {
|
|
133
|
+
var _a;
|
|
134
|
+
return (_a = props.menuOptions) === null || _a === void 0 ? void 0 : _a.map((option, index) => ({
|
|
135
|
+
option,
|
|
136
|
+
key: getMenuItemKey(option, index)
|
|
137
|
+
}));
|
|
138
|
+
});
|
|
139
|
+
const cssVarsRef = computed(() => {
|
|
140
|
+
const { common: { cubicBezierEaseInOut }, self } = themeRef.value;
|
|
141
|
+
return {
|
|
142
|
+
'--u-bezier': cubicBezierEaseInOut,
|
|
143
|
+
'--u-font-size': self.fontSize,
|
|
144
|
+
'--u-font-title-small': self.fontTitleSmall,
|
|
145
|
+
'--u-header-text-color': self.textColor,
|
|
146
|
+
'--u-header-bg-color': self.backgroundColor,
|
|
147
|
+
'--u-header-radius': self.borderRadius,
|
|
148
|
+
'--u-header-shadow': self.shadow,
|
|
149
|
+
'--u-header-navigation-gap': self.navigationGap,
|
|
150
|
+
'--u-header-action-gap': self.actionGap,
|
|
151
|
+
'--u-header-tab-text-color': self.tabTextColor,
|
|
152
|
+
'--u-header-tab-text-color-hover': self.tabTextColorHover,
|
|
153
|
+
'--u-header-tab-text-color-active': self.tabTextColorActive,
|
|
154
|
+
'--u-header-tab-indicator-color': self.tabIndicatorColor,
|
|
155
|
+
'--u-header-card-bg-color': self.cardBackgroundColor,
|
|
156
|
+
'--u-header-card-radius': self.cardBorderRadius,
|
|
157
|
+
'--u-header-card-title-color': self.cardTitleColor,
|
|
158
|
+
'--u-header-card-item-color': self.cardItemColor,
|
|
159
|
+
'--u-header-card-item-hover-color': self.cardItemHoverColor,
|
|
160
|
+
'--u-header-card-divider-color': self.cardDividerColor,
|
|
161
|
+
'--u-header-card-gap': self.cardGap,
|
|
162
|
+
'--u-header-card-padding': self.cardPadding,
|
|
163
|
+
'--u-header-badge-bg-color': self.badgeBackgroundColor,
|
|
164
|
+
'--u-header-badge-text-color': self.badgeTextColor,
|
|
165
|
+
'--u-header-action-icon-color': self.actionIconColor,
|
|
166
|
+
'--u-header-action-icon-hover-color': self.actionIconColorHover,
|
|
167
|
+
'--u-header-card-min-col-width': formatLength(props.menuCardMinColumnWidth),
|
|
168
|
+
'--u-header-mobile-border-color': self.mobileBorderColor,
|
|
169
|
+
'--u-header-mobile-item-hover-color': self.mobileItemHoverColor,
|
|
170
|
+
'--u-header-mobile-item-pressed-color': self.mobileItemPressedColor,
|
|
171
|
+
'--u-header-mobile-item-active-color': self.mobileItemActiveColor,
|
|
172
|
+
'--u-header-mobile-group-item-color': self.mobileGroupItemColor
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
const themeClassHandle = useThemeClass('header', computed(() => ''), cssVarsRef, props);
|
|
176
|
+
const menuPaneClass = computed(() => `${mergedClsPrefixRef.value}-header__tab-pane`);
|
|
177
|
+
const menuPaneWrapperClass = computed(() => `${mergedClsPrefixRef.value}-header__tab-pane-wrapper`);
|
|
178
|
+
function handleSelectLang(key) {
|
|
179
|
+
var _a;
|
|
180
|
+
const nextLang = (_a = props.langOptions) === null || _a === void 0 ? void 0 : _a.find((option) => option.key === key);
|
|
181
|
+
if (nextLang) {
|
|
182
|
+
currentLang.value = nextLang;
|
|
183
|
+
emit('language-select', nextLang);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function doUpdateMenuValue(value) {
|
|
187
|
+
uncontrolledMenuValueRef.value = value;
|
|
188
|
+
const { onUpdateMenuValue } = props;
|
|
189
|
+
const { 'onUpdate:menuValue': _onUpdateMenuValue } = props;
|
|
190
|
+
if (onUpdateMenuValue)
|
|
191
|
+
call(onUpdateMenuValue, value);
|
|
192
|
+
if (_onUpdateMenuValue)
|
|
193
|
+
call(_onUpdateMenuValue, value);
|
|
194
|
+
}
|
|
195
|
+
function handleMenuValueUpdate(value) {
|
|
196
|
+
if (value !== null) {
|
|
197
|
+
doUpdateMenuValue(value);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
function handleSearchClick() {
|
|
201
|
+
searchVisibleRef.value = true;
|
|
202
|
+
}
|
|
203
|
+
function handleSearchClose() {
|
|
204
|
+
searchVisibleRef.value = false;
|
|
205
|
+
}
|
|
206
|
+
function handleSearch(query) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
if (props.onSearch) {
|
|
209
|
+
const results = yield props.onSearch(query);
|
|
210
|
+
return results;
|
|
211
|
+
}
|
|
212
|
+
emit('search', query);
|
|
213
|
+
return [];
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function handleSearchResultSelect(result) {
|
|
217
|
+
emit('search-result-select', result);
|
|
218
|
+
}
|
|
219
|
+
function handlePreviewClick() {
|
|
220
|
+
emit('preview');
|
|
221
|
+
}
|
|
222
|
+
function handleLogoutClick() {
|
|
223
|
+
emit('logout');
|
|
224
|
+
}
|
|
225
|
+
function toggleMobileMenu() {
|
|
226
|
+
mobileMenuVisibleRef.value = !mobileMenuVisibleRef.value;
|
|
227
|
+
}
|
|
228
|
+
function closeMobileMenu() {
|
|
229
|
+
mobileMenuVisibleRef.value = false;
|
|
230
|
+
}
|
|
231
|
+
function handleMobileMenuItemClick(option) {
|
|
232
|
+
if (option.key !== undefined) {
|
|
233
|
+
doUpdateMenuValue(option.key);
|
|
234
|
+
}
|
|
235
|
+
closeMobileMenu();
|
|
236
|
+
}
|
|
237
|
+
function handleMobilePrimaryAction() {
|
|
238
|
+
emit('mobile-primary-action');
|
|
239
|
+
}
|
|
240
|
+
function handleMobileSecondaryAction() {
|
|
241
|
+
emit('mobile-secondary-action');
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
mergedClsPrefix: mergedClsPrefixRef,
|
|
245
|
+
cssVars: cssVarsRef,
|
|
246
|
+
themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
|
|
247
|
+
normalizedMenuItems: normalizedMenuItemsRef,
|
|
248
|
+
mergedMenuValue: mergedMenuValueRef,
|
|
249
|
+
currentLang,
|
|
250
|
+
isMobile: isMobileRef,
|
|
251
|
+
mobileMenuVisible: mobileMenuVisibleRef,
|
|
252
|
+
searchVisible: searchVisibleRef,
|
|
253
|
+
handleSelectLang,
|
|
254
|
+
handleMenuValueUpdate,
|
|
255
|
+
handleSearchClick,
|
|
256
|
+
handleSearchClose,
|
|
257
|
+
handleSearch,
|
|
258
|
+
handleSearchResultSelect,
|
|
259
|
+
handlePreviewClick,
|
|
260
|
+
handleLogoutClick,
|
|
261
|
+
toggleMobileMenu,
|
|
262
|
+
closeMobileMenu,
|
|
263
|
+
handleMobileMenuItemClick,
|
|
264
|
+
handleMobilePrimaryAction,
|
|
265
|
+
handleMobileSecondaryAction,
|
|
266
|
+
menuPaneClass,
|
|
267
|
+
menuPaneWrapperClass,
|
|
268
|
+
onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
|
|
269
|
+
};
|
|
270
|
+
},
|
|
271
|
+
render() {
|
|
272
|
+
var _a;
|
|
273
|
+
const { mergedClsPrefix, $slots } = this;
|
|
274
|
+
(_a = this.onRender) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
275
|
+
const blockClass = `${mergedClsPrefix}-header`;
|
|
276
|
+
const logoNode = resolveWrappedSlot($slots.logo, (children) => children ? h("div", { class: `${blockClass}__logo` }, children) : null) || (h("div", { class: `${blockClass}__logo` },
|
|
277
|
+
h("img", { src: this.logoSrc, alt: this.logoAlt })));
|
|
278
|
+
const navigationNode = resolveWrappedSlot($slots.navigation, (children) => children !== null && children !== void 0 ? children : null) || (h(HeaderNavigation, { menuOptions: this.menuOptions, menuPlacement: this.menuPlacement, menuTrigger: this.menuTrigger, menuValue: this.mergedMenuValue, menuTabsProps: this.menuTabsProps, menuCardMinColumnWidth: this.menuCardMinColumnWidth, mergedClsPrefix: mergedClsPrefix, menuPaneClass: this.menuPaneClass, menuPaneWrapperClass: this.menuPaneWrapperClass, onUpdateMenuValue: this.handleMenuValueUpdate }));
|
|
279
|
+
const mobileNode = this.responsive && this.isMobile ? (h(HeaderMobile, { visible: this.mobileMenuVisible, menuOptions: this.normalizedMenuItems, activeMenuValue: this.mergedMenuValue, langOptions: this.langOptions || defaultLangOptions, currentLang: this.currentLang, mergedClsPrefix: mergedClsPrefix, cssVars: this.cssVars, menuType: this.mobileMenuType, showFooterActions: this.mobileShowFooterActions, showHeaderActions: this.mobileShowHeaderActions, primaryActionText: this.mobilePrimaryActionText, secondaryActionText: this.mobileSecondaryActionText, onToggle: this.toggleMobileMenu, onClose: this.closeMobileMenu, onMenuItemClick: this.handleMobileMenuItemClick, onLanguageSelect: this.handleSelectLang, onPrimaryAction: this.handleMobilePrimaryAction, onSecondaryAction: this.handleMobileSecondaryAction, onSearchClick: this.handleSearchClick, onPreview: this.handlePreviewClick, onLogout: this.handleLogoutClick }, {
|
|
280
|
+
actions: $slots['mobile-actions'],
|
|
281
|
+
footer: $slots['mobile-footer']
|
|
282
|
+
})) : null;
|
|
283
|
+
const actionsNode = resolveWrappedSlot($slots.action, (children) => children ? h("div", { class: `${blockClass}__actions` }, children) : null) || (h(HeaderActions, { langOptions: this.langOptions || defaultLangOptions, currentLang: this.currentLang, mergedClsPrefix: mergedClsPrefix, responsive: this.responsive, isMobile: this.isMobile, mobileActionsCollapse: this.mobileActionsCollapse, cssVars: this.cssVars, onSearch: this.handleSearch, onSearchResultSelect: this.handleSearchResultSelect, onPreview: this.handlePreviewClick, onLogout: this.handleLogoutClick, onLanguageSelect: this.handleSelectLang }, {
|
|
284
|
+
mobile: () => mobileNode
|
|
285
|
+
}));
|
|
286
|
+
const searchNode = this.responsive && this.isMobile && this.searchVisible
|
|
287
|
+
? h(HeaderSearchMobile, {
|
|
288
|
+
mergedClsPrefix,
|
|
289
|
+
show: this.searchVisible,
|
|
290
|
+
cssVars: this.cssVars,
|
|
291
|
+
onClose: this.handleSearchClose,
|
|
292
|
+
onSearch: this.handleSearch,
|
|
293
|
+
onSearchResultSelect: this.handleSearchResultSelect
|
|
294
|
+
})
|
|
295
|
+
: null;
|
|
296
|
+
if (this.responsive && this.isMobile) {
|
|
297
|
+
return h(Fragment, null, [
|
|
298
|
+
h(HeaderMobileLayout, {
|
|
299
|
+
mergedClsPrefix,
|
|
300
|
+
themeClass: this.themeClass,
|
|
301
|
+
cssVars: this.cssVars
|
|
302
|
+
}, {
|
|
303
|
+
logo: () => logoNode,
|
|
304
|
+
navigation: () => null,
|
|
305
|
+
actions: () => actionsNode
|
|
306
|
+
}),
|
|
307
|
+
searchNode
|
|
308
|
+
]);
|
|
309
|
+
}
|
|
310
|
+
return h(HeaderDesktopLayout, {
|
|
311
|
+
mergedClsPrefix,
|
|
312
|
+
themeClass: this.themeClass,
|
|
313
|
+
cssVars: this.cssVars
|
|
314
|
+
}, {
|
|
315
|
+
logo: () => logoNode,
|
|
316
|
+
navigation: () => navigationNode,
|
|
317
|
+
actions: () => actionsNode
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
});
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { type PropType, type CSSProperties } from 'vue';
|
|
2
|
+
import type { LangOption, HeaderSearchResult, HeaderSearchHandler } from './interface';
|
|
3
|
+
export declare const headerActionsProps: {
|
|
4
|
+
readonly langOptions: {
|
|
5
|
+
readonly type: PropType<LangOption[]>;
|
|
6
|
+
readonly required: true;
|
|
7
|
+
};
|
|
8
|
+
readonly currentLang: {
|
|
9
|
+
readonly type: PropType<LangOption>;
|
|
10
|
+
readonly required: true;
|
|
11
|
+
};
|
|
12
|
+
readonly mergedClsPrefix: {
|
|
13
|
+
readonly type: StringConstructor;
|
|
14
|
+
readonly required: true;
|
|
15
|
+
};
|
|
16
|
+
readonly responsive: {
|
|
17
|
+
readonly type: BooleanConstructor;
|
|
18
|
+
readonly default: false;
|
|
19
|
+
};
|
|
20
|
+
readonly isMobile: {
|
|
21
|
+
readonly type: BooleanConstructor;
|
|
22
|
+
readonly default: false;
|
|
23
|
+
};
|
|
24
|
+
readonly mobileActionsCollapse: {
|
|
25
|
+
readonly type: BooleanConstructor;
|
|
26
|
+
readonly default: true;
|
|
27
|
+
};
|
|
28
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
29
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
30
|
+
readonly onPreview: PropType<() => void>;
|
|
31
|
+
readonly onLogout: PropType<() => void>;
|
|
32
|
+
readonly onLanguageSelect: PropType<(key: string | number) => void>;
|
|
33
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
34
|
+
};
|
|
35
|
+
declare const _default: import("vue").DefineComponent<{
|
|
36
|
+
readonly langOptions: {
|
|
37
|
+
readonly type: PropType<LangOption[]>;
|
|
38
|
+
readonly required: true;
|
|
39
|
+
};
|
|
40
|
+
readonly currentLang: {
|
|
41
|
+
readonly type: PropType<LangOption>;
|
|
42
|
+
readonly required: true;
|
|
43
|
+
};
|
|
44
|
+
readonly mergedClsPrefix: {
|
|
45
|
+
readonly type: StringConstructor;
|
|
46
|
+
readonly required: true;
|
|
47
|
+
};
|
|
48
|
+
readonly responsive: {
|
|
49
|
+
readonly type: BooleanConstructor;
|
|
50
|
+
readonly default: false;
|
|
51
|
+
};
|
|
52
|
+
readonly isMobile: {
|
|
53
|
+
readonly type: BooleanConstructor;
|
|
54
|
+
readonly default: false;
|
|
55
|
+
};
|
|
56
|
+
readonly mobileActionsCollapse: {
|
|
57
|
+
readonly type: BooleanConstructor;
|
|
58
|
+
readonly default: true;
|
|
59
|
+
};
|
|
60
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
61
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
62
|
+
readonly onPreview: PropType<() => void>;
|
|
63
|
+
readonly onLogout: PropType<() => void>;
|
|
64
|
+
readonly onLanguageSelect: PropType<(key: string | number) => void>;
|
|
65
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
66
|
+
}, {
|
|
67
|
+
searchVisible: import("vue").Ref<boolean>;
|
|
68
|
+
searchValue: import("vue").Ref<string>;
|
|
69
|
+
searchResults: import("vue").Ref<{
|
|
70
|
+
key: string | number;
|
|
71
|
+
label: string;
|
|
72
|
+
description?: string | undefined;
|
|
73
|
+
icon?: (() => import("vue").VNodeChild) | undefined;
|
|
74
|
+
extra?: string | undefined;
|
|
75
|
+
onClick?: (() => void) | undefined;
|
|
76
|
+
disabled?: boolean | undefined;
|
|
77
|
+
}[]>;
|
|
78
|
+
searchLoading: import("vue").Ref<boolean>;
|
|
79
|
+
handleSearchClick: () => void;
|
|
80
|
+
handleSearchInput: (value: string) => void;
|
|
81
|
+
handleSearch: () => Promise<void>;
|
|
82
|
+
handleSearchClose: () => void;
|
|
83
|
+
handleResultSelect: (result: HeaderSearchResult) => void;
|
|
84
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
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: StringConstructor;
|
|
95
|
+
readonly required: true;
|
|
96
|
+
};
|
|
97
|
+
readonly responsive: {
|
|
98
|
+
readonly type: BooleanConstructor;
|
|
99
|
+
readonly default: false;
|
|
100
|
+
};
|
|
101
|
+
readonly isMobile: {
|
|
102
|
+
readonly type: BooleanConstructor;
|
|
103
|
+
readonly default: false;
|
|
104
|
+
};
|
|
105
|
+
readonly mobileActionsCollapse: {
|
|
106
|
+
readonly type: BooleanConstructor;
|
|
107
|
+
readonly default: true;
|
|
108
|
+
};
|
|
109
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
110
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
111
|
+
readonly onPreview: PropType<() => void>;
|
|
112
|
+
readonly onLogout: PropType<() => void>;
|
|
113
|
+
readonly onLanguageSelect: PropType<(key: string | number) => void>;
|
|
114
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
115
|
+
}>>, {
|
|
116
|
+
readonly responsive: boolean;
|
|
117
|
+
readonly mobileActionsCollapse: boolean;
|
|
118
|
+
readonly isMobile: boolean;
|
|
119
|
+
}, {}>;
|
|
120
|
+
export default _default;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { h, defineComponent, ref, Transition, Fragment, watch } from 'vue';
|
|
11
|
+
import { UButton } from '../../button';
|
|
12
|
+
import { UIcon } from '../../icon';
|
|
13
|
+
import { UDropdown } from '../../dropdown';
|
|
14
|
+
import { UFlex } from '../../flex';
|
|
15
|
+
import HeaderSearchDesktop from './HeaderSearchDesktop';
|
|
16
|
+
import { SEARCH_DEBOUNCE_MS } from './constants';
|
|
17
|
+
import { SearchIcon, EyeIcon, LogoutIcon, ChevronDownOutline } from '../../_internal/icons';
|
|
18
|
+
export const headerActionsProps = {
|
|
19
|
+
langOptions: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true
|
|
22
|
+
},
|
|
23
|
+
currentLang: {
|
|
24
|
+
type: Object,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
mergedClsPrefix: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
responsive: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: false
|
|
34
|
+
},
|
|
35
|
+
isMobile: {
|
|
36
|
+
type: Boolean,
|
|
37
|
+
default: false
|
|
38
|
+
},
|
|
39
|
+
mobileActionsCollapse: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
default: true
|
|
42
|
+
},
|
|
43
|
+
cssVars: Object,
|
|
44
|
+
onSearch: Function,
|
|
45
|
+
onPreview: Function,
|
|
46
|
+
onLogout: Function,
|
|
47
|
+
onLanguageSelect: Function,
|
|
48
|
+
onSearchResultSelect: Function
|
|
49
|
+
};
|
|
50
|
+
export default defineComponent({
|
|
51
|
+
name: 'HeaderActions',
|
|
52
|
+
props: headerActionsProps,
|
|
53
|
+
setup(props) {
|
|
54
|
+
const searchVisible = ref(false);
|
|
55
|
+
const searchValue = ref('');
|
|
56
|
+
const searchResults = ref([]);
|
|
57
|
+
const searchLoading = ref(false);
|
|
58
|
+
const handleSearchClick = () => {
|
|
59
|
+
searchVisible.value = !searchVisible.value;
|
|
60
|
+
if (!searchVisible.value) {
|
|
61
|
+
searchValue.value = '';
|
|
62
|
+
searchResults.value = [];
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const handleSearchInput = (value) => {
|
|
66
|
+
searchValue.value = value;
|
|
67
|
+
};
|
|
68
|
+
const handleSearch = () => __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const query = searchValue.value.trim();
|
|
70
|
+
if (!query || !props.onSearch) {
|
|
71
|
+
searchResults.value = [];
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
searchLoading.value = true;
|
|
75
|
+
try {
|
|
76
|
+
const results = yield props.onSearch(query);
|
|
77
|
+
searchResults.value = results;
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
searchResults.value = [];
|
|
81
|
+
}
|
|
82
|
+
finally {
|
|
83
|
+
searchLoading.value = false;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
const handleSearchClose = () => {
|
|
87
|
+
searchValue.value = '';
|
|
88
|
+
searchResults.value = [];
|
|
89
|
+
searchVisible.value = false;
|
|
90
|
+
searchLoading.value = false;
|
|
91
|
+
};
|
|
92
|
+
const handleResultSelect = (result) => {
|
|
93
|
+
var _a;
|
|
94
|
+
(_a = props.onSearchResultSelect) === null || _a === void 0 ? void 0 : _a.call(props, result);
|
|
95
|
+
handleSearchClose();
|
|
96
|
+
};
|
|
97
|
+
let searchTimeout = null;
|
|
98
|
+
watch(searchValue, () => {
|
|
99
|
+
if (searchTimeout) {
|
|
100
|
+
clearTimeout(searchTimeout);
|
|
101
|
+
}
|
|
102
|
+
searchTimeout = setTimeout(() => {
|
|
103
|
+
void handleSearch();
|
|
104
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
105
|
+
});
|
|
106
|
+
return {
|
|
107
|
+
searchVisible,
|
|
108
|
+
searchValue,
|
|
109
|
+
searchResults,
|
|
110
|
+
searchLoading,
|
|
111
|
+
handleSearchClick,
|
|
112
|
+
handleSearchInput,
|
|
113
|
+
handleSearch,
|
|
114
|
+
handleSearchClose,
|
|
115
|
+
handleResultSelect
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
render() {
|
|
119
|
+
const blockClass = `${this.mergedClsPrefix}-header`;
|
|
120
|
+
if (this.responsive && this.isMobile && this.mobileActionsCollapse) {
|
|
121
|
+
return (h("div", { class: `${blockClass}__actions` },
|
|
122
|
+
h(UFlex, { size: 32 }, { default: () => { var _a, _b; return (_b = (_a = this.$slots).mobile) === null || _b === void 0 ? void 0 : _b.call(_a); } })));
|
|
123
|
+
}
|
|
124
|
+
return (h("div", { class: `${blockClass}__actions` },
|
|
125
|
+
h(UFlex, { class: `${blockClass}__actions-block`, size: 32 }, {
|
|
126
|
+
default: () => (h(Fragment, null,
|
|
127
|
+
h(UDropdown, { options: this.langOptions, onSelect: this.onLanguageSelect }, {
|
|
128
|
+
default: () => (h(UButton, { "icon-placement": "right", text: true, renderIcon: () => (h(UIcon, null, { default: () => h(ChevronDownOutline, null) })) }, {
|
|
129
|
+
default: () => {
|
|
130
|
+
var _a, _b, _c;
|
|
131
|
+
return (h("span", { class: `${blockClass}__lang-trigger` },
|
|
132
|
+
h("span", { class: `${blockClass}__lang-icon` }, (_b = (_a = this.currentLang) === null || _a === void 0 ? void 0 : _a.icon) === null || _b === void 0 ? void 0 : _b.call(_a)),
|
|
133
|
+
h("span", null, (_c = this.currentLang) === null || _c === void 0 ? void 0 : _c.label)));
|
|
134
|
+
}
|
|
135
|
+
}))
|
|
136
|
+
}),
|
|
137
|
+
h("div", { class: `${blockClass}__search-wrapper` },
|
|
138
|
+
h(UButton, { text: true, onClick: this.handleSearchClick }, {
|
|
139
|
+
default: () => (h(UIcon, { size: 24 }, { default: () => h(SearchIcon, null) }))
|
|
140
|
+
}),
|
|
141
|
+
h(Transition, { name: "fade-in-scale-up" }, {
|
|
142
|
+
default: () => this.searchVisible
|
|
143
|
+
? h(HeaderSearchDesktop, {
|
|
144
|
+
searchValue: this.searchValue,
|
|
145
|
+
searchResults: this.searchResults,
|
|
146
|
+
searchLoading: this.searchLoading,
|
|
147
|
+
mergedClsPrefix: this.mergedClsPrefix,
|
|
148
|
+
cssVars: this.cssVars,
|
|
149
|
+
onSearchInput: this.handleSearchInput,
|
|
150
|
+
onSearchClose: this.handleSearchClose,
|
|
151
|
+
onSearchSubmit: () => {
|
|
152
|
+
void this.handleSearch();
|
|
153
|
+
},
|
|
154
|
+
onResultSelect: this.handleResultSelect
|
|
155
|
+
})
|
|
156
|
+
: null
|
|
157
|
+
})),
|
|
158
|
+
h(UButton, { text: true, onClick: this.onPreview }, {
|
|
159
|
+
default: () => (h(UIcon, { size: 24 }, { default: () => h(EyeIcon, null) }))
|
|
160
|
+
}),
|
|
161
|
+
h(UButton, { text: true, onClick: this.onLogout }, {
|
|
162
|
+
default: () => (h(UIcon, { size: 24 }, { default: () => h(LogoutIcon, null) }))
|
|
163
|
+
})))
|
|
164
|
+
})));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PropType, type CSSProperties } from 'vue';
|
|
2
|
+
export declare const headerDesktopLayoutProps: {
|
|
3
|
+
readonly mergedClsPrefix: {
|
|
4
|
+
readonly type: PropType<string>;
|
|
5
|
+
readonly required: true;
|
|
6
|
+
};
|
|
7
|
+
readonly themeClass: StringConstructor;
|
|
8
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue").DefineComponent<{
|
|
11
|
+
readonly mergedClsPrefix: {
|
|
12
|
+
readonly type: PropType<string>;
|
|
13
|
+
readonly required: true;
|
|
14
|
+
};
|
|
15
|
+
readonly themeClass: StringConstructor;
|
|
16
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
17
|
+
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
|
+
readonly mergedClsPrefix: {
|
|
19
|
+
readonly type: PropType<string>;
|
|
20
|
+
readonly required: true;
|
|
21
|
+
};
|
|
22
|
+
readonly themeClass: StringConstructor;
|
|
23
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
24
|
+
}>>, {}, {}>;
|
|
25
|
+
export default _default;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { h, defineComponent } from 'vue';
|
|
2
|
+
export const headerDesktopLayoutProps = {
|
|
3
|
+
mergedClsPrefix: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
themeClass: String,
|
|
8
|
+
cssVars: Object
|
|
9
|
+
};
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: 'HeaderDesktopLayout',
|
|
12
|
+
props: headerDesktopLayoutProps,
|
|
13
|
+
render() {
|
|
14
|
+
var _a, _b, _c, _d, _e, _f;
|
|
15
|
+
const blockClass = `${this.mergedClsPrefix}-header`;
|
|
16
|
+
return (h("div", { class: [blockClass, `${blockClass}--desktop`, this.themeClass], style: this.cssVars },
|
|
17
|
+
h("div", { class: `${blockClass}__inner` },
|
|
18
|
+
h("div", { class: `${blockClass}__inner-wrapper` },
|
|
19
|
+
h("div", { class: `${blockClass}__inner-left` }, (_b = (_a = this.$slots).logo) === null || _b === void 0 ? void 0 :
|
|
20
|
+
_b.call(_a),
|
|
21
|
+
h("div", { class: `${blockClass}__navigation` }, (_d = (_c = this.$slots).navigation) === null || _d === void 0 ? void 0 : _d.call(_c))), (_f = (_e = this.$slots).actions) === null || _f === void 0 ? void 0 :
|
|
22
|
+
_f.call(_e)))));
|
|
23
|
+
}
|
|
24
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type PropType, type CSSProperties } from 'vue';
|
|
2
|
+
export declare const headerMobileLayoutProps: {
|
|
3
|
+
readonly mergedClsPrefix: {
|
|
4
|
+
readonly type: PropType<string>;
|
|
5
|
+
readonly required: true;
|
|
6
|
+
};
|
|
7
|
+
readonly themeClass: StringConstructor;
|
|
8
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
9
|
+
};
|
|
10
|
+
declare const _default: import("vue").DefineComponent<{
|
|
11
|
+
readonly mergedClsPrefix: {
|
|
12
|
+
readonly type: PropType<string>;
|
|
13
|
+
readonly required: true;
|
|
14
|
+
};
|
|
15
|
+
readonly themeClass: StringConstructor;
|
|
16
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
17
|
+
}, unknown, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
18
|
+
readonly mergedClsPrefix: {
|
|
19
|
+
readonly type: PropType<string>;
|
|
20
|
+
readonly required: true;
|
|
21
|
+
};
|
|
22
|
+
readonly themeClass: StringConstructor;
|
|
23
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
24
|
+
}>>, {}, {}>;
|
|
25
|
+
export default _default;
|