@azrico/reactgrid 1.3.37 → 1.3.39

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.
@@ -43,12 +43,11 @@ const columns = [{
43
43
  const editableColumns = ['job', 'age'];
44
44
  function getData(delta, max = 200) {
45
45
  const fd = [];
46
- console.log('Delta:', delta);
47
46
  for (let index = 0; index < max; index++) {
48
47
  const currentObject = {
49
48
  __table_id: String(index),
50
49
  name: 'user-' + index,
51
- age: 20,
50
+ age: 5 + index,
52
51
  job: 'None'
53
52
  };
54
53
  if (delta[index] && typeof delta[index] === 'object') {
@@ -157,18 +157,20 @@ function ApplyColumnData(column_data) {
157
157
  }
158
158
  for (let index = 0; index < final_columns.length; index++) {
159
159
  const col = final_columns[index];
160
- if (col.type) {
161
- switch (col.type) {
160
+ const coltype = col.type;
161
+ delete col.type;
162
+ if (coltype) {
163
+ switch (coltype) {
162
164
  case 'combo':
163
165
  case 'select':
164
166
  //@ts-ignore
165
167
  col.editor = _SelectEditor.default;
166
168
  break;
167
- // case 'number':
168
- // case 'numberic':
169
- // //@ts-ignore
170
- // col.editor = NumericEditor;
171
- // break;
169
+ case 'int':
170
+ case 'number':
171
+ case 'numberic':
172
+ col.type = 'number';
173
+ break;
172
174
  case 'truefalse':
173
175
  case 'bool':
174
176
  case 'boolean':
@@ -177,7 +179,6 @@ function ApplyColumnData(column_data) {
177
179
  break;
178
180
  }
179
181
  if (col.editable != false) col.editable = true;
180
- delete col.type;
181
182
  }
182
183
  //@ts-ignore
183
184
  if (!col.editorProps) col.editorProps = {};
@@ -362,7 +362,9 @@ function DataGridCore(props) {
362
362
  ...props.static_gridOptions,
363
363
  ...props.dynamic_gridOptions,
364
364
  rowIndexColumn: true,
365
- handle: ref => props.gridRef.current = ref.current,
365
+ handle: ref => {
366
+ if (ref) props.gridRef.current = ref.current;
367
+ },
366
368
  className: 'azgrid-flexed',
367
369
  columns: props.columns,
368
370
  dataSource: props.dataSource
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azrico/reactgrid",
3
- "version": "1.3.37",
3
+ "version": "1.3.39",
4
4
  "main": "dist/index.js",
5
5
  "description": "React Datagrid",
6
6
  "author": "Azrideus <MehrdadTavangar@gmail.com>",
package/src/example.tsx CHANGED
@@ -30,13 +30,12 @@ const columns = [
30
30
  const editableColumns = ['job', 'age'];
31
31
 
32
32
  function getData(delta: any, max = 200) {
33
- const fd: any[] = [];
34
- console.log('Delta:', delta);
33
+ const fd: any[] = [];
35
34
  for (let index = 0; index < max; index++) {
36
35
  const currentObject = {
37
36
  __table_id: String(index),
38
37
  name: 'user-' + index,
39
- age: 20,
38
+ age: 5 + index,
40
39
  job: 'None',
41
40
  };
42
41
  if (delta[index] && typeof delta[index] === 'object') {
@@ -154,18 +154,20 @@ export function ApplyColumnData(column_data: any): ColumnDefinition[] {
154
154
  }
155
155
  for (let index = 0; index < final_columns.length; index++) {
156
156
  const col = final_columns[index];
157
- if (col.type) {
158
- switch (col.type) {
157
+ const coltype = col.type;
158
+ delete col.type;
159
+ if (coltype) {
160
+ switch (coltype) {
159
161
  case 'combo':
160
162
  case 'select':
161
163
  //@ts-ignore
162
164
  col.editor = SelectEditor;
163
165
  break;
164
- // case 'number':
165
- // case 'numberic':
166
- // //@ts-ignore
167
- // col.editor = NumericEditor;
168
- // break;
166
+ case 'int':
167
+ case 'number':
168
+ case 'numberic':
169
+ col.type = 'number';
170
+ break;
169
171
  case 'truefalse':
170
172
  case 'bool':
171
173
  case 'boolean':
@@ -174,7 +176,6 @@ export function ApplyColumnData(column_data: any): ColumnDefinition[] {
174
176
  break;
175
177
  }
176
178
  if (col.editable != false) col.editable = true;
177
- delete col.type;
178
179
  }
179
180
  //@ts-ignore
180
181
  if (!col.editorProps) col.editorProps = {};
@@ -177,7 +177,7 @@ export function AzGrid(props: AzGridProps) {
177
177
  props.editableColumns,
178
178
  props.columnExtensions,
179
179
  props.customColumns,
180
- ]);
180
+ ]);
181
181
  /* -------------------------------------------------------------------------- */
182
182
  /* Row changes */
183
183
  /* -------------------------------------------------------------------------- */
@@ -548,7 +548,9 @@ function DataGridCore(props: DataGridWrapperProps) {
548
548
  {...props.static_gridOptions}
549
549
  {...props.dynamic_gridOptions}
550
550
  rowIndexColumn
551
- handle={(ref) => (props.gridRef.current = ref.current as any)}
551
+ handle={(ref) => {
552
+ if (ref) props.gridRef.current = ref.current as any;
553
+ }}
552
554
  className={'azgrid-flexed'}
553
555
  columns={props.columns}
554
556
  dataSource={props.dataSource}