@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
|
@@ -9,7 +9,6 @@ var List_1 = require("../../../List");
|
|
|
9
9
|
var Menu_1 = require("../../../Menu");
|
|
10
10
|
var Tooltip_1 = require("../../../Tooltip");
|
|
11
11
|
var Tab_1 = require("../../Tab");
|
|
12
|
-
var utils_1 = require("../MoreMenuTabs/utils");
|
|
13
12
|
var styles_1 = require("./styles");
|
|
14
13
|
var DEFAULT_MORE_MENU_TAB_LABEL = 'more_menu_tab';
|
|
15
14
|
exports.DEFAULT_MORE_MENU_TAB_LABEL = DEFAULT_MORE_MENU_TAB_LABEL;
|
|
@@ -46,19 +45,19 @@ var _MoreMenuTab = react_1.forwardRef(function (props, ref) {
|
|
|
46
45
|
if (!menuItems || menuItems.length === 0) {
|
|
47
46
|
return null;
|
|
48
47
|
}
|
|
49
|
-
return menuItems.map(function (item
|
|
50
|
-
var icon = item.icon, label = item.label, value = item.value, disabled = item.disabled, onClick = item.onClick, selected = item.selected, menuItemRest = tslib_1.__rest(item, ["icon", "label", "value", "disabled", "onClick", "selected"]);
|
|
48
|
+
return menuItems.map(function (item) {
|
|
49
|
+
var icon = item.icon, label = item.label, value = item.value, disabled = item.disabled, onClick = item.onClick, selected = item.selected, key = item.key, menuItemRest = tslib_1.__rest(item, ["icon", "label", "value", "disabled", "onClick", "selected", "key"]);
|
|
51
50
|
var handleClick = function (event) {
|
|
52
51
|
onChange === null || onChange === void 0 ? void 0 : onChange(event, value);
|
|
53
52
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
54
53
|
};
|
|
55
|
-
return (react_1.default.createElement(MenuItemComponent, { key:
|
|
54
|
+
return (react_1.default.createElement(MenuItemComponent, { key: key, disabled: disabled, selected: selected, value: value, onClick: handleClick, "data-test-automation-id": menuItemRest['data-test-automation-id'] },
|
|
56
55
|
icon ? react_1.default.createElement(List_1.RcListItemIcon, null, icon) : null,
|
|
57
56
|
react_1.default.createElement(List_1.RcListItemText, { primary: label || value })));
|
|
58
57
|
});
|
|
59
58
|
}, [MenuItemComponent, menuItems, onChange]);
|
|
60
59
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
61
|
-
react_1.default.createElement(Tab_1.RcTab, tslib_1.__assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId })),
|
|
60
|
+
react_1.default.createElement(Tab_1.RcTab, tslib_1.__assign({}, rest, { ref: ref, onClick: handleTabClick, label: MoreIcon, value: DEFAULT_MORE_MENU_TAB_LABEL, "aria-haspopup": "true", "aria-controls": menuId, "data-tab-more-button": "" })),
|
|
62
61
|
react_1.default.createElement(Menu_1.RcMenu, tslib_1.__assign({ autoClose: true }, MenuPropsRest, { id: menuId, anchorEl: anchorEl, open: open, variant: "menu", onClose: handleMenuClose }), MenuList)));
|
|
63
62
|
});
|
|
64
63
|
/** inner component */
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { FocusEventHandler } from 'react';
|
|
2
|
+
export declare type MoreMenuTabSentinelProps = {
|
|
3
|
+
onFocus: FocusEventHandler<HTMLDivElement>;
|
|
4
|
+
id: string;
|
|
5
|
+
value: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const MoreMenuTabSentinel: React.ForwardRefExoticComponent<MoreMenuTabSentinelProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var tslib_1 = require("tslib");
|
|
4
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
+
exports.MoreMenuTabSentinel = react_1.forwardRef(function (props, ref) {
|
|
6
|
+
var onFocus = props.onFocus, id = props.id;
|
|
7
|
+
return (react_1.default.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 }));
|
|
8
|
+
});
|
|
9
|
+
exports.MoreMenuTabSentinel.displayName = 'MoreMenuTabSentinel';
|
|
@@ -7,7 +7,6 @@ declare type MoreButtonProps = {
|
|
|
7
7
|
onGroupInfoChange?: (info: RcTabsMoreMenuGroupInfoType) => void;
|
|
8
8
|
} & RcBaseProps<MoreMenuTabProps, 'size' | 'menuItems' | 'onChange' | 'orientation' | 'ref' | 'innerRef'>;
|
|
9
9
|
declare type MoreMenuTabsProps = RcTabsProps;
|
|
10
|
-
export declare const findChildrenByKey: (childrenProp: React.ReactNode, key: string) => undefined;
|
|
11
10
|
/** inner component */
|
|
12
11
|
declare const MoreMenuTabs: import("styled-components").StyledComponentClass<Pick<RcTabsProps, "key" | "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "orientation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "action" | "buttonRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "centered" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "MoreButtonProps" | "resizeThrottleTime"> & React.RefAttributes<any>, import("../../../../foundation").RcTheme, Pick<Pick<RcTabsProps, "key" | "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "orientation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "action" | "buttonRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "centered" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "MoreButtonProps" | "resizeThrottleTime"> & React.RefAttributes<any>, "ref" | "key" | "form" | "className" | "color" | "id" | "lang" | "name" | "style" | "type" | "role" | "tabIndex" | "orientation" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "slot" | "title" | "classes" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "placeholder" | "spellCheck" | "translate" | "radioGroup" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "size" | "value" | "variant" | "innerRef" | "action" | "buttonRef" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "onFocusVisible" | "TouchRippleProps" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "centered" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "MoreButtonProps" | "resizeThrottleTime"> & {
|
|
13
12
|
theme?: import("../../../../foundation").RcTheme | undefined;
|
|
@@ -1,232 +1,312 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var react_1 = tslib_1.__importStar(require("react"));
|
|
5
|
-
var isEqual_1 = tslib_1.__importDefault(require("lodash/isEqual"));
|
|
6
4
|
var Tabs_1 = tslib_1.__importDefault(require("@material-ui/core/Tabs"));
|
|
5
|
+
var react_1 = tslib_1.__importStar(require("react"));
|
|
7
6
|
var foundation_1 = require("../../../../foundation");
|
|
8
7
|
var MoreMenuTab_1 = require("../MoreMenuTab");
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
var MoreMenuTabSentinel_1 = require("./MoreMenuTabSentinel");
|
|
9
|
+
// with of more button with a icon
|
|
10
|
+
var basicMoreButtonSize = 44;
|
|
11
|
+
var getTabsInfoFromChildren = function (children) {
|
|
12
|
+
var childrenInfo = react_1.default.Children.map(children, function (child, index) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
if (react_1.isValidElement(child)) {
|
|
15
|
+
var key = (_a = child.key) !== null && _a !== void 0 ? _a : index;
|
|
16
|
+
return {
|
|
17
|
+
index: index,
|
|
18
|
+
key: key,
|
|
19
|
+
value: (_b = child.props.value) !== null && _b !== void 0 ? _b : key,
|
|
20
|
+
element: child,
|
|
21
|
+
};
|
|
18
22
|
}
|
|
23
|
+
return null;
|
|
19
24
|
});
|
|
20
|
-
|
|
25
|
+
if (!childrenInfo)
|
|
26
|
+
return [];
|
|
27
|
+
return childrenInfo.filter(function (info) { return Boolean(info); });
|
|
21
28
|
};
|
|
22
29
|
var _MoreMenuTabs = react_1.forwardRef(function (props, ref) {
|
|
23
|
-
var orientation = props.orientation, childrenProp = props.children,
|
|
30
|
+
var orientation = props.orientation, childrenProp = props.children, value = props.value, onChange = props.onChange, _a = props.MoreButtonProps, MoreButtonProps = _a === void 0 ? {} : _a, _b = props.resizeThrottleTime, resizeThrottleTime = _b === void 0 ? 100 : _b, rest = tslib_1.__rest(props, ["orientation", "children", "value", "onChange", "MoreButtonProps", "resizeThrottleTime"]);
|
|
24
31
|
var onGroupInfoChange = MoreButtonProps.onGroupInfoChange, MoreButtonPropsRest = tslib_1.__rest(MoreButtonProps, ["onGroupInfoChange"]);
|
|
25
|
-
var prevChildrenProp = foundation_1.usePrevious(function () { return childrenProp; });
|
|
26
32
|
var isVertical = orientation === 'vertical';
|
|
27
|
-
var
|
|
33
|
+
var sizeKey = isVertical ? 'offsetHeight' : 'offsetWidth';
|
|
28
34
|
var innerRef = react_1.useRef(null);
|
|
29
35
|
var moreTabRef = react_1.useRef(null);
|
|
36
|
+
var sentinelStartRef = react_1.useRef(null);
|
|
30
37
|
var tabsRef = foundation_1.useForkRef(innerRef, ref);
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
var forceUpdate = foundation_1.useForceUpdate();
|
|
41
|
-
var sizeChange = function (size) {
|
|
42
|
-
hasResizeRef.current = true;
|
|
43
|
-
if (tabsSizeRef.current.height !== size.height ||
|
|
44
|
-
tabsSizeRef.current.width !== size.width) {
|
|
45
|
-
tabsSizeRef.current = size;
|
|
46
|
-
forceUpdate();
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var throttleTabsSizeChange = foundation_1.useThrottle(sizeChange, resizeThrottleTime);
|
|
50
|
-
foundation_1.useResizeObserver(innerRef, function (_a) {
|
|
51
|
-
var _b = tslib_1.__read(_a, 1), entry = _b[0];
|
|
52
|
-
var _c = entry.contentRect, width = _c.width, height = _c.height;
|
|
53
|
-
var obj = { width: width, height: height };
|
|
54
|
-
throttleTabsSizeChange(obj);
|
|
55
|
-
}, { mode: 'none' });
|
|
56
|
-
var tabsSize = tabsSizeRef.current;
|
|
57
|
-
// initial tabRefsMapRef and tabsTabChildRef
|
|
58
|
-
if (tabRefsMapRef.current === undefined ||
|
|
59
|
-
prevChildrenProp !== childrenProp) {
|
|
60
|
-
var tabRefs_1 = new Map();
|
|
61
|
-
var tabsTabDefaultChild_1 = [];
|
|
62
|
-
react_1.default.Children.forEach(childrenProp, function (child, index) {
|
|
63
|
-
var _a = child.props, ref = _a.ref, value = _a.value;
|
|
64
|
-
var innerRef = react_1.createRef();
|
|
65
|
-
var tabRef = ref ? foundation_1.useForkRef(innerRef, ref) : innerRef;
|
|
66
|
-
var childrenValue = value || index;
|
|
67
|
-
var children = react_1.default.cloneElement(child, {
|
|
68
|
-
ref: tabRef,
|
|
69
|
-
value: childrenValue,
|
|
70
|
-
});
|
|
71
|
-
var keyString = typeof child.key === 'string' ? child.key : '';
|
|
72
|
-
tabRefs_1.set(utils_1.getKey(keyString, index), {
|
|
73
|
-
ref: tabRef,
|
|
74
|
-
size: null,
|
|
75
|
-
index: index,
|
|
76
|
-
value: childrenValue,
|
|
77
|
-
});
|
|
78
|
-
tabsTabDefaultChild_1.push(children);
|
|
79
|
-
});
|
|
80
|
-
tabRefsMapRef.current = tabRefs_1;
|
|
81
|
-
tabsTabChildRef.current = tabsTabDefaultChild_1;
|
|
82
|
-
}
|
|
83
|
-
var updateAllTabsSize = function () {
|
|
84
|
-
var tabRefsMap = tabRefsMapRef.current;
|
|
85
|
-
var allTabsSize = tslib_1.__assign({}, utils_1.DEFAULT_SIZE);
|
|
86
|
-
if (tabRefsMap && tabRefsMap.size !== 0) {
|
|
87
|
-
tabRefsMap.forEach(function (value, key) {
|
|
88
|
-
var _a = utils_1.getDomBoundingClientSize(value.ref.current), width = _a.width, height = _a.height;
|
|
89
|
-
allTabsSize.width += width;
|
|
90
|
-
allTabsSize.height += height;
|
|
91
|
-
var newRef = {
|
|
92
|
-
ref: value.ref,
|
|
93
|
-
size: { width: width, height: height },
|
|
94
|
-
index: value.index,
|
|
95
|
-
value: value.value,
|
|
96
|
-
};
|
|
97
|
-
tabRefsMap.set(key, newRef);
|
|
98
|
-
});
|
|
99
|
-
allTabsSizeRef.current = allTabsSize;
|
|
38
|
+
var mountStateRef = foundation_1.useMountState();
|
|
39
|
+
var _c = tslib_1.__read(react_1.useState(function () {
|
|
40
|
+
var tabsInfo = getTabsInfoFromChildren(childrenProp);
|
|
41
|
+
if (!tabsInfo) {
|
|
42
|
+
return {
|
|
43
|
+
all: [],
|
|
44
|
+
tab: [],
|
|
45
|
+
menu: [],
|
|
46
|
+
};
|
|
100
47
|
}
|
|
101
|
-
return
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
48
|
+
return {
|
|
49
|
+
all: tabsInfo,
|
|
50
|
+
tab: tabsInfo,
|
|
51
|
+
menu: [],
|
|
52
|
+
};
|
|
53
|
+
}), 2), groupInfo = _c[0], setGroupInfo = _c[1];
|
|
54
|
+
var throttleCalculateGroupInfo = foundation_1.useThrottle(function () {
|
|
55
|
+
var e_1, _a;
|
|
56
|
+
var _b;
|
|
57
|
+
var tablist = (_b = innerRef.current) === null || _b === void 0 ? void 0 : _b.querySelector('[role="tablist"]');
|
|
58
|
+
if (!tablist)
|
|
106
59
|
return;
|
|
60
|
+
var allTabs = Array.from(tablist.children);
|
|
61
|
+
var allTabsSize = [];
|
|
62
|
+
var selectedIndex = groupInfo.all.findIndex(function (info) { return info.value === value; });
|
|
63
|
+
var tablistSize = tablist[sizeKey];
|
|
64
|
+
var moreButtonSize = basicMoreButtonSize;
|
|
65
|
+
var allTabsSizeSumWidthoutMoreButton = 0;
|
|
66
|
+
try {
|
|
67
|
+
for (var allTabs_1 = tslib_1.__values(allTabs), allTabs_1_1 = allTabs_1.next(); !allTabs_1_1.done; allTabs_1_1 = allTabs_1.next()) {
|
|
68
|
+
var tabEl = allTabs_1_1.value;
|
|
69
|
+
if (tabEl instanceof HTMLElement) {
|
|
70
|
+
if (typeof tabEl.dataset['tabOriginIndex'] === 'string') {
|
|
71
|
+
var tabOriginIndex = Number(tabEl.dataset['tabOriginIndex']);
|
|
72
|
+
var elSize = tabEl[sizeKey];
|
|
73
|
+
allTabsSize[tabOriginIndex] = elSize;
|
|
74
|
+
allTabsSizeSumWidthoutMoreButton += elSize;
|
|
75
|
+
}
|
|
76
|
+
else if (typeof tabEl.dataset['tabMoreButton'] === 'string') {
|
|
77
|
+
var elSize = tabEl[sizeKey];
|
|
78
|
+
moreButtonSize = elSize;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
107
82
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
83
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
84
|
+
finally {
|
|
85
|
+
try {
|
|
86
|
+
if (allTabs_1_1 && !allTabs_1_1.done && (_a = allTabs_1.return)) _a.call(allTabs_1);
|
|
87
|
+
}
|
|
88
|
+
finally { if (e_1) throw e_1.error; }
|
|
113
89
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
90
|
+
var newGroupInfo = {
|
|
91
|
+
all: groupInfo.all,
|
|
92
|
+
tab: [],
|
|
93
|
+
menu: [],
|
|
94
|
+
};
|
|
95
|
+
if (allTabsSizeSumWidthoutMoreButton > tablistSize) {
|
|
96
|
+
var allTabsSizeSum = allTabsSizeSumWidthoutMoreButton + moreButtonSize;
|
|
97
|
+
var targetSize = allTabsSizeSum;
|
|
98
|
+
for (var i = allTabsSize.length - 1; i >= 0; i--) {
|
|
99
|
+
if (i !== selectedIndex) {
|
|
100
|
+
targetSize -= allTabsSize[i];
|
|
101
|
+
newGroupInfo.menu.unshift(groupInfo.all[i]);
|
|
102
|
+
if (targetSize <= tablistSize) {
|
|
103
|
+
break;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
newGroupInfo.tab = groupInfo.all.filter(function (info) { return !newGroupInfo.menu.some(function (_a) {
|
|
108
|
+
var index = _a.index;
|
|
109
|
+
return index === info.index;
|
|
110
|
+
}); });
|
|
124
111
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
112
|
+
else {
|
|
113
|
+
newGroupInfo.tab = newGroupInfo.all;
|
|
114
|
+
}
|
|
115
|
+
var shouldUpdateGroupInfo = false;
|
|
116
|
+
if (newGroupInfo.tab.length === groupInfo.tab.length &&
|
|
117
|
+
newGroupInfo.tab.length === groupInfo.tab.length) {
|
|
118
|
+
for (var i = 0; i < groupInfo.tab.length; i++) {
|
|
119
|
+
if (newGroupInfo.tab[i] !== groupInfo.tab[i]) {
|
|
120
|
+
shouldUpdateGroupInfo = true;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
136
123
|
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
shouldUpdateGroupInfo = true;
|
|
127
|
+
}
|
|
128
|
+
if (shouldUpdateGroupInfo) {
|
|
129
|
+
// prevent resize observer loop limit exceeded
|
|
130
|
+
setTimeout(function () {
|
|
131
|
+
if (mountStateRef.current)
|
|
132
|
+
setGroupInfo(newGroupInfo);
|
|
133
|
+
}, 0);
|
|
134
|
+
}
|
|
135
|
+
}, resizeThrottleTime);
|
|
136
|
+
react_1.useEffect(function () {
|
|
137
|
+
var e_2, _a;
|
|
138
|
+
var _b;
|
|
139
|
+
var tablist = (_b = innerRef.current) === null || _b === void 0 ? void 0 : _b.querySelector('[role="tablist"]');
|
|
140
|
+
if (!tablist)
|
|
141
|
+
return;
|
|
142
|
+
var resizeObserver = foundation_1.getResizeObserver(throttleCalculateGroupInfo);
|
|
143
|
+
resizeObserver.observe(tablist);
|
|
144
|
+
try {
|
|
145
|
+
for (var _c = tslib_1.__values(Array.from(tablist.children)), _d = _c.next(); !_d.done; _d = _c.next()) {
|
|
146
|
+
var tabItem = _d.value;
|
|
147
|
+
resizeObserver.observe(tabItem,
|
|
148
|
+
// TODO: remove this, after remove ResizeObserver polyfill
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
{ box: 'border-box' });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
154
|
+
finally {
|
|
155
|
+
try {
|
|
156
|
+
if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
|
141
157
|
}
|
|
142
|
-
if (
|
|
143
|
-
|
|
158
|
+
finally { if (e_2) throw e_2.error; }
|
|
159
|
+
}
|
|
160
|
+
var mutationObserver = new MutationObserver(function (mutations) {
|
|
161
|
+
var e_3, _a;
|
|
162
|
+
try {
|
|
163
|
+
for (var mutations_1 = tslib_1.__values(mutations), mutations_1_1 = mutations_1.next(); !mutations_1_1.done; mutations_1_1 = mutations_1.next()) {
|
|
164
|
+
var mutation = mutations_1_1.value;
|
|
165
|
+
if (mutation.type === 'childList') {
|
|
166
|
+
mutation.removedNodes.forEach(function (removedNode) {
|
|
167
|
+
if (removedNode instanceof Element) {
|
|
168
|
+
resizeObserver.unobserve(removedNode);
|
|
169
|
+
}
|
|
170
|
+
});
|
|
171
|
+
mutation.addedNodes.forEach(function (addedNode) {
|
|
172
|
+
if (addedNode instanceof Element) {
|
|
173
|
+
resizeObserver.observe(addedNode,
|
|
174
|
+
// TODO: remove this, after remove ResizeObserver polyfill
|
|
175
|
+
// @ts-ignore
|
|
176
|
+
{ box: 'border-box' });
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
// should re-calculate group info when dom is removed and not added
|
|
180
|
+
if (mutation.removedNodes.length && !mutation.addedNodes.length) {
|
|
181
|
+
setTimeout(function () {
|
|
182
|
+
if (mountStateRef.current)
|
|
183
|
+
throttleCalculateGroupInfo();
|
|
184
|
+
}, 0);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
144
188
|
}
|
|
145
|
-
|
|
146
|
-
|
|
189
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
190
|
+
finally {
|
|
191
|
+
try {
|
|
192
|
+
if (mutations_1_1 && !mutations_1_1.done && (_a = mutations_1.return)) _a.call(mutations_1);
|
|
193
|
+
}
|
|
194
|
+
finally { if (e_3) throw e_3.error; }
|
|
147
195
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
size: value.size ? value.size[oriStr] : 0,
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
var limitSize = tabsSizeRef.current[oriStr] - moreTabSizeRef.current[oriStr];
|
|
159
|
-
var _a = utils_1.computeChildBySize(labelArray, currSelectTabItem === null || currSelectTabItem === void 0 ? void 0 : currSelectTabItem[0], limitSize), tabsTabLabel = _a.plainArr, menuTabLabel = _a.groupArr;
|
|
160
|
-
computeGroupingInfo(tabsTabLabel, menuTabLabel);
|
|
161
|
-
var tabsTabChild = tabsTabLabel.map(function (key) {
|
|
162
|
-
return exports.findChildrenByKey(childrenProp, key);
|
|
163
|
-
});
|
|
164
|
-
var menuTabChild = menuTabLabel.map(function (key) {
|
|
165
|
-
return exports.findChildrenByKey(childrenProp, key);
|
|
166
|
-
});
|
|
167
|
-
tabsTabChildRef.current = tabsTabChild;
|
|
168
|
-
setMenuTabChild(menuTabChild);
|
|
196
|
+
});
|
|
197
|
+
mutationObserver.observe(tablist, {
|
|
198
|
+
childList: true,
|
|
199
|
+
});
|
|
200
|
+
return function () {
|
|
201
|
+
resizeObserver.disconnect();
|
|
202
|
+
mutationObserver.disconnect();
|
|
169
203
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
204
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
205
|
+
}, []);
|
|
206
|
+
// No need calculate during the first rendering,
|
|
207
|
+
// resize observer will do this
|
|
208
|
+
foundation_1.useOnReRender(function () {
|
|
209
|
+
throttleCalculateGroupInfo();
|
|
210
|
+
}, [value], false);
|
|
211
|
+
foundation_1.useOnReRender(function () {
|
|
212
|
+
var e_4, _a;
|
|
213
|
+
var tabsInfo = getTabsInfoFromChildren(childrenProp);
|
|
214
|
+
var newGroupInfo = {
|
|
215
|
+
all: tabsInfo,
|
|
216
|
+
tab: [],
|
|
217
|
+
menu: [],
|
|
181
218
|
};
|
|
182
|
-
var
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
219
|
+
var _loop_1 = function (tabInfo) {
|
|
220
|
+
if (groupInfo.tab.some(function (_a) {
|
|
221
|
+
var key = _a.key;
|
|
222
|
+
return tabInfo.key === key;
|
|
223
|
+
})) {
|
|
224
|
+
newGroupInfo.tab.push(tabInfo);
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
// push new tab or invisible old tab to menu group
|
|
228
|
+
newGroupInfo.menu.push(tabInfo);
|
|
190
229
|
}
|
|
191
230
|
};
|
|
192
|
-
|
|
193
|
-
//
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
prevChildrenProp === childrenProp) {
|
|
198
|
-
return;
|
|
231
|
+
try {
|
|
232
|
+
// Prevent moreButton from flickering after children update
|
|
233
|
+
for (var tabsInfo_1 = tslib_1.__values(tabsInfo), tabsInfo_1_1 = tabsInfo_1.next(); !tabsInfo_1_1.done; tabsInfo_1_1 = tabsInfo_1.next()) {
|
|
234
|
+
var tabInfo = tabsInfo_1_1.value;
|
|
235
|
+
_loop_1(tabInfo);
|
|
199
236
|
}
|
|
200
|
-
// can't use tabsSize
|
|
201
|
-
// It is possible that the children prop render effect will execute before the sizeChange effect
|
|
202
|
-
// which get a old tabsSize value
|
|
203
|
-
computeTabChild(tabsSizeRef.current);
|
|
204
|
-
hasResizeRef.current = false;
|
|
205
237
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
]);
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
238
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
239
|
+
finally {
|
|
240
|
+
try {
|
|
241
|
+
if (tabsInfo_1_1 && !tabsInfo_1_1.done && (_a = tabsInfo_1.return)) _a.call(tabsInfo_1);
|
|
242
|
+
}
|
|
243
|
+
finally { if (e_4) throw e_4.error; }
|
|
244
|
+
}
|
|
245
|
+
setGroupInfo(newGroupInfo);
|
|
246
|
+
}, [childrenProp], false);
|
|
247
|
+
react_1.useEffect(function () {
|
|
248
|
+
onGroupInfoChange === null || onGroupInfoChange === void 0 ? void 0 : onGroupInfoChange([
|
|
249
|
+
groupInfo.tab.map(function (_a) {
|
|
250
|
+
var index = _a.index, key = _a.key;
|
|
251
|
+
return ({ index: index, key: key });
|
|
252
|
+
}),
|
|
253
|
+
groupInfo.menu.map(function (_a) {
|
|
254
|
+
var index = _a.index, key = _a.key;
|
|
255
|
+
return ({ index: index, key: key });
|
|
256
|
+
}),
|
|
257
|
+
]);
|
|
258
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
259
|
+
}, [groupInfo]); // ignore onGroupInfoChange
|
|
260
|
+
var useMoreMode = groupInfo.menu.length > 0;
|
|
261
|
+
var MoreMenuTabCmp = (function () {
|
|
262
|
+
if (!useMoreMode)
|
|
263
|
+
return null;
|
|
264
|
+
var menuItems = groupInfo.menu.map(function (_a) {
|
|
265
|
+
var key = _a.key, element = _a.element;
|
|
266
|
+
return tslib_1.__assign(tslib_1.__assign({}, element.props), { key: key });
|
|
218
267
|
});
|
|
219
268
|
return useMoreMode ? (react_1.default.createElement(MoreMenuTab_1.MoreMenuTab, tslib_1.__assign({}, MoreButtonPropsRest, { key: MoreMenuTab_1.DEFAULT_MORE_MENU_TAB_LABEL, size: rest.size, menuItems: menuItems, ref: moreTabRef, onChange: onChange, orientation: orientation }))) : null;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
269
|
+
})();
|
|
270
|
+
var children = (function () {
|
|
271
|
+
var tabGroupElements = groupInfo.tab.map(function (_a) {
|
|
272
|
+
var index = _a.index, key = _a.key, tabValue = _a.value, element = _a.element;
|
|
273
|
+
return react_1.cloneElement(element, {
|
|
274
|
+
key: key,
|
|
275
|
+
value: tabValue,
|
|
276
|
+
'data-tab-origin-index': index,
|
|
277
|
+
'data-tab-key': key,
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
if (!useMoreMode)
|
|
281
|
+
return tabGroupElements;
|
|
282
|
+
return tslib_1.__spread(tabGroupElements, [
|
|
283
|
+
react_1.default.createElement(MoreMenuTabSentinel_1.MoreMenuTabSentinel, { id: "start", value: "sentinel-start", key: "sentinel-start", ref: sentinelStartRef, onFocus: function () {
|
|
284
|
+
var _a;
|
|
285
|
+
(_a = moreTabRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
286
|
+
} })
|
|
287
|
+
], groupInfo.menu.map(function (_a) {
|
|
288
|
+
var index = _a.index, key = _a.key, tabValue = _a.value, element = _a.element;
|
|
289
|
+
return react_1.cloneElement(element, {
|
|
290
|
+
key: key,
|
|
291
|
+
value: tabValue,
|
|
292
|
+
'data-tab-origin-index': index,
|
|
293
|
+
'data-tab-key': key,
|
|
294
|
+
'aria-hidden': true,
|
|
295
|
+
disabled: true,
|
|
296
|
+
style: tslib_1.__assign(tslib_1.__assign({}, element.props.style), { opacity: 0, position: 'absolute', top: 0, left: 0 }),
|
|
297
|
+
});
|
|
298
|
+
}), [
|
|
299
|
+
react_1.default.createElement(MoreMenuTabSentinel_1.MoreMenuTabSentinel, { id: "end", value: "sentinel-end", key: "sentinel-end", onFocus: function () {
|
|
300
|
+
var _a;
|
|
301
|
+
var focusTarget = ((_a = sentinelStartRef.current) === null || _a === void 0 ? void 0 : _a.previousElementSibling) ||
|
|
302
|
+
moreTabRef.current;
|
|
303
|
+
if (focusTarget)
|
|
304
|
+
focusTarget.focus();
|
|
305
|
+
} }),
|
|
306
|
+
]);
|
|
307
|
+
})();
|
|
308
|
+
return (react_1.default.createElement(Tabs_1.default, tslib_1.__assign({}, rest, { ref: tabsRef, value: value, variant: "standard", indicatorColor: "primary", textColor: "primary", onChange: onChange, orientation: orientation }),
|
|
309
|
+
children,
|
|
230
310
|
MoreMenuTabCmp));
|
|
231
311
|
});
|
|
232
312
|
/** inner component */
|