imm-element-ui 2.9.8 → 2.9.9
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/esm2022/lib/grid/grid/grid.component.mjs +17 -8
- package/esm2022/lib/grid/grid-utils.mjs +15 -3
- package/esm2022/lib/page-form/page-form.component.mjs +5 -28
- package/fesm2022/imm-element-ui.mjs +34 -36
- package/fesm2022/imm-element-ui.mjs.map +1 -1
- package/lib/grid/grid/grid.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5012,7 +5012,9 @@ const _gridUtils = {
|
|
|
5012
5012
|
calcRowIds: (api, isServerSide) => {
|
|
5013
5013
|
const result = [];
|
|
5014
5014
|
api.forEachNode((node) => {
|
|
5015
|
-
node.
|
|
5015
|
+
if (node.data != null && node.isSelected() === true) {
|
|
5016
|
+
result.push(node.data);
|
|
5017
|
+
}
|
|
5016
5018
|
});
|
|
5017
5019
|
return result;
|
|
5018
5020
|
},
|
|
@@ -5133,9 +5135,19 @@ const _gridUtils = {
|
|
|
5133
5135
|
maxWidth: 80,
|
|
5134
5136
|
});
|
|
5135
5137
|
}
|
|
5136
|
-
|
|
5138
|
+
const hasRowGroup = (columns) => columns.some((column) => column?.rowGroup === true || (Array.isArray(column?.children) && hasRowGroup(column.children)));
|
|
5139
|
+
if (hasRowGroup(gridOptions.columnDefs || [])) {
|
|
5140
|
+
const rowSelection = gridOptions.rowSelection;
|
|
5137
5141
|
return {
|
|
5138
5142
|
...gridOptions,
|
|
5143
|
+
...(typeof rowSelection === 'object' && rowSelection?.mode === 'multiRow'
|
|
5144
|
+
? {
|
|
5145
|
+
rowSelection: {
|
|
5146
|
+
...rowSelection,
|
|
5147
|
+
groupSelects: rowSelection.groupSelects ?? 'filteredDescendants',
|
|
5148
|
+
},
|
|
5149
|
+
}
|
|
5150
|
+
: {}),
|
|
5139
5151
|
autoGroupColumnDef: {
|
|
5140
5152
|
width: 300,
|
|
5141
5153
|
minWidth: 300,
|
|
@@ -7841,6 +7853,15 @@ class GridComponent {
|
|
|
7841
7853
|
getGrid() {
|
|
7842
7854
|
return this.grid;
|
|
7843
7855
|
}
|
|
7856
|
+
getLeafRowData() {
|
|
7857
|
+
const rowData = [];
|
|
7858
|
+
this.grid?.api.forEachLeafNode((node) => {
|
|
7859
|
+
if (node.data != null) {
|
|
7860
|
+
rowData.push(node.data);
|
|
7861
|
+
}
|
|
7862
|
+
});
|
|
7863
|
+
return rowData;
|
|
7864
|
+
}
|
|
7844
7865
|
isMobileOrTabletBrowser() {
|
|
7845
7866
|
if (typeof navigator === 'undefined') {
|
|
7846
7867
|
return false;
|
|
@@ -8451,16 +8472,16 @@ class GridComponent {
|
|
|
8451
8472
|
this.ajustGridHeight();
|
|
8452
8473
|
}
|
|
8453
8474
|
delRows() {
|
|
8454
|
-
const
|
|
8455
|
-
const
|
|
8456
|
-
|
|
8475
|
+
const selectedData = gridUtils.calcRowIds(this.grid.api, this.toOptions().rowModelType === 'serverSide');
|
|
8476
|
+
const ids = [...new Set(selectedData.map((data) => data.id).filter((id) => id))];
|
|
8477
|
+
const unsavedRows = selectedData.filter((data) => !data.id);
|
|
8478
|
+
if (unsavedRows.length > 0) {
|
|
8479
|
+
this.handleDeletedRows(unsavedRows);
|
|
8480
|
+
this.action.updateGridAction({ type: 'delete', data: unsavedRows });
|
|
8481
|
+
}
|
|
8457
8482
|
if (ids.length > 0) {
|
|
8458
8483
|
this.deleteEmit.emit(ids);
|
|
8459
8484
|
}
|
|
8460
|
-
else if (selectedData.length > 0 && ids.length == 0) {
|
|
8461
|
-
this.handleDeletedRows(selectedData);
|
|
8462
|
-
this.action.updateGridAction({ type: 'delete', data: selectedData });
|
|
8463
|
-
}
|
|
8464
8485
|
this.ajustGridHeight();
|
|
8465
8486
|
}
|
|
8466
8487
|
setScrollHeight(height) {
|
|
@@ -12355,11 +12376,7 @@ class PageFormComponent extends AmComponent {
|
|
|
12355
12376
|
if (e.length > 0) {
|
|
12356
12377
|
let uniqueKeys = [];
|
|
12357
12378
|
if (grid.uniqueField) {
|
|
12358
|
-
const rowData = this.customGrid
|
|
12359
|
-
.get(this.indexValue)
|
|
12360
|
-
.getGrid()
|
|
12361
|
-
.api.getRenderedNodes()
|
|
12362
|
-
.map((node) => node.data);
|
|
12379
|
+
const rowData = this.customGrid.get(this.indexValue).getLeafRowData();
|
|
12363
12380
|
// console.log('rowData-----',rowData)
|
|
12364
12381
|
uniqueKeys = rowData.map((item) => item[grid.uniqueField]);
|
|
12365
12382
|
}
|
|
@@ -12389,30 +12406,15 @@ class PageFormComponent extends AmComponent {
|
|
|
12389
12406
|
});
|
|
12390
12407
|
if (grid.uniqueField) {
|
|
12391
12408
|
const keys = datas.map((item) => item[grid.uniqueField]);
|
|
12392
|
-
const rowData = this.customGrid
|
|
12393
|
-
.get(this.indexValue)
|
|
12394
|
-
.getGrid()
|
|
12395
|
-
.api.getRenderedNodes()
|
|
12396
|
-
.map((node) => node.data);
|
|
12409
|
+
const rowData = this.customGrid.get(this.indexValue).getLeafRowData();
|
|
12397
12410
|
let deletedRows = rowData.filter((item) => keys.includes(item[grid.uniqueField]));
|
|
12398
12411
|
this.subDeleteIds = deletedRows.map((v) => v.id).filter((v) => v);
|
|
12399
12412
|
const idNotRows = deletedRows.filter((v) => !v.id);
|
|
12400
12413
|
// console.log('idNotRows----',idNotRows)
|
|
12401
|
-
const deleteNodes = [];
|
|
12402
|
-
this.customGrid
|
|
12403
|
-
.get(this.indexValue)
|
|
12404
|
-
.getGrid()
|
|
12405
|
-
.api.forEachNode((node) => {
|
|
12406
|
-
let main = node.data[grid.uniqueField];
|
|
12407
|
-
let isExit = idNotRows.findIndex((v) => v[grid.uniqueField] == main);
|
|
12408
|
-
if (isExit > -1) {
|
|
12409
|
-
deleteNodes.push(node.data);
|
|
12410
|
-
}
|
|
12411
|
-
});
|
|
12412
12414
|
// if(deletedIds.length > 0){
|
|
12413
12415
|
// this.delRows(deletedIds)
|
|
12414
12416
|
// } else {
|
|
12415
|
-
this.customGrid.get(this.indexValue).selectRowsDeleted(
|
|
12417
|
+
this.customGrid.get(this.indexValue).selectRowsDeleted(idNotRows);
|
|
12416
12418
|
// }
|
|
12417
12419
|
}
|
|
12418
12420
|
}
|
|
@@ -12489,11 +12491,7 @@ class PageFormComponent extends AmComponent {
|
|
|
12489
12491
|
}
|
|
12490
12492
|
// console.log('!this.selectOptions.rowSelection-----',!this.selectOptions.rowSelection)
|
|
12491
12493
|
if (grid.uniqueField) {
|
|
12492
|
-
const rowData = this.customGrid
|
|
12493
|
-
.get(this.indexValue)
|
|
12494
|
-
.getGrid()
|
|
12495
|
-
.api.getRenderedNodes()
|
|
12496
|
-
.map((node) => node.data);
|
|
12494
|
+
const rowData = this.customGrid.get(this.indexValue).getLeafRowData();
|
|
12497
12495
|
this.selectionKeys = rowData?.map((item) => item[grid.uniqueField]) || [];
|
|
12498
12496
|
// console.log('this.selectionKeys----',this.selectionKeys)
|
|
12499
12497
|
if (typeof this.selectOptions.rowSelection == 'object') {
|