oa-componentbook 0.18.359 → 0.18.361
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.
|
@@ -51,7 +51,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
51
51
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
52
52
|
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 */
|
|
53
53
|
function GenricLayOut(_ref) {
|
|
54
|
-
var
|
|
54
|
+
var _state$misc19, _imageViewer$content, _imageViewer$content2, _leftHeaderFirstButto, _leftHeaderFirstButto2, _state$customDrawer3, _state$customDrawer4, _tabs$list, _tables$columns3, _tables$columns4, _tabs$active3, _state$tables3, _tables$selectionType, _tabs$active4, _tables$selectionType2, _tables$pagination31, _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;
|
|
55
55
|
let {
|
|
56
56
|
config,
|
|
57
57
|
getInitialData,
|
|
@@ -80,6 +80,7 @@ function GenricLayOut(_ref) {
|
|
|
80
80
|
} = {}
|
|
81
81
|
} = _ref;
|
|
82
82
|
const [state, dispatch] = (0, _react.useReducer)(_layoutReducer.genericLayoutReducer, config !== null && config !== void 0 ? config : _layoutReducer.initialState);
|
|
83
|
+
const [headerButtons, setHeaderButtons] = (0, _react.useState)(null);
|
|
83
84
|
const stateRef = (0, _react.useRef)(state);
|
|
84
85
|
const notificationRef = (0, _react.useRef)(null);
|
|
85
86
|
const openNotification = (0, _react.useCallback)(params => notificationRef.current.openNotification(params), []);
|
|
@@ -108,10 +109,25 @@ function GenricLayOut(_ref) {
|
|
|
108
109
|
(0, _react.useEffect)(() => {
|
|
109
110
|
stateRef.current = state;
|
|
110
111
|
}, [state]);
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
(0, _react.useEffect)(() => {
|
|
113
|
+
const observer = new MutationObserver(e => {
|
|
114
|
+
const parent = document.querySelector(".oaheaderButtons");
|
|
115
|
+
if (parent) {
|
|
116
|
+
var _parent$children;
|
|
117
|
+
setHeaderButtons(parent);
|
|
118
|
+
if ((parent === null || parent === void 0 || (_parent$children = parent.children) === null || _parent$children === void 0 ? void 0 : _parent$children.length) === 1) {
|
|
119
|
+
parent.classList.add("single-child");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
observer.observe(document.body, {
|
|
124
|
+
childList: true,
|
|
125
|
+
subtree: true
|
|
126
|
+
});
|
|
127
|
+
return () => {
|
|
128
|
+
observer.disconnect();
|
|
129
|
+
};
|
|
130
|
+
}, [headerButtons]);
|
|
115
131
|
|
|
116
132
|
/**
|
|
117
133
|
* Initializes the layout by fetching initial data and updating the state.
|
|
@@ -238,11 +254,7 @@ function GenricLayOut(_ref) {
|
|
|
238
254
|
data
|
|
239
255
|
} = await handleInputSearchChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, state === null || state === void 0 || (_state$inputSearch = state.inputSearch) === null || _state$inputSearch === void 0 ? void 0 : _state$inputSearch.request), state !== null && state !== void 0 && (_state$tabs2 = state.tabs) !== null && _state$tabs2 !== void 0 && _state$tabs2.active ? {
|
|
240
256
|
selectedTab: state.tabs.active
|
|
241
|
-
} : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied !== void 0 ? _customDrawer$applied : {}).length > 0 && {
|
|
242
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
243
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
244
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
245
|
-
}), {}, {
|
|
257
|
+
} : {}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied !== void 0 ? _customDrawer$applied : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), {}, {
|
|
246
258
|
current: tables === null || tables === void 0 || (_tables$pagination = tables.pagination) === null || _tables$pagination === void 0 ? void 0 : _tables$pagination.current,
|
|
247
259
|
pageSize: tables === null || tables === void 0 || (_tables$pagination2 = tables.pagination) === null || _tables$pagination2 === void 0 ? void 0 : _tables$pagination2.pageSize,
|
|
248
260
|
field: tables === null || tables === void 0 || (_tables$sorting = tables.sorting) === null || _tables$sorting === void 0 ? void 0 : _tables$sorting.sortBy,
|
|
@@ -314,11 +326,7 @@ function GenricLayOut(_ref) {
|
|
|
314
326
|
pageSize: tables === null || tables === void 0 || (_tables$pagination4 = tables.pagination) === null || _tables$pagination4 === void 0 ? void 0 : _tables$pagination4.pageSize,
|
|
315
327
|
field: tables === null || tables === void 0 || (_tables$sorting3 = tables.sorting) === null || _tables$sorting3 === void 0 ? void 0 : _tables$sorting3.sortBy,
|
|
316
328
|
order: tables === null || tables === void 0 || (_tables$sorting4 = tables.sorting) === null || _tables$sorting4 === void 0 ? void 0 : _tables$sorting4.sortDirection
|
|
317
|
-
}, (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied2 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied2 !== void 0 ? _customDrawer$applied2 : {}).length > 0 && {
|
|
318
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
319
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
320
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
321
|
-
}), inputSearch !== null && inputSearch !== void 0 && inputSearch.queryField ? {
|
|
329
|
+
}, (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied2 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied2 !== void 0 ? _customDrawer$applied2 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), inputSearch !== null && inputSearch !== void 0 && inputSearch.queryField ? {
|
|
322
330
|
queryField: inputSearch.queryField
|
|
323
331
|
} : {}), (header === null || header === void 0 || (_header$subHeading3 = header.subHeading) === null || _header$subHeading3 === void 0 || (_header$subHeading3 = _header$subHeading3.jsxConfig) === null || _header$subHeading3 === void 0 ? void 0 : _header$subHeading3.type) == "select" ? {
|
|
324
332
|
subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading4 = header.subHeading) === null || _header$subHeading4 === void 0 || (_header$subHeading4 = _header$subHeading4.jsxConfig) === null || _header$subHeading4 === void 0 ? void 0 : _header$subHeading4.value
|
|
@@ -383,11 +391,7 @@ function GenricLayOut(_ref) {
|
|
|
383
391
|
columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
|
|
384
392
|
}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data = staticFilter.data) === null || _staticFilter$data === void 0 || (_staticFilter$data = _staticFilter$data.find(item => item.selected)) === null || _staticFilter$data === void 0 ? void 0 : _staticFilter$data.value) && {
|
|
385
393
|
staticFilter: staticFilter.data.find(item => item.selected).value
|
|
386
|
-
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied3 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied3 !== void 0 ? _customDrawer$applied3 : {}).length > 0 && {
|
|
387
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
388
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
389
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
390
|
-
}), (_state$misc2 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc2 !== void 0 ? _state$misc2 : {}));
|
|
394
|
+
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied3 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied3 !== void 0 ? _customDrawer$applied3 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc2 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc2 !== void 0 ? _state$misc2 : {}));
|
|
391
395
|
if (error) {
|
|
392
396
|
showErrorNotification(error);
|
|
393
397
|
dispatch({
|
|
@@ -465,11 +469,7 @@ function GenricLayOut(_ref) {
|
|
|
465
469
|
columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
|
|
466
470
|
}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data2 = staticFilter.data) === null || _staticFilter$data2 === void 0 || (_staticFilter$data2 = _staticFilter$data2.find(item => item.selected)) === null || _staticFilter$data2 === void 0 ? void 0 : _staticFilter$data2.value) && {
|
|
467
471
|
staticFilter: staticFilter.data.find(item => item.selected).value
|
|
468
|
-
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied4 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied4 !== void 0 ? _customDrawer$applied4 : {}).length > 0 && {
|
|
469
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
470
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
471
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
472
|
-
}), (_state$misc3 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc3 !== void 0 ? _state$misc3 : {}));
|
|
472
|
+
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied4 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied4 !== void 0 ? _customDrawer$applied4 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc3 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc3 !== void 0 ? _state$misc3 : {}));
|
|
473
473
|
if (error) {
|
|
474
474
|
showErrorNotification(error);
|
|
475
475
|
dispatch({
|
|
@@ -519,11 +519,7 @@ function GenricLayOut(_ref) {
|
|
|
519
519
|
pageSize: tables === null || tables === void 0 || (_tables$pagination10 = tables.pagination) === null || _tables$pagination10 === void 0 ? void 0 : _tables$pagination10.pageSize
|
|
520
520
|
}, (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data3 = staticFilter.data) === null || _staticFilter$data3 === void 0 || (_staticFilter$data3 = _staticFilter$data3.find(item => item.selected)) === null || _staticFilter$data3 === void 0 ? void 0 : _staticFilter$data3.value) && {
|
|
521
521
|
staticFilter: staticFilter.data.find(item => item.selected).value
|
|
522
|
-
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied5 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied5 !== void 0 ? _customDrawer$applied5 : {}).length > 0 && {
|
|
523
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
524
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
525
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
526
|
-
}), (_state$misc4 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc4 !== void 0 ? _state$misc4 : {}));
|
|
522
|
+
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied5 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied5 !== void 0 ? _customDrawer$applied5 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc4 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc4 !== void 0 ? _state$misc4 : {}));
|
|
527
523
|
if (error) {
|
|
528
524
|
showErrorNotification(error);
|
|
529
525
|
dispatch({
|
|
@@ -629,11 +625,7 @@ function GenricLayOut(_ref) {
|
|
|
629
625
|
columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
|
|
630
626
|
}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data4 = staticFilter.data) === null || _staticFilter$data4 === void 0 || (_staticFilter$data4 = _staticFilter$data4.find(item => item.selected)) === null || _staticFilter$data4 === void 0 ? void 0 : _staticFilter$data4.value) && {
|
|
631
627
|
staticFilter: staticFilter.data.find(item => item.selected).value
|
|
632
|
-
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied6 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied6 !== void 0 ? _customDrawer$applied6 : {}).length > 0 && {
|
|
633
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
634
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
635
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
636
|
-
}), (_state$misc5 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc5 !== void 0 ? _state$misc5 : {}));
|
|
628
|
+
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied6 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied6 !== void 0 ? _customDrawer$applied6 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (_state$misc5 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc5 !== void 0 ? _state$misc5 : {}));
|
|
637
629
|
if (error) {
|
|
638
630
|
showErrorNotification(error);
|
|
639
631
|
dispatch({
|
|
@@ -682,11 +674,7 @@ function GenricLayOut(_ref) {
|
|
|
682
674
|
pageSize: tables === null || tables === void 0 || (_tables$pagination14 = tables.pagination) === null || _tables$pagination14 === void 0 ? void 0 : _tables$pagination14.pageSize,
|
|
683
675
|
field: tables === null || tables === void 0 || (_tables$sorting11 = tables.sorting) === null || _tables$sorting11 === void 0 ? void 0 : _tables$sorting11.sortBy,
|
|
684
676
|
order: tables === null || tables === void 0 || (_tables$sorting12 = tables.sorting) === null || _tables$sorting12 === void 0 ? void 0 : _tables$sorting12.sortDirection
|
|
685
|
-
}, (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied7 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied7 !== void 0 ? _customDrawer$applied7 : {}).length > 0 && {
|
|
686
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
687
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
688
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
689
|
-
}), (header === null || header === void 0 || (_header$subHeading5 = header.subHeading) === null || _header$subHeading5 === void 0 || (_header$subHeading5 = _header$subHeading5.jsxConfig) === null || _header$subHeading5 === void 0 ? void 0 : _header$subHeading5.type) == "select" ? {
|
|
677
|
+
}, (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied7 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied7 !== void 0 ? _customDrawer$applied7 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), (header === null || header === void 0 || (_header$subHeading5 = header.subHeading) === null || _header$subHeading5 === void 0 || (_header$subHeading5 = _header$subHeading5.jsxConfig) === null || _header$subHeading5 === void 0 ? void 0 : _header$subHeading5.type) == "select" ? {
|
|
690
678
|
subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading6 = header.subHeading) === null || _header$subHeading6 === void 0 || (_header$subHeading6 = _header$subHeading6.jsxConfig) === null || _header$subHeading6 === void 0 ? void 0 : _header$subHeading6.value
|
|
691
679
|
} : {}));
|
|
692
680
|
if (error) {
|
|
@@ -874,9 +862,9 @@ function GenricLayOut(_ref) {
|
|
|
874
862
|
* If an error occurs during any action, an error notification is shown.
|
|
875
863
|
*/
|
|
876
864
|
const customTableSelectFooterClick = async configData => {
|
|
877
|
-
var _state$modal;
|
|
878
|
-
const modalContent = state === null || state === void 0 || (_state$modal = state.modal) === null || _state$modal === void 0 ? void 0 : _state$modal.modalContent;
|
|
879
865
|
if ((configData === null || configData === void 0 ? void 0 : configData.action) === "OPEN_MODAL") {
|
|
866
|
+
var _state$modal;
|
|
867
|
+
const modalContent = state === null || state === void 0 || (_state$modal = state.modal) === null || _state$modal === void 0 ? void 0 : _state$modal.modalContent;
|
|
880
868
|
if (handleModalDataSet) {
|
|
881
869
|
const {
|
|
882
870
|
error,
|
|
@@ -898,6 +886,29 @@ function GenricLayOut(_ref) {
|
|
|
898
886
|
});
|
|
899
887
|
}
|
|
900
888
|
}
|
|
889
|
+
} else if ((configData === null || configData === void 0 ? void 0 : configData.action) === "CALL_API") {
|
|
890
|
+
if (handleTableFooterApi) {
|
|
891
|
+
var _handleTableFooterApi;
|
|
892
|
+
const {
|
|
893
|
+
error,
|
|
894
|
+
data
|
|
895
|
+
} = await ((_handleTableFooterApi = handleTableFooterApi) === null || _handleTableFooterApi === void 0 ? void 0 : _handleTableFooterApi(state));
|
|
896
|
+
if (error) {
|
|
897
|
+
showErrorNotification(error);
|
|
898
|
+
} else {
|
|
899
|
+
const updatedModalContent = (0, _staticConfigResolver.default)(config === null || config === void 0 ? void 0 : config.modal, data);
|
|
900
|
+
dispatch({
|
|
901
|
+
type: _layoutReducer.actionTypes.SET_MODAL,
|
|
902
|
+
payload: {
|
|
903
|
+
modalData: updatedModalContent
|
|
904
|
+
}
|
|
905
|
+
});
|
|
906
|
+
dispatch({
|
|
907
|
+
type: _layoutReducer.actionTypes.TOGGLE_MODAL,
|
|
908
|
+
payload: true
|
|
909
|
+
});
|
|
910
|
+
}
|
|
911
|
+
}
|
|
901
912
|
}
|
|
902
913
|
};
|
|
903
914
|
|
|
@@ -1011,11 +1022,7 @@ function GenricLayOut(_ref) {
|
|
|
1011
1022
|
subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading8 = header.subHeading) === null || _header$subHeading8 === void 0 || (_header$subHeading8 = _header$subHeading8.jsxConfig) === null || _header$subHeading8 === void 0 ? void 0 : _header$subHeading8.value
|
|
1012
1023
|
} : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data5 = staticFilter.data) === null || _staticFilter$data5 === void 0 || (_staticFilter$data5 = _staticFilter$data5.find(item => item.selected)) === null || _staticFilter$data5 === void 0 ? void 0 : _staticFilter$data5.value) && {
|
|
1013
1024
|
staticFilter: staticFilter.data.find(item => item.selected).value
|
|
1014
|
-
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied8 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied8 !== void 0 ? _customDrawer$applied8 : {}).length > 0 && {
|
|
1015
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
1016
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
1017
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
1018
|
-
}), {}, {
|
|
1025
|
+
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied8 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied8 !== void 0 ? _customDrawer$applied8 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)), {}, {
|
|
1019
1026
|
order: (sorter === null || sorter === void 0 ? void 0 : sorter.order) === "ascend" && "ASC" || (sorter === null || sorter === void 0 ? void 0 : sorter.order) === "descend" && "DESC" || ""
|
|
1020
1027
|
}, (_state$misc7 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc7 !== void 0 ? _state$misc7 : {}));
|
|
1021
1028
|
if (error) {
|
|
@@ -1118,11 +1125,7 @@ function GenricLayOut(_ref) {
|
|
|
1118
1125
|
}, (state === null || state === void 0 || (_state$dropdownSearch4 = state.dropdownSearch) === null || _state$dropdownSearch4 === void 0 || (_state$dropdownSearch4 = _state$dropdownSearch4.value) === null || _state$dropdownSearch4 === void 0 ? void 0 : _state$dropdownSearch4.trim()) && {
|
|
1119
1126
|
searchedValue: state.dropdownSearch.value,
|
|
1120
1127
|
selectedOption: state.dropdownSearch.selectedOption
|
|
1121
|
-
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied9 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied9 !== void 0 ? _customDrawer$applied9 : {}).length > 0 && {
|
|
1122
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
1123
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
1124
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
1125
|
-
}));
|
|
1128
|
+
}), (customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && Object.keys((_customDrawer$applied9 = customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) !== null && _customDrawer$applied9 !== void 0 ? _customDrawer$applied9 : {}).length > 0 && _objectSpread({}, customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)));
|
|
1126
1129
|
if (error) {
|
|
1127
1130
|
showErrorNotification(error);
|
|
1128
1131
|
dispatch({
|
|
@@ -1303,6 +1306,12 @@ function GenricLayOut(_ref) {
|
|
|
1303
1306
|
// Check if this is a cancel/clear action - check both buttonClickType and the actual button data
|
|
1304
1307
|
if (formData.type === "FILTER-CANCEL") {
|
|
1305
1308
|
var _state$dropdownSearch6, _state$inputSearch6, _state$tabs13, _tables$pagination19, _tables$pagination20, _tables$filter7, _tables$sorting17, _header$subHeading11, _header$subHeading12, _staticFilter$data7, _tables$sorting18, _state$misc10;
|
|
1309
|
+
if (isFiltersEmpty(customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters)) {
|
|
1310
|
+
dispatch({
|
|
1311
|
+
type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
|
|
1312
|
+
});
|
|
1313
|
+
return;
|
|
1314
|
+
}
|
|
1306
1315
|
const {
|
|
1307
1316
|
error,
|
|
1308
1317
|
data
|
|
@@ -1372,8 +1381,8 @@ function GenricLayOut(_ref) {
|
|
|
1372
1381
|
}
|
|
1373
1382
|
|
|
1374
1383
|
// Only process filter data if this is actually a filter drawer
|
|
1375
|
-
if (formData.
|
|
1376
|
-
var _state$dropdownSearch7, _state$inputSearch7, _ref4, _appliedFilters$filte, _state$tabs14,
|
|
1384
|
+
if (formData.type === "FILTER-SUBMIT") {
|
|
1385
|
+
var _state$dropdownSearch7, _state$inputSearch7, _ref4, _appliedFilters$filte, _state$tabs14, _config$tables, _config$tables2, _tables$filter8, _tables$sorting19, _header$subHeading13, _header$subHeading14, _staticFilter$data8, _tables$sorting20, _state$misc11;
|
|
1377
1386
|
const appliedFilters = {};
|
|
1378
1387
|
Object.keys(formData).forEach(key => {
|
|
1379
1388
|
const value = formData[key];
|
|
@@ -1381,21 +1390,27 @@ function GenricLayOut(_ref) {
|
|
|
1381
1390
|
appliedFilters[key] = value;
|
|
1382
1391
|
}
|
|
1383
1392
|
});
|
|
1393
|
+
if (isFiltersEmpty(appliedFilters)) {
|
|
1394
|
+
dispatch({
|
|
1395
|
+
type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
|
|
1396
|
+
});
|
|
1397
|
+
return;
|
|
1398
|
+
}
|
|
1384
1399
|
const {
|
|
1385
1400
|
error,
|
|
1386
1401
|
data
|
|
1387
|
-
} = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch7 = state.dropdownSearch) === null || _state$dropdownSearch7 === void 0 || (_state$dropdownSearch7 = _state$dropdownSearch7.value) === null || _state$dropdownSearch7 === void 0 ? void 0 : _state$dropdownSearch7.trim()) && {
|
|
1402
|
+
} = await handleTableChange(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, (state === null || state === void 0 || (_state$dropdownSearch7 = state.dropdownSearch) === null || _state$dropdownSearch7 === void 0 || (_state$dropdownSearch7 = _state$dropdownSearch7.value) === null || _state$dropdownSearch7 === void 0 ? void 0 : _state$dropdownSearch7.trim()) && {
|
|
1388
1403
|
searchedValue: state.dropdownSearch.value,
|
|
1389
1404
|
selectedOption: state.dropdownSearch.selectedOption
|
|
1390
1405
|
}), (state === null || state === void 0 || (_state$inputSearch7 = state.inputSearch) === null || _state$inputSearch7 === void 0 || (_state$inputSearch7 = _state$inputSearch7.value) === null || _state$inputSearch7 === void 0 ? void 0 : _state$inputSearch7.trim()) && {
|
|
1391
1406
|
searchedValue: state.inputSearch.value
|
|
1392
|
-
}), {}, {
|
|
1407
|
+
}), appliedFilters), {}, {
|
|
1393
1408
|
filterOn: (_ref4 = (_appliedFilters$filte = appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.filterBy) !== null && _appliedFilters$filte !== void 0 ? _appliedFilters$filte : customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.defaultAppliedFilter) !== null && _ref4 !== void 0 ? _ref4 : "",
|
|
1394
1409
|
fromDate: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.fromDate,
|
|
1395
1410
|
toDate: appliedFilters === null || appliedFilters === void 0 ? void 0 : appliedFilters.toDate,
|
|
1396
1411
|
selectedTab: state === null || state === void 0 || (_state$tabs14 = state.tabs) === null || _state$tabs14 === void 0 ? void 0 : _state$tabs14.active,
|
|
1397
|
-
current: tables === null || tables === void 0 || (
|
|
1398
|
-
pageSize:
|
|
1412
|
+
current: config === null || config === void 0 || (_config$tables = config.tables) === null || _config$tables === void 0 || (_config$tables = _config$tables.pagination) === null || _config$tables === void 0 ? void 0 : _config$tables.current,
|
|
1413
|
+
pageSize: config === null || config === void 0 || (_config$tables2 = config.tables) === null || _config$tables2 === void 0 || (_config$tables2 = _config$tables2.pagination) === null || _config$tables2 === void 0 ? void 0 : _config$tables2.pageSize
|
|
1399
1414
|
}, (tables === null || tables === void 0 || (_tables$filter8 = tables.filter) === null || _tables$filter8 === void 0 ? void 0 : _tables$filter8.key) && {
|
|
1400
1415
|
columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
|
|
1401
1416
|
}), {}, {
|
|
@@ -1413,6 +1428,7 @@ function GenricLayOut(_ref) {
|
|
|
1413
1428
|
type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
|
|
1414
1429
|
});
|
|
1415
1430
|
} else {
|
|
1431
|
+
var _config$tables3, _config$tables4;
|
|
1416
1432
|
if (staticFilter !== null && staticFilter !== void 0 && staticFilter.visible) {
|
|
1417
1433
|
var _staticFilter$data$fi3, _config$staticFilter2;
|
|
1418
1434
|
const selectedKey = staticFilter === null || staticFilter === void 0 || (_staticFilter$data$fi3 = staticFilter.data.find(item => item.selected)) === null || _staticFilter$data$fi3 === void 0 ? void 0 : _staticFilter$data$fi3.value;
|
|
@@ -1438,14 +1454,20 @@ function GenricLayOut(_ref) {
|
|
|
1438
1454
|
type: _layoutReducer.actionTypes.UPDATE_FILTER_DEFAULT_VALUES,
|
|
1439
1455
|
payload: formData
|
|
1440
1456
|
});
|
|
1457
|
+
dispatch({
|
|
1458
|
+
type: _layoutReducer.actionTypes.SET_PAGINATION,
|
|
1459
|
+
payload: {
|
|
1460
|
+
current: config === null || config === void 0 || (_config$tables3 = config.tables) === null || _config$tables3 === void 0 || (_config$tables3 = _config$tables3.pagination) === null || _config$tables3 === void 0 ? void 0 : _config$tables3.current,
|
|
1461
|
+
pageSize: config === null || config === void 0 || (_config$tables4 = config.tables) === null || _config$tables4 === void 0 || (_config$tables4 = _config$tables4.pagination) === null || _config$tables4 === void 0 ? void 0 : _config$tables4.pageSize
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1441
1464
|
dispatch({
|
|
1442
1465
|
type: _layoutReducer.actionTypes.CUSTOM_DRAWER_CLOSED
|
|
1443
1466
|
});
|
|
1444
1467
|
}
|
|
1445
1468
|
} else if (formData.drawerKey === "exportDrawer") {
|
|
1446
|
-
console.log(formData, "formData");
|
|
1447
1469
|
if (handleSecondaryTableCTAClick) {
|
|
1448
|
-
var _state$dropdownSearch8, _state$inputSearch8, _state$tabs15, _tables$
|
|
1470
|
+
var _state$dropdownSearch8, _state$inputSearch8, _state$tabs15, _tables$pagination21, _tables$pagination22, _tables$filter9, _tables$sorting21, _tables$sorting22, _header$subHeading15, _header$subHeading16, _staticFilter$data9, _state$misc12;
|
|
1449
1471
|
const {
|
|
1450
1472
|
error,
|
|
1451
1473
|
data
|
|
@@ -1456,8 +1478,8 @@ function GenricLayOut(_ref) {
|
|
|
1456
1478
|
searchedValue: state.inputSearch.value
|
|
1457
1479
|
}), {}, {
|
|
1458
1480
|
selectedTab: state === null || state === void 0 || (_state$tabs15 = state.tabs) === null || _state$tabs15 === void 0 ? void 0 : _state$tabs15.active,
|
|
1459
|
-
current: tables === null || tables === void 0 || (_tables$
|
|
1460
|
-
pageSize: tables === null || tables === void 0 || (_tables$
|
|
1481
|
+
current: tables === null || tables === void 0 || (_tables$pagination21 = tables.pagination) === null || _tables$pagination21 === void 0 ? void 0 : _tables$pagination21.current,
|
|
1482
|
+
pageSize: tables === null || tables === void 0 || (_tables$pagination22 = tables.pagination) === null || _tables$pagination22 === void 0 ? void 0 : _tables$pagination22.pageSize,
|
|
1461
1483
|
columnFilterStatus: tables === null || tables === void 0 || (_tables$filter9 = tables.filter) === null || _tables$filter9 === void 0 ? void 0 : _tables$filter9.value,
|
|
1462
1484
|
field: tables === null || tables === void 0 || (_tables$sorting21 = tables.sorting) === null || _tables$sorting21 === void 0 ? void 0 : _tables$sorting21.sortBy,
|
|
1463
1485
|
order: tables === null || tables === void 0 || (_tables$sorting22 = tables.sorting) === null || _tables$sorting22 === void 0 ? void 0 : _tables$sorting22.sortDirection
|
|
@@ -1484,7 +1506,7 @@ function GenricLayOut(_ref) {
|
|
|
1484
1506
|
}
|
|
1485
1507
|
};
|
|
1486
1508
|
const onClearAllAppliedFilters = async () => {
|
|
1487
|
-
var _state$dropdownSearch9, _state$inputSearch9, _state$tabs16, _tables$
|
|
1509
|
+
var _state$dropdownSearch9, _state$inputSearch9, _state$tabs16, _tables$pagination23, _tables$pagination24, _tables$filter10, _tables$sorting23, _header$subHeading17, _header$subHeading18, _staticFilter$data10, _tables$sorting24, _state$misc13;
|
|
1488
1510
|
const {
|
|
1489
1511
|
error,
|
|
1490
1512
|
data
|
|
@@ -1495,8 +1517,8 @@ function GenricLayOut(_ref) {
|
|
|
1495
1517
|
searchedValue: state.inputSearch.value
|
|
1496
1518
|
}), {}, {
|
|
1497
1519
|
selectedTab: state === null || state === void 0 || (_state$tabs16 = state.tabs) === null || _state$tabs16 === void 0 ? void 0 : _state$tabs16.active,
|
|
1498
|
-
current: tables === null || tables === void 0 || (_tables$
|
|
1499
|
-
pageSize: tables === null || tables === void 0 || (_tables$
|
|
1520
|
+
current: tables === null || tables === void 0 || (_tables$pagination23 = tables.pagination) === null || _tables$pagination23 === void 0 ? void 0 : _tables$pagination23.current,
|
|
1521
|
+
pageSize: tables === null || tables === void 0 || (_tables$pagination24 = tables.pagination) === null || _tables$pagination24 === void 0 ? void 0 : _tables$pagination24.pageSize
|
|
1500
1522
|
}, (tables === null || tables === void 0 || (_tables$filter10 = tables.filter) === null || _tables$filter10 === void 0 ? void 0 : _tables$filter10.key) && {
|
|
1501
1523
|
columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
|
|
1502
1524
|
}), {}, {
|
|
@@ -1638,7 +1660,6 @@ function GenricLayOut(_ref) {
|
|
|
1638
1660
|
* - "OPEN_MODAL": Opens a modal with updated content.
|
|
1639
1661
|
*/
|
|
1640
1662
|
const leftHeaderFirstButtonClick = async () => {
|
|
1641
|
-
console.log(leftHeaderFirstButton, "leftHeaderFirstButton");
|
|
1642
1663
|
if ((leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.action) === "OPEN_CUSTOM_DRAWER") {
|
|
1643
1664
|
var _config$customDrawer3;
|
|
1644
1665
|
const drawerData = config === null || config === void 0 || (_config$customDrawer3 = config.customDrawer) === null || _config$customDrawer3 === void 0 || (_config$customDrawer3 = _config$customDrawer3.data) === null || _config$customDrawer3 === void 0 ? void 0 : _config$customDrawer3[leftHeaderFirstButton === null || leftHeaderFirstButton === void 0 ? void 0 : leftHeaderFirstButton.drawerKey];
|
|
@@ -1689,7 +1710,7 @@ function GenricLayOut(_ref) {
|
|
|
1689
1710
|
};
|
|
1690
1711
|
const rightHeaderSecondButtonClick = async () => {
|
|
1691
1712
|
if ((rightHeaderSecondButton === null || rightHeaderSecondButton === void 0 ? void 0 : rightHeaderSecondButton.action) === "RESET_CUSTOM_DRAWER") {
|
|
1692
|
-
var _state$dropdownSearch10, _state$inputSearch10, _state$tabs17, _tables$
|
|
1713
|
+
var _state$dropdownSearch10, _state$inputSearch10, _state$tabs17, _tables$pagination25, _tables$pagination26, _tables$filter11, _tables$sorting25, _header$subHeading19, _header$subHeading20, _staticFilter$data11, _tables$sorting26, _state$misc15;
|
|
1693
1714
|
const {
|
|
1694
1715
|
error,
|
|
1695
1716
|
data
|
|
@@ -1700,8 +1721,8 @@ function GenricLayOut(_ref) {
|
|
|
1700
1721
|
searchedValue: state.inputSearch.value
|
|
1701
1722
|
}), {}, {
|
|
1702
1723
|
selectedTab: state === null || state === void 0 || (_state$tabs17 = state.tabs) === null || _state$tabs17 === void 0 ? void 0 : _state$tabs17.active,
|
|
1703
|
-
current: tables === null || tables === void 0 || (_tables$
|
|
1704
|
-
pageSize: tables === null || tables === void 0 || (_tables$
|
|
1724
|
+
current: tables === null || tables === void 0 || (_tables$pagination25 = tables.pagination) === null || _tables$pagination25 === void 0 ? void 0 : _tables$pagination25.current,
|
|
1725
|
+
pageSize: tables === null || tables === void 0 || (_tables$pagination26 = tables.pagination) === null || _tables$pagination26 === void 0 ? void 0 : _tables$pagination26.pageSize
|
|
1705
1726
|
}, (tables === null || tables === void 0 || (_tables$filter11 = tables.filter) === null || _tables$filter11 === void 0 ? void 0 : _tables$filter11.key) && {
|
|
1706
1727
|
columnFilterStatus: tables === null || tables === void 0 ? void 0 : tables.filter
|
|
1707
1728
|
}), {}, {
|
|
@@ -1763,7 +1784,7 @@ function GenricLayOut(_ref) {
|
|
|
1763
1784
|
};
|
|
1764
1785
|
const handleSubHeadingSelect = async val => {
|
|
1765
1786
|
if (val) {
|
|
1766
|
-
var _tables$
|
|
1787
|
+
var _tables$pagination27, _tables$pagination28, _state$misc16;
|
|
1767
1788
|
dispatch({
|
|
1768
1789
|
type: _layoutReducer.actionTypes.SET_SUBHEADING_SELECTED_CONFIG,
|
|
1769
1790
|
payload: val
|
|
@@ -1773,8 +1794,8 @@ function GenricLayOut(_ref) {
|
|
|
1773
1794
|
data
|
|
1774
1795
|
} = await handleSubHeadingSelectClick(_objectSpread({
|
|
1775
1796
|
searchedValue: inputSearch === null || inputSearch === void 0 ? void 0 : inputSearch.value,
|
|
1776
|
-
current: tables === null || tables === void 0 || (_tables$
|
|
1777
|
-
pageSize: tables === null || tables === void 0 || (_tables$
|
|
1797
|
+
current: tables === null || tables === void 0 || (_tables$pagination27 = tables.pagination) === null || _tables$pagination27 === void 0 ? void 0 : _tables$pagination27.current,
|
|
1798
|
+
pageSize: tables === null || tables === void 0 || (_tables$pagination28 = tables.pagination) === null || _tables$pagination28 === void 0 ? void 0 : _tables$pagination28.pageSize,
|
|
1778
1799
|
subHeadingSelectVal: val
|
|
1779
1800
|
}, (_state$misc16 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc16 !== void 0 ? _state$misc16 : {}));
|
|
1780
1801
|
if (error) {
|
|
@@ -1803,7 +1824,7 @@ function GenricLayOut(_ref) {
|
|
|
1803
1824
|
|
|
1804
1825
|
// Call the handler if provided
|
|
1805
1826
|
if (handleTableChange) {
|
|
1806
|
-
var _state$dropdownSearch11, _state$inputSearch11, _state$tabs18, _tables$
|
|
1827
|
+
var _state$dropdownSearch11, _state$inputSearch11, _state$tabs18, _tables$pagination29, _tables$sorting27, _tables$sorting28, _header$subHeading21, _header$subHeading22, _customDrawer$applied10, _state$misc17;
|
|
1807
1828
|
dispatch({
|
|
1808
1829
|
type: _layoutReducer.actionTypes.SET_LOADING,
|
|
1809
1830
|
payload: true
|
|
@@ -1820,17 +1841,13 @@ function GenricLayOut(_ref) {
|
|
|
1820
1841
|
selectedTab: state === null || state === void 0 || (_state$tabs18 = state.tabs) === null || _state$tabs18 === void 0 ? void 0 : _state$tabs18.active,
|
|
1821
1842
|
current: 1,
|
|
1822
1843
|
// Reset to first page when filtering
|
|
1823
|
-
pageSize: tables === null || tables === void 0 || (_tables$
|
|
1844
|
+
pageSize: tables === null || tables === void 0 || (_tables$pagination29 = tables.pagination) === null || _tables$pagination29 === void 0 ? void 0 : _tables$pagination29.pageSize,
|
|
1824
1845
|
filterStatus: filterValue,
|
|
1825
1846
|
field: tables === null || tables === void 0 || (_tables$sorting27 = tables.sorting) === null || _tables$sorting27 === void 0 ? void 0 : _tables$sorting27.sortBy,
|
|
1826
1847
|
order: tables === null || tables === void 0 || (_tables$sorting28 = tables.sorting) === null || _tables$sorting28 === void 0 ? void 0 : _tables$sorting28.sortDirection
|
|
1827
1848
|
}, (header === null || header === void 0 || (_header$subHeading21 = header.subHeading) === null || _header$subHeading21 === void 0 || (_header$subHeading21 = _header$subHeading21.jsxConfig) === null || _header$subHeading21 === void 0 ? void 0 : _header$subHeading21.type) == "select" ? {
|
|
1828
1849
|
subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading22 = header.subHeading) === null || _header$subHeading22 === void 0 || (_header$subHeading22 = _header$subHeading22.jsxConfig) === null || _header$subHeading22 === void 0 ? void 0 : _header$subHeading22.value
|
|
1829
|
-
} : {}), (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 && {
|
|
1830
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
1831
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
1832
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
1833
|
-
}), (_state$misc17 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc17 !== void 0 ? _state$misc17 : {}), {}, {
|
|
1850
|
+
} : {}), (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$misc17 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc17 !== void 0 ? _state$misc17 : {}), {}, {
|
|
1834
1851
|
staticFilter: filterValue // Pass static filter value
|
|
1835
1852
|
}));
|
|
1836
1853
|
if (error) {
|
|
@@ -1839,7 +1856,7 @@ function GenricLayOut(_ref) {
|
|
|
1839
1856
|
type: _layoutReducer.actionTypes.SET_TABLE_EMPTY
|
|
1840
1857
|
});
|
|
1841
1858
|
} else {
|
|
1842
|
-
var _tables$
|
|
1859
|
+
var _tables$pagination30;
|
|
1843
1860
|
dispatch({
|
|
1844
1861
|
type: _layoutReducer.actionTypes.SET_TABLE_DATA,
|
|
1845
1862
|
payload: data
|
|
@@ -1849,7 +1866,7 @@ function GenricLayOut(_ref) {
|
|
|
1849
1866
|
type: _layoutReducer.actionTypes.SET_PAGINATION,
|
|
1850
1867
|
payload: {
|
|
1851
1868
|
current: 1,
|
|
1852
|
-
pageSize: tables === null || tables === void 0 || (_tables$
|
|
1869
|
+
pageSize: tables === null || tables === void 0 || (_tables$pagination30 = tables.pagination) === null || _tables$pagination30 === void 0 ? void 0 : _tables$pagination30.pageSize
|
|
1853
1870
|
}
|
|
1854
1871
|
});
|
|
1855
1872
|
}
|
|
@@ -1892,11 +1909,7 @@ function GenricLayOut(_ref) {
|
|
|
1892
1909
|
subHeadingSelectVal: header === null || header === void 0 || (_header$subHeading24 = header.subHeading) === null || _header$subHeading24 === void 0 || (_header$subHeading24 = _header$subHeading24.jsxConfig) === null || _header$subHeading24 === void 0 ? void 0 : _header$subHeading24.value
|
|
1893
1910
|
} : {}), (staticFilter === null || staticFilter === void 0 ? void 0 : staticFilter.visible) && ((_staticFilter$data12 = staticFilter.data) === null || _staticFilter$data12 === void 0 || (_staticFilter$data12 = _staticFilter$data12.find(item => item.selected)) === null || _staticFilter$data12 === void 0 ? void 0 : _staticFilter$data12.value) && {
|
|
1894
1911
|
staticFilter: staticFilter.data.find(item => item.selected).value
|
|
1895
|
-
}), (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 && {
|
|
1896
|
-
filterOn: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.filterBy,
|
|
1897
|
-
fromDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.fromDate,
|
|
1898
|
-
toDate: customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters.toDate
|
|
1899
|
-
}), (_state$misc18 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc18 !== void 0 ? _state$misc18 : {}));
|
|
1912
|
+
}), (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$misc18 = state === null || state === void 0 ? void 0 : state.misc) !== null && _state$misc18 !== void 0 ? _state$misc18 : {}));
|
|
1900
1913
|
if (error) {
|
|
1901
1914
|
showErrorNotification(error);
|
|
1902
1915
|
dispatch({
|
|
@@ -1913,6 +1926,15 @@ function GenricLayOut(_ref) {
|
|
|
1913
1926
|
}
|
|
1914
1927
|
}
|
|
1915
1928
|
};
|
|
1929
|
+
function isFiltersEmpty() {
|
|
1930
|
+
let filters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1931
|
+
const filtersKeyLength = Object.keys(filters).length;
|
|
1932
|
+
if (filtersKeyLength === 0) return true;
|
|
1933
|
+
if (filtersKeyLength === 2) {
|
|
1934
|
+
return (filters === null || filters === void 0 ? void 0 : filters.drawerKey) && (filters === null || filters === void 0 ? void 0 : filters.type);
|
|
1935
|
+
}
|
|
1936
|
+
return false;
|
|
1937
|
+
}
|
|
1916
1938
|
console.log(state, "GenricLayOutstate");
|
|
1917
1939
|
return /*#__PURE__*/_react.default.createElement(_styles.OapageWithDataStyle, {
|
|
1918
1940
|
className: (state === null || state === void 0 || (_state$misc19 = state.misc) === null || _state$misc19 === void 0 ? void 0 : _state$misc19.flow) === "hubAutomation" ? "hubAutomationContainer" : ""
|
|
@@ -2008,7 +2030,7 @@ function GenricLayOut(_ref) {
|
|
|
2008
2030
|
}),
|
|
2009
2031
|
position: "left"
|
|
2010
2032
|
})
|
|
2011
|
-
}),
|
|
2033
|
+
}), !isFiltersEmpty(customDrawer === null || customDrawer === void 0 ? void 0 : customDrawer.appliedFilters) && /*#__PURE__*/_react.default.createElement("span", {
|
|
2012
2034
|
className: "notifyDot"
|
|
2013
2035
|
})))))), (inputSearch === null || inputSearch === void 0 ? void 0 : inputSearch.visible) && /*#__PURE__*/_react.default.createElement(_antd.Skeleton, {
|
|
2014
2036
|
loading: state === null || state === void 0 ? void 0 : state.isLoading,
|
|
@@ -2081,7 +2103,7 @@ function GenricLayOut(_ref) {
|
|
|
2081
2103
|
emptyText: emptyTableState
|
|
2082
2104
|
},
|
|
2083
2105
|
emptyStateCard: emptyTableState,
|
|
2084
|
-
onMobilePageChange: tables !== null && tables !== void 0 && (_tables$
|
|
2106
|
+
onMobilePageChange: tables !== null && tables !== void 0 && (_tables$pagination31 = tables.pagination) !== null && _tables$pagination31 !== void 0 && _tables$pagination31.mwebPagination ? onMobilePageChange : undefined
|
|
2085
2107
|
})))), (drawer === null || drawer === void 0 ? void 0 : drawer.visible) && /*#__PURE__*/_react.default.createElement(_CustomDrawer.default, {
|
|
2086
2108
|
className: "oaDrawer",
|
|
2087
2109
|
title: drawer === null || drawer === void 0 || (_drawer$data = drawer.data) === null || _drawer$data === void 0 || (_drawer$data = _drawer$data[(_tabs$active5 = tabs === null || tabs === void 0 ? void 0 : tabs.active) !== null && _tabs$active5 !== void 0 ? _tabs$active5 : "default"]) === null || _drawer$data === void 0 || (_drawer$data = _drawer$data[drawer === null || drawer === void 0 ? void 0 : drawer.active]) === null || _drawer$data === void 0 ? void 0 : _drawer$data.title,
|
|
@@ -2139,7 +2161,7 @@ function GenricLayOut(_ref) {
|
|
|
2139
2161
|
className: "bottomSelectedSecion"
|
|
2140
2162
|
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
2141
2163
|
color: "secondary-content",
|
|
2142
|
-
typography: "
|
|
2164
|
+
typography: "type-button-500"
|
|
2143
2165
|
}, /*#__PURE__*/_react.default.createElement("span", null, "".concat(tables === null || tables === void 0 || (_tables$selectedRowKe = tables.selectedRowKeys) === null || _tables$selectedRowKe === void 0 ? void 0 : _tables$selectedRowKe.length, " ").concat(tables === null || tables === void 0 || (_tables$tableFooter2 = tables.tableFooter) === null || _tables$tableFooter2 === void 0 ? void 0 : _tables$tableFooter2.text))), /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
2144
2166
|
type: tables === null || tables === void 0 || (_tables$tableFooter3 = tables.tableFooter) === null || _tables$tableFooter3 === void 0 || (_tables$tableFooter3 = _tables$tableFooter3.jsxConfig) === null || _tables$tableFooter3 === void 0 ? void 0 : _tables$tableFooter3.buttonType,
|
|
2145
2167
|
onClick: () => {
|
|
@@ -17,6 +17,7 @@ function Header(_ref) {
|
|
|
17
17
|
let {
|
|
18
18
|
heading,
|
|
19
19
|
subHeading,
|
|
20
|
+
subHeading1,
|
|
20
21
|
onSubHeadingClick,
|
|
21
22
|
handleSubHeadingSelect
|
|
22
23
|
} = _ref;
|
|
@@ -63,6 +64,11 @@ function Header(_ref) {
|
|
|
63
64
|
color: (_subHeading$color = subHeading === null || subHeading === void 0 ? void 0 : subHeading.color) !== null && _subHeading$color !== void 0 ? _subHeading$color : "secondary-content"
|
|
64
65
|
}, (subHeading === null || subHeading === void 0 || (_subHeading$icon = subHeading.icon) === null || _subHeading$icon === void 0 ? void 0 : _subHeading$icon.position) === "left" && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, _extends({}, subHeading === null || subHeading === void 0 || (_subHeading$icon2 = subHeading.icon) === null || _subHeading$icon2 === void 0 ? void 0 : _subHeading$icon2.iconConfig, {
|
|
65
66
|
className: "margin-right-8"
|
|
66
|
-
})), subHeading === null || subHeading === void 0 ? void 0 : subHeading.text, (subHeading === null || subHeading === void 0 || (_subHeading$icon3 = subHeading.icon) === null || _subHeading$icon3 === void 0 ? void 0 : _subHeading$icon3.position) === "right" && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, subHeading === null || subHeading === void 0 || (_subHeading$icon4 = subHeading.icon) === null || _subHeading$icon4 === void 0 ? void 0 : _subHeading$icon4.iconConfig)), subHeadingJsx(subHeading))
|
|
67
|
+
})), subHeading === null || subHeading === void 0 ? void 0 : subHeading.text, (subHeading === null || subHeading === void 0 || (_subHeading$icon3 = subHeading.icon) === null || _subHeading$icon3 === void 0 ? void 0 : _subHeading$icon3.position) === "right" && /*#__PURE__*/_react.default.createElement(_MaterialIcon.default, subHeading === null || subHeading === void 0 || (_subHeading$icon4 = subHeading.icon) === null || _subHeading$icon4 === void 0 ? void 0 : _subHeading$icon4.iconConfig)), subHeadingJsx(subHeading)), subHeading1 && /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
className: "subHadingText marginNone"
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement(_Typography.default, {
|
|
70
|
+
typography: subHeading1 === null || subHeading1 === void 0 ? void 0 : subHeading1.type,
|
|
71
|
+
color: "secondary-content"
|
|
72
|
+
}, subHeading1 === null || subHeading1 === void 0 ? void 0 : subHeading1.text)));
|
|
67
73
|
}
|
|
68
74
|
var _default = exports.default = Header;
|
|
@@ -16,7 +16,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
16
16
|
const DrawerWithOutFooter = exports.DrawerWithOutFooter = (0, _styledComponents.createGlobalStyle)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n.hubAutomationContainer .fullPageLayout {padding: 0 !important; background: #fff !important;}\n.hubAutomationContainer .fullPageLayout .oaRightLayouts{\n max-width: 1154px;\n margin: 24px auto;\n padding: 0 16px;\n box-shadow: none;}\n.oaDrawer div + div.ant-drawer-body{padding-bottom:100px !important;}\n\n.ant-checkbox-indeterminate .ant-checkbox-inner:after {\n background-color: #014fc5;\n}\n\n.ant-form-item .ant-form-item-label >label.ant-form-item-required::before {display:none;}\n.ant-form-item .ant-form-item-label >label.ant-form-item-required::after{ content: \"*\"; color: #DE350B; visibility: visible !important;}\n\n\n.cstUplaodWithFullWidth{margin-bottom:24px;}\n.cstUplaodWithFullWidth:last-child{margin-bottom:0;}\n.cstUplaodWithFullWidth .uploadDiv{width:100%;}\n.cstUplaodWithFullWidth .uploadDiv .ant-upload-list-item-container, .cstUplaodWithFullWidth .uploadDiv .ant-upload-wrapper .ant-upload-list-picture-card .ant-upload-select, .cstUplaodWithFullWidth .uploadDiv .ant-upload-wrapper.ant-upload-picture-card-wrapper .ant-upload-list.ant-upload-list-picture-card .ant-upload-list-item-container {\n width: 100%; \n height: 120px;\n}\n\n\n\n\n.oaDrawer .ant-form-item .ant-form-item-explain-error {\n color: #DE350B;\n font-size: 12px;\n margin: 4px 0 0 0;\n}\n.bottomSelectedSecion{background: #F6F6F6; padding: 16px 36px; position: fixed; bottom: 0; left: 0; right: 0;\nbox-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n display: flex; z-index: 2;\n align-items: center;\n justify-content: end;\n gap: 24px;}\n\n\n\n.listOfItems{ border-radius: 12px;\n border: 1px solid #E0E0E0;\n padding: 24px;\n margin: 24px 0 0 0;}\n modalSubheading{\n padding: 24px;\n margin: 24px 0 0 0;}\n\n.listOfItemsWithoutBorder{\n padding: 24px 0;\n margin: 24px 0 0 0;}\n\n modalSubheading{\n padding: 24px;\n margin: 24px 0 0 0;}\n\n\n\n\n.modalIconAndTextBox{display:flex; flex-direction:row; align-items: center; margin: 0 0 16px 0; gap:4px;}\n"])));
|
|
17
17
|
const FormWidgetStyle = exports.FormWidgetStyle = _styledComponents.default.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .formBottomAction {\n position: absolute;\n bottom: 0px;\n background-color: rgb(249, 249, 249);\n box-shadow: rgba(0, 0, 0, 0.1) 0px -2px 8px;\n padding: 16px;\n display: flex;\n justify-content: flex-end;\n gap: 12px;\n z-index: 10;\n left: 0;\n right: 0;\n }\n\n .formBottomAction .ant-form-item {\n margin-bottom: 0px;\n }\n\n .searchErrorMsg {\n font-size: 12px;\n }\n .searchErrorMsg {\n font-size: 12px;\n }\n"])));
|
|
18
18
|
const TableDataStyle = exports.TableDataStyle = _styledComponents.default.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n .tableContainerList th,\n button {\n white-space: nowrap;\n }\n .tableContainerList th,\n button {\n white-space: nowrap;\n }\n"])));
|
|
19
|
-
const OapageWithDataStyle = exports.OapageWithDataStyle = _styledComponents.default.aside(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .oaTopHeaderAndBtnSec {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n }\n\n .fullPageLayout {\n display: flex;\n padding: 8px;\n background: #f6f6f6;\n }\n .ant-pagination {\n padding: 0 16px;\n justify-content: end;\n }\n .layoutHeadingPage {\n display: flex;\n gap: 8px;\n margin: 0 0 32px 0;\n flex-direction: column;\n justify-content: flex-start;\n }\n\n .topHadingWithIcon span {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 8px;\n }\n\n .subHadingText {\n margin: 0 0 0 36px;\n }\n\n .marginNone {\n margin: 0 !important;\n }\n\n .subHadingText > span {\n display: flex;\n flex-direction: row;\n gap: 4px;\n align-items: center;\n }\n\n .oaRightLayouts {\n width: 100%;\n min-height: calc(100vh - 16px);\n padding: 76px 48px;\n overflow-y: auto;\n border-radius: 16px;\n background: #fff;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n }\n\n .oaheaderSearchAndFilter {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 0 0 16px 0;\n gap: 16px;\n }\n\n
|
|
19
|
+
const OapageWithDataStyle = exports.OapageWithDataStyle = _styledComponents.default.aside(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n .oaTopHeaderAndBtnSec {\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n }\n\n .fullPageLayout {\n display: flex;\n padding: 8px;\n background: #f6f6f6;\n }\n .ant-pagination {\n padding: 0 16px;\n justify-content: end;\n }\n .layoutHeadingPage {\n display: flex;\n gap: 8px;\n margin: 0 0 32px 0;\n flex-direction: column;\n justify-content: flex-start;\n }\n\n .topHadingWithIcon span {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 8px;\n }\n\n .subHadingText {\n margin: 0 0 0 36px;\n }\n\n .marginNone {\n margin: 0 !important;\n }\n\n .subHadingText > span {\n display: flex;\n flex-direction: row;\n gap: 4px;\n align-items: center;\n }\n\n .oaRightLayouts {\n width: 100%;\n min-height: calc(100vh - 16px);\n padding: 76px 48px;\n overflow-y: auto;\n border-radius: 16px;\n background: #fff;\n box-shadow: 0px 2px 10px 0px rgba(0, 0, 0, 0.14);\n }\n\n .oaheaderSearchAndFilter {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 0 0 16px 0;\n gap: 16px;\n }\n\n .oaRightLayouts .iconAndTextSecBox {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 8px;\n }\n .inLine {\n display: flex;\n flex-direction: row;\n align-items: center;\n gap: 4px;\n }\n\n .customeSelectDropdown {\n margin: 4px 0 0 8px;\n }\n\n .cardData {\n padding: 28px 0 48px 0;\n }\n\n .ant-carousel .slick-dots {\n position: static;\n margin: 20px auto 12px 0;\n }\n .ant-carousel .slick-dots li {\n width: 8px;\n height: 8px;\n }\n .ant-carousel .slick-dots li button {\n width: 8px;\n height: 8px;\n background: #cacaca;\n border-radius: 50%;\n opacity: 0.5;\n }\n .ant-carousel .slick-dots li.slick-active {\n width: 8px;\n height: 8px;\n }\n .ant-carousel .slick-dots li.slick-active button {\n width: 8px;\n height: 8px;\n opacity: 1;\n }\n .ant-carousel .slick-dots li::after {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n opacity: 1;\n background: #717171;\n }\n\n .oaTabs .ant-tabs-nav {\n border-top: 1px solid #e0e0e0;\n border-left: 1px solid #e0e0e0;\n border-right: 1px solid #e0e0e0;\n padding: 12px 22px 0 22px;\n margin: 0 0 8px 0;\n background: #fff;\n border-radius: 4px 4px 0 0;\n }\n .ant-card-body {\n padding: 24px 16px !important;\n border-radius: 16px;\n background: #f6f6f6;\n }\n .cardContainer {\n display: flex;\n gap: 24px;\n }\n .selectAndSearch .noClear {\n border-radius: 0 4px 4px 0;\n width: 320px;\n }\n\n .searchErrorMsg {\n font-size: 12px;\n margin: 4px 0px 0px;\n color: #de350b;\n }\n .searchOnly {\n margin: 0px 0px 16px;\n position: relative;\n }\n .searchOnly .ant-input-affix-wrapper {\n border-radius: 4px;\n max-width: 420px;\n padding-left: 44px;\n }\n .searchOnly .cstSearchIcon {\n position: absolute;\n left: 16px;\n top: 14px;\n z-index: 2;\n }\n\n .selectAndSearch .ant-input-affix-wrapper {\n border-radius: 0 4px 4px 0;\n width: 320px;\n }\n\n .selectAndSearch {\n flex-shrink: 0;\n }\n\n .customeSelectDropdown .ant-select-selector {\n border: none;\n padding: 0;\n }\n .customeSelectDropdown .ant-select-selection-item > span {\n font-size: 24px;\n font-weight: 500;\n line-height: 32px;\n }\n\n .customeSelectDropdown .ant-select {\n margin: 0 0 0 32px;\n }\n\n .customeSelectDropdown .ant-select .ant-select-arrow {\n color: #014fc5;\n inset-inline-end: -6px;\n }\n\n .customeSelectDropdown .ant-select-selector {\n box-shadow: none !important;\n }\n .oaheaderButtons {\n display: flex;\n gap: 24px;\n align-items: center;\n position: relative;\n flex-grow: 1;\n justify-content: space-between;\n }\n\n .oaheaderButtons.single-child {\n justify-content: flex-end;\n }\n\n .oaheaderButtonsRight {\n display: flex;\n flex-direction: row;\n gap: 16px;\n }\n\n .oaheaderButtons .notifyDot {\n width: 12px;\n height: 12px;\n background: #de350b;\n position: absolute;\n top: -4px;\n right: -4px;\n border-radius: 50%;\n }\n\n @media only screen and (max-width: 600px) {\n .selectAndSearch .ant-input-affix-wrapper {\n width: calc(100% - 84px);\n }\n .oaheaderSearchAndFilter .dropDownSearchContainer {\n width: 100%;\n }\n\n .oaheaderSearchAndFilter {\n align-items: flex-end;\n flex-direction: column;\n gap: 16px;\n }\n\n .inLine {\n flex-direction: column;\n gap: 0;\n align-items: flex-start;\n }\n\n .subHadingText > span {\n flex-direction: column;\n align-items: flex-start;\n }\n\n .fullPageLayout {\n flex-direction: column;\n padding: 0;\n }\n .oaRightLayouts {\n padding: 16px;\n border-radius: 0;\n background: #fff;\n box-shadow: none;\n height: auto;\n background: #f6f6f6;\n }\n .oaTabs .ant-tabs-nav {\n margin: 0 0 28px 0;\n padding: 12px 0 0 0;\n }\n .layoutHeadingPage {\n margin: 0 0 16px 0;\n background: #fff;\n padding: 16px;\n border-radius: 8px;\n width: 100%;\n }\n .layoutHeadingAndSearch {\n background: #fff;\n padding: 20px 16px;\n margin: 0;\n width: 100%;\n border-radius: 8px;\n }\n }\n"])));
|
|
20
20
|
const ListofDamageParts = exports.ListofDamageParts = _styledComponents.default.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ul.damagedParts {\n display: flex;\n flex-direction: column;\n margin: 8px 0 0 16px;\n list-style-type: disc;\n }\n ul.damagedParts li {\n padding: 4px 0;\n width: 100%;\n }\n ul.damagedParts li::marker {\n color: #717171;\n font-size: 20px;\n }\n"])));
|
|
21
21
|
const IncidentListParts = exports.IncidentListParts = _styledComponents.default.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n .qaSec dl {\n display: flex;\n flex-direction: column;\n margin: 0;\n padding: 0;\n }\n .qaSec dl dt {\n display: flex;\n flex-direction: column;\n margin: 16px 0 0 0;\n }\n .qaSec dl dt:first-child {\n margin-top: 8px;\n }\n"])));
|
|
22
22
|
var _default = exports.default = {};
|
|
@@ -8,6 +8,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
});
|
|
9
9
|
exports.default = FormWidget;
|
|
10
10
|
require("core-js/modules/web.dom-collections.iterator.js");
|
|
11
|
+
require("core-js/modules/es.regexp.constructor.js");
|
|
12
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
13
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
11
14
|
require("core-js/modules/es.array.includes.js");
|
|
12
15
|
require("core-js/modules/es.string.includes.js");
|
|
13
16
|
var _antd = require("antd");
|
|
@@ -43,7 +46,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
43
46
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
44
47
|
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 */
|
|
45
48
|
function FormWidget(props) {
|
|
46
|
-
var _cancel$type, _cancel$size, _clear$type, _clear$size, _submit$type;
|
|
49
|
+
var _cancel$type, _cancel$size, _clear$type, _clear$size, _submit$type, _submit$disabled;
|
|
47
50
|
const [form] = _antd.Form.useForm();
|
|
48
51
|
const [dynamicRules, setDynamicRules] = (0, _react.useState)({});
|
|
49
52
|
const {
|
|
@@ -61,16 +64,47 @@ function FormWidget(props) {
|
|
|
61
64
|
visible,
|
|
62
65
|
clear
|
|
63
66
|
} = cta !== null && cta !== void 0 ? cta : {};
|
|
64
|
-
const getFieldRules = item => {
|
|
65
|
-
|
|
67
|
+
const getFieldRules = (itemData, item) => {
|
|
68
|
+
console.log(item, "item");
|
|
69
|
+
console.log(itemData, "itemData");
|
|
70
|
+
if (item.customRulesCheck) {
|
|
71
|
+
return dynamicRules[item === null || item === void 0 ? void 0 : item.name] || (item === null || item === void 0 ? void 0 : item.rules) || [];
|
|
72
|
+
} else {
|
|
73
|
+
return getInputRules(itemData, item);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const getInputRules = (itemData, item) => {
|
|
77
|
+
var _ref;
|
|
78
|
+
console.log(itemData, item, "getInputRules");
|
|
79
|
+
if (itemData !== null && itemData !== void 0 && itemData.customRules) {
|
|
80
|
+
for (const key in itemData === null || itemData === void 0 ? void 0 : itemData.customRules) {
|
|
81
|
+
if (item[key]) {
|
|
82
|
+
var _itemData$customRules;
|
|
83
|
+
return itemData === null || itemData === void 0 || (_itemData$customRules = itemData.customRules[key]) === null || _itemData$customRules === void 0 ? void 0 : _itemData$customRules.map(r => {
|
|
84
|
+
var _r$rule;
|
|
85
|
+
if (r !== null && r !== void 0 && (_r$rule = r.rule) !== null && _r$rule !== void 0 && _r$rule.pattern) {
|
|
86
|
+
r.rule.pattern = new RegExp(r.rule.pattern);
|
|
87
|
+
}
|
|
88
|
+
return (r === null || r === void 0 ? void 0 : r.checkValidator) && (r === null || r === void 0 ? void 0 : r.rule);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return (_ref = itemData || item) === null || _ref === void 0 || (_ref = _ref.rules) === null || _ref === void 0 ? void 0 : _ref.map(r => {
|
|
94
|
+
var _r$rule2;
|
|
95
|
+
if (r !== null && r !== void 0 && (_r$rule2 = r.rule) !== null && _r$rule2 !== void 0 && _r$rule2.pattern) {
|
|
96
|
+
r.rule.pattern = new RegExp(r.rule.pattern);
|
|
97
|
+
}
|
|
98
|
+
return (r === null || r === void 0 ? void 0 : r.checkValidator) && (r === null || r === void 0 ? void 0 : r.rule);
|
|
99
|
+
});
|
|
66
100
|
};
|
|
67
101
|
const handleDynamicRuleUpdate = (fieldName, value, dynamicRulesConfig) => {
|
|
68
102
|
if (!dynamicRulesConfig) return;
|
|
69
|
-
|
|
70
|
-
Object.entries(dynamicRulesConfig).forEach(_ref => {
|
|
103
|
+
Object.entries(dynamicRulesConfig).forEach(_ref2 => {
|
|
71
104
|
var _config$conditions;
|
|
72
|
-
let [targetField, config] =
|
|
105
|
+
let [targetField, config] = _ref2;
|
|
73
106
|
const condition = (_config$conditions = config.conditions) === null || _config$conditions === void 0 ? void 0 : _config$conditions.find(c => c.type === "equals" ? value == c.value : c.type == "not_equals" ? value != c.value : c.type == "includes" ? value === null || value === void 0 ? void 0 : value.includes(c.value) : c.validator ? c.validator(value) : false);
|
|
107
|
+
console.log(condition, "condition");
|
|
74
108
|
const newRules = condition ? condition.rules : config.defaultRules || [];
|
|
75
109
|
setDynamicRules(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
76
110
|
[targetField]: newRules
|
|
@@ -82,6 +116,7 @@ function FormWidget(props) {
|
|
|
82
116
|
}
|
|
83
117
|
});
|
|
84
118
|
};
|
|
119
|
+
console.log(dynamicRules, "dynamicrule");
|
|
85
120
|
const dynamicClassInCaseOfUpload = item => {
|
|
86
121
|
if ((item === null || item === void 0 ? void 0 : item.width) === "full") {
|
|
87
122
|
return "cstUplaodWithFullWidth";
|
|
@@ -103,7 +138,7 @@ function FormWidget(props) {
|
|
|
103
138
|
};
|
|
104
139
|
const renderFieldWidget = (item, index, itemData) => {
|
|
105
140
|
if ((item === null || item === void 0 ? void 0 : item.widget) === "date" && (item === null || item === void 0 ? void 0 : item.visible) !== false) {
|
|
106
|
-
var _item$props, _item$props$getDisabl;
|
|
141
|
+
var _item$props, _item$props$getDisabl, _item$disabled;
|
|
107
142
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
108
143
|
value: item === null || item === void 0 ? void 0 : item.value,
|
|
109
144
|
name: item === null || item === void 0 ? void 0 : item.name,
|
|
@@ -116,11 +151,12 @@ function FormWidget(props) {
|
|
|
116
151
|
width: "100%"
|
|
117
152
|
},
|
|
118
153
|
disabledDateFunction: item === null || item === void 0 || (_item$props = item.props) === null || _item$props === void 0 || (_item$props$getDisabl = _item$props.getDisabledDateLogic) === null || _item$props$getDisabl === void 0 ? void 0 : _item$props$getDisabl.call(_item$props, item.valueProp),
|
|
154
|
+
disabled: (_item$disabled = item.disabled) !== null && _item$disabled !== void 0 ? _item$disabled : false,
|
|
119
155
|
defaultValue: item.defaultValue
|
|
120
156
|
}, item === null || item === void 0 ? void 0 : item.props)));
|
|
121
157
|
}
|
|
122
158
|
if ((item === null || item === void 0 ? void 0 : item.widget) === "select" && (item === null || item === void 0 ? void 0 : item.visible) !== false) {
|
|
123
|
-
var _item$
|
|
159
|
+
var _item$disabled2, _item$showSearch, _item$optionLabelProp;
|
|
124
160
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
125
161
|
name: item === null || item === void 0 ? void 0 : item.name,
|
|
126
162
|
label: item === null || item === void 0 ? void 0 : item.label,
|
|
@@ -130,7 +166,7 @@ function FormWidget(props) {
|
|
|
130
166
|
options: item === null || item === void 0 ? void 0 : item.value,
|
|
131
167
|
placeholder: item === null || item === void 0 ? void 0 : item.placeholder,
|
|
132
168
|
defaultValue: item.defaultValueRequired && (item === null || item === void 0 ? void 0 : item.defaultValue) !== "" ? item === null || item === void 0 ? void 0 : item.defaultValue : undefined,
|
|
133
|
-
disabled: (_item$
|
|
169
|
+
disabled: (_item$disabled2 = item.disabled) !== null && _item$disabled2 !== void 0 ? _item$disabled2 : false
|
|
134
170
|
}, (item === null || item === void 0 ? void 0 : item.onChange) && {
|
|
135
171
|
onChange: value => {
|
|
136
172
|
// Call the original onChange if provided
|
|
@@ -151,20 +187,22 @@ function FormWidget(props) {
|
|
|
151
187
|
},
|
|
152
188
|
showSearch: (_item$showSearch = item === null || item === void 0 ? void 0 : item.showSearch) !== null && _item$showSearch !== void 0 ? _item$showSearch : false,
|
|
153
189
|
filterOption: (input, option) => {
|
|
154
|
-
var _toLowerCase,
|
|
155
|
-
return (_toLowerCase = (
|
|
190
|
+
var _toLowerCase, _ref3, _option$label$props$t, _option$label, _input$toLowerCase;
|
|
191
|
+
return (_toLowerCase = (_ref3 = (_option$label$props$t = option === null || option === void 0 || (_option$label = option.label) === null || _option$label === void 0 || (_option$label = _option$label.props) === null || _option$label === void 0 ? void 0 : _option$label.title) !== null && _option$label$props$t !== void 0 ? _option$label$props$t : "").toLowerCase) === null || _toLowerCase === void 0 || (_toLowerCase = _toLowerCase.call(_ref3)) === null || _toLowerCase === void 0 ? void 0 : _toLowerCase.includes(input === null || input === void 0 || (_input$toLowerCase = input.toLowerCase) === null || _input$toLowerCase === void 0 ? void 0 : _input$toLowerCase.call(input));
|
|
156
192
|
}
|
|
157
193
|
}, item.optionLabelProp && {
|
|
158
194
|
optionLabelProp: (_item$optionLabelProp = item === null || item === void 0 ? void 0 : item.optionLabelProp) !== null && _item$optionLabelProp !== void 0 ? _item$optionLabelProp : ""
|
|
159
195
|
})));
|
|
160
196
|
}
|
|
161
197
|
if ((item === null || item === void 0 ? void 0 : item.widget) === "textArea") {
|
|
198
|
+
var _item$disabled3;
|
|
162
199
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
163
200
|
name: item === null || item === void 0 ? void 0 : item.name,
|
|
164
201
|
label: item === null || item === void 0 ? void 0 : item.label,
|
|
165
202
|
rules: item === null || item === void 0 ? void 0 : item.rules
|
|
166
203
|
}, /*#__PURE__*/_react.default.createElement(_CustomTextArea.default, {
|
|
167
204
|
rows: 4,
|
|
205
|
+
disabled: (_item$disabled3 = item.disabled) !== null && _item$disabled3 !== void 0 ? _item$disabled3 : false,
|
|
168
206
|
placeholder: item === null || item === void 0 ? void 0 : item.placeholder
|
|
169
207
|
}));
|
|
170
208
|
}
|
|
@@ -185,7 +223,7 @@ function FormWidget(props) {
|
|
|
185
223
|
return /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
186
224
|
name: "".concat(item === null || item === void 0 ? void 0 : item.name).concat(index ? index : ""),
|
|
187
225
|
label: renderLabelWithTooltip(item === null || item === void 0 ? void 0 : item.label, item === null || item === void 0 ? void 0 : item.tooltip),
|
|
188
|
-
rules: getFieldRules(item),
|
|
226
|
+
rules: getFieldRules(itemData, item),
|
|
189
227
|
extra: item === null || item === void 0 ? void 0 : item.helpText,
|
|
190
228
|
initialValue: item === null || item === void 0 ? void 0 : item.value
|
|
191
229
|
}, /*#__PURE__*/_react.default.createElement(_CustomInput.default, _extends({}, item === null || item === void 0 ? void 0 : item.props, {
|
|
@@ -198,13 +236,14 @@ function FormWidget(props) {
|
|
|
198
236
|
})));
|
|
199
237
|
}
|
|
200
238
|
if ((item === null || item === void 0 ? void 0 : item.widget) === "checkbox") {
|
|
201
|
-
var _item$rules, _item$className;
|
|
239
|
+
var _item$rules, _item$disabled4, _item$className;
|
|
202
240
|
return /*#__PURE__*/_react.default.createElement(_FormWidgetStyle.BgColorCheckBox, null, /*#__PURE__*/_react.default.createElement(_antd.Form.Item, {
|
|
203
241
|
name: "".concat(item === null || item === void 0 ? void 0 : item.name).concat(index ? index : ""),
|
|
204
242
|
rules: item === null || item === void 0 || (_item$rules = item.rules) === null || _item$rules === void 0 ? void 0 : _item$rules.map(r => (r === null || r === void 0 ? void 0 : r.checkValidator) && (r === null || r === void 0 ? void 0 : r.rule)).filter(Boolean),
|
|
205
243
|
valuePropName: "checked",
|
|
206
244
|
initialValue: item === null || item === void 0 ? void 0 : item.checked
|
|
207
245
|
}, /*#__PURE__*/_react.default.createElement(_CustomCheckBox.default, {
|
|
246
|
+
disabled: (_item$disabled4 = item.disabled) !== null && _item$disabled4 !== void 0 ? _item$disabled4 : false,
|
|
208
247
|
size: "large",
|
|
209
248
|
label: item === null || item === void 0 ? void 0 : item.label,
|
|
210
249
|
className: (_item$className = item === null || item === void 0 ? void 0 : item.className) !== null && _item$className !== void 0 ? _item$className : ""
|
|
@@ -242,7 +281,7 @@ function FormWidget(props) {
|
|
|
242
281
|
}
|
|
243
282
|
};
|
|
244
283
|
const renderWidget = item => {
|
|
245
|
-
var _item$value, _item$value2, _item$value2$map, _item$value3, _item$value4, _item$value5, _item$value6, _item$iconConfig, _item$subType, _item$
|
|
284
|
+
var _item$value, _item$value2, _item$value2$map, _item$value3, _item$value4, _item$value5, _item$value6, _item$iconConfig, _item$subType, _item$disabled5;
|
|
246
285
|
switch (item === null || item === void 0 ? void 0 : item.type) {
|
|
247
286
|
case "simpleList":
|
|
248
287
|
if ((item === null || item === void 0 || (_item$value = item.value) === null || _item$value === void 0 ? void 0 : _item$value.length) === 0) return null;
|
|
@@ -344,7 +383,7 @@ function FormWidget(props) {
|
|
|
344
383
|
}, /*#__PURE__*/_react.default.createElement(_CustomButton.default, _extends({
|
|
345
384
|
type: (_item$subType = item === null || item === void 0 ? void 0 : item.subType) !== null && _item$subType !== void 0 ? _item$subType : "primary",
|
|
346
385
|
label: item === null || item === void 0 ? void 0 : item.label,
|
|
347
|
-
disabled: (_item$
|
|
386
|
+
disabled: (_item$disabled5 = item === null || item === void 0 ? void 0 : item.disabled) !== null && _item$disabled5 !== void 0 ? _item$disabled5 : false,
|
|
348
387
|
onClick: () => {
|
|
349
388
|
if (item !== null && item !== void 0 && item.onClick) {
|
|
350
389
|
item.onClick(item === null || item === void 0 ? void 0 : item.action, item === null || item === void 0 ? void 0 : item.key);
|
|
@@ -456,6 +495,7 @@ function FormWidget(props) {
|
|
|
456
495
|
}
|
|
457
496
|
})), submit && /*#__PURE__*/_react.default.createElement(_antd.Form.Item, null, /*#__PURE__*/_react.default.createElement(_CustomButton.default, {
|
|
458
497
|
type: (_submit$type = submit === null || submit === void 0 ? void 0 : submit.type) !== null && _submit$type !== void 0 ? _submit$type : "primary",
|
|
498
|
+
disabled: (_submit$disabled = submit.disabled) !== null && _submit$disabled !== void 0 ? _submit$disabled : false,
|
|
459
499
|
onClick: () => {
|
|
460
500
|
var _form$validateFields3;
|
|
461
501
|
form === null || form === void 0 || (_form$validateFields3 = form.validateFields()) === null || _form$validateFields3 === void 0 || _form$validateFields3.then(value => {
|