@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,21 @@
|
|
|
1
|
+
import { h, defineComponent } from 'vue';
|
|
2
|
+
export const headerMobileLayoutProps = {
|
|
3
|
+
mergedClsPrefix: {
|
|
4
|
+
type: String,
|
|
5
|
+
required: true
|
|
6
|
+
},
|
|
7
|
+
themeClass: String,
|
|
8
|
+
cssVars: Object
|
|
9
|
+
};
|
|
10
|
+
export default defineComponent({
|
|
11
|
+
name: 'HeaderMobileLayout',
|
|
12
|
+
props: headerMobileLayoutProps,
|
|
13
|
+
render() {
|
|
14
|
+
var _a, _b, _c, _d;
|
|
15
|
+
const blockClass = `${this.mergedClsPrefix}-header`;
|
|
16
|
+
return (h("div", { class: [blockClass, `${blockClass}--mobile`, this.themeClass], style: this.cssVars },
|
|
17
|
+
h("div", { class: `${blockClass}__inner` }, (_b = (_a = this.$slots).logo) === null || _b === void 0 ? void 0 :
|
|
18
|
+
_b.call(_a), (_d = (_c = this.$slots).actions) === null || _d === void 0 ? void 0 :
|
|
19
|
+
_d.call(_c))));
|
|
20
|
+
}
|
|
21
|
+
});
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { type PropType } from 'vue';
|
|
2
|
+
import { type MaybeArray } from '../../_utils';
|
|
3
|
+
import type { HeaderMenuOption, HeaderMenuPlacement, HeaderMenuTabsProps } from './interface';
|
|
4
|
+
interface InternalMenuItem {
|
|
5
|
+
key: string | number;
|
|
6
|
+
option: HeaderMenuOption;
|
|
7
|
+
}
|
|
8
|
+
export declare const headerNavigationProps: {
|
|
9
|
+
readonly menuOptions: {
|
|
10
|
+
readonly type: PropType<HeaderMenuOption[]>;
|
|
11
|
+
readonly default: () => never[];
|
|
12
|
+
};
|
|
13
|
+
readonly menuPlacement: {
|
|
14
|
+
readonly type: PropType<HeaderMenuPlacement>;
|
|
15
|
+
readonly default: "horizontal";
|
|
16
|
+
};
|
|
17
|
+
readonly menuTrigger: {
|
|
18
|
+
readonly type: PropType<"click" | "hover">;
|
|
19
|
+
readonly default: "hover";
|
|
20
|
+
};
|
|
21
|
+
readonly menuValue: PropType<string | number | null>;
|
|
22
|
+
readonly menuTabsProps: {
|
|
23
|
+
readonly type: PropType<HeaderMenuTabsProps>;
|
|
24
|
+
readonly default: () => {};
|
|
25
|
+
};
|
|
26
|
+
readonly menuCardMinColumnWidth: {
|
|
27
|
+
readonly type: PropType<string | number>;
|
|
28
|
+
readonly default: 220;
|
|
29
|
+
};
|
|
30
|
+
readonly mergedClsPrefix: {
|
|
31
|
+
readonly type: PropType<string>;
|
|
32
|
+
readonly required: true;
|
|
33
|
+
};
|
|
34
|
+
readonly menuPaneClass: {
|
|
35
|
+
readonly type: StringConstructor;
|
|
36
|
+
readonly required: true;
|
|
37
|
+
};
|
|
38
|
+
readonly menuPaneWrapperClass: {
|
|
39
|
+
readonly type: StringConstructor;
|
|
40
|
+
readonly required: true;
|
|
41
|
+
};
|
|
42
|
+
readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
43
|
+
readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
44
|
+
};
|
|
45
|
+
declare const _default: import("vue").DefineComponent<{
|
|
46
|
+
readonly menuOptions: {
|
|
47
|
+
readonly type: PropType<HeaderMenuOption[]>;
|
|
48
|
+
readonly default: () => never[];
|
|
49
|
+
};
|
|
50
|
+
readonly menuPlacement: {
|
|
51
|
+
readonly type: PropType<HeaderMenuPlacement>;
|
|
52
|
+
readonly default: "horizontal";
|
|
53
|
+
};
|
|
54
|
+
readonly menuTrigger: {
|
|
55
|
+
readonly type: PropType<"click" | "hover">;
|
|
56
|
+
readonly default: "hover";
|
|
57
|
+
};
|
|
58
|
+
readonly menuValue: PropType<string | number | null>;
|
|
59
|
+
readonly menuTabsProps: {
|
|
60
|
+
readonly type: PropType<HeaderMenuTabsProps>;
|
|
61
|
+
readonly default: () => {};
|
|
62
|
+
};
|
|
63
|
+
readonly menuCardMinColumnWidth: {
|
|
64
|
+
readonly type: PropType<string | number>;
|
|
65
|
+
readonly default: 220;
|
|
66
|
+
};
|
|
67
|
+
readonly mergedClsPrefix: {
|
|
68
|
+
readonly type: PropType<string>;
|
|
69
|
+
readonly required: true;
|
|
70
|
+
};
|
|
71
|
+
readonly menuPaneClass: {
|
|
72
|
+
readonly type: StringConstructor;
|
|
73
|
+
readonly required: true;
|
|
74
|
+
};
|
|
75
|
+
readonly menuPaneWrapperClass: {
|
|
76
|
+
readonly type: StringConstructor;
|
|
77
|
+
readonly required: true;
|
|
78
|
+
};
|
|
79
|
+
readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
80
|
+
readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
81
|
+
}, {
|
|
82
|
+
normalizedMenuItems: import("vue").ComputedRef<InternalMenuItem[]>;
|
|
83
|
+
resolvedMenuPlacement: import("vue").ComputedRef<"left" | "right" | "top" | "bottom" | undefined>;
|
|
84
|
+
handleMenuValueUpdate: (value: string | number) => void;
|
|
85
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
86
|
+
readonly menuOptions: {
|
|
87
|
+
readonly type: PropType<HeaderMenuOption[]>;
|
|
88
|
+
readonly default: () => never[];
|
|
89
|
+
};
|
|
90
|
+
readonly menuPlacement: {
|
|
91
|
+
readonly type: PropType<HeaderMenuPlacement>;
|
|
92
|
+
readonly default: "horizontal";
|
|
93
|
+
};
|
|
94
|
+
readonly menuTrigger: {
|
|
95
|
+
readonly type: PropType<"click" | "hover">;
|
|
96
|
+
readonly default: "hover";
|
|
97
|
+
};
|
|
98
|
+
readonly menuValue: PropType<string | number | null>;
|
|
99
|
+
readonly menuTabsProps: {
|
|
100
|
+
readonly type: PropType<HeaderMenuTabsProps>;
|
|
101
|
+
readonly default: () => {};
|
|
102
|
+
};
|
|
103
|
+
readonly menuCardMinColumnWidth: {
|
|
104
|
+
readonly type: PropType<string | number>;
|
|
105
|
+
readonly default: 220;
|
|
106
|
+
};
|
|
107
|
+
readonly mergedClsPrefix: {
|
|
108
|
+
readonly type: PropType<string>;
|
|
109
|
+
readonly required: true;
|
|
110
|
+
};
|
|
111
|
+
readonly menuPaneClass: {
|
|
112
|
+
readonly type: StringConstructor;
|
|
113
|
+
readonly required: true;
|
|
114
|
+
};
|
|
115
|
+
readonly menuPaneWrapperClass: {
|
|
116
|
+
readonly type: StringConstructor;
|
|
117
|
+
readonly required: true;
|
|
118
|
+
};
|
|
119
|
+
readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
120
|
+
readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
121
|
+
}>>, {
|
|
122
|
+
readonly menuOptions: HeaderMenuOption[];
|
|
123
|
+
readonly menuPlacement: HeaderMenuPlacement;
|
|
124
|
+
readonly menuTrigger: "hover" | "click";
|
|
125
|
+
readonly menuTabsProps: Partial<import("../../tabs").TabsProps>;
|
|
126
|
+
readonly menuCardMinColumnWidth: string | number;
|
|
127
|
+
}, {}>;
|
|
128
|
+
export default _default;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { h, defineComponent, computed } from 'vue';
|
|
13
|
+
import { call } from '../../_utils';
|
|
14
|
+
import { UTabs, UTabPane } from '../../tabs';
|
|
15
|
+
import { renderOptionLabel, renderBadge, getMenuItemKey, isDividerOption, isGroupOption, isColumnOption, isNotNull, resolvePlacement } from './utils';
|
|
16
|
+
export const headerNavigationProps = {
|
|
17
|
+
menuOptions: {
|
|
18
|
+
type: Array,
|
|
19
|
+
default: () => []
|
|
20
|
+
},
|
|
21
|
+
menuPlacement: {
|
|
22
|
+
type: String,
|
|
23
|
+
default: 'horizontal'
|
|
24
|
+
},
|
|
25
|
+
menuTrigger: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: 'hover'
|
|
28
|
+
},
|
|
29
|
+
menuValue: [String, Number],
|
|
30
|
+
menuTabsProps: {
|
|
31
|
+
type: Object,
|
|
32
|
+
default: () => ({})
|
|
33
|
+
},
|
|
34
|
+
menuCardMinColumnWidth: {
|
|
35
|
+
type: [Number, String],
|
|
36
|
+
default: 220
|
|
37
|
+
},
|
|
38
|
+
mergedClsPrefix: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: true
|
|
41
|
+
},
|
|
42
|
+
menuPaneClass: {
|
|
43
|
+
type: String,
|
|
44
|
+
required: true
|
|
45
|
+
},
|
|
46
|
+
menuPaneWrapperClass: {
|
|
47
|
+
type: String,
|
|
48
|
+
required: true
|
|
49
|
+
},
|
|
50
|
+
'onUpdate:menuValue': [Function, Array],
|
|
51
|
+
onUpdateMenuValue: [Function, Array]
|
|
52
|
+
};
|
|
53
|
+
export default defineComponent({
|
|
54
|
+
name: 'HeaderNavigation',
|
|
55
|
+
props: headerNavigationProps,
|
|
56
|
+
setup(props) {
|
|
57
|
+
const normalizedMenuItemsRef = computed(() => {
|
|
58
|
+
return props.menuOptions.map((option, index) => ({
|
|
59
|
+
option,
|
|
60
|
+
key: getMenuItemKey(option, index)
|
|
61
|
+
}));
|
|
62
|
+
});
|
|
63
|
+
const resolvedMenuPlacementRef = computed(() => resolvePlacement(props.menuPlacement));
|
|
64
|
+
function handleMenuValueUpdate(value) {
|
|
65
|
+
const { onUpdateMenuValue } = props;
|
|
66
|
+
const { 'onUpdate:menuValue': _onUpdateMenuValue } = props;
|
|
67
|
+
if (onUpdateMenuValue)
|
|
68
|
+
call(onUpdateMenuValue, value);
|
|
69
|
+
if (_onUpdateMenuValue)
|
|
70
|
+
call(_onUpdateMenuValue, value);
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
normalizedMenuItems: normalizedMenuItemsRef,
|
|
74
|
+
resolvedMenuPlacement: resolvedMenuPlacementRef,
|
|
75
|
+
handleMenuValueUpdate
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
render() {
|
|
79
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
80
|
+
const mergedClsPrefix = this.mergedClsPrefix;
|
|
81
|
+
const blockClass = `${mergedClsPrefix}-header`;
|
|
82
|
+
const { $props } = this;
|
|
83
|
+
const renderMenuItem = (option, key) => {
|
|
84
|
+
if (isDividerOption(option)) {
|
|
85
|
+
return (h("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" }));
|
|
86
|
+
}
|
|
87
|
+
if (isGroupOption(option)) {
|
|
88
|
+
return renderMenuColumn(option, key);
|
|
89
|
+
}
|
|
90
|
+
const icon = typeof option.icon === 'function' ? option.icon() : null;
|
|
91
|
+
return (h("div", Object.assign({ key: key, class: [
|
|
92
|
+
`${blockClass}__menu-item`,
|
|
93
|
+
option.disabled && `${blockClass}__menu-item--disabled`
|
|
94
|
+
], role: "button", tabindex: option.disabled ? undefined : 0, onClick: option.onClick }, $props),
|
|
95
|
+
h("span", { class: `${blockClass}__menu-item-main` },
|
|
96
|
+
icon ? (h("span", { class: `${blockClass}__menu-item-icon` }, icon)) : null,
|
|
97
|
+
h("span", { class: `${blockClass}__menu-item-label` }, renderOptionLabel(option))),
|
|
98
|
+
renderBadge(option, `${blockClass}__badge`)));
|
|
99
|
+
};
|
|
100
|
+
const renderMenuColumn = (option, key, asSection = false) => {
|
|
101
|
+
var _a, _b, _c, _d;
|
|
102
|
+
if (isDividerOption(option)) {
|
|
103
|
+
return asSection ? (h("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" })) : (h("div", { key: key, class: `${blockClass}__menu-divider`, role: "separator" }));
|
|
104
|
+
}
|
|
105
|
+
if (isColumnOption(option)) {
|
|
106
|
+
const sections = (_b = (_a = option.children) === null || _a === void 0 ? void 0 : _a.map((child, index) => renderMenuColumn(child, `${key}-section-${index}`, true))) !== null && _b !== void 0 ? _b : [];
|
|
107
|
+
const content = sections.filter(isNotNull);
|
|
108
|
+
if (!content.length)
|
|
109
|
+
return null;
|
|
110
|
+
return (h("div", { key: key, class: `${blockClass}__menu-column` }, content));
|
|
111
|
+
}
|
|
112
|
+
if (isGroupOption(option)) {
|
|
113
|
+
const children = (_d = (_c = option.children) === null || _c === void 0 ? void 0 : _c.map((child, index) => renderMenuItem(child, `${key}-item-${index}`))) !== null && _d !== void 0 ? _d : [];
|
|
114
|
+
const content = children.filter(isNotNull);
|
|
115
|
+
if (!content.length)
|
|
116
|
+
return null;
|
|
117
|
+
if (asSection) {
|
|
118
|
+
return (h("div", { key: key, class: `${blockClass}__menu-column-section` },
|
|
119
|
+
h("div", { class: `${blockClass}__menu-column-title` }, renderOptionLabel(option)),
|
|
120
|
+
h("div", { class: `${blockClass}__menu-column-list` }, content)));
|
|
121
|
+
}
|
|
122
|
+
return (h("div", { key: key, class: `${blockClass}__menu-column` },
|
|
123
|
+
h("div", { class: `${blockClass}__menu-column-title` }, renderOptionLabel(option)),
|
|
124
|
+
h("div", { class: `${blockClass}__menu-column-list` }, content)));
|
|
125
|
+
}
|
|
126
|
+
return (h("div", { key: key, class: [
|
|
127
|
+
asSection
|
|
128
|
+
? `${blockClass}__menu-column-section ${blockClass}__menu-column-section--single`
|
|
129
|
+
: `${blockClass}__menu-column ${blockClass}__menu-column--single`
|
|
130
|
+
] },
|
|
131
|
+
h("div", { class: `${blockClass}__menu-column-list` }, renderMenuItem(option, `${key}-single`))));
|
|
132
|
+
};
|
|
133
|
+
const renderMenuCard = (item) => {
|
|
134
|
+
var _a, _b, _c;
|
|
135
|
+
const option = item.option;
|
|
136
|
+
if (!((_a = option.children) === null || _a === void 0 ? void 0 : _a.length))
|
|
137
|
+
return null;
|
|
138
|
+
const columns = (_c = (_b = option.children) === null || _b === void 0 ? void 0 : _b.map((child, index) => renderMenuColumn(child, `${item.key}-column-${index}`)).filter(isNotNull)) !== null && _c !== void 0 ? _c : [];
|
|
139
|
+
if (!columns.length)
|
|
140
|
+
return null;
|
|
141
|
+
// Подсчитываем количество колонок (children с type: 'column')
|
|
142
|
+
const columnCount = option.children.filter((child) => isColumnOption(child) || !isDividerOption(child)).length;
|
|
143
|
+
return (h("div", { class: `${blockClass}__menu-card` },
|
|
144
|
+
h("div", { class: `${blockClass}__menu-grid`, style: {
|
|
145
|
+
gridTemplateColumns: `repeat(${columnCount}, minmax(var(--u-header-card-min-col-width), 1fr))`
|
|
146
|
+
} }, columns)));
|
|
147
|
+
};
|
|
148
|
+
const menuItems = this.normalizedMenuItems;
|
|
149
|
+
const activeValue = (_a = this.menuValue) !== null && _a !== void 0 ? _a : undefined;
|
|
150
|
+
const menuTabsProps = this.menuTabsProps;
|
|
151
|
+
const _h = menuTabsProps || {}, { class: tabsClass, paneClass, paneWrapperClass, 'onUpdate:value': userOnUpdateValue, onUpdateValue: userOnUpdateValueCompat } = _h, restTabsProps = __rest(_h, ["class", "paneClass", "paneWrapperClass", 'onUpdate:value', "onUpdateValue"]);
|
|
152
|
+
const tabsNode = menuItems.length > 0 ? (h(UTabs, Object.assign({}, restTabsProps, { value: activeValue !== null && activeValue !== void 0 ? activeValue : undefined, type: (_b = restTabsProps.type) !== null && _b !== void 0 ? _b : 'bar', animated: (_c = restTabsProps.animated) !== null && _c !== void 0 ? _c : true, trigger: (_d = restTabsProps.trigger) !== null && _d !== void 0 ? _d : this.menuTrigger, placement: (_e = restTabsProps.placement) !== null && _e !== void 0 ? _e : this.resolvedMenuPlacement, tabsPadding: (_f = restTabsProps.tabsPadding) !== null && _f !== void 0 ? _f : 0, justifyContent: (_g = restTabsProps.justifyContent) !== null && _g !== void 0 ? _g : 'center', paneClass: [this.menuPaneClass, paneClass].filter(Boolean).join(' ') ||
|
|
153
|
+
undefined, paneWrapperClass: [this.menuPaneWrapperClass, paneWrapperClass]
|
|
154
|
+
.filter(Boolean)
|
|
155
|
+
.join(' ') || undefined, class: [`${blockClass}__tabs`, tabsClass], "onUpdate:value": (value) => {
|
|
156
|
+
this.handleMenuValueUpdate(value);
|
|
157
|
+
if (userOnUpdateValue)
|
|
158
|
+
call(userOnUpdateValue, value);
|
|
159
|
+
if (userOnUpdateValueCompat) {
|
|
160
|
+
call(userOnUpdateValueCompat, value);
|
|
161
|
+
}
|
|
162
|
+
} }), {
|
|
163
|
+
default: () => menuItems.map((item) => (h(UTabPane, { key: item.key, name: item.key, disabled: !!item.option.disabled, "display-directive": "show", tab: h("div", { class: `${blockClass}__tab` },
|
|
164
|
+
item.option.icon ? (h("span", { class: `${blockClass}__tab-icon` }, typeof item.option.icon === 'function'
|
|
165
|
+
? item.option.icon()
|
|
166
|
+
: item.option.icon)) : null,
|
|
167
|
+
h("span", { class: `${blockClass}__tab-label` }, renderOptionLabel(item.option)),
|
|
168
|
+
renderBadge(item.option, `${blockClass}__badge`)) }, { default: () => renderMenuCard(item) })))
|
|
169
|
+
})) : null;
|
|
170
|
+
return tabsNode;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type PropType, type CSSProperties } from 'vue';
|
|
2
|
+
import type { HeaderSearchResult } from './interface';
|
|
3
|
+
export declare const headerSearchDesktopProps: {
|
|
4
|
+
readonly searchValue: {
|
|
5
|
+
readonly type: StringConstructor;
|
|
6
|
+
readonly default: "";
|
|
7
|
+
};
|
|
8
|
+
readonly searchResults: {
|
|
9
|
+
readonly type: PropType<HeaderSearchResult[]>;
|
|
10
|
+
readonly default: () => never[];
|
|
11
|
+
};
|
|
12
|
+
readonly searchLoading: {
|
|
13
|
+
readonly type: BooleanConstructor;
|
|
14
|
+
readonly default: false;
|
|
15
|
+
};
|
|
16
|
+
readonly mergedClsPrefix: {
|
|
17
|
+
readonly type: PropType<string>;
|
|
18
|
+
readonly required: true;
|
|
19
|
+
};
|
|
20
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
21
|
+
readonly onSearchInput: PropType<(value: string) => void>;
|
|
22
|
+
readonly onSearchClose: PropType<() => void>;
|
|
23
|
+
readonly onSearchSubmit: PropType<() => void>;
|
|
24
|
+
readonly onResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
25
|
+
};
|
|
26
|
+
declare const _default: import("vue").DefineComponent<{
|
|
27
|
+
readonly searchValue: {
|
|
28
|
+
readonly type: StringConstructor;
|
|
29
|
+
readonly default: "";
|
|
30
|
+
};
|
|
31
|
+
readonly searchResults: {
|
|
32
|
+
readonly type: PropType<HeaderSearchResult[]>;
|
|
33
|
+
readonly default: () => never[];
|
|
34
|
+
};
|
|
35
|
+
readonly searchLoading: {
|
|
36
|
+
readonly type: BooleanConstructor;
|
|
37
|
+
readonly default: false;
|
|
38
|
+
};
|
|
39
|
+
readonly mergedClsPrefix: {
|
|
40
|
+
readonly type: PropType<string>;
|
|
41
|
+
readonly required: true;
|
|
42
|
+
};
|
|
43
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
44
|
+
readonly onSearchInput: PropType<(value: string) => void>;
|
|
45
|
+
readonly onSearchClose: PropType<() => void>;
|
|
46
|
+
readonly onSearchSubmit: PropType<() => void>;
|
|
47
|
+
readonly onResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
48
|
+
}, {
|
|
49
|
+
search: import("vue").Ref<string>;
|
|
50
|
+
searchText: import("vue").ComputedRef<string>;
|
|
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 searchValue: {
|
|
54
|
+
readonly type: StringConstructor;
|
|
55
|
+
readonly default: "";
|
|
56
|
+
};
|
|
57
|
+
readonly searchResults: {
|
|
58
|
+
readonly type: PropType<HeaderSearchResult[]>;
|
|
59
|
+
readonly default: () => never[];
|
|
60
|
+
};
|
|
61
|
+
readonly searchLoading: {
|
|
62
|
+
readonly type: BooleanConstructor;
|
|
63
|
+
readonly default: false;
|
|
64
|
+
};
|
|
65
|
+
readonly mergedClsPrefix: {
|
|
66
|
+
readonly type: PropType<string>;
|
|
67
|
+
readonly required: true;
|
|
68
|
+
};
|
|
69
|
+
readonly cssVars: PropType<CSSProperties>;
|
|
70
|
+
readonly onSearchInput: PropType<(value: string) => void>;
|
|
71
|
+
readonly onSearchClose: PropType<() => void>;
|
|
72
|
+
readonly onSearchSubmit: PropType<() => void>;
|
|
73
|
+
readonly onResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
74
|
+
}>>, {
|
|
75
|
+
readonly searchValue: string;
|
|
76
|
+
readonly searchResults: HeaderSearchResult[];
|
|
77
|
+
readonly searchLoading: boolean;
|
|
78
|
+
}, {}>;
|
|
79
|
+
export default _default;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { h, defineComponent, computed, ref } from 'vue';
|
|
2
|
+
import { UButton } from '../../button';
|
|
3
|
+
import { UIcon } from '../../icon';
|
|
4
|
+
import { UInput } from '../../input';
|
|
5
|
+
import { UFlex } from '../../flex';
|
|
6
|
+
import HeaderSearchResults from './HeaderSearchResults';
|
|
7
|
+
import { useLocale } from '../../_mixins';
|
|
8
|
+
import { UText } from '../../typography';
|
|
9
|
+
import { SearchIcon, CloseIcon } from '../../_internal/icons';
|
|
10
|
+
export const headerSearchDesktopProps = {
|
|
11
|
+
searchValue: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: ''
|
|
14
|
+
},
|
|
15
|
+
searchResults: {
|
|
16
|
+
type: Array,
|
|
17
|
+
default: () => []
|
|
18
|
+
},
|
|
19
|
+
searchLoading: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
},
|
|
23
|
+
mergedClsPrefix: {
|
|
24
|
+
type: String,
|
|
25
|
+
required: true
|
|
26
|
+
},
|
|
27
|
+
cssVars: Object,
|
|
28
|
+
onSearchInput: Function,
|
|
29
|
+
onSearchClose: Function,
|
|
30
|
+
onSearchSubmit: Function,
|
|
31
|
+
onResultSelect: Function
|
|
32
|
+
};
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
name: 'HeaderSearchDesktop',
|
|
35
|
+
props: headerSearchDesktopProps,
|
|
36
|
+
setup() {
|
|
37
|
+
const { localeRef } = useLocale('Header');
|
|
38
|
+
const search = ref('');
|
|
39
|
+
const searchText = computed(() => localeRef.value.desktopSearchTitle);
|
|
40
|
+
const placeholder = computed(() => localeRef.value.searchPlaceholder);
|
|
41
|
+
return {
|
|
42
|
+
search,
|
|
43
|
+
searchText,
|
|
44
|
+
placeholder
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
render() {
|
|
48
|
+
const blockClass = `${this.mergedClsPrefix}-header-search-desktop`;
|
|
49
|
+
return (h("div", { class: blockClass, style: this.cssVars },
|
|
50
|
+
h(UButton, { text: true, class: `${blockClass}__close`, onClick: this.onSearchClose }, {
|
|
51
|
+
default: () => (h(UIcon, { size: 24, color: "#C5C7CA" }, { default: () => h(CloseIcon, null) }))
|
|
52
|
+
}),
|
|
53
|
+
h(UFlex, { class: `${blockClass}__title`, justify: "space-between" },
|
|
54
|
+
h(UText, { variant: "title-l-medium", text: this.searchText })),
|
|
55
|
+
h("div", { class: `${blockClass}__content` },
|
|
56
|
+
h("div", { class: `${blockClass}__input-wrapper` },
|
|
57
|
+
h(UInput, { value: this.searchValue, class: `${blockClass}__input`, placeholder: this.placeholder, autofocus: true, onKeyup: (e) => {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
if (e.key === 'Enter') {
|
|
60
|
+
(_a = this.onSearchSubmit) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
61
|
+
}
|
|
62
|
+
else if (e.key === 'Escape') {
|
|
63
|
+
(_b = this.onSearchClose) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
64
|
+
}
|
|
65
|
+
}, onUpdateValue: this.onSearchInput }, {
|
|
66
|
+
prefix: () => (h(UIcon, { size: 20 }, { default: () => h(SearchIcon, null) }))
|
|
67
|
+
}))),
|
|
68
|
+
h(HeaderSearchResults, {
|
|
69
|
+
results: this.searchResults,
|
|
70
|
+
loading: this.searchLoading,
|
|
71
|
+
query: this.searchValue,
|
|
72
|
+
mergedClsPrefix: this.mergedClsPrefix,
|
|
73
|
+
cssVars: this.cssVars,
|
|
74
|
+
onSelect: this.onResultSelect
|
|
75
|
+
})));
|
|
76
|
+
}
|
|
77
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { type PropType, CSSProperties } from 'vue';
|
|
2
|
+
import type { HeaderSearchResult, HeaderSearchHandler } from './interface';
|
|
3
|
+
export declare const headerSearchMobileProps: {
|
|
4
|
+
readonly show: {
|
|
5
|
+
readonly type: BooleanConstructor;
|
|
6
|
+
readonly default: false;
|
|
7
|
+
};
|
|
8
|
+
readonly cssVars: {
|
|
9
|
+
readonly type: PropType<CSSProperties>;
|
|
10
|
+
readonly default: () => {};
|
|
11
|
+
};
|
|
12
|
+
readonly mergedClsPrefix: {
|
|
13
|
+
readonly type: PropType<string>;
|
|
14
|
+
readonly required: true;
|
|
15
|
+
};
|
|
16
|
+
readonly onClose: PropType<() => void>;
|
|
17
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
18
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
19
|
+
};
|
|
20
|
+
declare const _default: import("vue").DefineComponent<{
|
|
21
|
+
readonly show: {
|
|
22
|
+
readonly type: BooleanConstructor;
|
|
23
|
+
readonly default: false;
|
|
24
|
+
};
|
|
25
|
+
readonly cssVars: {
|
|
26
|
+
readonly type: PropType<CSSProperties>;
|
|
27
|
+
readonly default: () => {};
|
|
28
|
+
};
|
|
29
|
+
readonly mergedClsPrefix: {
|
|
30
|
+
readonly type: PropType<string>;
|
|
31
|
+
readonly required: true;
|
|
32
|
+
};
|
|
33
|
+
readonly onClose: PropType<() => void>;
|
|
34
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
35
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
36
|
+
}, {
|
|
37
|
+
placeholder: import("vue").ComputedRef<string>;
|
|
38
|
+
searchValue: import("vue").Ref<string>;
|
|
39
|
+
searchResults: import("vue").Ref<{
|
|
40
|
+
key: string | number;
|
|
41
|
+
label: string;
|
|
42
|
+
description?: string | undefined;
|
|
43
|
+
icon?: (() => import("vue").VNodeChild) | undefined;
|
|
44
|
+
extra?: string | undefined;
|
|
45
|
+
onClick?: (() => void) | undefined;
|
|
46
|
+
disabled?: boolean | undefined;
|
|
47
|
+
}[]>;
|
|
48
|
+
searchLoading: import("vue").Ref<boolean>;
|
|
49
|
+
handleSearchInput: (value: string) => void;
|
|
50
|
+
handleSearch: () => Promise<void>;
|
|
51
|
+
handleClose: () => void;
|
|
52
|
+
handleResultSelect: (result: HeaderSearchResult) => void;
|
|
53
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
54
|
+
readonly show: {
|
|
55
|
+
readonly type: BooleanConstructor;
|
|
56
|
+
readonly default: false;
|
|
57
|
+
};
|
|
58
|
+
readonly cssVars: {
|
|
59
|
+
readonly type: PropType<CSSProperties>;
|
|
60
|
+
readonly default: () => {};
|
|
61
|
+
};
|
|
62
|
+
readonly mergedClsPrefix: {
|
|
63
|
+
readonly type: PropType<string>;
|
|
64
|
+
readonly required: true;
|
|
65
|
+
};
|
|
66
|
+
readonly onClose: PropType<() => void>;
|
|
67
|
+
readonly onSearch: PropType<HeaderSearchHandler>;
|
|
68
|
+
readonly onSearchResultSelect: PropType<(result: HeaderSearchResult) => void>;
|
|
69
|
+
}>>, {
|
|
70
|
+
readonly show: boolean;
|
|
71
|
+
readonly cssVars: CSSProperties;
|
|
72
|
+
}, {}>;
|
|
73
|
+
export default _default;
|
|
@@ -0,0 +1,126 @@
|
|
|
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, watch, computed } from 'vue';
|
|
11
|
+
import { UDrawer } from '../../drawer';
|
|
12
|
+
import { UButton } from '../../button';
|
|
13
|
+
import { UIcon } from '../../icon';
|
|
14
|
+
import { UInput } from '../../input';
|
|
15
|
+
import HeaderSearchResults from './HeaderSearchResults';
|
|
16
|
+
import { useLocale } from '../../_mixins';
|
|
17
|
+
import { SEARCH_DEBOUNCE_MS } from './constants';
|
|
18
|
+
import { SearchIcon, ChevronLeftIcon } from '../../_internal/icons';
|
|
19
|
+
export const headerSearchMobileProps = {
|
|
20
|
+
show: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
cssVars: {
|
|
25
|
+
type: Object,
|
|
26
|
+
default: () => ({})
|
|
27
|
+
},
|
|
28
|
+
mergedClsPrefix: {
|
|
29
|
+
type: String,
|
|
30
|
+
required: true
|
|
31
|
+
},
|
|
32
|
+
onClose: Function,
|
|
33
|
+
onSearch: Function,
|
|
34
|
+
onSearchResultSelect: Function
|
|
35
|
+
};
|
|
36
|
+
export default defineComponent({
|
|
37
|
+
name: 'HeaderSearchMobile',
|
|
38
|
+
props: headerSearchMobileProps,
|
|
39
|
+
setup(props) {
|
|
40
|
+
const { localeRef } = useLocale('Header');
|
|
41
|
+
const searchValue = ref('');
|
|
42
|
+
const searchResults = ref([]);
|
|
43
|
+
const searchLoading = ref(false);
|
|
44
|
+
const placeholder = computed(() => localeRef.value.searchPlaceholder);
|
|
45
|
+
const handleSearch = () => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const query = searchValue.value.trim();
|
|
47
|
+
if (!query || !props.onSearch) {
|
|
48
|
+
searchResults.value = [];
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
searchLoading.value = true;
|
|
52
|
+
try {
|
|
53
|
+
const results = yield props.onSearch(query);
|
|
54
|
+
searchResults.value = results;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
searchResults.value = [];
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
searchLoading.value = false;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const handleSearchInput = (value) => {
|
|
64
|
+
searchValue.value = value;
|
|
65
|
+
};
|
|
66
|
+
const handleClose = () => {
|
|
67
|
+
var _a;
|
|
68
|
+
searchValue.value = '';
|
|
69
|
+
searchResults.value = [];
|
|
70
|
+
searchLoading.value = false;
|
|
71
|
+
(_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
72
|
+
};
|
|
73
|
+
const handleResultSelect = (result) => {
|
|
74
|
+
var _a;
|
|
75
|
+
(_a = props.onSearchResultSelect) === null || _a === void 0 ? void 0 : _a.call(props, result);
|
|
76
|
+
handleClose();
|
|
77
|
+
};
|
|
78
|
+
let searchTimeout = null;
|
|
79
|
+
watch(searchValue, () => {
|
|
80
|
+
if (searchTimeout) {
|
|
81
|
+
clearTimeout(searchTimeout);
|
|
82
|
+
}
|
|
83
|
+
searchTimeout = setTimeout(() => {
|
|
84
|
+
void handleSearch();
|
|
85
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
86
|
+
});
|
|
87
|
+
return {
|
|
88
|
+
placeholder,
|
|
89
|
+
searchValue,
|
|
90
|
+
searchResults,
|
|
91
|
+
searchLoading,
|
|
92
|
+
handleSearchInput,
|
|
93
|
+
handleSearch,
|
|
94
|
+
handleClose,
|
|
95
|
+
handleResultSelect
|
|
96
|
+
};
|
|
97
|
+
},
|
|
98
|
+
render() {
|
|
99
|
+
const blockClass = `${this.mergedClsPrefix}-header-search-mobile`;
|
|
100
|
+
return (h(UDrawer, { show: this.show, width: "84%", placement: "right", "auto-focus": false, onUpdateShow: (show) => {
|
|
101
|
+
if (!show) {
|
|
102
|
+
this.handleClose();
|
|
103
|
+
}
|
|
104
|
+
} }, () => (h("div", { class: blockClass, style: this.cssVars },
|
|
105
|
+
h("div", { class: `${blockClass}__header` },
|
|
106
|
+
h(UButton, { text: true, class: `${blockClass}__back`, onClick: this.handleClose }, () => h(UIcon, { size: 24 }, () => h(ChevronLeftIcon, null))),
|
|
107
|
+
h("div", { class: `${blockClass}__input-wrapper` },
|
|
108
|
+
h(UIcon, { size: 20, class: `${blockClass}__input-icon` }, () => h(SearchIcon, null)),
|
|
109
|
+
h(UInput, { value: this.searchValue, placeholder: this.placeholder, onKeyup: (e) => {
|
|
110
|
+
if (e.key === 'Enter') {
|
|
111
|
+
void this.handleSearch();
|
|
112
|
+
}
|
|
113
|
+
}, onUpdateValue: this.handleSearchInput }, {
|
|
114
|
+
prefix: () => (h(UIcon, { size: 20 }, () => h(SearchIcon, null)))
|
|
115
|
+
}))),
|
|
116
|
+
h(HeaderSearchResults, {
|
|
117
|
+
version: 'mobile',
|
|
118
|
+
results: this.searchResults,
|
|
119
|
+
loading: this.searchLoading,
|
|
120
|
+
query: this.searchValue,
|
|
121
|
+
mergedClsPrefix: this.mergedClsPrefix,
|
|
122
|
+
cssVars: this.cssVars,
|
|
123
|
+
onSelect: this.handleResultSelect
|
|
124
|
+
})))));
|
|
125
|
+
}
|
|
126
|
+
});
|