sccoreui 5.9.41 → 5.9.43
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/new-filter/conditions/Conditions.js +3 -3
- package/dist/components/ag-grid/advancedFeature/new-filter/table-filter.js +18 -10
- package/dist/components/ag-grid/advancedFeature/record-detail.js +1 -1
- package/dist/components/ag-grid/constants.js +25 -25
- package/dist/components/ag-grid/context-provider.js +13 -3
- package/dist/components/ag-grid/helper.js +17 -0
- package/dist/components/ag-grid/parent-for-grid.js +10 -3
- package/dist/types/components/ag-grid/Types.d.ts +5 -0
- package/dist/types/components/ag-grid/context-provider.d.ts +3 -0
- package/dist/types/components/ag-grid/helper.d.ts +1 -0
- package/package.json +1 -1
|
@@ -18,10 +18,10 @@ const Condtions = (props) => {
|
|
|
18
18
|
const onRemoveCondtion = (index) => {
|
|
19
19
|
removeConditionFromArray(index);
|
|
20
20
|
};
|
|
21
|
-
const onUpdateColumnName = (
|
|
22
|
-
// setColumnState(
|
|
21
|
+
const onUpdateColumnName = (value) => {
|
|
22
|
+
// setColumnState(value);
|
|
23
23
|
updateconditionsArray({
|
|
24
|
-
columnName:
|
|
24
|
+
columnName: value,
|
|
25
25
|
condition: '',
|
|
26
26
|
value: '',
|
|
27
27
|
id: id
|
|
@@ -12,7 +12,7 @@ const Conditions_1 = tslib_1.__importDefault(require("./conditions/Conditions"))
|
|
|
12
12
|
// import "./TableFilter.module.scss";
|
|
13
13
|
const context_provider_1 = require("../../context-provider");
|
|
14
14
|
const TableFilter = () => {
|
|
15
|
-
const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, } = (0, react_1.useContext)(context_provider_1.FeatureContext);
|
|
15
|
+
const { featureDetails, columnData, conditionType, conditionTypes, globalFilters, setConditionType, setGlobalFilters, setFeatureDetails, callGrid, setViewName, viewName, createView, enableViewCreate } = (0, react_1.useContext)(context_provider_1.FeatureContext);
|
|
16
16
|
const columnId = "field";
|
|
17
17
|
const columnName = "headerName";
|
|
18
18
|
const showFilter = (0, react_1.useRef)(null);
|
|
@@ -20,13 +20,11 @@ const TableFilter = () => {
|
|
|
20
20
|
const [allFieldsFilled, setAllFieldsFilled] = (0, react_1.useState)(false);
|
|
21
21
|
const [enbleApply, setEnbleApply] = (0, react_1.useState)(true);
|
|
22
22
|
const [isOverlayOpened, setIsOverlayOpened] = (0, react_1.useState)(false);
|
|
23
|
+
const [displayInput, setDisplayInput] = (0, react_1.useState)(false);
|
|
23
24
|
const tableColumns = columnData === null || columnData === void 0 ? void 0 : columnData.filter((eachColumn) => eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.isFilterable).map((eachColumn) => ({
|
|
24
25
|
name: eachColumn[columnName],
|
|
25
26
|
code: eachColumn[columnId],
|
|
26
27
|
dataType: eachColumn.dataType,
|
|
27
|
-
type: eachColumn.type,
|
|
28
|
-
key: eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.key,
|
|
29
|
-
options: eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.options,
|
|
30
28
|
}));
|
|
31
29
|
const defaultCondtion = {
|
|
32
30
|
columnName: "",
|
|
@@ -36,7 +34,6 @@ const TableFilter = () => {
|
|
|
36
34
|
isActive: false,
|
|
37
35
|
};
|
|
38
36
|
const applyAdvancedFilter = (array) => {
|
|
39
|
-
setGlobalFilters(array);
|
|
40
37
|
const allQueries = array.map((query) => {
|
|
41
38
|
const column = { field: query.columnName.code };
|
|
42
39
|
const operation = { code: query.condition.code };
|
|
@@ -48,6 +45,7 @@ const TableFilter = () => {
|
|
|
48
45
|
};
|
|
49
46
|
return queryToAdd;
|
|
50
47
|
});
|
|
48
|
+
setGlobalFilters(array);
|
|
51
49
|
const currentFeature = Object.assign({}, featureDetails);
|
|
52
50
|
currentFeature.filterQueries = allQueries;
|
|
53
51
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { filterQueries: allQueries }));
|
|
@@ -81,8 +79,8 @@ const TableFilter = () => {
|
|
|
81
79
|
setConditionsArray(updatedconditionsArray);
|
|
82
80
|
};
|
|
83
81
|
const onApplyFilter = () => {
|
|
84
|
-
|
|
85
|
-
return Object.assign(Object.assign({}, condition), { isActive: true });
|
|
82
|
+
const arr = conditionsArray.map((condition) => {
|
|
83
|
+
return Object.assign(Object.assign({}, condition), { isActive: true, logicalOperator: conditionType.id });
|
|
86
84
|
});
|
|
87
85
|
applyAdvancedFilter(arr);
|
|
88
86
|
setConditionsArray(arr);
|
|
@@ -97,6 +95,17 @@ const TableFilter = () => {
|
|
|
97
95
|
const { columnName, condition, value, id } = conditions;
|
|
98
96
|
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "flex align-items-center justify-content-end" }, { children: (0, jsx_runtime_1.jsx)(Conditions_1.default, { index: key, setEnbleApply: (value) => setEnbleApply(value), id: id, columnName: columnName, condition: condition, conditionType: conditionType, conditionTypes: conditionTypes, value: value, columnsArray: tableColumns, conditionsArray: constants_1.default.conditionsList, handleConditionType: handleConditionType, updateconditionsArray: updateconditionsArray, addEmptyCondition: addEmptyCondition, removeConditionFromArray: removeConditionFromArray, condtionslenght: conditionsArray.length }, key) })));
|
|
99
97
|
};
|
|
98
|
+
const createViewFromFilters = () => {
|
|
99
|
+
const newFilters = conditionsArray.map((condition) => {
|
|
100
|
+
return Object.assign(Object.assign({}, condition), { isActive: true, logicalOperator: conditionType.id });
|
|
101
|
+
});
|
|
102
|
+
const viewDetails = {
|
|
103
|
+
viewName: viewName,
|
|
104
|
+
viewFilter: newFilters
|
|
105
|
+
};
|
|
106
|
+
createView(viewDetails);
|
|
107
|
+
showFilter.current.toggle(false);
|
|
108
|
+
};
|
|
100
109
|
(0, react_1.useEffect)(() => {
|
|
101
110
|
if (conditionsArray.length === 0) {
|
|
102
111
|
setConditionsArray([defaultCondtion]);
|
|
@@ -116,15 +125,14 @@ const TableFilter = () => {
|
|
|
116
125
|
});
|
|
117
126
|
setAllFieldsFilled(isAllFieldsFilled && enbleApply);
|
|
118
127
|
}, [conditionsArray, enbleApply]);
|
|
119
|
-
console.log("filter", (globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1);
|
|
120
128
|
return ((0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `cursor-pointer filter-btn-grid font-semibold sc_icon_hover flex align-items-center gap-2 border-round-lg ${isOverlayOpened ||
|
|
121
129
|
(globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1
|
|
122
130
|
? "bg-primary-50"
|
|
123
131
|
: "bg-white"}` }, { children: [(0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: (e) => onClickFilter(e) }, { children: (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "filter-lines", size: 20, color: isOverlayOpened ||
|
|
124
132
|
(globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length) >= 1
|
|
125
133
|
? "#243DC6"
|
|
126
|
-
: "#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" }, { children: [`${globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length} Selected`, (0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: onresetFilter }, { 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: () => setIsOverlayOpened(false), 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: "Filters" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: "
|
|
134
|
+
: "#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" }, { children: [`${globalFilters === null || globalFilters === void 0 ? void 0 : globalFilters.filter((each) => each.isActive).length} Selected`, (0, jsx_runtime_1.jsx)("span", Object.assign({ onClick: onresetFilter }, { 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: () => { setIsOverlayOpened(false), setDisplayInput(false); }, 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: "Filters" })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "text-sm text-gray-600" }, { children: "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-4" }, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "max-h-14rem\toverflow-auto" }, { children: conditionsArray.map((eachCondition, index) => {
|
|
127
135
|
return ((0, jsx_runtime_1.jsx)("div", { children: renderCondtion(eachCondition, index) }, index));
|
|
128
|
-
}) })) })), (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, { text: true, className: "focus:shadow-none", label: "Reset Filter", onClick: onresetFilter }) }), (0, jsx_runtime_1.
|
|
136
|
+
}) })) })), (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, { text: true, className: "focus:shadow-none", label: "Reset Filter", onClick: onresetFilter }) }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex align-items-center" }, { 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 focus:shadow-none mr-3", label: "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.jsx)("input", { type: "text", onChange: (e) => setViewName(e.target.value) }), displayInput && (0, jsx_runtime_1.jsx)(button_1.Button, Object.assign({ onClick: createViewFromFilters, disabled: !viewName.length }, { children: "Add view" })), (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: "Apply", onClick: onApplyFilter, disabled: !allFieldsFilled })] }))] }))] }) }))] }));
|
|
129
137
|
};
|
|
130
138
|
exports.default = TableFilter;
|
|
@@ -5,6 +5,6 @@ const react_1 = require("react");
|
|
|
5
5
|
const context_provider_1 = require("../context-provider");
|
|
6
6
|
function RecordDetail() {
|
|
7
7
|
const { totalRecords } = (0, react_1.useContext)(context_provider_1.FeatureContext);
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)("div", { children: `Total ${totalRecords}
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: `Total ${totalRecords} records` }));
|
|
9
9
|
}
|
|
10
10
|
exports.default = RecordDetail;
|
|
@@ -193,31 +193,31 @@ const booleanOptions = [
|
|
|
193
193
|
{ id: 2, label: 'False', value: false },
|
|
194
194
|
];
|
|
195
195
|
exports.conditionsList = [
|
|
196
|
-
{ name: "contains all of", datatypes: ["boolean"],
|
|
197
|
-
{ name: "contains any of ", datatypes: ["string"],
|
|
198
|
-
{ name: "doesn’t contain all of ", datatypes: ["boolean"],
|
|
199
|
-
{ name: "doesn’t contain any of", datatypes: ["string"],
|
|
200
|
-
{ name: "ends with any of", datatypes: ["string"],
|
|
201
|
-
{ name: "is after", datatypes: ["date"],
|
|
202
|
-
{ name: "is any of", datatypes: ["boolean"],
|
|
203
|
-
{ name: "is before", datatypes: ["date"],
|
|
204
|
-
{ name: "is between", datatypes: ["integer", "date"],
|
|
205
|
-
{ name: "is (not) equal to", datatypes: ["integer", "date"],
|
|
206
|
-
{ name: "is (not) equal to all of", datatypes: ["boolean"],
|
|
207
|
-
{ name: "is (not) equal to any of", datatypes: ["string"],
|
|
208
|
-
{ name: "is greater than", datatypes: ["integer"],
|
|
209
|
-
{ name: "is greater than or equalto", datatypes: ["integer"],
|
|
210
|
-
{ name: "is known", datatypes: ["boolean", "integer", "string"],
|
|
211
|
-
{ name: "is less than", datatypes: ["integer", "date"],
|
|
212
|
-
{ name: "is less than or equal to", datatypes: ["integer"],
|
|
213
|
-
{ name: "is more than", datatypes: ["integer", "date"],
|
|
214
|
-
{ name: "is none of", datatypes: ["boolean"],
|
|
215
|
-
{ name: "is not between", datatypes: ["integer", "date"],
|
|
216
|
-
{ name: "is unknown", datatypes: ["boolean", "integer", "string"],
|
|
217
|
-
{ name: "starts with any of ", datatypes: ["string"],
|
|
218
|
-
{ name: "is equal to", datatypes: ["integer", "date"],
|
|
219
|
-
{ name: "is equal to all of", datatypes: ["boolean"],
|
|
220
|
-
{ name: "is equal to any of", datatypes: ["string"],
|
|
196
|
+
{ name: "contains all of", datatypes: ["boolean"], value: "1" },
|
|
197
|
+
{ name: "contains any of ", datatypes: ["string"], value: "2" },
|
|
198
|
+
{ name: "doesn’t contain all of ", datatypes: ["boolean"], value: "3" },
|
|
199
|
+
{ name: "doesn’t contain any of", datatypes: ["string"], value: "4" },
|
|
200
|
+
{ name: "ends with any of", datatypes: ["string"], value: "5" },
|
|
201
|
+
{ name: "is after", datatypes: ["date"], value: "6" },
|
|
202
|
+
{ name: "is any of", datatypes: ["boolean"], value: "7" },
|
|
203
|
+
{ name: "is before", datatypes: ["date"], value: "8" },
|
|
204
|
+
{ name: "is between", datatypes: ["integer", "date"], value: "9" },
|
|
205
|
+
{ name: "is (not) equal to", datatypes: ["integer", "date"], value: "10" },
|
|
206
|
+
{ name: "is (not) equal to all of", datatypes: ["boolean"], value: "11" },
|
|
207
|
+
{ name: "is (not) equal to any of", datatypes: ["string"], value: "12" },
|
|
208
|
+
{ name: "is greater than", datatypes: ["integer"], value: "13" },
|
|
209
|
+
{ name: "is greater than or equalto", datatypes: ["integer"], value: "14" },
|
|
210
|
+
{ name: "is known", datatypes: ["boolean", "integer", "string"], value: "15" },
|
|
211
|
+
{ name: "is less than", datatypes: ["integer", "date"], value: "16" },
|
|
212
|
+
{ name: "is less than or equal to", datatypes: ["integer"], value: "17" },
|
|
213
|
+
{ name: "is more than", datatypes: ["integer", "date"], value: "18" },
|
|
214
|
+
{ name: "is none of", datatypes: ["boolean"], value: "19" },
|
|
215
|
+
{ name: "is not between", datatypes: ["integer", "date"], value: "20" },
|
|
216
|
+
{ name: "is unknown", datatypes: ["boolean", "integer", "string"], value: "21" },
|
|
217
|
+
{ name: "starts with any of ", datatypes: ["string"], value: "22" },
|
|
218
|
+
{ name: "is equal to", datatypes: ["integer", "date"], value: "23" },
|
|
219
|
+
{ name: "is equal to all of", datatypes: ["boolean"], value: "24" },
|
|
220
|
+
{ name: "is equal to any of", datatypes: ["string"], value: "25" }
|
|
221
221
|
];
|
|
222
222
|
const toasterStates = {
|
|
223
223
|
success: "success-tick-mark",
|
|
@@ -5,12 +5,13 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
exports.FeatureContext = (0, react_1.createContext)(null);
|
|
7
7
|
function MyProvider({ children, value }) {
|
|
8
|
-
const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature } = value;
|
|
8
|
+
const { featureDetails, setFeatureDetails, gridData, callGrid, totalRecords, initialFeature, defaultFilters, createView, enableViewCreate } = value;
|
|
9
9
|
// States for sort
|
|
10
10
|
const [columnData] = (0, react_1.useState)(gridData === null || gridData === void 0 ? void 0 : gridData.columnData);
|
|
11
11
|
const [sortValue, setSortValue] = (0, react_1.useState)({});
|
|
12
12
|
const [sortBy, setSortBy] = (0, react_1.useState)({});
|
|
13
13
|
const [isOverlayOpened, setIsOverlayOpened] = (0, react_1.useState)(false);
|
|
14
|
+
const [viewName, setViewName] = (0, react_1.useState)("");
|
|
14
15
|
// States for filter
|
|
15
16
|
const [queries, setQueries] = (0, react_1.useState)(() => {
|
|
16
17
|
var _a;
|
|
@@ -19,7 +20,8 @@ function MyProvider({ children, value }) {
|
|
|
19
20
|
return length === 0 ? [0] : Array.from({ length }, (_, index) => index);
|
|
20
21
|
});
|
|
21
22
|
const conditionTypes = [{ id: 1, label: "And" }, { id: 2, label: "OR" }];
|
|
22
|
-
const [conditionType, setConditionType] = (0, react_1.useState)(conditionTypes
|
|
23
|
+
const [conditionType, setConditionType] = (0, react_1.useState)((defaultFilters === null || defaultFilters === void 0 ? void 0 : defaultFilters.logicalOperator) ? conditionTypes.find((item) => item.id === (defaultFilters === null || defaultFilters === void 0 ? void 0 : defaultFilters.logicalOperator)) :
|
|
24
|
+
conditionTypes[0]);
|
|
23
25
|
const [globalFilters, setGlobalFilters] = (0, react_1.useState)([]);
|
|
24
26
|
const [showAsSave, setShowAsSave] = (0, react_1.useState)(false);
|
|
25
27
|
// Function call on click to refresh
|
|
@@ -34,6 +36,10 @@ function MyProvider({ children, value }) {
|
|
|
34
36
|
setSortValue({});
|
|
35
37
|
callGrid(emptyFeatures);
|
|
36
38
|
};
|
|
39
|
+
(0, react_1.useEffect)(() => {
|
|
40
|
+
if (defaultFilters.length)
|
|
41
|
+
setGlobalFilters(defaultFilters);
|
|
42
|
+
}, []);
|
|
37
43
|
return ((0, jsx_runtime_1.jsx)(exports.FeatureContext.Provider, Object.assign({ value: {
|
|
38
44
|
sortValue,
|
|
39
45
|
setSortValue,
|
|
@@ -55,7 +61,11 @@ function MyProvider({ children, value }) {
|
|
|
55
61
|
globalFilters,
|
|
56
62
|
setGlobalFilters,
|
|
57
63
|
showAsSave,
|
|
58
|
-
setShowAsSave
|
|
64
|
+
setShowAsSave,
|
|
65
|
+
setViewName,
|
|
66
|
+
viewName,
|
|
67
|
+
createView,
|
|
68
|
+
enableViewCreate
|
|
59
69
|
} }, { children: children })));
|
|
60
70
|
}
|
|
61
71
|
exports.default = MyProvider;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.applyDefaultFilters = void 0;
|
|
4
|
+
const applyDefaultFilters = (defaultFilters) => {
|
|
5
|
+
console.log(defaultFilters, 'deafult filters');
|
|
6
|
+
const filters = defaultFilters === null || defaultFilters === void 0 ? void 0 : defaultFilters.map((item) => {
|
|
7
|
+
const obj = {
|
|
8
|
+
logicalOperator: item === null || item === void 0 ? void 0 : item.logicalOperator,
|
|
9
|
+
selectedColumn: item === null || item === void 0 ? void 0 : item.columnName,
|
|
10
|
+
selectedOperation: item === null || item === void 0 ? void 0 : item.condition,
|
|
11
|
+
value: item === null || item === void 0 ? void 0 : item.value
|
|
12
|
+
};
|
|
13
|
+
return obj;
|
|
14
|
+
});
|
|
15
|
+
return filters;
|
|
16
|
+
};
|
|
17
|
+
exports.applyDefaultFilters = applyDefaultFilters;
|
|
@@ -10,7 +10,9 @@ const context_provider_1 = tslib_1.__importDefault(require("./context-provider")
|
|
|
10
10
|
const error_ui_1 = tslib_1.__importDefault(require("./error-ui"));
|
|
11
11
|
const constants_1 = require("./constants");
|
|
12
12
|
const loading_component_1 = tslib_1.__importDefault(require("./loading-component"));
|
|
13
|
+
const helper_1 = require("./helper");
|
|
13
14
|
function ParentForGrid(props) {
|
|
15
|
+
var _a;
|
|
14
16
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
15
17
|
rowData: [],
|
|
16
18
|
columnData: props === null || props === void 0 ? void 0 : props.columnData,
|
|
@@ -20,6 +22,7 @@ function ParentForGrid(props) {
|
|
|
20
22
|
const [totalRecords, setTotalRecords] = (0, react_1.useState)(0);
|
|
21
23
|
const [gridReadyEvent, setGridReadyEvent] = (0, react_1.useState)();
|
|
22
24
|
const [defaultSelectedRows, setDefaultSelectedRows] = (0, react_1.useState)([]);
|
|
25
|
+
const [defaultFilters] = (0, react_1.useState)((_a = props === null || props === void 0 ? void 0 : props.defaultFilters) !== null && _a !== void 0 ? _a : []);
|
|
23
26
|
const [emptyResponse] = (0, react_1.useState)({
|
|
24
27
|
totalRecords: 0,
|
|
25
28
|
rowData: [],
|
|
@@ -44,7 +47,7 @@ function ParentForGrid(props) {
|
|
|
44
47
|
};
|
|
45
48
|
const [featureDetails, setFeatureDetails] = (0, react_1.useState)({
|
|
46
49
|
searchedText: "",
|
|
47
|
-
filterQueries: [],
|
|
50
|
+
filterQueries: (props === null || props === void 0 ? void 0 : props.defaultFilters) ? (0, helper_1.applyDefaultFilters)(props === null || props === void 0 ? void 0 : props.defaultFilters) : [],
|
|
48
51
|
sort: {
|
|
49
52
|
isSortable: false,
|
|
50
53
|
columnToSort: {},
|
|
@@ -92,6 +95,7 @@ function ParentForGrid(props) {
|
|
|
92
95
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
93
96
|
}
|
|
94
97
|
};
|
|
98
|
+
// Function to handle header checkbox click event
|
|
95
99
|
const handleHeaderCheckbox = () => {
|
|
96
100
|
const { allBoxChecked } = featureDetails.checkBoxSelection;
|
|
97
101
|
const currentStatus = !allBoxChecked;
|
|
@@ -169,11 +173,11 @@ function ParentForGrid(props) {
|
|
|
169
173
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.INFINITE) {
|
|
170
174
|
const dataSource = {
|
|
171
175
|
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
172
|
-
var
|
|
176
|
+
var _b;
|
|
173
177
|
const startRow = params.startRow;
|
|
174
178
|
const endRow = params.endRow;
|
|
175
179
|
const result = yield getData(startRow, endRow, currentFeatures);
|
|
176
|
-
if (((
|
|
180
|
+
if (((_b = result === null || result === void 0 ? void 0 : result.rowData) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
177
181
|
gridRef.current.api.hideOverlay();
|
|
178
182
|
params.successCallback(result === null || result === void 0 ? void 0 : result.rowData, result === null || result === void 0 ? void 0 : result.actualEndRow);
|
|
179
183
|
}
|
|
@@ -254,6 +258,9 @@ function ParentForGrid(props) {
|
|
|
254
258
|
callGrid,
|
|
255
259
|
totalRecords,
|
|
256
260
|
initialFeature,
|
|
261
|
+
defaultFilters,
|
|
262
|
+
createView: props === null || props === void 0 ? void 0 : props.createView,
|
|
263
|
+
enableViewCreate: props === null || props === void 0 ? void 0 : props.enableViewCreate
|
|
257
264
|
} }, { children: (0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props }) })), (0, jsx_runtime_1.jsx)(AgGrid_1.default, { style: style, gridOptions: gridOptions, onGridReady: onGridReady, gridRef: gridRef })] }) })) }) }));
|
|
258
265
|
}
|
|
259
266
|
exports.default = ParentForGrid;
|
|
@@ -10,6 +10,7 @@ export interface ColumnDef extends ColDef {
|
|
|
10
10
|
enableHeaderCheckbox?: boolean;
|
|
11
11
|
enableChildCheckbox?: boolean;
|
|
12
12
|
options?: any[];
|
|
13
|
+
selectionType?: string;
|
|
13
14
|
}
|
|
14
15
|
export interface Style {
|
|
15
16
|
height: number | string;
|
|
@@ -109,3 +110,7 @@ export interface HeaderCheckboxFlag {
|
|
|
109
110
|
CHECKED: number;
|
|
110
111
|
UNCHECKED: number;
|
|
111
112
|
}
|
|
113
|
+
export interface ViewFilterResponse {
|
|
114
|
+
viewName: string;
|
|
115
|
+
viewFilter: any[];
|
|
116
|
+
}
|
|
@@ -9,6 +9,9 @@ interface MyProviderProps {
|
|
|
9
9
|
callGrid: (featureDetails: Features) => void;
|
|
10
10
|
totalRecords: number;
|
|
11
11
|
initialFeature: Features;
|
|
12
|
+
defaultFilters: any;
|
|
13
|
+
createView: () => void;
|
|
14
|
+
enableViewCreate: boolean;
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
declare function MyProvider({ children, value }: MyProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const applyDefaultFilters: (defaultFilters: any) => any;
|