@azrico/reactgrid 1.3.25 → 1.3.27

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.
@@ -86,11 +86,14 @@ function AzGrid(props) {
86
86
  };
87
87
  }, [cached_columns, props.allowChildRows, props.editable, props.RowDetail, props.onEditComplete]);
88
88
  const static_gridOptions = _react.default.useMemo(() => {
89
- return {
89
+ const finalres = {
90
90
  ...base_gridOptions,
91
91
  ...props.gridOptions,
92
92
  ...forcedOptions
93
93
  };
94
+ //append filter types instead of replacing it
95
+ if (finalres.filterTypes) finalres.filterTypes = Object.assign({}, _reactdatagridEnterprise.default.defaultProps.filterTypes, finalres.filterTypes);
96
+ return finalres;
94
97
  }, [props.gridOptions, base_gridOptions, forcedOptions]);
95
98
  const dynamic_gridOptions = _react.default.useMemo(() => {
96
99
  const res = {};
@@ -291,23 +294,20 @@ function DataGridSearchWrapper(props) {
291
294
  const visibleColumns = props.gridRef.current.visibleColumns;
292
295
  const columns_to_search = (0, _object.array_intersection)(props.advancedFilterFields || [], visibleColumns.map(r => r.id));
293
296
  const lowerSearchText = currentSearch.current.toLowerCase().trim();
294
- console.log('s:', lowerSearchText);
295
297
  if (!lowerSearchText || columns_to_search.length === 0) newData = currentDS.current;else {
296
298
  newData = currentDS.current.filter(p => {
297
299
  for (let index = 0; index < columns_to_search.length; index++) {
298
300
  const col = columns_to_search[index];
299
301
  const v = (p[col] + '').toLowerCase(); //value of column
300
- if (v.indexOf(lowerSearchText) == -1) {
301
- console.log('v NOT match:', v, v.indexOf(lowerSearchText));
302
- return false;
302
+ if (v && v.indexOf(lowerSearchText) != -1) {
303
+ //if one column is matching then the row is a match
304
+ return true;
303
305
  }
304
- console.log('v is matching', v, v.indexOf(lowerSearchText));
305
306
  }
306
- return true;
307
+ return false;
307
308
  });
308
309
  }
309
310
  } else newData = currentDS.current;
310
- console.log('newData:', newData.length);
311
311
  set_filteredData(newData);
312
312
  }, 1000), []);
313
313
  _react.default.useEffect(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.25",
3
+ "version": "1.3.27",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -223,7 +223,17 @@ export function AzGrid(props: AzGridProps) {
223
223
  ]);
224
224
 
225
225
  const static_gridOptions = React.useMemo<AzGridOptions>(() => {
226
- return { ...base_gridOptions, ...props.gridOptions, ...forcedOptions };
226
+ const finalres = { ...base_gridOptions, ...props.gridOptions, ...forcedOptions };
227
+
228
+ //append filter types instead of replacing it
229
+ if (finalres.filterTypes)
230
+ finalres.filterTypes = Object.assign(
231
+ {},
232
+ ReactDataGrid.defaultProps.filterTypes,
233
+ finalres.filterTypes
234
+ );
235
+
236
+ return finalres;
227
237
  }, [props.gridOptions, base_gridOptions, forcedOptions]);
228
238
 
229
239
  const dynamic_gridOptions = React.useMemo<AzGridOptions>(
@@ -455,8 +465,6 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
455
465
  visibleColumns.map((r) => r.id)
456
466
  );
457
467
  const lowerSearchText = currentSearch.current.toLowerCase().trim();
458
- console.log('s:', lowerSearchText);
459
-
460
468
  if (!lowerSearchText || columns_to_search.length === 0)
461
469
  newData = currentDS.current;
462
470
  else {
@@ -464,20 +472,15 @@ function DataGridSearchWrapper(props: DataGridWrapperProps) {
464
472
  for (let index = 0; index < columns_to_search.length; index++) {
465
473
  const col = columns_to_search[index];
466
474
  const v = (p[col] + '').toLowerCase(); //value of column
467
-
468
- if (v.indexOf(lowerSearchText) == -1) {
469
- console.log('v NOT match:', v, v.indexOf(lowerSearchText));
470
- return false;
475
+ if (v && v.indexOf(lowerSearchText) != -1) {
476
+ //if one column is matching then the row is a match
477
+ return true;
471
478
  }
472
- console.log('v is matching', v, v.indexOf(lowerSearchText));
473
479
  }
474
-
475
- return true;
480
+ return false;
476
481
  });
477
482
  }
478
483
  } else newData = currentDS.current;
479
- console.log('newData:', newData.length);
480
-
481
484
  set_filteredData(newData);
482
485
  }, 1000),
483
486
  []