@zohodesk/components 1.2.4 → 1.2.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/README.md +8 -0
- package/coverage/Button/Button.js.html +1 -1
- package/coverage/Button/css/Button.module.css.html +1 -1
- package/coverage/Button/css/cssJSLogic.js.html +1 -1
- package/coverage/Button/css/index.html +1 -1
- package/coverage/Button/index.html +1 -1
- package/coverage/Button/props/defaultProps.js.html +1 -1
- package/coverage/Button/props/index.html +1 -1
- package/coverage/Button/props/propTypes.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.js.html +1 -1
- package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
- package/coverage/Buttongroup/index.html +1 -1
- package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
- package/coverage/Buttongroup/props/index.html +1 -1
- package/coverage/Buttongroup/props/propTypes.js.html +1 -1
- package/coverage/index.html +1 -1
- package/coverage/utils/dummyFunction.js.html +1 -1
- package/coverage/utils/index.html +1 -1
- package/es/AppContainer/AppContainer.js +3 -0
- package/es/v1/Accordion/Accordion.js +65 -0
- package/es/v1/Accordion/AccordionItem.js +57 -0
- package/es/v1/Accordion/index.js +2 -0
- package/es/v1/Animation/Animation.js +127 -0
- package/es/v1/AppContainer/AppContainer.js +137 -0
- package/es/v1/Avatar/Avatar.js +189 -0
- package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
- package/es/v1/Button/Button.js +68 -0
- package/es/v1/Buttongroup/Buttongroup.js +31 -0
- package/es/v1/Card/Card.js +271 -0
- package/es/v1/CheckBox/CheckBox.js +155 -0
- package/es/v1/DateTime/CalendarView.js +218 -0
- package/es/v1/DateTime/DateTime.js +783 -0
- package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
- package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
- package/es/v1/DateTime/DateWidget.js +1098 -0
- package/es/v1/DateTime/DaysRow.js +31 -0
- package/es/v1/DateTime/Time.js +166 -0
- package/es/v1/DateTime/YearView.js +264 -0
- package/es/v1/DateTime/index.js +1 -0
- package/es/v1/DropBox/DropBox.js +91 -0
- package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
- package/es/v1/DropDown/DropDown.js +73 -0
- package/es/v1/DropDown/DropDownHeading.js +44 -0
- package/es/v1/DropDown/DropDownItem.js +76 -0
- package/es/v1/DropDown/DropDownSearch.js +63 -0
- package/es/v1/DropDown/DropDownSeparator.js +15 -0
- package/es/v1/Heading/Heading.js +32 -0
- package/es/v1/Label/Label.js +40 -0
- package/es/v1/Layout/Box.js +115 -0
- package/es/v1/Layout/Container.js +132 -0
- package/es/v1/Layout/index.js +2 -0
- package/es/v1/ListItem/ListContainer.js +102 -0
- package/es/v1/ListItem/ListItem.js +124 -0
- package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
- package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
- package/es/v1/ListItem/ListItemWithIcon.js +127 -0
- package/es/v1/ListItem/ListItemWithRadio.js +105 -0
- package/es/v1/ListItem/index.js +6 -0
- package/es/v1/Modal/Modal.js +154 -0
- package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
- package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
- package/es/v1/MultiSelect/EmptyState.js +64 -0
- package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
- package/es/v1/MultiSelect/MultiSelect.js +1120 -0
- package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
- package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
- package/es/v1/MultiSelect/SelectedOptions.js +82 -0
- package/es/v1/MultiSelect/Suggestions.js +142 -0
- package/es/v1/MultiSelect/index.js +4 -0
- package/es/v1/PopOver/PopOver.js +211 -0
- package/es/v1/Popup/Popup.js +645 -0
- package/es/v1/Radio/Radio.js +115 -0
- package/es/v1/Responsive/CustomResponsive.js +195 -0
- package/es/v1/Responsive/RefWrapper.js +39 -0
- package/es/v1/Responsive/ResizeComponent.js +197 -0
- package/es/v1/Responsive/ResizeObserver.js +140 -0
- package/es/v1/Responsive/Responsive.js +194 -0
- package/es/v1/Responsive/index.js +9 -0
- package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
- package/es/v1/Ribbon/Ribbon.js +33 -0
- package/es/v1/RippleEffect/RippleEffect.js +24 -0
- package/es/v1/Select/GroupSelect.js +803 -0
- package/es/v1/Select/Select.js +969 -0
- package/es/v1/Select/SelectWithAvatar.js +344 -0
- package/es/v1/Select/SelectWithIcon.js +535 -0
- package/es/v1/Select/index.js +4 -0
- package/es/v1/Stencils/Stencils.js +26 -0
- package/es/v1/Switch/Switch.js +94 -0
- package/es/v1/Tab/Tab.js +108 -0
- package/es/v1/Tab/TabContent.js +30 -0
- package/es/v1/Tab/TabContentWrapper.js +29 -0
- package/es/v1/Tab/TabWrapper.js +57 -0
- package/es/v1/Tab/Tabs.js +612 -0
- package/es/v1/Tab/index.js +5 -0
- package/es/v1/Tag/Tag.js +134 -0
- package/es/v1/TextBox/TextBox.js +154 -0
- package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
- package/es/v1/Textarea/Textarea.js +102 -0
- package/es/v1/Tooltip/Tooltip.js +518 -0
- package/es/v1/Typography/Typography.js +38 -0
- package/es/v1/Typography/css/Typography.module.css +376 -0
- package/es/v1/Typography/css/cssJSLogic.js +46 -0
- package/es/v1/Typography/css/letterSpacingMap.js +12 -0
- package/es/v1/Typography/props/defaultProps.js +8 -0
- package/es/v1/Typography/props/propTypes.js +24 -0
- package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
- package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
- package/es/v1/semantic/Button/Button.js +53 -0
- package/es/v1/semantic/index.js +1 -0
- package/lib/AppContainer/AppContainer.js +5 -0
- package/lib/v1/Accordion/Accordion.js +96 -0
- package/lib/v1/Accordion/AccordionItem.js +68 -0
- package/lib/v1/Accordion/index.js +23 -0
- package/lib/v1/Animation/Animation.js +143 -0
- package/lib/v1/AppContainer/AppContainer.js +209 -0
- package/lib/v1/Avatar/Avatar.js +246 -0
- package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
- package/lib/v1/Button/Button.js +82 -0
- package/lib/v1/Buttongroup/Buttongroup.js +44 -0
- package/lib/v1/Card/Card.js +365 -0
- package/lib/v1/CheckBox/CheckBox.js +166 -0
- package/lib/v1/DateTime/CalendarView.js +285 -0
- package/lib/v1/DateTime/DateTime.js +872 -0
- package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
- package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
- package/lib/v1/DateTime/DateWidget.js +1125 -0
- package/lib/v1/DateTime/DaysRow.js +80 -0
- package/lib/v1/DateTime/Time.js +254 -0
- package/lib/v1/DateTime/YearView.js +325 -0
- package/lib/v1/DateTime/index.js +15 -0
- package/lib/v1/DropBox/DropBox.js +119 -0
- package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
- package/lib/v1/DropDown/DropDown.js +170 -0
- package/lib/v1/DropDown/DropDownHeading.js +93 -0
- package/lib/v1/DropDown/DropDownItem.js +127 -0
- package/lib/v1/DropDown/DropDownSearch.js +113 -0
- package/lib/v1/DropDown/DropDownSeparator.js +64 -0
- package/lib/v1/Heading/Heading.js +49 -0
- package/lib/v1/Label/Label.js +51 -0
- package/lib/v1/Layout/Box.js +128 -0
- package/lib/v1/Layout/Container.js +145 -0
- package/lib/v1/Layout/index.js +23 -0
- package/lib/v1/ListItem/ListContainer.js +120 -0
- package/lib/v1/ListItem/ListItem.js +138 -0
- package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
- package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
- package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
- package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
- package/lib/v1/ListItem/index.js +55 -0
- package/lib/v1/Modal/Modal.js +212 -0
- package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
- package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
- package/lib/v1/MultiSelect/EmptyState.js +112 -0
- package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
- package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
- package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
- package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
- package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
- package/lib/v1/MultiSelect/Suggestions.js +195 -0
- package/lib/v1/MultiSelect/index.js +39 -0
- package/lib/v1/PopOver/PopOver.js +293 -0
- package/lib/v1/Popup/Popup.js +715 -0
- package/lib/v1/Radio/Radio.js +126 -0
- package/lib/v1/Responsive/CustomResponsive.js +242 -0
- package/lib/v1/Responsive/RefWrapper.js +57 -0
- package/lib/v1/Responsive/ResizeComponent.js +268 -0
- package/lib/v1/Responsive/ResizeObserver.js +168 -0
- package/lib/v1/Responsive/Responsive.js +274 -0
- package/lib/v1/Responsive/index.js +55 -0
- package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
- package/lib/v1/Ribbon/Ribbon.js +44 -0
- package/lib/v1/RippleEffect/RippleEffect.js +39 -0
- package/lib/v1/Select/GroupSelect.js +877 -0
- package/lib/v1/Select/Select.js +1013 -0
- package/lib/v1/Select/SelectWithAvatar.js +394 -0
- package/lib/v1/Select/SelectWithIcon.js +597 -0
- package/lib/v1/Select/index.js +39 -0
- package/lib/v1/Stencils/Stencils.js +43 -0
- package/lib/v1/Switch/Switch.js +108 -0
- package/lib/v1/Tab/Tab.js +132 -0
- package/lib/v1/Tab/TabContent.js +42 -0
- package/lib/v1/Tab/TabContentWrapper.js +42 -0
- package/lib/v1/Tab/TabWrapper.js +89 -0
- package/lib/v1/Tab/Tabs.js +680 -0
- package/lib/v1/Tab/index.js +47 -0
- package/lib/v1/Tag/Tag.js +154 -0
- package/lib/v1/TextBox/TextBox.js +168 -0
- package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
- package/lib/v1/Textarea/Textarea.js +118 -0
- package/lib/v1/Tooltip/Tooltip.js +586 -0
- package/lib/v1/Typography/Typography.js +56 -0
- package/lib/v1/Typography/css/Typography.module.css +376 -0
- package/lib/v1/Typography/css/cssJSLogic.js +41 -0
- package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
- package/lib/v1/Typography/props/defaultProps.js +15 -0
- package/lib/v1/Typography/props/propTypes.js +35 -0
- package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
- package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
- package/lib/v1/semantic/Button/Button.js +63 -0
- package/lib/v1/semantic/index.js +15 -0
- package/package.json +1 -1
- package/result.json +1 -1
|
@@ -0,0 +1,680 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _Tab = _interopRequireDefault(require("./Tab"));
|
|
13
|
+
|
|
14
|
+
var _defaultProps = require("../../Tab/props/defaultProps");
|
|
15
|
+
|
|
16
|
+
var _propTypes = require("../../Tab/props/propTypes");
|
|
17
|
+
|
|
18
|
+
var _Common = require("../../utils/Common");
|
|
19
|
+
|
|
20
|
+
var _Layout = require("../Layout");
|
|
21
|
+
|
|
22
|
+
var _ResizeObserver = _interopRequireDefault(require("../Responsive/ResizeObserver"));
|
|
23
|
+
|
|
24
|
+
var _ListItem = _interopRequireDefault(require("../ListItem/ListItem"));
|
|
25
|
+
|
|
26
|
+
var _icons = require("@zohodesk/icons");
|
|
27
|
+
|
|
28
|
+
var _TabsModule = _interopRequireDefault(require("../../Tab/Tabs.module.css"));
|
|
29
|
+
|
|
30
|
+
var _Popup = _interopRequireDefault(require("../Popup/Popup"));
|
|
31
|
+
|
|
32
|
+
var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
|
|
33
|
+
|
|
34
|
+
var _CustomResponsive = require("../Responsive/CustomResponsive");
|
|
35
|
+
|
|
36
|
+
var _semanticButtonModule = _interopRequireDefault(require("../../semantic/Button/semanticButton.module.css"));
|
|
37
|
+
|
|
38
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
39
|
+
|
|
40
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
41
|
+
|
|
42
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
43
|
+
|
|
44
|
+
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); }
|
|
45
|
+
|
|
46
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
47
|
+
|
|
48
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
49
|
+
|
|
50
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
51
|
+
|
|
52
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
53
|
+
|
|
54
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
55
|
+
|
|
56
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
57
|
+
|
|
58
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
59
|
+
|
|
60
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
61
|
+
|
|
62
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
63
|
+
|
|
64
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
65
|
+
|
|
66
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
67
|
+
|
|
68
|
+
var Tabs = /*#__PURE__*/function (_React$Component) {
|
|
69
|
+
_inherits(Tabs, _React$Component);
|
|
70
|
+
|
|
71
|
+
var _super = _createSuper(Tabs);
|
|
72
|
+
|
|
73
|
+
function Tabs(props) {
|
|
74
|
+
var _this;
|
|
75
|
+
|
|
76
|
+
_classCallCheck(this, Tabs);
|
|
77
|
+
|
|
78
|
+
_this = _super.call(this, props);
|
|
79
|
+
_this.state = {
|
|
80
|
+
totalDimension: null,
|
|
81
|
+
tabDimensions: {},
|
|
82
|
+
highlightInitialDimension: null,
|
|
83
|
+
renderVirtualTabs: true,
|
|
84
|
+
tabKeys: []
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
_Common.bind.apply(_assertThisInitialized(_this), ['moreTabSelect', 'onResize', 'onTabResize', 'getHighlightRef', 'getTabsRef', 'getTabRef', 'getHighlightDim', 'onSizeChange', 'onScroll', 'togglePopup', 'setMaxDim']);
|
|
88
|
+
|
|
89
|
+
_this.tabsObserver = new _ResizeObserver["default"](_this.onResize);
|
|
90
|
+
_this.tabObserver = {};
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_createClass(Tabs, [{
|
|
95
|
+
key: "onTabResize",
|
|
96
|
+
value: function onTabResize(size, target) {
|
|
97
|
+
var align = this.props.align;
|
|
98
|
+
var tabDimensions = this.state.tabDimensions;
|
|
99
|
+
var newDim = Object.assign({}, tabDimensions);
|
|
100
|
+
var elemDim = (0, _Common.getTotalDimension)(target, align);
|
|
101
|
+
|
|
102
|
+
if (elemDim !== 0) {
|
|
103
|
+
newDim[target.dataset.key] = elemDim;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
this.setState({
|
|
107
|
+
tabDimensions: newDim
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "componentDidMount",
|
|
112
|
+
value: function componentDidMount() {
|
|
113
|
+
var _this2 = this;
|
|
114
|
+
|
|
115
|
+
var _this$props = this.props,
|
|
116
|
+
children = _this$props.children,
|
|
117
|
+
childType = _this$props.childType;
|
|
118
|
+
var totalDimension = this.getTotalDimension();
|
|
119
|
+
var tabDimensions = this.getTabDimensions();
|
|
120
|
+
var tabKeys = [];
|
|
121
|
+
var restrictedKeys = ['state', 'props', 'refs', 'context'];
|
|
122
|
+
|
|
123
|
+
_react["default"].Children.toArray(children).forEach(function (child) {
|
|
124
|
+
if (child && child.props.id && child.type === childType) {
|
|
125
|
+
if (restrictedKeys.includes(child.props.id)) {
|
|
126
|
+
throw new Error('Restricted id name found in Tabs, Please avoid these names => ' + restrictedKeys.toString());
|
|
127
|
+
} else {
|
|
128
|
+
tabKeys.push(child.props.id);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
this.setState({
|
|
134
|
+
totalDimension: totalDimension,
|
|
135
|
+
tabDimensions: tabDimensions,
|
|
136
|
+
renderVirtualTabs: false,
|
|
137
|
+
tabKeys: tabKeys
|
|
138
|
+
});
|
|
139
|
+
this.highlight && this.setState({
|
|
140
|
+
highlightInitialDimension: this.getHighlightDim()
|
|
141
|
+
}, function () {
|
|
142
|
+
_this2.moveHighlight();
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "componentWillUnmount",
|
|
147
|
+
value: function componentWillUnmount() {
|
|
148
|
+
var _this3 = this;
|
|
149
|
+
|
|
150
|
+
if (this.tabsObserver) {
|
|
151
|
+
this.tabsObserver.disconnect();
|
|
152
|
+
this.tabsObserver = null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (this.tabObserver) {
|
|
156
|
+
Object.keys(this.tabObserver).forEach(function (observer) {
|
|
157
|
+
_this3.tabObserver[observer] && _this3.tabObserver[observer].disconnect();
|
|
158
|
+
});
|
|
159
|
+
this.tabObserver = null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, {
|
|
163
|
+
key: "setMaxDim",
|
|
164
|
+
value: function setMaxDim() {
|
|
165
|
+
var totalDimension = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
166
|
+
var selectedTab = this.props.selectedTab; // let actual = Object.keys(tabDimensions).reduce(
|
|
167
|
+
// (sum, tab) => sum + (tabDimensions[tab] || 0),
|
|
168
|
+
// 0
|
|
169
|
+
// );
|
|
170
|
+
|
|
171
|
+
if (totalDimension && this[selectedTab]) {
|
|
172
|
+
var align = this.props.align;
|
|
173
|
+
var newDim = "".concat((0, _Common.remConvert)(totalDimension), "rem");
|
|
174
|
+
align === 'vertical' ? this[selectedTab].style.maxWidth = newDim : this[selectedTab].style.maxHeight = newDim;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}, {
|
|
178
|
+
key: "getHighlightDim",
|
|
179
|
+
value: function getHighlightDim() {
|
|
180
|
+
var align = this.props.align;
|
|
181
|
+
return align === 'vertical' ? this.highlight.offsetLeft : this.highlight.offsetTop;
|
|
182
|
+
}
|
|
183
|
+
}, {
|
|
184
|
+
key: "componentDidUpdate",
|
|
185
|
+
value: function componentDidUpdate(prevProps) {
|
|
186
|
+
var _this4 = this;
|
|
187
|
+
|
|
188
|
+
var _this$props2 = this.props,
|
|
189
|
+
children = _this$props2.children,
|
|
190
|
+
selectedTab = _this$props2.selectedTab,
|
|
191
|
+
childType = _this$props2.childType;
|
|
192
|
+
var _this$state = this.state,
|
|
193
|
+
tabDimensions = _this$state.tabDimensions,
|
|
194
|
+
totalDimension = _this$state.totalDimension,
|
|
195
|
+
tabKeys = _this$state.tabKeys;
|
|
196
|
+
|
|
197
|
+
if (prevProps.children && children) {
|
|
198
|
+
/**
|
|
199
|
+
* To recalculate the dimensions of tabs we are checking the children length.
|
|
200
|
+
* and also checking the tab id and their order.
|
|
201
|
+
*/
|
|
202
|
+
var newTabKeys = [];
|
|
203
|
+
|
|
204
|
+
_react["default"].Children.toArray(children).forEach(function (child) {
|
|
205
|
+
if (child && child.props.id && child.type === childType) {
|
|
206
|
+
newTabKeys.push(child.props.id);
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
var isSameTabKeys = newTabKeys.every(function (current, index) {
|
|
211
|
+
return tabKeys[index] === current;
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
if (newTabKeys.length !== tabKeys.length || !isSameTabKeys) {
|
|
215
|
+
this.setState({
|
|
216
|
+
renderVirtualTabs: true,
|
|
217
|
+
tabKeys: newTabKeys
|
|
218
|
+
}, function () {
|
|
219
|
+
totalDimension = _this4.getTotalDimension();
|
|
220
|
+
tabDimensions = _this4.getTabDimensions();
|
|
221
|
+
|
|
222
|
+
_this4.setState({
|
|
223
|
+
tabDimensions: tabDimensions,
|
|
224
|
+
totalDimension: totalDimension,
|
|
225
|
+
renderVirtualTabs: false
|
|
226
|
+
});
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (prevProps.selectedTab !== selectedTab || newTabKeys.length === 1) {
|
|
231
|
+
this.moveHighlight();
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}, {
|
|
236
|
+
key: "moveHighlight",
|
|
237
|
+
value: function moveHighlight() {
|
|
238
|
+
var _this$props3 = this.props,
|
|
239
|
+
isAnimate = _this$props3.isAnimate,
|
|
240
|
+
needTabBorder = _this$props3.needTabBorder,
|
|
241
|
+
selectedTab = _this$props3.selectedTab,
|
|
242
|
+
align = _this$props3.align;
|
|
243
|
+
var highlightInitialDimension = this.state.highlightInitialDimension;
|
|
244
|
+
var node = this.highlight;
|
|
245
|
+
|
|
246
|
+
if (isAnimate && needTabBorder && node) {
|
|
247
|
+
var tabActive = this[selectedTab];
|
|
248
|
+
|
|
249
|
+
if (tabActive) {
|
|
250
|
+
var position, dimension;
|
|
251
|
+
|
|
252
|
+
if (align === 'vertical') {
|
|
253
|
+
position = tabActive.offsetLeft;
|
|
254
|
+
dimension = tabActive.offsetWidth;
|
|
255
|
+
node.style.transform = "translateX(".concat((0, _Common.remConvert)(position - highlightInitialDimension), "rem)");
|
|
256
|
+
node.style.width = "".concat((0, _Common.remConvert)(dimension), "rem");
|
|
257
|
+
} else if (align === 'horizontal') {
|
|
258
|
+
position = tabActive.offsetTop;
|
|
259
|
+
dimension = tabActive.offsetHeight;
|
|
260
|
+
node.style.transform = "translateY(".concat((0, _Common.remConvert)(position - highlightInitialDimension), "rem)");
|
|
261
|
+
node.style.height = "".concat((0, _Common.remConvert)(dimension), "rem");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}, {
|
|
267
|
+
key: "getHighlightRef",
|
|
268
|
+
value: function getHighlightRef(ele) {
|
|
269
|
+
this.highlight = ele;
|
|
270
|
+
}
|
|
271
|
+
}, {
|
|
272
|
+
key: "getTabsRef",
|
|
273
|
+
value: function getTabsRef(ele) {
|
|
274
|
+
this.tabsEle = ele;
|
|
275
|
+
|
|
276
|
+
if (ele) {
|
|
277
|
+
this.tabsObserver.observe(ele);
|
|
278
|
+
} else {
|
|
279
|
+
this.tabsObserver && this.tabsObserver.disconnect();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}, {
|
|
283
|
+
key: "onSizeChange",
|
|
284
|
+
value: function onSizeChange() {
|
|
285
|
+
var _this5 = this;
|
|
286
|
+
|
|
287
|
+
var totalDimension = this.getTotalDimension();
|
|
288
|
+
this.setState({
|
|
289
|
+
totalDimension: totalDimension
|
|
290
|
+
});
|
|
291
|
+
this.highlight && this.setState({
|
|
292
|
+
highlightInitialDimension: this.getHighlightDim()
|
|
293
|
+
}, function () {
|
|
294
|
+
_this5.moveHighlight();
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}, {
|
|
298
|
+
key: "onResize",
|
|
299
|
+
value: function onResize(timer) {
|
|
300
|
+
var _this6 = this;
|
|
301
|
+
|
|
302
|
+
var isResponsive = this.props.isResponsive;
|
|
303
|
+
|
|
304
|
+
if (this.tabsEle && isResponsive) {
|
|
305
|
+
if (!timer) {
|
|
306
|
+
this.onSizeChange();
|
|
307
|
+
} else {
|
|
308
|
+
setTimeout(function () {
|
|
309
|
+
_this6.onSizeChange();
|
|
310
|
+
}, timer);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
}, {
|
|
315
|
+
key: "getTotalDimension",
|
|
316
|
+
value: function getTotalDimension() {
|
|
317
|
+
var align = this.props.align;
|
|
318
|
+
var totalDimension = this.tabsEle && (0, _Common.getTotalDimension)(this.tabsEle, align);
|
|
319
|
+
return totalDimension;
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
key: "getTabDimensions",
|
|
323
|
+
value: function getTabDimensions() {
|
|
324
|
+
var _this7 = this;
|
|
325
|
+
|
|
326
|
+
var _this$props4 = this.props,
|
|
327
|
+
children = _this$props4.children,
|
|
328
|
+
align = _this$props4.align,
|
|
329
|
+
childType = _this$props4.childType;
|
|
330
|
+
var tabDimensions = {};
|
|
331
|
+
|
|
332
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
333
|
+
return /*#__PURE__*/_react["default"].isValidElement(child) && child.type === childType && _this7[child.props.id] && Object.assign(tabDimensions, _defineProperty({}, child.props.id, _this7[child.props.id] && (0, _Common.getTotalDimension)(_this7[child.props.id], align)));
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
return tabDimensions;
|
|
337
|
+
}
|
|
338
|
+
}, {
|
|
339
|
+
key: "responsiveTab",
|
|
340
|
+
value: function responsiveTab(totalDimension, tabDimensions) {
|
|
341
|
+
var _this$props5 = this.props,
|
|
342
|
+
children = _this$props5.children,
|
|
343
|
+
maxTabsCount = _this$props5.maxTabsCount,
|
|
344
|
+
minTabsCount = _this$props5.minTabsCount,
|
|
345
|
+
isResponsive = _this$props5.isResponsive;
|
|
346
|
+
var mainTabs = [],
|
|
347
|
+
moreTabs = [],
|
|
348
|
+
otherTabs = [];
|
|
349
|
+
|
|
350
|
+
if (totalDimension && isResponsive) {
|
|
351
|
+
var _this$props6 = this.props,
|
|
352
|
+
childType = _this$props6.childType,
|
|
353
|
+
selectedTab = _this$props6.selectedTab;
|
|
354
|
+
var selectedTabDimension = tabDimensions[selectedTab] || 0;
|
|
355
|
+
var remainingDimension = totalDimension - selectedTabDimension;
|
|
356
|
+
var maxTabsTobeVisible = maxTabsCount - 1;
|
|
357
|
+
var minTabsToBeVisible = 1;
|
|
358
|
+
|
|
359
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
360
|
+
if (child && child.type === childType && child.props.id) {
|
|
361
|
+
var elemDimension = tabDimensions[child.props.id];
|
|
362
|
+
var isMaxCountExceeded = maxTabsTobeVisible <= 0 ? true : false;
|
|
363
|
+
var isMinCountNotExceeded = minTabsToBeVisible < minTabsCount ? true : false;
|
|
364
|
+
|
|
365
|
+
if (child.props.id === selectedTab) {
|
|
366
|
+
mainTabs.push(child);
|
|
367
|
+
} else if (isMinCountNotExceeded) {
|
|
368
|
+
mainTabs.push(child);
|
|
369
|
+
remainingDimension -= tabDimensions[child.props.id];
|
|
370
|
+
minTabsToBeVisible++;
|
|
371
|
+
maxTabsTobeVisible--;
|
|
372
|
+
} else if (remainingDimension - elemDimension >= 20 && !moreTabs.length && !isMaxCountExceeded) {
|
|
373
|
+
mainTabs.push(child);
|
|
374
|
+
remainingDimension -= tabDimensions[child.props.id];
|
|
375
|
+
maxTabsTobeVisible--;
|
|
376
|
+
} else {
|
|
377
|
+
moreTabs.push(child);
|
|
378
|
+
}
|
|
379
|
+
} else if ( /*#__PURE__*/_react["default"].isValidElement(child)) {
|
|
380
|
+
otherTabs.push(child);
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
if (selectedTabDimension > totalDimension) {
|
|
385
|
+
/* let { align } = this.props;
|
|
386
|
+
let newDim = `${remConvert(totalDimension)}rem`;
|
|
387
|
+
let newTabs;
|
|
388
|
+
if (align === 'vertical') {
|
|
389
|
+
newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxWidth: newDim } }));
|
|
390
|
+
} else {
|
|
391
|
+
newTabs = mainTabs.map(tab => React.cloneElement(tab, { style: { maxHeight: newDim } }));
|
|
392
|
+
}
|
|
393
|
+
mainTabs = newTabs; */
|
|
394
|
+
this.setMaxDim(totalDimension);
|
|
395
|
+
}
|
|
396
|
+
} else if (!isResponsive) {
|
|
397
|
+
var _childType = this.props.childType;
|
|
398
|
+
|
|
399
|
+
_react["default"].Children.forEach(children, function (child) {
|
|
400
|
+
if (child && child.type === _childType && child.props.id) {
|
|
401
|
+
mainTabs.push(child);
|
|
402
|
+
} else {
|
|
403
|
+
otherTabs.push(child);
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
} else {
|
|
407
|
+
moreTabs = children;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
return {
|
|
411
|
+
mainTabs: mainTabs,
|
|
412
|
+
moreTabs: moreTabs,
|
|
413
|
+
otherTabs: otherTabs
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
}, {
|
|
417
|
+
key: "getTabRef",
|
|
418
|
+
value: function getTabRef(refName, ele, isVirtual) {
|
|
419
|
+
this[refName] = ele;
|
|
420
|
+
var key = isVirtual ? "virtual_".concat(refName) : refName;
|
|
421
|
+
|
|
422
|
+
if (ele) {
|
|
423
|
+
this.tabObserver[key] = new _ResizeObserver["default"](this.onTabResize);
|
|
424
|
+
this.tabObserver[key].observe(ele);
|
|
425
|
+
} else {
|
|
426
|
+
if (this.tabObserver && this.tabObserver[key]) {
|
|
427
|
+
this.tabObserver[key].disconnect();
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}, {
|
|
432
|
+
key: "moreTabSelect",
|
|
433
|
+
value: function moreTabSelect(tab, value, index, e) {
|
|
434
|
+
var onSelect = this.props.onSelect;
|
|
435
|
+
|
|
436
|
+
if (e && e.target && e.target.parentElement.tagName === 'A' && (e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)) {
|
|
437
|
+
(0, _Common.cancelBubblingEffect)(e);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
e.preventDefault();
|
|
442
|
+
onSelect(tab);
|
|
443
|
+
}
|
|
444
|
+
}, {
|
|
445
|
+
key: "onScroll",
|
|
446
|
+
value: function onScroll(e) {
|
|
447
|
+
e.persist();
|
|
448
|
+
var onScroll = this.props.onScroll;
|
|
449
|
+
onScroll && (0, _Common.throttle)(onScroll, 100, e);
|
|
450
|
+
}
|
|
451
|
+
}, {
|
|
452
|
+
key: "togglePopup",
|
|
453
|
+
value: function togglePopup(e) {
|
|
454
|
+
var _this$props7 = this.props,
|
|
455
|
+
boxPosition = _this$props7.boxPosition,
|
|
456
|
+
togglePopup = _this$props7.togglePopup,
|
|
457
|
+
align = _this$props7.align,
|
|
458
|
+
removeClose = _this$props7.removeClose;
|
|
459
|
+
removeClose && removeClose(e);
|
|
460
|
+
var popupPosition = align === 'vertical' ? 'bottomLeft' : 'rightTop';
|
|
461
|
+
boxPosition = boxPosition ? boxPosition : popupPosition;
|
|
462
|
+
togglePopup(e, boxPosition);
|
|
463
|
+
}
|
|
464
|
+
}, {
|
|
465
|
+
key: "responsiveFunc",
|
|
466
|
+
value: function responsiveFunc(_ref) {
|
|
467
|
+
var mediaQueryOR = _ref.mediaQueryOR;
|
|
468
|
+
return {
|
|
469
|
+
tabletMode: mediaQueryOR([{
|
|
470
|
+
maxWidth: 700
|
|
471
|
+
}])
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
}, {
|
|
475
|
+
key: "renderTabs",
|
|
476
|
+
value: function renderTabs(mainTabs, moreTabs, isVirtual) {
|
|
477
|
+
var _this8 = this;
|
|
478
|
+
|
|
479
|
+
var _this$props8 = this.props,
|
|
480
|
+
selectedTab = _this$props8.selectedTab,
|
|
481
|
+
moreButtonClass = _this$props8.moreButtonClass,
|
|
482
|
+
moreButtonActiveClass = _this$props8.moreButtonActiveClass,
|
|
483
|
+
moreBoxClass = _this$props8.moreBoxClass,
|
|
484
|
+
menuItemClass = _this$props8.menuItemClass,
|
|
485
|
+
itemClass = _this$props8.itemClass,
|
|
486
|
+
itemActiveClass = _this$props8.itemActiveClass,
|
|
487
|
+
iconName = _this$props8.iconName,
|
|
488
|
+
isPopupReady = _this$props8.isPopupReady,
|
|
489
|
+
isPopupOpen = _this$props8.isPopupOpen,
|
|
490
|
+
getContainerRef = _this$props8.getContainerRef,
|
|
491
|
+
showTitleInMoreOptions = _this$props8.showTitleInMoreOptions,
|
|
492
|
+
onSelect = _this$props8.onSelect,
|
|
493
|
+
moreContainerClass = _this$props8.moreContainerClass,
|
|
494
|
+
align = _this$props8.align,
|
|
495
|
+
type = _this$props8.type,
|
|
496
|
+
isAnimate = _this$props8.isAnimate,
|
|
497
|
+
needTabBorder = _this$props8.needTabBorder,
|
|
498
|
+
needAppearance = _this$props8.needAppearance,
|
|
499
|
+
iconSize = _this$props8.iconSize,
|
|
500
|
+
getTargetRef = _this$props8.getTargetRef,
|
|
501
|
+
position = _this$props8.position,
|
|
502
|
+
customProps = _this$props8.customProps,
|
|
503
|
+
getCustomDropBoxHeaderPlaceHolder = _this$props8.getCustomDropBoxHeaderPlaceHolder,
|
|
504
|
+
dataSelectorId = _this$props8.dataSelectorId;
|
|
505
|
+
var _customProps$DropBoxP = customProps.DropBoxProps,
|
|
506
|
+
DropBoxProps = _customProps$DropBoxP === void 0 ? {} : _customProps$DropBoxP,
|
|
507
|
+
_customProps$ListItem = customProps.ListItemProps,
|
|
508
|
+
ListItemProps = _customProps$ListItem === void 0 ? {} : _customProps$ListItem,
|
|
509
|
+
_customProps$MoreButt = customProps.MoreButtonProps,
|
|
510
|
+
MoreButtonProps = _customProps$MoreButt === void 0 ? {} : _customProps$MoreButt;
|
|
511
|
+
var popupClass = align === 'vertical' ? _TabsModule["default"][position] ? _TabsModule["default"][position] : '' : '';
|
|
512
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _react["default"].Children.map(mainTabs, function (child) {
|
|
513
|
+
if (!child) {
|
|
514
|
+
return null;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
var MainTab = child.type;
|
|
518
|
+
var classProps = {};
|
|
519
|
+
|
|
520
|
+
if (itemActiveClass) {
|
|
521
|
+
classProps.activeClass = itemActiveClass;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
if (itemClass) {
|
|
525
|
+
classProps.className = itemClass;
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(MainTab, _extends({}, child.props, {
|
|
529
|
+
key: child.props.id,
|
|
530
|
+
getTabRef: _this8.getTabRef,
|
|
531
|
+
onSelect: onSelect,
|
|
532
|
+
recalculateDimension: _this8.recalculateDimension,
|
|
533
|
+
isActive: child.props.id === selectedTab,
|
|
534
|
+
type: type,
|
|
535
|
+
isAnimate: isAnimate,
|
|
536
|
+
needBorder: needTabBorder,
|
|
537
|
+
needAppearance: needAppearance,
|
|
538
|
+
align: align,
|
|
539
|
+
isVirtual: isVirtual
|
|
540
|
+
}, classProps));
|
|
541
|
+
}), _react["default"].Children.count(moreTabs) ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
542
|
+
className: "".concat(_TabsModule["default"].menu, " "),
|
|
543
|
+
dataSelectorId: "".concat(dataSelectorId, "_moreIcon")
|
|
544
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, _extends({
|
|
545
|
+
className: "".concat(_semanticButtonModule["default"].buttonReset, " ").concat(moreButtonClass, " ").concat(isPopupOpen ? moreButtonActiveClass : ''),
|
|
546
|
+
align: "both",
|
|
547
|
+
onClick: this.togglePopup,
|
|
548
|
+
dataId: "moreTabs",
|
|
549
|
+
eleRef: getTargetRef
|
|
550
|
+
}, MoreButtonProps, {
|
|
551
|
+
"aria-label": "MoreTabs",
|
|
552
|
+
role: "link",
|
|
553
|
+
tagName: "button"
|
|
554
|
+
}), /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
|
|
555
|
+
name: iconName,
|
|
556
|
+
size: iconSize
|
|
557
|
+
})), isPopupOpen && /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
|
|
558
|
+
query: this.responsiveFunc,
|
|
559
|
+
responsiveId: "Helmet"
|
|
560
|
+
}, function (_ref2) {
|
|
561
|
+
var tabletMode = _ref2.tabletMode;
|
|
562
|
+
return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], _extends({
|
|
563
|
+
isActive: isPopupReady,
|
|
564
|
+
isAnimate: true,
|
|
565
|
+
size: "medium",
|
|
566
|
+
customClass: {
|
|
567
|
+
customDropBoxWrap: "".concat(moreContainerClass, " ").concat(popupClass)
|
|
568
|
+
},
|
|
569
|
+
boxPosition: position,
|
|
570
|
+
getRef: getContainerRef,
|
|
571
|
+
isBoxPaddingNeed: true,
|
|
572
|
+
isArrow: false
|
|
573
|
+
}, DropBoxProps, {
|
|
574
|
+
isResponsivePadding: true,
|
|
575
|
+
needFocusScope: true,
|
|
576
|
+
onClose: _this8.togglePopup
|
|
577
|
+
}), getCustomDropBoxHeaderPlaceHolder && getCustomDropBoxHeaderPlaceHolder(_this8.props), /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
578
|
+
flexible: true,
|
|
579
|
+
shrink: true,
|
|
580
|
+
scroll: "vertical",
|
|
581
|
+
className: "".concat(tabletMode ? '' : _TabsModule["default"].menuBox, " ").concat(moreBoxClass),
|
|
582
|
+
onScroll: _this8.onScroll
|
|
583
|
+
}, _react["default"].Children.map(moreTabs, function (child) {
|
|
584
|
+
if (!child) {
|
|
585
|
+
return null;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
var _child$props = child.props,
|
|
589
|
+
text = _child$props.text,
|
|
590
|
+
id = _child$props.id,
|
|
591
|
+
title = _child$props.title,
|
|
592
|
+
isLink = _child$props.isLink,
|
|
593
|
+
href = _child$props.href,
|
|
594
|
+
children = _child$props.children,
|
|
595
|
+
dataId = _child$props.dataId;
|
|
596
|
+
var value = text ? text : showTitleInMoreOptions ? title : null;
|
|
597
|
+
return /*#__PURE__*/_react["default"].isValidElement(child) && /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({
|
|
598
|
+
key: id,
|
|
599
|
+
value: value,
|
|
600
|
+
onClick: _this8.moreTabSelect,
|
|
601
|
+
id: id,
|
|
602
|
+
title: title || text,
|
|
603
|
+
isLink: isLink,
|
|
604
|
+
href: href,
|
|
605
|
+
autoHover: true,
|
|
606
|
+
customClass: {
|
|
607
|
+
customListItem: menuItemClass
|
|
608
|
+
},
|
|
609
|
+
target: "self",
|
|
610
|
+
dataId: "".concat(dataId, "_Tab")
|
|
611
|
+
}, ListItemProps), !showTitleInMoreOptions ? children : null);
|
|
612
|
+
})));
|
|
613
|
+
})) : null);
|
|
614
|
+
}
|
|
615
|
+
}, {
|
|
616
|
+
key: "render",
|
|
617
|
+
value: function render() {
|
|
618
|
+
var _this$props9 = this.props,
|
|
619
|
+
style = _this$props9.style,
|
|
620
|
+
className = _this$props9.className,
|
|
621
|
+
dataId = _this$props9.dataId,
|
|
622
|
+
highlightClass = _this$props9.highlightClass,
|
|
623
|
+
type = _this$props9.type,
|
|
624
|
+
isAnimate = _this$props9.isAnimate,
|
|
625
|
+
needTabBorder = _this$props9.needTabBorder,
|
|
626
|
+
needBorder = _this$props9.needBorder,
|
|
627
|
+
needPadding = _this$props9.needPadding,
|
|
628
|
+
align = _this$props9.align,
|
|
629
|
+
needAppearance = _this$props9.needAppearance,
|
|
630
|
+
children = _this$props9.children,
|
|
631
|
+
containerClass = _this$props9.containerClass,
|
|
632
|
+
dataSelectorId = _this$props9.dataSelectorId;
|
|
633
|
+
var _this$state2 = this.state,
|
|
634
|
+
totalDimension = _this$state2.totalDimension,
|
|
635
|
+
tabDimensions = _this$state2.tabDimensions,
|
|
636
|
+
renderVirtualTabs = _this$state2.renderVirtualTabs;
|
|
637
|
+
|
|
638
|
+
var _this$responsiveTab = this.responsiveTab(totalDimension, tabDimensions),
|
|
639
|
+
mainTabs = _this$responsiveTab.mainTabs,
|
|
640
|
+
moreTabs = _this$responsiveTab.moreTabs,
|
|
641
|
+
otherTabs = _this$responsiveTab.otherTabs;
|
|
642
|
+
|
|
643
|
+
var appearanceClass = (0, _Common.cs)([_TabsModule["default"][type], needBorder && _TabsModule["default"]["".concat(type, "_border")], needPadding && _TabsModule["default"]["".concat(type, "_padding")]]);
|
|
644
|
+
var tabsClass = (0, _Common.cs)([_TabsModule["default"].tab, className, needAppearance && appearanceClass]);
|
|
645
|
+
var hlClass = (0, _Common.cs)([_TabsModule["default"].highlight, highlightClass, isAnimate && _TabsModule["default"].lineAnimate]);
|
|
646
|
+
return /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
647
|
+
className: containerClass,
|
|
648
|
+
dataSelectorId: dataSelectorId
|
|
649
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
650
|
+
alignBox: align === 'vertical' ? 'row' : 'column',
|
|
651
|
+
className: tabsClass,
|
|
652
|
+
style: style
|
|
653
|
+
}, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
|
|
654
|
+
eleRef: this.getTabsRef,
|
|
655
|
+
flexible: true
|
|
656
|
+
}, renderVirtualTabs && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
657
|
+
alignBox: align === 'vertical' ? 'row' : 'column',
|
|
658
|
+
className: _TabsModule["default"].hidden
|
|
659
|
+
}, this.renderTabs(children, [], true)), /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
|
|
660
|
+
alignBox: align === 'vertical' ? 'row' : 'column'
|
|
661
|
+
}, this.renderTabs(mainTabs, moreTabs, false))), otherTabs.length ? /*#__PURE__*/_react["default"].createElement(_Layout.Box, null, otherTabs) : null, isAnimate && needTabBorder && needAppearance && /*#__PURE__*/_react["default"].createElement("div", {
|
|
662
|
+
className: hlClass,
|
|
663
|
+
ref: this.getHighlightRef,
|
|
664
|
+
"data-id": dataId,
|
|
665
|
+
"data-test-id": dataId
|
|
666
|
+
})));
|
|
667
|
+
}
|
|
668
|
+
}]);
|
|
669
|
+
|
|
670
|
+
return Tabs;
|
|
671
|
+
}(_react["default"].Component);
|
|
672
|
+
|
|
673
|
+
Tabs.propTypes = _propTypes.Tabs_propTypes;
|
|
674
|
+
Tabs.defaultProps = _objectSpread(_objectSpread({}, _defaultProps.Tabs_defaultProps), {}, {
|
|
675
|
+
childType: _Tab["default"]
|
|
676
|
+
});
|
|
677
|
+
|
|
678
|
+
var _default = (0, _Popup["default"])(Tabs);
|
|
679
|
+
|
|
680
|
+
exports["default"] = _default;
|