@gravity-ui/navigation 0.16.0 → 0.17.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/README.md +17 -1
- package/build/cjs/components/CompositeBar/HighlightedItem/HighlightedItem.d.ts +12 -0
- package/build/cjs/components/CompositeBar/Item/Item.d.ts +3 -0
- package/build/cjs/components/CompositeBar/constants.d.ts +0 -1
- package/build/cjs/components/constants.d.ts +1 -1
- package/build/cjs/components/utils/cn.d.ts +3 -3
- package/build/cjs/index.js +1328 -1315
- package/build/cjs/index.js.map +1 -1
- package/build/esm/components/CompositeBar/HighlightedItem/HighlightedItem.d.ts +12 -0
- package/build/esm/components/CompositeBar/Item/Item.d.ts +3 -0
- package/build/esm/components/CompositeBar/constants.d.ts +0 -1
- package/build/esm/components/constants.d.ts +1 -1
- package/build/esm/components/utils/cn.d.ts +3 -3
- package/build/esm/index.js +1313 -1300
- package/build/esm/index.js.map +1 -1
- package/package.json +3 -1
package/build/esm/index.js
CHANGED
|
@@ -1,73 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { Children, isValidElement, cloneElement, Component, createElement,
|
|
3
|
-
import {
|
|
2
|
+
import React__default, { Children, isValidElement, cloneElement, Component, createElement, useState, useCallback, useEffect, useRef, useContext, useMemo } from 'react';
|
|
3
|
+
import { withNaming } from '@bem-react/classname';
|
|
4
|
+
import { useBodyScrollLock, Button, Icon, Portal, Popup, List, Tooltip, Text, Hotkey, TextInput, Tabs, Loader, Sheet, eventBroker } from '@gravity-ui/uikit';
|
|
4
5
|
import ReactDOM from 'react-dom';
|
|
5
6
|
import { Ellipsis, Xmark } from '@gravity-ui/icons';
|
|
6
7
|
|
|
7
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
|
-
|
|
9
|
-
var lib$1 = {};
|
|
10
|
-
|
|
11
|
-
var lib = {exports: {}};
|
|
12
|
-
|
|
13
|
-
/*!
|
|
14
|
-
* bem-cn v3.0.1
|
|
15
|
-
* Friendly BEM class names generator, greate for React
|
|
16
|
-
* @author Alexander Burtsev, https://github.com/albburtsev
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
(function (module, exports) {
|
|
20
|
-
!function(n,t){module.exports=t();}(commonjsGlobal,function(){return function(n){var t={};function e(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}return e.m=n,e.c=t,e.d=function(n,t,r){e.o(n,t)||Object.defineProperty(n,t,{enumerable:!0,get:r});},e.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0});},e.t=function(n,t){if(1&t&&(n=e(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)e.d(r,o,function(t){return n[t]}.bind(null,o));return r},e.n=function(n){var t=n&&n.__esModule?function(){return n.default}:function(){return n};return e.d(t,"a",t),t},e.o=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},e.p="",e(e.s=0)}([function(n,t,e){Object.defineProperty(t,"__esModule",{value:!0});var r=e(1);t.ERROR_BLOCK_NAME_TYPE="Block name should be a string",t.ERROR_BLOCK_NAME_EMPTY="Block name should be non-empty";var o={ns:"",el:"__",mod:"_",modValue:"_"},i=function(n){return "string"==typeof n},u=function(n){return "string"!=typeof n},s=function(n,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];var i=r.assign({},t);return i.mixes=i.mixes.concat(e),c(i,n)},a=function(n,t,e){for(var o=[],i=3;i<arguments.length;i++)o[i-3]=arguments[i];var u=r.assign({},t),s=r.assign({},u.states||{});return s[e]=r.assign.apply(void 0,[{},s[e]||{}].concat(o)),u.states=s,c(u,n)},l=function(n,t,e,r){return String.prototype.split.call(f(n,t),e,r)},f=function(n,t){var e=t.name,r=t.mods,o=t.mixes,i=t.states,u=[e];if(r&&(u=u.concat(Object.keys(r).filter(function(n){return r[n]}).map(function(t){var o=r[t];return !0===o?e+n.mod+t:e+n.mod+t+n.modValue+o}))),i&&Object.keys(i).forEach(function(n){var t=i[n];u=u.concat(Object.keys(t).filter(function(n){return t[n]}).map(function(t){return n+t}));}),n.ns&&(u=u.map(function(t){return n.ns+t})),o&&(u=u.concat(function(n){return void 0===n&&(n=[]),n.map(function(n){return Array.isArray(n)?n.join(" "):"object"==typeof n&&null!==n?n.toString():"function"==typeof n?n.toString():"string"==typeof n?n:""}).filter(function(n){return !!n})}(o))),n.classMap){var s=n.classMap;u=u.map(function(n){return s[n]||n});}return u.join(" ")},c=function(n,t){return {mix:s.bind(null,t,n),split:l.bind(null,t,n),is:a.bind(null,t,n,"is-"),has:a.bind(null,t,n,"has-"),state:a.bind(null,t,n,"is-"),toString:f.bind(null,t,n)}},d=function(n,t){var e={name:n,mods:{},mixes:[],states:{"is-":{},"has-":{}}},o=function(n,t){for(var e=[],o=2;o<arguments.length;o++)e[o-2]=arguments[o];if(!e.length)return f(n,t);var s=r.assign({},t),a=e.filter(i).reduce(function(t,e){return t+n.el+e},"");a&&(s.name=s.name+a);var l=e.filter(u).reduce(function(n,t){return r.assign(n,t)},{});return s.mods=r.assign({},s.mods,l),c(s,n)}.bind(null,t,e);return o.mix=s.bind(null,t,e),o.split=l.bind(null,t,e),o.is=a.bind(null,t,e,"is-"),o.has=a.bind(null,t,e,"has-"),o.state=a.bind(null,t,e,"is-"),o.toString=f.bind(null,t,e),o};t.setup=function(n){return void 0===n&&(n={}),function(e){if("string"!=typeof e)throw new Error(t.ERROR_BLOCK_NAME_TYPE);var i=e.trim();if(!i)throw new Error(t.ERROR_BLOCK_NAME_EMPTY);return d(i,r.assign({},o,n))}},t.block=t.setup(),t.default=t.block;},function(n,t,e){Object.defineProperty(t,"__esModule",{value:!0}),t.assign=function(n){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];for(var r=0;r<t.length;r++){var o=t[r];for(var i in o)o.hasOwnProperty(i)&&(n[i]=o[i]);}return n};}])});
|
|
21
|
-
} (lib));
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(lib$1, "__esModule", { value: true });
|
|
24
|
-
var bem_cn_1 = lib.exports;
|
|
25
|
-
var block$1 = (0, bem_cn_1.setup)();
|
|
26
|
-
function isString(data) {
|
|
27
|
-
return typeof data === 'string';
|
|
28
|
-
}
|
|
29
|
-
function hasMixinShape(data) {
|
|
30
|
-
return isString(data) || (Array.isArray(data) && data.every(isString));
|
|
31
|
-
}
|
|
32
|
-
function bemClassNameLite(blockName) {
|
|
33
|
-
var b = block$1(blockName);
|
|
34
|
-
function element() {
|
|
35
|
-
var args = [];
|
|
36
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
37
|
-
args[_i] = arguments[_i];
|
|
38
|
-
}
|
|
39
|
-
var elementName = args.shift();
|
|
40
|
-
var modifiers = args[0], mixin = args[1];
|
|
41
|
-
var result;
|
|
42
|
-
if (typeof elementName !== 'string' || hasMixinShape(modifiers)) {
|
|
43
|
-
mixin = modifiers;
|
|
44
|
-
modifiers = null;
|
|
45
|
-
}
|
|
46
|
-
result = b(elementName, modifiers);
|
|
47
|
-
if (mixin) {
|
|
48
|
-
result = result.mix(mixin);
|
|
49
|
-
}
|
|
50
|
-
return result.toString();
|
|
51
|
-
}
|
|
52
|
-
element.builder = function () {
|
|
53
|
-
return b;
|
|
54
|
-
};
|
|
55
|
-
return element;
|
|
56
|
-
}
|
|
57
|
-
bemClassNameLite.setup = function (config) {
|
|
58
|
-
block$1 = (0, bem_cn_1.setup)(config);
|
|
59
|
-
};
|
|
60
|
-
bemClassNameLite.reset = function () {
|
|
61
|
-
block$1 = (0, bem_cn_1.setup)();
|
|
62
|
-
};
|
|
63
|
-
var _default = lib$1.default = bemClassNameLite;
|
|
64
|
-
|
|
65
8
|
const NAMESPACE = 'gn-';
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
9
|
+
withNaming({ e: '__', m: '_' });
|
|
10
|
+
const block = withNaming({ n: NAMESPACE, e: '__', m: '_' });
|
|
69
11
|
|
|
70
|
-
const
|
|
12
|
+
const ASIDE_HEADER_ICON_SIZE = 18;
|
|
71
13
|
const ASIDE_HEADER_COMPACT_WIDTH = 56;
|
|
72
14
|
const ASIDE_HEADER_EXPANDED_WIDTH = 236;
|
|
73
15
|
|
|
@@ -113,6 +55,8 @@ function _inheritsLoose(subClass, superClass) {
|
|
|
113
55
|
_setPrototypeOf(subClass, superClass);
|
|
114
56
|
}
|
|
115
57
|
|
|
58
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
59
|
+
|
|
116
60
|
var propTypes = {exports: {}};
|
|
117
61
|
|
|
118
62
|
var reactIs = {exports: {}};
|
|
@@ -3117,15 +3061,15 @@ function styleInject(css, ref) {
|
|
|
3117
3061
|
}
|
|
3118
3062
|
}
|
|
3119
3063
|
|
|
3120
|
-
var css_248z$
|
|
3121
|
-
styleInject(css_248z$
|
|
3064
|
+
var css_248z$n = ".gn-drawer__item {\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n height: 100%;\n will-change: transform;\n background-color: var(--g-color-base-background);\n}\n.gn-drawer__item_direction_right {\n left: auto;\n right: 0;\n}\n.gn-drawer__item-transition-enter {\n transform: translate(-100%, 0);\n}\n.gn-drawer__item-transition_direction_right-enter {\n transform: translate(100%, 0);\n}\n.gn-drawer__item-transition-enter-active, .gn-drawer__item-transition_direction_right-enter-active {\n transform: translate(0, 0);\n transition: transform 300ms;\n}\n.gn-drawer__item-transition-enter-done, .gn-drawer__item-transition_direction_right-enter-done {\n filter: blur(0px);\n transform: translateZ(0);\n}\n.gn-drawer__item-transition-exit, .gn-drawer__item-transition_direction_right-exit {\n transform: translate(0, 0);\n}\n.gn-drawer__item-transition-exit-active, .gn-drawer__item-transition_direction_right-exit-active {\n transition: transform 300ms;\n}\n.gn-drawer__item-transition-exit-active {\n transform: translate(-100%, 0);\n}\n.gn-drawer__item-transition_direction_right-exit-active {\n transform: translate(100%, 0);\n}\n.gn-drawer__item-transition-exit-done, .gn-drawer__item-transition_direction_right-exit-done {\n visibility: hidden;\n}\n.gn-drawer__veil {\n position: absolute;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n background-color: var(--g-color-sfx-veil);\n}\n.gn-drawer__veil-transition-enter {\n opacity: 0;\n}\n.gn-drawer__veil-transition-enter-active {\n opacity: 1;\n transition: opacity 300ms;\n}\n.gn-drawer__veil-transition-exit {\n opacity: 1;\n}\n.gn-drawer__veil-transition-exit-active {\n opacity: 0;\n transition: opacity 300ms;\n}\n.gn-drawer__veil-transition-exit-done {\n visibility: hidden;\n}";
|
|
3065
|
+
styleInject(css_248z$n);
|
|
3122
3066
|
|
|
3123
|
-
const b$
|
|
3067
|
+
const b$o = block('drawer');
|
|
3124
3068
|
const TIMEOUT = 300;
|
|
3125
3069
|
const DrawerItem = ({ visible, content, direction, className }) => {
|
|
3126
3070
|
const itemRef = React__default.useRef(null);
|
|
3127
|
-
return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$
|
|
3128
|
-
React__default.createElement("div", { ref: itemRef, className: b$
|
|
3071
|
+
return (React__default.createElement(CSSTransition, { in: visible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$o('item-transition', { direction }), nodeRef: itemRef },
|
|
3072
|
+
React__default.createElement("div", { ref: itemRef, className: b$o('item', { direction }, className) }, content)));
|
|
3129
3073
|
};
|
|
3130
3074
|
const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScrollBody = true, }) => {
|
|
3131
3075
|
let someItemVisible = false;
|
|
@@ -3156,9 +3100,9 @@ const Drawer = ({ className, children, style, onVeilClick, onEscape, preventScro
|
|
|
3156
3100
|
const veilRef = React__default.useRef(null);
|
|
3157
3101
|
return (React__default.createElement(Transition, { in: someItemVisible, timeout: { enter: 0, exit: TIMEOUT }, mountOnEnter: true, unmountOnExit: true, nodeRef: containerRef }, (state) => {
|
|
3158
3102
|
const childrenVisible = someItemVisible && state === 'entered';
|
|
3159
|
-
return (React__default.createElement("div", { ref: containerRef, className: b$
|
|
3160
|
-
React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$
|
|
3161
|
-
React__default.createElement("div", { ref: veilRef, className: b$
|
|
3103
|
+
return (React__default.createElement("div", { ref: containerRef, className: b$o(null, className), style: style },
|
|
3104
|
+
React__default.createElement(CSSTransition, { in: childrenVisible, timeout: TIMEOUT, unmountOnExit: true, classNames: b$o('veil-transition'), nodeRef: veilRef },
|
|
3105
|
+
React__default.createElement("div", { ref: veilRef, className: b$o('veil'), onClick: onVeilClick })),
|
|
3162
3106
|
React__default.Children.map(children, (child) => {
|
|
3163
3107
|
const childElem = child;
|
|
3164
3108
|
if (childElem.type === DrawerItem) {
|
|
@@ -3177,10 +3121,10 @@ const AsideHeaderContext = React__default.createContext({
|
|
|
3177
3121
|
const AsideHeaderContextProvider = AsideHeaderContext.Provider;
|
|
3178
3122
|
const useAsideHeaderContext = () => React__default.useContext(AsideHeaderContext);
|
|
3179
3123
|
|
|
3180
|
-
var css_248z$
|
|
3181
|
-
styleInject(css_248z$
|
|
3124
|
+
var css_248z$m = ".gn-logo {\n display: flex;\n align-items: center;\n flex-shrink: 0;\n height: 40px;\n}\n.gn-logo__logo-btn-place {\n flex-shrink: 0;\n width: var(--gn-aside-header-min-width);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n}\n.gn-logo__logo-btn-place .yc-button::before {\n background-color: transparent;\n}\n.gn-logo__btn-logo.yc-button_view_flat.yc-button_size_l {\n --yc-button-height: var(--gn-aside-header-item-icon-background-size);\n}\n.gn-logo__logo {\n font-size: var(--g-text-body-2-font-size);\n line-height: var(--g-text-body-2-line-height);\n font-weight: var(--g-text-body-font-weight);\n vertical-align: middle;\n cursor: pointer;\n}\n.gn-logo__logo-link, .gn-logo__logo-link:hover, .gn-logo__logo-link:active, .gn-logo__logo-link:visited, .gn-logo__logo-link:focus {\n text-decoration: none;\n outline: none;\n color: inherit;\n}\n.g-root .gn-logo__btn-logo.button2_theme_flat.button2_hovered_yes::before {\n background-color: transparent;\n}";
|
|
3125
|
+
styleInject(css_248z$m);
|
|
3182
3126
|
|
|
3183
|
-
const b$
|
|
3127
|
+
const b$n = block('logo');
|
|
3184
3128
|
const Logo$1 = ({ text, icon, iconSrc, iconClassName, iconSize = 24, textSize = 15, href, wrapper, onClick, }) => {
|
|
3185
3129
|
const { compact } = useAsideHeaderContext();
|
|
3186
3130
|
const hasWrapper = typeof wrapper === 'function';
|
|
@@ -3192,18 +3136,18 @@ const Logo$1 = ({ text, icon, iconSrc, iconClassName, iconSize = 24, textSize =
|
|
|
3192
3136
|
else if (icon) {
|
|
3193
3137
|
buttonIcon = React__default.createElement(Icon, { data: icon, size: iconSize, className: iconClassName });
|
|
3194
3138
|
}
|
|
3195
|
-
const button = (React__default.createElement(Button, { view: "flat", size: "l", className: b$
|
|
3139
|
+
const button = (React__default.createElement(Button, { view: "flat", size: "l", className: b$n('btn-logo'), component: hasWrapper ? 'span' : undefined, onClick: onClick, target: "_self", href: href }, buttonIcon));
|
|
3196
3140
|
let logo;
|
|
3197
3141
|
if (typeof text === 'function') {
|
|
3198
3142
|
logo = text();
|
|
3199
3143
|
}
|
|
3200
3144
|
else {
|
|
3201
|
-
logo = (React__default.createElement("div", { className: b$
|
|
3145
|
+
logo = (React__default.createElement("div", { className: b$n('logo'), style: { fontSize: textSize } }, text));
|
|
3202
3146
|
}
|
|
3203
|
-
return (React__default.createElement("div", { className: b$
|
|
3204
|
-
React__default.createElement("div", { className: b$
|
|
3147
|
+
return (React__default.createElement("div", { className: b$n() },
|
|
3148
|
+
React__default.createElement("div", { className: b$n('logo-btn-place') }, hasWrapper ? wrapper(button, compact) : button),
|
|
3205
3149
|
!compact &&
|
|
3206
|
-
(hasWrapper ? (React__default.createElement("div", { onClick: onClick }, wrapper(logo, compact))) : (React__default.createElement("a", { href: href !== null && href !== void 0 ? href : '/', target: "_self", className: b$
|
|
3150
|
+
(hasWrapper ? (React__default.createElement("div", { onClick: onClick }, wrapper(logo, compact))) : (React__default.createElement("a", { href: href !== null && href !== void 0 ? href : '/', target: "_self", className: b$n('logo-link'), onClick: onClick }, logo)))));
|
|
3207
3151
|
};
|
|
3208
3152
|
|
|
3209
3153
|
/**
|
|
@@ -3581,7 +3525,6 @@ class AutoSizer extends Component {
|
|
|
3581
3525
|
}
|
|
3582
3526
|
}
|
|
3583
3527
|
|
|
3584
|
-
const ICON_SIZE = 24;
|
|
3585
3528
|
const ITEM_HEIGHT = 40;
|
|
3586
3529
|
const ITEM_TYPE_REGULAR = 'regular';
|
|
3587
3530
|
const COLLAPSE_ITEM_ID = 'collapse-item-id';
|
|
@@ -3680,1358 +3623,1428 @@ function isMenuItem(item) {
|
|
|
3680
3623
|
return (item === null || item === void 0 ? void 0 : item.id) !== undefined;
|
|
3681
3624
|
}
|
|
3682
3625
|
|
|
3683
|
-
|
|
3684
|
-
|
|
3626
|
+
/**
|
|
3627
|
+
* Checks if `value` is the
|
|
3628
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
3629
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
3630
|
+
*
|
|
3631
|
+
* @static
|
|
3632
|
+
* @memberOf _
|
|
3633
|
+
* @since 0.1.0
|
|
3634
|
+
* @category Lang
|
|
3635
|
+
* @param {*} value The value to check.
|
|
3636
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
3637
|
+
* @example
|
|
3638
|
+
*
|
|
3639
|
+
* _.isObject({});
|
|
3640
|
+
* // => true
|
|
3641
|
+
*
|
|
3642
|
+
* _.isObject([1, 2, 3]);
|
|
3643
|
+
* // => true
|
|
3644
|
+
*
|
|
3645
|
+
* _.isObject(_.noop);
|
|
3646
|
+
* // => true
|
|
3647
|
+
*
|
|
3648
|
+
* _.isObject(null);
|
|
3649
|
+
* // => false
|
|
3650
|
+
*/
|
|
3685
3651
|
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
if (item.rightAdornment) {
|
|
3690
|
-
titleNode = (React__default.createElement(React__default.Fragment, null,
|
|
3691
|
-
titleNode,
|
|
3692
|
-
React__default.createElement("div", { className: b$l('title-adornment') }, item.rightAdornment)));
|
|
3693
|
-
}
|
|
3694
|
-
return titleNode;
|
|
3695
|
-
}
|
|
3696
|
-
const defaultPopupPlacement = ['right-end'];
|
|
3697
|
-
const defaultPopupOffset = [-20, 8];
|
|
3698
|
-
const Item$1 = (props) => {
|
|
3699
|
-
const { item, className, collapseItems, onMouseLeave, onMouseEnter, enableTooltip = true, popupVisible = false, popupAnchor, popupPlacement = defaultPopupPlacement, popupOffset = defaultPopupOffset, popupKeepMounted, renderPopupContent, onClosePopup, onItemClick, onItemClickCapture, } = props;
|
|
3700
|
-
const { compact } = useAsideHeaderContext();
|
|
3701
|
-
if (item.type === 'divider') {
|
|
3702
|
-
return React__default.createElement("div", { className: b$l('menu-divider') });
|
|
3703
|
-
}
|
|
3704
|
-
const [open, toggleOpen] = React__default.useState(false);
|
|
3705
|
-
const ref = React__default.useRef(null);
|
|
3706
|
-
const anchorRef = popupAnchor || ref;
|
|
3707
|
-
const type = item.type || ITEM_TYPE_REGULAR;
|
|
3708
|
-
const current = item.current || false;
|
|
3709
|
-
const tooltipText = item.tooltipText || item.title;
|
|
3710
|
-
const icon = item.icon;
|
|
3711
|
-
const iconSize = item.iconSize || ICON_SIZE;
|
|
3712
|
-
const collapsedItem = item.id === COLLAPSE_ITEM_ID;
|
|
3713
|
-
const onClose = React__default.useCallback((event) => {
|
|
3714
|
-
var _a;
|
|
3715
|
-
if (event instanceof MouseEvent &&
|
|
3716
|
-
event.target &&
|
|
3717
|
-
((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
3718
|
-
return;
|
|
3719
|
-
}
|
|
3720
|
-
onClosePopup === null || onClosePopup === void 0 ? void 0 : onClosePopup();
|
|
3721
|
-
}, [onClosePopup]);
|
|
3722
|
-
const makeNode = ({ icon: iconEl, title: titleEl }) => {
|
|
3723
|
-
const createdNode = (React__default.createElement("div", { className: b$l({ type, current, compact }, className), ref: ref, onClick: (event) => {
|
|
3724
|
-
if (collapsedItem) {
|
|
3725
|
-
/**
|
|
3726
|
-
* If we call onItemClick for collapsedItem then:
|
|
3727
|
-
* - User get unexpected item in onItemClick callback
|
|
3728
|
-
* - onClosePanel calls twice for each popuped item, as result it will prevent opening of panelItems
|
|
3729
|
-
*/
|
|
3730
|
-
toggleOpen(!open);
|
|
3731
|
-
}
|
|
3732
|
-
else {
|
|
3733
|
-
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, false, event);
|
|
3734
|
-
}
|
|
3735
|
-
}, onClickCapture: onItemClickCapture, onMouseEnter: () => {
|
|
3736
|
-
if (!compact) {
|
|
3737
|
-
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter();
|
|
3738
|
-
}
|
|
3739
|
-
}, onMouseLeave: () => {
|
|
3740
|
-
if (!compact) {
|
|
3741
|
-
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
|
|
3742
|
-
}
|
|
3743
|
-
} },
|
|
3744
|
-
React__default.createElement("div", { className: b$l('icon-place') }, compact ? (React__default.createElement(Tooltip, { content: tooltipText, disabled: !enableTooltip || (collapsedItem && open) || popupVisible, placement: "right", className: b$l('icon-tooltip', { 'item-type': type }) },
|
|
3745
|
-
React__default.createElement("div", { onMouseEnter: () => onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(), onMouseLeave: () => onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(), className: b$l('btn-icon') }, iconEl))) : (iconEl)),
|
|
3746
|
-
React__default.createElement("div", { className: b$l('title'), title: typeof item.title === 'string' ? item.title : undefined }, titleEl),
|
|
3747
|
-
renderPopupContent && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { contentClassName: b$l('popup'), open: popupVisible, keepMounted: popupKeepMounted, placement: popupPlacement, offset: popupOffset, anchorRef: anchorRef, onClose: onClose }, renderPopupContent()))));
|
|
3748
|
-
return item.link ? (React__default.createElement("a", { href: item.link, className: b$l('link') }, createdNode)) : (createdNode);
|
|
3749
|
-
};
|
|
3750
|
-
const iconNode = icon ? React__default.createElement(Icon, { data: icon, size: iconSize, className: b$l('icon') }) : null;
|
|
3751
|
-
const titleNode = renderItemTitle(item);
|
|
3752
|
-
const params = { icon: iconNode, title: titleNode };
|
|
3753
|
-
let node;
|
|
3754
|
-
const opts = { compact, collapsed: false, item, ref };
|
|
3755
|
-
if (typeof item.itemWrapper === 'function') {
|
|
3756
|
-
node = item.itemWrapper(params, makeNode, opts);
|
|
3757
|
-
}
|
|
3758
|
-
else {
|
|
3759
|
-
node = makeNode(params);
|
|
3760
|
-
}
|
|
3761
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
3762
|
-
node,
|
|
3763
|
-
open && collapsedItem && (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(CollapsedPopup, Object.assign({}, props, { anchorRef: ref, onClose: () => toggleOpen(false) })))));
|
|
3764
|
-
};
|
|
3765
|
-
Item$1.displayName = 'Item';
|
|
3766
|
-
function CollapsedPopup({ onItemClick, collapseItems, anchorRef, onClose, }) {
|
|
3767
|
-
const { compact } = useAsideHeaderContext();
|
|
3768
|
-
return (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) ? (React__default.createElement(Popup, { placement: POPUP_PLACEMENT, open: true, anchorRef: anchorRef, onClose: onClose },
|
|
3769
|
-
React__default.createElement("div", { className: b$l('collapse-items-popup-content') },
|
|
3770
|
-
React__default.createElement(List, { itemClassName: b$l('root-collapse-item'), items: collapseItems, selectedItemIndex: getSelectedItemIndex$1(collapseItems), itemHeight: POPUP_ITEM_HEIGHT, itemsHeight: collapseItems.length * POPUP_ITEM_HEIGHT, virtualized: false, filterable: false, sortable: false, renderItem: (collapseItem) => {
|
|
3771
|
-
const makeCollapseNode = ({ title: titleEl }) => {
|
|
3772
|
-
const res = (React__default.createElement("div", { className: b$l('collapse-item'), onClick: (event) => {
|
|
3773
|
-
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(collapseItem, true, event);
|
|
3774
|
-
} }, titleEl));
|
|
3775
|
-
return collapseItem.link ? (React__default.createElement("a", { href: collapseItem.link, className: b$l('link') }, res)) : (res);
|
|
3776
|
-
};
|
|
3777
|
-
const titleNode = renderItemTitle(collapseItem);
|
|
3778
|
-
const params = { title: titleNode };
|
|
3779
|
-
const opts = { compact, collapsed: true, item: collapseItem, ref: anchorRef };
|
|
3780
|
-
if (typeof collapseItem.itemWrapper === 'function') {
|
|
3781
|
-
return collapseItem.itemWrapper(params, makeCollapseNode, opts);
|
|
3782
|
-
}
|
|
3783
|
-
else {
|
|
3784
|
-
return makeCollapseNode(params);
|
|
3785
|
-
}
|
|
3786
|
-
} })))) : null;
|
|
3652
|
+
function isObject$2(value) {
|
|
3653
|
+
var type = typeof value;
|
|
3654
|
+
return value != null && (type == 'object' || type == 'function');
|
|
3787
3655
|
}
|
|
3788
3656
|
|
|
3789
|
-
|
|
3790
|
-
active: false,
|
|
3791
|
-
activeIndex: undefined,
|
|
3792
|
-
hideCollapseItemTooltip: false,
|
|
3793
|
-
lastClickedItemIndex: undefined,
|
|
3794
|
-
setValue: () => { },
|
|
3795
|
-
};
|
|
3796
|
-
const MultipleTooltipContext = React__default.createContext(multipleTooltipContextDefaults);
|
|
3797
|
-
class MultipleTooltipProvider extends React__default.PureComponent {
|
|
3798
|
-
constructor() {
|
|
3799
|
-
super(...arguments);
|
|
3800
|
-
this.state = Object.assign({}, multipleTooltipContextDefaults);
|
|
3801
|
-
this.setValue = (value) => {
|
|
3802
|
-
this.setState(Object.assign({}, value));
|
|
3803
|
-
};
|
|
3804
|
-
}
|
|
3805
|
-
render() {
|
|
3806
|
-
const { children } = this.props;
|
|
3807
|
-
return (React__default.createElement(MultipleTooltipContext.Provider, { value: Object.assign(Object.assign({}, this.state), { setValue: this.setValue }) }, children));
|
|
3808
|
-
}
|
|
3809
|
-
}
|
|
3657
|
+
var isObject_1 = isObject$2;
|
|
3810
3658
|
|
|
3811
|
-
|
|
3812
|
-
styleInject(css_248z$j);
|
|
3659
|
+
/** Detect free variable `global` from Node.js. */
|
|
3813
3660
|
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3661
|
+
var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
3662
|
+
|
|
3663
|
+
var _freeGlobal = freeGlobal$1;
|
|
3664
|
+
|
|
3665
|
+
var freeGlobal = _freeGlobal;
|
|
3666
|
+
|
|
3667
|
+
/** Detect free variable `self`. */
|
|
3668
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
3669
|
+
|
|
3670
|
+
/** Used as a reference to the global object. */
|
|
3671
|
+
var root$2 = freeGlobal || freeSelf || Function('return this')();
|
|
3672
|
+
|
|
3673
|
+
var _root = root$2;
|
|
3674
|
+
|
|
3675
|
+
var root$1 = _root;
|
|
3676
|
+
|
|
3677
|
+
/**
|
|
3678
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
3679
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
3680
|
+
*
|
|
3681
|
+
* @static
|
|
3682
|
+
* @memberOf _
|
|
3683
|
+
* @since 2.4.0
|
|
3684
|
+
* @category Date
|
|
3685
|
+
* @returns {number} Returns the timestamp.
|
|
3686
|
+
* @example
|
|
3687
|
+
*
|
|
3688
|
+
* _.defer(function(stamp) {
|
|
3689
|
+
* console.log(_.now() - stamp);
|
|
3690
|
+
* }, _.now());
|
|
3691
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
3692
|
+
*/
|
|
3693
|
+
var now$1 = function() {
|
|
3694
|
+
return root$1.Date.now();
|
|
3839
3695
|
};
|
|
3840
3696
|
|
|
3841
|
-
var
|
|
3842
|
-
styleInject(css_248z$i);
|
|
3697
|
+
var now_1 = now$1;
|
|
3843
3698
|
|
|
3844
|
-
|
|
3845
|
-
const CompositeBarView = ({ type, items, onItemClick, collapseItems, multipleTooltip = false, }) => {
|
|
3846
|
-
const ref = useRef(null);
|
|
3847
|
-
const tooltipRef = useRef(null);
|
|
3848
|
-
const { setValue: setMultipleTooltipContextValue, active: multipleTooltipActive, activeIndex, lastClickedItemIndex, } = useContext(MultipleTooltipContext);
|
|
3849
|
-
const { compact } = useAsideHeaderContext();
|
|
3850
|
-
const onTooltipMouseEnter = useCallback((e) => {
|
|
3851
|
-
if (!multipleTooltipActive &&
|
|
3852
|
-
activeIndex !== lastClickedItemIndex &&
|
|
3853
|
-
e.clientX <= ASIDE_HEADER_COMPACT_WIDTH) {
|
|
3854
|
-
setMultipleTooltipContextValue === null || setMultipleTooltipContextValue === void 0 ? void 0 : setMultipleTooltipContextValue({
|
|
3855
|
-
active: true,
|
|
3856
|
-
});
|
|
3857
|
-
}
|
|
3858
|
-
}, [multipleTooltipActive, activeIndex, lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
3859
|
-
const onTooltipMouseLeave = useCallback(() => {
|
|
3860
|
-
if (multipleTooltipActive) {
|
|
3861
|
-
setMultipleTooltipContextValue === null || setMultipleTooltipContextValue === void 0 ? void 0 : setMultipleTooltipContextValue({
|
|
3862
|
-
active: false,
|
|
3863
|
-
lastClickedItemIndex: undefined,
|
|
3864
|
-
});
|
|
3865
|
-
}
|
|
3866
|
-
}, [multipleTooltipActive, setMultipleTooltipContextValue]);
|
|
3867
|
-
const onMouseEnterByIndex = useCallback((itemIndex) => () => {
|
|
3868
|
-
if (multipleTooltip) {
|
|
3869
|
-
let multipleTooltipActiveValue = multipleTooltipActive;
|
|
3870
|
-
if (!multipleTooltipActive && itemIndex !== lastClickedItemIndex) {
|
|
3871
|
-
multipleTooltipActiveValue = true;
|
|
3872
|
-
}
|
|
3873
|
-
if (activeIndex === itemIndex &&
|
|
3874
|
-
multipleTooltipActive === multipleTooltipActiveValue) {
|
|
3875
|
-
return;
|
|
3876
|
-
}
|
|
3877
|
-
setMultipleTooltipContextValue({
|
|
3878
|
-
activeIndex: itemIndex,
|
|
3879
|
-
active: multipleTooltipActiveValue,
|
|
3880
|
-
});
|
|
3881
|
-
}
|
|
3882
|
-
}, [multipleTooltipActive, activeIndex, lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
3883
|
-
const onMouseLeave = useCallback(() => {
|
|
3884
|
-
var _a;
|
|
3885
|
-
if (compact) {
|
|
3886
|
-
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.activateItem(undefined);
|
|
3887
|
-
if (multipleTooltip &&
|
|
3888
|
-
(activeIndex !== undefined || lastClickedItemIndex !== undefined)) {
|
|
3889
|
-
setMultipleTooltipContextValue({
|
|
3890
|
-
activeIndex: undefined,
|
|
3891
|
-
lastClickedItemIndex: undefined,
|
|
3892
|
-
});
|
|
3893
|
-
}
|
|
3894
|
-
}
|
|
3895
|
-
}, [activeIndex, lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
3896
|
-
const onItemClickByIndex = useCallback((itemIndex) => (item, collapsed, event) => {
|
|
3897
|
-
if (compact &&
|
|
3898
|
-
multipleTooltip &&
|
|
3899
|
-
itemIndex !== lastClickedItemIndex &&
|
|
3900
|
-
item.id !== COLLAPSE_ITEM_ID) {
|
|
3901
|
-
setMultipleTooltipContextValue({
|
|
3902
|
-
lastClickedItemIndex: itemIndex,
|
|
3903
|
-
active: false,
|
|
3904
|
-
});
|
|
3905
|
-
}
|
|
3906
|
-
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, collapsed, event);
|
|
3907
|
-
}, [lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
3908
|
-
return (React__default.createElement(React__default.Fragment, null,
|
|
3909
|
-
React__default.createElement("div", { ref: tooltipRef, onMouseEnter: onTooltipMouseEnter, onMouseLeave: onTooltipMouseLeave },
|
|
3910
|
-
React__default.createElement(List, { ref: ref, items: items, selectedItemIndex: type === 'menu' ? getSelectedItemIndex$1(items) : undefined, itemHeight: getItemHeight$1, itemsHeight: getItemsHeight, itemClassName: b$j('root-menu-item'), virtualized: false, filterable: false, sortable: false, renderItem: (item, _isItemActive, itemIndex) => {
|
|
3911
|
-
const itemExtraProps = isMenuItem(item) ? { item } : item;
|
|
3912
|
-
const enableTooltip = isMenuItem(item)
|
|
3913
|
-
? !multipleTooltip
|
|
3914
|
-
: item.enableTooltip;
|
|
3915
|
-
return (React__default.createElement(Item$1, Object.assign({}, itemExtraProps, { enableTooltip: enableTooltip, onMouseEnter: onMouseEnterByIndex(itemIndex), onMouseLeave: onMouseLeave, onItemClick: onItemClickByIndex(itemIndex), collapseItems: collapseItems })));
|
|
3916
|
-
} })),
|
|
3917
|
-
type === 'menu' && (React__default.createElement(MultipleTooltip, { open: compact && multipleTooltip && multipleTooltipActive, anchorRef: tooltipRef, placement: ['right-start'], items: items }))));
|
|
3918
|
-
};
|
|
3919
|
-
const CompositeBar = ({ type, items, menuMoreTitle, onItemClick, multipleTooltip = false, }) => {
|
|
3920
|
-
if (items.length === 0) {
|
|
3921
|
-
return null;
|
|
3922
|
-
}
|
|
3923
|
-
let node;
|
|
3924
|
-
if (type === 'menu') {
|
|
3925
|
-
const minHeight = getItemsMinHeight(items);
|
|
3926
|
-
const collapseItem = getMoreButtonItem(menuMoreTitle);
|
|
3927
|
-
node = (React__default.createElement("div", { className: b$j({ autosizer: true }), style: { minHeight } }, items.length !== 0 && (React__default.createElement(AutoSizer, null, ({ width, height }) => {
|
|
3928
|
-
const { listItems, collapseItems } = getAutosizeListItems(items, height, collapseItem);
|
|
3929
|
-
return (React__default.createElement("div", { style: { width, height } },
|
|
3930
|
-
React__default.createElement(CompositeBarView, { type: "menu", items: listItems, onItemClick: onItemClick, collapseItems: collapseItems, multipleTooltip: multipleTooltip })));
|
|
3931
|
-
}))));
|
|
3932
|
-
}
|
|
3933
|
-
else {
|
|
3934
|
-
node = (React__default.createElement("div", { className: b$j() },
|
|
3935
|
-
React__default.createElement(CompositeBarView, { type: "subheader", items: items, onItemClick: onItemClick })));
|
|
3936
|
-
}
|
|
3937
|
-
return React__default.createElement(MultipleTooltipProvider, null, node);
|
|
3938
|
-
};
|
|
3699
|
+
/** Used to match a single whitespace character. */
|
|
3939
3700
|
|
|
3940
|
-
|
|
3941
|
-
const RenderContent = React__default.memo(({ renderContent, size }) => {
|
|
3942
|
-
return React__default.createElement(React__default.Fragment, null, renderContent({ size }));
|
|
3943
|
-
});
|
|
3944
|
-
RenderContent.displayName = 'RenderContent';
|
|
3945
|
-
const Content = ({ size, // TODO: move to context when MobileHeader will support it
|
|
3946
|
-
className, cssSizeVariableName = '--aside-header-size', renderContent, }) => {
|
|
3947
|
-
return (React__default.createElement("div", { className: className, style: Object.assign({}, { [cssSizeVariableName]: `${size}px` }) }, typeof renderContent === 'function' && (React__default.createElement(RenderContent, { size: size, renderContent: renderContent }))));
|
|
3948
|
-
};
|
|
3701
|
+
var reWhitespace = /\s/;
|
|
3949
3702
|
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3703
|
+
/**
|
|
3704
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
3705
|
+
* character of `string`.
|
|
3706
|
+
*
|
|
3707
|
+
* @private
|
|
3708
|
+
* @param {string} string The string to inspect.
|
|
3709
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
3710
|
+
*/
|
|
3711
|
+
function trimmedEndIndex$1(string) {
|
|
3712
|
+
var index = string.length;
|
|
3713
|
+
|
|
3714
|
+
while (index-- && reWhitespace.test(string.charAt(index))) {}
|
|
3715
|
+
return index;
|
|
3954
3716
|
}
|
|
3955
3717
|
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
if (lastIndex < keyValue.length) {
|
|
3975
|
-
result += keyValue.slice(lastIndex);
|
|
3976
|
-
}
|
|
3977
|
-
return result;
|
|
3718
|
+
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
3719
|
+
|
|
3720
|
+
var trimmedEndIndex = _trimmedEndIndex;
|
|
3721
|
+
|
|
3722
|
+
/** Used to match leading whitespace. */
|
|
3723
|
+
var reTrimStart = /^\s+/;
|
|
3724
|
+
|
|
3725
|
+
/**
|
|
3726
|
+
* The base implementation of `_.trim`.
|
|
3727
|
+
*
|
|
3728
|
+
* @private
|
|
3729
|
+
* @param {string} string The string to trim.
|
|
3730
|
+
* @returns {string} Returns the trimmed string.
|
|
3731
|
+
*/
|
|
3732
|
+
function baseTrim$1(string) {
|
|
3733
|
+
return string
|
|
3734
|
+
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
|
|
3735
|
+
: string;
|
|
3978
3736
|
}
|
|
3979
3737
|
|
|
3980
|
-
var
|
|
3981
|
-
(function (PluralForm) {
|
|
3982
|
-
PluralForm[PluralForm["One"] = 0] = "One";
|
|
3983
|
-
PluralForm[PluralForm["Few"] = 1] = "Few";
|
|
3984
|
-
PluralForm[PluralForm["Many"] = 2] = "Many";
|
|
3985
|
-
PluralForm[PluralForm["None"] = 3] = "None";
|
|
3986
|
-
})(PluralForm || (PluralForm = {}));
|
|
3738
|
+
var _baseTrim = baseTrim$1;
|
|
3987
3739
|
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3740
|
+
var root = _root;
|
|
3741
|
+
|
|
3742
|
+
/** Built-in value references. */
|
|
3743
|
+
var Symbol$3 = root.Symbol;
|
|
3744
|
+
|
|
3745
|
+
var _Symbol = Symbol$3;
|
|
3746
|
+
|
|
3747
|
+
var Symbol$2 = _Symbol;
|
|
3748
|
+
|
|
3749
|
+
/** Used for built-in method references. */
|
|
3750
|
+
var objectProto$1 = Object.prototype;
|
|
3751
|
+
|
|
3752
|
+
/** Used to check objects for own properties. */
|
|
3753
|
+
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
3754
|
+
|
|
3755
|
+
/**
|
|
3756
|
+
* Used to resolve the
|
|
3757
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
3758
|
+
* of values.
|
|
3759
|
+
*/
|
|
3760
|
+
var nativeObjectToString$1 = objectProto$1.toString;
|
|
3761
|
+
|
|
3762
|
+
/** Built-in value references. */
|
|
3763
|
+
var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
|
|
3764
|
+
|
|
3765
|
+
/**
|
|
3766
|
+
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
|
|
3767
|
+
*
|
|
3768
|
+
* @private
|
|
3769
|
+
* @param {*} value The value to query.
|
|
3770
|
+
* @returns {string} Returns the raw `toStringTag`.
|
|
3771
|
+
*/
|
|
3772
|
+
function getRawTag$1(value) {
|
|
3773
|
+
var isOwn = hasOwnProperty.call(value, symToStringTag$1),
|
|
3774
|
+
tag = value[symToStringTag$1];
|
|
3775
|
+
|
|
3776
|
+
try {
|
|
3777
|
+
value[symToStringTag$1] = undefined;
|
|
3778
|
+
var unmasked = true;
|
|
3779
|
+
} catch (e) {}
|
|
3780
|
+
|
|
3781
|
+
var result = nativeObjectToString$1.call(value);
|
|
3782
|
+
if (unmasked) {
|
|
3783
|
+
if (isOwn) {
|
|
3784
|
+
value[symToStringTag$1] = tag;
|
|
3785
|
+
} else {
|
|
3786
|
+
delete value[symToStringTag$1];
|
|
3994
3787
|
}
|
|
3995
|
-
|
|
3788
|
+
}
|
|
3789
|
+
return result;
|
|
3996
3790
|
}
|
|
3997
3791
|
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
3792
|
+
var _getRawTag = getRawTag$1;
|
|
3793
|
+
|
|
3794
|
+
/** Used for built-in method references. */
|
|
3795
|
+
|
|
3796
|
+
var objectProto = Object.prototype;
|
|
3797
|
+
|
|
3798
|
+
/**
|
|
3799
|
+
* Used to resolve the
|
|
3800
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
3801
|
+
* of values.
|
|
3802
|
+
*/
|
|
3803
|
+
var nativeObjectToString = objectProto.toString;
|
|
3804
|
+
|
|
3805
|
+
/**
|
|
3806
|
+
* Converts `value` to a string using `Object.prototype.toString`.
|
|
3807
|
+
*
|
|
3808
|
+
* @private
|
|
3809
|
+
* @param {*} value The value to convert.
|
|
3810
|
+
* @returns {string} Returns the converted string.
|
|
3811
|
+
*/
|
|
3812
|
+
function objectToString$1(value) {
|
|
3813
|
+
return nativeObjectToString.call(value);
|
|
4012
3814
|
}
|
|
4013
3815
|
|
|
4014
|
-
|
|
4015
|
-
constructor(options) {
|
|
4016
|
-
this.data = {};
|
|
4017
|
-
this.lang = undefined;
|
|
4018
|
-
this.pluralizers = {
|
|
4019
|
-
en: pluralizerEn,
|
|
4020
|
-
ru: pluralizerRu,
|
|
4021
|
-
};
|
|
4022
|
-
this.logger = null;
|
|
4023
|
-
this.logger = (options === null || options === void 0 ? void 0 : options.logger) || null;
|
|
4024
|
-
}
|
|
4025
|
-
setLang(lang) {
|
|
4026
|
-
this.lang = lang;
|
|
4027
|
-
}
|
|
4028
|
-
configurePluralization(pluralizers) {
|
|
4029
|
-
this.pluralizers = Object.assign({}, this.pluralizers, pluralizers);
|
|
4030
|
-
}
|
|
4031
|
-
registerKeyset(lang, keysetName, data = {}) {
|
|
4032
|
-
if (this.data[lang] && Object.prototype.hasOwnProperty.call(this.data[lang], keysetName)) {
|
|
4033
|
-
throw new Error(`Keyset '${keysetName}' is already registered, aborting!`);
|
|
4034
|
-
}
|
|
4035
|
-
this.data[lang] = Object.assign({}, this.data[lang], { [keysetName]: data });
|
|
4036
|
-
}
|
|
4037
|
-
registerKeysets(lang, data) {
|
|
4038
|
-
Object.keys(data).forEach((keysetName) => {
|
|
4039
|
-
this.registerKeyset(lang, keysetName, data[keysetName]);
|
|
4040
|
-
});
|
|
4041
|
-
}
|
|
4042
|
-
has(keysetName, key, lang) {
|
|
4043
|
-
const languageData = this.getLanguageData(lang);
|
|
4044
|
-
return Boolean(languageData && languageData[keysetName] && languageData[keysetName][key]);
|
|
4045
|
-
}
|
|
4046
|
-
i18n(keysetName, key, params) {
|
|
4047
|
-
const languageData = this.getLanguageData(this.lang);
|
|
4048
|
-
if (typeof languageData === 'undefined') {
|
|
4049
|
-
throw new Error(`Language '${this.lang}' is not defined, make sure you call setLang for the same language you called registerKeysets for!`);
|
|
4050
|
-
}
|
|
4051
|
-
if (Object.keys(languageData).length === 0) {
|
|
4052
|
-
this.warn('Language data is empty.');
|
|
4053
|
-
return key;
|
|
4054
|
-
}
|
|
4055
|
-
const keyset = languageData[keysetName];
|
|
4056
|
-
if (!keyset) {
|
|
4057
|
-
this.warn('Keyset not found.', keysetName);
|
|
4058
|
-
return key;
|
|
4059
|
-
}
|
|
4060
|
-
if (Object.keys(keyset).length === 0) {
|
|
4061
|
-
this.warn('Keyset is empty.', keysetName);
|
|
4062
|
-
return key;
|
|
4063
|
-
}
|
|
4064
|
-
const keyValue = keyset && keyset[key];
|
|
4065
|
-
let result;
|
|
4066
|
-
if (typeof keyValue === 'undefined') {
|
|
4067
|
-
this.warn('Missing key.', keysetName, key);
|
|
4068
|
-
return key;
|
|
4069
|
-
}
|
|
4070
|
-
if (Array.isArray(keyValue)) {
|
|
4071
|
-
if (keyValue.length < 3) {
|
|
4072
|
-
this.warn('Missing required plurals', keysetName, key);
|
|
4073
|
-
return key;
|
|
4074
|
-
}
|
|
4075
|
-
const count = Number(params === null || params === void 0 ? void 0 : params.count);
|
|
4076
|
-
if (Number.isNaN(count)) {
|
|
4077
|
-
this.warn('Missing params.count for key.', keysetName, key);
|
|
4078
|
-
return key;
|
|
4079
|
-
}
|
|
4080
|
-
const pluralizer = this.getLanguagePluralizer(this.lang);
|
|
4081
|
-
result = keyValue[pluralizer(count, PluralForm)] || keyValue[PluralForm.Many];
|
|
4082
|
-
if (keyValue[PluralForm.None] === undefined) {
|
|
4083
|
-
this.warn('Missing key for 0', keysetName, key);
|
|
4084
|
-
}
|
|
4085
|
-
}
|
|
4086
|
-
else {
|
|
4087
|
-
result = keyValue;
|
|
4088
|
-
}
|
|
4089
|
-
if (params) {
|
|
4090
|
-
result = replaceParams(result, params);
|
|
4091
|
-
}
|
|
4092
|
-
return result;
|
|
4093
|
-
}
|
|
4094
|
-
keyset(keysetName) {
|
|
4095
|
-
return (key, params) => {
|
|
4096
|
-
return this.i18n(keysetName, key, params);
|
|
4097
|
-
};
|
|
4098
|
-
}
|
|
4099
|
-
warn(msg, keyset, key) {
|
|
4100
|
-
var _a;
|
|
4101
|
-
let cacheKey = '';
|
|
4102
|
-
if (keyset) {
|
|
4103
|
-
cacheKey += keyset;
|
|
4104
|
-
if (key) {
|
|
4105
|
-
cacheKey += `.${key}`;
|
|
4106
|
-
}
|
|
4107
|
-
}
|
|
4108
|
-
else {
|
|
4109
|
-
cacheKey = 'languageData';
|
|
4110
|
-
}
|
|
4111
|
-
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(`I18n: ${msg}`, {
|
|
4112
|
-
level: 'info',
|
|
4113
|
-
logger: cacheKey,
|
|
4114
|
-
extra: {
|
|
4115
|
-
type: 'i18n'
|
|
4116
|
-
}
|
|
4117
|
-
});
|
|
4118
|
-
}
|
|
4119
|
-
getLanguageData(lang) {
|
|
4120
|
-
const langCode = lang || this.lang;
|
|
4121
|
-
return langCode ? this.data[langCode] : undefined;
|
|
4122
|
-
}
|
|
4123
|
-
getLanguagePluralizer(lang) {
|
|
4124
|
-
const pluralizer = lang ? this.pluralizers[lang] : undefined;
|
|
4125
|
-
if (!pluralizer) {
|
|
4126
|
-
this.warn(`Pluralization is not configured for language '${lang}', falling back to the english ruleset`);
|
|
4127
|
-
}
|
|
4128
|
-
return pluralizer || pluralizerEn;
|
|
4129
|
-
}
|
|
4130
|
-
}
|
|
3816
|
+
var _objectToString = objectToString$1;
|
|
4131
3817
|
|
|
4132
|
-
var
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
Lang["En"] = "en";
|
|
4136
|
-
})(Lang || (Lang = {}));
|
|
4137
|
-
let subs = [];
|
|
4138
|
-
const config = {
|
|
4139
|
-
lang: Lang.En,
|
|
4140
|
-
};
|
|
4141
|
-
const configure = (newConfig) => {
|
|
4142
|
-
Object.assign(config, newConfig);
|
|
4143
|
-
subs.forEach((sub) => {
|
|
4144
|
-
sub(config);
|
|
4145
|
-
});
|
|
4146
|
-
};
|
|
4147
|
-
const subscribeConfigure = (sub) => {
|
|
4148
|
-
subs.push(sub);
|
|
4149
|
-
return () => {
|
|
4150
|
-
subs = subs.filter((item) => item !== sub);
|
|
4151
|
-
};
|
|
4152
|
-
};
|
|
4153
|
-
const getConfig = () => config;
|
|
3818
|
+
var Symbol$1 = _Symbol,
|
|
3819
|
+
getRawTag = _getRawTag,
|
|
3820
|
+
objectToString = _objectToString;
|
|
4154
3821
|
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
i18n$4.setLang(config.lang);
|
|
4159
|
-
});
|
|
3822
|
+
/** `Object#toString` result references. */
|
|
3823
|
+
var nullTag = '[object Null]',
|
|
3824
|
+
undefinedTag = '[object Undefined]';
|
|
4160
3825
|
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
3826
|
+
/** Built-in value references. */
|
|
3827
|
+
var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
|
|
3828
|
+
|
|
3829
|
+
/**
|
|
3830
|
+
* The base implementation of `getTag` without fallbacks for buggy environments.
|
|
3831
|
+
*
|
|
3832
|
+
* @private
|
|
3833
|
+
* @param {*} value The value to query.
|
|
3834
|
+
* @returns {string} Returns the `toStringTag`.
|
|
3835
|
+
*/
|
|
3836
|
+
function baseGetTag$1(value) {
|
|
3837
|
+
if (value == null) {
|
|
3838
|
+
return value === undefined ? undefinedTag : nullTag;
|
|
3839
|
+
}
|
|
3840
|
+
return (symToStringTag && symToStringTag in Object(value))
|
|
3841
|
+
? getRawTag(value)
|
|
3842
|
+
: objectToString(value);
|
|
4164
3843
|
}
|
|
4165
3844
|
|
|
4166
|
-
var
|
|
4167
|
-
var button_expand$1 = "Expand";
|
|
4168
|
-
var label_more$1 = "More";
|
|
4169
|
-
var en$3 = {
|
|
4170
|
-
button_collapse: button_collapse$1,
|
|
4171
|
-
button_expand: button_expand$1,
|
|
4172
|
-
label_more: label_more$1
|
|
4173
|
-
};
|
|
3845
|
+
var _baseGetTag = baseGetTag$1;
|
|
4174
3846
|
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
3847
|
+
/**
|
|
3848
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
3849
|
+
* and has a `typeof` result of "object".
|
|
3850
|
+
*
|
|
3851
|
+
* @static
|
|
3852
|
+
* @memberOf _
|
|
3853
|
+
* @since 4.0.0
|
|
3854
|
+
* @category Lang
|
|
3855
|
+
* @param {*} value The value to check.
|
|
3856
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
3857
|
+
* @example
|
|
3858
|
+
*
|
|
3859
|
+
* _.isObjectLike({});
|
|
3860
|
+
* // => true
|
|
3861
|
+
*
|
|
3862
|
+
* _.isObjectLike([1, 2, 3]);
|
|
3863
|
+
* // => true
|
|
3864
|
+
*
|
|
3865
|
+
* _.isObjectLike(_.noop);
|
|
3866
|
+
* // => false
|
|
3867
|
+
*
|
|
3868
|
+
* _.isObjectLike(null);
|
|
3869
|
+
* // => false
|
|
3870
|
+
*/
|
|
4183
3871
|
|
|
4184
|
-
|
|
4185
|
-
|
|
3872
|
+
function isObjectLike$1(value) {
|
|
3873
|
+
return value != null && typeof value == 'object';
|
|
3874
|
+
}
|
|
4186
3875
|
|
|
4187
|
-
var
|
|
4188
|
-
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
4189
|
-
var SvgControlMenuButton = function SvgControlMenuButton(props) {
|
|
4190
|
-
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
4191
|
-
width: 8,
|
|
4192
|
-
height: 8,
|
|
4193
|
-
viewBox: "0 0 8 8",
|
|
4194
|
-
fill: "currentColor",
|
|
4195
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
4196
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
4197
|
-
d: "m.72 7.64 6.39-3.2a.5.5 0 0 0 0-.89L.72.36A.5.5 0 0 0 0 .81v6.38c0 .37.4.61.72.45Z"
|
|
4198
|
-
})));
|
|
4199
|
-
};
|
|
4200
|
-
var controlMenuButtonIcon = SvgControlMenuButton;
|
|
3876
|
+
var isObjectLike_1 = isObjectLike$1;
|
|
4201
3877
|
|
|
4202
|
-
var
|
|
4203
|
-
|
|
4204
|
-
var SvgDividerCollapsed = function SvgDividerCollapsed(props) {
|
|
4205
|
-
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
4206
|
-
width: 56,
|
|
4207
|
-
height: 29,
|
|
4208
|
-
viewBox: "0 0 56 29",
|
|
4209
|
-
fill: "currentColor",
|
|
4210
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
4211
|
-
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
4212
|
-
d: "M56 0v29c-.8-1-7-6.1-17.7-8.4L13 15.7A16 16 0 0 1 0 0Z"
|
|
4213
|
-
})));
|
|
4214
|
-
};
|
|
4215
|
-
var headerDividerCollapsedIcon = SvgDividerCollapsed;
|
|
3878
|
+
var baseGetTag = _baseGetTag,
|
|
3879
|
+
isObjectLike = isObjectLike_1;
|
|
4216
3880
|
|
|
4217
|
-
|
|
4218
|
-
|
|
3881
|
+
/** `Object#toString` result references. */
|
|
3882
|
+
var symbolTag = '[object Symbol]';
|
|
4219
3883
|
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4230
|
-
|
|
4231
|
-
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
return (React__default.createElement(Content, { size: size, renderContent: this.props.renderContent, className: b$i('content') }));
|
|
4241
|
-
};
|
|
4242
|
-
this.renderLogo = () => React__default.createElement(Logo$1, Object.assign({}, this.props.logo, { onClick: this.onLogoClick }));
|
|
4243
|
-
this.renderHeader = () => (React__default.createElement("div", { className: b$i('header', { ['with-decoration']: this.props.headerDecoration }) },
|
|
4244
|
-
this.renderLogo(),
|
|
4245
|
-
React__default.createElement(CompositeBar, { type: "subheader", items: this.props.subheaderItems, onItemClick: this.onItemClick }),
|
|
4246
|
-
React__default.createElement(Icon, { data: headerDividerCollapsedIcon, className: b$i('header-divider'), width: ASIDE_HEADER_COMPACT_WIDTH, height: "29" })));
|
|
4247
|
-
this.renderFooter = (size) => {
|
|
4248
|
-
const { renderFooter, compact } = this.props;
|
|
4249
|
-
return (React__default.createElement("div", { className: b$i('footer') }, renderFooter === null || renderFooter === void 0 ? void 0 : renderFooter({
|
|
4250
|
-
size,
|
|
4251
|
-
compact,
|
|
4252
|
-
asideRef: this.asideRef,
|
|
4253
|
-
})));
|
|
4254
|
-
};
|
|
4255
|
-
this.renderPanels = (size) => {
|
|
4256
|
-
const { panelItems } = this.props;
|
|
4257
|
-
return (React__default.createElement(Drawer, { className: b$i('panels'), onVeilClick: this.onCloseDrawer, onEscape: this.onCloseDrawer, style: { left: size } }, panelItems.map((item) => (React__default.createElement(DrawerItem, Object.assign({ key: item.id }, item))))));
|
|
4258
|
-
};
|
|
4259
|
-
this.renderCollapseButton = () => {
|
|
4260
|
-
const { expandTitle, collapseTitle, compact } = this.props;
|
|
4261
|
-
const buttonTitle = compact
|
|
4262
|
-
? expandTitle || i18n$3('button_expand')
|
|
4263
|
-
: collapseTitle || i18n$3('button_collapse');
|
|
4264
|
-
return (React__default.createElement(Button, { className: b$i('collapse-button', { compact }), view: "flat", onClick: this.onCollapseButtonClick, title: buttonTitle },
|
|
4265
|
-
React__default.createElement(NotIcon, { data: controlMenuButtonIcon, className: b$i('collapse-icon'), width: "16", height: "10" })));
|
|
4266
|
-
};
|
|
4267
|
-
this.onCollapseButtonClick = () => {
|
|
4268
|
-
var _a, _b;
|
|
4269
|
-
(_b = (_a = this.props).onChangeCompact) === null || _b === void 0 ? void 0 : _b.call(_a, !this.props.compact);
|
|
4270
|
-
};
|
|
4271
|
-
this.onCloseDrawer = () => {
|
|
4272
|
-
var _a, _b;
|
|
4273
|
-
(_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4274
|
-
};
|
|
4275
|
-
this.onItemClick = (item, collapsed, event) => {
|
|
4276
|
-
var _a, _b, _c;
|
|
4277
|
-
(_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4278
|
-
(_c = item.onItemClick) === null || _c === void 0 ? void 0 : _c.call(item, item, collapsed, event);
|
|
4279
|
-
};
|
|
4280
|
-
this.onLogoClick = (event) => {
|
|
4281
|
-
var _a, _b, _c, _d;
|
|
4282
|
-
(_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4283
|
-
(_d = (_c = this.props.logo).onClick) === null || _d === void 0 ? void 0 : _d.call(_c, event);
|
|
4284
|
-
};
|
|
4285
|
-
}
|
|
4286
|
-
render() {
|
|
4287
|
-
const { className, compact } = this.props;
|
|
4288
|
-
const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
|
|
4289
|
-
return (React__default.createElement(AsideHeaderContextProvider, { value: { compact, size } },
|
|
4290
|
-
React__default.createElement("div", { className: b$i({ compact }, className) },
|
|
4291
|
-
React__default.createElement("div", { className: b$i('pane-container') },
|
|
4292
|
-
this.renderFirstPane(size),
|
|
4293
|
-
this.renderSecondPane(size)))));
|
|
4294
|
-
}
|
|
4295
|
-
}
|
|
4296
|
-
AsideHeader.defaultProps = {
|
|
4297
|
-
panelItems: [],
|
|
4298
|
-
subheaderItems: [],
|
|
4299
|
-
menuItems: [],
|
|
4300
|
-
headerDecoration: true,
|
|
4301
|
-
};
|
|
4302
|
-
|
|
4303
|
-
/******************************************************************************
|
|
4304
|
-
Copyright (c) Microsoft Corporation.
|
|
4305
|
-
|
|
4306
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
4307
|
-
purpose with or without fee is hereby granted.
|
|
4308
|
-
|
|
4309
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
4310
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
4311
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
4312
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
4313
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
4314
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4315
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
4316
|
-
***************************************************************************** */
|
|
4317
|
-
|
|
4318
|
-
function __rest(s, e) {
|
|
4319
|
-
var t = {};
|
|
4320
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4321
|
-
t[p] = s[p];
|
|
4322
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
4323
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
4324
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
4325
|
-
t[p[i]] = s[p[i]];
|
|
4326
|
-
}
|
|
4327
|
-
return t;
|
|
3884
|
+
/**
|
|
3885
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
3886
|
+
*
|
|
3887
|
+
* @static
|
|
3888
|
+
* @memberOf _
|
|
3889
|
+
* @since 4.0.0
|
|
3890
|
+
* @category Lang
|
|
3891
|
+
* @param {*} value The value to check.
|
|
3892
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
3893
|
+
* @example
|
|
3894
|
+
*
|
|
3895
|
+
* _.isSymbol(Symbol.iterator);
|
|
3896
|
+
* // => true
|
|
3897
|
+
*
|
|
3898
|
+
* _.isSymbol('abc');
|
|
3899
|
+
* // => false
|
|
3900
|
+
*/
|
|
3901
|
+
function isSymbol$1(value) {
|
|
3902
|
+
return typeof value == 'symbol' ||
|
|
3903
|
+
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
4328
3904
|
}
|
|
4329
3905
|
|
|
4330
|
-
|
|
4331
|
-
var e = new Error(message);
|
|
4332
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4333
|
-
};
|
|
4334
|
-
|
|
4335
|
-
var css_248z$g = ".gn-footer-item {\n width: 100%;\n height: 40px;\n}";
|
|
4336
|
-
styleInject(css_248z$g);
|
|
4337
|
-
|
|
4338
|
-
const b$h = block('footer-item');
|
|
4339
|
-
const FooterItem$1 = (_a) => {
|
|
4340
|
-
var { item } = _a, props = __rest(_a, ["item"]);
|
|
4341
|
-
return (React__default.createElement(Item$1, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_FOOTER_ICON_SIZE }, item), className: b$h({ compact: props.compact }), onItemClick: item.onItemClick, onItemClickCapture: item.onItemClickCapture })));
|
|
4342
|
-
};
|
|
4343
|
-
|
|
4344
|
-
var css_248z$f = ".gn-action-bar-group {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n margin: 0;\n padding: 0;\n}\n.gn-action-bar-group_pull_left {\n margin-left: 0;\n margin-right: auto;\n}\n.gn-action-bar-group_pull_right {\n margin-left: auto;\n margin-right: 0;\n}\n.gn-action-bar-group_pull_center {\n margin-left: auto;\n margin-right: auto;\n}";
|
|
4345
|
-
styleInject(css_248z$f);
|
|
4346
|
-
|
|
4347
|
-
const b$g = block('action-bar-group');
|
|
4348
|
-
const ActionBarGroup = ({ children, className, pull }) => {
|
|
4349
|
-
return (React__default.createElement("ul", { className: b$g({ pull }, className), role: "group" }, children));
|
|
4350
|
-
};
|
|
4351
|
-
ActionBarGroup.displayName = 'ActionBar.Group';
|
|
4352
|
-
|
|
4353
|
-
var css_248z$e = ".gn-action-bar-item {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n.gn-action-bar-item_pull_left {\n margin-left: 0;\n margin-right: auto;\n}\n.gn-action-bar-item_pull_right {\n margin-left: auto;\n margin-right: 0;\n}\n.gn-action-bar-item_pull_center {\n margin-left: auto;\n margin-right: auto;\n}\n.gn-action-bar-item + .gn-action-bar-item_spacing {\n margin-left: 8px;\n}";
|
|
4354
|
-
styleInject(css_248z$e);
|
|
4355
|
-
|
|
4356
|
-
const b$f = block('action-bar-item');
|
|
4357
|
-
const ActionBarItem = ({ children, className, pull, spacing = true }) => {
|
|
4358
|
-
return React__default.createElement("li", { className: b$f({ pull, spacing }, className) }, children);
|
|
4359
|
-
};
|
|
4360
|
-
ActionBarItem.displayName = 'ActionBar.Item';
|
|
3906
|
+
var isSymbol_1 = isSymbol$1;
|
|
4361
3907
|
|
|
4362
|
-
var
|
|
4363
|
-
|
|
3908
|
+
var baseTrim = _baseTrim,
|
|
3909
|
+
isObject$1 = isObject_1,
|
|
3910
|
+
isSymbol = isSymbol_1;
|
|
4364
3911
|
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
return React__default.createElement("div", { className: b$e({ type }) }, children);
|
|
4368
|
-
};
|
|
4369
|
-
ActionBarSection.displayName = 'ActionBar.Section';
|
|
3912
|
+
/** Used as references for various `Number` constants. */
|
|
3913
|
+
var NAN = 0 / 0;
|
|
4370
3914
|
|
|
4371
|
-
|
|
4372
|
-
|
|
3915
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
3916
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
4373
3917
|
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
return React__default.createElement("li", { role: "separator", className: b$d() });
|
|
4377
|
-
};
|
|
4378
|
-
ActionBarSeparator.displayName = 'ActionBar.Separator';
|
|
3918
|
+
/** Used to detect binary string values. */
|
|
3919
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
4379
3920
|
|
|
4380
|
-
|
|
4381
|
-
|
|
3921
|
+
/** Used to detect octal string values. */
|
|
3922
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
4382
3923
|
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
return (React__default.createElement("section", { className: b$c(null, className), "aria-label": ariaLabel }, children));
|
|
4386
|
-
};
|
|
4387
|
-
ActionBar.displayName = 'ActionBar';
|
|
4388
|
-
const PublicActionBar = Object.assign(ActionBar, {
|
|
4389
|
-
Section: ActionBarSection,
|
|
4390
|
-
Group: ActionBarGroup,
|
|
4391
|
-
Item: ActionBarItem,
|
|
4392
|
-
Separator: ActionBarSeparator,
|
|
4393
|
-
});
|
|
3924
|
+
/** Built-in method references without a dependency on `root`. */
|
|
3925
|
+
var freeParseInt = parseInt;
|
|
4394
3926
|
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
3927
|
+
/**
|
|
3928
|
+
* Converts `value` to a number.
|
|
3929
|
+
*
|
|
3930
|
+
* @static
|
|
3931
|
+
* @memberOf _
|
|
3932
|
+
* @since 4.0.0
|
|
3933
|
+
* @category Lang
|
|
3934
|
+
* @param {*} value The value to process.
|
|
3935
|
+
* @returns {number} Returns the number.
|
|
3936
|
+
* @example
|
|
3937
|
+
*
|
|
3938
|
+
* _.toNumber(3.2);
|
|
3939
|
+
* // => 3.2
|
|
3940
|
+
*
|
|
3941
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
3942
|
+
* // => 5e-324
|
|
3943
|
+
*
|
|
3944
|
+
* _.toNumber(Infinity);
|
|
3945
|
+
* // => Infinity
|
|
3946
|
+
*
|
|
3947
|
+
* _.toNumber('3.2');
|
|
3948
|
+
* // => 3.2
|
|
3949
|
+
*/
|
|
3950
|
+
function toNumber$1(value) {
|
|
3951
|
+
if (typeof value == 'number') {
|
|
3952
|
+
return value;
|
|
3953
|
+
}
|
|
3954
|
+
if (isSymbol(value)) {
|
|
3955
|
+
return NAN;
|
|
3956
|
+
}
|
|
3957
|
+
if (isObject$1(value)) {
|
|
3958
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
3959
|
+
value = isObject$1(other) ? (other + '') : other;
|
|
3960
|
+
}
|
|
3961
|
+
if (typeof value != 'string') {
|
|
3962
|
+
return value === 0 ? value : +value;
|
|
3963
|
+
}
|
|
3964
|
+
value = baseTrim(value);
|
|
3965
|
+
var isBinary = reIsBinary.test(value);
|
|
3966
|
+
return (isBinary || reIsOctal.test(value))
|
|
3967
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
3968
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
3969
|
+
}
|
|
4399
3970
|
|
|
4400
|
-
var
|
|
4401
|
-
var ru$2 = {
|
|
4402
|
-
button_close: button_close
|
|
4403
|
-
};
|
|
3971
|
+
var toNumber_1 = toNumber$1;
|
|
4404
3972
|
|
|
4405
|
-
|
|
4406
|
-
|
|
3973
|
+
var isObject = isObject_1,
|
|
3974
|
+
now = now_1,
|
|
3975
|
+
toNumber = toNumber_1;
|
|
4407
3976
|
|
|
4408
|
-
|
|
4409
|
-
|
|
3977
|
+
/** Error message constants. */
|
|
3978
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
4410
3979
|
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
React__default.createElement(Text, { className: b$b('text'), as: 'h3', variant: 'subheader-3' }, children),
|
|
4415
|
-
onClose && (React__default.createElement(Button, { onClick: onClose, view: "flat", size: "l", extraProps: {
|
|
4416
|
-
'aria-label': closeTitle,
|
|
4417
|
-
} },
|
|
4418
|
-
React__default.createElement(Icon, { data: Xmark, size: closeIconSize })))));
|
|
4419
|
-
};
|
|
4420
|
-
Title.displayName = 'Title';
|
|
4421
|
-
|
|
4422
|
-
function flattenHotkeyGroups(hotkeys) {
|
|
4423
|
-
const result = [];
|
|
4424
|
-
for (const hotkeysGroup of hotkeys) {
|
|
4425
|
-
result.push({
|
|
4426
|
-
title: hotkeysGroup.title,
|
|
4427
|
-
group: true,
|
|
4428
|
-
});
|
|
4429
|
-
result.push(...hotkeysGroup.items);
|
|
4430
|
-
}
|
|
4431
|
-
return result;
|
|
4432
|
-
}
|
|
4433
|
-
|
|
4434
|
-
function filterHotkeys(hotkeys, filter) {
|
|
4435
|
-
if (filter) {
|
|
4436
|
-
const result = [];
|
|
4437
|
-
const normalizedFilter = filter.toLowerCase();
|
|
4438
|
-
for (const hotkeysBlock of hotkeys) {
|
|
4439
|
-
const filteredItems = hotkeysBlock.items.filter((item) => item.title.toLowerCase().includes(normalizedFilter));
|
|
4440
|
-
if (filteredItems.length > 0) {
|
|
4441
|
-
result.push(Object.assign(Object.assign({}, hotkeysBlock), { items: filteredItems }));
|
|
4442
|
-
}
|
|
4443
|
-
}
|
|
4444
|
-
return result;
|
|
4445
|
-
}
|
|
4446
|
-
return hotkeys;
|
|
4447
|
-
}
|
|
4448
|
-
|
|
4449
|
-
var css_248z$9 = ".gn-hotkeys-panel {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n --hotkeys-panel-width: 400px;\n --hotkeys-panel-vertical-padding: 18px;\n --hotkeys-panel-horizontal-padding: 24px;\n}\n.gn-hotkeys-panel__drawer-item {\n width: var(--hotkeys-panel-width);\n padding: var(--hotkeys-panel-vertical-padding) 0;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n.gn-hotkeys-panel__title {\n margin: 0 var(--hotkeys-panel-horizontal-padding) 16px var(--hotkeys-panel-horizontal-padding);\n}\n.gn-hotkeys-panel__search {\n padding: 0 var(--hotkeys-panel-horizontal-padding);\n margin-bottom: 14px;\n}\n.gn-hotkeys-panel__list {\n flex: 1;\n overflow-y: auto;\n}\n.gn-hotkeys-panel__item {\n height: auto;\n padding: 8px var(--hotkeys-panel-horizontal-padding);\n}\n.gn-hotkeys-panel__item.yc-list__item_active {\n background: inherit;\n}\n.gn-hotkeys-panel__item-content {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n width: 100%;\n font-size: var(--g-text-body-1-font-size);\n line-height: var(--g-text-body-1-line-height);\n color: var(--g-color-text-primary);\n}\n.gn-hotkeys-panel__item-content_group {\n font-size: var(--g-text-body-2-font-size);\n font-weight: 500;\n line-height: var(--g-text-body-2-line-height);\n}\n.gn-hotkeys-panel__hotkey {\n color: var(--g-color-text-complementary);\n}";
|
|
4450
|
-
styleInject(css_248z$9);
|
|
4451
|
-
|
|
4452
|
-
const b$a = block('hotkeys-panel');
|
|
4453
|
-
function HotkeysPanel(_a) {
|
|
4454
|
-
var { visible, onClose, leftOffset, topOffset, className, preventScrollBody, hotkeys, itemClassName, filterPlaceholder, title, emptyState } = _a, listProps = __rest(_a, ["visible", "onClose", "leftOffset", "topOffset", "className", "preventScrollBody", "hotkeys", "itemClassName", "filterPlaceholder", "title", "emptyState"]);
|
|
4455
|
-
const [filter, setFilter] = useState('');
|
|
4456
|
-
const hotkeysList = useMemo(() => {
|
|
4457
|
-
const filteredHotkeys = filterHotkeys(hotkeys, filter);
|
|
4458
|
-
return flattenHotkeyGroups(filteredHotkeys);
|
|
4459
|
-
}, [hotkeys, filter]);
|
|
4460
|
-
const renderItem = useCallback((item) => (React__default.createElement("div", { className: b$a('item-content', { group: item.group }), key: item.title },
|
|
4461
|
-
item.title,
|
|
4462
|
-
item.value && React__default.createElement(Hotkey, { className: b$a('hotkey'), value: item.value }))), []);
|
|
4463
|
-
const drawerItemContent = (React__default.createElement(React__default.Fragment, null,
|
|
4464
|
-
React__default.createElement("h2", { className: b$a('title') }, title),
|
|
4465
|
-
React__default.createElement(TextInput, { value: filter, onUpdate: setFilter, placeholder: filterPlaceholder, autoFocus: true, className: b$a('search') }),
|
|
4466
|
-
React__default.createElement(List, Object.assign({ className: b$a('list'), virtualized: false, filterable: false, items: hotkeysList, renderItem: renderItem, itemClassName: b$a('item', itemClassName), emptyPlaceholder: emptyState }, listProps))));
|
|
4467
|
-
return (React__default.createElement(Drawer, { className: b$a(null, className), onVeilClick: onClose, onEscape: onClose, preventScrollBody: preventScrollBody, style: {
|
|
4468
|
-
left: leftOffset,
|
|
4469
|
-
top: topOffset,
|
|
4470
|
-
} },
|
|
4471
|
-
React__default.createElement(DrawerItem, { id: "hotkeys", visible: visible, className: b$a('drawer-item'), content: drawerItemContent })));
|
|
4472
|
-
}
|
|
3980
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3981
|
+
var nativeMax = Math.max,
|
|
3982
|
+
nativeMin = Math.min;
|
|
4473
3983
|
|
|
4474
3984
|
/**
|
|
4475
|
-
*
|
|
3985
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
3986
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
3987
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
3988
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
3989
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
3990
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
3991
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
3992
|
+
* calls to the debounced function return the result of the last `func`
|
|
3993
|
+
* invocation.
|
|
4476
3994
|
*
|
|
4477
|
-
*
|
|
4478
|
-
*
|
|
4479
|
-
*
|
|
4480
|
-
* @category Util
|
|
4481
|
-
* @param {*} value Any value.
|
|
4482
|
-
* @returns {*} Returns `value`.
|
|
4483
|
-
* @example
|
|
3995
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
3996
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
3997
|
+
* is invoked more than once during the `wait` timeout.
|
|
4484
3998
|
*
|
|
4485
|
-
*
|
|
3999
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4000
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4486
4001
|
*
|
|
4487
|
-
*
|
|
4488
|
-
*
|
|
4489
|
-
*/
|
|
4490
|
-
|
|
4491
|
-
function identity(value) {
|
|
4492
|
-
return value;
|
|
4493
|
-
}
|
|
4494
|
-
|
|
4495
|
-
var identity_1 = identity;
|
|
4496
|
-
|
|
4497
|
-
/**
|
|
4498
|
-
* Checks if `value` is the
|
|
4499
|
-
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
4500
|
-
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
4002
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4003
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
4501
4004
|
*
|
|
4502
4005
|
* @static
|
|
4503
4006
|
* @memberOf _
|
|
4504
4007
|
* @since 0.1.0
|
|
4505
|
-
* @category
|
|
4506
|
-
* @param {
|
|
4507
|
-
* @
|
|
4008
|
+
* @category Function
|
|
4009
|
+
* @param {Function} func The function to debounce.
|
|
4010
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
4011
|
+
* @param {Object} [options={}] The options object.
|
|
4012
|
+
* @param {boolean} [options.leading=false]
|
|
4013
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4014
|
+
* @param {number} [options.maxWait]
|
|
4015
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
4016
|
+
* @param {boolean} [options.trailing=true]
|
|
4017
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4018
|
+
* @returns {Function} Returns the new debounced function.
|
|
4508
4019
|
* @example
|
|
4509
4020
|
*
|
|
4510
|
-
*
|
|
4511
|
-
*
|
|
4021
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
4022
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
4512
4023
|
*
|
|
4513
|
-
*
|
|
4514
|
-
*
|
|
4024
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
4025
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
4026
|
+
* 'leading': true,
|
|
4027
|
+
* 'trailing': false
|
|
4028
|
+
* }));
|
|
4515
4029
|
*
|
|
4516
|
-
*
|
|
4517
|
-
*
|
|
4030
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
4031
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
4032
|
+
* var source = new EventSource('/stream');
|
|
4033
|
+
* jQuery(source).on('message', debounced);
|
|
4518
4034
|
*
|
|
4519
|
-
*
|
|
4520
|
-
*
|
|
4035
|
+
* // Cancel the trailing debounced invocation.
|
|
4036
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
4521
4037
|
*/
|
|
4038
|
+
function debounce(func, wait, options) {
|
|
4039
|
+
var lastArgs,
|
|
4040
|
+
lastThis,
|
|
4041
|
+
maxWait,
|
|
4042
|
+
result,
|
|
4043
|
+
timerId,
|
|
4044
|
+
lastCallTime,
|
|
4045
|
+
lastInvokeTime = 0,
|
|
4046
|
+
leading = false,
|
|
4047
|
+
maxing = false,
|
|
4048
|
+
trailing = true;
|
|
4522
4049
|
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4050
|
+
if (typeof func != 'function') {
|
|
4051
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
4052
|
+
}
|
|
4053
|
+
wait = toNumber(wait) || 0;
|
|
4054
|
+
if (isObject(options)) {
|
|
4055
|
+
leading = !!options.leading;
|
|
4056
|
+
maxing = 'maxWait' in options;
|
|
4057
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
4058
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4059
|
+
}
|
|
4529
4060
|
|
|
4530
|
-
|
|
4061
|
+
function invokeFunc(time) {
|
|
4062
|
+
var args = lastArgs,
|
|
4063
|
+
thisArg = lastThis;
|
|
4531
4064
|
|
|
4532
|
-
|
|
4065
|
+
lastArgs = lastThis = undefined;
|
|
4066
|
+
lastInvokeTime = time;
|
|
4067
|
+
result = func.apply(thisArg, args);
|
|
4068
|
+
return result;
|
|
4069
|
+
}
|
|
4533
4070
|
|
|
4534
|
-
|
|
4071
|
+
function leadingEdge(time) {
|
|
4072
|
+
// Reset any `maxWait` timer.
|
|
4073
|
+
lastInvokeTime = time;
|
|
4074
|
+
// Start the timer for the trailing edge.
|
|
4075
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4076
|
+
// Invoke the leading edge.
|
|
4077
|
+
return leading ? invokeFunc(time) : result;
|
|
4078
|
+
}
|
|
4535
4079
|
|
|
4536
|
-
|
|
4080
|
+
function remainingWait(time) {
|
|
4081
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4082
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
4083
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
4537
4084
|
|
|
4538
|
-
|
|
4539
|
-
|
|
4085
|
+
return maxing
|
|
4086
|
+
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
4087
|
+
: timeWaiting;
|
|
4088
|
+
}
|
|
4540
4089
|
|
|
4541
|
-
|
|
4542
|
-
var
|
|
4090
|
+
function shouldInvoke(time) {
|
|
4091
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4092
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
4543
4093
|
|
|
4544
|
-
|
|
4094
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
4095
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
4096
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
4097
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
4098
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
4099
|
+
}
|
|
4545
4100
|
|
|
4546
|
-
|
|
4101
|
+
function timerExpired() {
|
|
4102
|
+
var time = now();
|
|
4103
|
+
if (shouldInvoke(time)) {
|
|
4104
|
+
return trailingEdge(time);
|
|
4105
|
+
}
|
|
4106
|
+
// Restart the timer.
|
|
4107
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
4108
|
+
}
|
|
4547
4109
|
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
4551
|
-
*
|
|
4552
|
-
* @static
|
|
4553
|
-
* @memberOf _
|
|
4554
|
-
* @since 2.4.0
|
|
4555
|
-
* @category Date
|
|
4556
|
-
* @returns {number} Returns the timestamp.
|
|
4557
|
-
* @example
|
|
4558
|
-
*
|
|
4559
|
-
* _.defer(function(stamp) {
|
|
4560
|
-
* console.log(_.now() - stamp);
|
|
4561
|
-
* }, _.now());
|
|
4562
|
-
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
4563
|
-
*/
|
|
4564
|
-
var now$1 = function() {
|
|
4565
|
-
return root$1.Date.now();
|
|
4566
|
-
};
|
|
4110
|
+
function trailingEdge(time) {
|
|
4111
|
+
timerId = undefined;
|
|
4567
4112
|
|
|
4568
|
-
|
|
4113
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
4114
|
+
// debounced at least once.
|
|
4115
|
+
if (trailing && lastArgs) {
|
|
4116
|
+
return invokeFunc(time);
|
|
4117
|
+
}
|
|
4118
|
+
lastArgs = lastThis = undefined;
|
|
4119
|
+
return result;
|
|
4120
|
+
}
|
|
4569
4121
|
|
|
4570
|
-
|
|
4122
|
+
function cancel() {
|
|
4123
|
+
if (timerId !== undefined) {
|
|
4124
|
+
clearTimeout(timerId);
|
|
4125
|
+
}
|
|
4126
|
+
lastInvokeTime = 0;
|
|
4127
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
4128
|
+
}
|
|
4571
4129
|
|
|
4572
|
-
|
|
4130
|
+
function flush() {
|
|
4131
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
4132
|
+
}
|
|
4573
4133
|
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
*
|
|
4578
|
-
* @private
|
|
4579
|
-
* @param {string} string The string to inspect.
|
|
4580
|
-
* @returns {number} Returns the index of the last non-whitespace character.
|
|
4581
|
-
*/
|
|
4582
|
-
function trimmedEndIndex$1(string) {
|
|
4583
|
-
var index = string.length;
|
|
4134
|
+
function debounced() {
|
|
4135
|
+
var time = now(),
|
|
4136
|
+
isInvoking = shouldInvoke(time);
|
|
4584
4137
|
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
var _trimmedEndIndex = trimmedEndIndex$1;
|
|
4590
|
-
|
|
4591
|
-
var trimmedEndIndex = _trimmedEndIndex;
|
|
4592
|
-
|
|
4593
|
-
/** Used to match leading whitespace. */
|
|
4594
|
-
var reTrimStart = /^\s+/;
|
|
4138
|
+
lastArgs = arguments;
|
|
4139
|
+
lastThis = this;
|
|
4140
|
+
lastCallTime = time;
|
|
4595
4141
|
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4142
|
+
if (isInvoking) {
|
|
4143
|
+
if (timerId === undefined) {
|
|
4144
|
+
return leadingEdge(lastCallTime);
|
|
4145
|
+
}
|
|
4146
|
+
if (maxing) {
|
|
4147
|
+
// Handle invocations in a tight loop.
|
|
4148
|
+
clearTimeout(timerId);
|
|
4149
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4150
|
+
return invokeFunc(lastCallTime);
|
|
4151
|
+
}
|
|
4152
|
+
}
|
|
4153
|
+
if (timerId === undefined) {
|
|
4154
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4155
|
+
}
|
|
4156
|
+
return result;
|
|
4157
|
+
}
|
|
4158
|
+
debounced.cancel = cancel;
|
|
4159
|
+
debounced.flush = flush;
|
|
4160
|
+
return debounced;
|
|
4607
4161
|
}
|
|
4608
4162
|
|
|
4609
|
-
var
|
|
4610
|
-
|
|
4611
|
-
var root = _root;
|
|
4612
|
-
|
|
4613
|
-
/** Built-in value references. */
|
|
4614
|
-
var Symbol$3 = root.Symbol;
|
|
4615
|
-
|
|
4616
|
-
var _Symbol = Symbol$3;
|
|
4617
|
-
|
|
4618
|
-
var Symbol$2 = _Symbol;
|
|
4619
|
-
|
|
4620
|
-
/** Used for built-in method references. */
|
|
4621
|
-
var objectProto$1 = Object.prototype;
|
|
4622
|
-
|
|
4623
|
-
/** Used to check objects for own properties. */
|
|
4624
|
-
var hasOwnProperty = objectProto$1.hasOwnProperty;
|
|
4163
|
+
var debounce_1 = debounce;
|
|
4625
4164
|
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
4629
|
-
* of values.
|
|
4630
|
-
*/
|
|
4631
|
-
var nativeObjectToString$1 = objectProto$1.toString;
|
|
4165
|
+
var css_248z$l = ".gn-composite-bar-highlighted-item {\n position: absolute;\n z-index: 10000;\n display: flex;\n justify-content: center;\n}\n.gn-composite-bar-highlighted-item__icon {\n width: var(--gn-aside-header-item-icon-background-size);\n height: var(--gn-aside-header-item-icon-background-size);\n border-radius: 7px;\n cursor: pointer;\n background-color: var(--g-color-base-background);\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n transform: translateY(1px);\n overflow: hidden;\n box-shadow: 0 8px 20px 0 var(--g-color-sfx-shadow);\n}\n.gn-composite-bar-highlighted-item__icon::before {\n content: \"\";\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: -1;\n background-color: var(--g-color-base-selection);\n}\n.gn-composite-bar-highlighted-item__icon:hover::before {\n background-color: var(--g-color-base-selection-hover);\n}";
|
|
4166
|
+
styleInject(css_248z$l);
|
|
4632
4167
|
|
|
4633
|
-
|
|
4634
|
-
|
|
4168
|
+
const b$m = block('composite-bar-highlighted-item');
|
|
4169
|
+
const DEBOUNCE_TIME = 200;
|
|
4170
|
+
const HighlightedItem = ({ iconRef, iconNode, onClick, onClickCapture, openModalSubscriber, }) => {
|
|
4171
|
+
const [{ top, left, width, height }, setPosition] = useState({
|
|
4172
|
+
top: 0,
|
|
4173
|
+
left: 0,
|
|
4174
|
+
width: 0,
|
|
4175
|
+
height: 0,
|
|
4176
|
+
});
|
|
4177
|
+
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
4178
|
+
const handleResize = useCallback(debounce_1(() => {
|
|
4179
|
+
var _a;
|
|
4180
|
+
const { top = 0, left = 0, width = 0, height = 0, } = ((_a = iconRef === null || iconRef === void 0 ? void 0 : iconRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {};
|
|
4181
|
+
setPosition({
|
|
4182
|
+
top: top + window.scrollY,
|
|
4183
|
+
left: left + window.scrollX,
|
|
4184
|
+
width,
|
|
4185
|
+
height,
|
|
4186
|
+
});
|
|
4187
|
+
}, DEBOUNCE_TIME, { leading: true }), []);
|
|
4188
|
+
useEffect(() => {
|
|
4189
|
+
if (!isModalOpen) {
|
|
4190
|
+
return;
|
|
4191
|
+
}
|
|
4192
|
+
handleResize();
|
|
4193
|
+
window.addEventListener('resize', handleResize);
|
|
4194
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
4195
|
+
}, [handleResize, isModalOpen]);
|
|
4196
|
+
openModalSubscriber === null || openModalSubscriber === void 0 ? void 0 : openModalSubscriber((open) => {
|
|
4197
|
+
setIsModalOpen(open);
|
|
4198
|
+
});
|
|
4199
|
+
if (!iconNode || !isModalOpen) {
|
|
4200
|
+
return null;
|
|
4201
|
+
}
|
|
4202
|
+
return (React__default.createElement(Portal, null,
|
|
4203
|
+
React__default.createElement("div", { className: b$m(), style: { left, top, width, height }, onClick: onClick, onClickCapture: onClickCapture, "data-toast": true },
|
|
4204
|
+
React__default.createElement("div", { className: b$m('icon') }, iconNode))));
|
|
4205
|
+
};
|
|
4206
|
+
HighlightedItem.displayName = 'HighlightedItem';
|
|
4635
4207
|
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
*
|
|
4639
|
-
* @private
|
|
4640
|
-
* @param {*} value The value to query.
|
|
4641
|
-
* @returns {string} Returns the raw `toStringTag`.
|
|
4642
|
-
*/
|
|
4643
|
-
function getRawTag$1(value) {
|
|
4644
|
-
var isOwn = hasOwnProperty.call(value, symToStringTag$1),
|
|
4645
|
-
tag = value[symToStringTag$1];
|
|
4208
|
+
var css_248z$k = ".gn-composite-bar-item {\n --gn-composite-bar-item-action-size: 36px;\n display: flex;\n width: 100%;\n height: 100%;\n align-items: center;\n cursor: pointer;\n}\n.gn-composite-bar-item__icon {\n color: var(--g-color-text-misc);\n}\n.gn-footer-item .gn-composite-bar-item__icon, .gn-composite-bar-highlighted-item .gn-composite-bar-item__icon {\n color: var(--gn-aside-header-footer-item-icon-color);\n}\n.gn-composite-bar_subheader .gn-composite-bar-item__icon {\n color: var(--gn-aside-header-subheader-item-icon-color);\n}\n.gn-composite-bar-item__icon-place {\n flex-shrink: 0;\n width: var(--gn-aside-header-min-width);\n display: flex;\n align-items: center;\n justify-content: center;\n height: 100%;\n}\n.gn-composite-bar-item__title {\n display: flex;\n overflow: hidden;\n}\n.gn-composite-bar-item__title-text {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.gn-composite-bar-item__title-adornment {\n margin: 0 10px;\n}\n.gn-composite-bar-item__collapse-item {\n display: flex;\n padding: 0 16px;\n align-items: center;\n width: 100%;\n height: 100%;\n cursor: pointer;\n}\n.gn-composite-bar-item__collapse-item .gn-composite-bar-item__title-adornment {\n margin-right: 0;\n}\n.gn-composite-bar-item__menu-divider {\n margin: 0 8px;\n width: 100%;\n border-top: 1px solid var(--g-color-line-generic);\n cursor: default;\n}\n.gn-composite-bar-item__collapse-items-popup-content {\n padding: 4px 0;\n}\n.gn-composite-bar-item__link {\n display: flex;\n width: 100%;\n height: 100%;\n align-items: center;\n}\n.gn-composite-bar-item__link, .gn-composite-bar-item__link:hover, .gn-composite-bar-item__link:active, .gn-composite-bar-item__link:visited, .gn-composite-bar-item__link:focus {\n text-decoration: none;\n outline: none;\n color: inherit;\n}\n.gn-composite-bar-item__btn-icon {\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n.gn-composite-bar-item_type_action {\n justify-content: center;\n height: var(--gn-composite-bar-item-action-size);\n margin: 0 10px 8px;\n background: var(--g-color-base-float);\n box-shadow: 0px 0px 0px 1px rgba(0, 0, 0, 0.03), 0px 5px 6px rgba(0, 0, 0, 0.12);\n border-radius: var(--gn-composite-bar-item-action-size);\n transition: transform 0.1s ease-out, background-color 0.15s linear;\n}\n.gn-composite-bar-item_type_action:focus {\n box-shadow: 0 0 0 2px var(--g-color-line-misc);\n}\n.gn-composite-bar-item_type_action:focus:not(:focus-visible) {\n box-shadow: none;\n}\n.gn-composite-bar-item_type_action:hover {\n background-color: var(--g-color-base-float-hover);\n}\n.gn-composite-bar-item_type_action:active {\n box-shadow: 0 1px 2px var(--g-color-sfx-shadow);\n transition: none;\n transform: scale(0.96);\n}\n.gn-composite-bar-item_type_action .gn-composite-bar-item__icon-place {\n width: var(--gn-composite-bar-item-action-size);\n}\n.gn-composite-bar-item_type_action .gn-composite-bar-item__title {\n margin-right: 16px;\n}\n.gn-composite-bar-item__icon-tooltip_item-type_action {\n margin-left: 10px;\n}\n.gn-composite-bar-item:not(.gn-composite-bar-item_compact).gn-composite-bar-item_current.gn-composite-bar-item_type_regular {\n background-color: var(--g-color-base-selection);\n}\n.gn-composite-bar-item:not(.gn-composite-bar-item_compact):not(.gn-composite-bar-item_current):hover.gn-composite-bar-item_type_regular {\n background-color: var(--g-color-base-simple-hover);\n}\n.gn-composite-bar-item_compact.gn-composite-bar-item_type_action {\n width: var(--gn-composite-bar-item-action-size);\n}\n.gn-composite-bar-item_compact.gn-composite-bar-item_type_action .gn-composite-bar-item__title {\n margin: 0;\n}\n.gn-composite-bar-item_compact.gn-composite-bar-item_current.gn-composite-bar-item_type_regular .gn-composite-bar-item__btn-icon {\n position: relative;\n background-color: transparent;\n}\n.gn-composite-bar-item_compact.gn-composite-bar-item_current.gn-composite-bar-item_type_regular .gn-composite-bar-item__btn-icon::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: -1;\n width: var(--gn-aside-header-item-icon-background-size);\n height: var(--gn-aside-header-item-icon-background-size);\n margin-top: -19px;\n margin-left: -19px;\n border-radius: 7px;\n}\n.gn-composite-bar-item_compact.gn-composite-bar-item_current.gn-composite-bar-item_type_regular .gn-composite-bar-item__btn-icon::before {\n background-color: var(--g-color-base-selection);\n}\n.gn-composite-bar-item_compact:not(.gn-composite-bar-item_current):hover.gn-composite-bar-item_type_regular .gn-composite-bar-item__btn-icon {\n position: relative;\n background-color: transparent;\n}\n.gn-composite-bar-item_compact:not(.gn-composite-bar-item_current):hover.gn-composite-bar-item_type_regular .gn-composite-bar-item__btn-icon::before {\n content: \"\";\n position: absolute;\n top: 50%;\n left: 50%;\n z-index: -1;\n width: var(--gn-aside-header-item-icon-background-size);\n height: var(--gn-aside-header-item-icon-background-size);\n margin-top: -19px;\n margin-left: -19px;\n border-radius: 7px;\n}\n.gn-composite-bar-item_compact:not(.gn-composite-bar-item_current):hover.gn-composite-bar-item_type_regular .gn-composite-bar-item__btn-icon::before {\n background-color: var(--g-color-base-simple-hover);\n}";
|
|
4209
|
+
styleInject(css_248z$k);
|
|
4646
4210
|
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4211
|
+
const b$l = block('composite-bar-item');
|
|
4212
|
+
function renderItemTitle(item) {
|
|
4213
|
+
let titleNode = React__default.createElement("div", { className: b$l('title-text') }, item.title);
|
|
4214
|
+
if (item.rightAdornment) {
|
|
4215
|
+
titleNode = (React__default.createElement(React__default.Fragment, null,
|
|
4216
|
+
titleNode,
|
|
4217
|
+
React__default.createElement("div", { className: b$l('title-adornment') }, item.rightAdornment)));
|
|
4218
|
+
}
|
|
4219
|
+
return titleNode;
|
|
4220
|
+
}
|
|
4221
|
+
const defaultPopupPlacement = ['right-end'];
|
|
4222
|
+
const defaultPopupOffset = [-20, 8];
|
|
4223
|
+
const Item$1 = (props) => {
|
|
4224
|
+
const { item, className, collapseItems, onMouseLeave, onMouseEnter, enableTooltip = true, popupVisible = false, popupAnchor, popupPlacement = defaultPopupPlacement, popupOffset = defaultPopupOffset, popupKeepMounted, renderPopupContent, onClosePopup, onItemClick, onItemClickCapture, bringForward, openModalSubscriber, } = props;
|
|
4225
|
+
const { compact } = useAsideHeaderContext();
|
|
4226
|
+
if (item.type === 'divider') {
|
|
4227
|
+
return React__default.createElement("div", { className: b$l('menu-divider') });
|
|
4228
|
+
}
|
|
4229
|
+
const [open, toggleOpen] = React__default.useState(false);
|
|
4230
|
+
const ref = React__default.useRef(null);
|
|
4231
|
+
const anchorRef = popupAnchor || ref;
|
|
4232
|
+
const highlightedRef = React__default.useRef(null);
|
|
4233
|
+
const type = item.type || ITEM_TYPE_REGULAR;
|
|
4234
|
+
const current = item.current || false;
|
|
4235
|
+
const tooltipText = item.tooltipText || item.title;
|
|
4236
|
+
const icon = item.icon;
|
|
4237
|
+
const iconSize = item.iconSize || ASIDE_HEADER_ICON_SIZE;
|
|
4238
|
+
const collapsedItem = item.id === COLLAPSE_ITEM_ID;
|
|
4239
|
+
const onClose = React__default.useCallback((event) => {
|
|
4240
|
+
var _a;
|
|
4241
|
+
if (event instanceof MouseEvent &&
|
|
4242
|
+
event.target &&
|
|
4243
|
+
((_a = ref.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
|
|
4244
|
+
return;
|
|
4245
|
+
}
|
|
4246
|
+
onClosePopup === null || onClosePopup === void 0 ? void 0 : onClosePopup();
|
|
4247
|
+
}, [onClosePopup]);
|
|
4248
|
+
const makeIconNode = (iconEl) => {
|
|
4249
|
+
return compact ? (React__default.createElement(Tooltip, { content: tooltipText, disabled: !enableTooltip || (collapsedItem && open) || popupVisible, placement: "right", className: b$l('icon-tooltip', { 'item-type': type }) },
|
|
4250
|
+
React__default.createElement("div", { onMouseEnter: () => onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter(), onMouseLeave: () => onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(), className: b$l('btn-icon') }, iconEl))) : (iconEl);
|
|
4251
|
+
};
|
|
4252
|
+
const makeNode = ({ icon: iconEl, title: titleEl }) => {
|
|
4253
|
+
const createdNode = (React__default.createElement("div", { className: b$l({ type, current, compact }, className), ref: ref, onClick: (event) => {
|
|
4254
|
+
if (collapsedItem) {
|
|
4255
|
+
/**
|
|
4256
|
+
* If we call onItemClick for collapsedItem then:
|
|
4257
|
+
* - User get unexpected item in onItemClick callback
|
|
4258
|
+
* - onClosePanel calls twice for each popuped item, as result it will prevent opening of panelItems
|
|
4259
|
+
*/
|
|
4260
|
+
toggleOpen(!open);
|
|
4261
|
+
}
|
|
4262
|
+
else {
|
|
4263
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, false, event);
|
|
4264
|
+
}
|
|
4265
|
+
}, onClickCapture: onItemClickCapture, onMouseEnter: () => {
|
|
4266
|
+
if (!compact) {
|
|
4267
|
+
onMouseEnter === null || onMouseEnter === void 0 ? void 0 : onMouseEnter();
|
|
4268
|
+
}
|
|
4269
|
+
}, onMouseLeave: () => {
|
|
4270
|
+
if (!compact) {
|
|
4271
|
+
onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave();
|
|
4272
|
+
}
|
|
4273
|
+
} },
|
|
4274
|
+
React__default.createElement("div", { className: b$l('icon-place'), ref: highlightedRef }, makeIconNode(iconEl)),
|
|
4275
|
+
React__default.createElement("div", { className: b$l('title'), title: typeof item.title === 'string' ? item.title : undefined }, titleEl),
|
|
4276
|
+
renderPopupContent && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(Popup, { contentClassName: b$l('popup'), open: popupVisible, keepMounted: popupKeepMounted, placement: popupPlacement, offset: popupOffset, anchorRef: anchorRef, onClose: onClose }, renderPopupContent()))));
|
|
4277
|
+
return item.link ? (React__default.createElement("a", { href: item.link, className: b$l('link') }, createdNode)) : (createdNode);
|
|
4278
|
+
};
|
|
4279
|
+
const iconNode = icon ? React__default.createElement(Icon, { data: icon, size: iconSize, className: b$l('icon') }) : null;
|
|
4280
|
+
const titleNode = renderItemTitle(item);
|
|
4281
|
+
const params = { icon: iconNode, title: titleNode };
|
|
4282
|
+
let node;
|
|
4283
|
+
const opts = { compact, collapsed: false, item, ref };
|
|
4284
|
+
if (typeof item.itemWrapper === 'function') {
|
|
4285
|
+
node = item.itemWrapper(params, makeNode, opts);
|
|
4286
|
+
}
|
|
4287
|
+
else {
|
|
4288
|
+
node = makeNode(params);
|
|
4289
|
+
}
|
|
4290
|
+
const highlightedNode = makeIconNode(iconNode);
|
|
4291
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
4292
|
+
bringForward && (React__default.createElement(HighlightedItem, { iconNode: highlightedNode, iconRef: highlightedRef, onClick: (event) => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, false, event), onClickCapture: onItemClickCapture, openModalSubscriber: openModalSubscriber })),
|
|
4293
|
+
node,
|
|
4294
|
+
open && collapsedItem && (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) && Boolean(anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.current) && (React__default.createElement(CollapsedPopup, Object.assign({}, props, { anchorRef: ref, onClose: () => toggleOpen(false) })))));
|
|
4295
|
+
};
|
|
4296
|
+
Item$1.displayName = 'Item';
|
|
4297
|
+
function CollapsedPopup({ onItemClick, collapseItems, anchorRef, onClose, }) {
|
|
4298
|
+
const { compact } = useAsideHeaderContext();
|
|
4299
|
+
return (collapseItems === null || collapseItems === void 0 ? void 0 : collapseItems.length) ? (React__default.createElement(Popup, { placement: POPUP_PLACEMENT, open: true, anchorRef: anchorRef, onClose: onClose },
|
|
4300
|
+
React__default.createElement("div", { className: b$l('collapse-items-popup-content') },
|
|
4301
|
+
React__default.createElement(List, { itemClassName: b$l('root-collapse-item'), items: collapseItems, selectedItemIndex: getSelectedItemIndex$1(collapseItems), itemHeight: POPUP_ITEM_HEIGHT, itemsHeight: collapseItems.length * POPUP_ITEM_HEIGHT, virtualized: false, filterable: false, sortable: false, renderItem: (collapseItem) => {
|
|
4302
|
+
const makeCollapseNode = ({ title: titleEl }) => {
|
|
4303
|
+
const res = (React__default.createElement("div", { className: b$l('collapse-item'), onClick: (event) => {
|
|
4304
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(collapseItem, true, event);
|
|
4305
|
+
} }, titleEl));
|
|
4306
|
+
return collapseItem.link ? (React__default.createElement("a", { href: collapseItem.link, className: b$l('link') }, res)) : (res);
|
|
4307
|
+
};
|
|
4308
|
+
const titleNode = renderItemTitle(collapseItem);
|
|
4309
|
+
const params = { title: titleNode };
|
|
4310
|
+
const opts = { compact, collapsed: true, item: collapseItem, ref: anchorRef };
|
|
4311
|
+
if (typeof collapseItem.itemWrapper === 'function') {
|
|
4312
|
+
return collapseItem.itemWrapper(params, makeCollapseNode, opts);
|
|
4313
|
+
}
|
|
4314
|
+
else {
|
|
4315
|
+
return makeCollapseNode(params);
|
|
4316
|
+
}
|
|
4317
|
+
} })))) : null;
|
|
4318
|
+
}
|
|
4651
4319
|
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4320
|
+
const multipleTooltipContextDefaults = {
|
|
4321
|
+
active: false,
|
|
4322
|
+
activeIndex: undefined,
|
|
4323
|
+
hideCollapseItemTooltip: false,
|
|
4324
|
+
lastClickedItemIndex: undefined,
|
|
4325
|
+
setValue: () => { },
|
|
4326
|
+
};
|
|
4327
|
+
const MultipleTooltipContext = React__default.createContext(multipleTooltipContextDefaults);
|
|
4328
|
+
class MultipleTooltipProvider extends React__default.PureComponent {
|
|
4329
|
+
constructor() {
|
|
4330
|
+
super(...arguments);
|
|
4331
|
+
this.state = Object.assign({}, multipleTooltipContextDefaults);
|
|
4332
|
+
this.setValue = (value) => {
|
|
4333
|
+
this.setState(Object.assign({}, value));
|
|
4334
|
+
};
|
|
4335
|
+
}
|
|
4336
|
+
render() {
|
|
4337
|
+
const { children } = this.props;
|
|
4338
|
+
return (React__default.createElement(MultipleTooltipContext.Provider, { value: Object.assign(Object.assign({}, this.state), { setValue: this.setValue }) }, children));
|
|
4658
4339
|
}
|
|
4659
|
-
}
|
|
4660
|
-
return result;
|
|
4661
4340
|
}
|
|
4662
4341
|
|
|
4663
|
-
var
|
|
4342
|
+
var css_248z$j = ".g-root_theme_dark .gn-multiple-tooltip,\n.g-root_theme_dark-hc .gn-multiple-tooltip {\n --multiple-tooltip-item-bg-color: #424147;\n --multiple-tooltip-item-active-bg-color: var(--g-color-base-float-heavy);\n --multiple-tooltip-backdrop-background: linear-gradient(\n 90deg,\n #313036 0%,\n rgba(49, 48, 54, 0.3) 100%\n );\n --multiple-tooltip-backdrop-filter: blur(16px);\n}\n\n.g-root_theme_light .gn-multiple-tooltip,\n.g-root_theme_light-hc .gn-multiple-tooltip {\n --multiple-tooltip-item-bg-color: #7a7a7a;\n --multiple-tooltip-item-active-bg-color: var(--g-color-base-float-heavy);\n --multiple-tooltip-backdrop-background: linear-gradient(\n 90deg,\n #ffffff 0%,\n rgba(255, 255, 255, 0.3) 100%\n );\n --multiple-tooltip-backdrop-filter: blur(12px);\n}\n\n.gn-multiple-tooltip {\n background-color: transparent;\n box-shadow: none;\n}\n.gn-multiple-tooltip::before {\n content: \"\";\n box-shadow: none;\n position: absolute;\n width: 100%;\n height: 100%;\n z-index: -1;\n background: var(--multiple-tooltip-backdrop-background);\n filter: var(--multiple-tooltip-backdrop-filter);\n}\n.gn-multiple-tooltip__items-container {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n padding: 32px 40px 32px 12px;\n}\n.gn-multiple-tooltip__item {\n display: flex;\n box-sizing: border-box;\n height: 30px;\n padding: 8px 12px;\n background-color: var(--multiple-tooltip-item-bg-color);\n position: relative;\n border-radius: 5px;\n align-items: center;\n color: var(--g-color-text-light-primary);\n margin-bottom: 5px;\n transition: transform 100ms ease-in-out;\n}\n.gn-multiple-tooltip__item:not(.gn-multiple-tooltip__item_divider) + .gn-multiple-tooltip__item:not(.gn-multiple-tooltip__item_divider), .gn-multiple-tooltip__item:first-child {\n margin-top: 5px;\n}\n.gn-multiple-tooltip__item_divider + .gn-multiple-tooltip__item:not(.gn-multiple-tooltip__item_divider) {\n margin-top: 4px;\n}\n.gn-multiple-tooltip__item_active {\n background-color: var(--multiple-tooltip-item-active-bg-color);\n transform: translateX(-12px);\n}\n.gn-multiple-tooltip__item_divider {\n height: 15px;\n visibility: hidden;\n margin: 0;\n}";
|
|
4343
|
+
styleInject(css_248z$j);
|
|
4664
4344
|
|
|
4665
|
-
|
|
4345
|
+
const b$k = block('multiple-tooltip');
|
|
4346
|
+
const POPUP_OFFSET = [-32, 4];
|
|
4347
|
+
const POPUP_MODIFIERS = [
|
|
4348
|
+
{
|
|
4349
|
+
name: 'preventOverflow',
|
|
4350
|
+
enabled: false,
|
|
4351
|
+
},
|
|
4352
|
+
];
|
|
4353
|
+
const MultipleTooltip = ({ items, open, anchorRef, placement, }) => {
|
|
4354
|
+
const { activeIndex, hideCollapseItemTooltip } = React__default.useContext(MultipleTooltipContext);
|
|
4355
|
+
const activeItem = activeIndex === undefined ? null : items[activeIndex];
|
|
4356
|
+
return (React__default.createElement(Popup, { open: open, anchorRef: anchorRef, placement: placement, offset: POPUP_OFFSET, contentClassName: b$k(null), modifiers: POPUP_MODIFIERS },
|
|
4357
|
+
React__default.createElement("div", { className: b$k('items-container') }, items
|
|
4358
|
+
.filter(({ type = 'regular', id }) => !hideCollapseItemTooltip ||
|
|
4359
|
+
(id !== COLLAPSE_ITEM_ID && type !== 'action'))
|
|
4360
|
+
.map((item, idx) => {
|
|
4361
|
+
switch (item.type) {
|
|
4362
|
+
case 'divider':
|
|
4363
|
+
return (React__default.createElement("div", { className: b$k('item', { divider: true }), key: idx }, item.title));
|
|
4364
|
+
default:
|
|
4365
|
+
return (React__default.createElement("div", { className: b$k('item', {
|
|
4366
|
+
active: item === activeItem,
|
|
4367
|
+
}), key: idx }, item.title));
|
|
4368
|
+
}
|
|
4369
|
+
}))));
|
|
4370
|
+
};
|
|
4666
4371
|
|
|
4667
|
-
var
|
|
4372
|
+
var css_248z$i = ".gn-composite-bar {\n flex: 1 0 auto;\n width: 100%;\n min-height: 40px;\n}\n.gn-composite-bar .gn-composite-bar__root-menu-item[class] {\n background-color: transparent;\n}";
|
|
4373
|
+
styleInject(css_248z$i);
|
|
4668
4374
|
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
}
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4375
|
+
const b$j = block('composite-bar');
|
|
4376
|
+
const CompositeBarView = ({ type, items, onItemClick, collapseItems, multipleTooltip = false, }) => {
|
|
4377
|
+
const ref = useRef(null);
|
|
4378
|
+
const tooltipRef = useRef(null);
|
|
4379
|
+
const { setValue: setMultipleTooltipContextValue, active: multipleTooltipActive, activeIndex, lastClickedItemIndex, } = useContext(MultipleTooltipContext);
|
|
4380
|
+
const { compact } = useAsideHeaderContext();
|
|
4381
|
+
React__default.useEffect(() => {
|
|
4382
|
+
function handleBlurWindow() {
|
|
4383
|
+
if (multipleTooltip && multipleTooltipActive) {
|
|
4384
|
+
setMultipleTooltipContextValue({ active: false });
|
|
4385
|
+
}
|
|
4386
|
+
}
|
|
4387
|
+
window.addEventListener('blur', handleBlurWindow);
|
|
4388
|
+
return () => {
|
|
4389
|
+
window.removeEventListener('blur', handleBlurWindow);
|
|
4390
|
+
};
|
|
4391
|
+
}, [multipleTooltip, multipleTooltipActive, setMultipleTooltipContextValue]);
|
|
4392
|
+
const onTooltipMouseEnter = useCallback((e) => {
|
|
4393
|
+
if (multipleTooltip &&
|
|
4394
|
+
compact &&
|
|
4395
|
+
!multipleTooltipActive &&
|
|
4396
|
+
document.hasFocus() &&
|
|
4397
|
+
activeIndex !== lastClickedItemIndex &&
|
|
4398
|
+
e.clientX <= ASIDE_HEADER_COMPACT_WIDTH) {
|
|
4399
|
+
setMultipleTooltipContextValue === null || setMultipleTooltipContextValue === void 0 ? void 0 : setMultipleTooltipContextValue({
|
|
4400
|
+
active: true,
|
|
4401
|
+
});
|
|
4402
|
+
}
|
|
4403
|
+
}, [
|
|
4404
|
+
multipleTooltip,
|
|
4405
|
+
compact,
|
|
4406
|
+
multipleTooltipActive,
|
|
4407
|
+
activeIndex,
|
|
4408
|
+
lastClickedItemIndex,
|
|
4409
|
+
setMultipleTooltipContextValue,
|
|
4410
|
+
]);
|
|
4411
|
+
const onTooltipMouseLeave = useCallback(() => {
|
|
4412
|
+
if (multipleTooltip && multipleTooltipActive && document.hasFocus()) {
|
|
4413
|
+
setMultipleTooltipContextValue === null || setMultipleTooltipContextValue === void 0 ? void 0 : setMultipleTooltipContextValue({
|
|
4414
|
+
active: false,
|
|
4415
|
+
lastClickedItemIndex: undefined,
|
|
4416
|
+
});
|
|
4417
|
+
}
|
|
4418
|
+
}, [multipleTooltipActive, setMultipleTooltipContextValue]);
|
|
4419
|
+
const onMouseEnterByIndex = useCallback((itemIndex) => () => {
|
|
4420
|
+
if (multipleTooltip) {
|
|
4421
|
+
let multipleTooltipActiveValue = multipleTooltipActive;
|
|
4422
|
+
if (!multipleTooltipActive && itemIndex !== lastClickedItemIndex) {
|
|
4423
|
+
multipleTooltipActiveValue = true;
|
|
4424
|
+
}
|
|
4425
|
+
if (activeIndex === itemIndex &&
|
|
4426
|
+
multipleTooltipActive === multipleTooltipActiveValue) {
|
|
4427
|
+
return;
|
|
4428
|
+
}
|
|
4429
|
+
setMultipleTooltipContextValue({
|
|
4430
|
+
activeIndex: itemIndex,
|
|
4431
|
+
active: multipleTooltipActiveValue,
|
|
4432
|
+
});
|
|
4433
|
+
}
|
|
4434
|
+
}, [multipleTooltipActive, activeIndex, lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
4435
|
+
const onMouseLeave = useCallback(() => {
|
|
4436
|
+
var _a;
|
|
4437
|
+
if (compact) {
|
|
4438
|
+
(_a = ref.current) === null || _a === void 0 ? void 0 : _a.activateItem(undefined);
|
|
4439
|
+
if (multipleTooltip &&
|
|
4440
|
+
(activeIndex !== undefined || lastClickedItemIndex !== undefined)) {
|
|
4441
|
+
setMultipleTooltipContextValue({
|
|
4442
|
+
activeIndex: undefined,
|
|
4443
|
+
lastClickedItemIndex: undefined,
|
|
4444
|
+
});
|
|
4445
|
+
}
|
|
4446
|
+
}
|
|
4447
|
+
}, [activeIndex, lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
4448
|
+
const onItemClickByIndex = useCallback((itemIndex) => (item, collapsed, event) => {
|
|
4449
|
+
if (compact &&
|
|
4450
|
+
multipleTooltip &&
|
|
4451
|
+
itemIndex !== lastClickedItemIndex &&
|
|
4452
|
+
item.id !== COLLAPSE_ITEM_ID) {
|
|
4453
|
+
setMultipleTooltipContextValue({
|
|
4454
|
+
lastClickedItemIndex: itemIndex,
|
|
4455
|
+
active: false,
|
|
4456
|
+
});
|
|
4457
|
+
}
|
|
4458
|
+
onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, collapsed, event);
|
|
4459
|
+
}, [lastClickedItemIndex, setMultipleTooltipContextValue]);
|
|
4460
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
4461
|
+
React__default.createElement("div", { ref: tooltipRef, onMouseEnter: onTooltipMouseEnter, onMouseLeave: onTooltipMouseLeave },
|
|
4462
|
+
React__default.createElement(List, { ref: ref, items: items, selectedItemIndex: type === 'menu' ? getSelectedItemIndex$1(items) : undefined, itemHeight: getItemHeight$1, itemsHeight: getItemsHeight, itemClassName: b$j('root-menu-item'), virtualized: false, filterable: false, sortable: false, renderItem: (item, _isItemActive, itemIndex) => {
|
|
4463
|
+
const itemExtraProps = isMenuItem(item) ? { item } : item;
|
|
4464
|
+
const enableTooltip = isMenuItem(item)
|
|
4465
|
+
? !multipleTooltip
|
|
4466
|
+
: item.enableTooltip;
|
|
4467
|
+
return (React__default.createElement(Item$1, Object.assign({}, itemExtraProps, { enableTooltip: enableTooltip, onMouseEnter: onMouseEnterByIndex(itemIndex), onMouseLeave: onMouseLeave, onItemClick: onItemClickByIndex(itemIndex), collapseItems: collapseItems })));
|
|
4468
|
+
} })),
|
|
4469
|
+
type === 'menu' && (React__default.createElement(MultipleTooltip, { open: compact && multipleTooltip && multipleTooltipActive, anchorRef: tooltipRef, placement: ['right-start'], items: items }))));
|
|
4470
|
+
};
|
|
4471
|
+
const CompositeBar = ({ type, items, menuMoreTitle, onItemClick, multipleTooltip = false, }) => {
|
|
4472
|
+
if (items.length === 0) {
|
|
4473
|
+
return null;
|
|
4474
|
+
}
|
|
4475
|
+
let node;
|
|
4476
|
+
if (type === 'menu') {
|
|
4477
|
+
const minHeight = getItemsMinHeight(items);
|
|
4478
|
+
const collapseItem = getMoreButtonItem(menuMoreTitle);
|
|
4479
|
+
node = (React__default.createElement("div", { className: b$j({ autosizer: true }), style: { minHeight } }, items.length !== 0 && (React__default.createElement(AutoSizer, null, ({ width, height }) => {
|
|
4480
|
+
const { listItems, collapseItems } = getAutosizeListItems(items, height, collapseItem);
|
|
4481
|
+
return (React__default.createElement("div", { style: { width, height } },
|
|
4482
|
+
React__default.createElement(CompositeBarView, { type: "menu", items: listItems, onItemClick: onItemClick, collapseItems: collapseItems, multipleTooltip: multipleTooltip })));
|
|
4483
|
+
}))));
|
|
4484
|
+
}
|
|
4485
|
+
else {
|
|
4486
|
+
node = (React__default.createElement("div", { className: b$j({ subheader: true }) },
|
|
4487
|
+
React__default.createElement(CompositeBarView, { type: "subheader", items: items, onItemClick: onItemClick })));
|
|
4488
|
+
}
|
|
4489
|
+
return React__default.createElement(MultipleTooltipProvider, null, node);
|
|
4490
|
+
};
|
|
4692
4491
|
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4492
|
+
/* Used by renderContent AsideHeader prop */
|
|
4493
|
+
const RenderContent = React__default.memo(({ renderContent, size }) => {
|
|
4494
|
+
return React__default.createElement(React__default.Fragment, null, renderContent({ size }));
|
|
4495
|
+
});
|
|
4496
|
+
RenderContent.displayName = 'RenderContent';
|
|
4497
|
+
const Content = ({ size, // TODO: move to context when MobileHeader will support it
|
|
4498
|
+
className, cssSizeVariableName = '--gn-aside-header-size', renderContent, }) => {
|
|
4499
|
+
return (React__default.createElement("div", { className: className, style: Object.assign({}, { [cssSizeVariableName]: `${size}px` }) }, typeof renderContent === 'function' && (React__default.createElement(RenderContent, { size: size, renderContent: renderContent }))));
|
|
4500
|
+
};
|
|
4696
4501
|
|
|
4697
|
-
|
|
4698
|
-
|
|
4502
|
+
function fakeDisplayName(newDisplayName, Component) {
|
|
4503
|
+
const Fake = (props) => React__default.createElement(Component, Object.assign({}, props));
|
|
4504
|
+
Fake.displayName = newDisplayName;
|
|
4505
|
+
return Fake;
|
|
4506
|
+
}
|
|
4699
4507
|
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4508
|
+
const PARAM_REGEXP = /{{(.*?)}}/g;
|
|
4509
|
+
function replaceParams(keyValue, params) {
|
|
4510
|
+
let result = '';
|
|
4511
|
+
let lastIndex = (PARAM_REGEXP.lastIndex = 0);
|
|
4512
|
+
let match;
|
|
4513
|
+
while ((match = PARAM_REGEXP.exec(keyValue))) {
|
|
4514
|
+
if (lastIndex !== match.index) {
|
|
4515
|
+
result += keyValue.slice(lastIndex, match.index);
|
|
4516
|
+
}
|
|
4517
|
+
lastIndex = PARAM_REGEXP.lastIndex;
|
|
4518
|
+
const [all, key] = match;
|
|
4519
|
+
if (Object.prototype.hasOwnProperty.call(params, key)) {
|
|
4520
|
+
result += params[key];
|
|
4521
|
+
}
|
|
4522
|
+
else {
|
|
4523
|
+
result += all;
|
|
4524
|
+
}
|
|
4525
|
+
}
|
|
4526
|
+
if (lastIndex < keyValue.length) {
|
|
4527
|
+
result += keyValue.slice(lastIndex);
|
|
4528
|
+
}
|
|
4529
|
+
return result;
|
|
4714
4530
|
}
|
|
4715
4531
|
|
|
4716
|
-
var
|
|
4532
|
+
var PluralForm;
|
|
4533
|
+
(function (PluralForm) {
|
|
4534
|
+
PluralForm[PluralForm["One"] = 0] = "One";
|
|
4535
|
+
PluralForm[PluralForm["Few"] = 1] = "Few";
|
|
4536
|
+
PluralForm[PluralForm["Many"] = 2] = "Many";
|
|
4537
|
+
PluralForm[PluralForm["None"] = 3] = "None";
|
|
4538
|
+
})(PluralForm || (PluralForm = {}));
|
|
4717
4539
|
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
4728
|
-
* @example
|
|
4729
|
-
*
|
|
4730
|
-
* _.isObjectLike({});
|
|
4731
|
-
* // => true
|
|
4732
|
-
*
|
|
4733
|
-
* _.isObjectLike([1, 2, 3]);
|
|
4734
|
-
* // => true
|
|
4735
|
-
*
|
|
4736
|
-
* _.isObjectLike(_.noop);
|
|
4737
|
-
* // => false
|
|
4738
|
-
*
|
|
4739
|
-
* _.isObjectLike(null);
|
|
4740
|
-
* // => false
|
|
4741
|
-
*/
|
|
4540
|
+
function pluralizerEn (count, pluralForms) {
|
|
4541
|
+
if (count === 0) {
|
|
4542
|
+
return pluralForms.None;
|
|
4543
|
+
}
|
|
4544
|
+
if (count === 1 || count === -1) {
|
|
4545
|
+
return pluralForms.One;
|
|
4546
|
+
}
|
|
4547
|
+
return pluralForms.Many;
|
|
4548
|
+
}
|
|
4742
4549
|
|
|
4743
|
-
function
|
|
4744
|
-
|
|
4550
|
+
function pluralizerRu (count, pluralForms) {
|
|
4551
|
+
// the rules for negative numbers are the same
|
|
4552
|
+
const lastDigit = Math.abs(count % 10);
|
|
4553
|
+
const last2Digits = Math.abs(count % 100);
|
|
4554
|
+
if (count === 0) {
|
|
4555
|
+
return pluralForms.None;
|
|
4556
|
+
}
|
|
4557
|
+
if (lastDigit === 1 && last2Digits !== 11) {
|
|
4558
|
+
return pluralForms.One;
|
|
4559
|
+
}
|
|
4560
|
+
if ((lastDigit > 1 && lastDigit < 5) && (last2Digits < 10 || last2Digits > 20)) {
|
|
4561
|
+
return pluralForms.Few;
|
|
4562
|
+
}
|
|
4563
|
+
return pluralForms.Many;
|
|
4745
4564
|
}
|
|
4746
4565
|
|
|
4747
|
-
|
|
4566
|
+
class I18N {
|
|
4567
|
+
constructor(options) {
|
|
4568
|
+
this.data = {};
|
|
4569
|
+
this.lang = undefined;
|
|
4570
|
+
this.pluralizers = {
|
|
4571
|
+
en: pluralizerEn,
|
|
4572
|
+
ru: pluralizerRu,
|
|
4573
|
+
};
|
|
4574
|
+
this.logger = null;
|
|
4575
|
+
this.logger = (options === null || options === void 0 ? void 0 : options.logger) || null;
|
|
4576
|
+
}
|
|
4577
|
+
setLang(lang) {
|
|
4578
|
+
this.lang = lang;
|
|
4579
|
+
}
|
|
4580
|
+
configurePluralization(pluralizers) {
|
|
4581
|
+
this.pluralizers = Object.assign({}, this.pluralizers, pluralizers);
|
|
4582
|
+
}
|
|
4583
|
+
registerKeyset(lang, keysetName, data = {}) {
|
|
4584
|
+
if (this.data[lang] && Object.prototype.hasOwnProperty.call(this.data[lang], keysetName)) {
|
|
4585
|
+
throw new Error(`Keyset '${keysetName}' is already registered, aborting!`);
|
|
4586
|
+
}
|
|
4587
|
+
this.data[lang] = Object.assign({}, this.data[lang], { [keysetName]: data });
|
|
4588
|
+
}
|
|
4589
|
+
registerKeysets(lang, data) {
|
|
4590
|
+
Object.keys(data).forEach((keysetName) => {
|
|
4591
|
+
this.registerKeyset(lang, keysetName, data[keysetName]);
|
|
4592
|
+
});
|
|
4593
|
+
}
|
|
4594
|
+
has(keysetName, key, lang) {
|
|
4595
|
+
const languageData = this.getLanguageData(lang);
|
|
4596
|
+
return Boolean(languageData && languageData[keysetName] && languageData[keysetName][key]);
|
|
4597
|
+
}
|
|
4598
|
+
i18n(keysetName, key, params) {
|
|
4599
|
+
const languageData = this.getLanguageData(this.lang);
|
|
4600
|
+
if (typeof languageData === 'undefined') {
|
|
4601
|
+
throw new Error(`Language '${this.lang}' is not defined, make sure you call setLang for the same language you called registerKeysets for!`);
|
|
4602
|
+
}
|
|
4603
|
+
if (Object.keys(languageData).length === 0) {
|
|
4604
|
+
this.warn('Language data is empty.');
|
|
4605
|
+
return key;
|
|
4606
|
+
}
|
|
4607
|
+
const keyset = languageData[keysetName];
|
|
4608
|
+
if (!keyset) {
|
|
4609
|
+
this.warn('Keyset not found.', keysetName);
|
|
4610
|
+
return key;
|
|
4611
|
+
}
|
|
4612
|
+
if (Object.keys(keyset).length === 0) {
|
|
4613
|
+
this.warn('Keyset is empty.', keysetName);
|
|
4614
|
+
return key;
|
|
4615
|
+
}
|
|
4616
|
+
const keyValue = keyset && keyset[key];
|
|
4617
|
+
let result;
|
|
4618
|
+
if (typeof keyValue === 'undefined') {
|
|
4619
|
+
this.warn('Missing key.', keysetName, key);
|
|
4620
|
+
return key;
|
|
4621
|
+
}
|
|
4622
|
+
if (Array.isArray(keyValue)) {
|
|
4623
|
+
if (keyValue.length < 3) {
|
|
4624
|
+
this.warn('Missing required plurals', keysetName, key);
|
|
4625
|
+
return key;
|
|
4626
|
+
}
|
|
4627
|
+
const count = Number(params === null || params === void 0 ? void 0 : params.count);
|
|
4628
|
+
if (Number.isNaN(count)) {
|
|
4629
|
+
this.warn('Missing params.count for key.', keysetName, key);
|
|
4630
|
+
return key;
|
|
4631
|
+
}
|
|
4632
|
+
const pluralizer = this.getLanguagePluralizer(this.lang);
|
|
4633
|
+
result = keyValue[pluralizer(count, PluralForm)] || keyValue[PluralForm.Many];
|
|
4634
|
+
if (keyValue[PluralForm.None] === undefined) {
|
|
4635
|
+
this.warn('Missing key for 0', keysetName, key);
|
|
4636
|
+
}
|
|
4637
|
+
}
|
|
4638
|
+
else {
|
|
4639
|
+
result = keyValue;
|
|
4640
|
+
}
|
|
4641
|
+
if (params) {
|
|
4642
|
+
result = replaceParams(result, params);
|
|
4643
|
+
}
|
|
4644
|
+
return result;
|
|
4645
|
+
}
|
|
4646
|
+
keyset(keysetName) {
|
|
4647
|
+
return (key, params) => {
|
|
4648
|
+
return this.i18n(keysetName, key, params);
|
|
4649
|
+
};
|
|
4650
|
+
}
|
|
4651
|
+
warn(msg, keyset, key) {
|
|
4652
|
+
var _a;
|
|
4653
|
+
let cacheKey = '';
|
|
4654
|
+
if (keyset) {
|
|
4655
|
+
cacheKey += keyset;
|
|
4656
|
+
if (key) {
|
|
4657
|
+
cacheKey += `.${key}`;
|
|
4658
|
+
}
|
|
4659
|
+
}
|
|
4660
|
+
else {
|
|
4661
|
+
cacheKey = 'languageData';
|
|
4662
|
+
}
|
|
4663
|
+
(_a = this.logger) === null || _a === void 0 ? void 0 : _a.log(`I18n: ${msg}`, {
|
|
4664
|
+
level: 'info',
|
|
4665
|
+
logger: cacheKey,
|
|
4666
|
+
extra: {
|
|
4667
|
+
type: 'i18n'
|
|
4668
|
+
}
|
|
4669
|
+
});
|
|
4670
|
+
}
|
|
4671
|
+
getLanguageData(lang) {
|
|
4672
|
+
const langCode = lang || this.lang;
|
|
4673
|
+
return langCode ? this.data[langCode] : undefined;
|
|
4674
|
+
}
|
|
4675
|
+
getLanguagePluralizer(lang) {
|
|
4676
|
+
const pluralizer = lang ? this.pluralizers[lang] : undefined;
|
|
4677
|
+
if (!pluralizer) {
|
|
4678
|
+
this.warn(`Pluralization is not configured for language '${lang}', falling back to the english ruleset`);
|
|
4679
|
+
}
|
|
4680
|
+
return pluralizer || pluralizerEn;
|
|
4681
|
+
}
|
|
4682
|
+
}
|
|
4748
4683
|
|
|
4749
|
-
var
|
|
4750
|
-
|
|
4684
|
+
var Lang;
|
|
4685
|
+
(function (Lang) {
|
|
4686
|
+
Lang["Ru"] = "ru";
|
|
4687
|
+
Lang["En"] = "en";
|
|
4688
|
+
})(Lang || (Lang = {}));
|
|
4689
|
+
let subs = [];
|
|
4690
|
+
const config = {
|
|
4691
|
+
lang: Lang.En,
|
|
4692
|
+
};
|
|
4693
|
+
const configure = (newConfig) => {
|
|
4694
|
+
Object.assign(config, newConfig);
|
|
4695
|
+
subs.forEach((sub) => {
|
|
4696
|
+
sub(config);
|
|
4697
|
+
});
|
|
4698
|
+
};
|
|
4699
|
+
const subscribeConfigure = (sub) => {
|
|
4700
|
+
subs.push(sub);
|
|
4701
|
+
return () => {
|
|
4702
|
+
subs = subs.filter((item) => item !== sub);
|
|
4703
|
+
};
|
|
4704
|
+
};
|
|
4705
|
+
const getConfig = () => config;
|
|
4751
4706
|
|
|
4752
|
-
|
|
4753
|
-
|
|
4707
|
+
const i18n$4 = new I18N();
|
|
4708
|
+
i18n$4.setLang(getConfig().lang);
|
|
4709
|
+
subscribeConfigure((config) => {
|
|
4710
|
+
i18n$4.setLang(config.lang);
|
|
4711
|
+
});
|
|
4754
4712
|
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
* @static
|
|
4759
|
-
* @memberOf _
|
|
4760
|
-
* @since 4.0.0
|
|
4761
|
-
* @category Lang
|
|
4762
|
-
* @param {*} value The value to check.
|
|
4763
|
-
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
4764
|
-
* @example
|
|
4765
|
-
*
|
|
4766
|
-
* _.isSymbol(Symbol.iterator);
|
|
4767
|
-
* // => true
|
|
4768
|
-
*
|
|
4769
|
-
* _.isSymbol('abc');
|
|
4770
|
-
* // => false
|
|
4771
|
-
*/
|
|
4772
|
-
function isSymbol$1(value) {
|
|
4773
|
-
return typeof value == 'symbol' ||
|
|
4774
|
-
(isObjectLike(value) && baseGetTag(value) == symbolTag);
|
|
4713
|
+
function registerKeyset(data, keysetName) {
|
|
4714
|
+
Object.entries(data).forEach(([lang, keys]) => i18n$4.registerKeyset(lang, keysetName, keys));
|
|
4715
|
+
return i18n$4.keyset(keysetName);
|
|
4775
4716
|
}
|
|
4776
4717
|
|
|
4777
|
-
var
|
|
4778
|
-
|
|
4779
|
-
var
|
|
4780
|
-
|
|
4781
|
-
|
|
4718
|
+
var button_collapse$1 = "Collapse";
|
|
4719
|
+
var button_expand$1 = "Expand";
|
|
4720
|
+
var label_more$1 = "More";
|
|
4721
|
+
var en$3 = {
|
|
4722
|
+
button_collapse: button_collapse$1,
|
|
4723
|
+
button_expand: button_expand$1,
|
|
4724
|
+
label_more: label_more$1
|
|
4725
|
+
};
|
|
4782
4726
|
|
|
4783
|
-
|
|
4784
|
-
var
|
|
4727
|
+
var button_collapse = "Свернуть";
|
|
4728
|
+
var button_expand = "Развернуть";
|
|
4729
|
+
var label_more = "Ещё";
|
|
4730
|
+
var ru$3 = {
|
|
4731
|
+
button_collapse: button_collapse,
|
|
4732
|
+
button_expand: button_expand,
|
|
4733
|
+
label_more: label_more
|
|
4734
|
+
};
|
|
4785
4735
|
|
|
4786
|
-
|
|
4787
|
-
var
|
|
4736
|
+
const COMPONENT$3 = 'AsideHeader';
|
|
4737
|
+
var i18n$3 = registerKeyset({ en: en$3, ru: ru$3 }, COMPONENT$3);
|
|
4788
4738
|
|
|
4789
|
-
|
|
4790
|
-
var
|
|
4739
|
+
var _path$1;
|
|
4740
|
+
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
4741
|
+
var SvgControlMenuButton = function SvgControlMenuButton(props) {
|
|
4742
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
4743
|
+
width: 8,
|
|
4744
|
+
height: 8,
|
|
4745
|
+
viewBox: "0 0 8 8",
|
|
4746
|
+
fill: "currentColor",
|
|
4747
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4748
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
4749
|
+
d: "m.72 7.64 6.39-3.2a.5.5 0 0 0 0-.89L.72.36A.5.5 0 0 0 0 .81v6.38c0 .37.4.61.72.45Z"
|
|
4750
|
+
})));
|
|
4751
|
+
};
|
|
4752
|
+
var controlMenuButtonIcon = SvgControlMenuButton;
|
|
4791
4753
|
|
|
4792
|
-
|
|
4793
|
-
var
|
|
4754
|
+
var _path;
|
|
4755
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4756
|
+
var SvgDividerCollapsed = function SvgDividerCollapsed(props) {
|
|
4757
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
|
4758
|
+
width: 56,
|
|
4759
|
+
height: 29,
|
|
4760
|
+
viewBox: "0 0 56 29",
|
|
4761
|
+
fill: "currentColor",
|
|
4762
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4763
|
+
}, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
|
|
4764
|
+
d: "M56 0v29c-.8-1-7-6.1-17.7-8.4L13 15.7A16 16 0 0 1 0 0Z"
|
|
4765
|
+
})));
|
|
4766
|
+
};
|
|
4767
|
+
var headerDividerCollapsedIcon = SvgDividerCollapsed;
|
|
4794
4768
|
|
|
4795
|
-
|
|
4796
|
-
|
|
4769
|
+
var css_248z$h = ".g-root {\n --gn-aside-header-background-color: var(--g-color-base-warning-light);\n --gn-aside-header-collapse-button-divider-line-color: var(\n --gn-aside-header-subheader-divider-line-color\n );\n --gn-aside-header-footer-item-icon-color: var(--g-color-text-primary);\n --gn-aside-header-subheader-item-icon-color: var(--g-color-text-primary);\n --gn-aside-header-item-icon-background-size: 38px;\n}\n\n.g-root_theme_light,\n.g-root_theme_light-hc {\n --gn-aside-header-divider-line-color: transparent;\n --gn-aside-header-subheader-divider-line-color: var(--g-color-line-generic);\n}\n\n.g-root_theme_dark,\n.g-root_theme_dark-hc {\n --gn-aside-header-divider-line-color: var(--g-color-line-generic-solid);\n --gn-aside-header-subheader-divider-line-color: var(--g-color-line-generic-solid);\n}\n\n.gn-aside-header {\n --gn-aside-header-min-width: 56px;\n height: 100%;\n width: 100%;\n position: relative;\n background-color: var(--g-color-base-background);\n}\n.gn-aside-header__aside {\n position: sticky;\n top: 0;\n left: 0;\n height: 100vh;\n width: inherit;\n display: flex;\n flex-direction: column;\n background-color: var(--g-color-base-background);\n z-index: 100;\n box-sizing: border-box;\n}\n.gn-aside-header__aside::after {\n position: absolute;\n top: 0;\n right: 0;\n z-index: 2;\n width: 1px;\n height: 100%;\n content: \"\";\n background-color: var(--gn-aside-header-divider-line-color);\n}\n.gn-aside-header__aside-popup-anchor {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n z-index: 1;\n}\n.gn-aside-header__aside-content {\n --gradient-height: 334px;\n display: flex;\n flex-direction: column;\n overflow-x: hidden;\n width: inherit;\n height: inherit;\n position: relative;\n z-index: 2;\n user-select: none;\n}\n.gn-aside-header__aside-content::after {\n position: absolute;\n top: 0;\n right: -100px;\n bottom: 0;\n width: 100px;\n content: \"\";\n box-shadow: 0px 0px 4px rgba(0, 0, 0, 0.1), 0px 0px 24px rgba(0, 0, 0, 0.08);\n}\n.gn-aside-header__aside-content > .gn-aside-header-logo {\n margin: 8px 0;\n}\n.gn-aside-header__aside-content_with-decoration {\n background: linear-gradient(180deg, var(--gn-aside-header-background-color) calc(var(--gradient-height) * 0.33), transparent calc(var(--gradient-height) * 0.88));\n}\n.gn-aside-header_compact .gn-aside-header__aside-content {\n background: transparent;\n}\n.gn-aside-header__header {\n --gn-aside-header-header-divider-height: 29px;\n position: relative;\n z-index: 1;\n flex: none;\n box-sizing: border-box;\n width: 100%;\n padding-top: 8px;\n padding-bottom: 22px;\n}\n.gn-aside-header__header .gn-aside-header__header-divider {\n position: absolute;\n bottom: 0;\n left: 0;\n z-index: -2;\n display: none;\n color: var(--gn-aside-header-background-color);\n}\n.gn-aside-header__header_with-decoration::before {\n position: absolute;\n top: 0;\n left: 0;\n z-index: -2;\n display: none;\n width: 100%;\n height: calc(100% - var(--gn-aside-header-header-divider-height));\n content: \"\";\n background-color: var(--gn-aside-header-background-color);\n}\n.gn-aside-header__header::after {\n position: absolute;\n bottom: 12px;\n left: 0;\n z-index: -2;\n width: 100%;\n height: 1px;\n content: \"\";\n background-color: var(--gn-aside-header-subheader-divider-line-color);\n}\n.gn-aside-header_compact .gn-aside-header__header::before {\n display: block;\n}\n.gn-aside-header_compact .gn-aside-header__header_with-decoration .gn-aside-header__header-divider {\n display: block;\n}\n.gn-aside-header_compact .gn-aside-header__header_with-decoration::after {\n display: none;\n}\n.gn-aside-header__menu-items {\n flex-grow: 1;\n}\n.gn-aside-header__footer {\n flex-shrink: 0;\n width: 100%;\n margin: 8px 0;\n display: flex;\n flex-direction: column;\n}\n.gn-aside-header__panels {\n z-index: 98;\n position: fixed;\n left: 0;\n right: 0;\n bottom: 0;\n top: 0;\n overflow: auto;\n}\n.gn-aside-header__panel {\n height: 100%;\n}\n.gn-aside-header__pane-container {\n display: flex;\n outline: none;\n overflow: visible;\n user-select: text;\n flex-direction: row;\n}\n.gn-aside-header__content {\n width: calc(100% - var(--gn-aside-header-size));\n z-index: 95;\n}\n.gn-aside-header__collapse-button {\n --yc-button-background-color-hover: transparent;\n overflow: hidden;\n box-sizing: border-box;\n flex: none;\n width: 100%;\n height: 20px;\n border-top: 1px solid var(--gn-aside-header-collapse-button-divider-line-color);\n margin-top: auto;\n}\n.gn-aside-header__collapse-button > .yc-button__text {\n display: flex;\n align-items: center;\n justify-content: center;\n height: 20px;\n}\n.gn-aside-header__collapse-button:not(.gn-aside-header__collapse-button_compact) .gn-aside-header__collapse-icon {\n transform: rotate(180deg);\n}\n.gn-aside-header__collapse-button .gn-aside-header__collapse-icon {\n color: var(--g-color-text-secondary);\n}\n.gn-aside-header__collapse-button:hover .gn-aside-header__collapse-icon {\n color: var(--g-color-text-primary);\n}";
|
|
4770
|
+
styleInject(css_248z$h);
|
|
4797
4771
|
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4772
|
+
// TODO: remove temporary fix for expand button
|
|
4773
|
+
const NotIcon = fakeDisplayName('NotIcon', Icon);
|
|
4774
|
+
const b$i = block('aside-header');
|
|
4775
|
+
class AsideHeader extends React__default.Component {
|
|
4776
|
+
constructor() {
|
|
4777
|
+
super(...arguments);
|
|
4778
|
+
this.asideRef = React__default.createRef();
|
|
4779
|
+
this.renderFirstPane = (size) => {
|
|
4780
|
+
const { menuItems, panelItems, headerDecoration, multipleTooltip, menuMoreTitle } = this.props;
|
|
4781
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
4782
|
+
React__default.createElement("div", { className: b$i('aside'), style: { width: size } },
|
|
4783
|
+
React__default.createElement("div", { className: b$i('aside-popup-anchor'), ref: this.asideRef }),
|
|
4784
|
+
React__default.createElement("div", { className: b$i('aside-content', { ['with-decoration']: headerDecoration }) },
|
|
4785
|
+
this.renderHeader(),
|
|
4786
|
+
(menuItems === null || menuItems === void 0 ? void 0 : menuItems.length) ? (React__default.createElement(CompositeBar, { type: "menu", items: menuItems, menuMoreTitle: menuMoreTitle !== null && menuMoreTitle !== void 0 ? menuMoreTitle : i18n$3('label_more'), onItemClick: this.onItemClick, multipleTooltip: multipleTooltip })) : (React__default.createElement("div", { className: b$i('menu-items') })),
|
|
4787
|
+
this.renderFooter(size),
|
|
4788
|
+
this.renderCollapseButton())),
|
|
4789
|
+
panelItems && this.renderPanels(size)));
|
|
4790
|
+
};
|
|
4791
|
+
this.renderSecondPane = (size) => {
|
|
4792
|
+
return (React__default.createElement(Content, { size: size, renderContent: this.props.renderContent, className: b$i('content') }));
|
|
4793
|
+
};
|
|
4794
|
+
this.renderLogo = () => React__default.createElement(Logo$1, Object.assign({}, this.props.logo, { onClick: this.onLogoClick }));
|
|
4795
|
+
this.renderHeader = () => (React__default.createElement("div", { className: b$i('header', { ['with-decoration']: this.props.headerDecoration }) },
|
|
4796
|
+
this.renderLogo(),
|
|
4797
|
+
React__default.createElement(CompositeBar, { type: "subheader", items: this.props.subheaderItems, onItemClick: this.onItemClick }),
|
|
4798
|
+
React__default.createElement(Icon, { data: headerDividerCollapsedIcon, className: b$i('header-divider'), width: ASIDE_HEADER_COMPACT_WIDTH, height: "29" })));
|
|
4799
|
+
this.renderFooter = (size) => {
|
|
4800
|
+
const { renderFooter, compact } = this.props;
|
|
4801
|
+
return (React__default.createElement("div", { className: b$i('footer') }, renderFooter === null || renderFooter === void 0 ? void 0 : renderFooter({
|
|
4802
|
+
size,
|
|
4803
|
+
compact,
|
|
4804
|
+
asideRef: this.asideRef,
|
|
4805
|
+
})));
|
|
4806
|
+
};
|
|
4807
|
+
this.renderPanels = (size) => {
|
|
4808
|
+
const { panelItems } = this.props;
|
|
4809
|
+
return (React__default.createElement(Drawer, { className: b$i('panels'), onVeilClick: this.onCloseDrawer, onEscape: this.onCloseDrawer, style: { left: size } }, panelItems.map((item) => (React__default.createElement(DrawerItem, Object.assign({ key: item.id }, item))))));
|
|
4810
|
+
};
|
|
4811
|
+
this.renderCollapseButton = () => {
|
|
4812
|
+
const { expandTitle, collapseTitle, compact } = this.props;
|
|
4813
|
+
const buttonTitle = compact
|
|
4814
|
+
? expandTitle || i18n$3('button_expand')
|
|
4815
|
+
: collapseTitle || i18n$3('button_collapse');
|
|
4816
|
+
return (React__default.createElement(Button, { className: b$i('collapse-button', { compact }), view: "flat", onClick: this.onCollapseButtonClick, title: buttonTitle },
|
|
4817
|
+
React__default.createElement(NotIcon, { data: controlMenuButtonIcon, className: b$i('collapse-icon'), width: "16", height: "10" })));
|
|
4818
|
+
};
|
|
4819
|
+
this.onCollapseButtonClick = () => {
|
|
4820
|
+
var _a, _b;
|
|
4821
|
+
(_b = (_a = this.props).onChangeCompact) === null || _b === void 0 ? void 0 : _b.call(_a, !this.props.compact);
|
|
4822
|
+
};
|
|
4823
|
+
this.onCloseDrawer = () => {
|
|
4824
|
+
var _a, _b;
|
|
4825
|
+
(_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4826
|
+
};
|
|
4827
|
+
this.onItemClick = (item, collapsed, event) => {
|
|
4828
|
+
var _a, _b, _c;
|
|
4829
|
+
(_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4830
|
+
(_c = item.onItemClick) === null || _c === void 0 ? void 0 : _c.call(item, item, collapsed, event);
|
|
4831
|
+
};
|
|
4832
|
+
this.onLogoClick = (event) => {
|
|
4833
|
+
var _a, _b, _c, _d;
|
|
4834
|
+
(_b = (_a = this.props).onClosePanel) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
4835
|
+
(_d = (_c = this.props.logo).onClick) === null || _d === void 0 ? void 0 : _d.call(_c, event);
|
|
4836
|
+
};
|
|
4837
|
+
}
|
|
4838
|
+
render() {
|
|
4839
|
+
const { className, compact } = this.props;
|
|
4840
|
+
const size = compact ? ASIDE_HEADER_COMPACT_WIDTH : ASIDE_HEADER_EXPANDED_WIDTH;
|
|
4841
|
+
return (React__default.createElement(AsideHeaderContextProvider, { value: { compact, size } },
|
|
4842
|
+
React__default.createElement("div", { className: b$i({ compact }, className) },
|
|
4843
|
+
React__default.createElement("div", { className: b$i('pane-container') },
|
|
4844
|
+
this.renderFirstPane(size),
|
|
4845
|
+
this.renderSecondPane(size)))));
|
|
4846
|
+
}
|
|
4840
4847
|
}
|
|
4848
|
+
AsideHeader.defaultProps = {
|
|
4849
|
+
panelItems: [],
|
|
4850
|
+
subheaderItems: [],
|
|
4851
|
+
menuItems: [],
|
|
4852
|
+
headerDecoration: true,
|
|
4853
|
+
};
|
|
4841
4854
|
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
var isObject = isObject_1,
|
|
4845
|
-
now = now_1,
|
|
4846
|
-
toNumber = toNumber_1;
|
|
4847
|
-
|
|
4848
|
-
/** Error message constants. */
|
|
4849
|
-
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
4855
|
+
/******************************************************************************
|
|
4856
|
+
Copyright (c) Microsoft Corporation.
|
|
4850
4857
|
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
nativeMin = Math.min;
|
|
4858
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4859
|
+
purpose with or without fee is hereby granted.
|
|
4854
4860
|
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
* calls to the debounced function return the result of the last `func`
|
|
4864
|
-
* invocation.
|
|
4865
|
-
*
|
|
4866
|
-
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4867
|
-
* invoked on the trailing edge of the timeout only if the debounced function
|
|
4868
|
-
* is invoked more than once during the `wait` timeout.
|
|
4869
|
-
*
|
|
4870
|
-
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4871
|
-
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4872
|
-
*
|
|
4873
|
-
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4874
|
-
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
4875
|
-
*
|
|
4876
|
-
* @static
|
|
4877
|
-
* @memberOf _
|
|
4878
|
-
* @since 0.1.0
|
|
4879
|
-
* @category Function
|
|
4880
|
-
* @param {Function} func The function to debounce.
|
|
4881
|
-
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
4882
|
-
* @param {Object} [options={}] The options object.
|
|
4883
|
-
* @param {boolean} [options.leading=false]
|
|
4884
|
-
* Specify invoking on the leading edge of the timeout.
|
|
4885
|
-
* @param {number} [options.maxWait]
|
|
4886
|
-
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
4887
|
-
* @param {boolean} [options.trailing=true]
|
|
4888
|
-
* Specify invoking on the trailing edge of the timeout.
|
|
4889
|
-
* @returns {Function} Returns the new debounced function.
|
|
4890
|
-
* @example
|
|
4891
|
-
*
|
|
4892
|
-
* // Avoid costly calculations while the window size is in flux.
|
|
4893
|
-
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
4894
|
-
*
|
|
4895
|
-
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
4896
|
-
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
4897
|
-
* 'leading': true,
|
|
4898
|
-
* 'trailing': false
|
|
4899
|
-
* }));
|
|
4900
|
-
*
|
|
4901
|
-
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
4902
|
-
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
4903
|
-
* var source = new EventSource('/stream');
|
|
4904
|
-
* jQuery(source).on('message', debounced);
|
|
4905
|
-
*
|
|
4906
|
-
* // Cancel the trailing debounced invocation.
|
|
4907
|
-
* jQuery(window).on('popstate', debounced.cancel);
|
|
4908
|
-
*/
|
|
4909
|
-
function debounce(func, wait, options) {
|
|
4910
|
-
var lastArgs,
|
|
4911
|
-
lastThis,
|
|
4912
|
-
maxWait,
|
|
4913
|
-
result,
|
|
4914
|
-
timerId,
|
|
4915
|
-
lastCallTime,
|
|
4916
|
-
lastInvokeTime = 0,
|
|
4917
|
-
leading = false,
|
|
4918
|
-
maxing = false,
|
|
4919
|
-
trailing = true;
|
|
4861
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
4862
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
4863
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
4864
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
4865
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
4866
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
4867
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
4868
|
+
***************************************************************************** */
|
|
4920
4869
|
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
if (
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4870
|
+
function __rest(s, e) {
|
|
4871
|
+
var t = {};
|
|
4872
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4873
|
+
t[p] = s[p];
|
|
4874
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
4875
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
4876
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
4877
|
+
t[p[i]] = s[p[i]];
|
|
4878
|
+
}
|
|
4879
|
+
return t;
|
|
4880
|
+
}
|
|
4931
4881
|
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4882
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
4883
|
+
var e = new Error(message);
|
|
4884
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
4885
|
+
};
|
|
4935
4886
|
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
result = func.apply(thisArg, args);
|
|
4939
|
-
return result;
|
|
4940
|
-
}
|
|
4887
|
+
var css_248z$g = ".gn-footer-item {\n width: 100%;\n height: 40px;\n}";
|
|
4888
|
+
styleInject(css_248z$g);
|
|
4941
4889
|
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
// Invoke the leading edge.
|
|
4948
|
-
return leading ? invokeFunc(time) : result;
|
|
4949
|
-
}
|
|
4890
|
+
const b$h = block('footer-item');
|
|
4891
|
+
const FooterItem$1 = (_a) => {
|
|
4892
|
+
var { item } = _a, props = __rest(_a, ["item"]);
|
|
4893
|
+
return (React__default.createElement(Item$1, Object.assign({}, props, { item: Object.assign({ iconSize: ASIDE_HEADER_ICON_SIZE }, item), className: b$h({ compact: props.compact }), onItemClick: item.onItemClick, onItemClickCapture: item.onItemClickCapture })));
|
|
4894
|
+
};
|
|
4950
4895
|
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
timeSinceLastInvoke = time - lastInvokeTime,
|
|
4954
|
-
timeWaiting = wait - timeSinceLastCall;
|
|
4896
|
+
var css_248z$f = ".gn-action-bar-group {\n display: flex;\n flex-flow: row nowrap;\n align-items: center;\n justify-content: flex-start;\n margin: 0;\n padding: 0;\n}\n.gn-action-bar-group_pull_left {\n margin-left: 0;\n margin-right: auto;\n}\n.gn-action-bar-group_pull_right {\n margin-left: auto;\n margin-right: 0;\n}\n.gn-action-bar-group_pull_center {\n margin-left: auto;\n margin-right: auto;\n}";
|
|
4897
|
+
styleInject(css_248z$f);
|
|
4955
4898
|
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4899
|
+
const b$g = block('action-bar-group');
|
|
4900
|
+
const ActionBarGroup = ({ children, className, pull }) => {
|
|
4901
|
+
return (React__default.createElement("ul", { className: b$g({ pull }, className), role: "group" }, children));
|
|
4902
|
+
};
|
|
4903
|
+
ActionBarGroup.displayName = 'ActionBar.Group';
|
|
4960
4904
|
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
timeSinceLastInvoke = time - lastInvokeTime;
|
|
4905
|
+
var css_248z$e = ".gn-action-bar-item {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n.gn-action-bar-item_pull_left {\n margin-left: 0;\n margin-right: auto;\n}\n.gn-action-bar-item_pull_right {\n margin-left: auto;\n margin-right: 0;\n}\n.gn-action-bar-item_pull_center {\n margin-left: auto;\n margin-right: auto;\n}\n.gn-action-bar-item + .gn-action-bar-item_spacing {\n margin-left: 8px;\n}";
|
|
4906
|
+
styleInject(css_248z$e);
|
|
4964
4907
|
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
}
|
|
4908
|
+
const b$f = block('action-bar-item');
|
|
4909
|
+
const ActionBarItem = ({ children, className, pull, spacing = true }) => {
|
|
4910
|
+
return React__default.createElement("li", { className: b$f({ pull, spacing }, className) }, children);
|
|
4911
|
+
};
|
|
4912
|
+
ActionBarItem.displayName = 'ActionBar.Item';
|
|
4971
4913
|
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
if (shouldInvoke(time)) {
|
|
4975
|
-
return trailingEdge(time);
|
|
4976
|
-
}
|
|
4977
|
-
// Restart the timer.
|
|
4978
|
-
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
4979
|
-
}
|
|
4914
|
+
var css_248z$d = ".gn-action-bar-section {\n display: flex;\n flex-flow: row nowrap;\n justify-content: flex-start;\n align-items: stretch;\n}\n.gn-action-bar-section + .gn-action-bar-section {\n border-left: solid 1px var(--g-color-line-generic);\n}\n.gn-action-bar-section_type_primary {\n flex: 1 1 auto;\n padding-left: 20px;\n padding-right: 20px;\n}\n.gn-action-bar-section_type_secondary {\n padding-left: 6px;\n padding-right: 6px;\n}";
|
|
4915
|
+
styleInject(css_248z$d);
|
|
4980
4916
|
|
|
4981
|
-
|
|
4982
|
-
|
|
4917
|
+
const b$e = block('action-bar-section');
|
|
4918
|
+
const ActionBarSection = ({ children, type = 'primary' }) => {
|
|
4919
|
+
return React__default.createElement("div", { className: b$e({ type }) }, children);
|
|
4920
|
+
};
|
|
4921
|
+
ActionBarSection.displayName = 'ActionBar.Section';
|
|
4983
4922
|
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4923
|
+
var css_248z$c = ".gn-action-bar-separator {\n list-style: none;\n margin: 0;\n padding: 0;\n margin-left: 6px;\n margin-right: 6px;\n border-right: solid 1px var(--g-color-line-generic);\n height: 40px;\n}";
|
|
4924
|
+
styleInject(css_248z$c);
|
|
4925
|
+
|
|
4926
|
+
const b$d = block('action-bar-separator');
|
|
4927
|
+
const ActionBarSeparator = () => {
|
|
4928
|
+
return React__default.createElement("li", { role: "separator", className: b$d() });
|
|
4929
|
+
};
|
|
4930
|
+
ActionBarSeparator.displayName = 'ActionBar.Separator';
|
|
4931
|
+
|
|
4932
|
+
var css_248z$b = ".gn-action-bar {\n box-sizing: border-box;\n height: 40px;\n border-bottom: solid 1px var(--g-color-line-generic);\n display: flex;\n flex-flow: row nowrap;\n justify-content: flex-start;\n align-items: stretch;\n}";
|
|
4933
|
+
styleInject(css_248z$b);
|
|
4934
|
+
|
|
4935
|
+
const b$c = block('action-bar');
|
|
4936
|
+
const ActionBar = ({ children, className, 'aria-label': ariaLabel }) => {
|
|
4937
|
+
return (React__default.createElement("section", { className: b$c(null, className), "aria-label": ariaLabel }, children));
|
|
4938
|
+
};
|
|
4939
|
+
ActionBar.displayName = 'ActionBar';
|
|
4940
|
+
const PublicActionBar = Object.assign(ActionBar, {
|
|
4941
|
+
Section: ActionBarSection,
|
|
4942
|
+
Group: ActionBarGroup,
|
|
4943
|
+
Item: ActionBarItem,
|
|
4944
|
+
Separator: ActionBarSeparator,
|
|
4945
|
+
});
|
|
4946
|
+
|
|
4947
|
+
var button_close$1 = "Close";
|
|
4948
|
+
var en$2 = {
|
|
4949
|
+
button_close: button_close$1
|
|
4950
|
+
};
|
|
4951
|
+
|
|
4952
|
+
var button_close = "Закрыть";
|
|
4953
|
+
var ru$2 = {
|
|
4954
|
+
button_close: button_close
|
|
4955
|
+
};
|
|
4956
|
+
|
|
4957
|
+
const COMPONENT$2 = 'Title';
|
|
4958
|
+
var i18n$2 = registerKeyset({ en: en$2, ru: ru$2 }, COMPONENT$2);
|
|
4959
|
+
|
|
4960
|
+
var css_248z$a = ".gn-title {\n box-sizing: border-box;\n padding: 14px 10px 14px 20px;\n min-height: 64px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n}\n.gn-title_separator {\n border-bottom: 1px solid var(--g-color-line-generic);\n}\n.gn-title__text {\n margin: 0;\n margin-right: 20px;\n}";
|
|
4961
|
+
styleInject(css_248z$a);
|
|
4962
|
+
|
|
4963
|
+
const b$b = block('title');
|
|
4964
|
+
const Title = ({ children, closeIconSize = 23, hasSeparator, closeTitle = i18n$2('button_close'), onClose, }) => {
|
|
4965
|
+
return (React__default.createElement("div", { className: b$b({ separator: hasSeparator }) },
|
|
4966
|
+
React__default.createElement(Text, { className: b$b('text'), as: 'h3', variant: 'subheader-3' }, children),
|
|
4967
|
+
onClose && (React__default.createElement(Button, { onClick: onClose, view: "flat", size: "l", extraProps: {
|
|
4968
|
+
'aria-label': closeTitle,
|
|
4969
|
+
} },
|
|
4970
|
+
React__default.createElement(Icon, { data: Xmark, size: closeIconSize })))));
|
|
4971
|
+
};
|
|
4972
|
+
Title.displayName = 'Title';
|
|
4973
|
+
|
|
4974
|
+
function flattenHotkeyGroups(hotkeys) {
|
|
4975
|
+
const result = [];
|
|
4976
|
+
for (const hotkeysGroup of hotkeys) {
|
|
4977
|
+
result.push({
|
|
4978
|
+
title: hotkeysGroup.title,
|
|
4979
|
+
group: true,
|
|
4980
|
+
});
|
|
4981
|
+
result.push(...hotkeysGroup.items);
|
|
4988
4982
|
}
|
|
4989
|
-
lastArgs = lastThis = undefined;
|
|
4990
4983
|
return result;
|
|
4991
|
-
|
|
4984
|
+
}
|
|
4992
4985
|
|
|
4993
|
-
|
|
4994
|
-
if (
|
|
4995
|
-
|
|
4986
|
+
function filterHotkeys(hotkeys, filter) {
|
|
4987
|
+
if (filter) {
|
|
4988
|
+
const result = [];
|
|
4989
|
+
const normalizedFilter = filter.toLowerCase();
|
|
4990
|
+
for (const hotkeysBlock of hotkeys) {
|
|
4991
|
+
const filteredItems = hotkeysBlock.items.filter((item) => item.title.toLowerCase().includes(normalizedFilter));
|
|
4992
|
+
if (filteredItems.length > 0) {
|
|
4993
|
+
result.push(Object.assign(Object.assign({}, hotkeysBlock), { items: filteredItems }));
|
|
4994
|
+
}
|
|
4995
|
+
}
|
|
4996
|
+
return result;
|
|
4996
4997
|
}
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
}
|
|
4998
|
+
return hotkeys;
|
|
4999
|
+
}
|
|
5000
5000
|
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
}
|
|
5001
|
+
var css_248z$9 = ".gn-hotkeys-panel {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n --hotkeys-panel-width: 400px;\n --hotkeys-panel-vertical-padding: 18px;\n --hotkeys-panel-horizontal-padding: 24px;\n}\n.gn-hotkeys-panel__drawer-item {\n width: var(--hotkeys-panel-width);\n padding: var(--hotkeys-panel-vertical-padding) 0;\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n}\n.gn-hotkeys-panel__title {\n margin: 0 var(--hotkeys-panel-horizontal-padding) 16px var(--hotkeys-panel-horizontal-padding);\n}\n.gn-hotkeys-panel__search {\n padding: 0 var(--hotkeys-panel-horizontal-padding);\n margin-bottom: 14px;\n}\n.gn-hotkeys-panel__list {\n flex: 1;\n overflow-y: auto;\n}\n.gn-hotkeys-panel__item {\n height: auto;\n padding: 8px var(--hotkeys-panel-horizontal-padding);\n}\n.gn-hotkeys-panel__item.yc-list__item_active {\n background: inherit;\n}\n.gn-hotkeys-panel__item-content {\n display: flex;\n align-items: baseline;\n justify-content: space-between;\n width: 100%;\n font-size: var(--g-text-body-1-font-size);\n line-height: var(--g-text-body-1-line-height);\n color: var(--g-color-text-primary);\n}\n.gn-hotkeys-panel__item-content_group {\n font-size: var(--g-text-body-2-font-size);\n font-weight: 500;\n line-height: var(--g-text-body-2-line-height);\n}\n.gn-hotkeys-panel__hotkey {\n color: var(--g-color-text-complementary);\n}";
|
|
5002
|
+
styleInject(css_248z$9);
|
|
5004
5003
|
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5004
|
+
const b$a = block('hotkeys-panel');
|
|
5005
|
+
function HotkeysPanel(_a) {
|
|
5006
|
+
var { visible, onClose, leftOffset, topOffset, className, preventScrollBody, hotkeys, itemClassName, filterPlaceholder, title, emptyState } = _a, listProps = __rest(_a, ["visible", "onClose", "leftOffset", "topOffset", "className", "preventScrollBody", "hotkeys", "itemClassName", "filterPlaceholder", "title", "emptyState"]);
|
|
5007
|
+
const [filter, setFilter] = useState('');
|
|
5008
|
+
const hotkeysList = useMemo(() => {
|
|
5009
|
+
const filteredHotkeys = filterHotkeys(hotkeys, filter);
|
|
5010
|
+
return flattenHotkeyGroups(filteredHotkeys);
|
|
5011
|
+
}, [hotkeys, filter]);
|
|
5012
|
+
const renderItem = useCallback((item) => (React__default.createElement("div", { className: b$a('item-content', { group: item.group }), key: item.title },
|
|
5013
|
+
item.title,
|
|
5014
|
+
item.value && React__default.createElement(Hotkey, { className: b$a('hotkey'), value: item.value }))), []);
|
|
5015
|
+
const drawerItemContent = (React__default.createElement(React__default.Fragment, null,
|
|
5016
|
+
React__default.createElement("h2", { className: b$a('title') }, title),
|
|
5017
|
+
React__default.createElement(TextInput, { value: filter, onUpdate: setFilter, placeholder: filterPlaceholder, autoFocus: true, className: b$a('search') }),
|
|
5018
|
+
React__default.createElement(List, Object.assign({ className: b$a('list'), virtualized: false, filterable: false, items: hotkeysList, renderItem: renderItem, itemClassName: b$a('item', itemClassName), emptyPlaceholder: emptyState }, listProps))));
|
|
5019
|
+
return (React__default.createElement(Drawer, { className: b$a(null, className), onVeilClick: onClose, onEscape: onClose, preventScrollBody: preventScrollBody, style: {
|
|
5020
|
+
left: leftOffset,
|
|
5021
|
+
top: topOffset,
|
|
5022
|
+
} },
|
|
5023
|
+
React__default.createElement(DrawerItem, { id: "hotkeys", visible: visible, className: b$a('drawer-item'), content: drawerItemContent })));
|
|
5024
|
+
}
|
|
5008
5025
|
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5026
|
+
/**
|
|
5027
|
+
* This method returns the first argument it receives.
|
|
5028
|
+
*
|
|
5029
|
+
* @static
|
|
5030
|
+
* @since 0.1.0
|
|
5031
|
+
* @memberOf _
|
|
5032
|
+
* @category Util
|
|
5033
|
+
* @param {*} value Any value.
|
|
5034
|
+
* @returns {*} Returns `value`.
|
|
5035
|
+
* @example
|
|
5036
|
+
*
|
|
5037
|
+
* var object = { 'a': 1 };
|
|
5038
|
+
*
|
|
5039
|
+
* console.log(_.identity(object) === object);
|
|
5040
|
+
* // => true
|
|
5041
|
+
*/
|
|
5012
5042
|
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
return leadingEdge(lastCallTime);
|
|
5016
|
-
}
|
|
5017
|
-
if (maxing) {
|
|
5018
|
-
// Handle invocations in a tight loop.
|
|
5019
|
-
clearTimeout(timerId);
|
|
5020
|
-
timerId = setTimeout(timerExpired, wait);
|
|
5021
|
-
return invokeFunc(lastCallTime);
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
if (timerId === undefined) {
|
|
5025
|
-
timerId = setTimeout(timerExpired, wait);
|
|
5026
|
-
}
|
|
5027
|
-
return result;
|
|
5028
|
-
}
|
|
5029
|
-
debounced.cancel = cancel;
|
|
5030
|
-
debounced.flush = flush;
|
|
5031
|
-
return debounced;
|
|
5043
|
+
function identity(value) {
|
|
5044
|
+
return value;
|
|
5032
5045
|
}
|
|
5033
5046
|
|
|
5034
|
-
var
|
|
5047
|
+
var identity_1 = identity;
|
|
5035
5048
|
|
|
5036
5049
|
function useStableCallback(func) {
|
|
5037
5050
|
const funcRef = React.useRef();
|