@azrico/reactgrid 1.0.13 → 1.0.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/dist/src/func/helpers.js
CHANGED
|
@@ -28,7 +28,7 @@ function fix_parent_child_relations(rows) {
|
|
|
28
28
|
assign_children(mrow, converted_rows);
|
|
29
29
|
}
|
|
30
30
|
const result = top_level_rows.map(r => r.data);
|
|
31
|
-
console.log(result);
|
|
31
|
+
//console.log(result);
|
|
32
32
|
return result;
|
|
33
33
|
}
|
|
34
34
|
function assign_children(row, all_rows) {
|
|
@@ -40,7 +40,7 @@ function assign_children(row, all_rows) {
|
|
|
40
40
|
assign_children(child, all_rows);
|
|
41
41
|
}
|
|
42
42
|
row.data.__children = my_children.map(r => r.data);
|
|
43
|
-
} else row.data.__children = undefined;
|
|
43
|
+
} else if (!Array.isArray(row.data.__children) || row.data.__children.length == 0) row.data.__children = undefined;
|
|
44
44
|
}
|
|
45
45
|
class func_selection {
|
|
46
46
|
static getVirtualElement(x = 0, y = 0) {
|
|
@@ -76,10 +76,11 @@ function AzGrid(props) {
|
|
|
76
76
|
const ext = mcolExts[index];
|
|
77
77
|
const ext_cl = get_col_name(ext);
|
|
78
78
|
const mcol = final_columns.find(s => s.name === ext_cl);
|
|
79
|
-
if (
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
if (mcol) {
|
|
80
|
+
for (const key in ext) {
|
|
81
|
+
if (!mcol[key] && key != 'name') mcol[key] = ext[key];
|
|
82
|
+
}
|
|
83
|
+
}
|
|
83
84
|
// if (ext.widthGrow) mcol.widthGrow = ext.widthGrow;
|
|
84
85
|
}
|
|
85
86
|
/* ------------------------------- frozen cols ------------------------------ */
|
|
@@ -133,7 +134,7 @@ function AzGrid(props) {
|
|
|
133
134
|
/* -------------------------------------------------------------------------- */
|
|
134
135
|
_react.default.useEffect(() => {
|
|
135
136
|
if (pendingChanges <= 0) return;
|
|
136
|
-
console.log('Updated Pending Changes: ', pendingChanges);
|
|
137
|
+
//console.log('Updated Pending Changes: ', pendingChanges);
|
|
137
138
|
let new_rows = [];
|
|
138
139
|
if (typeof props.get_rows === 'function') {
|
|
139
140
|
new_rows = props.get_rows();
|
|
@@ -147,11 +148,11 @@ function AzGrid(props) {
|
|
|
147
148
|
set_pendingChanges(0);
|
|
148
149
|
}, [pendingChanges]);
|
|
149
150
|
_react.default.useEffect(() => {
|
|
150
|
-
console.log('Rows Changed !');
|
|
151
|
+
//console.log('Rows Changed !');
|
|
151
152
|
set_pendingChanges(r => r + 1);
|
|
152
153
|
}, [props.rows]);
|
|
153
154
|
function onRowsChange(rows, options) {
|
|
154
|
-
console.log('onRowsChange');
|
|
155
|
+
//console.log('onRowsChange');
|
|
155
156
|
if (props.onRowsChange) props.onRowsChange(rows, options);
|
|
156
157
|
set_pendingChanges(r => r + 1); //notify the cache to update rows after we made changes to them
|
|
157
158
|
}
|
package/package.json
CHANGED
package/src/func/helpers.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function fix_parent_child_relations<T extends mrow>(rows: T[]): T[] {
|
|
|
24
24
|
assign_children(mrow, converted_rows);
|
|
25
25
|
}
|
|
26
26
|
const result = top_level_rows.map((r) => r.data) as T[];
|
|
27
|
-
console.log(result);
|
|
27
|
+
//console.log(result);
|
|
28
28
|
return result;
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -37,7 +37,7 @@ function assign_children(row: converted_row, all_rows: converted_row[]) {
|
|
|
37
37
|
assign_children(child, all_rows);
|
|
38
38
|
}
|
|
39
39
|
row.data.__children = my_children.map((r) => r.data);
|
|
40
|
-
} else row.data.__children = undefined;
|
|
40
|
+
} else if (!Array.isArray(row.data.__children) || row.data.__children.length == 0) row.data.__children = undefined;
|
|
41
41
|
}
|
|
42
42
|
export class func_selection {
|
|
43
43
|
static getVirtualElement(x = 0, y = 0) {
|
package/src/views/DataGrid.tsx
CHANGED
|
@@ -152,11 +152,11 @@ export function AzGrid(props: AzGridProps) {
|
|
|
152
152
|
const ext = mcolExts[index];
|
|
153
153
|
const ext_cl = get_col_name(ext);
|
|
154
154
|
const mcol = final_columns.find((s) => s.name === ext_cl);
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
155
|
+
if (mcol) {
|
|
156
|
+
for (const key in ext) {
|
|
157
|
+
if (!mcol[key] && key != 'name') mcol[key] = ext[key];
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
160
|
// if (ext.widthGrow) mcol.widthGrow = ext.widthGrow;
|
|
161
161
|
}
|
|
162
162
|
|
|
@@ -213,7 +213,7 @@ export function AzGrid(props: AzGridProps) {
|
|
|
213
213
|
/* -------------------------------------------------------------------------- */
|
|
214
214
|
React.useEffect(() => {
|
|
215
215
|
if (pendingChanges <= 0) return;
|
|
216
|
-
console.log('Updated Pending Changes: ', pendingChanges);
|
|
216
|
+
//console.log('Updated Pending Changes: ', pendingChanges);
|
|
217
217
|
let new_rows: any[] = [];
|
|
218
218
|
if (typeof props.get_rows === 'function') {
|
|
219
219
|
new_rows = props.get_rows();
|
|
@@ -229,12 +229,12 @@ export function AzGrid(props: AzGridProps) {
|
|
|
229
229
|
}, [pendingChanges]);
|
|
230
230
|
|
|
231
231
|
React.useEffect(() => {
|
|
232
|
-
console.log('Rows Changed !');
|
|
232
|
+
//console.log('Rows Changed !');
|
|
233
233
|
set_pendingChanges((r) => r + 1);
|
|
234
234
|
}, [props.rows]);
|
|
235
235
|
|
|
236
236
|
function onRowsChange(rows: any[], options: any) {
|
|
237
|
-
console.log('onRowsChange');
|
|
237
|
+
//console.log('onRowsChange');
|
|
238
238
|
if (props.onRowsChange) props.onRowsChange(rows, options);
|
|
239
239
|
set_pendingChanges((r) => r + 1); //notify the cache to update rows after we made changes to them
|
|
240
240
|
}
|