(
leaf: [IdMap2<Cell>, IdSet, Id, Row],
changedGroupedSelectedCells: IdMap<[Cell]>,
selectedRowId: Id,
forceRemove?: 1,
)
| 549 | const tree = mapNew<Cell, any>(); |
| 550 | |
| 551 | const writeGroupRow = ( |
| 552 | leaf: [IdMap2<Cell>, IdSet, Id, Row], |
| 553 | changedGroupedSelectedCells: IdMap<[Cell]>, |
| 554 | selectedRowId: Id, |
| 555 | forceRemove?: 1, |
| 556 | ) => |
| 557 | ifNotUndefined( |
| 558 | leaf, |
| 559 | ([selectedCells, selectedRowIds, groupRowId, groupRow]) => { |
| 560 | mapForEach( |
| 561 | changedGroupedSelectedCells, |
| 562 | (selectedCellId, [newCell]) => { |
| 563 | const selectedCell = mapEnsure( |
| 564 | selectedCells, |
| 565 | selectedCellId, |
| 566 | mapNew, |
| 567 | ); |
| 568 | const oldLeafCell = mapGet(selectedCell, selectedRowId); |
| 569 | const newLeafCell = forceRemove ? undefined : newCell; |
| 570 | if (oldLeafCell !== newLeafCell) { |
| 571 | const oldNewSet = setNew([[oldLeafCell, newLeafCell]]); |
| 572 | const oldLength = collSize(selectedCell); |
| 573 | mapSet(selectedCell, selectedRowId, newLeafCell); |
| 574 | collForEach( |
| 575 | mapGet(groupedSelectedCellIds, selectedCellId), |
| 576 | ([groupedCellId, aggregators]) => { |
| 577 | const aggregateValue = getAggregateValue( |
| 578 | groupRow[groupedCellId], |
| 579 | oldLength, |
| 580 | selectedCell as IdMap<Cell>, |
| 581 | oldNewSet as Set<ChangedCell>, |
| 582 | aggregators, |
| 583 | ); |
| 584 | groupRow[groupedCellId] = ( |
| 585 | isUndefined(getCellOrValueType(aggregateValue)) |
| 586 | ? undefined |
| 587 | : aggregateValue |
| 588 | ) as Cell; |
| 589 | }, |
| 590 | ); |
| 591 | } |
| 592 | }, |
| 593 | ); |
| 594 | if ( |
| 595 | collIsEmpty(selectedRowIds) || |
| 596 | !arrayEvery(havings, (having) => |
| 597 | having((cellId) => groupRow[cellId] as any), |
| 598 | ) |
| 599 | ) { |
| 600 | resultStore.delRow(queryId, groupRowId); |
| 601 | } else if (isUndefined(groupRowId)) { |
| 602 | leaf[2] = resultStore.addRow(queryId, groupRow) as Id; |
| 603 | } else { |
| 604 | resultStore.setRow(queryId, groupRowId, groupRow); |
| 605 | } |
| 606 | }, |
| 607 | ); |
| 608 |
no test coverage detected
searching dependent graphs…