@ringcentral/juno 2.31.0-hotfix.5 → 2.31.0-hotfix.6
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/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +4 -5
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.d.ts +7 -0
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.js +9 -0
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.d.ts +0 -1
- package/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +277 -197
- package/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.d.ts +3 -34
- package/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.js +0 -87
- package/components/Tabs/Tabs/MoreMenuTabs/utils/index.js +0 -2
- package/es6/components/Tabs/Tabs/MoreMenuTab/MoreMenuTab.js +4 -5
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabSentinel.js +6 -0
- package/es6/components/Tabs/Tabs/MoreMenuTabs/MoreMenuTabs.js +279 -199
- package/es6/components/Tabs/Tabs/MoreMenuTabs/utils/MoreMenuTabsUtils.js +0 -87
- package/es6/components/Tabs/Tabs/MoreMenuTabs/utils/index.js +0 -1
- package/es6/foundation/hooks/useOnReRender/useOnReRender.js +6 -3
- package/foundation/hooks/useOnReRender/useOnReRender.d.ts +1 -1
- package/foundation/hooks/useOnReRender/useOnReRender.js +5 -2
- package/package.json +1 -1
|
@@ -1,36 +1,5 @@
|
|
|
1
|
-
export declare const DEFAULT_SIZE: {
|
|
2
|
-
width: number;
|
|
3
|
-
height: number;
|
|
4
|
-
};
|
|
5
|
-
export declare const computeChildBySize: (labelArray: {
|
|
6
|
-
key: string;
|
|
7
|
-
size: number;
|
|
8
|
-
}[], fixLabel: string | undefined, limitSize: number) => {
|
|
9
|
-
plainArr: string[];
|
|
10
|
-
groupArr: string[];
|
|
11
|
-
};
|
|
12
|
-
export declare const getDomBoundingClientSize: (dom: HTMLElement | null) => {
|
|
13
|
-
width: number;
|
|
14
|
-
height: number;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
*
|
|
18
|
-
* @param keyProp React.key
|
|
19
|
-
* @param idx string
|
|
20
|
-
* @example
|
|
21
|
-
* getKey('tab_0', 0) => childIdx_0_propKey_tab_0
|
|
22
|
-
* getKey(undefined, 1) => childIdx_1
|
|
23
|
-
*/
|
|
24
|
-
export declare const getKey: (keyProp?: string | number | undefined, idx?: number | undefined) => string;
|
|
25
1
|
export declare type GroupTabInfoType = {
|
|
26
|
-
index
|
|
27
|
-
key
|
|
2
|
+
index: number;
|
|
3
|
+
key: string | number;
|
|
28
4
|
};
|
|
29
|
-
|
|
30
|
-
*
|
|
31
|
-
* @example
|
|
32
|
-
* parseKey(childIdx_1) => { index: 1 }
|
|
33
|
-
* parseKey(childIdx_1_propKey_tab_1) => { index: 1, key: tab_1 }
|
|
34
|
-
*/
|
|
35
|
-
export declare const parseKey: (key: string) => GroupTabInfoType;
|
|
36
|
-
export declare type RcTabsMoreMenuGroupInfoType = GroupTabInfoType[][];
|
|
5
|
+
export declare type RcTabsMoreMenuGroupInfoType = [GroupTabInfoType[], GroupTabInfoType[]];
|
|
@@ -1,89 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_SIZE = {
|
|
4
|
-
width: 0,
|
|
5
|
-
height: 0,
|
|
6
|
-
};
|
|
7
|
-
exports.computeChildBySize = function (labelArray, fixLabel, limitSize) {
|
|
8
|
-
var plainArr = [];
|
|
9
|
-
var groupArr = [];
|
|
10
|
-
var sumSize = 0;
|
|
11
|
-
var groupFlag = false;
|
|
12
|
-
labelArray.forEach(function (_label) {
|
|
13
|
-
var label = _label.key, size = _label.size;
|
|
14
|
-
if (groupFlag === false && sumSize + size < limitSize) {
|
|
15
|
-
sumSize += size;
|
|
16
|
-
plainArr.push(label);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
groupFlag = true;
|
|
20
|
-
groupArr.push(label);
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
if (fixLabel && groupArr.includes(fixLabel)) {
|
|
24
|
-
plainArr = [];
|
|
25
|
-
groupArr = [];
|
|
26
|
-
var fixLabelSize_1 = 0;
|
|
27
|
-
labelArray.forEach(function (_label) {
|
|
28
|
-
var label = _label.key, size = _label.size;
|
|
29
|
-
if (label === fixLabel) {
|
|
30
|
-
fixLabelSize_1 = size;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
var sumFixSize_1 = 0;
|
|
34
|
-
var groupFlag_1 = false;
|
|
35
|
-
labelArray.forEach(function (_label) {
|
|
36
|
-
var label = _label.key, size = _label.size;
|
|
37
|
-
if (label === fixLabel) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (groupFlag_1 === false && sumFixSize_1 + size < limitSize - fixLabelSize_1) {
|
|
41
|
-
sumFixSize_1 += size;
|
|
42
|
-
plainArr.push(label);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
groupFlag_1 = true;
|
|
46
|
-
groupArr.push(label);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
plainArr.push(fixLabel);
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
plainArr: plainArr,
|
|
53
|
-
groupArr: groupArr,
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
exports.getDomBoundingClientSize = function (dom) {
|
|
57
|
-
if (!dom || dom.nodeType !== 1) {
|
|
58
|
-
return exports.DEFAULT_SIZE;
|
|
59
|
-
}
|
|
60
|
-
var _a = dom.getBoundingClientRect(), width = _a.width, height = _a.height;
|
|
61
|
-
return {
|
|
62
|
-
width: width,
|
|
63
|
-
height: height,
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param keyProp React.key
|
|
69
|
-
* @param idx string
|
|
70
|
-
* @example
|
|
71
|
-
* getKey('tab_0', 0) => childIdx_0_propKey_tab_0
|
|
72
|
-
* getKey(undefined, 1) => childIdx_1
|
|
73
|
-
*/
|
|
74
|
-
exports.getKey = function (keyProp, idx) {
|
|
75
|
-
return "childIdx_" + idx + (keyProp ? "_propKey_" + keyProp : '');
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* parseKey(childIdx_1) => { index: 1 }
|
|
81
|
-
* parseKey(childIdx_1_propKey_tab_1) => { index: 1, key: tab_1 }
|
|
82
|
-
*/
|
|
83
|
-
exports.parseKey = function (key) {
|
|
84
|
-
var match = /^(?:childIdx_)(\d+)(?:_propKey_)?(.*)/gi.exec(key);
|
|
85
|
-
return {
|
|
86
|
-
index: match === null || match === void 0 ? void 0 : match[1],
|
|
87
|
-
key: match === null || match === void 0 ? void 0 : match[2].replace(/^\.\$/i, ''),
|
|
88
|
-
};
|
|
89
|
-
};
|
|
@@ -7,7 +7,6 @@ import { RcListItemIcon, RcListItemText } from '../../../List';
|
|
|
7
7
|
import { RcMenu, RcMenuItem, } from '../../../Menu';
|
|
8
8
|
import { RcTooltip } from '../../../Tooltip';
|
|
9
9
|
import { RcTab } from '../../Tab';
|
|
10
|
-
import { getKey } from '../MoreMenuTabs/utils';
|
|
11
10
|
import { MoreMenuTabStyle } from './styles';
|
|
12
11
|
var DEFAULT_MORE_MENU_TAB_LABEL = 'more_menu_tab';
|
|
13
12
|
var _MoreMenuTab = forwardRef(function (props, ref) {
|
|
@@ -43,19 +42,19 @@ var _MoreMenuTab = forwardRef(function (props, ref) {
|
|
|
43
42
|
if (!menuItems || menuItems.length === 0) {
|
|
44
43
|
return null;
|
|
45
44
|
}
|
|
46
|
-
return menuItems.map(function (item
|
|
47
|
-
var icon = item.icon, label = item.label, value = item.value, disabled = item.disabled, onClick = item.onClick, selected = item.selected, menuItemRest = __rest(item, ["icon", "label", "value", "disabled", "onClick", "selected"]);
|
|
45
|
+
return menuItems.map(function (item) {
|
|
46
|
+
var icon = item.icon, label = item.label, value = item.value, disabled = item.disabled, onClick = item.onClick, selected = item.selected, key = item.key, menuItemRest = __rest(item, ["icon", "label", "value", "disabled", "onClick", "selected", "key"]);
|
|
48
47
|
var handleClick = function (event) {
|
|
49
48
|
onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
|
|
50
49
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
51
50
|
};
|
|
52
|
-
return (React.createElement(MenuItemComponent, { key:
|
|
51
|
+
return (React.createElement(MenuItemComponent, { key: key, disabled: disabled, selected: selected, value: value, onClick: handleClick, "data-test-automation-id": menuItemRest['data-test-automation-id'] },
|
|
53
52
|
icon ? React.createElement(RcListItemIcon, null, icon) : null,
|
|
54
53
|
React.createElement(RcListItemText, { primary: label || value })));
|
|
55
54
|
});
|
|
56
55
|
}, [MenuItemComponent, menuItems, onChange]);
|
|
57
56
|
return (React.createElement(React.Fragment, null,
|
|
58
|
-
React.createElement(RcTab, __assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId })),
|
|
57
|
+
React.createElement(RcTab, __assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId, "data-tab-more-button": "" })),
|
|
59
58
|
React.createElement(RcMenu, __assign({ autoClose: true }, MenuPropsRest, { id: menuId, anchorEl: anchorEl, open: open, variant: "menu", onClose: handleMenuClose }), MenuList)));
|
|
60
59
|
});
|
|
61
60
|
/** inner component */
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
export var MoreMenuTabSentinel = forwardRef(function (props, ref) {
|
|
3
|
+
var onFocus = props.onFocus, id = props.id;
|
|
4
|
+
return (React.createElement("div", { ref: ref, "aria-hidden": true, style: { position: 'absolute', top: 0, left: 0, height: 0, width: 0 }, tabIndex: -1, "data-tab-sentinel": id, onFocus: onFocus }));
|
|
5
|
+
});
|
|
6
|
+
MoreMenuTabSentinel.displayName = 'MoreMenuTabSentinel';
|