@azrico/reactgrid 1.3.34 → 1.3.36

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.
@@ -5,7 +5,7 @@ import '../themes/base_styles.css';
5
5
  import '../themes/grid.css';
6
6
  import { ConvertableToMenuItem } from '@azrico/controls';
7
7
  import React from 'react';
8
- import { TypeCellSelection, TypeColumn, TypeDataGridProps, TypeDataSource, TypeEditInfo, TypeFilterTypes, TypeFilterValue, TypeRowDetailsInfo, TypeRowProps, TypeRowSelection } from '@inovua/reactdatagrid-community/types';
8
+ import { TypeCellSelection, TypeColumn, TypeDataGridProps, TypeDataSource, TypeEditInfo, TypeFilterTypes, TypeFilterValue, TypeRowDetailsInfo, TypeRowProps, TypeRowSelection, TypeComputedProps } from '@inovua/reactdatagrid-community/types';
9
9
  import { TypeOnSelectionChangeArg } from '@inovua/reactdatagrid-community/types/TypeDataGridProps';
10
10
  export type ColumnDefinition = TypeColumn;
11
11
  export type CellDefinition = any;
@@ -45,7 +45,7 @@ export type AzGridProps = {
45
45
  details_columns?: LooseColumnDefinition[];
46
46
  details_filter?: FilterValues;
47
47
  licenseKey?: string;
48
- gridRef?: any;
48
+ gridRef?: React.MutableRefObject<TypeComputedProps>;
49
49
  gridOptions?: AzGridOptions;
50
50
  columns?: LooseColumnDefinition[];
51
51
  columnExtensions?: Partial<LooseColumnDefinition>;
@@ -131,7 +131,7 @@ function DataGridEventsWrapper(props) {
131
131
  for (let index = 0; index < dt.length; index++) {
132
132
  props.gridRef.current.setItemPropertyAt(index, col, dt[index][col]);
133
133
  }
134
- }, [props.gridRef.current, props.gridRef.current.ungroupedData]);
134
+ }, [props.gridRef.current]);
135
135
  const refresh = _react.default.useCallback(() => {
136
136
  const dt = props.gridRef.current.ungroupedData;
137
137
  for (let index = 0; index < dt.length; index++) {
@@ -139,8 +139,9 @@ function DataGridEventsWrapper(props) {
139
139
  replace: false
140
140
  });
141
141
  }
142
- }, [props.gridRef.current, props.gridRef.current.ungroupedData]);
142
+ }, [props.gridRef.current]);
143
143
  _react.default.useEffect(() => {
144
+ if (!props.gridRef.current) return;
144
145
  props.gridRef.current['refresh'] = refresh;
145
146
  props.gridRef.current['refreshColumn'] = refreshColumn;
146
147
  }, [props.gridRef.current, props.dataSource, refresh, refreshColumn]);
@@ -361,7 +362,7 @@ function DataGridCore(props) {
361
362
  ...props.static_gridOptions,
362
363
  ...props.dynamic_gridOptions,
363
364
  rowIndexColumn: true,
364
- handle: ref => props.gridRef.current = ref ? ref.current : null,
365
+ handle: ref => props.gridRef = ref,
365
366
  className: 'azgrid-flexed',
366
367
  columns: props.columns,
367
368
  dataSource: props.dataSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.34",
3
+ "version": "1.3.36",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
@@ -26,6 +26,7 @@ import {
26
26
  TypeRowDetailsInfo,
27
27
  TypeRowProps,
28
28
  TypeRowSelection,
29
+ TypeComputedProps,
29
30
  } from '@inovua/reactdatagrid-community/types';
30
31
  import { fix_parent_child_relations, func_selection } from '../func/func_child';
31
32
  import { array_intersection, fn_eval } from '@azrico/object';
@@ -81,7 +82,7 @@ export type AzGridProps = {
81
82
 
82
83
  licenseKey?: string;
83
84
 
84
- gridRef?: any;
85
+ gridRef?: React.MutableRefObject<TypeComputedProps>;
85
86
  gridOptions?: AzGridOptions;
86
87
 
87
88
  columns?: LooseColumnDefinition[];
@@ -134,6 +135,7 @@ type DataGridProps = ModifyFields<
134
135
  type DataGridWrapperProps = ModifyFields<
135
136
  DataGridProps,
136
137
  {
138
+ gridRef: React.MutableRefObject<TypeComputedProps>;
137
139
  static_gridOptions: AzGridOptions;
138
140
  dynamic_gridOptions: AzGridOptions;
139
141
  children?: React.ReactNode;
@@ -284,15 +286,16 @@ function DataGridEventsWrapper(props: DataGridWrapperProps) {
284
286
  (props.gridRef.current as any).setItemPropertyAt(index, col, dt[index][col]);
285
287
  }
286
288
  },
287
- [props.gridRef.current, props.gridRef.current.ungroupedData]
289
+ [props.gridRef.current]
288
290
  );
289
291
  const refresh = React.useCallback(() => {
290
292
  const dt = props.gridRef.current.ungroupedData;
291
293
  for (let index = 0; index < dt.length; index++) {
292
294
  (props.gridRef.current as any).setItemAt(index, {}, { replace: false });
293
295
  }
294
- }, [props.gridRef.current, props.gridRef.current.ungroupedData]);
296
+ }, [props.gridRef.current]);
295
297
  React.useEffect(() => {
298
+ if (!props.gridRef.current) return;
296
299
  props.gridRef.current['refresh'] = refresh;
297
300
  props.gridRef.current['refreshColumn'] = refreshColumn;
298
301
  }, [props.gridRef.current, props.dataSource, refresh, refreshColumn]);
@@ -545,7 +548,7 @@ function DataGridCore(props: DataGridWrapperProps) {
545
548
  {...props.static_gridOptions}
546
549
  {...props.dynamic_gridOptions}
547
550
  rowIndexColumn
548
- handle={(ref) => (props.gridRef.current = ref ? ref.current : null)}
551
+ handle={(ref) => (props.gridRef = ref as any)}
549
552
  className={'azgrid-flexed'}
550
553
  columns={props.columns}
551
554
  dataSource={props.dataSource}