@capillarytech/blaze-ui 5.18.6 → 5.18.7
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/CapGraph/index.js +179 -630
- package/CapGraph/index.js.map +1 -1
- package/CapHamburgerMenu/README.md +234 -0
- package/CapHamburgerMenu/USE_CASES.md +48 -0
- package/CapHamburgerMenu/index.d.ts +6 -0
- package/CapHamburgerMenu/index.d.ts.map +1 -0
- package/CapHamburgerMenu/index.js +567 -613
- package/CapHamburgerMenu/index.js.map +1 -1
- package/CapHamburgerMenu/types.d.ts +161 -0
- package/CapHamburgerMenu/types.d.ts.map +1 -0
- package/index.d.ts +2 -2
- package/index.d.ts.map +1 -1
- package/index.js +856 -259
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/CapGraph/README.md +0 -69
- package/CapGraph/USE_CASES.md +0 -66
- package/CapGraph/constants.d.ts +0 -10
- package/CapGraph/constants.d.ts.map +0 -1
- package/CapGraph/index.d.ts +0 -9
- package/CapGraph/index.d.ts.map +0 -1
- package/CapGraph/types.d.ts +0 -55
- package/CapGraph/types.d.ts.map +0 -1
|
@@ -3560,6 +3560,14 @@ var _default = exports["default"] = SvgWarningCircle;
|
|
|
3560
3560
|
|
|
3561
3561
|
/***/ }),
|
|
3562
3562
|
|
|
3563
|
+
/***/ 18073:
|
|
3564
|
+
/***/ ((module) => {
|
|
3565
|
+
|
|
3566
|
+
"use strict";
|
|
3567
|
+
module.exports = require("react-virtuoso");
|
|
3568
|
+
|
|
3569
|
+
/***/ }),
|
|
3570
|
+
|
|
3563
3571
|
/***/ 18173:
|
|
3564
3572
|
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3565
3573
|
|
|
@@ -8633,14 +8641,6 @@ function isObjectLike(value) {
|
|
|
8633
8641
|
module.exports = isObjectLike;
|
|
8634
8642
|
|
|
8635
8643
|
|
|
8636
|
-
/***/ }),
|
|
8637
|
-
|
|
8638
|
-
/***/ 40861:
|
|
8639
|
-
/***/ ((module) => {
|
|
8640
|
-
|
|
8641
|
-
"use strict";
|
|
8642
|
-
module.exports = require("react-virtualized");
|
|
8643
|
-
|
|
8644
8644
|
/***/ }),
|
|
8645
8645
|
|
|
8646
8646
|
/***/ 40929:
|
|
@@ -16988,27 +16988,10 @@ var ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ = __webpack_require__(31601);
|
|
|
16988
16988
|
var ___CSS_LOADER_API_IMPORT___ = __webpack_require__(76314);
|
|
16989
16989
|
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);
|
|
16990
16990
|
// Module
|
|
16991
|
-
___CSS_LOADER_EXPORT___.push([module.id, `.mobile-view .ant-drawer.cap-hamburger-menu.ant-drawer-left .ant-drawer-content-wrapper{width:75% !important}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-header{padding:
|
|
16991
|
+
___CSS_LOADER_EXPORT___.push([module.id, `.mobile-view .ant-drawer.cap-hamburger-menu.ant-drawer-left .ant-drawer-content-wrapper{width:75% !important}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-header{padding:1.142rem 1.142rem .285rem;border-radius:0}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-header .ant-drawer-title{font-weight:400 !important}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-header .ant-drawer-title img{margin-right:.429rem;vertical-align:bottom}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-header .ant-drawer-title span.name{font-size:1.143rem;font-weight:500}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-header .ant-drawer-title .user-name{font-size:1rem;font-family:"Roboto-Regular",sans-serif;color:#5e6c84;margin-left:2.429rem;max-width:15.714rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body{padding:.571rem 0}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ui.list{margin-bottom:0}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ui.list .item{height:2.571rem;padding:.571rem 1.142rem}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ui.list .item .item-label{padding-top:.143rem}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ui.list .item .cap-icon-v2{color:#091e42;margin-top:-0.143rem;margin-right:-0.285rem}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ui.list .item.listItemSelected{color:#2466ea;background:#e9f0fe;border-left:.143rem solid #2466ea}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ui.list .item.nested{padding-left:2.285rem}.mobile-view .ant-drawer.cap-hamburger-menu .ant-drawer-content-wrapper .ant-drawer-body .ant-drawer-footer{font-size:1rem;font-family:"Roboto-Regular",sans-serif;border-top:.071rem solid #e8e8e8;padding:.857rem;position:fixed;bottom:0;width:75%}.mobile-view .org-select-selection{width:105%;display:flex;align-items:center;font-family:"Roboto",sans-serif;font-weight:400;justify-content:space-between;cursor:pointer;margin:.571rem 0;height:2.285rem;border:.071rem solid rgba(0,0,0,0)}.mobile-view .org-select-selection.open{border-radius:.285rem;border:.071rem solid #b3bac5}.mobile-view .org-select-selection.secondary-select{margin-left:0}.mobile-view .org-select-selected-value{font-size:1rem;font-weight:500;display:flex;align-items:center}.mobile-view .org-select-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;overflow:hidden;padding:.071rem 0 0}.mobile-view .org-select-selected-value-label{max-width:10.714rem}.mobile-view .org-select-selected-ou-value-label{display:inline-flex;align-items:baseline;justify-content:space-between;width:10.714rem}.mobile-view .org-select-selected-icon{margin-right:.571rem}.mobile-view .org-select-selected-icon{display:flex;align-items:center;position:relative;height:2.285rem;width:2.285rem;margin-right:.857rem}.mobile-view .org-select-selected-icon svg{background:#dfe2e7;border-radius:.857rem}.mobile-view .org-select-selected-icon .text-label{font-size:1rem;font-family:"Roboto-Regular",sans-serif;position:absolute;right:50%;top:50%;transform:translate(50%, -50%);line-height:1rem}.mobile-view .oval{width:3.428rem;height:3.428rem;background:#dfe2e7;border-radius:50%;margin:0 1.142rem 0 3.714rem}.mobile-view .org-select-header{padding:.571rem 1.142rem 1.428rem 1.142rem;font-size:1rem;font-weight:500}.mobile-view .org-select-select-item,.mobile-view .org-select-select-ou-org-item,.mobile-view .org-select-select-ou-item{cursor:pointer}.mobile-view .org-select-select-item:hover,.mobile-view .org-select-select-ou-org-item:hover,.mobile-view .org-select-select-ou-item:hover{background-color:#faf9f4}.mobile-view .org-select-select-item.selected,.mobile-view .org-select-select-ou-org-item.selected,.mobile-view .org-select-select-ou-item.selected{color:#2466ea;font-weight:500;position:relative;background-color:rgba(36,102,234,.1)}.mobile-view .org-select-select-item.selected:before,.mobile-view .org-select-select-ou-org-item.selected:before,.mobile-view .org-select-select-ou-item.selected:before{content:" ";width:.143rem;height:100%;left:0;top:0;position:absolute;background-color:#2466ea}.mobile-view .org-select-select-item{padding:.571rem .571rem .571rem 1.714rem}.mobile-view .org-select-select-ou-org-item{padding:.571rem .571rem .571rem .571rem}.mobile-view .org-select-select-ou-item{padding:.571rem 1.142rem .571rem 2.857rem;display:flex;justify-content:space-between;align-items:baseline}.mobile-view .org-select-no-results{display:flex;justify-content:center;flex-direction:column}.mobile-view .org-select-no-results .org-select-no-results-wrapper{position:relative}.mobile-view .org-select-no-results .org-select-no-results-wrapper .org-select-no-results-image{height:7.143rem;width:7.143rem;border-radius:50%;background:#f4f5f7;text-align:center;padding:.929rem 1.071rem;position:absolute;left:50%;transform:translate(-50%, 0%)}.mobile-view .org-select-no-results .org-select-no-results-wrapper .org-select-no-results-image .cap-icon-v2{font-size:5.286rem}.mobile-view .org-select-no-results .org-select-no-results-text{margin-top:7.714rem;text-align:center;color:#5e6c84;font-size:1rem}.mobile-view .ant-popover.org-select-popover{padding-top:0;width:18.571rem}.mobile-view .ant-popover.org-select-popover .ant-popover-inner-content{padding-left:0;padding-right:0}.mobile-view .ant-popover.org-select-popover .ant-popover-arrow{display:none}.mobile-view .org-select-search{padding:0 1.142rem 1.142rem 1.142rem}.mobile-view .org-select-items-wrapper{max-height:14.286rem;padding:0 1.142rem}.mobile-view .org-select-arrow{margin-right:.571rem}.mobile-view .org-select-slidebox .cap-slide-box-v2-container{width:100vw;min-width:100vw;max-width:100vw}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-header{padding:1.142rem;height:4rem}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-header .back-icon{margin-right:.857rem;vertical-align:text-top}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-header .back-icon+span{font-size:1.428rem}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-header .cap-slide-box-v2-close-icon{display:none}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-content-container{padding:0 !important;overflow-y:hidden}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-content-container .org-select-search .ant-input-prefix .cap-icon-v2{color:#5e6c84 !important}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-content-container .org-select-search .ant-input-lg{font-size:1rem;padding:.143rem 2rem .214rem 2.285rem}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-content-container .org-select-product{height:2.571rem;line-height:2.571rem;padding:0 2.285rem}.mobile-view .org-select-slidebox .cap-slide-box-v2-container .slidebox-content-container .org-select-product.selected{font-weight:500;color:#2466ea;background:#e9f0fe;border-left:.143rem solid #2466ea}.hamburgerIcon{height:2rem;width:2rem}.capLogo{height:1.857rem;width:1.857rem}.moreApplicationsIcon{height:1.714rem;width:1.714rem;margin-bottom:.071rem;margin-right:.643rem !important}`, ""]);
|
|
16992
16992
|
// Exports
|
|
16993
16993
|
___CSS_LOADER_EXPORT___.locals = {
|
|
16994
16994
|
"mobile-view": `mobile-view`,
|
|
16995
|
-
"ant-drawer": `ant-drawer`,
|
|
16996
|
-
"cap-hamburger-menu": `cap-hamburger-menu`,
|
|
16997
|
-
"ant-drawer-left": `ant-drawer-left`,
|
|
16998
|
-
"ant-drawer-content-wrapper": `ant-drawer-content-wrapper`,
|
|
16999
|
-
"ant-drawer-header": `ant-drawer-header`,
|
|
17000
|
-
"ant-drawer-title": `ant-drawer-title`,
|
|
17001
|
-
"name": `name`,
|
|
17002
|
-
"user-name": `user-name`,
|
|
17003
|
-
"ant-drawer-body": `ant-drawer-body`,
|
|
17004
|
-
"ui": `ui`,
|
|
17005
|
-
"list": `list`,
|
|
17006
|
-
"item": `item`,
|
|
17007
|
-
"item-label": `item-label`,
|
|
17008
|
-
"cap-icon-v2": `cap-icon-v2`,
|
|
17009
|
-
"selected": `selected`,
|
|
17010
|
-
"nested": `nested`,
|
|
17011
|
-
"ant-drawer-footer": `ant-drawer-footer`,
|
|
17012
16995
|
"org-select-selection": `org-select-selection`,
|
|
17013
16996
|
"open": `open`,
|
|
17014
16997
|
"secondary-select": `secondary-select`,
|
|
@@ -17023,14 +17006,13 @@ ___CSS_LOADER_EXPORT___.locals = {
|
|
|
17023
17006
|
"org-select-select-item": `org-select-select-item`,
|
|
17024
17007
|
"org-select-select-ou-org-item": `org-select-select-ou-org-item`,
|
|
17025
17008
|
"org-select-select-ou-item": `org-select-select-ou-item`,
|
|
17009
|
+
"selected": `selected`,
|
|
17026
17010
|
"org-select-no-results": `org-select-no-results`,
|
|
17027
17011
|
"org-select-no-results-wrapper": `org-select-no-results-wrapper`,
|
|
17028
17012
|
"org-select-no-results-image": `org-select-no-results-image`,
|
|
17013
|
+
"cap-icon-v2": `cap-icon-v2`,
|
|
17029
17014
|
"org-select-no-results-text": `org-select-no-results-text`,
|
|
17030
|
-
"ant-popover": `ant-popover`,
|
|
17031
17015
|
"org-select-popover": `org-select-popover`,
|
|
17032
|
-
"ant-popover-inner-content": `ant-popover-inner-content`,
|
|
17033
|
-
"ant-popover-arrow": `ant-popover-arrow`,
|
|
17034
17016
|
"org-select-search": `org-select-search`,
|
|
17035
17017
|
"org-select-items-wrapper": `org-select-items-wrapper`,
|
|
17036
17018
|
"org-select-arrow": `org-select-arrow`,
|
|
@@ -17040,9 +17022,10 @@ ___CSS_LOADER_EXPORT___.locals = {
|
|
|
17040
17022
|
"back-icon": `back-icon`,
|
|
17041
17023
|
"cap-slide-box-v2-close-icon": `cap-slide-box-v2-close-icon`,
|
|
17042
17024
|
"slidebox-content-container": `slidebox-content-container`,
|
|
17043
|
-
"
|
|
17044
|
-
"
|
|
17045
|
-
"
|
|
17025
|
+
"org-select-product": `org-select-product`,
|
|
17026
|
+
"hamburgerIcon": `hamburgerIcon`,
|
|
17027
|
+
"capLogo": `capLogo`,
|
|
17028
|
+
"moreApplicationsIcon": `moreApplicationsIcon`
|
|
17046
17029
|
};
|
|
17047
17030
|
module.exports = ___CSS_LOADER_EXPORT___;
|
|
17048
17031
|
|
|
@@ -17354,14 +17337,6 @@ var update = _node_modules_style_loader_dist_runtime_injectStylesIntoStyleTag_js
|
|
|
17354
17337
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ((_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default()) && (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) ? (_node_modules_css_loader_dist_cjs_js_ruleSet_1_rules_1_use_1_node_modules_sass_loader_dist_cjs_js_ruleSet_1_rules_1_use_2_styles_scss__WEBPACK_IMPORTED_MODULE_5___default().locals) : undefined);
|
|
17355
17338
|
|
|
17356
17339
|
|
|
17357
|
-
/***/ }),
|
|
17358
|
-
|
|
17359
|
-
/***/ 76480:
|
|
17360
|
-
/***/ ((module) => {
|
|
17361
|
-
|
|
17362
|
-
"use strict";
|
|
17363
|
-
module.exports = require("styled-components");
|
|
17364
|
-
|
|
17365
17340
|
/***/ }),
|
|
17366
17341
|
|
|
17367
17342
|
/***/ 76545:
|
|
@@ -21614,11 +21589,9 @@ var _forOwn = _interopRequireDefault(__webpack_require__(33215));
|
|
|
21614
21589
|
var _get = _interopRequireDefault(__webpack_require__(58156));
|
|
21615
21590
|
var _isEmpty = _interopRequireDefault(__webpack_require__(62193));
|
|
21616
21591
|
var _isEqual = _interopRequireDefault(__webpack_require__(2404));
|
|
21617
|
-
var
|
|
21618
|
-
var
|
|
21619
|
-
var Virtualized = _interopRequireWildcard(__webpack_require__(40861));
|
|
21592
|
+
var _react = _interopRequireWildcard(__webpack_require__(9206));
|
|
21593
|
+
var _reactVirtuoso = __webpack_require__(18073);
|
|
21620
21594
|
var _semanticUiReact = __webpack_require__(96117);
|
|
21621
|
-
var _styledComponents = _interopRequireDefault(__webpack_require__(76480));
|
|
21622
21595
|
var _icons = __webpack_require__(30775);
|
|
21623
21596
|
var _CapColumn = _interopRequireDefault(__webpack_require__(4757));
|
|
21624
21597
|
var _CapDrawer = _interopRequireDefault(__webpack_require__(78716));
|
|
@@ -21629,624 +21602,605 @@ var _CapLabel = _interopRequireDefault(__webpack_require__(92675));
|
|
|
21629
21602
|
var _CapRow = _interopRequireDefault(__webpack_require__(69813));
|
|
21630
21603
|
var _CapSlideBox = _interopRequireDefault(__webpack_require__(70225));
|
|
21631
21604
|
var styledVars = _interopRequireWildcard(__webpack_require__(56587));
|
|
21632
|
-
__webpack_require__(27945);
|
|
21605
|
+
var _styles = _interopRequireDefault(__webpack_require__(27945));
|
|
21633
21606
|
var _jsxRuntime = __webpack_require__(74848);
|
|
21634
|
-
|
|
21607
|
+
const _excluded = ["goToHome", "placement", "productName", "userData", "loadStorageItem", "changeOrgEntity", "selectOrganization", "sidebarContent", "selectedSidebarItem", "onSidebarClick", "noResultsText", "footer", "screenHeight", "screenWidth", "insights", "selectProduct", "defaultSelectedProduct"];
|
|
21608
|
+
/* eslint-disable max-lines */
|
|
21635
21609
|
/*
|
|
21636
21610
|
Hamburger menu for mobile view of app
|
|
21637
21611
|
|
|
21638
21612
|
Move this to cap-ui-library once hamburger menu and other needed components are prepared and tested
|
|
21639
21613
|
Also move hamburger.svg and cap-logo-mobile.svg images to ui library assets/images and use from there.
|
|
21640
21614
|
*/
|
|
21641
|
-
// import { LogoBackground } from '../assets/icons';
|
|
21642
21615
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
21643
21616
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
21644
|
-
function
|
|
21645
|
-
|
|
21617
|
+
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
21618
|
+
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
21646
21619
|
const capLogo = __webpack_require__(73770);
|
|
21647
21620
|
const hamburgerIcon = __webpack_require__(94052);
|
|
21648
21621
|
const moreApplications = __webpack_require__(39761);
|
|
21649
21622
|
const PRODUCT_MASTERS = 'masters';
|
|
21650
|
-
const
|
|
21651
|
-
|
|
21652
|
-
|
|
21653
|
-
|
|
21654
|
-
|
|
21655
|
-
|
|
21656
|
-
|
|
21657
|
-
|
|
21658
|
-
|
|
21659
|
-
|
|
21660
|
-
|
|
21661
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
}
|
|
21670
|
-
|
|
21623
|
+
const CapHamburgerMenu = _ref => {
|
|
21624
|
+
let {
|
|
21625
|
+
goToHome,
|
|
21626
|
+
placement = 'left',
|
|
21627
|
+
productName,
|
|
21628
|
+
userData = {},
|
|
21629
|
+
loadStorageItem,
|
|
21630
|
+
changeOrgEntity,
|
|
21631
|
+
selectOrganization,
|
|
21632
|
+
sidebarContent = [],
|
|
21633
|
+
selectedSidebarItem,
|
|
21634
|
+
onSidebarClick,
|
|
21635
|
+
noResultsText,
|
|
21636
|
+
footer,
|
|
21637
|
+
screenHeight,
|
|
21638
|
+
screenWidth,
|
|
21639
|
+
insights,
|
|
21640
|
+
selectProduct,
|
|
21641
|
+
defaultSelectedProduct
|
|
21642
|
+
} = _ref,
|
|
21643
|
+
restProps = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
21644
|
+
// Initialize menu items from sidebarContent
|
|
21645
|
+
const initialMenuItems = (0, _react.useMemo)(() => {
|
|
21646
|
+
const menuItems = [];
|
|
21647
|
+
if (!(0, _isEmpty.default)(sidebarContent)) {
|
|
21648
|
+
sidebarContent.forEach((item, i) => {
|
|
21649
|
+
if (!(0, _isEmpty.default)(item.children)) {
|
|
21650
|
+
menuItems.push({
|
|
21651
|
+
label: item.label,
|
|
21652
|
+
hasChildren: true,
|
|
21653
|
+
expanded: i === 0,
|
|
21654
|
+
children: item.children
|
|
21655
|
+
});
|
|
21656
|
+
} else {
|
|
21657
|
+
menuItems.push({
|
|
21658
|
+
label: item.label,
|
|
21659
|
+
value: item.value // Store value for reference, even though MenuItemWithState doesn't require it
|
|
21660
|
+
});
|
|
21661
|
+
}
|
|
21662
|
+
});
|
|
21663
|
+
}
|
|
21664
|
+
return menuItems;
|
|
21665
|
+
}, [sidebarContent]);
|
|
21666
|
+
|
|
21667
|
+
// Helper function to get proxy org list
|
|
21668
|
+
const getProxyOrgList = props => {
|
|
21669
|
+
const {
|
|
21670
|
+
userData: data = {}
|
|
21671
|
+
} = props;
|
|
21672
|
+
const proxyOrgList = [];
|
|
21673
|
+
if (data != null && data.user && Object.keys(data.user).length > 0) {
|
|
21671
21674
|
const {
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
return {
|
|
21676
|
-
menuItems
|
|
21677
|
-
};
|
|
21678
|
-
});
|
|
21679
|
-
this.getOuList = orgItem => {
|
|
21675
|
+
orgDetails = {},
|
|
21676
|
+
user = {}
|
|
21677
|
+
} = data;
|
|
21680
21678
|
const {
|
|
21681
|
-
|
|
21682
|
-
} =
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21686
|
-
accessibleOus.push({
|
|
21687
|
-
label: item.ouName,
|
|
21688
|
-
value: item.ouID,
|
|
21689
|
-
key: item.ouID
|
|
21690
|
-
});
|
|
21691
|
-
});
|
|
21692
|
-
}
|
|
21693
|
-
return accessibleOus;
|
|
21694
|
-
};
|
|
21695
|
-
this.getProxyOrgList = function (props) {
|
|
21696
|
-
if (props === void 0) {
|
|
21697
|
-
props = _this.props;
|
|
21698
|
-
}
|
|
21679
|
+
name: selectedOrgName
|
|
21680
|
+
} = orgDetails;
|
|
21681
|
+
let {
|
|
21682
|
+
org_id: selectedOrgId
|
|
21683
|
+
} = orgDetails;
|
|
21699
21684
|
const {
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
21711
|
-
|
|
21712
|
-
|
|
21713
|
-
|
|
21714
|
-
|
|
21715
|
-
|
|
21716
|
-
accessibleOUList
|
|
21717
|
-
|
|
21718
|
-
|
|
21719
|
-
|
|
21720
|
-
|
|
21721
|
-
|
|
21722
|
-
label: selectedOrgName,
|
|
21723
|
-
value: selectedOrgId,
|
|
21724
|
-
key: selectedOrgId
|
|
21725
|
-
};
|
|
21726
|
-
// add ou list for selected org if available
|
|
21727
|
-
if (!(0, _isEmpty.default)(accessibleOUList)) {
|
|
21728
|
-
selectedOrg.accessibleOus = [];
|
|
21729
|
-
(0, _forOwn.default)(accessibleOUList, (ouId, ouName) => {
|
|
21730
|
-
selectedOrg.accessibleOus.push({
|
|
21731
|
-
label: ouName,
|
|
21732
|
-
value: ouId,
|
|
21733
|
-
key: ouId
|
|
21734
|
-
});
|
|
21685
|
+
proxyOrgList: orgList = [],
|
|
21686
|
+
accessibleOUList
|
|
21687
|
+
} = user;
|
|
21688
|
+
|
|
21689
|
+
// Fetching current selected org details and adding to org list dropdown
|
|
21690
|
+
if (!(0, _isEmpty.default)(selectedOrgId)) {
|
|
21691
|
+
selectedOrgId = parseInt(String(selectedOrgId), 10);
|
|
21692
|
+
const selectedOrg = {
|
|
21693
|
+
label: selectedOrgName || '',
|
|
21694
|
+
value: selectedOrgId,
|
|
21695
|
+
key: selectedOrgId
|
|
21696
|
+
};
|
|
21697
|
+
|
|
21698
|
+
// Add ou list for selected org if available
|
|
21699
|
+
if (!(0, _isEmpty.default)(accessibleOUList)) {
|
|
21700
|
+
selectedOrg.accessibleOus = [];
|
|
21701
|
+
(0, _forOwn.default)(accessibleOUList, (ouId, ouName) => {
|
|
21702
|
+
var _selectedOrg$accessib;
|
|
21703
|
+
(_selectedOrg$accessib = selectedOrg.accessibleOus) == null || _selectedOrg$accessib.push({
|
|
21704
|
+
label: ouName,
|
|
21705
|
+
value: ouId,
|
|
21706
|
+
key: ouId
|
|
21735
21707
|
});
|
|
21736
|
-
}
|
|
21737
|
-
proxyOrgList.push(selectedOrg);
|
|
21738
|
-
}
|
|
21739
|
-
if (orgList && orgList.length) {
|
|
21740
|
-
orgList.forEach(item => {
|
|
21741
|
-
if (parseInt(item.orgID, 10) !== parseInt(selectedOrgId, 10)) {
|
|
21742
|
-
const id = parseInt(item.orgID, 10);
|
|
21743
|
-
const name = item.orgName;
|
|
21744
|
-
const orgObj = {
|
|
21745
|
-
label: name,
|
|
21746
|
-
value: id,
|
|
21747
|
-
key: id
|
|
21748
|
-
};
|
|
21749
|
-
if (item.ouList) {
|
|
21750
|
-
orgObj.accessibleOus = _this.getOuList(item);
|
|
21751
|
-
}
|
|
21752
|
-
proxyOrgList.push(orgObj);
|
|
21753
|
-
}
|
|
21754
21708
|
});
|
|
21755
21709
|
}
|
|
21710
|
+
proxyOrgList.push(selectedOrg);
|
|
21756
21711
|
}
|
|
21757
|
-
|
|
21758
|
-
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
const intlProductName = this.props[productName];
|
|
21772
|
-
const moduleName = intlProductName || module.name.toLowerCase();
|
|
21773
|
-
productsList.push({
|
|
21774
|
-
value: moduleName,
|
|
21775
|
-
url: module.url,
|
|
21776
|
-
key: module.code
|
|
21777
|
-
});
|
|
21712
|
+
if (orgList && orgList.length) {
|
|
21713
|
+
orgList.forEach(item => {
|
|
21714
|
+
if (parseInt(String(item.orgID), 10) !== parseInt(String(selectedOrgId), 10)) {
|
|
21715
|
+
const id = parseInt(String(item.orgID), 10);
|
|
21716
|
+
const name = item.orgName;
|
|
21717
|
+
const orgObj = {
|
|
21718
|
+
label: name,
|
|
21719
|
+
value: id,
|
|
21720
|
+
key: id
|
|
21721
|
+
};
|
|
21722
|
+
if (item.ouList) {
|
|
21723
|
+
orgObj.accessibleOus = getOuList(item);
|
|
21724
|
+
}
|
|
21725
|
+
proxyOrgList.push(orgObj);
|
|
21778
21726
|
}
|
|
21779
21727
|
});
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
|
|
21728
|
+
}
|
|
21729
|
+
}
|
|
21730
|
+
return proxyOrgList;
|
|
21731
|
+
};
|
|
21732
|
+
const getOuList = orgItem => {
|
|
21733
|
+
const {
|
|
21734
|
+
ouList = []
|
|
21735
|
+
} = orgItem;
|
|
21736
|
+
const accessibleOus = [];
|
|
21737
|
+
if (ouList.length) {
|
|
21738
|
+
ouList.forEach(item => {
|
|
21739
|
+
accessibleOus.push({
|
|
21740
|
+
label: item.ouName,
|
|
21741
|
+
value: item.ouID,
|
|
21742
|
+
key: item.ouID
|
|
21743
|
+
});
|
|
21744
|
+
});
|
|
21745
|
+
}
|
|
21746
|
+
return accessibleOus;
|
|
21747
|
+
};
|
|
21748
|
+
const [isOpen, setIsOpen] = (0, _react.useState)(false);
|
|
21749
|
+
const [orgList, setOrgList] = (0, _react.useState)(() => getProxyOrgList(_extends({
|
|
21750
|
+
userData,
|
|
21751
|
+
loadStorageItem,
|
|
21752
|
+
changeOrgEntity,
|
|
21753
|
+
selectOrganization,
|
|
21754
|
+
sidebarContent,
|
|
21755
|
+
selectedSidebarItem,
|
|
21756
|
+
onSidebarClick,
|
|
21757
|
+
noResultsText,
|
|
21758
|
+
footer,
|
|
21759
|
+
screenHeight,
|
|
21760
|
+
screenWidth,
|
|
21761
|
+
insights,
|
|
21762
|
+
selectProduct,
|
|
21763
|
+
defaultSelectedProduct
|
|
21764
|
+
}, restProps)));
|
|
21765
|
+
const [menuItems, setMenuItems] = (0, _react.useState)(initialMenuItems);
|
|
21766
|
+
const [orgSearchText, setOrgSearchText] = (0, _react.useState)('');
|
|
21767
|
+
const [orgSelectionBoxOpen, setOrgSelectionBoxOpen] = (0, _react.useState)(false);
|
|
21768
|
+
const [productListOpen, setProductListOpen] = (0, _react.useState)(false);
|
|
21769
|
+
const prevUserRef = (0, _react.useRef)((0, _get.default)(userData, 'user'));
|
|
21770
|
+
const prevSidebarContentRef = (0, _react.useRef)(sidebarContent);
|
|
21771
|
+
|
|
21772
|
+
// Update orgList when userData.user changes (mimicking componentWillReceiveProps behavior)
|
|
21773
|
+
(0, _react.useEffect)(() => {
|
|
21774
|
+
const currentUser = (0, _get.default)(userData, 'user');
|
|
21775
|
+
if (!(0, _isEmpty.default)(currentUser) && !(0, _isEqual.default)(currentUser, prevUserRef.current)) {
|
|
21776
|
+
prevUserRef.current = currentUser;
|
|
21777
|
+
setOrgList(getProxyOrgList(_extends({
|
|
21778
|
+
userData,
|
|
21779
|
+
loadStorageItem,
|
|
21780
|
+
changeOrgEntity,
|
|
21781
|
+
selectOrganization,
|
|
21782
|
+
sidebarContent,
|
|
21783
|
+
selectedSidebarItem,
|
|
21784
|
+
onSidebarClick,
|
|
21785
|
+
noResultsText,
|
|
21786
|
+
footer,
|
|
21787
|
+
screenHeight,
|
|
21788
|
+
screenWidth,
|
|
21789
|
+
insights,
|
|
21790
|
+
selectProduct,
|
|
21791
|
+
defaultSelectedProduct
|
|
21792
|
+
}, restProps)));
|
|
21793
|
+
}
|
|
21794
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21795
|
+
}, [userData]); // Only depend on userData; other props are stable or handled separately
|
|
21796
|
+
|
|
21797
|
+
// Update menuItems when sidebarContent changes
|
|
21798
|
+
(0, _react.useEffect)(() => {
|
|
21799
|
+
// Only update if sidebarContent actually changed (deep comparison) to prevent infinite loops
|
|
21800
|
+
if (!(0, _isEqual.default)(sidebarContent, prevSidebarContentRef.current)) {
|
|
21801
|
+
prevSidebarContentRef.current = sidebarContent;
|
|
21802
|
+
setMenuItems(initialMenuItems);
|
|
21803
|
+
}
|
|
21804
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
21805
|
+
}, [sidebarContent]); // Only depend on sidebarContent; initialMenuItems is derived from it via useMemo
|
|
21806
|
+
|
|
21807
|
+
const capitalize = function (text) {
|
|
21808
|
+
if (text === void 0) {
|
|
21809
|
+
text = '';
|
|
21810
|
+
}
|
|
21811
|
+
return text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
21812
|
+
};
|
|
21813
|
+
const toggleIsOpen = () => setIsOpen(prev => !prev);
|
|
21814
|
+
const toggleMenuItemExpanded = i => {
|
|
21815
|
+
setMenuItems(prevMenuItems => {
|
|
21816
|
+
const newMenuItems = [...prevMenuItems];
|
|
21817
|
+
if (newMenuItems[i]) {
|
|
21818
|
+
newMenuItems[i] = _extends({}, newMenuItems[i], {
|
|
21819
|
+
expanded: !newMenuItems[i].expanded
|
|
21820
|
+
});
|
|
21821
|
+
}
|
|
21822
|
+
return newMenuItems;
|
|
21823
|
+
});
|
|
21824
|
+
};
|
|
21825
|
+
const getProductList = () => {
|
|
21826
|
+
const {
|
|
21827
|
+
currentOrgDetails = {}
|
|
21828
|
+
} = userData;
|
|
21829
|
+
const {
|
|
21830
|
+
module_details: moduleDetails = []
|
|
21831
|
+
} = currentOrgDetails;
|
|
21832
|
+
const productsList = [];
|
|
21833
|
+
if (Object.keys(currentOrgDetails).length !== 0) {
|
|
21834
|
+
moduleDetails.forEach(module => {
|
|
21835
|
+
if (module.name.toLowerCase() !== PRODUCT_MASTERS) {
|
|
21836
|
+
const productName = module.namespace;
|
|
21837
|
+
const intlProductName = restProps[productName];
|
|
21838
|
+
const moduleName = intlProductName || module.name.toLowerCase();
|
|
21839
|
+
productsList.push({
|
|
21840
|
+
value: moduleName,
|
|
21841
|
+
url: module.url,
|
|
21842
|
+
key: module.code
|
|
21843
|
+
});
|
|
21844
|
+
}
|
|
21845
|
+
});
|
|
21846
|
+
// Below change is temporary and should be fixed once we get correct modules list
|
|
21847
|
+
// Adding insights+ to module list
|
|
21848
|
+
if (insights) {
|
|
21783
21849
|
productsList.push({
|
|
21784
|
-
value:
|
|
21850
|
+
value: insights,
|
|
21785
21851
|
url: 'analytics/v2/',
|
|
21786
21852
|
key: 'insights'
|
|
21787
21853
|
});
|
|
21788
|
-
// }
|
|
21789
21854
|
}
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
}
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
|
|
21807
|
-
|
|
21808
|
-
|
|
21809
|
-
|
|
21810
|
-
|
|
21811
|
-
|
|
21812
|
-
|
|
21813
|
-
|
|
21814
|
-
|
|
21815
|
-
|
|
21816
|
-
};
|
|
21817
|
-
this.ouSearchCondition = item => {
|
|
21818
|
-
const {
|
|
21819
|
-
orgSearchText
|
|
21820
|
-
} = this.state;
|
|
21821
|
-
return (item.accessibleOus || []).filter(ou => ou.label.toLowerCase().includes((orgSearchText || '').toLowerCase()));
|
|
21822
|
-
};
|
|
21823
|
-
this.getOrgListItem = item => {
|
|
21824
|
-
const selectedItem = this.props.loadStorageItem('orgID');
|
|
21825
|
-
const selectedOuItem = this.props.loadStorageItem('ouId');
|
|
21826
|
-
const isOuPresent = selectedOuItem !== null && selectedOuItem !== undefined && selectedOuItem !== -1;
|
|
21827
|
-
const itemLabel = item.accessibleOus ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21855
|
+
}
|
|
21856
|
+
return productsList;
|
|
21857
|
+
};
|
|
21858
|
+
const handleProductChange = product => {
|
|
21859
|
+
if (product.url !== window.location.pathname) {
|
|
21860
|
+
window.location.pathname = product.url;
|
|
21861
|
+
}
|
|
21862
|
+
};
|
|
21863
|
+
const orgSearchCondition = item => {
|
|
21864
|
+
return orgSearchText === '' || (item.label || '').toLowerCase().indexOf((orgSearchText || '').toLowerCase()) !== -1;
|
|
21865
|
+
};
|
|
21866
|
+
const ouSearchCondition = item => {
|
|
21867
|
+
return (item.accessibleOus || []).filter(ou => ou.label.toLowerCase().includes((orgSearchText || '').toLowerCase()));
|
|
21868
|
+
};
|
|
21869
|
+
const getOrgListItem = item => {
|
|
21870
|
+
const selectedItem = loadStorageItem == null ? void 0 : loadStorageItem('orgID');
|
|
21871
|
+
const selectedOuItem = loadStorageItem == null ? void 0 : loadStorageItem('ouId');
|
|
21872
|
+
const isOuPresent = selectedOuItem !== null && selectedOuItem !== undefined && selectedOuItem !== -1;
|
|
21873
|
+
const itemLabel = item.accessibleOus ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21874
|
+
style: {
|
|
21875
|
+
display: 'flex',
|
|
21876
|
+
alignItems: 'center'
|
|
21877
|
+
},
|
|
21878
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
21879
|
+
type: "sitemap",
|
|
21880
|
+
size: "s",
|
|
21828
21881
|
style: {
|
|
21829
|
-
|
|
21830
|
-
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
}
|
|
21843
|
-
|
|
21844
|
-
|
|
21882
|
+
marginRight: styledVars.CAP_SPACE_08
|
|
21883
|
+
}
|
|
21884
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21885
|
+
className: _styles.default['org-select-overflow-ellipsis'],
|
|
21886
|
+
children: item.label
|
|
21887
|
+
})]
|
|
21888
|
+
}) : item.label;
|
|
21889
|
+
const customClassname = item.accessibleOus ? _styles.default['org-select-select-ou-org-item'] : _styles.default['org-select-select-item'];
|
|
21890
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
21891
|
+
type: "h6",
|
|
21892
|
+
onClick: () => handleChange(item),
|
|
21893
|
+
className: (0, _classnames.default)(customClassname, {
|
|
21894
|
+
[_styles.default.selected]: selectedItem === item.value && !isOuPresent
|
|
21895
|
+
}, _styles.default['org-select-overflow-ellipsis']),
|
|
21896
|
+
title: item.label,
|
|
21897
|
+
children: itemLabel
|
|
21898
|
+
}, "org-key-" + item.key);
|
|
21899
|
+
};
|
|
21900
|
+
const getOuListItem = (item, ou) => {
|
|
21901
|
+
const selectedOuItem = loadStorageItem == null ? void 0 : loadStorageItem('ouId');
|
|
21902
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21903
|
+
className: (0, _classnames.default)(_styles.default['org-select-select-ou-item'], {
|
|
21904
|
+
[_styles.default.selected]: selectedOuItem === ou.value
|
|
21905
|
+
}),
|
|
21906
|
+
onClick: () => handleChange(item, ou),
|
|
21907
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
21845
21908
|
type: "h6",
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21909
|
+
style: {
|
|
21910
|
+
maxWidth: 125
|
|
21911
|
+
},
|
|
21912
|
+
className: _styles.default['org-select-overflow-ellipsis'],
|
|
21913
|
+
title: ou.label,
|
|
21914
|
+
children: ou.label
|
|
21915
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
21916
|
+
type: "label3",
|
|
21917
|
+
style: {
|
|
21918
|
+
maxWidth: 70
|
|
21919
|
+
},
|
|
21920
|
+
className: _styles.default['org-select-overflow-ellipsis'],
|
|
21850
21921
|
title: item.label,
|
|
21851
|
-
children:
|
|
21852
|
-
}
|
|
21853
|
-
};
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
|
|
21857
|
-
|
|
21858
|
-
|
|
21859
|
-
|
|
21860
|
-
onClick: () => this.handleChange(item, ou),
|
|
21861
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
21862
|
-
type: "h6",
|
|
21863
|
-
style: {
|
|
21864
|
-
maxWidth: 125
|
|
21865
|
-
},
|
|
21866
|
-
className: clsPrefix + "-overflow-ellipsis",
|
|
21867
|
-
title: ou.label,
|
|
21868
|
-
children: ou.label
|
|
21869
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
21870
|
-
type: "label3",
|
|
21871
|
-
style: {
|
|
21872
|
-
maxWidth: 70
|
|
21873
|
-
},
|
|
21874
|
-
className: clsPrefix + "-overflow-ellipsis",
|
|
21875
|
-
title: item.label,
|
|
21876
|
-
children: item.label
|
|
21877
|
-
})]
|
|
21878
|
-
}, "ou-key-" + ou.key);
|
|
21879
|
-
};
|
|
21880
|
-
this.getOrgItems = () => {
|
|
21881
|
-
const {
|
|
21882
|
-
orgList = []
|
|
21883
|
-
} = this.state;
|
|
21884
|
-
const dropdownItems = [];
|
|
21885
|
-
orgList.forEach(item => {
|
|
21886
|
-
if (this.orgSearchCondition(item)) {
|
|
21887
|
-
dropdownItems.push(this.getOrgListItem(item));
|
|
21888
|
-
}
|
|
21889
|
-
if (item.accessibleOus) {
|
|
21890
|
-
const ouList = this.orgSearchCondition(item) ? item.accessibleOus : this.ouSearchCondition(item);
|
|
21891
|
-
ouList.forEach(ou => {
|
|
21892
|
-
if (ou.key !== -1) {
|
|
21893
|
-
dropdownItems.push(this.getOuListItem(item, ou));
|
|
21894
|
-
}
|
|
21895
|
-
});
|
|
21896
|
-
}
|
|
21897
|
-
});
|
|
21898
|
-
return dropdownItems;
|
|
21899
|
-
};
|
|
21900
|
-
this.handleSearch = e => this.setState({
|
|
21901
|
-
orgSearchText: e.target.value
|
|
21902
|
-
});
|
|
21903
|
-
this.clearSearch = () => this.setState({
|
|
21904
|
-
orgSearchText: ''
|
|
21905
|
-
});
|
|
21906
|
-
this.handleChange = function (item, ou) {
|
|
21907
|
-
if (ou === void 0) {
|
|
21908
|
-
ou = {};
|
|
21922
|
+
children: item.label
|
|
21923
|
+
})]
|
|
21924
|
+
}, "ou-key-" + ou.key);
|
|
21925
|
+
};
|
|
21926
|
+
const getOrgItems = () => {
|
|
21927
|
+
const dropdownItems = [];
|
|
21928
|
+
orgList.forEach(item => {
|
|
21929
|
+
if (orgSearchCondition(item)) {
|
|
21930
|
+
dropdownItems.push(getOrgListItem(item));
|
|
21909
21931
|
}
|
|
21910
|
-
|
|
21911
|
-
|
|
21912
|
-
|
|
21913
|
-
|
|
21914
|
-
|
|
21932
|
+
if (item.accessibleOus) {
|
|
21933
|
+
const ouList = orgSearchCondition(item) ? item.accessibleOus : ouSearchCondition(item);
|
|
21934
|
+
ouList.forEach(ou => {
|
|
21935
|
+
if (ou.key !== -1) {
|
|
21936
|
+
dropdownItems.push(getOuListItem(item, ou));
|
|
21937
|
+
}
|
|
21938
|
+
});
|
|
21915
21939
|
}
|
|
21916
|
-
};
|
|
21917
|
-
this.hideOrgSlidebox = () => this.setState({
|
|
21918
|
-
orgSelectionBoxOpen: false,
|
|
21919
|
-
orgSearchText: ''
|
|
21920
21940
|
});
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21932
|
-
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21939
|
-
|
|
21940
|
-
|
|
21941
|
+
return dropdownItems;
|
|
21942
|
+
};
|
|
21943
|
+
const handleSearch = e => setOrgSearchText(e.target.value);
|
|
21944
|
+
const clearSearch = () => setOrgSearchText('');
|
|
21945
|
+
const handleChange = function (item, ou) {
|
|
21946
|
+
if (ou === void 0) {
|
|
21947
|
+
ou = {};
|
|
21948
|
+
}
|
|
21949
|
+
const selectedItem = loadStorageItem == null ? void 0 : loadStorageItem('orgID');
|
|
21950
|
+
const selectedOuItem = loadStorageItem == null ? void 0 : loadStorageItem('ouId');
|
|
21951
|
+
hideOrgSlidebox();
|
|
21952
|
+
if (selectedItem !== item.value || selectedOuItem !== ou.value) {
|
|
21953
|
+
changeOrgEntity == null || changeOrgEntity(item.value, ou.value);
|
|
21954
|
+
}
|
|
21955
|
+
};
|
|
21956
|
+
const hideOrgSlidebox = () => {
|
|
21957
|
+
setOrgSelectionBoxOpen(false);
|
|
21958
|
+
setOrgSearchText('');
|
|
21959
|
+
};
|
|
21960
|
+
const renderOrgList = () => {
|
|
21961
|
+
const itemsHtml = getOrgItems();
|
|
21962
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
21963
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapInput.default.Search, {
|
|
21964
|
+
placeholder: selectOrganization,
|
|
21965
|
+
onChange: handleSearch,
|
|
21966
|
+
value: orgSearchText,
|
|
21967
|
+
onClear: clearSearch,
|
|
21968
|
+
className: (0, _classnames.default)(_styles.default['org-select-search'])
|
|
21969
|
+
}), itemsHtml.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21970
|
+
className: (0, _classnames.default)(_styles.default['org-select-items-wrapper']),
|
|
21971
|
+
style: {
|
|
21972
|
+
height: screenHeight ? screenHeight - 112 : undefined,
|
|
21973
|
+
maxHeight: screenHeight ? screenHeight - 112 : undefined,
|
|
21974
|
+
overflowY: 'auto'
|
|
21975
|
+
},
|
|
21976
|
+
children: screenWidth && screenHeight && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactVirtuoso.Virtuoso, {
|
|
21941
21977
|
style: {
|
|
21942
|
-
height: screenHeight - 112,
|
|
21943
|
-
maxHeight: screenHeight - 112,
|
|
21944
|
-
overflowY: 'auto'
|
|
21945
|
-
},
|
|
21946
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Virtualized.List, {
|
|
21947
|
-
rowCount: (itemsHtml || []).length,
|
|
21948
21978
|
width: screenWidth - 30,
|
|
21949
|
-
height: screenHeight - 60
|
|
21950
|
-
rowHeight: 36,
|
|
21951
|
-
rowRenderer: value => this.rowRenderer(value, itemsHtml),
|
|
21952
|
-
overscanRowCount: 5
|
|
21953
|
-
})
|
|
21954
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21955
|
-
className: (0, _classnames.default)(clsPrefix + "-no-results"),
|
|
21956
|
-
style: {
|
|
21957
|
-
height: screenHeight - 175
|
|
21979
|
+
height: screenHeight - 60
|
|
21958
21980
|
},
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
color: styledVars.CAP_G06
|
|
21966
|
-
},
|
|
21967
|
-
type: "alert"
|
|
21968
|
-
})
|
|
21969
|
-
})
|
|
21970
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21971
|
-
className: (0, _classnames.default)(clsPrefix + "-no-results-text"),
|
|
21972
|
-
children: noResultsText
|
|
21973
|
-
})]
|
|
21974
|
-
})]
|
|
21975
|
-
});
|
|
21976
|
-
};
|
|
21977
|
-
this.renderOrgSelectionBox = () => {
|
|
21978
|
-
const {
|
|
21979
|
-
selectOrganization
|
|
21980
|
-
} = this.props;
|
|
21981
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSlideBox.default, {
|
|
21982
|
-
header: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
21983
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
21984
|
-
className: "material-icons back-icon",
|
|
21985
|
-
onClick: () => this.hideOrgSlidebox(),
|
|
21986
|
-
children: "arrow_back"
|
|
21987
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
21988
|
-
children: selectOrganization
|
|
21989
|
-
})]
|
|
21990
|
-
}),
|
|
21991
|
-
show: this.state.orgSelectionBoxOpen,
|
|
21992
|
-
size: "size-l",
|
|
21993
|
-
className: clsPrefix + "-slidebox",
|
|
21994
|
-
content: this.renderOrgList(),
|
|
21995
|
-
handleClose: () => this.hideOrgSlidebox()
|
|
21996
|
-
});
|
|
21997
|
-
};
|
|
21998
|
-
this.renderProductList = () => {
|
|
21999
|
-
const {
|
|
22000
|
-
selectProduct,
|
|
22001
|
-
defaultSelectedProduct
|
|
22002
|
-
} = this.props;
|
|
22003
|
-
const productList = this.getProductList();
|
|
22004
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSlideBox.default, {
|
|
22005
|
-
header: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
22006
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
22007
|
-
className: "material-icons back-icon",
|
|
22008
|
-
onClick: () => this.setState({
|
|
22009
|
-
productListOpen: false
|
|
22010
|
-
}),
|
|
22011
|
-
children: "arrow_back"
|
|
22012
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22013
|
-
children: selectProduct
|
|
22014
|
-
})]
|
|
22015
|
-
}),
|
|
22016
|
-
show: this.state.productListOpen,
|
|
22017
|
-
size: "size-l",
|
|
22018
|
-
className: clsPrefix + "-slidebox",
|
|
22019
|
-
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
22020
|
-
children: productList.map(product => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22021
|
-
onClick: () => this.handleProductChange(product),
|
|
22022
|
-
className: clsPrefix + "-product" + (product.value === defaultSelectedProduct ? ' selected' : ''),
|
|
22023
|
-
children: this.capitalize(product.value)
|
|
22024
|
-
}, product.key || product.name))
|
|
22025
|
-
}),
|
|
22026
|
-
handleClose: () => this.setState({
|
|
22027
|
-
productListOpen: false
|
|
21981
|
+
totalCount: (itemsHtml || []).length,
|
|
21982
|
+
fixedItemHeight: 36,
|
|
21983
|
+
itemContent: index => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21984
|
+
children: itemsHtml[index]
|
|
21985
|
+
}),
|
|
21986
|
+
overscan: 5
|
|
22028
21987
|
})
|
|
22029
|
-
})
|
|
22030
|
-
|
|
22031
|
-
|
|
22032
|
-
|
|
22033
|
-
|
|
22034
|
-
|
|
22035
|
-
|
|
22036
|
-
|
|
22037
|
-
|
|
22038
|
-
|
|
22039
|
-
const selectedOrg = loadStorageItem('orgID');
|
|
22040
|
-
const selectedOu = loadStorageItem('ouId');
|
|
22041
|
-
const selectedItemIndex = (0, _findIndex.default)(orgList, item => item.value === selectedOrg);
|
|
22042
|
-
const itemDetails = orgList[selectedItemIndex] || {};
|
|
22043
|
-
let selectedOuItemIndex = -1;
|
|
22044
|
-
if (selectedOu && selectedOu !== -1) {
|
|
22045
|
-
selectedOuItemIndex = (0, _findIndex.default)(itemDetails.accessibleOus, ou => ou.value === selectedOu);
|
|
22046
|
-
}
|
|
22047
|
-
let selectedItemLabel = selectOrganization;
|
|
22048
|
-
if (selectedItemIndex !== -1) {
|
|
22049
|
-
selectedItemLabel = itemDetails.label;
|
|
22050
|
-
}
|
|
22051
|
-
if (selectedOuItemIndex !== -1) {
|
|
22052
|
-
selectedItemLabel = itemDetails.accessibleOus[selectedOuItemIndex].label;
|
|
22053
|
-
}
|
|
22054
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22055
|
-
className: (0, _classnames.default)(clsPrefix + "-selection"),
|
|
22056
|
-
onClick: () => this.setOrgSelectionBoxOpen(true),
|
|
22057
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22058
|
-
className: clsPrefix + "-selected-value",
|
|
22059
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22060
|
-
className: clsPrefix + "-selected-icon",
|
|
22061
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LogoBackground, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22062
|
-
className: "text-label",
|
|
22063
|
-
children: selectedItemLabel[0]
|
|
22064
|
-
})]
|
|
22065
|
-
}), selectedOuItemIndex !== -1 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22066
|
-
className: clsPrefix + "-selected-ou-value-label",
|
|
22067
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
22068
|
-
type: "h4",
|
|
22069
|
-
style: {
|
|
22070
|
-
maxWidth: 110
|
|
22071
|
-
},
|
|
22072
|
-
className: clsPrefix + "-overflow-ellipsis",
|
|
22073
|
-
title: selectedItemLabel,
|
|
22074
|
-
children: selectedItemLabel
|
|
22075
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
22076
|
-
type: "label3",
|
|
21988
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
21989
|
+
className: (0, _classnames.default)(_styles.default['org-select-no-results']),
|
|
21990
|
+
style: {
|
|
21991
|
+
height: screenHeight ? screenHeight - 175 : undefined
|
|
21992
|
+
},
|
|
21993
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21994
|
+
className: (0, _classnames.default)(_styles.default['org-select-no-results-wrapper']),
|
|
21995
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
21996
|
+
className: (0, _classnames.default)(_styles.default['org-select-no-results-image']),
|
|
21997
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
22077
21998
|
style: {
|
|
22078
|
-
|
|
21999
|
+
color: styledVars.CAP_G06
|
|
22079
22000
|
},
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22083
|
-
|
|
22084
|
-
|
|
22001
|
+
type: "alert"
|
|
22002
|
+
})
|
|
22003
|
+
})
|
|
22004
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22005
|
+
className: (0, _classnames.default)(_styles.default['org-select-no-results-text']),
|
|
22006
|
+
children: noResultsText
|
|
22007
|
+
})]
|
|
22008
|
+
})]
|
|
22009
|
+
});
|
|
22010
|
+
};
|
|
22011
|
+
const renderOrgSelectionBox = () => {
|
|
22012
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSlideBox.default, {
|
|
22013
|
+
header: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
22014
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
22015
|
+
className: "material-icons back-icon",
|
|
22016
|
+
onClick: hideOrgSlidebox,
|
|
22017
|
+
children: "arrow_back"
|
|
22018
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22019
|
+
children: selectOrganization
|
|
22020
|
+
})]
|
|
22021
|
+
}),
|
|
22022
|
+
show: orgSelectionBoxOpen,
|
|
22023
|
+
size: "size-l",
|
|
22024
|
+
className: _styles.default['org-select-slidebox'],
|
|
22025
|
+
content: renderOrgList(),
|
|
22026
|
+
handleClose: hideOrgSlidebox
|
|
22027
|
+
});
|
|
22028
|
+
};
|
|
22029
|
+
const renderProductList = () => {
|
|
22030
|
+
const productList = getProductList();
|
|
22031
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapSlideBox.default, {
|
|
22032
|
+
header: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
22033
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
22034
|
+
className: "material-icons back-icon",
|
|
22035
|
+
onClick: () => setProductListOpen(false),
|
|
22036
|
+
children: "arrow_back"
|
|
22037
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22038
|
+
children: selectProduct
|
|
22039
|
+
})]
|
|
22040
|
+
}),
|
|
22041
|
+
show: productListOpen,
|
|
22042
|
+
size: "size-l",
|
|
22043
|
+
className: _styles.default['org-select-slidebox'],
|
|
22044
|
+
content: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
22045
|
+
children: productList.map(product => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22046
|
+
onClick: () => handleProductChange(product),
|
|
22047
|
+
className: (0, _classnames.default)(_styles.default['org-select-product'], {
|
|
22048
|
+
[_styles.default.selected]: product.value === defaultSelectedProduct
|
|
22049
|
+
}),
|
|
22050
|
+
children: capitalize(product.value)
|
|
22051
|
+
}, product.key || product.value))
|
|
22052
|
+
}),
|
|
22053
|
+
handleClose: () => setProductListOpen(false)
|
|
22054
|
+
});
|
|
22055
|
+
};
|
|
22056
|
+
const renderSelectedOrg = () => {
|
|
22057
|
+
const selectedOrg = loadStorageItem == null ? void 0 : loadStorageItem('orgID');
|
|
22058
|
+
const selectedOu = loadStorageItem == null ? void 0 : loadStorageItem('ouId');
|
|
22059
|
+
const selectedItemIndex = (0, _findIndex.default)(orgList, item => item.value === selectedOrg);
|
|
22060
|
+
const itemDetails = orgList[selectedItemIndex] || {};
|
|
22061
|
+
let selectedOuItemIndex = -1;
|
|
22062
|
+
if (selectedOu && selectedOu !== -1) {
|
|
22063
|
+
selectedOuItemIndex = (0, _findIndex.default)(itemDetails.accessibleOus || [], ou => ou.value === selectedOu);
|
|
22064
|
+
}
|
|
22065
|
+
let selectedItemLabel = selectOrganization || '';
|
|
22066
|
+
if (selectedItemIndex !== -1) {
|
|
22067
|
+
selectedItemLabel = itemDetails.label;
|
|
22068
|
+
}
|
|
22069
|
+
if (selectedOuItemIndex !== -1 && itemDetails.accessibleOus) {
|
|
22070
|
+
selectedItemLabel = itemDetails.accessibleOus[selectedOuItemIndex].label;
|
|
22071
|
+
}
|
|
22072
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22073
|
+
className: (0, _classnames.default)(_styles.default['org-select-selection']),
|
|
22074
|
+
onClick: () => setOrgSelectionBoxOpen(true),
|
|
22075
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22076
|
+
className: _styles.default['org-select-selected-value'],
|
|
22077
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22078
|
+
className: _styles.default['org-select-selected-icon'],
|
|
22079
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.LogoBackground, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22080
|
+
className: _styles.default['text-label'],
|
|
22081
|
+
children: selectedItemLabel[0] || ''
|
|
22082
|
+
})]
|
|
22083
|
+
}), selectedOuItemIndex !== -1 ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22084
|
+
className: _styles.default['org-select-selected-ou-value-label'],
|
|
22085
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
22085
22086
|
type: "h4",
|
|
22086
|
-
|
|
22087
|
+
style: {
|
|
22088
|
+
maxWidth: 110
|
|
22089
|
+
},
|
|
22090
|
+
className: _styles.default['org-select-overflow-ellipsis'],
|
|
22087
22091
|
title: selectedItemLabel,
|
|
22088
22092
|
children: selectedItemLabel
|
|
22093
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapLabel.default, {
|
|
22094
|
+
type: "label3",
|
|
22095
|
+
style: {
|
|
22096
|
+
maxWidth: 70
|
|
22097
|
+
},
|
|
22098
|
+
className: _styles.default['org-select-overflow-ellipsis'],
|
|
22099
|
+
title: itemDetails.label,
|
|
22100
|
+
children: itemDetails.label
|
|
22089
22101
|
})]
|
|
22090
|
-
})
|
|
22091
|
-
type: "
|
|
22092
|
-
className: (0, _classnames.default)(
|
|
22102
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapHeading.default, {
|
|
22103
|
+
type: "h4",
|
|
22104
|
+
className: (0, _classnames.default)(_styles.default['org-select-selected-value-label'], _styles.default['org-select-overflow-ellipsis']),
|
|
22105
|
+
title: selectedItemLabel,
|
|
22106
|
+
children: selectedItemLabel
|
|
22093
22107
|
})]
|
|
22094
|
-
})
|
|
22095
|
-
|
|
22096
|
-
|
|
22097
|
-
|
|
22098
|
-
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
|
|
22107
|
-
children:
|
|
22108
|
-
|
|
22109
|
-
|
|
22110
|
-
span:
|
|
22111
|
-
children:
|
|
22112
|
-
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
|
|
22120
|
-
}), item.hasChildren && !item.expanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
22121
|
-
type: "chevron-down",
|
|
22122
|
-
className: (0, _classnames.default)(clsPrefix + "-arrow")
|
|
22123
|
-
})]
|
|
22108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
22109
|
+
type: "chevron-right",
|
|
22110
|
+
className: (0, _classnames.default)(_styles.default['org-select-arrow'])
|
|
22111
|
+
})]
|
|
22112
|
+
});
|
|
22113
|
+
};
|
|
22114
|
+
const renderSidebarContent = () => {
|
|
22115
|
+
if (!(0, _isEmpty.default)(sidebarContent)) {
|
|
22116
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
22117
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_semanticUiReact.List, {
|
|
22118
|
+
children: menuItems.map((item, i) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_react.default.Fragment, {
|
|
22119
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_semanticUiReact.List.Item, {
|
|
22120
|
+
onClick: () => item.hasChildren ? toggleMenuItemExpanded(i) : undefined,
|
|
22121
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapRow.default, {
|
|
22122
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_CapColumn.default, {
|
|
22123
|
+
className: "item-label",
|
|
22124
|
+
span: 22,
|
|
22125
|
+
children: item.label
|
|
22126
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_CapColumn.default, {
|
|
22127
|
+
span: 2,
|
|
22128
|
+
children: [item.hasChildren && item.expanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
22129
|
+
type: "chevron-up",
|
|
22130
|
+
className: (0, _classnames.default)(_styles.default['org-select-arrow'])
|
|
22131
|
+
}), item.hasChildren && !item.expanded && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapIcon.default, {
|
|
22132
|
+
type: "chevron-down",
|
|
22133
|
+
className: (0, _classnames.default)(_styles.default['org-select-arrow'])
|
|
22124
22134
|
})]
|
|
22125
|
-
})
|
|
22126
|
-
})
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
|
|
22135
|
+
})]
|
|
22136
|
+
})
|
|
22137
|
+
}), item.expanded && item.children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
22138
|
+
children: item.children.map(childItem => /*#__PURE__*/(0, _jsxRuntime.jsx)(_semanticUiReact.List.Item, {
|
|
22139
|
+
className: (0, _classnames.default)(_styles.default.nested, {
|
|
22140
|
+
[_styles.default.listItemSelected]: childItem.value === selectedSidebarItem
|
|
22141
|
+
}),
|
|
22142
|
+
onClick: () => childItem.value !== selectedSidebarItem && (onSidebarClick == null ? void 0 : onSidebarClick(childItem)),
|
|
22143
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapRow.default, {
|
|
22144
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapColumn.default, {
|
|
22145
|
+
className: "item-label",
|
|
22131
22146
|
span: 24,
|
|
22132
|
-
children:
|
|
22133
|
-
className: "item-label",
|
|
22134
|
-
span: 24,
|
|
22135
|
-
children: childItem.label
|
|
22136
|
-
})
|
|
22147
|
+
children: childItem.label
|
|
22137
22148
|
})
|
|
22138
|
-
}
|
|
22139
|
-
})
|
|
22140
|
-
})
|
|
22141
|
-
}
|
|
22142
|
-
|
|
22143
|
-
|
|
22144
|
-
|
|
22145
|
-
})
|
|
22146
|
-
}
|
|
22147
|
-
return '';
|
|
22148
|
-
};
|
|
22149
|
-
const _menuItems = [];
|
|
22150
|
-
if (!(0, _isEmpty.default)(_props.sidebarContent)) {
|
|
22151
|
-
_props.sidebarContent.forEach((item, i) => {
|
|
22152
|
-
if (!(0, _isEmpty.default)(item.children)) {
|
|
22153
|
-
_menuItems.push({
|
|
22154
|
-
label: item.label,
|
|
22155
|
-
hasChildren: true,
|
|
22156
|
-
expanded: i === 0,
|
|
22157
|
-
children: item.children
|
|
22158
|
-
});
|
|
22159
|
-
} else {
|
|
22160
|
-
_menuItems.push(item);
|
|
22161
|
-
}
|
|
22162
|
-
});
|
|
22163
|
-
}
|
|
22164
|
-
this.state = {
|
|
22165
|
-
isOpen: false,
|
|
22166
|
-
orgList: this.getProxyOrgList(_props),
|
|
22167
|
-
menuItems: _menuItems,
|
|
22168
|
-
orgSearchText: '',
|
|
22169
|
-
orgSelectionBoxOpen: false,
|
|
22170
|
-
productListOpen: false
|
|
22171
|
-
};
|
|
22172
|
-
}
|
|
22173
|
-
componentWillReceiveProps(nextProps) {
|
|
22174
|
-
if (!(0, _isEmpty.default)((0, _get.default)(nextProps, 'userData.user')) && !(0, _isEqual.default)((0, _get.default)(nextProps, 'userData.user'), (0, _get.default)(this.props, 'userData.user'))) {
|
|
22175
|
-
this.setState({
|
|
22176
|
-
orgList: this.getProxyOrgList(nextProps)
|
|
22149
|
+
})
|
|
22150
|
+
}, childItem.value))
|
|
22151
|
+
}) : null]
|
|
22152
|
+
}, "menu-item-" + i))
|
|
22153
|
+
}), isOpen && footer && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22154
|
+
className: "ant-drawer-footer",
|
|
22155
|
+
children: footer
|
|
22156
|
+
}), isOpen && renderOrgSelectionBox(), isOpen && renderProductList()]
|
|
22177
22157
|
});
|
|
22178
22158
|
}
|
|
22179
|
-
|
|
22180
|
-
|
|
22181
|
-
|
|
22182
|
-
|
|
22183
|
-
|
|
22184
|
-
|
|
22185
|
-
|
|
22186
|
-
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
|
|
22190
|
-
|
|
22191
|
-
|
|
22192
|
-
|
|
22193
|
-
|
|
22194
|
-
|
|
22195
|
-
|
|
22196
|
-
|
|
22197
|
-
|
|
22198
|
-
|
|
22199
|
-
|
|
22200
|
-
|
|
22201
|
-
|
|
22202
|
-
|
|
22203
|
-
|
|
22204
|
-
|
|
22205
|
-
|
|
22206
|
-
|
|
22207
|
-
|
|
22208
|
-
|
|
22209
|
-
|
|
22210
|
-
|
|
22211
|
-
|
|
22212
|
-
|
|
22213
|
-
|
|
22214
|
-
|
|
22215
|
-
|
|
22216
|
-
|
|
22217
|
-
|
|
22218
|
-
|
|
22219
|
-
|
|
22220
|
-
|
|
22221
|
-
|
|
22222
|
-
|
|
22223
|
-
|
|
22224
|
-
closable: false,
|
|
22225
|
-
onClose: this.toggleIsOpen,
|
|
22226
|
-
visible: this.state.isOpen,
|
|
22227
|
-
content: this.renderSidebarContent()
|
|
22228
|
-
}, "cap-hamburger-left")]
|
|
22229
|
-
});
|
|
22230
|
-
}
|
|
22231
|
-
}
|
|
22232
|
-
CapHamburgerMenu.propTypes = {
|
|
22233
|
-
goToHome: _propTypes.default.func,
|
|
22234
|
-
placement: _propTypes.default.string,
|
|
22235
|
-
productName: _propTypes.default.string,
|
|
22236
|
-
userData: _propTypes.default.object,
|
|
22237
|
-
loadStorageItem: _propTypes.default.func,
|
|
22238
|
-
changeOrgEntity: _propTypes.default.func,
|
|
22239
|
-
selectOrganization: _propTypes.default.string,
|
|
22240
|
-
sidebarContent: _propTypes.default.array,
|
|
22241
|
-
selectedSidebarItem: _propTypes.default.string,
|
|
22242
|
-
onSidebarClick: _propTypes.default.func,
|
|
22243
|
-
noResultsText: _propTypes.default.string,
|
|
22244
|
-
footer: _propTypes.default.element,
|
|
22245
|
-
screenHeight: _propTypes.default.number,
|
|
22246
|
-
screenWidth: _propTypes.default.number,
|
|
22247
|
-
insights: _propTypes.default.string,
|
|
22248
|
-
selectProduct: _propTypes.default.string,
|
|
22249
|
-
defaultSelectedProduct: _propTypes.default.string
|
|
22159
|
+
return null;
|
|
22160
|
+
};
|
|
22161
|
+
const {
|
|
22162
|
+
user = {}
|
|
22163
|
+
} = userData;
|
|
22164
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
22165
|
+
className: _styles.default.sideMenu,
|
|
22166
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
22167
|
+
onClick: toggleIsOpen,
|
|
22168
|
+
className: _styles.default.hamburgerIcon,
|
|
22169
|
+
src: hamburgerIcon,
|
|
22170
|
+
alt: "hamburger"
|
|
22171
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_CapDrawer.default, {
|
|
22172
|
+
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
22173
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
22174
|
+
src: moreApplications,
|
|
22175
|
+
alt: "moreApplications",
|
|
22176
|
+
className: _styles.default.moreApplicationsIcon,
|
|
22177
|
+
onClick: () => setProductListOpen(true)
|
|
22178
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
22179
|
+
onClick: () => {
|
|
22180
|
+
toggleIsOpen();
|
|
22181
|
+
goToHome == null || goToHome();
|
|
22182
|
+
},
|
|
22183
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
22184
|
+
src: capLogo,
|
|
22185
|
+
alt: "cap-logo-mobile",
|
|
22186
|
+
className: _styles.default.capLogo
|
|
22187
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
22188
|
+
className: "name",
|
|
22189
|
+
children: productName
|
|
22190
|
+
})]
|
|
22191
|
+
}), !(0, _isEmpty.default)(user.loginName) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
22192
|
+
className: "user-name",
|
|
22193
|
+
children: user.loginName
|
|
22194
|
+
}), renderSelectedOrg()]
|
|
22195
|
+
}),
|
|
22196
|
+
className: "cap-hamburger-menu",
|
|
22197
|
+
placement: placement,
|
|
22198
|
+
closable: false,
|
|
22199
|
+
onClose: toggleIsOpen,
|
|
22200
|
+
open: isOpen,
|
|
22201
|
+
content: renderSidebarContent()
|
|
22202
|
+
}, "cap-hamburger-left")]
|
|
22203
|
+
});
|
|
22250
22204
|
};
|
|
22251
22205
|
var _default = exports["default"] = CapHamburgerMenu;
|
|
22252
22206
|
})();
|