sccoreui 5.8.22 → 5.9.1
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/AgGrid.js +2 -2
- package/dist/components/ag-grid/ParentForGrid.js +37 -25
- package/dist/components/ag-grid/advancedFeature/new-filter/TableFilter.js +8 -10
- package/dist/components/ag-grid/advancedFeature/new-filter/conditions/Conditions.js +0 -8
- package/dist/components/ag-grid/grid-checkbox.js +2 -3
- package/dist/components/ag-grid/loading-component.js +7 -0
- package/dist/types/components/ag-grid/AgGrid.d.ts +2 -1
- package/dist/types/components/ag-grid/Types.d.ts +3 -3
- package/dist/types/components/ag-grid/grid-checkbox.d.ts +1 -1
- package/dist/types/components/ag-grid/loading-component.d.ts +2 -0
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ const infinite_row_model_1 = require("@ag-grid-community/infinite-row-model");
|
|
|
12
12
|
const LicenceKey_1 = require("./LicenceKey");
|
|
13
13
|
core_1.ModuleRegistry.registerModules([client_side_row_model_1.ClientSideRowModelModule, range_selection_1.RangeSelectionModule, infinite_row_model_1.InfiniteRowModelModule]);
|
|
14
14
|
core_2.LicenseManager.setLicenseKey(LicenceKey_1.LICENSEKEY);
|
|
15
|
-
const AgGrid = ({ style, gridOptions, onGridReady }) => {
|
|
16
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ag-theme-quartz ", style: { height: style.height, width: style.width } }, { children: (0, jsx_runtime_1.jsx)(react_1.AgGridReact, Object.assign({ onGridReady: onGridReady, reactiveCustomComponents: true }, gridOptions)) })) }));
|
|
15
|
+
const AgGrid = ({ style, gridOptions, onGridReady, gridRef }) => {
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "ag-theme-quartz ", style: { height: style.height, width: style.width } }, { children: (0, jsx_runtime_1.jsx)(react_1.AgGridReact, Object.assign({ ref: gridRef, onGridReady: onGridReady, reactiveCustomComponents: true }, gridOptions)) })) }));
|
|
17
17
|
};
|
|
18
18
|
exports.default = AgGrid;
|
|
@@ -10,6 +10,7 @@ const MyProvider_1 = tslib_1.__importDefault(require("./MyProvider"));
|
|
|
10
10
|
const error_ui_1 = tslib_1.__importDefault(require("./error-ui"));
|
|
11
11
|
const constants_1 = require("./constants");
|
|
12
12
|
require("./ag-grid.scss");
|
|
13
|
+
const loading_component_1 = tslib_1.__importDefault(require("./loading-component"));
|
|
13
14
|
function ParentForGrid(props) {
|
|
14
15
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
15
16
|
rowData: [],
|
|
@@ -26,9 +27,9 @@ function ParentForGrid(props) {
|
|
|
26
27
|
const [isLoading, setIsLoading] = (0, react_1.useState)(false);
|
|
27
28
|
const [initialCheckBoxData] = (0, react_1.useState)({
|
|
28
29
|
allBoxChecked: false,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
isIndeterminate: false,
|
|
31
|
+
includedRecords: [],
|
|
32
|
+
excludedRecords: [],
|
|
32
33
|
});
|
|
33
34
|
const initialFeature = {
|
|
34
35
|
searchedText: "",
|
|
@@ -52,6 +53,7 @@ function ParentForGrid(props) {
|
|
|
52
53
|
checkBoxSelection: initialCheckBoxData,
|
|
53
54
|
isRemoveClicked: false
|
|
54
55
|
});
|
|
56
|
+
const gridRef = (0, react_1.useRef)(null);
|
|
55
57
|
// Default column specification
|
|
56
58
|
const defaultColDef = (0, react_1.useMemo)(() => {
|
|
57
59
|
return {
|
|
@@ -64,50 +66,50 @@ function ParentForGrid(props) {
|
|
|
64
66
|
}, []);
|
|
65
67
|
// Function to handle checkbox click events
|
|
66
68
|
const handleCheckboxClick = (rowData) => {
|
|
67
|
-
const {
|
|
68
|
-
if (allBoxChecked &&
|
|
69
|
-
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), {
|
|
69
|
+
const { excludedRecords, includedRecords, allBoxChecked } = featureDetails.checkBoxSelection;
|
|
70
|
+
if (allBoxChecked && excludedRecords.includes(rowData)) {
|
|
71
|
+
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: excludedRecords.filter((item) => item !== rowData) });
|
|
70
72
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
71
73
|
return;
|
|
72
74
|
}
|
|
73
75
|
else if (allBoxChecked) {
|
|
74
|
-
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), {
|
|
76
|
+
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { excludedRecords: [...excludedRecords, rowData], isIndeterminate: true });
|
|
75
77
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
80
|
// Logic to handle checkbox click events
|
|
79
|
-
if (
|
|
80
|
-
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), {
|
|
81
|
+
if (includedRecords.includes(rowData)) {
|
|
82
|
+
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { includedRecords: includedRecords.filter((item) => item !== rowData) });
|
|
81
83
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
82
84
|
}
|
|
83
85
|
else {
|
|
84
|
-
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), {
|
|
86
|
+
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { includedRecords: [...includedRecords, rowData] });
|
|
85
87
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
86
88
|
}
|
|
87
89
|
};
|
|
88
90
|
const handleHeaderCheckbox = () => {
|
|
89
91
|
const { allBoxChecked } = featureDetails.checkBoxSelection;
|
|
90
|
-
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { allBoxChecked: !allBoxChecked,
|
|
92
|
+
const checkboxData = Object.assign(Object.assign({}, featureDetails.checkBoxSelection), { allBoxChecked: !allBoxChecked, isIndeterminate: false, includedRecords: [], excludedRecords: [] });
|
|
91
93
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
92
94
|
};
|
|
93
95
|
// JSX for rendering checkbox in header
|
|
94
96
|
const headerCheckBoxRenderer = (params) => {
|
|
95
97
|
const displayName = params === null || params === void 0 ? void 0 : params.displayName;
|
|
96
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: handleHeaderCheckbox,
|
|
98
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { checked: featureDetails.checkBoxSelection.allBoxChecked, onChange: handleHeaderCheckbox, isIndeterminate: featureDetails.checkBoxSelection.isIndeterminate }), (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "px-3" }, { children: displayName }))] })));
|
|
97
99
|
};
|
|
98
100
|
// JSX for rendering checkbox in cells
|
|
99
101
|
const cellCheckBoxRenderer = (params) => {
|
|
100
102
|
const { data } = params;
|
|
101
|
-
const { allBoxChecked,
|
|
103
|
+
const { allBoxChecked, excludedRecords, includedRecords } = featureDetails.checkBoxSelection;
|
|
102
104
|
return ((0, jsx_runtime_1.jsx)(grid_checkbox_1.default, { checked: allBoxChecked
|
|
103
|
-
? !
|
|
104
|
-
:
|
|
105
|
+
? !excludedRecords.includes(data)
|
|
106
|
+
: includedRecords.includes(data), onChange: () => handleCheckboxClick(data), isIndeterminate: false }));
|
|
105
107
|
};
|
|
106
108
|
// Render checkbox as well as initial component/data from props
|
|
107
109
|
const dataCellRenderer = (cellRendererParams, column) => {
|
|
108
110
|
var _a;
|
|
109
111
|
const { initialRenderer, cellCheckBoxRenderer } = cellRendererParams;
|
|
110
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "pr-3" }, { children: cellCheckBoxRenderer(cellRendererParams) })), typeof initialRenderer === "function" ? (initialRenderer(cellRendererParams)) : ((0, jsx_runtime_1.jsx)("div", { children: (_a = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.data) === null || _a === void 0 ? void 0 : _a[column === null || column === void 0 ? void 0 : column.field] }))] })));
|
|
112
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "flex" }, { children: [(0, jsx_runtime_1.jsx)("div", Object.assign({ className: "pr-3 " }, { children: cellCheckBoxRenderer(cellRendererParams) })), typeof initialRenderer === "function" ? (initialRenderer(cellRendererParams)) : ((0, jsx_runtime_1.jsx)("div", { children: (_a = cellRendererParams === null || cellRendererParams === void 0 ? void 0 : cellRendererParams.data) === null || _a === void 0 ? void 0 : _a[column === null || column === void 0 ? void 0 : column.field] }))] })));
|
|
111
113
|
};
|
|
112
114
|
// Callback to products for getting data
|
|
113
115
|
const getData = (startRow, endRow, currentFeatures) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -116,7 +118,8 @@ function ParentForGrid(props) {
|
|
|
116
118
|
}
|
|
117
119
|
const response = yield props.getRowData(startRow, endRow, currentFeatures);
|
|
118
120
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: [] }));
|
|
119
|
-
|
|
121
|
+
// Clear selected checkbox
|
|
122
|
+
// setFeatureDetails((prev: any) => ({ ...prev, checkBoxSelection: initialCheckBoxData }));
|
|
120
123
|
// To identify when to stop the callBack
|
|
121
124
|
// const actualEndRow = startRow + (response?.rowData?.length ?? 0);
|
|
122
125
|
const actualEndRow = response === null || response === void 0 ? void 0 : response.totalRecords;
|
|
@@ -141,13 +144,18 @@ function ParentForGrid(props) {
|
|
|
141
144
|
if (!updatedFeatures) {
|
|
142
145
|
currentFeatures = featureDetails;
|
|
143
146
|
}
|
|
147
|
+
setFeatureDetails(currentFeatures);
|
|
144
148
|
if (props.rowModelType === constants_1.ROWMODELTYPE.CLIENT_SIDE) {
|
|
149
|
+
params.api.setGridOption("rowData", []);
|
|
145
150
|
const result = yield getData(0, 0, currentFeatures);
|
|
146
151
|
if (result.rowData) {
|
|
147
152
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: result.rowData }));
|
|
148
|
-
|
|
153
|
+
gridRef.current.api.hideOverlay();
|
|
149
154
|
params.api.applyTransaction({ add: result.rowData });
|
|
150
155
|
}
|
|
156
|
+
else {
|
|
157
|
+
params.api.applyTransaction({ add: [] });
|
|
158
|
+
}
|
|
151
159
|
}
|
|
152
160
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.INFINITE) {
|
|
153
161
|
const dataSource = {
|
|
@@ -157,16 +165,18 @@ function ParentForGrid(props) {
|
|
|
157
165
|
const endRow = params.endRow;
|
|
158
166
|
const result = yield getData(startRow, endRow, currentFeatures);
|
|
159
167
|
if (((_a = result === null || result === void 0 ? void 0 : result.rowData) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
168
|
+
gridRef.current.api.hideOverlay();
|
|
160
169
|
params.successCallback(result === null || result === void 0 ? void 0 : result.rowData, result === null || result === void 0 ? void 0 : result.actualEndRow);
|
|
161
170
|
}
|
|
162
171
|
else {
|
|
163
|
-
params.
|
|
172
|
+
params.successCallback([], 0);
|
|
173
|
+
gridRef.current.api.showNoRowsOverlay();
|
|
174
|
+
// params.failCallback();
|
|
164
175
|
}
|
|
165
176
|
}),
|
|
166
177
|
};
|
|
167
178
|
params.api.setGridOption("datasource", dataSource);
|
|
168
179
|
}
|
|
169
|
-
setFeatureDetails(currentFeatures);
|
|
170
180
|
setIsLoading(false);
|
|
171
181
|
});
|
|
172
182
|
// Get values when cell edited
|
|
@@ -201,7 +211,9 @@ function ParentForGrid(props) {
|
|
|
201
211
|
pinnedTopRowData: props === null || props === void 0 ? void 0 : props.pinnedTopRowData,
|
|
202
212
|
cacheBlockSize: constants_1.BLOCK_SIZE,
|
|
203
213
|
maxBlocksInCache: constants_1.MAX_BLOCKS,
|
|
204
|
-
blockLoadDebounceMillis: constants_1.DEBOUNCE_INTERVAL,
|
|
214
|
+
blockLoadDebounceMillis: constants_1.DEBOUNCE_INTERVAL,
|
|
215
|
+
noRowsOverlayComponent: props === null || props === void 0 ? void 0 : props.noRowsOverlayComponent,
|
|
216
|
+
loadingOverlayComponent: loading_component_1.default,
|
|
205
217
|
};
|
|
206
218
|
// Fucntion to call the grid
|
|
207
219
|
const callGrid = (featureDetails) => {
|
|
@@ -222,9 +234,9 @@ function ParentForGrid(props) {
|
|
|
222
234
|
// useEffect(() => {
|
|
223
235
|
// setCheckBoxSelection({
|
|
224
236
|
// allBoxChecked: false,
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
//
|
|
237
|
+
// isIndeterminate: false,
|
|
238
|
+
// includedRecords: [],
|
|
239
|
+
// excludedRecords: [],
|
|
228
240
|
// });
|
|
229
241
|
// }, [featureDetails]);
|
|
230
242
|
console.log(isLoading, gridOptions, props === null || props === void 0 ? void 0 : props.pinnedTopRowData, "is loading state");
|
|
@@ -241,6 +253,6 @@ function ParentForGrid(props) {
|
|
|
241
253
|
callGrid,
|
|
242
254
|
totalRecords,
|
|
243
255
|
initialFeature
|
|
244
|
-
} }, { 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 })] }) })) }) }));
|
|
256
|
+
} }, { 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 })] }) })) }) }));
|
|
245
257
|
}
|
|
246
258
|
exports.default = ParentForGrid;
|
|
@@ -21,16 +21,14 @@ const TableFilter = () => {
|
|
|
21
21
|
const [allFieldsFilled, setAllFieldsFilled] = (0, react_1.useState)(false);
|
|
22
22
|
const [enbleApply, setEnbleApply] = (0, react_1.useState)(true);
|
|
23
23
|
const [isOverlayOpened, setIsOverlayOpened] = (0, react_1.useState)(false);
|
|
24
|
-
const tableColumns = columnData === null || columnData === void 0 ? void 0 : columnData.map((eachColumn) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
});
|
|
24
|
+
const tableColumns = columnData === null || columnData === void 0 ? void 0 : columnData.filter((eachColumn) => eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.isFilterable).map((eachColumn) => ({
|
|
25
|
+
name: eachColumn[columnName],
|
|
26
|
+
code: eachColumn[columnId],
|
|
27
|
+
dataType: eachColumn.dataType,
|
|
28
|
+
type: eachColumn.type,
|
|
29
|
+
key: eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.key,
|
|
30
|
+
options: eachColumn === null || eachColumn === void 0 ? void 0 : eachColumn.options,
|
|
31
|
+
}));
|
|
34
32
|
const defaultCondtion = {
|
|
35
33
|
columnName: "",
|
|
36
34
|
condition: "",
|
|
@@ -12,14 +12,6 @@ const calendar_1 = require("primereact/calendar");
|
|
|
12
12
|
const multi_select_dropdown_1 = tslib_1.__importDefault(require("../../../../multi-select-dropdown/multi-select-dropdown"));
|
|
13
13
|
const Condtions = (props) => {
|
|
14
14
|
const { columnName, condition, value, columnsArray, conditionsArray, index, id, setEnbleApply, updateconditionsArray, removeConditionFromArray, addEmptyCondition, condtionslenght, conditionType, conditionTypes, handleConditionType } = props;
|
|
15
|
-
// const [columnState, setColumnState] = useState(columnName);
|
|
16
|
-
// const [condtionState, setConditionState] = useState(condition);
|
|
17
|
-
// const [dynamicFieldState, setDynamicFieldState] = useState(value);
|
|
18
|
-
// useEffect(() => {
|
|
19
|
-
// setColumnState(columnName);
|
|
20
|
-
// setConditionState(condition);
|
|
21
|
-
// setDynamicFieldState(value);
|
|
22
|
-
// }, [columnName, condition, value]);
|
|
23
15
|
const onAddCondtion = (index) => {
|
|
24
16
|
addEmptyCondition(index);
|
|
25
17
|
};
|
|
@@ -4,9 +4,8 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const checkbox_1 = require("primereact/checkbox");
|
|
6
6
|
const svg_component_1 = tslib_1.__importDefault(require("../../directives/svg-component"));
|
|
7
|
-
const GridCheckBOx = ({ checked, onChange,
|
|
8
|
-
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { icon: isInterminate && (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "minus-square" }), onChange: onChange, checked: checked, className: "" })
|
|
7
|
+
const GridCheckBOx = ({ checked, onChange, isIndeterminate }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsx)(checkbox_1.Checkbox, { icon: isIndeterminate && (0, jsx_runtime_1.jsx)(svg_component_1.default, { icon: "minus-square" }), onChange: onChange, checked: checked, className: "" })
|
|
10
9
|
// <input
|
|
11
10
|
// type="checkbox"
|
|
12
11
|
// checked={checked}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
|
+
function LoadingComponent() {
|
|
5
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)("p", Object.assign({ className: "text-red" }, { children: "...Loading" })) }));
|
|
6
|
+
}
|
|
7
|
+
exports.default = LoadingComponent;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "ag-grid-community/styles/ag-grid.css";
|
|
2
2
|
import "ag-grid-community/styles/ag-theme-quartz.css";
|
|
3
|
-
declare const AgGrid: ({ style, gridOptions, onGridReady }: {
|
|
3
|
+
declare const AgGrid: ({ style, gridOptions, onGridReady, gridRef }: {
|
|
4
4
|
style: any;
|
|
5
5
|
gridOptions: any;
|
|
6
6
|
onGridReady: any;
|
|
7
|
+
gridRef: any;
|
|
7
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export default AgGrid;
|
|
@@ -64,9 +64,9 @@ export interface ParentProp {
|
|
|
64
64
|
}
|
|
65
65
|
export interface CheckBoxSelection {
|
|
66
66
|
allBoxChecked: boolean;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
isIndeterminate: boolean;
|
|
68
|
+
includedRecords: any[];
|
|
69
|
+
excludedRecords: any[];
|
|
70
70
|
}
|
|
71
71
|
export declare enum ATTRIBUTEDATATYPES {
|
|
72
72
|
STRING = "string",
|