sccoreui 6.2.48 → 6.2.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/ag-grid/advancedFeature/column-group.js +5 -6
- package/dist/components/ag-grid/advancedFeature/global-search.js +5 -2
- package/dist/components/ag-grid/advancedFeature/new-filter/table-filter.js +38 -18
- package/dist/components/ag-grid/context-provider.js +2 -1
- package/dist/components/ag-grid/parent-for-grid.js +19 -11
- package/dist/components/ag-grid/utilComponents.js +1 -1
- package/dist/types/components/ag-grid/context-provider.d.ts +1 -0
- package/package.json +1 -1
|
@@ -110,8 +110,8 @@ const ColumnGroup = (props) => {
|
|
|
110
110
|
// Update feature details
|
|
111
111
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: initialCheckBoxData }));
|
|
112
112
|
// Log the renderColumns and checkedColumns for debugging
|
|
113
|
-
console.log("Rendering Columns:", renderColumns);
|
|
114
|
-
console.log("Checked Columns:", checkedColumns);
|
|
113
|
+
// console.log("Rendering Columns:", renderColumns);
|
|
114
|
+
// console.log("Checked Columns:", checkedColumns);
|
|
115
115
|
// Deep clone the render columns to avoid mutation
|
|
116
116
|
const columnsData = (0, helper_1.deepClone)(renderColumns);
|
|
117
117
|
// Iterate over the columns to identify grouped and pinned columns
|
|
@@ -146,7 +146,7 @@ const ColumnGroup = (props) => {
|
|
|
146
146
|
if (columnGroupRef === null || columnGroupRef === void 0 ? void 0 : columnGroupRef.current) {
|
|
147
147
|
columnGroupRef.current.hide(e);
|
|
148
148
|
}
|
|
149
|
-
|
|
149
|
+
// Log updated columns for debugging
|
|
150
150
|
};
|
|
151
151
|
// Remove grouping
|
|
152
152
|
const clearListItems = (e) => {
|
|
@@ -157,7 +157,7 @@ const ColumnGroup = (props) => {
|
|
|
157
157
|
if (gridApi) {
|
|
158
158
|
// Use deep copy of `intialColumns` to ensure no unintended mutation
|
|
159
159
|
const clonedInitialColumns = (0, helper_1.deepClone)(intialColumns);
|
|
160
|
-
console.log("clonedInitialColumns", clonedInitialColumns);
|
|
160
|
+
// console.log("clonedInitialColumns", clonedInitialColumns);
|
|
161
161
|
// Update grid's column definitions
|
|
162
162
|
gridApi.current.api.setColumnDefs(clonedInitialColumns);
|
|
163
163
|
gridApi.current.columnApi.setRowGroupColumns([]);
|
|
@@ -173,7 +173,6 @@ const ColumnGroup = (props) => {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
console.log("intialllllll columns", intialColumns);
|
|
177
176
|
const handleHide = () => {
|
|
178
177
|
var _a, _b, _c;
|
|
179
178
|
// Reset the renderColumns when the OverlayPanel is hidden
|
|
@@ -190,7 +189,7 @@ const ColumnGroup = (props) => {
|
|
|
190
189
|
// Deep clone columns from the grid to avoid mutation
|
|
191
190
|
const columnsFromGrid = (_h = (_g = (_f = (_e = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current) === null || _e === void 0 ? void 0 : _e.api) === null || _f === void 0 ? void 0 : _f.columnModel) === null || _g === void 0 ? void 0 : _g.columnDefs) === null || _h === void 0 ? void 0 : _h.map((column) => {
|
|
192
191
|
return Object.assign(Object.assign({}, column), { rowGroup: false }); // Create a shallow copy with `rowGroup` set to false
|
|
193
|
-
});
|
|
192
|
+
}).filter((d) => d.grouping === true || !("grouping" in d));
|
|
194
193
|
// Update state with the cloned columns
|
|
195
194
|
setColumns(columnsFromGrid);
|
|
196
195
|
setRenderColumns(columnsFromGrid);
|
|
@@ -12,14 +12,17 @@ function Search({ searchPlaceHolder }) {
|
|
|
12
12
|
const { featureDetails, setFeatureDetails, rowModelType, gridApi, quickSearch, } = (0, react_1.useContext)(context_provider_1.FeatureContext);
|
|
13
13
|
const [inputValue, deboucedValue, setInputValue] = (0, hooks_1.useDebounce)("", 500);
|
|
14
14
|
(0, react_1.useEffect)(() => {
|
|
15
|
-
var _a, _b;
|
|
15
|
+
var _a, _b, _c;
|
|
16
16
|
if (rowModelType === constants_1.ROWMODELTYPE.CLIENT_SIDE && quickSearch) {
|
|
17
17
|
if (gridApi === null || gridApi === void 0 ? void 0 : gridApi.current) {
|
|
18
18
|
(_a = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _a === void 0 ? void 0 : _a.setGridOption("quickFilterText", deboucedValue);
|
|
19
19
|
const displayedRowCount = (_b = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _b === void 0 ? void 0 : _b.getDisplayedRowCount();
|
|
20
|
-
if (displayedRowCount === 0) {
|
|
20
|
+
if (displayedRowCount === 0 && Boolean(deboucedValue)) {
|
|
21
21
|
gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api.showNoRowsOverlay();
|
|
22
22
|
}
|
|
23
|
+
else if (displayedRowCount > 0) {
|
|
24
|
+
(_c = gridApi === null || gridApi === void 0 ? void 0 : gridApi.current.api) === null || _c === void 0 ? void 0 : _c.hideOverlay();
|
|
25
|
+
}
|
|
23
26
|
}
|
|
24
27
|
}
|
|
25
28
|
else {
|
|
@@ -13,7 +13,7 @@ const svg_component_1 = tslib_1.__importDefault(require("../../../../directives/
|
|
|
13
13
|
const constants_1 = tslib_1.__importDefault(require("../../constants"));
|
|
14
14
|
// import "./TableFilter.module.scss";
|
|
15
15
|
const TableFilter = () => {
|
|
16
|
-
const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, setViewName, viewName, createView, enableViewCreate, filterModelText } = (0, react_1.useContext)(context_provider_1.FeatureContext);
|
|
16
|
+
const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, setViewName, viewName, createView, enableViewCreate, filterModelText, enableAdvancedFilter, gridApi, } = (0, react_1.useContext)(context_provider_1.FeatureContext);
|
|
17
17
|
const columnId = "field";
|
|
18
18
|
const columnName = "headerName";
|
|
19
19
|
const showFilter = (0, react_1.useRef)(null);
|
|
@@ -28,7 +28,7 @@ const TableFilter = () => {
|
|
|
28
28
|
dataType: eachColumn.dataType,
|
|
29
29
|
columnType: eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.columnType,
|
|
30
30
|
options: eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.options,
|
|
31
|
-
attributeType: eachColumn.attributeType ? eachColumn.attributeType : 1
|
|
31
|
+
attributeType: eachColumn.attributeType ? eachColumn.attributeType : 1,
|
|
32
32
|
}));
|
|
33
33
|
const defaultCondition = {
|
|
34
34
|
columnName: "",
|
|
@@ -56,7 +56,9 @@ const TableFilter = () => {
|
|
|
56
56
|
fieldValue: element === null || element === void 0 ? void 0 : element.value.toString(),
|
|
57
57
|
conditionalOperator: element === null || element === void 0 ? void 0 : element.selectedOperation,
|
|
58
58
|
logicalOperator: element.logicalOperator,
|
|
59
|
-
attributeType: ((_d = (_c = element === null || element === void 0 ? void 0 : element.selectedColumn) === null || _c === void 0 ? void 0 : _c.code) === null || _d === void 0 ? void 0 : _d.attributeType)
|
|
59
|
+
attributeType: ((_d = (_c = element === null || element === void 0 ? void 0 : element.selectedColumn) === null || _c === void 0 ? void 0 : _c.code) === null || _d === void 0 ? void 0 : _d.attributeType)
|
|
60
|
+
? (_e = element === null || element === void 0 ? void 0 : element.selectedColumn) === null || _e === void 0 ? void 0 : _e.code.attributeType
|
|
61
|
+
: 1,
|
|
60
62
|
});
|
|
61
63
|
});
|
|
62
64
|
setGlobalFilters(array);
|
|
@@ -71,7 +73,13 @@ const TableFilter = () => {
|
|
|
71
73
|
setConditionType(value);
|
|
72
74
|
};
|
|
73
75
|
const onClickFilter = (event) => {
|
|
74
|
-
|
|
76
|
+
var _a;
|
|
77
|
+
if (enableAdvancedFilter && gridApi.current) {
|
|
78
|
+
(_a = gridApi.current.api) === null || _a === void 0 ? void 0 : _a.showAdvancedFilterBuilder(event);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
showFilter.current.toggle(event);
|
|
82
|
+
}
|
|
75
83
|
};
|
|
76
84
|
const updateconditionsArray = (conditionObj, conditionIndex) => {
|
|
77
85
|
const updatedConditions = conditionsArray.map((eachCondition) => {
|
|
@@ -101,7 +109,6 @@ const TableFilter = () => {
|
|
|
101
109
|
setConditionsArray(arr);
|
|
102
110
|
showFilter.current.toggle(false);
|
|
103
111
|
};
|
|
104
|
-
console.log(conditionsArray);
|
|
105
112
|
const onresetFilter = () => {
|
|
106
113
|
applyAdvancedFilter([]);
|
|
107
114
|
setConditionsArray([defaultCondition]);
|
|
@@ -121,13 +128,12 @@ const TableFilter = () => {
|
|
|
121
128
|
});
|
|
122
129
|
const viewDetails = {
|
|
123
130
|
viewName: viewName,
|
|
124
|
-
viewFilter: newFilters
|
|
131
|
+
viewFilter: newFilters,
|
|
125
132
|
};
|
|
126
133
|
createView(viewDetails);
|
|
127
134
|
showFilter.current.toggle(false);
|
|
128
135
|
};
|
|
129
136
|
const filterLogoToggle = () => {
|
|
130
|
-
console.log('calling filter logo toggle');
|
|
131
137
|
setIsOverlayOpened(false), setDisplayInput(false), setViewName("");
|
|
132
138
|
};
|
|
133
139
|
(0, react_1.useEffect)(() => {
|
|
@@ -146,24 +152,38 @@ const TableFilter = () => {
|
|
|
146
152
|
(0, react_1.useEffect)(() => {
|
|
147
153
|
const isAllFieldsFilled = conditionsArray.every((condition) => {
|
|
148
154
|
if (condition.columnName && condition.condition) {
|
|
149
|
-
return Array.isArray(condition.value)
|
|
155
|
+
return Array.isArray(condition.value)
|
|
156
|
+
? condition.value.length > 0
|
|
157
|
+
: Boolean(condition.value);
|
|
150
158
|
}
|
|
151
159
|
return false;
|
|
152
160
|
});
|
|
153
161
|
setAllFieldsFilled(isAllFieldsFilled && enbleApply);
|
|
154
162
|
}, [conditionsArray, enbleApply]);
|
|
155
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.
|
|
163
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `cursor-pointer filter-btn-grid font-semibold hover:bg-primary-25 sc_icon_hover flex align-items-center gap-2 border-round-lg ${isOverlayOpened ||
|
|
156
164
|
(globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1
|
|
157
165
|
? "bg-primary-50"
|
|
158
|
-
: "bg-white"}` }, { children: (0, jsx_runtime_1.jsxs)("span", Object.assign({ onClick: (e) => onClickFilter(e), className: "flex zoom_animate" }, { children: [(0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "filter-lines", size: 18, color: isOverlayOpened ||
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
+
: "bg-white"}` }, { children: [(0, jsx_runtime_1.jsx)("div", { id: "advancedFilterParent", className: "hidden" }), (0, jsx_runtime_1.jsxs)("span", Object.assign({ onClick: (e) => onClickFilter(e), className: "flex zoom_animate", id: "advance-filter-id" }, { children: [(0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "filter-lines", size: 18, color: isOverlayOpened ||
|
|
167
|
+
(globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1
|
|
168
|
+
? "#243DC6"
|
|
169
|
+
: "#667085" }), (globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1 && ((0, jsx_runtime_1.jsxs)("span", Object.assign({ className: "flex gap-2 align-items-center text-primary-400 pl-2" }, { children: [`${globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length} ${(filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.onSelectedFilter)
|
|
170
|
+
? filterModelText.onSelectedFilter
|
|
171
|
+
: "Selected"}`, (0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: (e) => {
|
|
172
|
+
e.preventDefault();
|
|
173
|
+
e.stopPropagation();
|
|
174
|
+
onresetFilter();
|
|
175
|
+
} }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", size: 18, color: "#243DC6" }) }))] })))] }))] })), (0, jsx_runtime_1.jsx)(overlaypanel_1.OverlayPanel, Object.assign({ ref: showFilter, onShow: () => setIsOverlayOpened(true), onHide: filterLogoToggle, className: "table-filter-overlay" }, { children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-lg font-semibold line-height-3 text-gray-900" }, { children: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.header) ? filterModelText.header : "Filter" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.subHeader)
|
|
176
|
+
? filterModelText.subHeader
|
|
177
|
+
: "Streamline Your Search With Filters" }))] })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "p-2" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "max-h-14rem\toverflow-y-auto overflow-x-hidden flex flex-column gap-1" }, { children: conditionsArray.map((eachCondition, index) => {
|
|
166
178
|
return ((0, jsx_runtime_1.jsx)("div", { children: renderCondition(eachCondition, index) }, index));
|
|
167
|
-
}) })) })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4 flex justify-content-between" }, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(button_1.Button, { outlined: true, className: "focus:shadow-none font-semibold border-none hover:bg-primary-25", label: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.resetFilterAction)
|
|
179
|
+
}) })) })), (0, jsx_runtime_1.jsx)(divider_1.Divider, { className: "w-full p-0 m-0" }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-4 flex justify-content-between" }, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(button_1.Button, { outlined: true, className: "focus:shadow-none font-semibold border-none hover:bg-primary-25", label: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.resetFilterAction)
|
|
180
|
+
? filterModelText.resetFilterAction
|
|
181
|
+
: "Reset Filter", onClick: onresetFilter }) }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center gap-3" }, { children: [!displayInput && enableViewCreate && ((0, jsx_runtime_1.jsx)(button_1.Button, { className: "text-base px-2 font-semibold text-primary-400 flex gap-2 p-1 px-4 flex justify-content-center focus:shadow-none mr-3", label: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.createViewAction)
|
|
182
|
+
? filterModelText.createViewAction
|
|
183
|
+
: "Create view", onClick: () => setDisplayInput(true), disabled: !allFieldsFilled, text: true, iconPos: "left", icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "plus", color: "text-primary-400 mr-2" }) })), displayInput && ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "p-input-icon-left p-input-icon-right w-full" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `p-input-suffix` }, { children: [displayInput && ((0, jsx_runtime_1.jsx)(button_1.Button, { onClick: createViewFromFilters, disabled: !viewName.length, className: "p-0 h-auto mr-2", text: true, icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "check", color: "text-gray-500" }) })), (0, jsx_runtime_1.jsx)(button_1.Button, { onClick: () => setViewName(""), className: "p-0 h-auto", disabled: !viewName.length, text: true, icon: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "x-close", color: "text-gray-500" }) })] })), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { placeholder: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.createViewInputPlaceHolder)
|
|
184
|
+
? filterModelText.createViewInputPlaceHolder
|
|
185
|
+
: "Enter", value: viewName, onChange: (e) => setViewName(e.target.value), className: "text-lg font-normal text-gray-500 hover:text-gray-900 w-full pl-3 pr-60 mr-3" })] }))), (0, jsx_runtime_1.jsx)(button_1.Button, { className: "text-base font-semibold text-gray-600 p-1 focus:shadow-none text-white w-4rem", label: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.applyAction)
|
|
186
|
+
? filterModelText.applyAction
|
|
187
|
+
: "Apply", onClick: onApplyFilter, disabled: !allFieldsFilled })] }))] }))] }) }))] }));
|
|
168
188
|
};
|
|
169
189
|
exports.default = TableFilter;
|
|
@@ -6,7 +6,7 @@ const react_1 = require("react");
|
|
|
6
6
|
const helper_1 = require("./helper");
|
|
7
7
|
exports.FeatureContext = (0, react_1.createContext)(null);
|
|
8
8
|
function MyProvider({ children, value }) {
|
|
9
|
-
const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, createView, enableViewCreate, filterModelText, sortModelText, recordDetailModelText, sidePanelText, sortOptions, filterConditions, clearFilters, setGridData, gridApi, updateColumnsForGrid, enableManageColumnsCallback, columnToRender, selectedGroup, setSelectedGroup, initialCheckBoxData, intialColumns, setIntialColumns, rowModelType, quickSearch, } = value;
|
|
9
|
+
const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, createView, enableViewCreate, filterModelText, sortModelText, recordDetailModelText, sidePanelText, sortOptions, filterConditions, clearFilters, setGridData, gridApi, updateColumnsForGrid, enableManageColumnsCallback, columnToRender, selectedGroup, setSelectedGroup, initialCheckBoxData, intialColumns, setIntialColumns, rowModelType, quickSearch, enableAdvancedFilter, } = value;
|
|
10
10
|
// States for sort
|
|
11
11
|
const [columnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
|
|
12
12
|
const [sortValue, setSortValue] = (0, react_1.useState)({});
|
|
@@ -107,6 +107,7 @@ function MyProvider({ children, value }) {
|
|
|
107
107
|
setIntialColumns,
|
|
108
108
|
rowModelType,
|
|
109
109
|
quickSearch,
|
|
110
|
+
enableAdvancedFilter,
|
|
110
111
|
} }, { children: children })));
|
|
111
112
|
}
|
|
112
113
|
exports.default = MyProvider;
|
|
@@ -22,7 +22,7 @@ function ParentForGrid(props) {
|
|
|
22
22
|
let maxLength = 0;
|
|
23
23
|
// const [style] = useState<Style>(props.style);
|
|
24
24
|
const [api, setApi] = (0, react_1.useState)(null);
|
|
25
|
-
const [totalRecords, setTotalRecords] = (0, react_1.useState)(0);
|
|
25
|
+
const [totalRecords, setTotalRecords] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.rowData) ? props === null || props === void 0 ? void 0 : props.rowData.length : 0);
|
|
26
26
|
const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
|
|
27
27
|
const [intialColumns, setIntialColumns] = (0, react_1.useState)(null);
|
|
28
28
|
const [defaultFilters, setDefaultFilters] = (0, react_1.useState)((props === null || props === void 0 ? void 0 : props.defaultFilters) || []);
|
|
@@ -75,7 +75,6 @@ function ParentForGrid(props) {
|
|
|
75
75
|
sortable: false,
|
|
76
76
|
};
|
|
77
77
|
}, []);
|
|
78
|
-
// console.log("propsssssssss", props)
|
|
79
78
|
// Function to handle header checkbox click event
|
|
80
79
|
const handleHeaderCheckbox = (props) => {
|
|
81
80
|
// get the group and subgroupids
|
|
@@ -95,7 +94,6 @@ function ParentForGrid(props) {
|
|
|
95
94
|
}
|
|
96
95
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
97
96
|
};
|
|
98
|
-
console.log("feature details", featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection);
|
|
99
97
|
// JSX for rendering checkbox in header
|
|
100
98
|
const headerCheckBoxRenderer = (headerDisplayName, HeaderComponent) => {
|
|
101
99
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -146,7 +144,7 @@ function ParentForGrid(props) {
|
|
|
146
144
|
// Gets call onLoad,scroll and whenever any featureDetails changed
|
|
147
145
|
const onGridReady = (params, updatedFeatures) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
148
146
|
var _r, _s;
|
|
149
|
-
setApi(params.api);
|
|
147
|
+
params && setApi(params === null || params === void 0 ? void 0 : params.api);
|
|
150
148
|
setGridReadyEvent(params);
|
|
151
149
|
let currentFeatures = updatedFeatures;
|
|
152
150
|
if (!updatedFeatures) {
|
|
@@ -245,7 +243,7 @@ function ParentForGrid(props) {
|
|
|
245
243
|
(((_c = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _c === void 0 ? void 0 : _c.allBoxChecked) &&
|
|
246
244
|
!((_d = featureDetails === null || featureDetails === void 0 ? void 0 : featureDetails.checkBoxSelection) === null || _d === void 0 ? void 0 : _d.isIndeterminate)), onChange: (e) => onChange(e, params), isIndeterminate: false, shouldRenderOnRight: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.displayCheckboxOnRight }), props.rowGroupHeaderComponent ? ((0, jsx_runtime_1.jsx)(HeaderComponent, { params: params })) : ((_f = params === null || params === void 0 ? void 0 : params.node) === null || _f === void 0 ? void 0 : _f.field)] })));
|
|
247
245
|
}
|
|
248
|
-
return (0, jsx_runtime_1.jsx)(Wrapper, {});
|
|
246
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.rowGroupHeaderComponent ? ((0, jsx_runtime_1.jsx)(HeaderComponent, { params: params })) : ((0, jsx_runtime_1.jsx)(Wrapper, {})) }));
|
|
249
247
|
};
|
|
250
248
|
const GridHeaderComponent = () => {
|
|
251
249
|
if (props === null || props === void 0 ? void 0 : props.GroupHeaderComponent) {
|
|
@@ -291,13 +289,20 @@ function ParentForGrid(props) {
|
|
|
291
289
|
}
|
|
292
290
|
};
|
|
293
291
|
(0, react_1.useEffect)(() => {
|
|
292
|
+
var _a, _b;
|
|
294
293
|
// Initialize `intialColumns` only if it hasn't been set yet
|
|
295
294
|
if (!intialColumns) {
|
|
296
295
|
// Perform a deep copy of the columns array using `JSON.parse(JSON.stringify())`
|
|
297
296
|
const deepCopyOfColumns = (0, helper_1.deepClone)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
|
|
298
297
|
setIntialColumns(deepCopyOfColumns);
|
|
299
298
|
}
|
|
300
|
-
|
|
299
|
+
if (props === null || props === void 0 ? void 0 : props.rowData) {
|
|
300
|
+
setTotalRecords(props === null || props === void 0 ? void 0 : props.rowData.length);
|
|
301
|
+
}
|
|
302
|
+
if (props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) {
|
|
303
|
+
(_b = (_a = props === null || props === void 0 ? void 0 : props.getGridRef) === null || _a === void 0 ? void 0 : _a.current) === null || _b === void 0 ? void 0 : _b.api.setGridOption("advancedFilterParent", document.getElementById("advancedFilterParent"));
|
|
304
|
+
}
|
|
305
|
+
}, [intialColumns, props === null || props === void 0 ? void 0 : props.rowData]);
|
|
301
306
|
(0, react_1.useEffect)(() => {
|
|
302
307
|
if (props === null || props === void 0 ? void 0 : props.getGridRef) {
|
|
303
308
|
props.getGridRef.current = gridRef.current;
|
|
@@ -322,8 +327,11 @@ function ParentForGrid(props) {
|
|
|
322
327
|
api === null || api === void 0 ? void 0 : api.showNoRowsOverlay(); // Show the noRowsOverlayComponent only if no rows or pinned rows are present
|
|
323
328
|
}
|
|
324
329
|
}, [gridData.rowData, props === null || props === void 0 ? void 0 : props.pinnedTopRowData]);
|
|
330
|
+
const popupParent = (0, react_1.useMemo)(() => {
|
|
331
|
+
return document.getElementById("wrapper");
|
|
332
|
+
}, []);
|
|
325
333
|
// Options that grid should have
|
|
326
|
-
const gridOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ columnDefs: (_f = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _f === void 0 ? void 0 : _f.map((column) => {
|
|
334
|
+
const gridOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ columnDefs: (_f = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _f === void 0 ? void 0 : _f.map((column) => {
|
|
327
335
|
var _a, _b;
|
|
328
336
|
if ((column === null || column === void 0 ? void 0 : column.enableChildCheckbox) && (column === null || column === void 0 ? void 0 : column.enableHeaderCheckbox)) {
|
|
329
337
|
return Object.assign(Object.assign({}, column), { headerComponent: (params) => headerCheckBoxRenderer(params === null || params === void 0 ? void 0 : params.displayName, (column === null || column === void 0 ? void 0 : column.headerComponent) && ""), cellRenderer: (params) => (0, utilComponents_1.dataCellRenderer)(params, column, props), cellRendererParams: {
|
|
@@ -340,9 +348,9 @@ function ParentForGrid(props) {
|
|
|
340
348
|
? { domLayout: "autoHeight" }
|
|
341
349
|
: { domLayout: undefined })), ((props === null || props === void 0 ? void 0 : props.dataTypeDefinitions) && {
|
|
342
350
|
dataTypeDefinitions: props === null || props === void 0 ? void 0 : props.dataTypeDefinitions,
|
|
343
|
-
})), ((props === null || props === void 0 ? void 0 : props.treeData) && { treeData: props === null || props === void 0 ? void 0 : props.treeData })), ((props === null || props === void 0 ? void 0 : props.groupDefaultExpanded) && {
|
|
351
|
+
})), { popupParent: popupParent }), ((props === null || props === void 0 ? void 0 : props.treeData) && { treeData: props === null || props === void 0 ? void 0 : props.treeData })), ((props === null || props === void 0 ? void 0 : props.groupDefaultExpanded) && {
|
|
344
352
|
groupDefaultExpanded: props === null || props === void 0 ? void 0 : props.groupDefaultExpanded, // to enable tree data
|
|
345
|
-
})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {}));
|
|
353
|
+
})), ((props === null || props === void 0 ? void 0 : props.onRowClicked) ? { onRowClicked: props === null || props === void 0 ? void 0 : props.onRowClicked } : {})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {}));
|
|
346
354
|
// Fucntion to call the grid
|
|
347
355
|
const callGrid = (featureDetails) => {
|
|
348
356
|
onGridReady(gridReadyEvent, featureDetails);
|
|
@@ -400,7 +408,7 @@ function ParentForGrid(props) {
|
|
|
400
408
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: initialCheckBoxData }));
|
|
401
409
|
}
|
|
402
410
|
}, [props === null || props === void 0 ? void 0 : props.emptyCheckboxStatus]);
|
|
403
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(error_ui_1.default, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ style: { height: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.height, width: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.width }, className:
|
|
411
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)(error_ui_1.default, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ id: "wrapper", style: { height: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.height, width: gridStyle === null || gridStyle === void 0 ? void 0 : gridStyle.width }, className: `ag-grid-container ${(props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) ? "hide-advance-filter" : ""}` }, { children: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(context_provider_1.default, Object.assign({ value: Object.assign({ rowModelType: props.rowModelType, quickSearch: props === null || props === void 0 ? void 0 : props.quickSearch, featureDetails,
|
|
404
412
|
setFeatureDetails,
|
|
405
413
|
gridData,
|
|
406
414
|
callGrid,
|
|
@@ -409,6 +417,6 @@ function ParentForGrid(props) {
|
|
|
409
417
|
defaultFilters, createView: props === null || props === void 0 ? void 0 : props.createView, enableViewCreate: (_k = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _k === void 0 ? void 0 : _k.enableViewCreate, filterModelText: (_l = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _l === void 0 ? void 0 : _l.filterModelText, sortModelText: (_m = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _m === void 0 ? void 0 : _m.sortModelText, recordDetailModelText: (_o = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _o === void 0 ? void 0 : _o.recordDetailModelText, sidePanelText: (_p = props === null || props === void 0 ? void 0 : props.dynamicText) === null || _p === void 0 ? void 0 : _p.sidePanelText, sortOptions: (props === null || props === void 0 ? void 0 : props.sortOptions)
|
|
410
418
|
? props.sortOptions
|
|
411
419
|
: constants_1.COLUMN_SORT_OPTIONS, filterConditions: props === null || props === void 0 ? void 0 : props.filterConditions, clearFilters: props === null || props === void 0 ? void 0 : props.clearFilters, setGridData, gridApi: gridRef, updateColumnsForGrid: props === null || props === void 0 ? void 0 : props.updateColumnsForGrid, enableManageColumnsCallback: props.enableManageColumnsCallback, columnToRender: gridData.columnData, selectedGroup: selectedGroup, setSelectedGroup: setSelectedGroup, initialCheckBoxData: initialCheckBoxData, intialColumns,
|
|
412
|
-
setIntialColumns }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })) }, { children: ((_q = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _q === void 0 ? void 0 : _q.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: gridStyle, gridOptions: gridOptions, onGridReady: (props === null || props === void 0 ? void 0 : props.rowData) ? undefined : onGridReady, gridRef: gridRef })] }) })) }) }));
|
|
420
|
+
setIntialColumns, enableAdvancedFilter: props === null || props === void 0 ? void 0 : props.enableAdvancedFilter }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })) }, { children: ((_q = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _q === void 0 ? void 0 : _q.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: gridStyle, gridOptions: gridOptions, onGridReady: (props === null || props === void 0 ? void 0 : props.rowData) ? undefined : onGridReady, gridRef: gridRef })] }) })) }) }));
|
|
413
421
|
}
|
|
414
422
|
exports.default = ParentForGrid;
|
|
@@ -12,7 +12,7 @@ const dataCellRenderer = (cellRendererParams, column, props) => {
|
|
|
12
12
|
exports.dataCellRenderer = dataCellRenderer;
|
|
13
13
|
//Get this compnent from products
|
|
14
14
|
const GroupHeader = (params) => {
|
|
15
|
-
console.log(params, "params
|
|
15
|
+
console.log(params, "params");
|
|
16
16
|
return (0, jsx_runtime_1.jsx)("p", { children: "My Custom Group" });
|
|
17
17
|
};
|
|
18
18
|
exports.GroupHeader = GroupHeader;
|
|
@@ -31,6 +31,7 @@ interface MyProviderProps {
|
|
|
31
31
|
setIntialColumns: React.Dispatch<React.SetStateAction<any>>;
|
|
32
32
|
rowModelType: string;
|
|
33
33
|
quickSearch?: boolean;
|
|
34
|
+
enableAdvancedFilter?: boolean;
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
37
|
declare function MyProvider({ children, value }: MyProviderProps): import("react/jsx-runtime").JSX.Element;
|