@uzum-tech/ui 1.12.15 → 1.12.17
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 +95 -17
- package/dist/index.prod.js +2 -2
- package/es/config-provider/src/internal-interface.d.ts +2 -0
- package/es/header/src/Header.d.ts +32 -10
- package/es/header/src/Header.js +13 -6
- package/es/header/src/HeaderNavigation.d.ts +17 -0
- package/es/header/src/HeaderNavigation.js +44 -11
- package/es/header/src/interface.d.ts +3 -2
- package/es/header/src/mobile/HeaderMobile.d.ts +1 -1
- package/es/header/src/styles/index.cssr.js +2 -0
- package/es/header/src/utils.d.ts +1 -0
- package/es/header/src/utils.js +34 -0
- package/es/modal/src/Modal.js +15 -1
- package/es/version.d.ts +1 -1
- package/es/version.js +1 -1
- package/lib/config-provider/src/internal-interface.d.ts +2 -0
- package/lib/header/src/Header.d.ts +32 -10
- package/lib/header/src/Header.js +13 -6
- package/lib/header/src/HeaderNavigation.d.ts +17 -0
- package/lib/header/src/HeaderNavigation.js +42 -9
- package/lib/header/src/interface.d.ts +3 -2
- package/lib/header/src/mobile/HeaderMobile.d.ts +1 -1
- package/lib/header/src/styles/index.cssr.js +2 -0
- package/lib/header/src/utils.d.ts +1 -0
- package/lib/header/src/utils.js +35 -0
- package/lib/modal/src/Modal.js +14 -0
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/web-types.json +19 -33
package/lib/header/src/Header.js
CHANGED
|
@@ -74,13 +74,20 @@ exports.headerProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props),
|
|
|
74
74
|
}, langOptions: {
|
|
75
75
|
type: Array,
|
|
76
76
|
default: () => defaultLangOptions
|
|
77
|
-
}, defaultLang:
|
|
77
|
+
}, defaultLang: {
|
|
78
|
+
type: [String, Number]
|
|
79
|
+
}, menuPlacement: {
|
|
78
80
|
type: String,
|
|
79
81
|
default: 'horizontal'
|
|
80
82
|
}, menuTrigger: {
|
|
81
83
|
type: String,
|
|
82
84
|
default: 'hover'
|
|
83
|
-
}, menuValue:
|
|
85
|
+
}, menuValue: {
|
|
86
|
+
type: [String, Number]
|
|
87
|
+
}, activeMenuKey: {
|
|
88
|
+
type: [String, Number],
|
|
89
|
+
default: null
|
|
90
|
+
}, menuTabsProps: {
|
|
84
91
|
type: Object,
|
|
85
92
|
default: () => ({})
|
|
86
93
|
}, menuCardMinColumnWidth: {
|
|
@@ -131,10 +138,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
131
138
|
'mobile-secondary-action'
|
|
132
139
|
],
|
|
133
140
|
setup(props, { emit }) {
|
|
134
|
-
var _a, _b
|
|
141
|
+
var _a, _b;
|
|
135
142
|
const { mergedClsPrefixRef } = (0, _mixins_1.useConfig)(props);
|
|
136
143
|
const themeRef = (0, _mixins_1.useTheme)('Header', '-header', index_cssr_1.default, styles_1.headerLight, props, mergedClsPrefixRef);
|
|
137
|
-
const isMobileRef = props
|
|
144
|
+
const isMobileRef = (0, vue_1.toRef)(props, 'isMobile');
|
|
138
145
|
const mobileMenuVisibleRef = (0, vue_1.ref)(false);
|
|
139
146
|
const searchVisibleRef = (0, vue_1.ref)(false);
|
|
140
147
|
(0, vue_1.onBeforeMount)(() => {
|
|
@@ -159,7 +166,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
159
166
|
((_b = props.langOptions) === null || _b === void 0 ? void 0 : _b[0]) ||
|
|
160
167
|
defaultLangOptions[0]);
|
|
161
168
|
const controlledMenuValueRef = (0, vue_1.toRef)(props, 'menuValue');
|
|
162
|
-
const uncontrolledMenuValueRef = (0, vue_1.ref)(
|
|
169
|
+
const uncontrolledMenuValueRef = (0, vue_1.ref)(null);
|
|
163
170
|
const mergedMenuValueRef = (0, vooks_1.useMergedState)(controlledMenuValueRef, uncontrolledMenuValueRef);
|
|
164
171
|
const normalizedMenuItemsRef = (0, vue_1.computed)(() => {
|
|
165
172
|
var _a;
|
|
@@ -318,7 +325,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
318
325
|
this.logoSrc && `${blockClass}__logo--clickable`
|
|
319
326
|
].filter(Boolean), onClick: this.handleLogoClick },
|
|
320
327
|
(0, vue_1.h)("img", { src: this.logoSrc, alt: this.logoAlt })));
|
|
321
|
-
const navigationNode = (0, _utils_1.resolveWrappedSlot)($slots.navigation, (children) => children !== null && children !== void 0 ? children : null) || ((0, vue_1.h)(HeaderNavigation_1.default, { 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 }));
|
|
328
|
+
const navigationNode = (0, _utils_1.resolveWrappedSlot)($slots.navigation, (children) => children !== null && children !== void 0 ? children : null) || ((0, vue_1.h)(HeaderNavigation_1.default, { 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, activeMenuKey: this.activeMenuKey, onUpdateMenuValue: this.handleMenuValueUpdate }));
|
|
322
329
|
const mobileNode = this.responsive && this.isMobile ? ((0, vue_1.h)(HeaderMobile_1.default, { 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 }, {
|
|
323
330
|
actions: $slots['mobile-actions'],
|
|
324
331
|
footer: $slots['mobile-footer']
|
|
@@ -39,6 +39,10 @@ export declare const headerNavigationProps: {
|
|
|
39
39
|
readonly type: StringConstructor;
|
|
40
40
|
readonly required: true;
|
|
41
41
|
};
|
|
42
|
+
readonly activeMenuKey: {
|
|
43
|
+
readonly type: PropType<string | number | null>;
|
|
44
|
+
readonly default: null;
|
|
45
|
+
};
|
|
42
46
|
readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
43
47
|
readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
44
48
|
};
|
|
@@ -76,6 +80,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
76
80
|
readonly type: StringConstructor;
|
|
77
81
|
readonly required: true;
|
|
78
82
|
};
|
|
83
|
+
readonly activeMenuKey: {
|
|
84
|
+
readonly type: PropType<string | number | null>;
|
|
85
|
+
readonly default: null;
|
|
86
|
+
};
|
|
79
87
|
readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
80
88
|
readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
81
89
|
}, {
|
|
@@ -1679,6 +1687,10 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1679
1687
|
"vector-effect"?: import("csstype").Property.VectorEffect | undefined;
|
|
1680
1688
|
}>;
|
|
1681
1689
|
hoveredKey: import("vue").Ref<string | number | null>;
|
|
1690
|
+
activeMenuKey: import("vue").Ref<string> | import("vue").Ref<number> | import("vue").Ref<null>;
|
|
1691
|
+
setActiveMenuKey: (key?: string | number | null) => void;
|
|
1692
|
+
handleMenuItemClick: (option: HeaderMenuOption) => void;
|
|
1693
|
+
checkedTopMenuKey: import("vue").ComputedRef<string | number | undefined>;
|
|
1682
1694
|
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
1683
1695
|
readonly menuOptions: {
|
|
1684
1696
|
readonly type: PropType<HeaderMenuOption[]>;
|
|
@@ -1713,12 +1725,17 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
1713
1725
|
readonly type: StringConstructor;
|
|
1714
1726
|
readonly required: true;
|
|
1715
1727
|
};
|
|
1728
|
+
readonly activeMenuKey: {
|
|
1729
|
+
readonly type: PropType<string | number | null>;
|
|
1730
|
+
readonly default: null;
|
|
1731
|
+
};
|
|
1716
1732
|
readonly 'onUpdate:menuValue': PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
1717
1733
|
readonly onUpdateMenuValue: PropType<MaybeArray<(value: string | number | null) => void>>;
|
|
1718
1734
|
}>>, {
|
|
1719
1735
|
readonly menuOptions: HeaderMenuOption[];
|
|
1720
1736
|
readonly menuPlacement: HeaderMenuPlacement;
|
|
1721
1737
|
readonly menuTrigger: "click" | "hover";
|
|
1738
|
+
readonly activeMenuKey: string | number | null;
|
|
1722
1739
|
readonly menuTabsProps: Partial<import("../..").TabsProps>;
|
|
1723
1740
|
readonly menuCardMinColumnWidth: string | number;
|
|
1724
1741
|
}, {}>;
|
|
@@ -58,6 +58,10 @@ exports.headerNavigationProps = {
|
|
|
58
58
|
type: String,
|
|
59
59
|
required: true
|
|
60
60
|
},
|
|
61
|
+
activeMenuKey: {
|
|
62
|
+
type: [String, Number],
|
|
63
|
+
default: null
|
|
64
|
+
},
|
|
61
65
|
'onUpdate:menuValue': [Function, Array],
|
|
62
66
|
onUpdateMenuValue: [Function, Array]
|
|
63
67
|
};
|
|
@@ -76,11 +80,16 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
76
80
|
navRef.value = el;
|
|
77
81
|
};
|
|
78
82
|
const hoveredKeyRef = (0, vue_1.ref)(null);
|
|
83
|
+
const activeMenuKeyRef = (0, vue_1.toRef)(props.activeMenuKey);
|
|
79
84
|
const tabRefs = (0, vue_1.ref)({});
|
|
80
85
|
const indicatorStyleRef = (0, vue_1.ref)({
|
|
81
86
|
width: '0px',
|
|
82
87
|
transform: 'translateX(0)'
|
|
83
88
|
});
|
|
89
|
+
const checkedTopMenuKey = (0, vue_1.computed)(() => {
|
|
90
|
+
var _a;
|
|
91
|
+
return ((_a = (0, utils_1.resolveTopLevelMenuKey)(props.menuOptions, activeMenuKeyRef.value)) !== null && _a !== void 0 ? _a : undefined);
|
|
92
|
+
});
|
|
84
93
|
function updateIndicator() {
|
|
85
94
|
var _a, _b;
|
|
86
95
|
const navEl = navRef.value;
|
|
@@ -120,6 +129,14 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
120
129
|
if (_onUpdateMenuValue)
|
|
121
130
|
(0, _utils_1.call)(_onUpdateMenuValue, value);
|
|
122
131
|
}
|
|
132
|
+
function setActiveMenuKey(key = null) {
|
|
133
|
+
activeMenuKeyRef.value = key;
|
|
134
|
+
}
|
|
135
|
+
function handleMenuItemClick(option) {
|
|
136
|
+
setActiveMenuKey(option === null || option === void 0 ? void 0 : option.key);
|
|
137
|
+
if (option.onClick)
|
|
138
|
+
option === null || option === void 0 ? void 0 : option.onClick();
|
|
139
|
+
}
|
|
123
140
|
(0, vue_1.onMounted)(() => __awaiter(this, void 0, void 0, function* () {
|
|
124
141
|
yield (0, vue_1.nextTick)(updateIndicator);
|
|
125
142
|
window.addEventListener('resize', updateIndicator);
|
|
@@ -151,7 +168,11 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
151
168
|
navRef,
|
|
152
169
|
setTabRef,
|
|
153
170
|
indicatorStyle: indicatorStyleRef,
|
|
154
|
-
hoveredKey: hoveredKeyRef
|
|
171
|
+
hoveredKey: hoveredKeyRef,
|
|
172
|
+
activeMenuKey: activeMenuKeyRef,
|
|
173
|
+
setActiveMenuKey,
|
|
174
|
+
handleMenuItemClick,
|
|
175
|
+
checkedTopMenuKey
|
|
155
176
|
};
|
|
156
177
|
},
|
|
157
178
|
render() {
|
|
@@ -170,7 +191,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
170
191
|
return ((0, vue_1.h)("div", Object.assign({ key: key, class: [
|
|
171
192
|
`${blockClass}__menu-item`,
|
|
172
193
|
option.disabled && `${blockClass}__menu-item--disabled`
|
|
173
|
-
], role: "button", tabindex: option.disabled ? undefined : 0, onClick:
|
|
194
|
+
], role: "button", tabindex: option.disabled ? undefined : 0, onClick: (event) => {
|
|
195
|
+
event.stopPropagation();
|
|
196
|
+
this.handleMenuItemClick(option);
|
|
197
|
+
} }, $props),
|
|
174
198
|
(0, vue_1.h)("span", { class: `${blockClass}__menu-item-main` },
|
|
175
199
|
icon ? ((0, vue_1.h)("span", { class: `${blockClass}__menu-item-icon` }, icon)) : null,
|
|
176
200
|
(0, vue_1.h)("span", { class: `${blockClass}__menu-item-label` }, (0, utils_1.renderOptionLabel)(option))),
|
|
@@ -204,7 +228,10 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
204
228
|
const hasChildren = option.children && option.children.length > 0;
|
|
205
229
|
if (!hasChildren) {
|
|
206
230
|
return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column-section` },
|
|
207
|
-
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick:
|
|
231
|
+
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: (event) => {
|
|
232
|
+
event.stopPropagation();
|
|
233
|
+
this.handleMenuItemClick(option);
|
|
234
|
+
} }, (0, utils_1.renderOptionLabel)(option))));
|
|
208
235
|
}
|
|
209
236
|
const children = (_e = (_d = option.children) === null || _d === void 0 ? void 0 : _d.map((child, index) => renderMenuItem(child, `${key}-item-${index}`))) !== null && _e !== void 0 ? _e : [];
|
|
210
237
|
const content = children.filter(utils_1.isNotNull);
|
|
@@ -212,11 +239,17 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
212
239
|
return null;
|
|
213
240
|
if (asSection) {
|
|
214
241
|
return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column-section` },
|
|
215
|
-
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick:
|
|
242
|
+
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: (event) => {
|
|
243
|
+
event.stopPropagation();
|
|
244
|
+
this.handleMenuItemClick(option);
|
|
245
|
+
} }, (0, utils_1.renderOptionLabel)(option)),
|
|
216
246
|
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-list` }, content)));
|
|
217
247
|
}
|
|
218
248
|
return ((0, vue_1.h)("div", { key: key, class: `${blockClass}__menu-column` },
|
|
219
|
-
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick:
|
|
249
|
+
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-title`, role: option.onClick ? 'button' : undefined, tabindex: option.onClick && !option.disabled ? 0 : undefined, onClick: (event) => {
|
|
250
|
+
event.stopPropagation();
|
|
251
|
+
this.handleMenuItemClick(option);
|
|
252
|
+
} }, (0, utils_1.renderOptionLabel)(option)),
|
|
220
253
|
(0, vue_1.h)("div", { class: `${blockClass}__menu-column-list` }, content)));
|
|
221
254
|
}
|
|
222
255
|
return ((0, vue_1.h)("div", { key: key, class: [
|
|
@@ -290,6 +323,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
290
323
|
(0, vue_1.h)("div", { class: "u-tabs-pad", style: { width: tabsPaddingValue } }),
|
|
291
324
|
menuItems.map((item, index) => {
|
|
292
325
|
const isActive = activeValue === item.key;
|
|
326
|
+
const isChecked = this.checkedTopMenuKey === item.key;
|
|
293
327
|
const isOpen = isHoverTrigger
|
|
294
328
|
? this.hoveredKey === item.key
|
|
295
329
|
: isActive;
|
|
@@ -302,7 +336,8 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
302
336
|
'u-tabs-tab',
|
|
303
337
|
`${blockClass}__tab`,
|
|
304
338
|
isActive && 'u-tabs-tab--active',
|
|
305
|
-
isDisabled && 'u-tabs-tab--disabled'
|
|
339
|
+
isDisabled && 'u-tabs-tab--disabled',
|
|
340
|
+
isChecked && 'u-tabs-tab--checked'
|
|
306
341
|
], ref: this.setTabRef(item.key), role: "tab", "aria-selected": isActive, "aria-disabled": isDisabled, tabindex: isDisabled ? -1 : isActive ? 0 : -1, onKeydown: (event) => {
|
|
307
342
|
if (!isDisabled &&
|
|
308
343
|
!isHoverTrigger &&
|
|
@@ -320,9 +355,7 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
320
355
|
if (!isHoverTrigger) {
|
|
321
356
|
emitUpdate(item.key);
|
|
322
357
|
}
|
|
323
|
-
|
|
324
|
-
item.option.onClick();
|
|
325
|
-
}
|
|
358
|
+
this.handleMenuItemClick(item.option);
|
|
326
359
|
}
|
|
327
360
|
: undefined },
|
|
328
361
|
icon ? ((0, vue_1.h)("span", { class: `${blockClass}__tab-icon` }, icon)) : null,
|
|
@@ -9,7 +9,7 @@ export interface HeaderProps {
|
|
|
9
9
|
menuPlacement?: HeaderMenuPlacement;
|
|
10
10
|
menuTrigger?: HeaderMenuTrigger;
|
|
11
11
|
menuValue?: string | number | null;
|
|
12
|
-
|
|
12
|
+
activeMenuKey?: string | number | null;
|
|
13
13
|
menuTabsProps?: HeaderMenuTabsProps;
|
|
14
14
|
menuCardMinColumnWidth?: string | number;
|
|
15
15
|
logoSrc?: string;
|
|
@@ -52,9 +52,10 @@ export type HeaderMenuDividerOption = MenuDividerOption;
|
|
|
52
52
|
export type HeaderSearchHandler = (query: string) => Promise<HeaderSearchResult[]> | HeaderSearchResult[];
|
|
53
53
|
export type HeaderMenuChildOption = HeaderMenuColumnOption | HeaderMenuGroupOption | HeaderMenuDividerOption | HeaderMenuOption;
|
|
54
54
|
export type HeaderMenuOption = Omit<BaseMenuOption, 'children'> & {
|
|
55
|
+
key?: string | number | null;
|
|
55
56
|
children?: HeaderMenuChildOption[];
|
|
56
|
-
onClick?: () => void;
|
|
57
57
|
hide?: boolean;
|
|
58
|
+
onClick?: () => void;
|
|
58
59
|
};
|
|
59
60
|
export type HeaderMenuPlacement = 'horizontal' | 'vertical' | 'top' | 'bottom' | 'left' | 'right';
|
|
60
61
|
export type HeaderMenuTrigger = 'click' | 'hover';
|
|
@@ -207,8 +207,8 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
207
207
|
}>>, {
|
|
208
208
|
readonly primaryActionText: string;
|
|
209
209
|
readonly secondaryActionText: string;
|
|
210
|
-
readonly visible: boolean;
|
|
211
210
|
readonly menuOptions: NormalizedMenuItem[];
|
|
211
|
+
readonly visible: boolean;
|
|
212
212
|
readonly menuType: "drawer" | "dropdown";
|
|
213
213
|
readonly drawerPlacement: "left" | "right";
|
|
214
214
|
readonly drawerWidth: string;
|
|
@@ -132,6 +132,8 @@ exports.default = (0, cssr_1.cB)('header', `
|
|
|
132
132
|
cursor: not-allowed;
|
|
133
133
|
pointer-events: none;
|
|
134
134
|
opacity: .5;
|
|
135
|
+
`), (0, cssr_1.c)('& .u-tabs-tab--checked', `
|
|
136
|
+
color: var(--u-header-tab-text-color-active);
|
|
135
137
|
`), (0, cssr_1.c)('& .u-tabs-tab:hover', `
|
|
136
138
|
color: var(--u-header-tab-text-color-hover);
|
|
137
139
|
`), (0, cssr_1.c)('& .u-tabs-bar', `
|
|
@@ -11,3 +11,4 @@ export declare function isColumnOption(option: HeaderMenuChildOption): option is
|
|
|
11
11
|
export declare function isNotNull<T>(value: T | null): value is T;
|
|
12
12
|
export declare function resolvePlacement(placement: HeaderMenuPlacement): TabsProps['placement'];
|
|
13
13
|
export declare function isLeafMenuOption(option: HeaderMenuChildOption): option is Exclude<HeaderMenuChildOption, HeaderMenuColumnOption>;
|
|
14
|
+
export declare function resolveTopLevelMenuKey(menuOptions: HeaderMenuOption[], activeMenuKey: string | number | null | undefined): string | number | null;
|
package/lib/header/src/utils.js
CHANGED
|
@@ -10,6 +10,7 @@ exports.isColumnOption = isColumnOption;
|
|
|
10
10
|
exports.isNotNull = isNotNull;
|
|
11
11
|
exports.resolvePlacement = resolvePlacement;
|
|
12
12
|
exports.isLeafMenuOption = isLeafMenuOption;
|
|
13
|
+
exports.resolveTopLevelMenuKey = resolveTopLevelMenuKey;
|
|
13
14
|
const vue_1 = require("vue");
|
|
14
15
|
function renderOptionLabel(option) {
|
|
15
16
|
var _a;
|
|
@@ -60,3 +61,37 @@ function resolvePlacement(placement) {
|
|
|
60
61
|
function isLeafMenuOption(option) {
|
|
61
62
|
return option.type !== 'column';
|
|
62
63
|
}
|
|
64
|
+
function isMenuValueInChildren(children, value) {
|
|
65
|
+
if (!children || children.length === 0)
|
|
66
|
+
return false;
|
|
67
|
+
for (const child of children) {
|
|
68
|
+
if (isDividerOption(child))
|
|
69
|
+
continue;
|
|
70
|
+
if (isColumnOption(child)) {
|
|
71
|
+
if (isMenuValueInChildren(child.children, value))
|
|
72
|
+
return true;
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (child.key === value)
|
|
76
|
+
return true;
|
|
77
|
+
if (isGroupOption(child) || hasChildren(child)) {
|
|
78
|
+
if (isMenuValueInChildren(child.children, value))
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
function resolveTopLevelMenuKey(menuOptions, activeMenuKey) {
|
|
85
|
+
if (activeMenuKey === null || activeMenuKey === undefined)
|
|
86
|
+
return null;
|
|
87
|
+
for (let index = 0; index < menuOptions.length; index += 1) {
|
|
88
|
+
const option = menuOptions[index];
|
|
89
|
+
const optionKey = getMenuItemKey(option, index);
|
|
90
|
+
if (optionKey === activeMenuKey)
|
|
91
|
+
return optionKey;
|
|
92
|
+
if (isMenuValueInChildren(option.children, activeMenuKey)) {
|
|
93
|
+
return optionKey;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}
|
package/lib/modal/src/Modal.js
CHANGED
|
@@ -130,6 +130,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
130
130
|
const { onBeforeLeave, onBeforeHide } = props;
|
|
131
131
|
if (onBeforeLeave)
|
|
132
132
|
(0, _utils_1.call)(onBeforeLeave);
|
|
133
|
+
void (0, vue_1.nextTick)(() => {
|
|
134
|
+
if (document.activeElement &&
|
|
135
|
+
document.activeElement !== document.body) {
|
|
136
|
+
;
|
|
137
|
+
document.activeElement.blur();
|
|
138
|
+
}
|
|
139
|
+
});
|
|
133
140
|
// deprecated
|
|
134
141
|
if (onBeforeHide)
|
|
135
142
|
onBeforeHide();
|
|
@@ -138,6 +145,13 @@ exports.default = (0, vue_1.defineComponent)({
|
|
|
138
145
|
const { onAfterLeave, onAfterHide } = props;
|
|
139
146
|
if (onAfterLeave)
|
|
140
147
|
(0, _utils_1.call)(onAfterLeave);
|
|
148
|
+
void (0, vue_1.nextTick)(() => {
|
|
149
|
+
if (document.activeElement &&
|
|
150
|
+
document.activeElement !== document.body) {
|
|
151
|
+
;
|
|
152
|
+
document.activeElement.blur();
|
|
153
|
+
}
|
|
154
|
+
});
|
|
141
155
|
// deprecated
|
|
142
156
|
if (onAfterHide)
|
|
143
157
|
onAfterHide();
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "1.12.
|
|
1
|
+
declare const _default: "1.12.17";
|
|
2
2
|
export default _default;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/web-types.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"framework": "vue",
|
|
4
4
|
"name": "@uzum-tech/ui",
|
|
5
|
-
"version": "1.12.
|
|
5
|
+
"version": "1.12.17",
|
|
6
6
|
"js-types-syntax": "typescript",
|
|
7
7
|
"contributions": {
|
|
8
8
|
"html": {
|
|
@@ -18294,7 +18294,7 @@
|
|
|
18294
18294
|
{
|
|
18295
18295
|
"name": "menu-options",
|
|
18296
18296
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18297
|
-
"type": "
|
|
18297
|
+
"type": "HeaderMenuOption[]",
|
|
18298
18298
|
"description": "Navigation data rendered as tabs with grid dropdown cards.",
|
|
18299
18299
|
"default": "[]"
|
|
18300
18300
|
},
|
|
@@ -18303,7 +18303,7 @@
|
|
|
18303
18303
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18304
18304
|
"type": "LangOption[]",
|
|
18305
18305
|
"description": "Language options for the language switcher.",
|
|
18306
|
-
"default": "[
|
|
18306
|
+
"default": "['Русский', \"O'zbek\"]"
|
|
18307
18307
|
},
|
|
18308
18308
|
{
|
|
18309
18309
|
"name": "default-lang",
|
|
@@ -18334,10 +18334,10 @@
|
|
|
18334
18334
|
"default": "undefined"
|
|
18335
18335
|
},
|
|
18336
18336
|
{
|
|
18337
|
-
"name": "
|
|
18337
|
+
"name": "active-menu-key",
|
|
18338
18338
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18339
18339
|
"type": "string | number | null",
|
|
18340
|
-
"description": "
|
|
18340
|
+
"description": "Active menu key.",
|
|
18341
18341
|
"default": "null"
|
|
18342
18342
|
},
|
|
18343
18343
|
{
|
|
@@ -18359,7 +18359,7 @@
|
|
|
18359
18359
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18360
18360
|
"type": "string",
|
|
18361
18361
|
"description": "Source for the default logo when the slot is not provided.",
|
|
18362
|
-
"default": "
|
|
18362
|
+
"default": "'/demo/assets/images/logo.svg'"
|
|
18363
18363
|
},
|
|
18364
18364
|
{
|
|
18365
18365
|
"name": "logo-alt",
|
|
@@ -18378,7 +18378,9 @@
|
|
|
18378
18378
|
{
|
|
18379
18379
|
"name": "is-mobile",
|
|
18380
18380
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18381
|
-
"type": "boolean"
|
|
18381
|
+
"type": "boolean",
|
|
18382
|
+
"description": "Force mobile layout when `responsive` is enabled.",
|
|
18383
|
+
"default": "true"
|
|
18382
18384
|
},
|
|
18383
18385
|
{
|
|
18384
18386
|
"name": "mobile-menu-type",
|
|
@@ -18406,14 +18408,14 @@
|
|
|
18406
18408
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18407
18409
|
"type": "string",
|
|
18408
18410
|
"description": "Text for primary action button in mobile footer.",
|
|
18409
|
-
"default": "
|
|
18411
|
+
"default": "undefined"
|
|
18410
18412
|
},
|
|
18411
18413
|
{
|
|
18412
18414
|
"name": "mobile-secondary-action-text",
|
|
18413
18415
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18414
18416
|
"type": "string",
|
|
18415
18417
|
"description": "Text for secondary action button in mobile footer.",
|
|
18416
|
-
"default": "
|
|
18418
|
+
"default": "undefined"
|
|
18417
18419
|
},
|
|
18418
18420
|
{
|
|
18419
18421
|
"name": "mobile-show-header-actions",
|
|
@@ -18423,31 +18425,10 @@
|
|
|
18423
18425
|
"default": "true"
|
|
18424
18426
|
},
|
|
18425
18427
|
{
|
|
18426
|
-
"name": "
|
|
18427
|
-
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18428
|
-
"type": "number",
|
|
18429
|
-
"description": "Breakpoint (px) at which mobile mode activates.",
|
|
18430
|
-
"default": "768"
|
|
18431
|
-
},
|
|
18432
|
-
{
|
|
18433
|
-
"name": "mobile-footer-buttons-round",
|
|
18434
|
-
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18435
|
-
"type": "boolean",
|
|
18436
|
-
"description": "Make mobile footer buttons rounded.",
|
|
18437
|
-
"default": "true"
|
|
18438
|
-
},
|
|
18439
|
-
{
|
|
18440
|
-
"name": "mobile-close-icon-size",
|
|
18441
|
-
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18442
|
-
"type": "number",
|
|
18443
|
-
"description": "Size of the close icon in mobile menu header (px).",
|
|
18444
|
-
"default": "24"
|
|
18445
|
-
},
|
|
18446
|
-
{
|
|
18447
|
-
"name": "mobile-close-icon-color",
|
|
18428
|
+
"name": "logo-props",
|
|
18448
18429
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18449
|
-
"type": "
|
|
18450
|
-
"description": "
|
|
18430
|
+
"type": "Partial<ImageProps>",
|
|
18431
|
+
"description": "Props passed to the default logo image component.",
|
|
18451
18432
|
"default": "undefined"
|
|
18452
18433
|
}
|
|
18453
18434
|
],
|
|
@@ -18534,6 +18515,11 @@
|
|
|
18534
18515
|
"name": "menu-pane-wrapper-class",
|
|
18535
18516
|
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18536
18517
|
"type": "string"
|
|
18518
|
+
},
|
|
18519
|
+
{
|
|
18520
|
+
"name": "active-menu-key",
|
|
18521
|
+
"doc-url": "https://uzum-ui.kapitalbank.uz/en-US/os-theme/components/header",
|
|
18522
|
+
"type": "string | number"
|
|
18537
18523
|
}
|
|
18538
18524
|
],
|
|
18539
18525
|
"js": {
|