@azrico/reactgrid 1.3.21 → 1.3.23

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.
@@ -291,26 +291,26 @@ function DataGridSearchWrapper(props) {
291
291
  const visibleColumns = props.gridRef.current.visibleColumns;
292
292
  const columns_to_search = (0, _object.array_intersection)(props.advancedFilterFields || [], visibleColumns.map(r => r.id));
293
293
  const lowerSearchText = currentSearch.current.toLowerCase().trim();
294
- console.log('cols:', columns_to_search);
295
294
  console.log('s:', lowerSearchText);
296
- if (!lowerSearchText) newData = currentDS.current;else newData = currentDS.current.filter(p => {
297
- for (let index = 0; index < columns_to_search.length; index++) {
298
- const col = columns_to_search[index];
299
- const v = (p[col] + '').toLowerCase(); // get string value
300
- if (v && v.indexOf(lowerSearchText) == -1) return false;
301
- }
302
- return true;
303
- });
295
+ if (!lowerSearchText) newData = currentDS.current;else {
296
+ newData = currentDS.current.filter(p => {
297
+ for (let index = 0; index < columns_to_search.length; index++) {
298
+ const col = columns_to_search[index];
299
+ const v = (p[col] + '').toLowerCase(); //value of column
300
+ console.log('v:', v);
301
+ if (v && v.indexOf(lowerSearchText) == -1) return false;
302
+ }
303
+ return true;
304
+ });
305
+ }
304
306
  } else newData = currentDS.current;
305
307
  console.log('newData:', newData.length);
306
308
  set_filteredData(newData);
307
309
  }, 1000), []);
308
310
  _react.default.useEffect(() => {
309
311
  set_search('');
310
- (0, _object.fn_eval)(props.dataSource).then(({
311
- data
312
- }) => {
313
- currentDS.current = data;
312
+ (0, _object.fn_eval)(props.dataSource).then(r => {
313
+ currentDS.current = typeof r === 'object' ? r.data || r : r;
314
314
  searchIfNeeded();
315
315
  });
316
316
  }, [props.dataSource]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.21",
3
+ "version": "1.3.23",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -455,19 +455,19 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
455
455
  visibleColumns.map((r) => r.id)
456
456
  );
457
457
  const lowerSearchText = currentSearch.current.toLowerCase().trim();
458
- console.log('cols:', columns_to_search);
459
458
  console.log('s:', lowerSearchText);
460
459
  if (!lowerSearchText) newData = currentDS.current;
461
- else
460
+ else {
462
461
  newData = currentDS.current.filter((p) => {
463
462
  for (let index = 0; index < columns_to_search.length; index++) {
464
463
  const col = columns_to_search[index];
465
- const v = (p[col] + '').toLowerCase(); // get string value
466
-
464
+ const v = (p[col] + '').toLowerCase(); //value of column
465
+ console.log('v:', v);
467
466
  if (v && v.indexOf(lowerSearchText) == -1) return false;
468
467
  }
469
468
  return true;
470
469
  });
470
+ }
471
471
  } else newData = currentDS.current;
472
472
  console.log('newData:', newData.length);
473
473
 
@@ -477,8 +477,8 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
477
477
  );
478
478
  React.useEffect(() => {
479
479
  set_search('');
480
- fn_eval(props.dataSource).then(({ data }) => {
481
- currentDS.current = data;
480
+ fn_eval(props.dataSource).then((r) => {
481
+ currentDS.current = typeof r === 'object' ? r.data || r : r;
482
482
  searchIfNeeded();
483
483
  });
484
484
  }, [props.dataSource]);