oa-componentbook 1.0.1-stage.460 → 1.0.1-stage.462

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.
@@ -43,6 +43,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
43
43
  */
44
44
  function CustomInfo(_ref) {
45
45
  let {
46
+ className,
46
47
  buttonConfig,
47
48
  color,
48
49
  description,
@@ -90,7 +91,8 @@ function CustomInfo(_ref) {
90
91
  };
91
92
  return /*#__PURE__*/_react.default.createElement(_styles.InfoContainer, {
92
93
  $color: color,
93
- $borderColor: borderColor
94
+ $borderColor: borderColor,
95
+ className: className
94
96
  }, /*#__PURE__*/_react.default.createElement(_styles.RowFlex, null, iconConfig.position === 'left' && conditionallyAddTooltipToIcon(), /*#__PURE__*/_react.default.createElement(_styles.ColFlex, {
95
97
  style: {
96
98
  flex: 1
@@ -263,7 +263,6 @@ function CustomTableV1(_ref2) {
263
263
  case "tag":
264
264
  const tagType = typeof subType === "function" ? subType(_, record) : subType;
265
265
  const tagLabel = label || _;
266
- console.log("tagLabel", tagLabel);
267
266
  return tagLabel ? /*#__PURE__*/_react.default.createElement(_CustomTag.default, {
268
267
  key: index,
269
268
  label: tagLabel,
@@ -175,19 +175,34 @@ function DocumentUpload(_ref) {
175
175
  try {
176
176
  if ((file === null || file === void 0 ? void 0 : file.uid) === (files === null || files === void 0 ? void 0 : files.uid)) {
177
177
  if (generateS3Url) {
178
- var _response, _response2, _response3;
178
+ var _response, _response2, _response3, _response5, _response6, _response7;
179
179
  if (beforeUploadFileValidations && formName && !beforeUpload(file, allowedMediaType, maxAllowedSize)) {
180
180
  setLoading(false);
181
181
  return false;
182
182
  }
183
183
  let response = await generateS3Url(files.name);
184
- response = (_response = response) === null || _response === void 0 ? void 0 : _response.data;
185
- s3ResponseReturn(response);
186
- await uploadOnS3((_response2 = response) === null || _response2 === void 0 || (_response2 = _response2.response) === null || _response2 === void 0 || (_response2 = _response2.data) === null || _response2 === void 0 ? void 0 : _response2.uploadUrl, files);
187
- if (((_response3 = response) === null || _response3 === void 0 || (_response3 = _response3.response) === null || _response3 === void 0 || (_response3 = _response3.status) === null || _response3 === void 0 ? void 0 : _response3.toLowerCase()) == "success") {
184
+ // Handle error case: if response.data is null and response.error exists
185
+ if ((((_response = response) === null || _response === void 0 ? void 0 : _response.data) === null || !((_response2 = response) !== null && _response2 !== void 0 && _response2.data)) && (_response3 = response) !== null && _response3 !== void 0 && _response3.error) {
188
186
  var _response4;
187
+ openNotification({
188
+ description: ((_response4 = response) === null || _response4 === void 0 ? void 0 : _response4.error) || "Failed to generate upload URL. Please try again.",
189
+ type: "failure",
190
+ mode: "dark",
191
+ showIcon: true,
192
+ placement: "bottomRight"
193
+ });
194
+ modifiedFile.status = "failed";
195
+ modifiedFile = null;
196
+ setLoading(false);
197
+ return modifiedFile;
198
+ }
199
+ response = (_response5 = response) === null || _response5 === void 0 ? void 0 : _response5.data;
200
+ s3ResponseReturn(response);
201
+ await uploadOnS3((_response6 = response) === null || _response6 === void 0 || (_response6 = _response6.response) === null || _response6 === void 0 || (_response6 = _response6.data) === null || _response6 === void 0 ? void 0 : _response6.uploadUrl, files);
202
+ if (((_response7 = response) === null || _response7 === void 0 || (_response7 = _response7.response) === null || _response7 === void 0 || (_response7 = _response7.status) === null || _response7 === void 0 ? void 0 : _response7.toLowerCase()) == "success") {
203
+ var _response8;
189
204
  modifiedFile.status = "done";
190
- modifiedFile.s3Uid = (_response4 = response) === null || _response4 === void 0 || (_response4 = _response4.response) === null || _response4 === void 0 || (_response4 = _response4.data) === null || _response4 === void 0 ? void 0 : _response4.uuid;
205
+ modifiedFile.s3Uid = (_response8 = response) === null || _response8 === void 0 || (_response8 = _response8.response) === null || _response8 === void 0 || (_response8 = _response8.data) === null || _response8 === void 0 ? void 0 : _response8.uuid;
191
206
  if (!isImageFile(files === null || files === void 0 ? void 0 : files.name)) {
192
207
  modifiedFile.url = _PdfSampleImage.default;
193
208
  }
@@ -38,6 +38,8 @@ var _downloadFile = _interopRequireDefault(require("../../utils/download-file"))
38
38
  var _AppliedFilters = _interopRequireDefault(require("./components/AppliedFilters"));
39
39
  var _ProfileSection = _interopRequireDefault(require("./components/ProfileSection"));
40
40
  var _FilterListRounded = _interopRequireDefault(require("@material-ui/icons/FilterListRounded"));
41
+ var _MoreVert = _interopRequireDefault(require("@material-ui/icons/MoreVert"));
42
+ var _CustomDropdown = _interopRequireDefault(require("../../components/oa-component-dropdown/CustomDropdown"));
41
43
  var _CustomInfo = _interopRequireDefault(require("../../components/oa-component-info/CustomInfo"));
42
44
  const _excluded = ["filteredValue"],
43
45
  _excluded2 = ["sortOrder"];
@@ -53,7 +55,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
53
55
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
54
56
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable */
55
57
  function GenricLayOut(_ref) {
56
- var _state$misc30, _sidebar$mobileMenuIt, _imageViewer$content, _imageViewer$content2, _infoData$iconConfig, _infoData$iconConfig2, _infoData$iconConfig3, _infoData$iconConfig4, _leftHeaderFirstButto, _leftHeaderFirstButto2, _infoPanel$data, _infoPanel$data2, _infoPanel$data3, _infoPanel$data4, _infoPanel$data5, _state$customDrawer3, _state$customDrawer4, _tabs$list, _ref7, _tabs$extraAction$che2, _tabs$extraAction$pro, _tables$columns3, _tables$columns4, _tabs$active3, _state$tables5, _tables$selectionType, _tabs$active4, _tables$selectionType2, _tables$pagination19, _drawer$data, _tabs$active5, _drawer$data$drawer$a, _drawer$data2, _tabs$active6, _tabs$active7, _nestedDrawer$data, _nestedDrawer$data$ca, _nestedDrawer$data2, _customDrawer$data, _customDrawer$data2, _contentPanel$dataSou, _tables$tableFooter, _tables$selectedRowKe, _tables$tableFooter2, _tables$tableFooter3, _tables$tableFooter5;
58
+ var _state$misc33, _sidebar$mobileMenuIt, _imageViewer$content, _imageViewer$content2, _infoData$iconConfig, _infoData$iconConfig2, _infoData$iconConfig3, _infoData$iconConfig4, _leftHeaderFirstButto, _leftHeaderFirstButto2, _infoPanel$data, _infoPanel$data2, _infoPanel$data3, _infoPanel$data4, _infoPanel$data5, _state$customDrawer3, _state$customDrawer4, _tabs$list, _ref7, _tabs$extraAction$che2, _tabs$extraAction$pro, _tables$columns3, _tables$columns4, _tabs$active3, _state$tables5, _tables$selectionType, _tabs$active4, _tables$selectionType2, _tables$pagination19, _drawer$data, _tabs$active5, _drawer$data$drawer$a, _drawer$data2, _tabs$active6, _tabs$active7, _nestedDrawer$data, _nestedDrawer$data$ca, _nestedDrawer$data2, _customDrawer$data, _customDrawer$data2, _contentPanel$dataSou, _tables$tableFooter, _tables$selectedRowKe, _tables$tableFooter2, _tables$tableFooter3, _tables$tableFooter5;
57
59
  let {
58
60
  config,
59
61
  getInitialData,
@@ -84,6 +86,9 @@ function GenricLayOut(_ref) {
84
86
  handleSwitchSelectItem,
85
87
  handleTableColumnClickParent,
86
88
  handleLeftHeaderFirstButton,
89
+ handleRightHeaderButtonClick,
90
+ handleDownloadTemplate,
91
+ handleCtaDownload,
87
92
  handleTabExtraActionChange
88
93
  } = {}
89
94
  } = _ref;
@@ -999,6 +1004,10 @@ function GenricLayOut(_ref) {
999
1004
  });
1000
1005
  }
1001
1006
  }
1007
+ } else if ((configArgs === null || configArgs === void 0 ? void 0 : configArgs.action) === "CTA_DOWNLOAD") {
1008
+ if (handleCtaDownload) {
1009
+ handleCtaDownload(record);
1010
+ }
1002
1011
  }
1003
1012
  };
1004
1013
 
@@ -1697,10 +1706,27 @@ function GenricLayOut(_ref) {
1697
1706
  });
1698
1707
  }
1699
1708
  }
1709
+ } else if (formData.type === "BULK_CREATION") {
1710
+ if (handleDrawerFormOnFinish) {
1711
+ var _state$misc23;
1712
+ const {
1713
+ error,
1714
+ data
1715
+ } = await (handleDrawerFormOnFinish === null || handleDrawerFormOnFinish === void 0 ? void 0 : handleDrawerFormOnFinish(_objectSpread(_objectSpread({}, formData), (_state$misc23 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc23 !== void 0 ? _state$misc23 : {})));
1716
+ if (error) {
1717
+ showErrorNotification(error);
1718
+ } else {
1719
+ dispatch({
1720
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
1721
+ });
1722
+ showSuccessNotification(data === null || data === void 0 ? void 0 : data.message);
1723
+ init();
1724
+ }
1725
+ }
1700
1726
  }
1701
1727
  };
1702
1728
  const onClearAllAppliedFilters = async () => {
1703
- var _state$dropdownSearch9, _state$inputSearch9, _state$tabs15, _tables$pagination9, _tables$pagination10, _tables$filter10, _tables$sorting23, _header$subHeading27, _header$subHeading28, _staticFilter$data11, _tables$sorting24, _state$misc23, _state$staticFilter$m11, _state$staticFilter11;
1729
+ var _state$dropdownSearch9, _state$inputSearch9, _state$tabs15, _tables$pagination9, _tables$pagination10, _tables$filter10, _tables$sorting23, _header$subHeading27, _header$subHeading28, _staticFilter$data11, _tables$sorting24, _state$misc24, _state$staticFilter$m11, _state$staticFilter11;
1704
1730
  resetTabsExtraActionSwitch();
1705
1731
  const {
1706
1732
  error,
@@ -1724,7 +1750,7 @@ function GenricLayOut(_ref) {
1724
1750
  staticFilter: staticFilter.data.find(item => item.selected).value
1725
1751
  }), {}, {
1726
1752
  order: tables === null || tables === void 0 || (_tables$sorting24 = tables.sorting) === null || _tables$sorting24 === void 0 ? void 0 : _tables$sorting24.sortDirection
1727
- }, (_state$misc23 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc23 !== void 0 ? _state$misc23 : {}), {}, {
1753
+ }, (_state$misc24 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc24 !== void 0 ? _state$misc24 : {}), {}, {
1728
1754
  multiSelectValue: (_state$staticFilter$m11 = state === null || state === void 0 || (_state$staticFilter11 = state.staticFilter) === null || _state$staticFilter11 === void 0 ? void 0 : _state$staticFilter11.multiSelectValue) !== null && _state$staticFilter$m11 !== void 0 ? _state$staticFilter$m11 : []
1729
1755
  }));
1730
1756
  if (error) {
@@ -1783,14 +1809,14 @@ function GenricLayOut(_ref) {
1783
1809
  return;
1784
1810
  } else if (action === "CLOSE_MODAL_AND_FETCH") {
1785
1811
  if (handleModalCloseSuccess) {
1786
- var _stateRef$current, _state$misc24;
1812
+ var _stateRef$current, _state$misc25;
1787
1813
  const {
1788
1814
  error,
1789
1815
  data
1790
1816
  } = await (handleModalCloseSuccess === null || handleModalCloseSuccess === void 0 ? void 0 : handleModalCloseSuccess(_objectSpread({
1791
1817
  modalValue: stateRef === null || stateRef === void 0 || (_stateRef$current = stateRef.current) === null || _stateRef$current === void 0 || (_stateRef$current = _stateRef$current.modal) === null || _stateRef$current === void 0 ? void 0 : _stateRef$current.value,
1792
1818
  call: buttonConfig === null || buttonConfig === void 0 ? void 0 : buttonConfig.call
1793
- }, (_state$misc24 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc24 !== void 0 ? _state$misc24 : {})));
1819
+ }, (_state$misc25 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc25 !== void 0 ? _state$misc25 : {})));
1794
1820
  if (error) {
1795
1821
  showErrorNotification(error);
1796
1822
  } else {
@@ -1804,11 +1830,11 @@ function GenricLayOut(_ref) {
1804
1830
  }
1805
1831
  } else {
1806
1832
  if (handleDrawerFormOnFinish) {
1807
- var _state$tables$selecte, _state$tables4, _state$misc25;
1833
+ var _state$tables$selecte, _state$tables4, _state$misc26;
1808
1834
  let req = {};
1809
1835
  req.type = "APPROVE";
1810
1836
  req.orderUUID = (_state$tables$selecte = state === null || state === void 0 || (_state$tables4 = state.tables) === null || _state$tables4 === void 0 || (_state$tables4 = _state$tables4.selectedRowKeys) === null || _state$tables4 === void 0 ? void 0 : _state$tables4.map(item => item.orderUUID)) !== null && _state$tables$selecte !== void 0 ? _state$tables$selecte : [];
1811
- req.misc = (_state$misc25 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc25 !== void 0 ? _state$misc25 : {};
1837
+ req.misc = (_state$misc26 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc26 !== void 0 ? _state$misc26 : {};
1812
1838
  const {
1813
1839
  error,
1814
1840
  data
@@ -1899,11 +1925,12 @@ function GenricLayOut(_ref) {
1899
1925
  */
1900
1926
  const rightHeaderFirstButtonClick = async () => {
1901
1927
  if ((rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.action) === "OPEN_CUSTOM_DRAWER") {
1902
- var _config$customDrawer4, _state$customDrawer2;
1928
+ var _config$customDrawer4, _state$misc27, _state$customDrawer2;
1903
1929
  const drawerData = config === null || config === void 0 || (_config$customDrawer4 = config.customDrawer) === null || _config$customDrawer4 === void 0 || (_config$customDrawer4 = _config$customDrawer4.data) === null || _config$customDrawer4 === void 0 ? void 0 : _config$customDrawer4[rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.drawerKey];
1930
+ const dynamicConfig = (0, _staticConfigResolver.removeHidden)((0, _staticConfigResolver.default)(drawerData, (_state$misc27 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc27 !== void 0 ? _state$misc27 : {}));
1904
1931
  dispatch({
1905
1932
  type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1906
- payload: drawerData
1933
+ payload: dynamicConfig
1907
1934
  });
1908
1935
  dispatch({
1909
1936
  type: _layoutReducer.actionTypes.CUSTOM_DRAWER_OPEN
@@ -1914,15 +1941,35 @@ function GenricLayOut(_ref) {
1914
1941
  syncFilterFormWithAppliedFilters(state.customDrawer.appliedFilters);
1915
1942
  }
1916
1943
  } else if ((rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.action) === "OPEN_DRAWER") {
1917
- dispatch({
1918
- type: _layoutReducer.actionTypes.TOGGLE_DRAWER,
1919
- payload: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.key
1920
- });
1944
+ // Check if button has a drawerKey for custom drawer, otherwise use key for regular drawer
1945
+ if (rightHeaderFirstButton !== null && rightHeaderFirstButton !== void 0 && rightHeaderFirstButton.drawerKey) {
1946
+ var _config$customDrawer5, _state$misc28;
1947
+ const drawerData = config === null || config === void 0 || (_config$customDrawer5 = config.customDrawer) === null || _config$customDrawer5 === void 0 || (_config$customDrawer5 = _config$customDrawer5.data) === null || _config$customDrawer5 === void 0 ? void 0 : _config$customDrawer5[rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.drawerKey];
1948
+ const {
1949
+ error,
1950
+ data
1951
+ } = await handleRightHeaderButtonClick(_objectSpread({}, (_state$misc28 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc28 !== void 0 ? _state$misc28 : {}));
1952
+ if (drawerData) {
1953
+ const dynamicConfig = (0, _staticConfigResolver.removeHidden)((0, _staticConfigResolver.default)(drawerData, data !== null && data !== void 0 ? data : {}));
1954
+ dispatch({
1955
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
1956
+ payload: dynamicConfig
1957
+ });
1958
+ dispatch({
1959
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_OPEN
1960
+ });
1961
+ }
1962
+ } else {
1963
+ dispatch({
1964
+ type: _layoutReducer.actionTypes.TOGGLE_DRAWER,
1965
+ payload: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.key
1966
+ });
1967
+ }
1921
1968
  }
1922
1969
  };
1923
1970
  const rightHeaderSecondButtonClick = async () => {
1924
1971
  if ((rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.action) === "RESET_CUSTOM_DRAWER") {
1925
- var _state$dropdownSearch10, _state$inputSearch10, _state$tabs16, _tables$pagination11, _tables$pagination12, _tables$filter11, _tables$sorting25, _header$subHeading29, _header$subHeading30, _staticFilter$data12, _tables$sorting26, _state$misc26, _state$staticFilter$m12, _state$staticFilter12;
1972
+ var _state$dropdownSearch10, _state$inputSearch10, _state$tabs16, _tables$pagination11, _tables$pagination12, _tables$filter11, _tables$sorting25, _header$subHeading29, _header$subHeading30, _staticFilter$data12, _tables$sorting26, _state$misc29, _state$staticFilter$m12, _state$staticFilter12;
1926
1973
  resetTabsExtraActionSwitch();
1927
1974
  const {
1928
1975
  error,
@@ -1946,7 +1993,7 @@ function GenricLayOut(_ref) {
1946
1993
  staticFilter: staticFilter.data.find(item => item.selected).value
1947
1994
  }), {}, {
1948
1995
  order: tables === null || tables === void 0 || (_tables$sorting26 = tables.sorting) === null || _tables$sorting26 === void 0 ? void 0 : _tables$sorting26.sortDirection
1949
- }, (_state$misc26 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc26 !== void 0 ? _state$misc26 : {}), {}, {
1996
+ }, (_state$misc29 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc29 !== void 0 ? _state$misc29 : {}), {}, {
1950
1997
  multiSelectValue: (_state$staticFilter$m12 = state === null || state === void 0 || (_state$staticFilter12 = state.staticFilter) === null || _state$staticFilter12 === void 0 ? void 0 : _state$staticFilter12.multiSelectValue) !== null && _state$staticFilter$m12 !== void 0 ? _state$staticFilter$m12 : []
1951
1998
  }));
1952
1999
  if (error) {
@@ -1955,7 +2002,7 @@ function GenricLayOut(_ref) {
1955
2002
  type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
1956
2003
  });
1957
2004
  } else {
1958
- var _config$customDrawer5;
2005
+ var _config$customDrawer6;
1959
2006
  if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
1960
2007
  setStaticFilterData(data);
1961
2008
  }
@@ -1966,7 +2013,7 @@ function GenricLayOut(_ref) {
1966
2013
  dispatch({
1967
2014
  type: _layoutReducer.actionTypes.CLEAR_ALL_APPLIED_FILTERS
1968
2015
  });
1969
- const drawerData = config === null || config === void 0 || (_config$customDrawer5 = config.customDrawer) === null || _config$customDrawer5 === void 0 || (_config$customDrawer5 = _config$customDrawer5.data) === null || _config$customDrawer5 === void 0 ? void 0 : _config$customDrawer5[rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.drawerKey];
2016
+ const drawerData = config === null || config === void 0 || (_config$customDrawer6 = config.customDrawer) === null || _config$customDrawer6 === void 0 || (_config$customDrawer6 = _config$customDrawer6.data) === null || _config$customDrawer6 === void 0 ? void 0 : _config$customDrawer6[rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.drawerKey];
1970
2017
  if (drawerData) {
1971
2018
  dispatch({
1972
2019
  type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
@@ -1977,6 +2024,41 @@ function GenricLayOut(_ref) {
1977
2024
  }
1978
2025
  };
1979
2026
 
2027
+ /**
2028
+ * Handles the menu item click for rightHeaderFirstButton menu
2029
+ * @param {Object} menuItem - The clicked menu item
2030
+ */
2031
+ const handleRightHeaderFirstButtonMenuClick = menuItem => {
2032
+ // Check if menuItem has drawerKey to open a drawer
2033
+ if (menuItem !== null && menuItem !== void 0 && menuItem.drawerKey) {
2034
+ // Check if it's a custom drawer or regular drawer
2035
+ if ((menuItem === null || menuItem === void 0 ? void 0 : menuItem.drawerType) === "custom") {
2036
+ var _config$customDrawer7;
2037
+ const drawerData = config === null || config === void 0 || (_config$customDrawer7 = config.customDrawer) === null || _config$customDrawer7 === void 0 || (_config$customDrawer7 = _config$customDrawer7.data) === null || _config$customDrawer7 === void 0 ? void 0 : _config$customDrawer7[menuItem.drawerKey];
2038
+ if (drawerData) {
2039
+ dispatch({
2040
+ type: _layoutReducer.actionTypes.SET_CUSTOM_DRAWER,
2041
+ payload: drawerData
2042
+ });
2043
+ dispatch({
2044
+ type: _layoutReducer.actionTypes.CUSTOM_DRAWER_OPEN
2045
+ });
2046
+ }
2047
+ } else {
2048
+ // Regular drawer - open using drawer key
2049
+ dispatch({
2050
+ type: _layoutReducer.actionTypes.TOGGLE_DRAWER,
2051
+ payload: menuItem.drawerKey
2052
+ });
2053
+ }
2054
+ }
2055
+
2056
+ // Call custom handler if provided
2057
+ if (rightHeaderFirstButton !== null && rightHeaderFirstButton !== void 0 && rightHeaderFirstButton.onMenuClick) {
2058
+ rightHeaderFirstButton.onMenuClick(menuItem, state);
2059
+ }
2060
+ };
2061
+
1980
2062
  /**
1981
2063
  * @function
1982
2064
  * @param {Object} selectedOption - The selected option from the custom select.
@@ -1999,7 +2081,7 @@ function GenricLayOut(_ref) {
1999
2081
  };
2000
2082
  const handleSubHeadingSelect = async val => {
2001
2083
  if (val) {
2002
- var _state$tabs17, _tables$pagination13, _tables$pagination14, _state$misc27;
2084
+ var _state$tabs17, _tables$pagination13, _tables$pagination14, _state$misc30;
2003
2085
  dispatch({
2004
2086
  type: _layoutReducer.actionTypes.SET_SUBHEADING_SELECTED_CONFIG,
2005
2087
  payload: val
@@ -2013,7 +2095,7 @@ function GenricLayOut(_ref) {
2013
2095
  current: tables === null || tables === void 0 || (_tables$pagination13 = tables.pagination) === null || _tables$pagination13 === void 0 ? void 0 : _tables$pagination13.current,
2014
2096
  pageSize: tables === null || tables === void 0 || (_tables$pagination14 = tables.pagination) === null || _tables$pagination14 === void 0 ? void 0 : _tables$pagination14.pageSize,
2015
2097
  subHeadingSelectVal: val
2016
- }, (_state$misc27 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc27 !== void 0 ? _state$misc27 : {}));
2098
+ }, (_state$misc30 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc30 !== void 0 ? _state$misc30 : {}));
2017
2099
  if (error) {
2018
2100
  showErrorNotification(error);
2019
2101
  dispatch({
@@ -2050,7 +2132,7 @@ function GenricLayOut(_ref) {
2050
2132
 
2051
2133
  // Call the handler if provided
2052
2134
  if (handleTableChange) {
2053
- var _state$dropdownSearch11, _state$inputSearch11, _state$tabs18, _tables$pagination15, _tables$sorting27, _tables$sorting28, _header$subHeading31, _header$subHeading32, _customDrawer$applied10, _state$misc28;
2135
+ var _state$dropdownSearch11, _state$inputSearch11, _state$tabs18, _tables$pagination15, _tables$sorting27, _tables$sorting28, _header$subHeading31, _header$subHeading32, _customDrawer$applied10, _state$misc31;
2054
2136
  dispatch({
2055
2137
  type: _layoutReducer.actionTypes.SET_LOADING,
2056
2138
  payload: true
@@ -2072,7 +2154,7 @@ function GenricLayOut(_ref) {
2072
2154
  order: tables === null || tables === void 0 || (_tables$sorting28 = tables.sorting) === null || _tables$sorting28 === void 0 ? void 0 : _tables$sorting28.sortDirection
2073
2155
  }, (header === null || header === void 0 || (_header$subHeading31 = header.subHeading) === null || _header$subHeading31 === void 0 || (_header$subHeading31 = _header$subHeading31.jsxConfig) === null || _header$subHeading31 === void 0 ? void 0 : _header$subHeading31.type) == "select" ? {
2074
2156
  subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading32 = header.subHeading) === null || _header$subHeading32 === void 0 || (_header$subHeading32 = _header$subHeading32.jsxConfig) === null || _header$subHeading32 === void 0 ? void 0 : _header$subHeading32.value
2075
- } : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied10 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied10 !== void 0 ? _customDrawer$applied10 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc28 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc28 !== void 0 ? _state$misc28 : {}), {}, {
2157
+ } : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied10 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied10 !== void 0 ? _customDrawer$applied10 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc31 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc31 !== void 0 ? _state$misc31 : {}), {}, {
2076
2158
  staticFilter: filterValue,
2077
2159
  // Pass static filter value
2078
2160
  multiSelectValue: multiSelectValue
@@ -2117,7 +2199,7 @@ function GenricLayOut(_ref) {
2117
2199
  }
2118
2200
  });
2119
2201
  if (handleTableChange) {
2120
- var _state$dropdownSearch12, _state$inputSearch12, _state$tabs19, _tables$filter12, _tables$sorting29, _tables$sorting30, _header$subHeading33, _header$subHeading34, _staticFilter$data13, _customDrawer$applied11, _state$misc29, _state$staticFilter$m13, _state$staticFilter13;
2202
+ var _state$dropdownSearch12, _state$inputSearch12, _state$tabs19, _tables$filter12, _tables$sorting29, _tables$sorting30, _header$subHeading33, _header$subHeading34, _staticFilter$data13, _customDrawer$applied11, _state$misc32, _state$staticFilter$m13, _state$staticFilter13;
2121
2203
  const {
2122
2204
  error,
2123
2205
  data
@@ -2137,7 +2219,7 @@ function GenricLayOut(_ref) {
2137
2219
  subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading34 = header.subHeading) === null || _header$subHeading34 === void 0 || (_header$subHeading34 = _header$subHeading34.jsxConfig) === null || _header$subHeading34 === void 0 ? void 0 : _header$subHeading34.value
2138
2220
  } : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data13 = staticFilter.data) === null || _staticFilter$data13 === void 0 || (_staticFilter$data13 = _staticFilter$data13.find(item => item.selected)) === null || _staticFilter$data13 === void 0 ? void 0 : _staticFilter$data13.value) && {
2139
2221
  staticFilter: staticFilter.data.find(item => item.selected).value
2140
- }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied11 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied11 !== void 0 ? _customDrawer$applied11 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc29 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc29 !== void 0 ? _state$misc29 : {}), {}, {
2222
+ }), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied11 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied11 !== void 0 ? _customDrawer$applied11 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc32 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc32 !== void 0 ? _state$misc32 : {}), {}, {
2141
2223
  multiSelectValue: (_state$staticFilter$m13 = state === null || state === void 0 || (_state$staticFilter13 = state.staticFilter) === null || _state$staticFilter13 === void 0 ? void 0 : _state$staticFilter13.multiSelectValue) !== null && _state$staticFilter$m13 !== void 0 ? _state$staticFilter$m13 : []
2142
2224
  }));
2143
2225
  if (error) {
@@ -2168,7 +2250,7 @@ function GenricLayOut(_ref) {
2168
2250
  console.log(state, "GenricLayOutstate");
2169
2251
  return /*#__PURE__*/_react.default.createElement(_styles.OapageWithDataStyle, {
2170
2252
  marginBottom: infoPanel !== null && infoPanel !== void 0 && infoPanel.bottomMarginRequired ? "18px" : "0",
2171
- className: (state === null || state === void 0 || (_state$misc30 = state.misc) === null || _state$misc30 === void 0 ? void 0 : _state$misc30.flow) === "hubAutomation" ? "hubAutomationContainer" : ""
2253
+ className: (state === null || state === void 0 || (_state$misc33 = state.misc) === null || _state$misc33 === void 0 ? void 0 : _state$misc33.flow) === "hubAutomation" ? "hubAutomationContainer" : ""
2172
2254
  }, /*#__PURE__*/_react.default.createElement(_styles.DrawerWithOutFooter, null), /*#__PURE__*/_react.default.createElement("div", {
2173
2255
  className: "fullPageLayout"
2174
2256
  }, /*#__PURE__*/_react.default.createElement(_GlobalCss.default, null, (sidebar === null || sidebar === void 0 ? void 0 : sidebar.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
@@ -2227,6 +2309,7 @@ function GenricLayOut(_ref) {
2227
2309
  }, /*#__PURE__*/_react.default.createElement(_CustomInfo.default, {
2228
2310
  closable: infoData === null || infoData === void 0 ? void 0 : infoData.closable,
2229
2311
  description: infoData === null || infoData === void 0 ? void 0 : infoData.description,
2312
+ className: infoData === null || infoData === void 0 ? void 0 : infoData.className,
2230
2313
  iconConfig: {
2231
2314
  icon: /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
2232
2315
  color: (infoData === null || infoData === void 0 || (_infoData$iconConfig = infoData.iconConfig) === null || _infoData$iconConfig === void 0 ? void 0 : _infoData$iconConfig.color) || "primary-content",
@@ -2282,7 +2365,13 @@ function GenricLayOut(_ref) {
2282
2365
  onClick: rightHeaderSecondButtonClick,
2283
2366
  type: rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.type,
2284
2367
  size: rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.size
2285
- }), (rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.visible) && /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
2368
+ }), (rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.visible) && /*#__PURE__*/_react.default.createElement("div", {
2369
+ style: {
2370
+ display: "flex",
2371
+ alignItems: "center",
2372
+ gap: "8px"
2373
+ }
2374
+ }, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
2286
2375
  label: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.label,
2287
2376
  onClick: rightHeaderFirstButtonClick,
2288
2377
  type: rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.type,
@@ -2295,7 +2384,25 @@ function GenricLayOut(_ref) {
2295
2384
  }),
2296
2385
  position: "left"
2297
2386
  })
2298
- }), !isFiltersEmpty(customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && /*#__PURE__*/_react.default.createElement("span", {
2387
+ }), (rightHeaderFirstButton === null || rightHeaderFirstButton === void 0 ? void 0 : rightHeaderFirstButton.menuItems) && Array.isArray(rightHeaderFirstButton.menuItems) && rightHeaderFirstButton.menuItems.length > 0 && /*#__PURE__*/_react.default.createElement(_CustomDropdown.default, {
2388
+ items: rightHeaderFirstButton.menuItems,
2389
+ onMenuItemClick: handleRightHeaderFirstButtonMenuClick,
2390
+ trigger: ["click"],
2391
+ placement: "bottomRight",
2392
+ type: "default"
2393
+ }, /*#__PURE__*/_react.default.createElement("div", {
2394
+ style: {
2395
+ cursor: "pointer",
2396
+ display: "flex",
2397
+ alignItems: "center",
2398
+ padding: "4px",
2399
+ marginTop: "14px"
2400
+ }
2401
+ }, /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, {
2402
+ icon: _MoreVert.default,
2403
+ size: 24,
2404
+ color: "secondary-content"
2405
+ }))), !isFiltersEmpty(customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && /*#__PURE__*/_react.default.createElement("span", {
2299
2406
  className: "notifyDot"
2300
2407
  })))))), (inputSearch === null || inputSearch === void 0 ? void 0 : inputSearch.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2301
2408
  loading: state === null || state === void 0 ? void 0 : state.isLoading,
@@ -2371,7 +2478,7 @@ function GenricLayOut(_ref) {
2371
2478
  }
2372
2479
  // Call handleTabExtraActionChange
2373
2480
  if (handleTabExtraActionChange) {
2374
- var _tables$pagination17, _tables$pagination18, _tables$sorting31, _tables$sorting32, _tables$filter13, _staticFilter$data14, _state$misc31;
2481
+ var _tables$pagination17, _tables$pagination18, _tables$sorting31, _tables$sorting32, _tables$filter13, _staticFilter$data14, _state$misc34;
2375
2482
  dispatch({
2376
2483
  type: _layoutReducer.actionTypes.SET_LOADING,
2377
2484
  payload: true
@@ -2390,7 +2497,7 @@ function GenricLayOut(_ref) {
2390
2497
  columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
2391
2498
  }), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data14 = staticFilter.data) === null || _staticFilter$data14 === void 0 || (_staticFilter$data14 = _staticFilter$data14.find(item => item.selected)) === null || _staticFilter$data14 === void 0 ? void 0 : _staticFilter$data14.value) && {
2392
2499
  staticFilter: staticFilter.data.find(item => item.selected).value
2393
- }), (_state$misc31 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc31 !== void 0 ? _state$misc31 : {}));
2500
+ }), (_state$misc34 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc34 !== void 0 ? _state$misc34 : {}));
2394
2501
  if (error) {
2395
2502
  showErrorNotification(error);
2396
2503
  dispatch({
@@ -2496,7 +2603,11 @@ function GenricLayOut(_ref) {
2496
2603
  destroyOnClose: true,
2497
2604
  zIndex: 1000
2498
2605
  }, /*#__PURE__*/_react.default.createElement(_DetailDataLayout.default, _extends({}, (_nestedDrawer$data$ca = nestedDrawer === null || nestedDrawer === void 0 || (_nestedDrawer$data2 = nestedDrawer.data) === null || _nestedDrawer$data2 === void 0 ? void 0 : _nestedDrawer$data2.cancelOrder) !== null && _nestedDrawer$data$ca !== void 0 ? _nestedDrawer$data$ca : {}, {
2499
- handleDrawerFormOnFinish: drawerFormOnFinish
2606
+ handleDrawerFormOnFinish: drawerFormOnFinish,
2607
+ generateS3Url: generateS3Url,
2608
+ downloadFileOnS3: downloadFileOnS3,
2609
+ uploadOnS3: uploadOnS3,
2610
+ handleCollapsibleKeyData: handleCollapsibleKeyData
2500
2611
  }))), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.visible) && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
2501
2612
  className: "oaDrawer",
2502
2613
  title: customDrawer === null || customDrawer === void 0 || (_customDrawer$data = customDrawer.data) === null || _customDrawer$data === void 0 ? void 0 : _customDrawer$data.title,
@@ -2507,7 +2618,12 @@ function GenricLayOut(_ref) {
2507
2618
  destroyOnClose: true,
2508
2619
  zIndex: 1000
2509
2620
  }, /*#__PURE__*/_react.default.createElement(_DetailDataLayout.default, _extends({}, (_customDrawer$data2 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.data) !== null && _customDrawer$data2 !== void 0 ? _customDrawer$data2 : {}, {
2510
- handleDrawerFormOnFinish: filterFormOnFinish
2621
+ handleDrawerFormOnFinish: filterFormOnFinish,
2622
+ generateS3Url: generateS3Url,
2623
+ downloadFileOnS3: downloadFileOnS3,
2624
+ uploadOnS3: uploadOnS3,
2625
+ handleCollapsibleKeyData: handleCollapsibleKeyData,
2626
+ handleDownloadTemplate: handleDownloadTemplate
2511
2627
  }))), (contentPanel === null || contentPanel === void 0 ? void 0 : contentPanel.visible) && Array.isArray(contentPanel === null || contentPanel === void 0 ? void 0 : contentPanel.dataSource) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
2512
2628
  loading: state === null || state === void 0 ? void 0 : state.isLoading,
2513
2629
  active: true,
@@ -56,7 +56,8 @@ function FormWidget(props) {
56
56
  downloadFileOnS3,
57
57
  generateS3Url,
58
58
  uploadOnS3,
59
- handleCollapsibleKeyData
59
+ handleCollapsibleKeyData,
60
+ handleDownloadTemplate
60
61
  } = props;
61
62
  const {
62
63
  cancel,
@@ -420,7 +421,9 @@ function FormWidget(props) {
420
421
  label: item === null || item === void 0 ? void 0 : item.label,
421
422
  disabled: (_item$disabled5 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled5 !== void 0 ? _item$disabled5 : false,
422
423
  onClick: () => {
423
- if (item !== null && item !== void 0 && item.onClick) {
424
+ if ((item === null || item === void 0 ? void 0 : item.action) === "DOWNLOAD_TEMPLATE" && handleDownloadTemplate) {
425
+ handleDownloadTemplate(_objectSpread({}, (item === null || item === void 0 ? void 0 : item.params) || {}));
426
+ } else if (item !== null && item !== void 0 && item.onClick) {
424
427
  item.onClick(item === null || item === void 0 ? void 0 : item.action, item === null || item === void 0 ? void 0 : item.key);
425
428
  }
426
429
  }
@@ -171,11 +171,7 @@ function _default(_ref) {
171
171
  }
172
172
  }
173
173
  } else if (addingUser) {
174
- // Add new user
175
174
  if (addUserClick) {
176
- console.log("userData", userData);
177
- console.log("misc", misc);
178
- console.log("branchId", branchId);
179
175
  const {
180
176
  error,
181
177
  data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oa-componentbook",
3
- "version": "1.0.1-stage.460",
3
+ "version": "1.0.1-stage.462",
4
4
  "private": false,
5
5
  "description": "Reusable components",
6
6
  "main": "build/index.js",