iguazio.dashboard-react-controls 3.1.1 → 3.1.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ActionsMenu.d.ts","sourceRoot":"","sources":["../../../src/lib/components/ActionsMenu/ActionsMenu.jsx"],"names":[],"mappings":";AAkCA;;;;;;gBAmJC"}
1
+ {"version":3,"file":"ActionsMenu.d.ts","sourceRoot":"","sources":["../../../src/lib/components/ActionsMenu/ActionsMenu.jsx"],"names":[],"mappings":";AAkCA;;;;;;gBAqJC"}
@@ -1,62 +1,61 @@
1
- import { jsxs as v, jsx as t } from "react/jsx-runtime";
2
- import { useState as f, useRef as l, useCallback as w, useEffect as p } from "react";
1
+ import { jsxs as M, jsx as n } from "react/jsx-runtime";
2
+ import { useState as f, useRef as a, useCallback as g, useEffect as p } from "react";
3
3
  import s from "prop-types";
4
- import { isEmpty as S } from "lodash";
5
- import D from "classnames";
6
- import L from "../../elements/ActionsMenuItem/ActionsMenuItem.mjs";
7
- import P from "../PopUpDialog/PopUpDialog.mjs";
4
+ import { isEmpty as D } from "lodash";
5
+ import L from "classnames";
6
+ import P from "../../elements/ActionsMenuItem/ActionsMenuItem.mjs";
7
+ import j from "../PopUpDialog/PopUpDialog.mjs";
8
8
  import k from "../RoundedIcon/RoundedIcon.mjs";
9
- import { ACTIONS_MENU as j } from "../../types.mjs";
9
+ import { ACTIONS_MENU as q } from "../../types.mjs";
10
10
  import H from "../../images/elipsis.svg.mjs";
11
11
  /* empty css */
12
12
  const I = ({
13
13
  dataItem: i = {},
14
14
  menu: c,
15
- menuPosition: _ = "",
15
+ menuPosition: h = "",
16
16
  time: y = 100,
17
- withQuickActions: b = !1
17
+ withQuickActions: _ = !1
18
18
  }) => {
19
- const [r, N] = f(c), [T, g] = f(!1), [a, o] = f(!1), E = l(), M = l(), x = l(), h = l();
19
+ const [[o, b], N] = f(c), [T, E] = f(!1), [r, t] = f(!1), x = a(), v = a(), C = a(), w = a();
20
20
  let d = null;
21
- const R = D(
21
+ const R = L(
22
22
  "actions-menu__container",
23
- b && "actions-menu__container_extended",
24
- a && "actions-menu__container-active"
25
- ), u = w(
23
+ _ && (o.length > 0 || b.length > 1) && "actions-menu__container_extended",
24
+ r && "actions-menu__container-active"
25
+ ), u = g(
26
26
  (e) => {
27
- e.target.closest(".actions-menu-button") || o(!1);
27
+ e.target.closest(".actions-menu-button") || t(!1);
28
28
  },
29
- [o]
30
- ), m = w(
29
+ [t]
30
+ ), m = g(
31
31
  (e) => {
32
- e.target.closest(".actions-menu__body") || o(!1);
32
+ e.target.closest(".actions-menu__body") || t(!1);
33
33
  },
34
- [o]
35
- ), C = () => {
36
- a && (d = setTimeout(() => {
37
- o(!1);
34
+ [t]
35
+ ), O = () => {
36
+ r && (d = setTimeout(() => {
37
+ t(!1);
38
38
  }, y));
39
- }, O = (e) => {
40
- var n;
41
- (n = h.current) != null && n.contains(e.target) && o(!1), d && clearTimeout(d);
39
+ }, S = (e) => {
40
+ var l;
41
+ (l = w.current) != null && l.contains(e.target) && t(!1), d && clearTimeout(d);
42
42
  };
43
43
  return p(() => {
44
- S(i) || N(typeof c == "function" ? c(i, _) : c);
45
- }, [i, c, _]), p(() => {
46
- var e;
47
- g((e = r[0]) == null ? void 0 : e.some((n) => n.icon));
48
- }, [r]), p(() => (window.addEventListener("click", u), window.addEventListener("scroll", m, !0), () => {
44
+ D(i) || N(typeof c == "function" ? c(i, h) : c);
45
+ }, [i, c, h]), p(() => {
46
+ E(o == null ? void 0 : o.some((e) => e.icon));
47
+ }, [o]), p(() => (window.addEventListener("click", u), window.addEventListener("scroll", m, !0), () => {
49
48
  window.removeEventListener("click", u), window.removeEventListener("scroll", m, !0);
50
- }), [u, m]), /* @__PURE__ */ v(
49
+ }), [u, m]), /* @__PURE__ */ M(
51
50
  "div",
52
51
  {
53
52
  className: R,
54
- onMouseOut: C,
55
- onMouseOver: O,
56
- ref: E,
53
+ onMouseOut: O,
54
+ onMouseOver: S,
55
+ ref: x,
57
56
  children: [
58
- b && /* @__PURE__ */ t("div", { className: "actions-menu__main-actions-wrapper", ref: h, children: r[1].map(
59
- (e) => !e.hidden && /* @__PURE__ */ t(
57
+ _ && /* @__PURE__ */ n("div", { className: "actions-menu__main-actions-wrapper", ref: w, children: b.map(
58
+ (e) => !e.hidden && /* @__PURE__ */ n(
60
59
  k,
61
60
  {
62
61
  disabled: e.disabled,
@@ -68,38 +67,38 @@ const I = ({
68
67
  e.label
69
68
  )
70
69
  ) }),
71
- r[0].length > 0 && /* @__PURE__ */ v("div", { className: "actions-menu", "data-testid": "actions-menu", children: [
72
- /* @__PURE__ */ t(
70
+ o.length > 0 && /* @__PURE__ */ M("div", { className: "actions-menu", "data-testid": "actions-menu", children: [
71
+ /* @__PURE__ */ n(
73
72
  k,
74
73
  {
75
74
  className: "actions-menu-button",
76
- isActive: a,
75
+ isActive: r,
77
76
  id: "actions-menu-button",
78
77
  onClick: () => {
79
- o((e) => !e);
78
+ t((e) => !e);
80
79
  },
81
- ref: M,
80
+ ref: v,
82
81
  tooltipText: "More actions",
83
- children: /* @__PURE__ */ t(H, {})
82
+ children: /* @__PURE__ */ n(H, {})
84
83
  }
85
84
  ),
86
- a && /* @__PURE__ */ t(
87
- P,
85
+ r && /* @__PURE__ */ n(
86
+ j,
88
87
  {
89
88
  className: "actions-menu__body",
90
89
  customPosition: {
91
- element: M,
90
+ element: v,
92
91
  position: "bottom-left",
93
92
  autoVerticalPosition: !0
94
93
  },
95
94
  headerIsHidden: !0,
96
- ref: x,
97
- children: /* @__PURE__ */ t("ul", { "data-testid": "actions-drop-down-menu", className: "actions-menu__list", children: r[0].map(
98
- (e, n) => !e.hidden && /* @__PURE__ */ t(
99
- L,
95
+ ref: C,
96
+ children: /* @__PURE__ */ n("ul", { "data-testid": "actions-drop-down-menu", className: "actions-menu__list", children: o.map(
97
+ (e, l) => !e.hidden && /* @__PURE__ */ n(
98
+ P,
100
99
  {
101
100
  dataItem: i,
102
- index: n,
101
+ index: l,
103
102
  isIconDisplayed: T,
104
103
  menuItem: e
105
104
  },
@@ -115,7 +114,7 @@ const I = ({
115
114
  };
116
115
  I.propTypes = {
117
116
  dataItem: s.oneOfType([s.object, s.string]),
118
- menu: j.isRequired,
117
+ menu: q.isRequired,
119
118
  menuPosition: s.string,
120
119
  time: s.number,
121
120
  withQuickActions: s.bool
@@ -1 +1 @@
1
- {"version":3,"file":"ActionsMenu.mjs","sources":["../../../src/lib/components/ActionsMenu/ActionsMenu.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty } from 'lodash'\nimport classnames from 'classnames'\n\nimport ActionsMenuItem from '../../elements/ActionsMenuItem/ActionsMenuItem'\nimport PopUpDialog from '../PopUpDialog/PopUpDialog'\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\n\nimport { ACTIONS_MENU } from '../../types'\n\nimport ActionMenuIcon from '../../images/elipsis.svg?react'\n\nimport './actionsMenu.scss'\n\nconst ActionsMenu = ({\n dataItem = {},\n menu,\n menuPosition = '',\n time = 100,\n withQuickActions = false\n}) => {\n const [actionMenu, setActionMenu] = useState(menu)\n const [isIconDisplayed, setIsIconDisplayed] = useState(false)\n const [isShowMenu, setIsShowMenu] = useState(false)\n const actionMenuRef = useRef()\n const actionMenuBtnRef = useRef()\n const dropDownMenuRef = useRef()\n const mainActionsWrapperRef = useRef()\n\n let idTimeout = null\n\n const actionMenuClassNames = classnames(\n 'actions-menu__container',\n withQuickActions && 'actions-menu__container_extended',\n isShowMenu && 'actions-menu__container-active'\n )\n\n const clickHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu-button')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const scrollHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu__body')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const onMouseOut = () => {\n if (isShowMenu) {\n idTimeout = setTimeout(() => {\n setIsShowMenu(false)\n }, time)\n }\n }\n\n const handleMouseOver = event => {\n if (mainActionsWrapperRef.current?.contains(event.target)) {\n setIsShowMenu(false)\n }\n\n if (idTimeout) clearTimeout(idTimeout)\n }\n\n useEffect(() => {\n if (!isEmpty(dataItem)) {\n setActionMenu(typeof menu === 'function' ? menu(dataItem, menuPosition) : menu)\n }\n }, [dataItem, menu, menuPosition])\n\n useEffect(() => {\n setIsIconDisplayed(actionMenu[0]?.some(menuItem => menuItem.icon))\n }, [actionMenu])\n\n useEffect(() => {\n window.addEventListener('click', clickHandler)\n window.addEventListener('scroll', scrollHandler, true)\n\n return () => {\n window.removeEventListener('click', clickHandler)\n window.removeEventListener('scroll', scrollHandler, true)\n }\n }, [clickHandler, scrollHandler])\n\n return (\n <div\n className={actionMenuClassNames}\n onMouseOut={onMouseOut}\n onMouseOver={handleMouseOver}\n ref={actionMenuRef}\n >\n {withQuickActions && (\n <div className=\"actions-menu__main-actions-wrapper\" ref={mainActionsWrapperRef}>\n {actionMenu[1].map(\n mainAction =>\n !mainAction.hidden && (\n <RoundedIcon\n disabled={mainAction.disabled}\n id={`quick-link-${mainAction.id}`}\n onClick={() => mainAction.onClick(dataItem)}\n tooltipText={mainAction.label}\n key={mainAction.label}\n >\n {mainAction.icon}\n </RoundedIcon>\n )\n )}\n </div>\n )}\n {actionMenu[0].length > 0 && (\n <div className=\"actions-menu\" data-testid=\"actions-menu\">\n <RoundedIcon\n className=\"actions-menu-button\"\n isActive={isShowMenu}\n id=\"actions-menu-button\"\n onClick={() => {\n setIsShowMenu(prevValue => !prevValue)\n }}\n ref={actionMenuBtnRef}\n tooltipText=\"More actions\"\n >\n <ActionMenuIcon />\n </RoundedIcon>\n {isShowMenu && (\n <PopUpDialog\n className=\"actions-menu__body\"\n customPosition={{\n element: actionMenuBtnRef,\n position: 'bottom-left',\n autoVerticalPosition: true\n }}\n headerIsHidden\n ref={dropDownMenuRef}\n >\n <ul data-testid=\"actions-drop-down-menu\" className=\"actions-menu__list\">\n {actionMenu[0].map(\n (menuItem, idx) =>\n !menuItem.hidden && (\n <ActionsMenuItem\n dataItem={dataItem}\n index={idx}\n isIconDisplayed={isIconDisplayed}\n key={menuItem.label}\n menuItem={menuItem}\n />\n )\n )}\n </ul>\n </PopUpDialog>\n )}\n </div>\n )}\n </div>\n )\n}\n\nActionsMenu.propTypes = {\n dataItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n menu: ACTIONS_MENU.isRequired,\n menuPosition: PropTypes.string,\n time: PropTypes.number,\n withQuickActions: PropTypes.bool\n}\n\nexport default ActionsMenu\n"],"names":["ActionsMenu","dataItem","menu","menuPosition","time","withQuickActions","actionMenu","setActionMenu","useState","isIconDisplayed","setIsIconDisplayed","isShowMenu","setIsShowMenu","actionMenuRef","useRef","actionMenuBtnRef","dropDownMenuRef","mainActionsWrapperRef","idTimeout","actionMenuClassNames","classnames","clickHandler","useCallback","event","scrollHandler","onMouseOut","handleMouseOver","_a","useEffect","isEmpty","menuItem","jsxs","jsx","mainAction","RoundedIcon","prevValue","ActionMenuIcon","PopUpDialog","idx","ActionsMenuItem","PropTypes","ACTIONS_MENU"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,IAAc,CAAC;AAAA,EACnB,UAAAC,IAAW,CAAC;AAAA,EACZ,MAAAC;AAAA,EACA,cA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AAU;AAAA,cACV,gBAAgB;AAAA,gBACd,SAAStB;AAAA,gBACT,UAAU;AAAA,gBACV,sBAAsB;AAAA,cACxB;AAAA,cACA,gBAAc;AAAA,cACd,KAAKC;AAAA,cAEL,UAAA,gBAAAgB,EAAC,QAAG,eAAY,0BAAyB,WAAU,sBAChD,UAAA1B,EAAW,CAAC,EAAE;AAAA,gBACb,CAACwB,GAAUQ,MACT,CAACR,EAAS,UACR,gBAAAE;AAAA,kBAACO;AAAA,kBAAA;AAAA,oBACC,UAAAtC;AAAA,oBACA,OAAOqC;AAAA,oBACP,iBAAA7B;AAAA,oBAEA,UAAAqB;AAAA,kBAAA;AAAA,kBADKA,EAAS;AAAA,gBAAA;AAAA,cAEhB,EAGR,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACF,EAEJ,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAEJ;AAEJ;AAEA9B,EAAY,YAAY;AAAA,EACtB,UAAUwC,EAAU,UAAU,CAACA,EAAU,QAAQA,EAAU,MAAM,CAAC;AAAA,EAClE,MAAMC,EAAa;AAAA,EACnB,cAAcD,EAAU;AAAA,EACxB,MAAMA,EAAU;AAAA,EAChB,kBAAkBA,EAAU;AAC9B;"}
1
+ {"version":3,"file":"ActionsMenu.mjs","sources":["../../../src/lib/components/ActionsMenu/ActionsMenu.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport { isEmpty } from 'lodash'\nimport classnames from 'classnames'\n\nimport ActionsMenuItem from '../../elements/ActionsMenuItem/ActionsMenuItem'\nimport PopUpDialog from '../PopUpDialog/PopUpDialog'\nimport RoundedIcon from '../RoundedIcon/RoundedIcon'\n\nimport { ACTIONS_MENU } from '../../types'\n\nimport ActionMenuIcon from '../../images/elipsis.svg?react'\n\nimport './actionsMenu.scss'\n\nconst ActionsMenu = ({\n dataItem = {},\n menu,\n menuPosition = '',\n time = 100,\n withQuickActions = false\n}) => {\n const [[actionMenu, quickActions], setActionMenuContent] = useState(menu)\n const [isIconDisplayed, setIsIconDisplayed] = useState(false)\n const [isShowMenu, setIsShowMenu] = useState(false)\n const actionMenuRef = useRef()\n const actionMenuBtnRef = useRef()\n const dropDownMenuRef = useRef()\n const mainActionsWrapperRef = useRef()\n\n let idTimeout = null\n\n const actionMenuClassNames = classnames(\n 'actions-menu__container',\n withQuickActions &&\n (actionMenu.length > 0 || quickActions.length > 1) &&\n 'actions-menu__container_extended',\n isShowMenu && 'actions-menu__container-active'\n )\n\n const clickHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu-button')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const scrollHandler = useCallback(\n event => {\n if (!event.target.closest('.actions-menu__body')) {\n setIsShowMenu(false)\n }\n },\n [setIsShowMenu]\n )\n\n const onMouseOut = () => {\n if (isShowMenu) {\n idTimeout = setTimeout(() => {\n setIsShowMenu(false)\n }, time)\n }\n }\n\n const handleMouseOver = event => {\n if (mainActionsWrapperRef.current?.contains(event.target)) {\n setIsShowMenu(false)\n }\n\n if (idTimeout) clearTimeout(idTimeout)\n }\n\n useEffect(() => {\n if (!isEmpty(dataItem)) {\n setActionMenuContent(typeof menu === 'function' ? menu(dataItem, menuPosition) : menu)\n }\n }, [dataItem, menu, menuPosition])\n\n useEffect(() => {\n setIsIconDisplayed(actionMenu?.some(menuItem => menuItem.icon))\n }, [actionMenu])\n\n useEffect(() => {\n window.addEventListener('click', clickHandler)\n window.addEventListener('scroll', scrollHandler, true)\n\n return () => {\n window.removeEventListener('click', clickHandler)\n window.removeEventListener('scroll', scrollHandler, true)\n }\n }, [clickHandler, scrollHandler])\n\n return (\n <div\n className={actionMenuClassNames}\n onMouseOut={onMouseOut}\n onMouseOver={handleMouseOver}\n ref={actionMenuRef}\n >\n {withQuickActions && (\n <div className=\"actions-menu__main-actions-wrapper\" ref={mainActionsWrapperRef}>\n {quickActions.map(\n mainAction =>\n !mainAction.hidden && (\n <RoundedIcon\n disabled={mainAction.disabled}\n id={`quick-link-${mainAction.id}`}\n onClick={() => mainAction.onClick(dataItem)}\n tooltipText={mainAction.label}\n key={mainAction.label}\n >\n {mainAction.icon}\n </RoundedIcon>\n )\n )}\n </div>\n )}\n {actionMenu.length > 0 && (\n <div className=\"actions-menu\" data-testid=\"actions-menu\">\n <RoundedIcon\n className=\"actions-menu-button\"\n isActive={isShowMenu}\n id=\"actions-menu-button\"\n onClick={() => {\n setIsShowMenu(prevValue => !prevValue)\n }}\n ref={actionMenuBtnRef}\n tooltipText=\"More actions\"\n >\n <ActionMenuIcon />\n </RoundedIcon>\n {isShowMenu && (\n <PopUpDialog\n className=\"actions-menu__body\"\n customPosition={{\n element: actionMenuBtnRef,\n position: 'bottom-left',\n autoVerticalPosition: true\n }}\n headerIsHidden\n ref={dropDownMenuRef}\n >\n <ul data-testid=\"actions-drop-down-menu\" className=\"actions-menu__list\">\n {actionMenu.map(\n (menuItem, idx) =>\n !menuItem.hidden && (\n <ActionsMenuItem\n dataItem={dataItem}\n index={idx}\n isIconDisplayed={isIconDisplayed}\n key={menuItem.label}\n menuItem={menuItem}\n />\n )\n )}\n </ul>\n </PopUpDialog>\n )}\n </div>\n )}\n </div>\n )\n}\n\nActionsMenu.propTypes = {\n dataItem: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),\n menu: ACTIONS_MENU.isRequired,\n menuPosition: PropTypes.string,\n time: PropTypes.number,\n withQuickActions: PropTypes.bool\n}\n\nexport default ActionsMenu\n"],"names":["ActionsMenu","dataItem","menu","menuPosition","time","withQuickActions","actionMenu","quickActions","setActionMenuContent","useState","isIconDisplayed","setIsIconDisplayed","isShowMenu","setIsShowMenu","actionMenuRef","useRef","actionMenuBtnRef","dropDownMenuRef","mainActionsWrapperRef","idTimeout","actionMenuClassNames","classnames","clickHandler","useCallback","event","scrollHandler","onMouseOut","handleMouseOver","_a","useEffect","isEmpty","menuItem","jsxs","mainAction","jsx","RoundedIcon","prevValue","ActionMenuIcon","PopUpDialog","idx","ActionsMenuItem","PropTypes","ACTIONS_MENU"],"mappings":";;;;;;;;;;;AAkCA,MAAMA,IAAc,CAAC;AAAA,EACnB,UAAAC,IAAW,CAAC;AAAA,EACZ,MAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,MAAAC,IAAO;AAAA,EACP,kBAAAC,IAAmB;AACrB,MAAM;AACE,QAAA,CAAC,CAACC,GAAYC,CAAY,GAAGC,CAAoB,IAAIC,EAASP,CAAI,GAClE,CAACQ,GAAiBC,CAAkB,IAAIF,EAAS,EAAK,GACtD,CAACG,GAAYC,CAAa,IAAIJ,EAAS,EAAK,GAC5CK,IAAgBC,EAAO,GACvBC,IAAmBD,EAAO,GAC1BE,IAAkBF,EAAO,GACzBG,IAAwBH,EAAO;AAErC,MAAII,IAAY;AAEhB,QAAMC,IAAuBC;AAAA,IAC3B;AAAA,IACAhB,MACGC,EAAW,SAAS,KAAKC,EAAa,SAAS,MAChD;AAAA,IACFK,KAAc;AAAA,EAChB,GAEMU,IAAeC;AAAA,IACnB,CAASC,MAAA;AACP,MAAKA,EAAM,OAAO,QAAQ,sBAAsB,KAC9CX,EAAc,EAAK;AAAA,IAEvB;AAAA,IACA,CAACA,CAAa;AAAA,EAChB,GAEMY,IAAgBF;AAAA,IACpB,CAASC,MAAA;AACP,MAAKA,EAAM,OAAO,QAAQ,qBA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A,EACxB,MAAMA,EAAU;AAAA,EAChB,kBAAkBA,EAAU;AAC9B;"}
@@ -7,14 +7,14 @@ export function useDetails({ applyDetailsChanges, applyDetailsChangesCallback, f
7
7
  selectedItem: any;
8
8
  }): {
9
9
  DetailsContainer: {
10
- ({ blocker, detailsMenu, detailsPanelClassNames, detailsPopUpSelectedTab, detailsRef, detailsStore, commonDetailsStore, doNotLeavePage, formRef, isDetailsPopUp, leavePage, params, renderHeader, renderTabsContent, setBlocker, setDetailsPopUpSelectedTab, shouldDetailsBlock, withActionMenu }: {
10
+ ({ blocker, commonDetailsStore, detailsMenu, detailsPanelClassNames, detailsPopUpSelectedTab, detailsRef, detailsStore, doNotLeavePage, formRef, isDetailsPopUp, leavePage, params, renderHeader, renderTabsContent, setBlocker, setDetailsPopUpSelectedTab, shouldDetailsBlock, withActionMenu }: {
11
11
  blocker: any;
12
+ commonDetailsStore: any;
12
13
  detailsMenu: any;
13
14
  detailsPanelClassNames: any;
14
15
  detailsPopUpSelectedTab?: string;
15
16
  detailsRef: any;
16
17
  detailsStore: any;
17
- commonDetailsStore: any;
18
18
  doNotLeavePage: any;
19
19
  formRef: any;
20
20
  isDetailsPopUp?: any;
@@ -18,18 +18,18 @@ import { PRIMARY_BUTTON as fe, TERTIARY_BUTTON as pe, VIEW_SEARCH_PARAMETER as x
18
18
  import { DETAILS_MENU as ge } from "../types.mjs";
19
19
  import { setFieldState as Re } from "../utils/form.util.mjs";
20
20
  const H = ({
21
- blocker: p,
22
- detailsMenu: g,
23
- detailsPanelClassNames: o,
24
- detailsPopUpSelectedTab: a = "",
25
- detailsRef: E,
26
- detailsStore: h,
27
- commonDetailsStore: s,
21
+ blocker: f,
22
+ commonDetailsStore: p,
23
+ detailsMenu: o,
24
+ detailsPanelClassNames: a,
25
+ detailsPopUpSelectedTab: E = "",
26
+ detailsRef: g,
27
+ detailsStore: s,
28
28
  doNotLeavePage: R,
29
29
  formRef: q,
30
30
  isDetailsPopUp: t = null,
31
31
  leavePage: T,
32
- params: f,
32
+ params: h,
33
33
  renderHeader: n,
34
34
  renderTabsContent: c,
35
35
  setBlocker: S,
@@ -37,24 +37,24 @@ const H = ({
37
37
  shouldDetailsBlock: v,
38
38
  withActionMenu: k = !0
39
39
  }) => /* @__PURE__ */ d(X, { form: q.current, onSubmit: () => {
40
- }, children: (i) => /* @__PURE__ */ W("div", { className: o, ref: E, "data-testid": "detailsPanel", children: [
41
- h.loadingCounter > 0 && /* @__PURE__ */ d(ae, {}),
42
- h.error && /* @__PURE__ */ d(oe, { message: h.error.message }),
40
+ }, children: (i) => /* @__PURE__ */ W("div", { className: a, ref: g, "data-testid": "detailsPanel", children: [
41
+ s.loadingCounter > 0 && /* @__PURE__ */ d(ae, {}),
42
+ s.error && /* @__PURE__ */ d(oe, { message: s.error.message }),
43
43
  /* @__PURE__ */ W("div", { className: "item-header-wrapper", children: [
44
44
  n(),
45
45
  k && /* @__PURE__ */ d(
46
46
  ie,
47
47
  {
48
- initialTab: t ? a : f.tab,
48
+ initialTab: t ? E : h.tab,
49
49
  isDetailsPopUp: t,
50
50
  onClick: (u) => b && b(u),
51
51
  skipLink: t,
52
- tabsList: g
52
+ tabsList: o
53
53
  }
54
54
  )
55
55
  ] }),
56
56
  /* @__PURE__ */ d("div", { className: "item-info", children: c(i) }),
57
- (p.state === "blocked" || s.showWarning) && /* @__PURE__ */ d(
57
+ (f.state === "blocked" || p.showWarning) && /* @__PURE__ */ d(
58
58
  ce,
59
59
  {
60
60
  cancelButton: {
@@ -69,7 +69,7 @@ const H = ({
69
69
  variant: fe
70
70
  },
71
71
  header: "You have unsaved changes.",
72
- isOpen: p.state === "blocked" || s.showWarning,
72
+ isOpen: f.state === "blocked" || p.showWarning,
73
73
  message: "Do you want to discard the changes?"
74
74
  }
75
75
  ),
@@ -96,15 +96,15 @@ H.propTypes = {
96
96
  withActionMenu: r.bool
97
97
  };
98
98
  const De = ({
99
- applyDetailsChanges: p,
100
- applyDetailsChangesCallback: g,
99
+ applyDetailsChanges: f,
100
+ applyDetailsChangesCallback: p,
101
101
  formInitialValues: o,
102
102
  isDetailsPopUp: a,
103
103
  isDetailsScreen: E,
104
- selectedItem: h
104
+ selectedItem: g
105
105
  }) => {
106
- const [s, R] = G({}), q = w(), t = ee(), T = w(), f = ne(), n = te((e) => e.commonDetailsStore), c = re(), [S, b] = J(() => a ? [me, ue] : [de, le], [a]), v = w(
107
- c.pathname.substring(0, c.pathname.lastIndexOf(f.tab))
106
+ const [s, R] = G({}), q = w(), t = ee(), T = w(), h = ne(), n = te((e) => e.commonDetailsStore), c = re(), [S, b] = J(() => a ? [me, ue] : [de, le], [a]), v = w(
107
+ c.pathname.substring(0, c.pathname.lastIndexOf(h.tab))
108
108
  ), k = Q(
109
109
  "table__item",
110
110
  n.showWarning && "pop-up-dialog-opened",
@@ -150,29 +150,29 @@ const De = ({
150
150
  }, [o, n.changes.counter]), C(() => {
151
151
  const e = c.pathname.substring(
152
152
  0,
153
- c.pathname.lastIndexOf(f.tab)
153
+ c.pathname.lastIndexOf(h.tab)
154
154
  );
155
155
  v.current !== e && !a && (i.current.restart(o), t(he(!1)), v.current = e);
156
- }, [t, o, a, c.pathname, f.tab]);
156
+ }, [t, o, a, c.pathname, h.tab]);
157
157
  const O = l(() => {
158
- p(n.changes).then(() => {
158
+ f(n.changes).then(() => {
159
159
  t(j());
160
160
  const e = U(n.changes);
161
161
  setTimeout(() => {
162
- g(e, h);
162
+ p(e, g);
163
163
  });
164
164
  });
165
165
  }, [
166
+ f,
166
167
  p,
167
- g,
168
168
  n.changes,
169
169
  t,
170
- h
170
+ g
171
171
  ]), _ = l(() => {
172
172
  n.changes.counter > 0 && (t(j()), i.current.reset(o));
173
173
  }, [n.changes.counter, t, o]), F = l(() => {
174
174
  var e;
175
- _(), u(!1), n.filtersWasHandled ? t(D(!1)) : (e = s.proceed) == null || e.call(s), window.dispatchEvent(new CustomEvent("discardChanges"));
175
+ _(), u(!1), n.filtersWasHandled && t(D(!1)), (e = s.proceed) == null || e.call(s), window.dispatchEvent(new CustomEvent("discardChanges"));
176
176
  }, [s, _, n.filtersWasHandled, t, u]), Y = l(() => {
177
177
  var e;
178
178
  (e = s.reset) == null || e.call(s), t(A(!1)), window.dispatchEvent(new CustomEvent("cancelLeave"));
@@ -191,7 +191,7 @@ const De = ({
191
191
  handleShowWarning: u,
192
192
  leavePage: F,
193
193
  location: c,
194
- params: f,
194
+ params: h,
195
195
  removeDetailsInfo: b,
196
196
  setBlocker: R,
197
197
  setDetailsInfo: S,
@@ -1 +1 @@
1
- {"version":3,"file":"useDetails.hook.mjs","sources":["../../src/lib/hooks/useDetails.hook.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport arrayMutators from 'final-form-arrays'\nimport classnames from 'classnames'\nimport { Form } from 'react-final-form'\nimport { cloneDeep, isEqual, pickBy } from 'lodash'\nimport { createForm } from 'final-form'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { useLocation, useParams } from 'react-router-dom'\n\nimport BlockerSpy from '../components/BlockerSpy/BlockerSpy'\nimport ErrorMessage from '../components/ErrorMessage/ErrorMessage'\nimport Loader from '../components/Loader/Loader'\nimport TabsSlider from '../components/TabsSlider/TabsSlider'\nimport ConfirmDialog from '../components/ConfirmDialog/ConfirmDialog'\n\nimport {\n removeDetailsPopUpInfoContent,\n removeInfoContent,\n resetChanges,\n setDetailsPopUpInfoContent,\n setEditMode,\n setFiltersWasHandled,\n setInfoContent,\n showWarning\n} from '../reducers/commonDetailsReducer'\nimport { PRIMARY_BUTTON, TERTIARY_BUTTON } from '../constants'\nimport { VIEW_SEARCH_PARAMETER } from '../constants'\nimport { DETAILS_MENU } from '../types'\nimport { setFieldState } from '../utils/form.util'\n\nconst DetailsContainer = ({\n blocker,\n detailsMenu,\n detailsPanelClassNames,\n detailsPopUpSelectedTab = '',\n detailsRef,\n detailsStore,\n commonDetailsStore,\n doNotLeavePage,\n formRef,\n isDetailsPopUp = null,\n leavePage,\n params,\n renderHeader,\n renderTabsContent,\n setBlocker,\n setDetailsPopUpSelectedTab = null,\n shouldDetailsBlock,\n withActionMenu = true\n}) => {\n return (\n <Form form={formRef.current} onSubmit={() => {}}>\n {formState => (\n <div className={detailsPanelClassNames} ref={detailsRef} data-testid=\"detailsPanel\">\n {detailsStore.loadingCounter > 0 && <Loader />}\n {detailsStore.error && <ErrorMessage message={detailsStore.error.message} />}\n <div className=\"item-header-wrapper\">\n {renderHeader()}\n {withActionMenu && (\n <TabsSlider\n initialTab={isDetailsPopUp ? detailsPopUpSelectedTab : params.tab}\n isDetailsPopUp={isDetailsPopUp}\n onClick={newTab => setDetailsPopUpSelectedTab && setDetailsPopUpSelectedTab(newTab)}\n skipLink={isDetailsPopUp}\n tabsList={detailsMenu}\n />\n )}\n </div>\n <div className=\"item-info\">{renderTabsContent(formState)}</div>\n {(blocker.state === 'blocked' || commonDetailsStore.showWarning) && (\n <ConfirmDialog\n cancelButton={{\n handler: doNotLeavePage,\n label: 'Cancel',\n variant: TERTIARY_BUTTON\n }}\n closePopUp={doNotLeavePage}\n confirmButton={{\n handler: leavePage,\n label: 'Yes',\n variant: PRIMARY_BUTTON\n }}\n header=\"You have unsaved changes.\"\n isOpen={blocker.state === 'blocked' || commonDetailsStore.showWarning}\n message=\"Do you want to discard the changes?\"\n />\n )}\n {!isDetailsPopUp && (\n <BlockerSpy setBlocker={setBlocker} shouldBlock={shouldDetailsBlock} />\n )}\n </div>\n )}\n </Form>\n )\n}\n\nDetailsContainer.propTypes = {\n blocker: PropTypes.object.isRequired,\n detailsMenu: DETAILS_MENU.isRequired,\n detailsPanelClassNames: PropTypes.string.isRequired,\n detailsPopUpSelectedTab: PropTypes.string,\n detailsRef: PropTypes.object.isRequired,\n detailsStore: PropTypes.object.isRequired,\n commonDetailsStore: PropTypes.object.isRequired,\n doNotLeavePage: PropTypes.func.isRequired,\n formRef: PropTypes.object.isRequired,\n isDetailsPopUp: PropTypes.bool,\n leavePage: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n renderHeader: PropTypes.func.isRequired,\n renderTabsContent: PropTypes.func.isRequired,\n setBlocker: PropTypes.func.isRequired,\n setDetailsPopUpSelectedTab: PropTypes.func,\n shouldDetailsBlock: PropTypes.func.isRequired,\n withActionMenu: PropTypes.bool\n}\n\nexport const useDetails = ({\n applyDetailsChanges,\n applyDetailsChangesCallback,\n formInitialValues,\n isDetailsPopUp,\n isDetailsScreen,\n selectedItem\n}) => {\n const [blocker, setBlocker] = useState({})\n const applyChangesRef = useRef()\n const dispatch = useDispatch()\n const detailsRef = useRef()\n const params = useParams()\n const commonDetailsStore = useSelector(store => store.commonDetailsStore)\n const location = useLocation()\n const [setDetailsInfo, removeDetailsInfo] = useMemo(() => {\n return isDetailsPopUp\n ? [setDetailsPopUpInfoContent, removeDetailsPopUpInfoContent]\n : [setInfoContent, removeInfoContent]\n }, [isDetailsPopUp])\n const previousPathnameRef = useRef(\n location.pathname.substring(0, location.pathname.lastIndexOf(params.tab))\n )\n const detailsPanelClassNames = classnames(\n 'table__item',\n commonDetailsStore.showWarning && 'pop-up-dialog-opened',\n isDetailsScreen && 'table__item_big',\n isDetailsPopUp && 'table__item-popup'\n )\n\n const formRef = useRef(\n createForm({\n initialValues: formInitialValues,\n mutators: { ...arrayMutators, setFieldState },\n onSubmit: () => {}\n })\n )\n\n useEffect(() => {\n return () => {\n if (!isDetailsPopUp) {\n dispatch(resetChanges())\n }\n }\n }, [dispatch, isDetailsPopUp])\n\n const handleShowWarning = useCallback(\n show => {\n dispatch(showWarning(show))\n },\n [dispatch]\n )\n\n const handleRefreshClick = useCallback(\n event => {\n if (\n commonDetailsStore.changes.counter > 0 &&\n document.getElementById('refresh')?.contains(event.target)\n ) {\n handleShowWarning(true)\n dispatch(setFiltersWasHandled(true))\n }\n },\n [commonDetailsStore.changes.counter, dispatch, handleShowWarning]\n )\n\n useEffect(() => {\n window.addEventListener('click', handleRefreshClick)\n\n return () => {\n window.removeEventListener('click', handleRefreshClick)\n }\n }, [handleRefreshClick])\n\n const shouldDetailsBlock = useCallback(\n ({ currentLocation, nextLocation }) => {\n const currentDetailsView = currentLocation.search.split(`${VIEW_SEARCH_PARAMETER}=`)?.[1]\n const nextDetailsView = nextLocation.search.split(`${VIEW_SEARCH_PARAMETER}=`)?.[1]\n const currentLocationPathname = currentLocation.pathname.split('/')\n const nextLocationPathname = nextLocation.pathname.split('/')\n currentLocationPathname.pop()\n nextLocationPathname.pop()\n\n return (\n commonDetailsStore.changes.counter > 0 &&\n (currentLocationPathname.join('/') !== nextLocationPathname.join('/') ||\n currentDetailsView !== nextDetailsView)\n )\n },\n [commonDetailsStore.changes.counter]\n )\n\n useEffect(() => {\n if (\n formRef.current &&\n commonDetailsStore.changes.counter === 0 &&\n !isEqual(pickBy(formInitialValues), pickBy(formRef.current.getState()?.values)) &&\n !formRef.current.getState()?.active\n ) {\n formRef.current.restart(formInitialValues)\n }\n }, [formInitialValues, commonDetailsStore.changes.counter])\n\n useEffect(() => {\n const currentPathname = location.pathname.substring(\n 0,\n location.pathname.lastIndexOf(params.tab)\n )\n\n if (previousPathnameRef.current !== currentPathname && !isDetailsPopUp) {\n formRef.current.restart(formInitialValues)\n dispatch(setEditMode(false))\n previousPathnameRef.current = currentPathname\n }\n }, [dispatch, formInitialValues, isDetailsPopUp, location.pathname, params.tab])\n\n const applyChanges = useCallback(() => {\n applyDetailsChanges(commonDetailsStore.changes).then(() => {\n dispatch(resetChanges())\n\n const changes = cloneDeep(commonDetailsStore.changes)\n\n // todo [redux-toolkit] rework it after redux-toolkit will be added to the details store. Need to remove setTimeout and use a Promise that resolves after the state is updated.\n setTimeout(() => {\n applyDetailsChangesCallback(changes, selectedItem)\n })\n })\n }, [\n applyDetailsChanges,\n applyDetailsChangesCallback,\n commonDetailsStore.changes,\n dispatch,\n selectedItem\n ])\n\n const cancelChanges = useCallback(() => {\n if (commonDetailsStore.changes.counter > 0) {\n dispatch(resetChanges())\n formRef.current.reset(formInitialValues)\n }\n }, [commonDetailsStore.changes.counter, dispatch, formInitialValues])\n\n const leavePage = useCallback(() => {\n cancelChanges()\n handleShowWarning(false)\n\n if (commonDetailsStore.filtersWasHandled) {\n dispatch(setFiltersWasHandled(false))\n } else {\n blocker.proceed?.()\n }\n\n window.dispatchEvent(new CustomEvent('discardChanges'))\n }, [blocker, cancelChanges, commonDetailsStore.filtersWasHandled, dispatch, handleShowWarning])\n\n const doNotLeavePage = useCallback(() => {\n blocker.reset?.()\n dispatch(showWarning(false))\n window.dispatchEvent(new CustomEvent('cancelLeave'))\n }, [blocker, dispatch])\n\n return {\n DetailsContainer,\n applyChanges,\n applyChangesRef,\n blocker,\n cancelChanges,\n detailsPanelClassNames,\n detailsRef,\n commonDetailsStore,\n doNotLeavePage,\n formRef,\n handleShowWarning,\n leavePage,\n location,\n params,\n removeDetailsInfo,\n setBlocker,\n setDetailsInfo,\n shouldDetailsBlock\n }\n}\n"],"names":["DetailsContainer","blocker","detailsMenu","detailsPanelClassNames","detailsPopUpSelectedTab","detailsRef","detailsStore","commonDetailsStore","doNotLeavePage","formRef","isDetailsPopUp","leavePage","params","renderHeader","renderTabsContent","setBlocker","setDetailsPopUpSelectedTab","shouldDetailsBlock","withActionMenu","Form","jsxs","jsx","Loader","ErrorMessage","TabsSlider","newTab","formState","ConfirmDialog","TERTIARY_BUTTON","PRIMARY_BUTTON","BlockerSpy","PropTypes","DETAILS_MENU","useDetails","applyDetailsChanges","applyDetailsChangesCallback","formInitialValues","isDetailsScreen","selectedItem","useState","applyChangesRef","useRef","dispatch","useDispatch","useParams","useSelector","store","location","useLocation","setDetailsInfo","removeDetailsInfo","useMemo","setDetailsPopUpInfoContent","removeDetailsPopUpInfoContent","setInfoContent","removeInfoContent","previousPathnameRef","classnames","createForm","arrayMutators","setFieldState","useEffect","resetChanges","handleShowWarning","useCallback","show","showWarning","handleRefreshClick","event","_a","setFiltersWasHandled","currentLocation","nextLocation","currentDetailsView","VIEW_SEARCH_PARAMETER","nextDetailsView","_b","currentLocationPathname","nextLocationPathname","isEqual","pickBy","currentPathname","setEditMode","applyChanges","changes","cloneDeep","cancelChanges"],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,MAAMA,IAAmB,CAAC;AAAA,EACxB,SAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,yBAAAC,IAA0B;AAAA,EAC1B,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,4BAAAC,IAA6B;AAAA,EAC7B,oBAAAC;AAAA,EACA,gBAAAC,IAAiB;AACnB,wBAEKC,GAAK,EAAA,MAAMV,EAAQ,SAAS,UAAU,MAAM;AAAC,GAC3C,iBACE,gBAAAW,EAAA,OAAA,EAAI,WAAWjB,GAAwB,KAAKE,GAAY,eAAY,gBAClE,UAAA;AAAA,EAAaC,EAAA,iBAAiB,KAAK,gBAAAe,EAACC,IAAO,CAAA,CAAA;AAAA,EAC3ChB,EAAa,SAAS,gBAAAe,EAACE,MAAa,SAASjB,EAAa,MAAM,SAAS;AAAA,EAC1E,gBAAAc,EAAC,OAAI,EAAA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KAEpCD,IAAApE,EAAQ,YAAR,QAAAoE,EAAA,KAAApE,IAGF,OAAO,cAAc,IAAI,YAAY,gBAAgB,CAAC;AAAA,EAAA,GACrD,CAACA,GAASqF,GAAe/E,EAAmB,mBAAmBmC,GAAUqB,CAAiB,CAAC,GAExFvD,IAAiBwD,EAAY,MAAM;;AACvC,KAAAK,IAAApE,EAAQ,UAAR,QAAAoE,EAAA,KAAApE,IACSyC,EAAAwB,EAAY,EAAK,CAAC,GAC3B,OAAO,cAAc,IAAI,YAAY,aAAa,CAAC;AAAA,EAAA,GAClD,CAACjE,GAASyC,CAAQ,CAAC;AAEf,SAAA;AAAA,IACL,kBAAA1C;AAAA,IACA,cAAAmF;AAAA,IACA,iBAAA3C;AAAA,IACA,SAAAvC;AAAA,IACA,eAAAqF;AAAA,IACA,wBAAAnF;AAAA,IACA,YAAAE;AAAA,IACA,oBAAAE;AAAA,IACA,gBAAAC;AAAA,IACA,SAAAC;AAAA,IACA,mBAAAsD;AAAA,IACA,WAAApD;AAAA,IACA,UAAAoC;AAAA,IACA,QAAAnC;AAAA,IACA,mBAAAsC;AAAA,IACA,YAAAnC;AAAA,IACA,gBAAAkC;AAAA,IACA,oBAAAhC;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useDetails.hook.mjs","sources":["../../src/lib/hooks/useDetails.hook.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\nimport React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport PropTypes from 'prop-types'\nimport arrayMutators from 'final-form-arrays'\nimport classnames from 'classnames'\nimport { Form } from 'react-final-form'\nimport { cloneDeep, isEqual, pickBy } from 'lodash'\nimport { createForm } from 'final-form'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { useLocation, useParams } from 'react-router-dom'\n\nimport BlockerSpy from '../components/BlockerSpy/BlockerSpy'\nimport ErrorMessage from '../components/ErrorMessage/ErrorMessage'\nimport Loader from '../components/Loader/Loader'\nimport TabsSlider from '../components/TabsSlider/TabsSlider'\nimport ConfirmDialog from '../components/ConfirmDialog/ConfirmDialog'\n\nimport {\n removeDetailsPopUpInfoContent,\n removeInfoContent,\n resetChanges,\n setDetailsPopUpInfoContent,\n setEditMode,\n setFiltersWasHandled,\n setInfoContent,\n showWarning\n} from '../reducers/commonDetailsReducer'\nimport { PRIMARY_BUTTON, TERTIARY_BUTTON } from '../constants'\nimport { VIEW_SEARCH_PARAMETER } from '../constants'\nimport { DETAILS_MENU } from '../types'\nimport { setFieldState } from '../utils/form.util'\n\nconst DetailsContainer = ({\n blocker,\n commonDetailsStore,\n detailsMenu,\n detailsPanelClassNames,\n detailsPopUpSelectedTab = '',\n detailsRef,\n detailsStore,\n doNotLeavePage,\n formRef,\n isDetailsPopUp = null,\n leavePage,\n params,\n renderHeader,\n renderTabsContent,\n setBlocker,\n setDetailsPopUpSelectedTab = null,\n shouldDetailsBlock,\n withActionMenu = true\n}) => {\n return (\n <Form form={formRef.current} onSubmit={() => {}}>\n {formState => (\n <div className={detailsPanelClassNames} ref={detailsRef} data-testid=\"detailsPanel\">\n {detailsStore.loadingCounter > 0 && <Loader />}\n {detailsStore.error && <ErrorMessage message={detailsStore.error.message} />}\n <div className=\"item-header-wrapper\">\n {renderHeader()}\n {withActionMenu && (\n <TabsSlider\n initialTab={isDetailsPopUp ? detailsPopUpSelectedTab : params.tab}\n isDetailsPopUp={isDetailsPopUp}\n onClick={newTab => setDetailsPopUpSelectedTab && setDetailsPopUpSelectedTab(newTab)}\n skipLink={isDetailsPopUp}\n tabsList={detailsMenu}\n />\n )}\n </div>\n <div className=\"item-info\">{renderTabsContent(formState)}</div>\n {(blocker.state === 'blocked' || commonDetailsStore.showWarning) && (\n <ConfirmDialog\n cancelButton={{\n handler: doNotLeavePage,\n label: 'Cancel',\n variant: TERTIARY_BUTTON\n }}\n closePopUp={doNotLeavePage}\n confirmButton={{\n handler: leavePage,\n label: 'Yes',\n variant: PRIMARY_BUTTON\n }}\n header=\"You have unsaved changes.\"\n isOpen={blocker.state === 'blocked' || commonDetailsStore.showWarning}\n message=\"Do you want to discard the changes?\"\n />\n )}\n {!isDetailsPopUp && (\n <BlockerSpy setBlocker={setBlocker} shouldBlock={shouldDetailsBlock} />\n )}\n </div>\n )}\n </Form>\n )\n}\n\nDetailsContainer.propTypes = {\n blocker: PropTypes.object.isRequired,\n detailsMenu: DETAILS_MENU.isRequired,\n detailsPanelClassNames: PropTypes.string.isRequired,\n detailsPopUpSelectedTab: PropTypes.string,\n detailsRef: PropTypes.object.isRequired,\n detailsStore: PropTypes.object.isRequired,\n commonDetailsStore: PropTypes.object.isRequired,\n doNotLeavePage: PropTypes.func.isRequired,\n formRef: PropTypes.object.isRequired,\n isDetailsPopUp: PropTypes.bool,\n leavePage: PropTypes.func.isRequired,\n params: PropTypes.object.isRequired,\n renderHeader: PropTypes.func.isRequired,\n renderTabsContent: PropTypes.func.isRequired,\n setBlocker: PropTypes.func.isRequired,\n setDetailsPopUpSelectedTab: PropTypes.func,\n shouldDetailsBlock: PropTypes.func.isRequired,\n withActionMenu: PropTypes.bool\n}\n\nexport const useDetails = ({\n applyDetailsChanges,\n applyDetailsChangesCallback,\n formInitialValues,\n isDetailsPopUp,\n isDetailsScreen,\n selectedItem\n}) => {\n const [blocker, setBlocker] = useState({})\n const applyChangesRef = useRef()\n const dispatch = useDispatch()\n const detailsRef = useRef()\n const params = useParams()\n const commonDetailsStore = useSelector(store => store.commonDetailsStore)\n const location = useLocation()\n const [setDetailsInfo, removeDetailsInfo] = useMemo(() => {\n return isDetailsPopUp\n ? [setDetailsPopUpInfoContent, removeDetailsPopUpInfoContent]\n : [setInfoContent, removeInfoContent]\n }, [isDetailsPopUp])\n const previousPathnameRef = useRef(\n location.pathname.substring(0, location.pathname.lastIndexOf(params.tab))\n )\n const detailsPanelClassNames = classnames(\n 'table__item',\n commonDetailsStore.showWarning && 'pop-up-dialog-opened',\n isDetailsScreen && 'table__item_big',\n isDetailsPopUp && 'table__item-popup'\n )\n\n const formRef = useRef(\n createForm({\n initialValues: formInitialValues,\n mutators: { ...arrayMutators, setFieldState },\n onSubmit: () => {}\n })\n )\n\n useEffect(() => {\n return () => {\n if (!isDetailsPopUp) {\n dispatch(resetChanges())\n }\n }\n }, [dispatch, isDetailsPopUp])\n\n const handleShowWarning = useCallback(\n show => {\n dispatch(showWarning(show))\n },\n [dispatch]\n )\n\n const handleRefreshClick = useCallback(\n event => {\n if (\n commonDetailsStore.changes.counter > 0 &&\n document.getElementById('refresh')?.contains(event.target)\n ) {\n handleShowWarning(true)\n dispatch(setFiltersWasHandled(true))\n }\n },\n [commonDetailsStore.changes.counter, dispatch, handleShowWarning]\n )\n\n useEffect(() => {\n window.addEventListener('click', handleRefreshClick)\n\n return () => {\n window.removeEventListener('click', handleRefreshClick)\n }\n }, [handleRefreshClick])\n\n const shouldDetailsBlock = useCallback(\n ({ currentLocation, nextLocation }) => {\n const currentDetailsView = currentLocation.search.split(`${VIEW_SEARCH_PARAMETER}=`)?.[1]\n const nextDetailsView = nextLocation.search.split(`${VIEW_SEARCH_PARAMETER}=`)?.[1]\n const currentLocationPathname = currentLocation.pathname.split('/')\n const nextLocationPathname = nextLocation.pathname.split('/')\n currentLocationPathname.pop()\n nextLocationPathname.pop()\n\n return (\n commonDetailsStore.changes.counter > 0 &&\n (currentLocationPathname.join('/') !== nextLocationPathname.join('/') ||\n currentDetailsView !== nextDetailsView)\n )\n },\n [commonDetailsStore.changes.counter]\n )\n\n useEffect(() => {\n if (\n formRef.current &&\n commonDetailsStore.changes.counter === 0 &&\n !isEqual(pickBy(formInitialValues), pickBy(formRef.current.getState()?.values)) &&\n !formRef.current.getState()?.active\n ) {\n formRef.current.restart(formInitialValues)\n }\n }, [formInitialValues, commonDetailsStore.changes.counter])\n\n useEffect(() => {\n const currentPathname = location.pathname.substring(\n 0,\n location.pathname.lastIndexOf(params.tab)\n )\n\n if (previousPathnameRef.current !== currentPathname && !isDetailsPopUp) {\n formRef.current.restart(formInitialValues)\n dispatch(setEditMode(false))\n previousPathnameRef.current = currentPathname\n }\n }, [dispatch, formInitialValues, isDetailsPopUp, location.pathname, params.tab])\n\n const applyChanges = useCallback(() => {\n applyDetailsChanges(commonDetailsStore.changes).then(() => {\n dispatch(resetChanges())\n\n const changes = cloneDeep(commonDetailsStore.changes)\n\n // todo [redux-toolkit] rework it after redux-toolkit will be added to the details store. Need to remove setTimeout and use a Promise that resolves after the state is updated.\n setTimeout(() => {\n applyDetailsChangesCallback(changes, selectedItem)\n })\n })\n }, [\n applyDetailsChanges,\n applyDetailsChangesCallback,\n commonDetailsStore.changes,\n dispatch,\n selectedItem\n ])\n\n const cancelChanges = useCallback(() => {\n if (commonDetailsStore.changes.counter > 0) {\n dispatch(resetChanges())\n formRef.current.reset(formInitialValues)\n }\n }, [commonDetailsStore.changes.counter, dispatch, formInitialValues])\n\n const leavePage = useCallback(() => {\n cancelChanges()\n handleShowWarning(false)\n\n if (commonDetailsStore.filtersWasHandled) {\n dispatch(setFiltersWasHandled(false))\n }\n\n blocker.proceed?.()\n\n window.dispatchEvent(new CustomEvent('discardChanges'))\n }, [blocker, cancelChanges, commonDetailsStore.filtersWasHandled, dispatch, handleShowWarning])\n\n const doNotLeavePage = useCallback(() => {\n blocker.reset?.()\n dispatch(showWarning(false))\n window.dispatchEvent(new CustomEvent('cancelLeave'))\n }, [blocker, dispatch])\n\n return {\n DetailsContainer,\n applyChanges,\n applyChangesRef,\n blocker,\n cancelChanges,\n detailsPanelClassNames,\n detailsRef,\n commonDetailsStore,\n doNotLeavePage,\n formRef,\n handleShowWarning,\n leavePage,\n location,\n params,\n removeDetailsInfo,\n setBlocker,\n setDetailsInfo,\n shouldDetailsBlock\n }\n}\n"],"names":["DetailsContainer","blocker","commonDetailsStore","detailsMenu","detailsPanelClassNames","detailsPopUpSelectedTab","detailsRef","detailsStore","doNotLeavePage","formRef","isDetailsPopUp","leavePage","params","renderHeader","renderTabsContent","setBlocker","setDetailsPopUpSelectedTab","shouldDetailsBlock","withActionMenu","Form","jsxs","jsx","Loader","ErrorMessage","TabsSlider","newTab","formState","ConfirmDialog","TERTIARY_BUTTON","PRIMARY_BUTTON","BlockerSpy","PropTypes","DETAILS_MENU","useDetails","applyDetailsChanges","applyDetailsChangesCallback","formInitialValues","isDetailsScreen","selectedItem","useState","applyChangesRef","useRef","dispatch","useDispatch","useParams","useSelector","store","location","useLocation","setDetailsInfo","removeDetailsInfo","useMemo","setDetailsPopUpInfoContent","removeDetailsPopUpInfoContent","setInfoContent","removeInfoContent","previousPathnameRef","classnames","createForm","arrayMutators","setFieldState","useEffect","resetChanges","handleShowWarning","useCallback","show","showWarning","handleRefreshClick","event","_a","setFiltersWasHandled","currentLocation","nextLocation","currentDetailsView","VIEW_SEARCH_PARAMETER","nextDetailsView","_b","currentLocationPathname","nextLocationPathname","isEqual","pickBy","currentPathname","setEditMode","applyChanges","changes","cloneDeep","cancelChanges"],"mappings":";;;;;;;;;;;;;;;;;;;AAkDA,MAAMA,IAAmB,CAAC;AAAA,EACxB,SAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,aAAAC;AAAA,EACA,wBAAAC;AAAA,EACA,yBAAAC,IAA0B;AAAA,EAC1B,YAAAC;AAAA,EACA,cAAAC;AAAA,EACA,gBAAAC;AAAA,EACA,SAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,WAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC;AAAA,E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({ handleCancel, handleShowWarning, isDetailsPop
5
5
  pageData: any;
6
6
  }): {
7
7
  DetailsHeaderContainer: {
8
- ({ actionButton, actionsMenu, applyChanges, applyChangesRef, cancelChanges, commonDetailsStore, getCloseDetailsLink, getDefaultCloseDetailsLink, handleCancelClick, handleRefresh, headerRef, isDetailsPopUp, isDetailsScreen, location, navigate, pageData, params, renderCustomElements, renderStatus, renderTitle, selectedItem, showAllVersions, tab, viewMode, withActionMenu, withToggleViewBtn }: {
8
+ ({ actionButton, actionsMenu, applyChanges, applyChangesRef, cancelChanges, commonDetailsStore, getCloseDetailsLink, getDefaultCloseDetailsLink, handleActionClick, handleCancelClick, handleRefresh, headerRef, isDetailsPopUp, isDetailsScreen, location, navigate, pageData, params, renderCustomElements, renderStatus, renderTitle, selectedItem, showAllVersions, tab, viewMode, withActionMenu, withToggleViewBtn }: {
9
9
  actionButton?: any;
10
10
  actionsMenu: any;
11
11
  applyChanges: any;
@@ -14,6 +14,7 @@ export function useDetailsHeader({ handleCancel, handleShowWarning, isDetailsPop
14
14
  commonDetailsStore: any;
15
15
  getCloseDetailsLink?: any;
16
16
  getDefaultCloseDetailsLink: any;
17
+ handleActionClick: any;
17
18
  handleCancelClick: any;
18
19
  handleRefresh?: any;
19
20
  headerRef: any;
@@ -42,6 +43,7 @@ export function useDetailsHeader({ handleCancel, handleShowWarning, isDetailsPop
42
43
  commonDetailsStore: any;
43
44
  getCloseDetailsLink: any;
44
45
  getDefaultCloseDetailsLink: any;
46
+ handleActionClick: any;
45
47
  handleCancelClick: any;
46
48
  handleRefresh: any;
47
49
  headerRef: any;
@@ -64,6 +66,7 @@ export function useDetailsHeader({ handleCancel, handleShowWarning, isDetailsPop
64
66
  };
65
67
  actionButton: any;
66
68
  commonDetailsStore: any;
69
+ handleActionClick: (event: any, handler: any) => Promise<void>;
67
70
  handleBackClick: () => void;
68
71
  handleCancelClick: () => void;
69
72
  headerRef: import("react").MutableRefObject<undefined>;
@@ -1 +1 @@
1
- {"version":3,"file":"useDetailsHeader.hook.d.ts","sourceRoot":"","sources":["../../src/lib/hooks/useDetailsHeader.hook.jsx"],"names":[],"mappings":"AAsOO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCN"}
1
+ {"version":3,"file":"useDetailsHeader.hook.d.ts","sourceRoot":"","sources":["../../src/lib/hooks/useDetailsHeader.hook.jsx"],"names":[],"mappings":"AA0OO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkDN"}
@@ -1,84 +1,85 @@
1
- import { jsxs as l, jsx as i, Fragment as q } from "react/jsx-runtime";
2
- import { useRef as L, useCallback as M } from "react";
1
+ import { jsxs as r, jsx as i, Fragment as M } from "react/jsx-runtime";
2
+ import { useRef as H, useCallback as x } from "react";
3
3
  import e from "prop-types";
4
- import { useSelector as B } from "react-redux";
5
- import { Link as O, useParams as F, useNavigate as H, useLocation as P } from "react-router-dom";
6
- import U from "../components/ActionsMenu/ActionsMenu.mjs";
7
- import x from "../components/Button/Button.mjs";
8
- import z from "../components/LoadButton/LoadButton.mjs";
4
+ import { useSelector as O, useDispatch as F } from "react-redux";
5
+ import { Link as P, useParams as D, useNavigate as U, useLocation as z } from "react-router-dom";
6
+ import W from "../components/ActionsMenu/ActionsMenu.mjs";
7
+ import j from "../components/Button/Button.mjs";
8
+ import Y from "../components/LoadButton/LoadButton.mjs";
9
9
  import s from "../components/RoundedIcon/RoundedIcon.mjs";
10
- import D from "../components/TooltipTemplate/TextTooltipTemplate.mjs";
11
- import W from "../components/Tooltip/Tooltip.mjs";
12
- import { ACTIONS_MENU as Y, ACTION_BUTTON as G } from "../types.mjs";
13
- import { TERTIARY_BUTTON as J, FULL_VIEW_MODE as A, VIEW_SEARCH_PARAMETER as j } from "../constants.mjs";
14
- import { getFilteredSearchParams as K } from "../utils/filter.util.mjs";
15
- import { getViewMode as Q } from "../utils/common.util.mjs";
16
- import E from "../images/close.svg.mjs";
17
- import X from "../images/ml-enlarge.svg.mjs";
18
- import Z from "../images/history.svg.mjs";
19
- import ee from "../images/ml-minimize.svg.mjs";
20
- import ie from "../images/refresh.svg.mjs";
21
- const y = ({
10
+ import G from "../components/TooltipTemplate/TextTooltipTemplate.mjs";
11
+ import J from "../components/Tooltip/Tooltip.mjs";
12
+ import { ACTIONS_MENU as K, ACTION_BUTTON as Q } from "../types.mjs";
13
+ import { TERTIARY_BUTTON as X, FULL_VIEW_MODE as y, VIEW_SEARCH_PARAMETER as E } from "../constants.mjs";
14
+ import { getFilteredSearchParams as Z } from "../utils/filter.util.mjs";
15
+ import { getViewMode as ee, performDetailsActionHelper as ie } from "../utils/common.util.mjs";
16
+ import $ from "../images/close.svg.mjs";
17
+ import te from "../images/ml-enlarge.svg.mjs";
18
+ import oe from "../images/history.svg.mjs";
19
+ import ne from "../images/ml-minimize.svg.mjs";
20
+ import re from "../images/refresh.svg.mjs";
21
+ const B = ({
22
22
  actionButton: t = null,
23
- actionsMenu: a,
24
- applyChanges: c,
25
- applyChangesRef: g,
26
- cancelChanges: r,
23
+ actionsMenu: c,
24
+ applyChanges: d,
25
+ applyChangesRef: R,
26
+ cancelChanges: n,
27
27
  commonDetailsStore: o,
28
- getCloseDetailsLink: d = null,
29
- getDefaultCloseDetailsLink: b,
30
- handleCancelClick: m,
31
- handleRefresh: u = null,
32
- headerRef: R,
33
- isDetailsPopUp: n = !1,
34
- isDetailsScreen: v,
35
- location: h,
36
- navigate: p,
37
- pageData: f,
38
- params: $,
39
- renderCustomElements: C = null,
40
- renderStatus: w = null,
41
- renderTitle: _,
42
- selectedItem: T,
43
- showAllVersions: k = null,
28
+ getCloseDetailsLink: m = null,
29
+ getDefaultCloseDetailsLink: C,
30
+ handleActionClick: v,
31
+ handleCancelClick: u,
32
+ handleRefresh: h = null,
33
+ headerRef: T,
34
+ isDetailsPopUp: a = !1,
35
+ isDetailsScreen: w,
36
+ location: p,
37
+ navigate: f,
38
+ pageData: g,
39
+ params: l,
40
+ renderCustomElements: b = null,
41
+ renderStatus: _ = null,
42
+ renderTitle: q,
43
+ selectedItem: k,
44
+ showAllVersions: N = null,
44
45
  tab: S = "",
45
- viewMode: N = "",
46
+ viewMode: A = "",
46
47
  withActionMenu: V = !0,
47
48
  withToggleViewBtn: I = !1
48
- }) => /* @__PURE__ */ l("div", { className: "item-header", ref: R, children: [
49
- /* @__PURE__ */ l("div", { className: "item-header__data", children: [
50
- /* @__PURE__ */ i("h3", { className: "item-header__title", children: _ && _() }),
51
- /* @__PURE__ */ i("div", { className: "item-header__status", children: w && w() })
49
+ }) => /* @__PURE__ */ r("div", { className: "item-header", ref: T, children: [
50
+ /* @__PURE__ */ r("div", { className: "item-header__data", children: [
51
+ /* @__PURE__ */ i("h3", { className: "item-header__title", children: q && q() }),
52
+ /* @__PURE__ */ i("div", { className: "item-header__status", children: _ && _() })
52
53
  ] }),
53
- /* @__PURE__ */ i("div", { className: "item-header__custom-elements", children: C && C() }),
54
- /* @__PURE__ */ l("div", { className: "item-header__buttons", children: [
55
- o.changes.counter > 0 && !n && /* @__PURE__ */ l(q, { children: [
54
+ /* @__PURE__ */ i("div", { className: "item-header__custom-elements", children: b && b() }),
55
+ /* @__PURE__ */ r("div", { className: "item-header__buttons", children: [
56
+ o.changes.counter > 0 && !a && /* @__PURE__ */ r(M, { children: [
56
57
  /* @__PURE__ */ i(
57
- x,
58
+ j,
58
59
  {
59
- variant: J,
60
+ variant: X,
60
61
  label: "Cancel",
61
- onClick: r,
62
+ onClick: n,
62
63
  disabled: o.changes.counter === 0 || o.editMode
63
64
  }
64
65
  ),
65
66
  /* @__PURE__ */ i(
66
- W,
67
+ J,
67
68
  {
68
69
  template: /* @__PURE__ */ i(
69
- D,
70
+ G,
70
71
  {
71
72
  text: `${o.changes.counter} ${o.changes.counter === 1 ? "change pending" : "changes pending"}`
72
73
  }
73
74
  ),
74
75
  children: /* @__PURE__ */ i(
75
- z,
76
+ Y,
76
77
  {
77
- ref: g,
78
+ ref: R,
78
79
  variant: "primary",
79
80
  label: "Apply Changes",
80
81
  className: "btn_apply-changes",
81
- onClick: c,
82
+ onClick: d,
82
83
  disabled: o.changes.counter === 0 || o.editMode
83
84
  }
84
85
  )
@@ -86,93 +87,96 @@ const y = ({
86
87
  )
87
88
  ] }),
88
89
  t && !t.hidden && /* @__PURE__ */ i(
89
- x,
90
+ j,
90
91
  {
91
92
  disabled: t.disabled,
92
93
  label: t.label,
93
- onClick: t.onClick,
94
+ onClick: (L) => {
95
+ v(L, t.onClick);
96
+ },
94
97
  tooltip: t.tooltip,
95
98
  variant: t.variant
96
99
  }
97
100
  ),
98
- k && /* @__PURE__ */ i(
101
+ N && /* @__PURE__ */ i(
99
102
  s,
100
103
  {
101
104
  id: "showAllVersions",
102
- onClick: () => k(),
105
+ onClick: () => N(),
103
106
  tooltipText: "Show all versions",
104
- children: /* @__PURE__ */ i(Z, {})
107
+ children: /* @__PURE__ */ i(oe, {})
105
108
  }
106
109
  ),
107
- v && u && /* @__PURE__ */ i(
110
+ w && h && /* @__PURE__ */ i(
108
111
  s,
109
112
  {
110
113
  id: "refresh",
111
- onClick: () => u(T),
114
+ onClick: () => h(k),
112
115
  tooltipText: "Refresh",
113
- children: /* @__PURE__ */ i(ie, {})
116
+ children: /* @__PURE__ */ i(re, {})
114
117
  }
115
118
  ),
116
- V && /* @__PURE__ */ i(U, { dataItem: T, menu: a, time: 500 }),
117
- /* @__PURE__ */ l("div", { className: "item-header__navigation-buttons", children: [
118
- I && !n && /* @__PURE__ */ l(q, { children: [
119
- N !== A && /* @__PURE__ */ i(
119
+ V && /* @__PURE__ */ i(W, { dataItem: k, menu: c, time: 500 }),
120
+ /* @__PURE__ */ r("div", { className: "item-header__navigation-buttons", children: [
121
+ I && !a && /* @__PURE__ */ r(M, { children: [
122
+ A !== y && /* @__PURE__ */ i(
120
123
  s,
121
124
  {
122
125
  onClick: () => {
123
- p(
124
- `${h.pathname}${window.location.search}${window.location.search ? "&" : "?"}${j}=full`
126
+ f(
127
+ `${p.pathname}${window.location.search}${window.location.search ? "&" : "?"}${E}=full`
125
128
  );
126
129
  },
127
130
  id: "full-view",
128
131
  tooltipText: "Full view",
129
- children: /* @__PURE__ */ i(X, {})
132
+ children: /* @__PURE__ */ i(te, {})
130
133
  }
131
134
  ),
132
- N === A && /* @__PURE__ */ i(
135
+ A === y && /* @__PURE__ */ i(
133
136
  s,
134
137
  {
135
138
  onClick: () => {
136
- p(
137
- `${h.pathname}${K(window.location.search, [j])}`
139
+ f(
140
+ `${p.pathname}${Z(window.location.search, [E])}`
138
141
  );
139
142
  },
140
143
  id: "table-view",
141
144
  tooltipText: "Table view",
142
- children: /* @__PURE__ */ i(ee, {})
145
+ children: /* @__PURE__ */ i(ne, {})
143
146
  }
144
147
  )
145
148
  ] }),
146
- !f.details.hideBackBtn && (n ? /* @__PURE__ */ i(
149
+ !g.details.hideBackBtn && (a ? /* @__PURE__ */ i(
147
150
  "div",
148
151
  {
149
152
  className: "details-close-btn",
150
153
  "data-testid": "details-close-btn",
151
- onClick: m,
152
- children: /* @__PURE__ */ i(s, { tooltipText: "Close", id: "details-close", children: /* @__PURE__ */ i(E, {}) })
154
+ onClick: u,
155
+ children: /* @__PURE__ */ i(s, { tooltipText: "Close", id: "details-close", children: /* @__PURE__ */ i($, {}) })
153
156
  }
154
157
  ) : /* @__PURE__ */ i(
155
- O,
158
+ P,
156
159
  {
157
160
  className: "details-close-btn",
158
161
  "data-testid": "details-close-btn",
159
- to: d ? d(T.name) : b($, f.page, S),
160
- onClick: m,
161
- children: /* @__PURE__ */ i(s, { tooltipText: "Close", id: "details-close", children: /* @__PURE__ */ i(E, {}) })
162
+ to: m ? m(k.name) : C(l, g.page, S),
163
+ onClick: u,
164
+ children: /* @__PURE__ */ i(s, { tooltipText: "Close", id: "details-close", children: /* @__PURE__ */ i($, {}) })
162
165
  }
163
166
  ))
164
167
  ] })
165
168
  ] })
166
169
  ] });
167
- y.propTypes = {
168
- actionButton: G,
169
- actionsMenu: Y.isRequired,
170
+ B.propTypes = {
171
+ actionButton: Q,
172
+ actionsMenu: K.isRequired,
170
173
  applyChanges: e.func.isRequired,
171
174
  applyChangesRef: e.object.isRequired,
172
175
  cancelChanges: e.func.isRequired,
173
176
  commonDetailsStore: e.object.isRequired,
174
177
  getCloseDetailsLink: e.func,
175
178
  getDefaultCloseDetailsLink: e.func.isRequired,
179
+ handleActionClick: e.func.isRequired,
176
180
  handleCancelClick: e.func.isRequired,
177
181
  handleRefresh: e.func,
178
182
  headerRef: e.object.isRequired,
@@ -192,28 +196,34 @@ y.propTypes = {
192
196
  withActionMenu: e.bool,
193
197
  withToggleViewBtn: e.bool
194
198
  };
195
- const we = ({ handleCancel: t, handleShowWarning: a, isDetailsPopUp: c, pageData: g }) => {
196
- const r = B((f) => f.commonDetailsStore), o = F(), d = H(), b = Q(window.location.search), { actionButton: m, withToggleViewBtn: u, showAllVersions: R } = g.details, n = L(), v = P(), h = M(() => {
197
- r.changes.counter > 0 ? a(!0) : t && t();
198
- }, [r.changes.counter, t, a]), p = M(() => {
199
- t && (r.changes.counter === 0 || c) && t();
200
- }, [r.changes.counter, t, c]);
199
+ const Ne = ({ handleCancel: t, handleShowWarning: c, isDetailsPopUp: d, pageData: R }) => {
200
+ const n = O((l) => l.commonDetailsStore), o = F(), m = D(), C = U(), v = ee(window.location.search), { actionButton: u, withToggleViewBtn: h, showAllVersions: T } = R.details, a = H(), w = z(), p = async (l, b) => {
201
+ await ie(
202
+ n.changes,
203
+ o
204
+ ) && b(l);
205
+ }, f = x(() => {
206
+ n.changes.counter > 0 ? c(!0) : t && t();
207
+ }, [n.changes.counter, t, c]), g = x(() => {
208
+ t && (n.changes.counter === 0 || d) && t();
209
+ }, [n.changes.counter, t, d]);
201
210
  return {
202
- DetailsHeaderContainer: y,
203
- actionButton: m,
204
- commonDetailsStore: r,
205
- handleBackClick: h,
206
- handleCancelClick: p,
207
- headerRef: n,
208
- location: v,
209
- navigate: d,
210
- params: o,
211
- showAllVersions: R,
212
- viewMode: b,
213
- withToggleViewBtn: u
211
+ DetailsHeaderContainer: B,
212
+ actionButton: u,
213
+ commonDetailsStore: n,
214
+ handleActionClick: p,
215
+ handleBackClick: f,
216
+ handleCancelClick: g,
217
+ headerRef: a,
218
+ location: w,
219
+ navigate: C,
220
+ params: m,
221
+ showAllVersions: T,
222
+ viewMode: v,
223
+ withToggleViewBtn: h
214
224
  };
215
225
  };
216
226
  export {
217
- we as useDetailsHeader
227
+ Ne as useDetailsHeader
218
228
  };
219
229
  //# sourceMappingURL=useDetailsHeader.hook.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDetailsHeader.hook.mjs","sources":["../../src/lib/hooks/useDetailsHeader.hook.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\n\nimport React, { useCallback, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { useSelector } from 'react-redux'\nimport { Link, useLocation, useNavigate, useParams } from 'react-router-dom'\n\nimport ActionsMenu from '../components/ActionsMenu/ActionsMenu'\nimport Button from '../components/Button/Button'\nimport LoadButton from '../components/LoadButton/LoadButton'\nimport RoundedIcon from '../components/RoundedIcon/RoundedIcon'\nimport TextTooltipTemplate from '../components/TooltipTemplate/TextTooltipTemplate'\nimport Tooltip from '../components/Tooltip/Tooltip'\n\nimport { ACTION_BUTTON, ACTIONS_MENU } from '../types'\nimport { TERTIARY_BUTTON, VIEW_SEARCH_PARAMETER, FULL_VIEW_MODE } from '../constants'\nimport { getFilteredSearchParams } from '../utils/filter.util'\nimport { getViewMode } from '../utils/common.util'\n\nimport Close from '../images/close.svg?react'\nimport EnlargeIcon from '../images/ml-enlarge.svg?react'\nimport HistoryIcon from '../images/history.svg?react'\nimport MinimizeIcon from '../images/ml-minimize.svg?react'\nimport Refresh from '../images/refresh.svg?react'\n\nconst DetailsHeaderContainer = ({\n actionButton = null,\n actionsMenu,\n applyChanges,\n applyChangesRef,\n cancelChanges,\n commonDetailsStore,\n getCloseDetailsLink = null,\n getDefaultCloseDetailsLink,\n handleCancelClick,\n handleRefresh = null,\n headerRef,\n isDetailsPopUp = false,\n isDetailsScreen,\n location,\n navigate,\n pageData,\n params,\n renderCustomElements = null,\n renderStatus = null,\n renderTitle,\n selectedItem,\n showAllVersions = null,\n tab = '',\n viewMode = '',\n withActionMenu = true,\n withToggleViewBtn = false\n}) => {\n return (\n <div className=\"item-header\" ref={headerRef}>\n <div className=\"item-header__data\">\n <h3 className=\"item-header__title\">{renderTitle && renderTitle()}</h3>\n <div className=\"item-header__status\">{renderStatus && renderStatus()}</div>\n </div>\n <div className=\"item-header__custom-elements\">\n {renderCustomElements && renderCustomElements()}\n </div>\n <div className=\"item-header__buttons\">\n {commonDetailsStore.changes.counter > 0 && !isDetailsPopUp && (\n <>\n <Button\n variant={TERTIARY_BUTTON}\n label=\"Cancel\"\n onClick={cancelChanges}\n disabled={commonDetailsStore.changes.counter === 0 || commonDetailsStore.editMode}\n />\n <Tooltip\n template={\n <TextTooltipTemplate\n text={`${commonDetailsStore.changes.counter} ${\n commonDetailsStore.changes.counter === 1 ? 'change pending' : 'changes pending'\n }`}\n />\n }\n >\n <LoadButton\n ref={applyChangesRef}\n variant=\"primary\"\n label=\"Apply Changes\"\n className=\"btn_apply-changes\"\n onClick={applyChanges}\n disabled={commonDetailsStore.changes.counter === 0 || commonDetailsStore.editMode}\n />\n </Tooltip>\n </>\n )}\n {actionButton && !actionButton.hidden && (\n <Button\n disabled={actionButton.disabled}\n label={actionButton.label}\n onClick={actionButton.onClick}\n tooltip={actionButton.tooltip}\n variant={actionButton.variant}\n />\n )}\n {showAllVersions && (\n <RoundedIcon\n id=\"showAllVersions\"\n onClick={() => showAllVersions()}\n tooltipText=\"Show all versions\"\n >\n <HistoryIcon />\n </RoundedIcon>\n )}\n {isDetailsScreen && handleRefresh && (\n <RoundedIcon\n id=\"refresh\"\n onClick={() => handleRefresh(selectedItem)}\n tooltipText=\"Refresh\"\n >\n <Refresh />\n </RoundedIcon>\n )}\n {withActionMenu && <ActionsMenu dataItem={selectedItem} menu={actionsMenu} time={500} />}\n <div className=\"item-header__navigation-buttons\">\n {withToggleViewBtn && !isDetailsPopUp && (\n <>\n {viewMode !== FULL_VIEW_MODE && (\n <RoundedIcon\n onClick={() => {\n navigate(\n `${location.pathname}${window.location.search}${window.location.search ? '&' : '?'}${VIEW_SEARCH_PARAMETER}=full`\n )\n }}\n id=\"full-view\"\n tooltipText=\"Full view\"\n >\n <EnlargeIcon />\n </RoundedIcon>\n )}\n {viewMode === FULL_VIEW_MODE && (\n <RoundedIcon\n onClick={() => {\n navigate(\n `${location.pathname}${getFilteredSearchParams(window.location.search, [VIEW_SEARCH_PARAMETER])}`\n )\n }}\n id=\"table-view\"\n tooltipText=\"Table view\"\n >\n <MinimizeIcon />\n </RoundedIcon>\n )}\n </>\n )}\n {!pageData.details.hideBackBtn &&\n (isDetailsPopUp ? (\n <div\n className=\"details-close-btn\"\n data-testid=\"details-close-btn\"\n onClick={handleCancelClick}\n >\n <RoundedIcon tooltipText=\"Close\" id=\"details-close\">\n <Close />\n </RoundedIcon>\n </div>\n ) : (\n <Link\n className=\"details-close-btn\"\n data-testid=\"details-close-btn\"\n to={\n getCloseDetailsLink\n ? getCloseDetailsLink(selectedItem.name)\n : getDefaultCloseDetailsLink(params, pageData.page, tab)\n }\n onClick={handleCancelClick}\n >\n <RoundedIcon tooltipText=\"Close\" id=\"details-close\">\n <Close />\n </RoundedIcon>\n </Link>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\nDetailsHeaderContainer.propTypes = {\n actionButton: ACTION_BUTTON,\n actionsMenu: ACTIONS_MENU.isRequired,\n applyChanges: PropTypes.func.isRequired,\n applyChangesRef: PropTypes.object.isRequired,\n cancelChanges: PropTypes.func.isRequired,\n commonDetailsStore: PropTypes.object.isRequired,\n getCloseDetailsLink: PropTypes.func,\n getDefaultCloseDetailsLink: PropTypes.func.isRequired,\n handleCancelClick: PropTypes.func.isRequired,\n handleRefresh: PropTypes.func,\n headerRef: PropTypes.object.isRequired,\n isDetailsPopUp: PropTypes.bool,\n isDetailsScreen: PropTypes.bool.isRequired,\n location: PropTypes.object.isRequired,\n navigate: PropTypes.func.isRequired,\n pageData: PropTypes.object.isRequired,\n params: PropTypes.object.isRequired,\n renderCustomElements: PropTypes.func,\n renderStatus: PropTypes.func,\n renderTitle: PropTypes.func.isRequired,\n selectedItem: PropTypes.object.isRequired,\n showAllVersions: PropTypes.func,\n tab: PropTypes.string,\n viewMode: PropTypes.string,\n withActionMenu: PropTypes.bool,\n withToggleViewBtn: PropTypes.bool\n}\n\nexport const useDetailsHeader = ({ handleCancel, handleShowWarning, isDetailsPopUp, pageData }) => {\n const commonDetailsStore = useSelector(store => store.commonDetailsStore)\n const params = useParams()\n const navigate = useNavigate()\n const viewMode = getViewMode(window.location.search)\n const { actionButton, withToggleViewBtn, showAllVersions } = pageData.details\n const headerRef = useRef()\n const location = useLocation()\n\n const handleBackClick = useCallback(() => {\n if (commonDetailsStore.changes.counter > 0) {\n handleShowWarning(true)\n } else if (handleCancel) {\n handleCancel()\n }\n }, [commonDetailsStore.changes.counter, handleCancel, handleShowWarning])\n\n const handleCancelClick = useCallback(() => {\n if (handleCancel && (commonDetailsStore.changes.counter === 0 || isDetailsPopUp)) {\n handleCancel()\n }\n }, [commonDetailsStore.changes.counter, handleCancel, isDetailsPopUp])\n\n return {\n DetailsHeaderContainer,\n actionButton,\n commonDetailsStore,\n handleBackClick,\n handleCancelClick,\n headerRef,\n location,\n navigate,\n params,\n showAllVersions,\n viewMode,\n withToggleViewBtn\n }\n}\n"],"names":["DetailsHeaderContainer","actionButton","actionsMenu","applyChanges","applyChangesRef","cancelChanges","commonDetailsStore","getCloseDetailsLink","getDefaultCloseDetailsLink","handleCancelClick","handleRefresh","headerRef","isDetailsPopUp","isDetailsScreen","location","navigate","pageData","params","renderCustomElements","renderStatus","renderTitle","selectedItem","showAllVersions","tab","viewMode","withActionMenu","withToggleViewBtn","jsxs","jsx","Fragment","Button","TERTIARY_BUTTON","Tooltip","TextTooltipTemplate","LoadButton","RoundedIcon","HistoryIcon","Refresh","ActionsMenu","FULL_VIEW_MODE","VIEW_SEARCH_PARAMETER","EnlargeIcon","getFilteredSearchParams","MinimizeIcon","Close","Link","ACTION_BUTTON","ACTIONS_MENU","PropTypes","useDetailsHeader","handleCancel","handleShowWarning","useSelector","store","useParams","useNavigate","getViewMode","useRef","useLocation","handleBackClick","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,IAAyB,CAAC;AAAA,EAC9B,cAAAC,IAAe;AAAA,EACf,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,4BAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,WAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,cAAAC,IAAe;AAAA,EACf,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,KAAAC,IAAM;AAAA,EACN,UAAA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AAAC;AAAA,IACA,QAAAE;AAAA,IACA,iBAAAK;AAAA,IACA,UAAAE;AAAA,IACA,mBAAAE;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useDetailsHeader.hook.mjs","sources":["../../src/lib/hooks/useDetailsHeader.hook.jsx"],"sourcesContent":["/*\nCopyright 2019 Iguazio Systems Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\") with\nan addition restriction as set forth herein. You may not use this\nfile except in compliance with the License. You may obtain a copy of\nthe License at http://www.apache.org/licenses/LICENSE-2.0.\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n\nIn addition, you may not use the software for any purposes that are\nillegal under applicable law, and the grant of the foregoing license\nunder the Apache 2.0 license is conditioned upon your compliance with\nsuch restriction.\n*/\n\nimport React, { useCallback, useRef } from 'react'\nimport PropTypes from 'prop-types'\nimport { useDispatch, useSelector } from 'react-redux'\nimport { Link, useLocation, useNavigate, useParams } from 'react-router-dom'\n\nimport ActionsMenu from '../components/ActionsMenu/ActionsMenu'\nimport Button from '../components/Button/Button'\nimport LoadButton from '../components/LoadButton/LoadButton'\nimport RoundedIcon from '../components/RoundedIcon/RoundedIcon'\nimport TextTooltipTemplate from '../components/TooltipTemplate/TextTooltipTemplate'\nimport Tooltip from '../components/Tooltip/Tooltip'\n\nimport { ACTION_BUTTON, ACTIONS_MENU } from '../types'\nimport { TERTIARY_BUTTON, VIEW_SEARCH_PARAMETER, FULL_VIEW_MODE } from '../constants'\nimport { getFilteredSearchParams } from '../utils/filter.util'\nimport { getViewMode, performDetailsActionHelper } from '../utils/common.util'\n\nimport Close from '../images/close.svg?react'\nimport EnlargeIcon from '../images/ml-enlarge.svg?react'\nimport HistoryIcon from '../images/history.svg?react'\nimport MinimizeIcon from '../images/ml-minimize.svg?react'\nimport Refresh from '../images/refresh.svg?react'\n\nconst DetailsHeaderContainer = ({\n actionButton = null,\n actionsMenu,\n applyChanges,\n applyChangesRef,\n cancelChanges,\n commonDetailsStore,\n getCloseDetailsLink = null,\n getDefaultCloseDetailsLink,\n handleActionClick,\n handleCancelClick,\n handleRefresh = null,\n headerRef,\n isDetailsPopUp = false,\n isDetailsScreen,\n location,\n navigate,\n pageData,\n params,\n renderCustomElements = null,\n renderStatus = null,\n renderTitle,\n selectedItem,\n showAllVersions = null,\n tab = '',\n viewMode = '',\n withActionMenu = true,\n withToggleViewBtn = false\n}) => {\n return (\n <div className=\"item-header\" ref={headerRef}>\n <div className=\"item-header__data\">\n <h3 className=\"item-header__title\">{renderTitle && renderTitle()}</h3>\n <div className=\"item-header__status\">{renderStatus && renderStatus()}</div>\n </div>\n <div className=\"item-header__custom-elements\">\n {renderCustomElements && renderCustomElements()}\n </div>\n <div className=\"item-header__buttons\">\n {commonDetailsStore.changes.counter > 0 && !isDetailsPopUp && (\n <>\n <Button\n variant={TERTIARY_BUTTON}\n label=\"Cancel\"\n onClick={cancelChanges}\n disabled={commonDetailsStore.changes.counter === 0 || commonDetailsStore.editMode}\n />\n <Tooltip\n template={\n <TextTooltipTemplate\n text={`${commonDetailsStore.changes.counter} ${\n commonDetailsStore.changes.counter === 1 ? 'change pending' : 'changes pending'\n }`}\n />\n }\n >\n <LoadButton\n ref={applyChangesRef}\n variant=\"primary\"\n label=\"Apply Changes\"\n className=\"btn_apply-changes\"\n onClick={applyChanges}\n disabled={commonDetailsStore.changes.counter === 0 || commonDetailsStore.editMode}\n />\n </Tooltip>\n </>\n )}\n {actionButton && !actionButton.hidden && (\n <Button\n disabled={actionButton.disabled}\n label={actionButton.label}\n onClick={event => {\n handleActionClick(event, actionButton.onClick)\n }}\n tooltip={actionButton.tooltip}\n variant={actionButton.variant}\n />\n )}\n {showAllVersions && (\n <RoundedIcon\n id=\"showAllVersions\"\n onClick={() => showAllVersions()}\n tooltipText=\"Show all versions\"\n >\n <HistoryIcon />\n </RoundedIcon>\n )}\n {isDetailsScreen && handleRefresh && (\n <RoundedIcon\n id=\"refresh\"\n onClick={() => handleRefresh(selectedItem)}\n tooltipText=\"Refresh\"\n >\n <Refresh />\n </RoundedIcon>\n )}\n {withActionMenu && <ActionsMenu dataItem={selectedItem} menu={actionsMenu} time={500} />}\n <div className=\"item-header__navigation-buttons\">\n {withToggleViewBtn && !isDetailsPopUp && (\n <>\n {viewMode !== FULL_VIEW_MODE && (\n <RoundedIcon\n onClick={() => {\n navigate(\n `${location.pathname}${window.location.search}${window.location.search ? '&' : '?'}${VIEW_SEARCH_PARAMETER}=full`\n )\n }}\n id=\"full-view\"\n tooltipText=\"Full view\"\n >\n <EnlargeIcon />\n </RoundedIcon>\n )}\n {viewMode === FULL_VIEW_MODE && (\n <RoundedIcon\n onClick={() => {\n navigate(\n `${location.pathname}${getFilteredSearchParams(window.location.search, [VIEW_SEARCH_PARAMETER])}`\n )\n }}\n id=\"table-view\"\n tooltipText=\"Table view\"\n >\n <MinimizeIcon />\n </RoundedIcon>\n )}\n </>\n )}\n {!pageData.details.hideBackBtn &&\n (isDetailsPopUp ? (\n <div\n className=\"details-close-btn\"\n data-testid=\"details-close-btn\"\n onClick={handleCancelClick}\n >\n <RoundedIcon tooltipText=\"Close\" id=\"details-close\">\n <Close />\n </RoundedIcon>\n </div>\n ) : (\n <Link\n className=\"details-close-btn\"\n data-testid=\"details-close-btn\"\n to={\n getCloseDetailsLink\n ? getCloseDetailsLink(selectedItem.name)\n : getDefaultCloseDetailsLink(params, pageData.page, tab)\n }\n onClick={handleCancelClick}\n >\n <RoundedIcon tooltipText=\"Close\" id=\"details-close\">\n <Close />\n </RoundedIcon>\n </Link>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\nDetailsHeaderContainer.propTypes = {\n actionButton: ACTION_BUTTON,\n actionsMenu: ACTIONS_MENU.isRequired,\n applyChanges: PropTypes.func.isRequired,\n applyChangesRef: PropTypes.object.isRequired,\n cancelChanges: PropTypes.func.isRequired,\n commonDetailsStore: PropTypes.object.isRequired,\n getCloseDetailsLink: PropTypes.func,\n getDefaultCloseDetailsLink: PropTypes.func.isRequired,\n handleActionClick: PropTypes.func.isRequired,\n handleCancelClick: PropTypes.func.isRequired,\n handleRefresh: PropTypes.func,\n headerRef: PropTypes.object.isRequired,\n isDetailsPopUp: PropTypes.bool,\n isDetailsScreen: PropTypes.bool.isRequired,\n location: PropTypes.object.isRequired,\n navigate: PropTypes.func.isRequired,\n pageData: PropTypes.object.isRequired,\n params: PropTypes.object.isRequired,\n renderCustomElements: PropTypes.func,\n renderStatus: PropTypes.func,\n renderTitle: PropTypes.func.isRequired,\n selectedItem: PropTypes.object.isRequired,\n showAllVersions: PropTypes.func,\n tab: PropTypes.string,\n viewMode: PropTypes.string,\n withActionMenu: PropTypes.bool,\n withToggleViewBtn: PropTypes.bool\n}\n\nexport const useDetailsHeader = ({ handleCancel, handleShowWarning, isDetailsPopUp, pageData }) => {\n const commonDetailsStore = useSelector(store => store.commonDetailsStore)\n const dispatch = useDispatch()\n const params = useParams()\n const navigate = useNavigate()\n const viewMode = getViewMode(window.location.search)\n const { actionButton, withToggleViewBtn, showAllVersions } = pageData.details\n const headerRef = useRef()\n const location = useLocation()\n\n const handleActionClick = async (event, handler) => {\n const actionCanBePerformed = await performDetailsActionHelper(\n commonDetailsStore.changes,\n dispatch\n )\n\n if (actionCanBePerformed) {\n handler(event)\n }\n }\n\n const handleBackClick = useCallback(() => {\n if (commonDetailsStore.changes.counter > 0) {\n handleShowWarning(true)\n } else if (handleCancel) {\n handleCancel()\n }\n }, [commonDetailsStore.changes.counter, handleCancel, handleShowWarning])\n\n const handleCancelClick = useCallback(() => {\n if (handleCancel && (commonDetailsStore.changes.counter === 0 || isDetailsPopUp)) {\n handleCancel()\n }\n }, [commonDetailsStore.changes.counter, handleCancel, isDetailsPopUp])\n\n return {\n DetailsHeaderContainer,\n actionButton,\n commonDetailsStore,\n handleActionClick,\n handleBackClick,\n handleCancelClick,\n headerRef,\n location,\n navigate,\n params,\n showAllVersions,\n viewMode,\n withToggleViewBtn\n }\n}\n"],"names":["DetailsHeaderContainer","actionButton","actionsMenu","applyChanges","applyChangesRef","cancelChanges","commonDetailsStore","getCloseDetailsLink","getDefaultCloseDetailsLink","handleActionClick","handleCancelClick","handleRefresh","headerRef","isDetailsPopUp","isDetailsScreen","location","navigate","pageData","params","renderCustomElements","renderStatus","renderTitle","selectedItem","showAllVersions","tab","viewMode","withActionMenu","withToggleViewBtn","jsxs","jsx","Fragment","Button","TERTIARY_BUTTON","Tooltip","TextTooltipTemplate","LoadButton","event","RoundedIcon","HistoryIcon","Refresh","ActionsMenu","FULL_VIEW_MODE","VIEW_SEARCH_PARAMETER","EnlargeIcon","getFilteredSearchParams","MinimizeIcon","Close","Link","ACTION_BUTTON","ACTIONS_MENU","PropTypes","useDetailsHeader","handleCancel","handleShowWarning","useSelector","store","dispatch","useDispatch","useParams","useNavigate","getViewMode","useRef","useLocation","handler","performDetailsActionHelper","handleBackClick","useCallback"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,MAAMA,IAAyB,CAAC;AAAA,EAC9B,cAAAC,IAAe;AAAA,EACf,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,eAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,4BAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,WAAAC;AAAA,EACA,gBAAAC,IAAiB;AAAA,EACjB,iBAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,QAAAC;AAAA,EACA,sBAAAC,IAAuB;AAAA,EACvB,cAAAC,IAAe;AAAA,EACf,aAAAC;AAAA,EACA,cAAAC;AAAA,EACA,iBAAAC,IAAkB;AAAA,EAClB,KAAAC,IAAM;AAAA,EACN,UAAAC,IAAW;AAAA,EACX,gBAAAC,IA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MAClDuC,EAAA;AAAA,EACf,GACC,CAAC9C,EAAmB,QAAQ,SAAS8C,GAAcvC,CAAc,CAAC;AAE9D,SAAA;AAAA,IACL,wBAAAb;AAAA,IACA,cAAAC;AAAA,IACA,oBAAAK;AAAA,IACA,mBAAAG;AAAA,IACA,iBAAAwD;AAAA,IACA,mBAAAvD;AAAA,IACA,WAAAE;AAAA,IACA,UAAAG;AAAA,IACA,UAAAC;AAAA,IACA,QAAAE;AAAA,IACA,iBAAAK;AAAA,IACA,UAAAE;AAAA,IACA,mBAAAE;AAAA,EACF;AACF;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iguazio.dashboard-react-controls",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Collection of resources (such as CSS styles, fonts and images) and ReactJS 17.x components to share among different Iguazio React repos.",
5
5
  "module": "./dist/index.mjs",
6
6
  "main": "./dist/index.mjs",