@azrico/reactgrid 1.3.13 → 1.3.14
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/CHANGELOG.md +15 -0
- package/dist/src/views/DataGrid.js +14 -13
- package/package.json +1 -1
- package/src/views/DataGrid.tsx +23 -19
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.3.14](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.3.14) (2023-08-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* DataGridSearchWrapper ([ebf3acf](https://github.com/Azrideus/azrico-reactgrid/commit/ebf3acff5f90c45090fad86be8e83e28744dd9dd))
|
|
11
|
+
* editable can be a function ([6ea857e](https://github.com/Azrideus/azrico-reactgrid/commit/6ea857e4f403d2a334dc5e74065f6b8033277ca4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* DataGridDelayedSizeWrapper actual delayed ([2ddfd2f](https://github.com/Azrideus/azrico-reactgrid/commit/2ddfd2fb58c90bd906e1330f22f0ef7468d34afb))
|
|
17
|
+
* onCellSelectionChange ([95c8f54](https://github.com/Azrideus/azrico-reactgrid/commit/95c8f540e94dde0c7e245fb29fb6afc7172957ec))
|
|
18
|
+
* styling ([9018f75](https://github.com/Azrideus/azrico-reactgrid/commit/9018f7593e253720f751f52855a2d956dfc578ed))
|
|
19
|
+
|
|
5
20
|
### [1.3.13](https://github.com/Azrideus/azrico-reactgrid/compare/v1.2.10...v1.3.13) (2023-08-19)
|
|
6
21
|
|
|
7
22
|
|
|
@@ -282,22 +282,23 @@ function DataGridSearchWrapper(props) {
|
|
|
282
282
|
const [evaluatedDataSource, set_evaluatedDataSource] = _react.default.useState([]);
|
|
283
283
|
const [filteredData, set_filteredData] = _react.default.useState([]);
|
|
284
284
|
const try_search = _react.default.useCallback((0, _lodash.default)((ds, v) => {
|
|
285
|
-
if (!
|
|
286
|
-
set_filteredData(props.dataSource);
|
|
285
|
+
if (!Array.isArray(ds)) {
|
|
287
286
|
return;
|
|
288
287
|
}
|
|
289
|
-
const visibleColumns = props.gridRef.current.visibleColumns;
|
|
290
|
-
const columns_to_search = (0, _object.array_intersection)(props.advancedFilterFields || [], visibleColumns.map(r => r.id));
|
|
291
|
-
const lowerSearchText = v && v.toLowerCase();
|
|
292
288
|
let newData = [];
|
|
293
|
-
if (
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
289
|
+
if (v) {
|
|
290
|
+
const visibleColumns = props.gridRef.current.visibleColumns;
|
|
291
|
+
const columns_to_search = (0, _object.array_intersection)(props.advancedFilterFields || [], visibleColumns.map(r => r.id));
|
|
292
|
+
const lowerSearchText = v && v.toLowerCase();
|
|
293
|
+
if (!lowerSearchText) newData = ds;else newData = ds.filter(p => {
|
|
294
|
+
for (let index = 0; index < columns_to_search.length; index++) {
|
|
295
|
+
const col = columns_to_search[index];
|
|
296
|
+
const v = (p[col] + '').toLowerCase(); // get string value
|
|
297
|
+
if (v && v.indexOf(lowerSearchText) == -1) return false;
|
|
298
|
+
}
|
|
299
|
+
return true;
|
|
300
|
+
});
|
|
301
|
+
} else newData = ds;
|
|
301
302
|
set_filteredData(newData);
|
|
302
303
|
}, 1000), []);
|
|
303
304
|
_react.default.useEffect(() => {
|
package/package.json
CHANGED
package/src/views/DataGrid.tsx
CHANGED
|
@@ -443,29 +443,33 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
|
|
|
443
443
|
|
|
444
444
|
const try_search = React.useCallback(
|
|
445
445
|
debounce((ds, v) => {
|
|
446
|
-
if (!
|
|
447
|
-
set_filteredData(props.dataSource);
|
|
446
|
+
if (!Array.isArray(ds)) {
|
|
448
447
|
return;
|
|
449
448
|
}
|
|
450
|
-
|
|
451
|
-
const columns_to_search: string[] = array_intersection(
|
|
452
|
-
props.advancedFilterFields || [],
|
|
453
|
-
visibleColumns.map((r) => r.id)
|
|
454
|
-
);
|
|
455
|
-
const lowerSearchText = v && v.toLowerCase();
|
|
449
|
+
|
|
456
450
|
let newData: any[] = [];
|
|
457
451
|
|
|
458
|
-
if (
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
452
|
+
if (v) {
|
|
453
|
+
const visibleColumns = props.gridRef.current.visibleColumns;
|
|
454
|
+
const columns_to_search: string[] = array_intersection(
|
|
455
|
+
props.advancedFilterFields || [],
|
|
456
|
+
visibleColumns.map((r) => r.id)
|
|
457
|
+
);
|
|
458
|
+
const lowerSearchText = v && v.toLowerCase();
|
|
459
|
+
|
|
460
|
+
if (!lowerSearchText) newData = ds;
|
|
461
|
+
else
|
|
462
|
+
newData = ds.filter((p) => {
|
|
463
|
+
for (let index = 0; index < columns_to_search.length; index++) {
|
|
464
|
+
const col = columns_to_search[index];
|
|
465
|
+
const v = (p[col] + '').toLowerCase(); // get string value
|
|
466
|
+
|
|
467
|
+
if (v && v.indexOf(lowerSearchText) == -1) return false;
|
|
468
|
+
}
|
|
469
|
+
return true;
|
|
470
|
+
});
|
|
471
|
+
} else newData = ds;
|
|
472
|
+
|
|
469
473
|
set_filteredData(newData);
|
|
470
474
|
}, 1000),
|
|
471
475
|
[]
|