@pretable/core 0.0.10 → 0.0.11
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/index.cjs +134 -7
- package/dist/index.mjs +134 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1151,7 +1151,9 @@ function createGridCore(inputOptions) {
|
|
|
1151
1151
|
if (nextPinned !== moved.pinned) {
|
|
1152
1152
|
nextColumns[clampedTo] = { ...moved, pinned: nextPinned };
|
|
1153
1153
|
}
|
|
1154
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1154
1155
|
options = { ...options, columns: nextColumns };
|
|
1156
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1155
1157
|
emit();
|
|
1156
1158
|
},
|
|
1157
1159
|
setColumnOrder(ids) {
|
|
@@ -1189,7 +1191,9 @@ function createGridCore(inputOptions) {
|
|
|
1189
1191
|
if (!changed) {
|
|
1190
1192
|
return;
|
|
1191
1193
|
}
|
|
1194
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1192
1195
|
options = { ...options, columns: nextColumns };
|
|
1196
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1193
1197
|
emit();
|
|
1194
1198
|
},
|
|
1195
1199
|
setColumnPinned(columnId, pinned) {
|
|
@@ -1224,7 +1228,9 @@ function createGridCore(inputOptions) {
|
|
|
1224
1228
|
pinned: nextPinnedValue
|
|
1225
1229
|
};
|
|
1226
1230
|
nextColumns.splice(insertAt, 0, nextColumn);
|
|
1231
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1227
1232
|
options = { ...options, columns: nextColumns };
|
|
1233
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1228
1234
|
emit();
|
|
1229
1235
|
},
|
|
1230
1236
|
autosizeColumn(columnId, autosizeOptions) {
|
|
@@ -1274,7 +1280,9 @@ function createGridCore(inputOptions) {
|
|
|
1274
1280
|
return;
|
|
1275
1281
|
}
|
|
1276
1282
|
}
|
|
1283
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1277
1284
|
options = { ...options, columns: next };
|
|
1285
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1278
1286
|
emit();
|
|
1279
1287
|
},
|
|
1280
1288
|
mergeColumnsFromProps(nextColumns) {
|
|
@@ -1292,8 +1300,11 @@ function createGridCore(inputOptions) {
|
|
|
1292
1300
|
});
|
|
1293
1301
|
const grouped = groupColumnsByPin(merged);
|
|
1294
1302
|
const layoutChanged = !sameColumnLayout(options.columns, grouped);
|
|
1295
|
-
const
|
|
1303
|
+
const columnSetChanged = !sameColumnIds(options.columns, grouped);
|
|
1304
|
+
const groupingAccessorsChanged = rowGroups.length > 0 && !sameGroupingAccessors(options.columns, grouped, rowGroups);
|
|
1305
|
+
const groupingSemanticsChanged = columnSetChanged || groupingAccessorsChanged;
|
|
1296
1306
|
const before = groupingSemanticsChanged ? captureVisibleRowsForFocusReconciliation() : null;
|
|
1307
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1297
1308
|
originalColumns = groupColumnsByPin(nextColumns).map((c) => ({ ...c }));
|
|
1298
1309
|
options = { ...options, columns: grouped };
|
|
1299
1310
|
const nextRowGroups = sanitizeRowGroups(rowGroups, grouped);
|
|
@@ -1306,7 +1317,8 @@ function createGridCore(inputOptions) {
|
|
|
1306
1317
|
cachedVisibleRows = null;
|
|
1307
1318
|
reconcileFocusAfterVisibleModelChange(before);
|
|
1308
1319
|
}
|
|
1309
|
-
|
|
1320
|
+
const selectionChanged = reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1321
|
+
if (layoutChanged || groupingSemanticsChanged || sanitizedGroupingChanged || selectionChanged) {
|
|
1310
1322
|
emit();
|
|
1311
1323
|
}
|
|
1312
1324
|
},
|
|
@@ -1412,9 +1424,11 @@ function createGridCore(inputOptions) {
|
|
|
1412
1424
|
return;
|
|
1413
1425
|
}
|
|
1414
1426
|
const before = captureVisibleRowsForFocusReconciliation();
|
|
1427
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1415
1428
|
rowGroups = next;
|
|
1416
1429
|
groupExpansionOverrides = /* @__PURE__ */ new Set();
|
|
1417
1430
|
reconcileFocusAfterVisibleModelChange(before);
|
|
1431
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1418
1432
|
emit();
|
|
1419
1433
|
},
|
|
1420
1434
|
toggleGroup(groupId) {
|
|
@@ -1517,6 +1531,111 @@ function createGridCore(inputOptions) {
|
|
|
1517
1531
|
});
|
|
1518
1532
|
emit();
|
|
1519
1533
|
}
|
|
1534
|
+
function captureColumnsForSelectionReconciliation() {
|
|
1535
|
+
return selection.ranges.length === 0 && selection.anchor === null ? null : getColumns();
|
|
1536
|
+
}
|
|
1537
|
+
function reconcileSelectionAfterColumnModelChange(before) {
|
|
1538
|
+
if (before === null) {
|
|
1539
|
+
return false;
|
|
1540
|
+
}
|
|
1541
|
+
const beforeFirst = before[0];
|
|
1542
|
+
const beforeLast = before[before.length - 1];
|
|
1543
|
+
const after = getColumns();
|
|
1544
|
+
const afterFirst = after[0];
|
|
1545
|
+
const afterLast = after[after.length - 1];
|
|
1546
|
+
if (!afterFirst || !afterLast) {
|
|
1547
|
+
selection = { ranges: [], anchor: null };
|
|
1548
|
+
return true;
|
|
1549
|
+
}
|
|
1550
|
+
if (!beforeFirst || !beforeLast) {
|
|
1551
|
+
return false;
|
|
1552
|
+
}
|
|
1553
|
+
const surviving = new Set(after.map((column) => column.id));
|
|
1554
|
+
const beforeIndex = new Map(before.map((column, i) => [column.id, i]));
|
|
1555
|
+
const afterIndex = new Map(after.map((column, i) => [column.id, i]));
|
|
1556
|
+
const anchor = selection.anchor;
|
|
1557
|
+
let anchorColumnId = anchor ? anchor.columnId : null;
|
|
1558
|
+
let anchorRemapped = false;
|
|
1559
|
+
let changed = false;
|
|
1560
|
+
const ranges = [];
|
|
1561
|
+
for (const range of selection.ranges) {
|
|
1562
|
+
const forwardFullRow = range.startColumnId === beforeFirst.id && range.endColumnId === beforeLast.id;
|
|
1563
|
+
const reverseFullRow = !forwardFullRow && range.startColumnId === beforeLast.id && range.endColumnId === beforeFirst.id;
|
|
1564
|
+
if (forwardFullRow || reverseFullRow) {
|
|
1565
|
+
const startColumnId2 = forwardFullRow ? afterFirst.id : afterLast.id;
|
|
1566
|
+
const endColumnId2 = forwardFullRow ? afterLast.id : afterFirst.id;
|
|
1567
|
+
if (startColumnId2 !== range.startColumnId || endColumnId2 !== range.endColumnId) {
|
|
1568
|
+
changed = true;
|
|
1569
|
+
}
|
|
1570
|
+
if (anchor && !anchorRemapped && (range.startRowId === anchor.rowId || range.endRowId === anchor.rowId)) {
|
|
1571
|
+
if (anchor.columnId === range.startColumnId) {
|
|
1572
|
+
anchorColumnId = startColumnId2;
|
|
1573
|
+
anchorRemapped = true;
|
|
1574
|
+
} else if (anchor.columnId === range.endColumnId) {
|
|
1575
|
+
anchorColumnId = endColumnId2;
|
|
1576
|
+
anchorRemapped = true;
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
ranges.push({ ...range, startColumnId: startColumnId2, endColumnId: endColumnId2 });
|
|
1580
|
+
continue;
|
|
1581
|
+
}
|
|
1582
|
+
const beforeStart = beforeIndex.get(range.startColumnId);
|
|
1583
|
+
const beforeEnd = beforeIndex.get(range.endColumnId);
|
|
1584
|
+
if (beforeStart === void 0 || beforeEnd === void 0) {
|
|
1585
|
+
if (surviving.has(range.startColumnId) && surviving.has(range.endColumnId)) {
|
|
1586
|
+
ranges.push(range);
|
|
1587
|
+
continue;
|
|
1588
|
+
}
|
|
1589
|
+
changed = true;
|
|
1590
|
+
continue;
|
|
1591
|
+
}
|
|
1592
|
+
const lo = Math.min(beforeStart, beforeEnd);
|
|
1593
|
+
const hi = Math.max(beforeStart, beforeEnd);
|
|
1594
|
+
let memberLo = Infinity;
|
|
1595
|
+
let memberHi = -Infinity;
|
|
1596
|
+
let memberCount = 0;
|
|
1597
|
+
for (let i = lo; i <= hi; i += 1) {
|
|
1598
|
+
const nextIndex = afterIndex.get(before[i].id);
|
|
1599
|
+
if (nextIndex === void 0) {
|
|
1600
|
+
continue;
|
|
1601
|
+
}
|
|
1602
|
+
memberLo = Math.min(memberLo, nextIndex);
|
|
1603
|
+
memberHi = Math.max(memberHi, nextIndex);
|
|
1604
|
+
memberCount += 1;
|
|
1605
|
+
}
|
|
1606
|
+
if (memberCount === 0 || memberHi - memberLo + 1 !== memberCount) {
|
|
1607
|
+
changed = true;
|
|
1608
|
+
continue;
|
|
1609
|
+
}
|
|
1610
|
+
const forward = beforeStart <= beforeEnd;
|
|
1611
|
+
const startColumnId = after[forward ? memberLo : memberHi].id;
|
|
1612
|
+
const endColumnId = after[forward ? memberHi : memberLo].id;
|
|
1613
|
+
if (startColumnId === range.startColumnId && endColumnId === range.endColumnId) {
|
|
1614
|
+
ranges.push(range);
|
|
1615
|
+
continue;
|
|
1616
|
+
}
|
|
1617
|
+
changed = true;
|
|
1618
|
+
ranges.push({ ...range, startColumnId, endColumnId });
|
|
1619
|
+
}
|
|
1620
|
+
let nextAnchor = anchor;
|
|
1621
|
+
if (anchor) {
|
|
1622
|
+
if (!anchorRemapped && !surviving.has(anchor.columnId)) {
|
|
1623
|
+
anchorColumnId = null;
|
|
1624
|
+
}
|
|
1625
|
+
if (anchorColumnId === null) {
|
|
1626
|
+
nextAnchor = null;
|
|
1627
|
+
changed = true;
|
|
1628
|
+
} else if (anchorColumnId !== anchor.columnId) {
|
|
1629
|
+
nextAnchor = { ...anchor, columnId: anchorColumnId };
|
|
1630
|
+
changed = true;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
if (!changed) {
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1636
|
+
selection = { ranges, anchor: nextAnchor };
|
|
1637
|
+
return true;
|
|
1638
|
+
}
|
|
1520
1639
|
function captureVisibleRowsForFocusReconciliation() {
|
|
1521
1640
|
return focus.rowId === null && focus.columnId === null ? null : getSnapshot().visibleRows;
|
|
1522
1641
|
}
|
|
@@ -1656,13 +1775,21 @@ function sameColumnLayout(a, b) {
|
|
|
1656
1775
|
return left.id === right.id && left.header === right.header && left.widthPx === right.widthPx && left.minWidthPx === right.minWidthPx && left.maxWidthPx === right.maxWidthPx && left.pinned === right.pinned && left.sortable === right.sortable && left.filterable === right.filterable && left.resizable === right.resizable && left.reorderable === right.reorderable && left.wrap === right.wrap;
|
|
1657
1776
|
});
|
|
1658
1777
|
}
|
|
1659
|
-
function
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1778
|
+
function sameColumnIds(a, b) {
|
|
1779
|
+
return a.length === b.length && a.every((left, index) => left.id === b[index].id);
|
|
1780
|
+
}
|
|
1781
|
+
function sameGroupingAccessors(a, b, rowGroups) {
|
|
1782
|
+
const levels = new Set(rowGroups);
|
|
1663
1783
|
return a.every((left, index) => {
|
|
1664
1784
|
const right = b[index];
|
|
1665
|
-
|
|
1785
|
+
if (!right || left.id !== right.id) {
|
|
1786
|
+
return false;
|
|
1787
|
+
}
|
|
1788
|
+
const participates = levels.has(left.id) || left.aggregate !== void 0 || right.aggregate !== void 0;
|
|
1789
|
+
if (!participates) {
|
|
1790
|
+
return true;
|
|
1791
|
+
}
|
|
1792
|
+
return left.value === right.value && left.aggregate === right.aggregate;
|
|
1666
1793
|
});
|
|
1667
1794
|
}
|
|
1668
1795
|
function computePageStep(viewport, rowCount) {
|
package/dist/index.mjs
CHANGED
|
@@ -1149,7 +1149,9 @@ function createGridCore(inputOptions) {
|
|
|
1149
1149
|
if (nextPinned !== moved.pinned) {
|
|
1150
1150
|
nextColumns[clampedTo] = { ...moved, pinned: nextPinned };
|
|
1151
1151
|
}
|
|
1152
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1152
1153
|
options = { ...options, columns: nextColumns };
|
|
1154
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1153
1155
|
emit();
|
|
1154
1156
|
},
|
|
1155
1157
|
setColumnOrder(ids) {
|
|
@@ -1187,7 +1189,9 @@ function createGridCore(inputOptions) {
|
|
|
1187
1189
|
if (!changed) {
|
|
1188
1190
|
return;
|
|
1189
1191
|
}
|
|
1192
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1190
1193
|
options = { ...options, columns: nextColumns };
|
|
1194
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1191
1195
|
emit();
|
|
1192
1196
|
},
|
|
1193
1197
|
setColumnPinned(columnId, pinned) {
|
|
@@ -1222,7 +1226,9 @@ function createGridCore(inputOptions) {
|
|
|
1222
1226
|
pinned: nextPinnedValue
|
|
1223
1227
|
};
|
|
1224
1228
|
nextColumns.splice(insertAt, 0, nextColumn);
|
|
1229
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1225
1230
|
options = { ...options, columns: nextColumns };
|
|
1231
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1226
1232
|
emit();
|
|
1227
1233
|
},
|
|
1228
1234
|
autosizeColumn(columnId, autosizeOptions) {
|
|
@@ -1272,7 +1278,9 @@ function createGridCore(inputOptions) {
|
|
|
1272
1278
|
return;
|
|
1273
1279
|
}
|
|
1274
1280
|
}
|
|
1281
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1275
1282
|
options = { ...options, columns: next };
|
|
1283
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1276
1284
|
emit();
|
|
1277
1285
|
},
|
|
1278
1286
|
mergeColumnsFromProps(nextColumns) {
|
|
@@ -1290,8 +1298,11 @@ function createGridCore(inputOptions) {
|
|
|
1290
1298
|
});
|
|
1291
1299
|
const grouped = groupColumnsByPin(merged);
|
|
1292
1300
|
const layoutChanged = !sameColumnLayout(options.columns, grouped);
|
|
1293
|
-
const
|
|
1301
|
+
const columnSetChanged = !sameColumnIds(options.columns, grouped);
|
|
1302
|
+
const groupingAccessorsChanged = rowGroups.length > 0 && !sameGroupingAccessors(options.columns, grouped, rowGroups);
|
|
1303
|
+
const groupingSemanticsChanged = columnSetChanged || groupingAccessorsChanged;
|
|
1294
1304
|
const before = groupingSemanticsChanged ? captureVisibleRowsForFocusReconciliation() : null;
|
|
1305
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1295
1306
|
originalColumns = groupColumnsByPin(nextColumns).map((c) => ({ ...c }));
|
|
1296
1307
|
options = { ...options, columns: grouped };
|
|
1297
1308
|
const nextRowGroups = sanitizeRowGroups(rowGroups, grouped);
|
|
@@ -1304,7 +1315,8 @@ function createGridCore(inputOptions) {
|
|
|
1304
1315
|
cachedVisibleRows = null;
|
|
1305
1316
|
reconcileFocusAfterVisibleModelChange(before);
|
|
1306
1317
|
}
|
|
1307
|
-
|
|
1318
|
+
const selectionChanged = reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1319
|
+
if (layoutChanged || groupingSemanticsChanged || sanitizedGroupingChanged || selectionChanged) {
|
|
1308
1320
|
emit();
|
|
1309
1321
|
}
|
|
1310
1322
|
},
|
|
@@ -1410,9 +1422,11 @@ function createGridCore(inputOptions) {
|
|
|
1410
1422
|
return;
|
|
1411
1423
|
}
|
|
1412
1424
|
const before = captureVisibleRowsForFocusReconciliation();
|
|
1425
|
+
const beforeColumns = captureColumnsForSelectionReconciliation();
|
|
1413
1426
|
rowGroups = next;
|
|
1414
1427
|
groupExpansionOverrides = /* @__PURE__ */ new Set();
|
|
1415
1428
|
reconcileFocusAfterVisibleModelChange(before);
|
|
1429
|
+
reconcileSelectionAfterColumnModelChange(beforeColumns);
|
|
1416
1430
|
emit();
|
|
1417
1431
|
},
|
|
1418
1432
|
toggleGroup(groupId) {
|
|
@@ -1515,6 +1529,111 @@ function createGridCore(inputOptions) {
|
|
|
1515
1529
|
});
|
|
1516
1530
|
emit();
|
|
1517
1531
|
}
|
|
1532
|
+
function captureColumnsForSelectionReconciliation() {
|
|
1533
|
+
return selection.ranges.length === 0 && selection.anchor === null ? null : getColumns();
|
|
1534
|
+
}
|
|
1535
|
+
function reconcileSelectionAfterColumnModelChange(before) {
|
|
1536
|
+
if (before === null) {
|
|
1537
|
+
return false;
|
|
1538
|
+
}
|
|
1539
|
+
const beforeFirst = before[0];
|
|
1540
|
+
const beforeLast = before[before.length - 1];
|
|
1541
|
+
const after = getColumns();
|
|
1542
|
+
const afterFirst = after[0];
|
|
1543
|
+
const afterLast = after[after.length - 1];
|
|
1544
|
+
if (!afterFirst || !afterLast) {
|
|
1545
|
+
selection = { ranges: [], anchor: null };
|
|
1546
|
+
return true;
|
|
1547
|
+
}
|
|
1548
|
+
if (!beforeFirst || !beforeLast) {
|
|
1549
|
+
return false;
|
|
1550
|
+
}
|
|
1551
|
+
const surviving = new Set(after.map((column) => column.id));
|
|
1552
|
+
const beforeIndex = new Map(before.map((column, i) => [column.id, i]));
|
|
1553
|
+
const afterIndex = new Map(after.map((column, i) => [column.id, i]));
|
|
1554
|
+
const anchor = selection.anchor;
|
|
1555
|
+
let anchorColumnId = anchor ? anchor.columnId : null;
|
|
1556
|
+
let anchorRemapped = false;
|
|
1557
|
+
let changed = false;
|
|
1558
|
+
const ranges = [];
|
|
1559
|
+
for (const range of selection.ranges) {
|
|
1560
|
+
const forwardFullRow = range.startColumnId === beforeFirst.id && range.endColumnId === beforeLast.id;
|
|
1561
|
+
const reverseFullRow = !forwardFullRow && range.startColumnId === beforeLast.id && range.endColumnId === beforeFirst.id;
|
|
1562
|
+
if (forwardFullRow || reverseFullRow) {
|
|
1563
|
+
const startColumnId2 = forwardFullRow ? afterFirst.id : afterLast.id;
|
|
1564
|
+
const endColumnId2 = forwardFullRow ? afterLast.id : afterFirst.id;
|
|
1565
|
+
if (startColumnId2 !== range.startColumnId || endColumnId2 !== range.endColumnId) {
|
|
1566
|
+
changed = true;
|
|
1567
|
+
}
|
|
1568
|
+
if (anchor && !anchorRemapped && (range.startRowId === anchor.rowId || range.endRowId === anchor.rowId)) {
|
|
1569
|
+
if (anchor.columnId === range.startColumnId) {
|
|
1570
|
+
anchorColumnId = startColumnId2;
|
|
1571
|
+
anchorRemapped = true;
|
|
1572
|
+
} else if (anchor.columnId === range.endColumnId) {
|
|
1573
|
+
anchorColumnId = endColumnId2;
|
|
1574
|
+
anchorRemapped = true;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
ranges.push({ ...range, startColumnId: startColumnId2, endColumnId: endColumnId2 });
|
|
1578
|
+
continue;
|
|
1579
|
+
}
|
|
1580
|
+
const beforeStart = beforeIndex.get(range.startColumnId);
|
|
1581
|
+
const beforeEnd = beforeIndex.get(range.endColumnId);
|
|
1582
|
+
if (beforeStart === void 0 || beforeEnd === void 0) {
|
|
1583
|
+
if (surviving.has(range.startColumnId) && surviving.has(range.endColumnId)) {
|
|
1584
|
+
ranges.push(range);
|
|
1585
|
+
continue;
|
|
1586
|
+
}
|
|
1587
|
+
changed = true;
|
|
1588
|
+
continue;
|
|
1589
|
+
}
|
|
1590
|
+
const lo = Math.min(beforeStart, beforeEnd);
|
|
1591
|
+
const hi = Math.max(beforeStart, beforeEnd);
|
|
1592
|
+
let memberLo = Infinity;
|
|
1593
|
+
let memberHi = -Infinity;
|
|
1594
|
+
let memberCount = 0;
|
|
1595
|
+
for (let i = lo; i <= hi; i += 1) {
|
|
1596
|
+
const nextIndex = afterIndex.get(before[i].id);
|
|
1597
|
+
if (nextIndex === void 0) {
|
|
1598
|
+
continue;
|
|
1599
|
+
}
|
|
1600
|
+
memberLo = Math.min(memberLo, nextIndex);
|
|
1601
|
+
memberHi = Math.max(memberHi, nextIndex);
|
|
1602
|
+
memberCount += 1;
|
|
1603
|
+
}
|
|
1604
|
+
if (memberCount === 0 || memberHi - memberLo + 1 !== memberCount) {
|
|
1605
|
+
changed = true;
|
|
1606
|
+
continue;
|
|
1607
|
+
}
|
|
1608
|
+
const forward = beforeStart <= beforeEnd;
|
|
1609
|
+
const startColumnId = after[forward ? memberLo : memberHi].id;
|
|
1610
|
+
const endColumnId = after[forward ? memberHi : memberLo].id;
|
|
1611
|
+
if (startColumnId === range.startColumnId && endColumnId === range.endColumnId) {
|
|
1612
|
+
ranges.push(range);
|
|
1613
|
+
continue;
|
|
1614
|
+
}
|
|
1615
|
+
changed = true;
|
|
1616
|
+
ranges.push({ ...range, startColumnId, endColumnId });
|
|
1617
|
+
}
|
|
1618
|
+
let nextAnchor = anchor;
|
|
1619
|
+
if (anchor) {
|
|
1620
|
+
if (!anchorRemapped && !surviving.has(anchor.columnId)) {
|
|
1621
|
+
anchorColumnId = null;
|
|
1622
|
+
}
|
|
1623
|
+
if (anchorColumnId === null) {
|
|
1624
|
+
nextAnchor = null;
|
|
1625
|
+
changed = true;
|
|
1626
|
+
} else if (anchorColumnId !== anchor.columnId) {
|
|
1627
|
+
nextAnchor = { ...anchor, columnId: anchorColumnId };
|
|
1628
|
+
changed = true;
|
|
1629
|
+
}
|
|
1630
|
+
}
|
|
1631
|
+
if (!changed) {
|
|
1632
|
+
return false;
|
|
1633
|
+
}
|
|
1634
|
+
selection = { ranges, anchor: nextAnchor };
|
|
1635
|
+
return true;
|
|
1636
|
+
}
|
|
1518
1637
|
function captureVisibleRowsForFocusReconciliation() {
|
|
1519
1638
|
return focus.rowId === null && focus.columnId === null ? null : getSnapshot().visibleRows;
|
|
1520
1639
|
}
|
|
@@ -1654,13 +1773,21 @@ function sameColumnLayout(a, b) {
|
|
|
1654
1773
|
return left.id === right.id && left.header === right.header && left.widthPx === right.widthPx && left.minWidthPx === right.minWidthPx && left.maxWidthPx === right.maxWidthPx && left.pinned === right.pinned && left.sortable === right.sortable && left.filterable === right.filterable && left.resizable === right.resizable && left.reorderable === right.reorderable && left.wrap === right.wrap;
|
|
1655
1774
|
});
|
|
1656
1775
|
}
|
|
1657
|
-
function
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1776
|
+
function sameColumnIds(a, b) {
|
|
1777
|
+
return a.length === b.length && a.every((left, index) => left.id === b[index].id);
|
|
1778
|
+
}
|
|
1779
|
+
function sameGroupingAccessors(a, b, rowGroups) {
|
|
1780
|
+
const levels = new Set(rowGroups);
|
|
1661
1781
|
return a.every((left, index) => {
|
|
1662
1782
|
const right = b[index];
|
|
1663
|
-
|
|
1783
|
+
if (!right || left.id !== right.id) {
|
|
1784
|
+
return false;
|
|
1785
|
+
}
|
|
1786
|
+
const participates = levels.has(left.id) || left.aggregate !== void 0 || right.aggregate !== void 0;
|
|
1787
|
+
if (!participates) {
|
|
1788
|
+
return true;
|
|
1789
|
+
}
|
|
1790
|
+
return left.value === right.value && left.aggregate === right.aggregate;
|
|
1664
1791
|
});
|
|
1665
1792
|
}
|
|
1666
1793
|
function computePageStep(viewport, rowCount) {
|