sccoreui 6.5.25 → 6.5.26
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.
|
@@ -18,7 +18,7 @@ const Conditions = (props) => {
|
|
|
18
18
|
// Filter available conditions based on column data type using fieldOperators
|
|
19
19
|
const filteredConditions = constants_2.default.conditionsList.filter((cond) => cond.fieldOperators.includes(columnName === null || columnName === void 0 ? void 0 : columnName.dataType));
|
|
20
20
|
// Extract numeric value from condition (handles both object and number formats)
|
|
21
|
-
const conditionValue = typeof condition ===
|
|
21
|
+
const conditionValue = typeof condition === "object" ? condition === null || condition === void 0 ? void 0 : condition.value : condition;
|
|
22
22
|
const onAddCondition = (index) => {
|
|
23
23
|
addEmptyCondition(index);
|
|
24
24
|
};
|
|
@@ -102,7 +102,9 @@ const Conditions = (props) => {
|
|
|
102
102
|
}
|
|
103
103
|
// Preview resulting value and block if > 100
|
|
104
104
|
if (key !== ".") {
|
|
105
|
-
const previewValue = currentValue.substring(0, cursorPos) +
|
|
105
|
+
const previewValue = currentValue.substring(0, cursorPos) +
|
|
106
|
+
key +
|
|
107
|
+
currentValue.substring(selEnd);
|
|
106
108
|
if (parseFloat(previewValue) > 100) {
|
|
107
109
|
e.preventDefault();
|
|
108
110
|
return;
|
|
@@ -120,24 +122,168 @@ const Conditions = (props) => {
|
|
|
120
122
|
};
|
|
121
123
|
const renderRangeNumber = (selectedColumn, showError) => {
|
|
122
124
|
const isPercent = (selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.dataType) === Types_1.FilterDataType.PERCENT;
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
+
const isInteger = (selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.dataType) === Types_1.FilterDataType.INTEGER;
|
|
126
|
+
const maxFractionDigits = isInteger ? 0 : 2;
|
|
127
|
+
// ✅ Validate input (allows typing states)
|
|
128
|
+
const validateInput = (val) => {
|
|
129
|
+
if (val === "")
|
|
130
|
+
return val;
|
|
131
|
+
const regex = isInteger
|
|
132
|
+
? /^\d*$/
|
|
133
|
+
: new RegExp(`^\\d*(\\.\\d{0,${maxFractionDigits}})?$`);
|
|
134
|
+
if (!regex.test(val))
|
|
135
|
+
return null;
|
|
136
|
+
// only validate numeric constraints if complete
|
|
137
|
+
if (!val.endsWith(".") && val !== ".") {
|
|
138
|
+
const num = Number(val);
|
|
139
|
+
if (!Number.isNaN(num)) {
|
|
140
|
+
if (num < 0)
|
|
141
|
+
return null;
|
|
142
|
+
if (isPercent && num > 100)
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return val;
|
|
147
|
+
};
|
|
148
|
+
// ✅ Safe conversion
|
|
149
|
+
const toSafeNumber = (val) => {
|
|
150
|
+
if (val === "" || val === "." || val.endsWith(".")) {
|
|
151
|
+
return val;
|
|
152
|
+
}
|
|
153
|
+
const num = Number(val);
|
|
154
|
+
if (!Number.isNaN(num) && Math.abs(num) <= Number.MAX_SAFE_INTEGER) {
|
|
155
|
+
return num;
|
|
156
|
+
}
|
|
157
|
+
return val;
|
|
158
|
+
};
|
|
159
|
+
// ✅ Normalize for comparison
|
|
160
|
+
const normalize = (val) => {
|
|
161
|
+
if (val === null || val === "")
|
|
162
|
+
return null;
|
|
163
|
+
return typeof val === "number" ? val.toString() : val;
|
|
164
|
+
};
|
|
165
|
+
// ✅ Large number safe compare (integers)
|
|
166
|
+
const compareValues = (a, b) => {
|
|
167
|
+
const x = a.replace(/^0+/, "") || "0";
|
|
168
|
+
const y = b.replace(/^0+/, "") || "0";
|
|
169
|
+
if (x.length > y.length)
|
|
170
|
+
return 1;
|
|
171
|
+
if (x.length < y.length)
|
|
172
|
+
return -1;
|
|
173
|
+
if (x > y)
|
|
174
|
+
return 1;
|
|
175
|
+
if (x < y)
|
|
176
|
+
return -1;
|
|
177
|
+
return 0;
|
|
178
|
+
};
|
|
179
|
+
// ✅ Between validation
|
|
180
|
+
const isValidRange = (() => {
|
|
181
|
+
if (!Array.isArray(value))
|
|
182
|
+
return true;
|
|
183
|
+
const [minVal, maxVal] = value;
|
|
184
|
+
if (!minVal || !maxVal)
|
|
185
|
+
return true;
|
|
186
|
+
if (!isInteger) {
|
|
187
|
+
return Number(minVal) <= Number(maxVal);
|
|
188
|
+
}
|
|
189
|
+
return compareValues(normalize(minVal), normalize(maxVal)) <= 0;
|
|
190
|
+
})();
|
|
191
|
+
const rangeInvalid = isValidRange ? "" : "p-invalid";
|
|
192
|
+
// ✅ Change handler
|
|
193
|
+
const handleChange = (index, val) => {
|
|
194
|
+
if (val.length > 20)
|
|
195
|
+
return;
|
|
196
|
+
const validated = validateInput(val);
|
|
197
|
+
if (validated === null)
|
|
198
|
+
return;
|
|
199
|
+
const converted = toSafeNumber(validated);
|
|
200
|
+
const newValue = Array.isArray(value) ? [...value] : [null, null];
|
|
201
|
+
newValue[index] = converted;
|
|
202
|
+
handleDynamicFieldState(newValue);
|
|
203
|
+
};
|
|
204
|
+
// ✅ Blur handler (normalize like ControlledInput)
|
|
205
|
+
const handleBlur = (index) => {
|
|
206
|
+
if (!Array.isArray(value))
|
|
207
|
+
return;
|
|
208
|
+
let val = value[index];
|
|
209
|
+
if (!val || typeof val !== "string")
|
|
210
|
+
return;
|
|
211
|
+
if (val === "." || val === "") {
|
|
212
|
+
const newValue = [...value];
|
|
213
|
+
newValue[index] = null;
|
|
214
|
+
handleDynamicFieldState(newValue);
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
// ✅ if too large → DO NOT convert
|
|
218
|
+
if (val.length > 15) {
|
|
219
|
+
// keep as string (prevents precision loss)
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const num = Number(val);
|
|
223
|
+
if (!Number.isNaN(num)) {
|
|
224
|
+
let formatted = num;
|
|
225
|
+
if (!isInteger) {
|
|
226
|
+
formatted = Number(num.toFixed(maxFractionDigits));
|
|
227
|
+
}
|
|
228
|
+
else {
|
|
229
|
+
formatted = Math.floor(num);
|
|
230
|
+
}
|
|
231
|
+
const newValue = [...value];
|
|
232
|
+
newValue[index] = formatted;
|
|
233
|
+
handleDynamicFieldState(newValue);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
// ✅ Display value
|
|
237
|
+
const getDisplayValue = (val) => {
|
|
238
|
+
if (val === null || val === undefined)
|
|
239
|
+
return "";
|
|
240
|
+
return val.toString();
|
|
241
|
+
};
|
|
242
|
+
// ✅ Keydown validation
|
|
243
|
+
const handleKeyDown = (e) => {
|
|
244
|
+
const allowed = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "Tab"];
|
|
245
|
+
const isDot = e.key === ".";
|
|
246
|
+
if (e.ctrlKey || e.metaKey) {
|
|
125
247
|
return;
|
|
126
|
-
|
|
127
|
-
|
|
248
|
+
}
|
|
249
|
+
if (isDot && e.currentTarget.value.includes(".")) {
|
|
250
|
+
e.preventDefault();
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
if (!/[0-9.]/.test(e.key) && !allowed.includes(e.key)) {
|
|
254
|
+
e.preventDefault();
|
|
255
|
+
}
|
|
128
256
|
};
|
|
129
|
-
|
|
130
|
-
|
|
257
|
+
// ✅ Paste handling (safe)
|
|
258
|
+
const handlePaste = (e) => {
|
|
259
|
+
let pasted = e.clipboardData.getData("text");
|
|
260
|
+
if (!pasted)
|
|
261
|
+
return;
|
|
262
|
+
// ✅ Trim spaces & normalize
|
|
263
|
+
pasted = pasted.trim();
|
|
264
|
+
// ✅ Remove commas (common copy case like 1,000)
|
|
265
|
+
pasted = pasted.replace(/,/g, "");
|
|
266
|
+
// ✅ Allow valid patterns
|
|
267
|
+
const regex = isInteger ? /^\d+$/ : /^\d*(\.\d*)?$/;
|
|
268
|
+
if (!regex.test(pasted)) {
|
|
269
|
+
e.preventDefault();
|
|
131
270
|
return;
|
|
132
|
-
|
|
133
|
-
|
|
271
|
+
}
|
|
272
|
+
// ✅ Validate numeric constraints (only if complete)
|
|
273
|
+
if (!pasted.endsWith(".")) {
|
|
274
|
+
const num = Number(pasted);
|
|
275
|
+
if (!Number.isNaN(num)) {
|
|
276
|
+
if (num < 0 || (isPercent && num > 100)) {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
// ✅ Allow paste
|
|
134
283
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
: ""
|
|
139
|
-
: "";
|
|
140
|
-
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `border-noround-left p-0 col-4 mx-0 focus:shadow-none lh-44 h-44 flex ${showError ? "p-invalid" : ""}` }, { children: [(0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, { disabled: !condition, min: 0, useGrouping: false, max: isPercent ? 100 : Infinity, maxFractionDigits: (selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.dataType) === Types_1.FilterDataType.INTEGER ? 0 : 2, inputClassName: "mx-0 w-full lh-44 h-44", className: `w-7ren border-noround-left lh-44 h-44 border-noround-right dropdown-focus-none ${rangeInvalid} ${showError ? "p-invalid" : ""}`, value: Array.isArray(value) ? value[0] : null, placeholder: "Min", onChange: (event) => handleChange1(event.value), onKeyDown: isPercent ? handlePercentKeyDown : undefined }), (0, jsx_runtime_1.jsx)(inputnumber_1.InputNumber, { disabled: !condition || !(Array.isArray(value) && value[0]), min: 0, useGrouping: false, max: isPercent ? 100 : Infinity, maxFractionDigits: (selectedColumn === null || selectedColumn === void 0 ? void 0 : selectedColumn.dataType) === Types_1.FilterDataType.INTEGER ? 0 : 2, inputClassName: "mx-0 w-full lh-44 h-44", className: `w-7ren border-noround-left lh-44 h-44 dropdown-focus-none ${rangeInvalid} ${showError ? "p-invalid" : ""}`, value: Array.isArray(value) ? value[1] : null, placeholder: "Max", onChange: (event) => handleChange2(event.value), onKeyDown: isPercent ? handlePercentKeyDown : undefined })] })));
|
|
284
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: `border-noround-left w-13rem p-0 col-4 mx-0 flex ${showError ? "p-invalid" : ""}` }, { children: [(0, jsx_runtime_1.jsx)(inputtext_1.InputText, { disabled: !condition, value: getDisplayValue(Array.isArray(value) ? value[0] : ""), placeholder: "Min", onChange: (e) => handleChange(0, e.target.value), onKeyDown: handleKeyDown, onBlur: () => handleBlur(0),
|
|
285
|
+
// onPaste={handlePaste}
|
|
286
|
+
className: `w-6 border-noround-left lh-44 h-44 border-noround-right ${rangeInvalid} ${showError ? "p-invalid" : ""}` }), (0, jsx_runtime_1.jsx)(inputtext_1.InputText, { disabled: !condition || !(Array.isArray(value) && value[0]), value: getDisplayValue(Array.isArray(value) ? value[1] : ""), placeholder: "Max", onChange: (e) => handleChange(1, e.target.value), onKeyDown: handleKeyDown, onBlur: () => handleBlur(1), onPaste: handlePaste, className: `w-6 border-left-none border-noround-left lh-44 h-44 ${rangeInvalid} ${showError ? "p-invalid" : ""}` })] })));
|
|
141
287
|
};
|
|
142
288
|
const renderListStringChips = (showError) => ((0, jsx_runtime_1.jsx)(chips_1.Chips, { value: value, type: "", disabled: !condition, className: `table_filters_1 border-noround-left col-4 focus:shadow-none lh-44 h-44 chip_comp flex align-items-center ${showError ? "p-invalid" : ""}`, onChange: (e) => handleDynamicFieldState(e.target.value), placeholder: "Enter tags", separator: "," }));
|
|
143
289
|
const renderListNumberChips = (selectedColumn, showError) => {
|
|
@@ -281,7 +427,11 @@ const Conditions = (props) => {
|
|
|
281
427
|
: convertDateToISO(val);
|
|
282
428
|
handleDynamicFieldState(valueString);
|
|
283
429
|
};
|
|
284
|
-
const selectionMode = spec.kind === "Range"
|
|
430
|
+
const selectionMode = spec.kind === "Range"
|
|
431
|
+
? "range"
|
|
432
|
+
: spec.kind === "List"
|
|
433
|
+
? "multiple"
|
|
434
|
+
: "single";
|
|
285
435
|
const isArrayMode = spec.kind === "Range" || spec.kind === "List";
|
|
286
436
|
return ((0, jsx_runtime_1.jsx)(calendar_1.Calendar, { readOnlyInput: true, showTime: false, disabled: !condition, selectionMode: selectionMode, placeholder: (filterModelText === null || filterModelText === void 0 ? void 0 : filterModelText.elementThreePlaceHolder_Calender)
|
|
287
437
|
? filterModelText.elementThreePlaceHolder_Calender
|
|
@@ -68,10 +68,29 @@ const TableFilter = () => {
|
|
|
68
68
|
*/
|
|
69
69
|
const validateNumberValue = (value, condition) => {
|
|
70
70
|
if (isBetweenCondition(condition)) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const normalize = (val) => {
|
|
72
|
+
if (val === null || val === "")
|
|
73
|
+
return null;
|
|
74
|
+
return typeof val === "number" ? val.toString() : val;
|
|
75
|
+
};
|
|
76
|
+
const compareValues = (a, b) => {
|
|
77
|
+
if (a === null || a === undefined)
|
|
78
|
+
return -1;
|
|
79
|
+
if (b === null || b === undefined)
|
|
80
|
+
return 1;
|
|
81
|
+
const x = a.toString().replace(/^0+/, "") || "0";
|
|
82
|
+
const y = b.toString().replace(/^0+/, "") || "0";
|
|
83
|
+
if (x.length > y.length)
|
|
84
|
+
return 1;
|
|
85
|
+
if (x.length < y.length)
|
|
86
|
+
return -1;
|
|
87
|
+
if (x > y)
|
|
88
|
+
return 1;
|
|
89
|
+
if (x < y)
|
|
90
|
+
return -1;
|
|
91
|
+
return 0;
|
|
92
|
+
};
|
|
93
|
+
return (compareValues(normalize((value === null || value === void 0 ? void 0 : value[0]) || null), normalize((value === null || value === void 0 ? void 0 : value[1]) || null)) <= 0);
|
|
75
94
|
}
|
|
76
95
|
if (isAnyOrNoneOf(condition)) {
|
|
77
96
|
return (Array.isArray(value) &&
|
|
@@ -206,7 +225,7 @@ const TableFilter = () => {
|
|
|
206
225
|
/**
|
|
207
226
|
* Apply filter conditions to the grid
|
|
208
227
|
*/
|
|
209
|
-
const applyAdvancedFilter = (array) => {
|
|
228
|
+
const applyAdvancedFilter = (array, rest) => {
|
|
210
229
|
const allQueries = array.map((query) => {
|
|
211
230
|
const column = { code: query.columnName };
|
|
212
231
|
const operation = query.condition;
|
|
@@ -221,7 +240,7 @@ const TableFilter = () => {
|
|
|
221
240
|
const currentFeature = Object.assign({}, featureDetails);
|
|
222
241
|
currentFeature.filterQueries = allQueries;
|
|
223
242
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { filterQueries: allQueries }));
|
|
224
|
-
callGrid(currentFeature);
|
|
243
|
+
!rest && callGrid(currentFeature);
|
|
225
244
|
return [];
|
|
226
245
|
};
|
|
227
246
|
/**
|
|
@@ -286,7 +305,7 @@ const TableFilter = () => {
|
|
|
286
305
|
* Reset all filters to default state
|
|
287
306
|
*/
|
|
288
307
|
const onResetFilter = (formSetter) => {
|
|
289
|
-
applyAdvancedFilter([]);
|
|
308
|
+
applyAdvancedFilter([], true);
|
|
290
309
|
const newDefault = Object.assign(Object.assign({}, defaultCondition), { id: Math.random().toString() });
|
|
291
310
|
setConditionsArray([newDefault]);
|
|
292
311
|
setViewName("");
|
|
@@ -28,13 +28,16 @@ const INITIAL_CHECKBOX_DATA = {
|
|
|
28
28
|
};
|
|
29
29
|
function ParentForGrid(props) {
|
|
30
30
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
31
|
-
const { gridProps = {}, gridViewTemplate, selectColumns = () => { }, enableCheckboxForGroupHeader = false, serverSideSelectRow, blockSize, renderSelectField, renderMultiSelectField } = props;
|
|
31
|
+
const { gridProps = {}, gridViewTemplate, selectColumns = () => { }, enableCheckboxForGroupHeader = false, serverSideSelectRow, blockSize, renderSelectField, renderMultiSelectField, } = props;
|
|
32
32
|
const effectiveBlockSize = blockSize || constants_1.BLOCK_SIZE;
|
|
33
33
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
34
34
|
rowData: (props === null || props === void 0 ? void 0 : props.rowData) || [],
|
|
35
35
|
columnData: (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData),
|
|
36
36
|
});
|
|
37
|
-
const [gridViewData, setGridViewData] = (0, react_1.useState)({
|
|
37
|
+
const [gridViewData, setGridViewData] = (0, react_1.useState)({
|
|
38
|
+
rowData: [],
|
|
39
|
+
searchText: "",
|
|
40
|
+
});
|
|
38
41
|
const [gridView, setGridView] = (0, react_1.useState)(false);
|
|
39
42
|
const [isDataLoading, setIsDataLoading] = (0, react_1.useState)(false);
|
|
40
43
|
// const [style] = useState<Style>(props.style);
|
|
@@ -135,7 +138,8 @@ function ParentForGrid(props) {
|
|
|
135
138
|
else {
|
|
136
139
|
setSelectedGroup([]);
|
|
137
140
|
}
|
|
138
|
-
selectColumns &&
|
|
141
|
+
selectColumns &&
|
|
142
|
+
selectColumns(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
139
143
|
serverSideRowLeveSelection(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
140
144
|
setFeatureDetails(Object.assign(Object.assign({}, featureDetails), { checkBoxSelection: checkboxData }));
|
|
141
145
|
};
|
|
@@ -168,7 +172,7 @@ function ParentForGrid(props) {
|
|
|
168
172
|
setIsDataLoading(true);
|
|
169
173
|
try {
|
|
170
174
|
const response = yield (props === null || props === void 0 ? void 0 : props.getRowData(startRow, endRow, currentFeatures, params));
|
|
171
|
-
setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: [] })));
|
|
175
|
+
setGridData((prev) => (Object.assign(Object.assign({}, prev), { rowData: [] })));
|
|
172
176
|
// To identify when to stop the callBack
|
|
173
177
|
const actualEndRow = (response === null || response === void 0 ? void 0 : response.totalRecords) < constants_1.MAX_RECORDS_TO_LOAD
|
|
174
178
|
? response === null || response === void 0 ? void 0 : response.totalRecords
|
|
@@ -205,10 +209,16 @@ function ParentForGrid(props) {
|
|
|
205
209
|
}
|
|
206
210
|
(_k = (_j = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) === null || _j === void 0 ? void 0 : _j.api) === null || _k === void 0 ? void 0 : _k.showLoadingOverlay();
|
|
207
211
|
params && ((_l = params === null || params === void 0 ? void 0 : params.api) === null || _l === void 0 ? void 0 : _l.setGridOption("rowData", []));
|
|
208
|
-
const result = gridViewData.rowData.length > 0
|
|
212
|
+
const result = gridViewData.rowData.length > 0
|
|
213
|
+
? {
|
|
214
|
+
rowData: gridViewData.rowData,
|
|
215
|
+
totalRecords: gridViewData.rowData.length,
|
|
216
|
+
}
|
|
217
|
+
: yield getData(0, 0, currentFeatures);
|
|
209
218
|
if (((_m = result.rowData) === null || _m === void 0 ? void 0 : _m.length) > 0) {
|
|
210
|
-
gridViewData.rowData.length > 0 &&
|
|
211
|
-
|
|
219
|
+
gridViewData.rowData.length > 0 &&
|
|
220
|
+
setGridViewData({ rowData: [], searchText: "" });
|
|
221
|
+
setGridData((prev) => (Object.assign(Object.assign({}, prev), { rowData: result.rowData })));
|
|
212
222
|
gridRef.current && gridRef.current.api.hideOverlay();
|
|
213
223
|
params && ((_o = params === null || params === void 0 ? void 0 : params.api) === null || _o === void 0 ? void 0 : _o.applyTransaction({ add: result.rowData }));
|
|
214
224
|
}
|
|
@@ -228,10 +238,14 @@ function ParentForGrid(props) {
|
|
|
228
238
|
const response = yield getData(startRow, endRow, currentFeatures, params);
|
|
229
239
|
// simulating real server call with a 500ms delay
|
|
230
240
|
if (((_q = response.rowData) === null || _q === void 0 ? void 0 : _q.length) > 0) {
|
|
231
|
-
setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: response.rowData })));
|
|
241
|
+
setGridData((prev) => (Object.assign(Object.assign({}, prev), { rowData: response.rowData })));
|
|
232
242
|
gridRef.current.api.hideOverlay();
|
|
233
243
|
// supply rows for requested block to grid
|
|
234
|
-
params &&
|
|
244
|
+
params &&
|
|
245
|
+
params.success({
|
|
246
|
+
rowData: response.rowData,
|
|
247
|
+
rowCount: response.actualEndRow,
|
|
248
|
+
});
|
|
235
249
|
return;
|
|
236
250
|
}
|
|
237
251
|
else {
|
|
@@ -320,8 +334,7 @@ function ParentForGrid(props) {
|
|
|
320
334
|
GridHeaderComponent, // Header component
|
|
321
335
|
headerCheckBoxRenderer, //
|
|
322
336
|
enableCheckboxForGroupHeader, ((_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.displayGroupCount) || false, parseInt(props === null || props === void 0 ? void 0 : props.rowGroupColumnWidth), // for grouped column width
|
|
323
|
-
cellRendererConditionally, GroupHeaderRenderer
|
|
324
|
-
);
|
|
337
|
+
cellRendererConditionally, GroupHeaderRenderer);
|
|
325
338
|
}
|
|
326
339
|
else {
|
|
327
340
|
return (0, helper_1.autoGroupColumnDef)((props === null || props === void 0 ? void 0 : props.enableTree) ? true : false, // If tree enable
|
|
@@ -330,8 +343,7 @@ function ParentForGrid(props) {
|
|
|
330
343
|
GridHeaderComponent, // Header component
|
|
331
344
|
headerCheckBoxRenderer, //
|
|
332
345
|
enableCheckboxForGroupHeader, ((_c = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _c === void 0 ? void 0 : _c.displayGroupCount) || false, parseInt(props === null || props === void 0 ? void 0 : props.rowGroupColumnWidth), // for grouped column width
|
|
333
|
-
GroupHeaderRenderer
|
|
334
|
-
);
|
|
346
|
+
GroupHeaderRenderer);
|
|
335
347
|
}
|
|
336
348
|
};
|
|
337
349
|
(0, react_1.useEffect)(() => {
|
|
@@ -344,7 +356,7 @@ function ParentForGrid(props) {
|
|
|
344
356
|
}
|
|
345
357
|
if (props === null || props === void 0 ? void 0 : props.rowData) {
|
|
346
358
|
setTotalRecords(props === null || props === void 0 ? void 0 : props.rowData.length);
|
|
347
|
-
setGridData(prev => (Object.assign(Object.assign({}, prev), { rowData: props.rowData })));
|
|
359
|
+
setGridData((prev) => (Object.assign(Object.assign({}, prev), { rowData: props.rowData })));
|
|
348
360
|
}
|
|
349
361
|
if (props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) {
|
|
350
362
|
(_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"));
|
|
@@ -357,10 +369,16 @@ function ParentForGrid(props) {
|
|
|
357
369
|
}, [props === null || props === void 0 ? void 0 : props.getGridRef]);
|
|
358
370
|
const gridStyle = (0, react_1.useMemo)(() => {
|
|
359
371
|
var _a, _b, _c;
|
|
360
|
-
return (Object.assign({ width: (_a = props === null || props === void 0 ? void 0 : props.style) === null || _a === void 0 ? void 0 : _a.width }, (totalRecords > constants_1.AUTO_HEIGHT_ROWS ||
|
|
372
|
+
return (Object.assign({ width: (_a = props === null || props === void 0 ? void 0 : props.style) === null || _a === void 0 ? void 0 : _a.width }, (totalRecords > constants_1.AUTO_HEIGHT_ROWS ||
|
|
373
|
+
!((_b = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _b === void 0 ? void 0 : _b.isGridAutoHeight)
|
|
361
374
|
? { height: (_c = props === null || props === void 0 ? void 0 : props.style) === null || _c === void 0 ? void 0 : _c.height }
|
|
362
375
|
: null)));
|
|
363
|
-
}, [
|
|
376
|
+
}, [
|
|
377
|
+
(_a = props === null || props === void 0 ? void 0 : props.style) === null || _a === void 0 ? void 0 : _a.width,
|
|
378
|
+
(_b = props === null || props === void 0 ? void 0 : props.style) === null || _b === void 0 ? void 0 : _b.height,
|
|
379
|
+
totalRecords,
|
|
380
|
+
(_c = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _c === void 0 ? void 0 : _c.isGridAutoHeight,
|
|
381
|
+
]);
|
|
364
382
|
// Dont show hide overlay component when any row pinned
|
|
365
383
|
// useEffect(() => {
|
|
366
384
|
// if (!props?.pinnedTopRowData) return;
|
|
@@ -399,7 +417,10 @@ function ParentForGrid(props) {
|
|
|
399
417
|
}
|
|
400
418
|
}), autoGroupColumnDef: (props === null || props === void 0 ? void 0 : props.autoGroupColumnDef)
|
|
401
419
|
? props === null || props === void 0 ? void 0 : props.autoGroupColumnDef
|
|
402
|
-
: manageColumnGrouping(), treeData: (props === null || props === void 0 ? void 0 : props.enableTree) ? props === null || props === void 0 ? void 0 : props.enableTree : false, getDataPath: (props === null || props === void 0 ? void 0 : props.enableTree) ? getDataPath : null, defaultColDef: defaultColDef, suppressMenuHide: false, suppressRowClickSelection: false, headerHeight: props === null || props === void 0 ? void 0 : props.columnHeaderHeight, rowHeight: constants_1.ROW_HEIGHT, rowModelType: props.rowModelType, pinnedTopRowData: props === null || props === void 0 ? void 0 : props.pinnedTopRowData }, (props.rowModelType === (constants_1.ROWMODELTYPE === null || constants_1.ROWMODELTYPE === void 0 ? void 0 : constants_1.ROWMODELTYPE.SERVER_SIDE) && {
|
|
420
|
+
: manageColumnGrouping(), treeData: (props === null || props === void 0 ? void 0 : props.enableTree) ? props === null || props === void 0 ? void 0 : props.enableTree : false, getDataPath: (props === null || props === void 0 ? void 0 : props.enableTree) ? getDataPath : null, defaultColDef: defaultColDef, suppressMenuHide: false, suppressRowClickSelection: false, headerHeight: props === null || props === void 0 ? void 0 : props.columnHeaderHeight, rowHeight: constants_1.ROW_HEIGHT, rowModelType: props.rowModelType, pinnedTopRowData: props === null || props === void 0 ? void 0 : props.pinnedTopRowData }, (props.rowModelType === (constants_1.ROWMODELTYPE === null || constants_1.ROWMODELTYPE === void 0 ? void 0 : constants_1.ROWMODELTYPE.SERVER_SIDE) && {
|
|
421
|
+
cacheBlockSize: effectiveBlockSize,
|
|
422
|
+
})), { maxBlocksInCache: effectiveBlockSize, blockLoadDebounceMillis: constants_1.DEBOUNCE_INTERVAL, noRowsOverlayComponent: props === null || props === void 0 ? void 0 : props.noRowsOverlayComponent, loadingOverlayComponent: loading_component_1.default, suppressCellFocus: true, suppressPropertyNamesCheck: true, suppressServerSideFullWidthLoadingRow: true, enableRangeSelection: (_e = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _e === void 0 ? void 0 : _e.enableFillHandle, enableFillHandle: (_f = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _f === void 0 ? void 0 : _f.enableFillHandle, onFillEnd: wrapperToFillOpertation, fillOperation: myOpertaion, serverSideInitialRowCount: (props === null || props === void 0 ? void 0 : props.serverSideInitialRowCount) || 10, getRowId: getRowId, enableAdvancedFilter: (props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) || false, fillHandleDirection: "y" }), ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })), (totalRecords <= constants_1.AUTO_HEIGHT_ROWS &&
|
|
423
|
+
((_g = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _g === void 0 ? void 0 : _g.isGridAutoHeight)
|
|
403
424
|
? { domLayout: "autoHeight" }
|
|
404
425
|
: { domLayout: "normal" })), ((props === null || props === void 0 ? void 0 : props.dataTypeDefinitions) && {
|
|
405
426
|
dataTypeDefinitions: props === null || props === void 0 ? void 0 : props.dataTypeDefinitions,
|
|
@@ -538,8 +559,14 @@ function ParentForGrid(props) {
|
|
|
538
559
|
}, [
|
|
539
560
|
props.rowModelType,
|
|
540
561
|
props === null || props === void 0 ? void 0 : props.quickSearch,
|
|
541
|
-
featureDetails,
|
|
542
|
-
|
|
562
|
+
featureDetails,
|
|
563
|
+
gridData,
|
|
564
|
+
callGrid,
|
|
565
|
+
totalRecords,
|
|
566
|
+
initialFeature,
|
|
567
|
+
defaultFilters,
|
|
568
|
+
defaultSearchText,
|
|
569
|
+
defaultSort,
|
|
543
570
|
props === null || props === void 0 ? void 0 : props.createView,
|
|
544
571
|
props === null || props === void 0 ? void 0 : props.conditionsToDisplay,
|
|
545
572
|
props === null || props === void 0 ? void 0 : props.dynamicText,
|
|
@@ -548,15 +575,21 @@ function ParentForGrid(props) {
|
|
|
548
575
|
props === null || props === void 0 ? void 0 : props.clearFilters,
|
|
549
576
|
props === null || props === void 0 ? void 0 : props.onFiltersCleared,
|
|
550
577
|
props === null || props === void 0 ? void 0 : props.updateColumnsForGrid,
|
|
551
|
-
props.enableManageColumnsCallback,
|
|
552
|
-
|
|
578
|
+
props.enableManageColumnsCallback,
|
|
579
|
+
selectedGroup,
|
|
580
|
+
initialCheckBoxData,
|
|
581
|
+
intialColumns,
|
|
582
|
+
gridViewFun,
|
|
583
|
+
gridViewData,
|
|
584
|
+
gridView,
|
|
553
585
|
props === null || props === void 0 ? void 0 : props.enableAdvancedFilter,
|
|
554
586
|
props === null || props === void 0 ? void 0 : props.rowData,
|
|
555
587
|
props.serverSideSelectRow,
|
|
556
588
|
props === null || props === void 0 ? void 0 : props.defaultViewName,
|
|
557
589
|
isDataLoading,
|
|
558
|
-
renderSelectField,
|
|
590
|
+
renderSelectField,
|
|
591
|
+
renderMultiSelectField,
|
|
559
592
|
]);
|
|
560
|
-
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 ag-grid-parent-div ${(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: contextValue }, { children: ((_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), gridView ? (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: gridViewTemplate(gridViewData) }) : (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 })] }) })) }) }));
|
|
593
|
+
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 ag-grid-parent-div ${(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: contextValue }, { children: ((_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.displayFeaturesHeader) && ((0, jsx_runtime_1.jsx)(advanced_feature_1.default, { props: props })) })), gridView ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: gridViewTemplate(gridViewData) })) : ((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 }))] }) })) }) }));
|
|
561
594
|
}
|
|
562
595
|
exports.default = ParentForGrid;
|