@infinite-table/infinite-react 3.0.4 → 3.0.6
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/index.d.ts +6 -2
- package/index.dev.js +115 -108
- package/index.dev.mjs +115 -108
- package/index.js +5 -5
- package/index.mjs +5 -5
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1376,7 +1376,7 @@ declare type CellPositionOptions = {
|
|
|
1376
1376
|
colId?: never;
|
|
1377
1377
|
};
|
|
1378
1378
|
|
|
1379
|
-
declare type InfiniteTableCellSelectionApi = {
|
|
1379
|
+
declare type InfiniteTableCellSelectionApi<T> = {
|
|
1380
1380
|
isCellSelected(cellPosition: CellPositionOptions): boolean;
|
|
1381
1381
|
selectCell(cellPosition: CellPositionOptions & {
|
|
1382
1382
|
clear?: boolean;
|
|
@@ -1395,6 +1395,10 @@ declare type InfiniteTableCellSelectionApi = {
|
|
|
1395
1395
|
columnIds: string[];
|
|
1396
1396
|
positions: (CellSelectionPosition | null)[][];
|
|
1397
1397
|
};
|
|
1398
|
+
mapCellSelectionPositions<SELECTED_VALUE, EMPTY_VALUE>(fn: (rowInfo: InfiniteTableRowInfo<T>, colId: string) => SELECTED_VALUE, emptyValue: EMPTY_VALUE): {
|
|
1399
|
+
columnIds: string[];
|
|
1400
|
+
positions: (SELECTED_VALUE | EMPTY_VALUE)[][];
|
|
1401
|
+
};
|
|
1398
1402
|
};
|
|
1399
1403
|
|
|
1400
1404
|
declare type ArrayOfIds = Pick<InfiniteTable_RowInfoBase<any>, 'id'>[];
|
|
@@ -2564,7 +2568,7 @@ declare type MultiSortBehaviorOptions = {
|
|
|
2564
2568
|
};
|
|
2565
2569
|
interface InfiniteTableApi<T> {
|
|
2566
2570
|
get rowSelectionApi(): InfiniteTableRowSelectionApi;
|
|
2567
|
-
get cellSelectionApi(): InfiniteTableCellSelectionApi
|
|
2571
|
+
get cellSelectionApi(): InfiniteTableCellSelectionApi<T>;
|
|
2568
2572
|
setColumnOrder: (columnOrder: InfiniteTablePropColumnOrder) => void;
|
|
2569
2573
|
setColumnVisibility: (columnVisibility: InfiniteTablePropColumnVisibility) => void;
|
|
2570
2574
|
isDestroyed: () => boolean;
|
package/index.dev.js
CHANGED
|
@@ -14538,31 +14538,67 @@ function ensureMinMaxCellPositionByIndex(start, end) {
|
|
|
14538
14538
|
{ rowIndex: rowEnd, colIndex: colEnd }
|
|
14539
14539
|
];
|
|
14540
14540
|
}
|
|
14541
|
-
|
|
14542
|
-
|
|
14543
|
-
|
|
14544
|
-
|
|
14545
|
-
|
|
14546
|
-
|
|
14547
|
-
|
|
14548
|
-
|
|
14549
|
-
|
|
14550
|
-
|
|
14551
|
-
|
|
14552
|
-
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
const
|
|
14558
|
-
const
|
|
14541
|
+
var InfiniteTableCellSelectionApiImpl = class {
|
|
14542
|
+
constructor(param) {
|
|
14543
|
+
this.getCellSelectionPosition = (options) => {
|
|
14544
|
+
var _a, _b, _c;
|
|
14545
|
+
const rowId = (_b = options.rowId) != null ? _b : (_a = getRowInfoAt(options.rowIndex, this.getDataSourceState)) == null ? void 0 : _a.id;
|
|
14546
|
+
const colId = (_c = options.colId) != null ? _c : this.getComputed().computedVisibleColumns[options.colIndex].id;
|
|
14547
|
+
return [rowId, colId];
|
|
14548
|
+
};
|
|
14549
|
+
this.setRangeSelected = (startOptions, endOptions, selected) => {
|
|
14550
|
+
const dataSourceState = this.getDataSourceState();
|
|
14551
|
+
const cellSelection = dataSourceState.cellSelection;
|
|
14552
|
+
if (!cellSelection) {
|
|
14553
|
+
return;
|
|
14554
|
+
}
|
|
14555
|
+
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14556
|
+
const [startRowId, startColId] = this.getCellSelectionPosition(startOptions);
|
|
14557
|
+
const [endRowId, endColId] = this.getCellSelectionPosition(endOptions);
|
|
14558
|
+
const startCol = this.getComputed().computedVisibleColumnsMap.get(startColId);
|
|
14559
|
+
const endCol = this.getComputed().computedVisibleColumnsMap.get(endColId);
|
|
14560
|
+
if (!startCol || !endCol) {
|
|
14561
|
+
return;
|
|
14562
|
+
}
|
|
14563
|
+
const startColIndex = startCol.computedVisibleIndex;
|
|
14564
|
+
const endColIndex = endCol.computedVisibleIndex;
|
|
14565
|
+
const startRowInfo = getRowInfoAt(startRowId, this.getDataSourceState);
|
|
14566
|
+
const endRowInfo = getRowInfoAt(endRowId, this.getDataSourceState);
|
|
14567
|
+
if (!startRowInfo || !endRowInfo) {
|
|
14568
|
+
return;
|
|
14569
|
+
}
|
|
14570
|
+
const startRowIndex = startRowInfo.indexInAll;
|
|
14571
|
+
const endRowIndex = endRowInfo.indexInAll;
|
|
14572
|
+
const [start, end] = ensureMinMaxCellPositionByIndex(
|
|
14573
|
+
{ rowIndex: startRowIndex, colIndex: startColIndex },
|
|
14574
|
+
{ rowIndex: endRowIndex, colIndex: endColIndex }
|
|
14575
|
+
);
|
|
14576
|
+
for (let i = start.rowIndex; i <= end.rowIndex; i++) {
|
|
14577
|
+
for (let j = start.colIndex; j <= end.colIndex; j++) {
|
|
14578
|
+
const pos = {
|
|
14579
|
+
rowIndex: i,
|
|
14580
|
+
colIndex: j
|
|
14581
|
+
};
|
|
14582
|
+
const [pk, colId] = this.getCellSelectionPosition(pos);
|
|
14583
|
+
if (selected) {
|
|
14584
|
+
newCellSelection.selectCell(pk, colId);
|
|
14585
|
+
} else {
|
|
14586
|
+
newCellSelection.deselectCell(pk, colId);
|
|
14587
|
+
}
|
|
14588
|
+
}
|
|
14589
|
+
}
|
|
14590
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14591
|
+
};
|
|
14592
|
+
this.getCellSelectionPositionsWithFn = (fn, emptyValue) => {
|
|
14593
|
+
const dataArray = getRowInfoArray(this.getDataSourceState);
|
|
14594
|
+
const { computedVisibleColumns } = this.getComputed();
|
|
14559
14595
|
const computedVisibleColumnsIds = computedVisibleColumns.map((x) => x.id);
|
|
14560
14596
|
const colsInSelection = /* @__PURE__ */ new Set();
|
|
14561
14597
|
const rowsInSelection = [];
|
|
14562
14598
|
const rowIdsInSelection = /* @__PURE__ */ new Set();
|
|
14563
14599
|
dataArray.filter((rowInfo) => {
|
|
14564
14600
|
computedVisibleColumns.forEach((col) => {
|
|
14565
|
-
if (
|
|
14601
|
+
if (this.isCellSelected({
|
|
14566
14602
|
rowId: rowInfo.id,
|
|
14567
14603
|
colId: col.id
|
|
14568
14604
|
})) {
|
|
@@ -14582,136 +14618,107 @@ function getCellSelectionApi(param) {
|
|
|
14582
14618
|
);
|
|
14583
14619
|
const positions = rowsInSelection.map((rowInfo) => {
|
|
14584
14620
|
return columnIds.map((colId) => {
|
|
14585
|
-
if (
|
|
14586
|
-
return
|
|
14621
|
+
if (this.isCellSelected({ rowId: rowInfo.id, colId })) {
|
|
14622
|
+
return fn(rowInfo, colId);
|
|
14587
14623
|
}
|
|
14588
|
-
return
|
|
14624
|
+
return emptyValue;
|
|
14589
14625
|
});
|
|
14590
14626
|
});
|
|
14591
14627
|
return {
|
|
14592
14628
|
columnIds,
|
|
14593
14629
|
positions
|
|
14594
14630
|
};
|
|
14595
|
-
}
|
|
14596
|
-
|
|
14597
|
-
|
|
14631
|
+
};
|
|
14632
|
+
this.getAllCellSelectionPositions = () => {
|
|
14633
|
+
return this.getCellSelectionPositionsWithFn((rowInfo, colId) => {
|
|
14634
|
+
return [rowInfo.id, colId];
|
|
14635
|
+
}, null);
|
|
14636
|
+
};
|
|
14637
|
+
this.mapCellSelectionPositions = (fn, emptyValue) => {
|
|
14638
|
+
return this.getCellSelectionPositionsWithFn(fn, emptyValue);
|
|
14639
|
+
};
|
|
14640
|
+
this.deselectAll = () => {
|
|
14641
|
+
const dataSourceState = this.getDataSourceState();
|
|
14598
14642
|
const cellSelection = dataSourceState.cellSelection;
|
|
14599
14643
|
if (!cellSelection) {
|
|
14600
14644
|
return;
|
|
14601
14645
|
}
|
|
14602
14646
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14603
14647
|
newCellSelection.deselectAll();
|
|
14604
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14605
|
-
}
|
|
14606
|
-
clear
|
|
14607
|
-
|
|
14608
|
-
}
|
|
14609
|
-
selectAll
|
|
14610
|
-
const dataSourceState = getDataSourceState();
|
|
14648
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14649
|
+
};
|
|
14650
|
+
this.clear = () => {
|
|
14651
|
+
this.deselectAll();
|
|
14652
|
+
};
|
|
14653
|
+
this.selectAll = () => {
|
|
14654
|
+
const dataSourceState = this.getDataSourceState();
|
|
14611
14655
|
const cellSelection = dataSourceState.cellSelection;
|
|
14612
14656
|
if (!cellSelection) {
|
|
14613
14657
|
return;
|
|
14614
14658
|
}
|
|
14615
14659
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14616
14660
|
newCellSelection.selectAll();
|
|
14617
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14618
|
-
}
|
|
14619
|
-
selectRange
|
|
14620
|
-
|
|
14621
|
-
}
|
|
14622
|
-
deselectRange
|
|
14623
|
-
|
|
14624
|
-
}
|
|
14625
|
-
|
|
14626
|
-
const dataSourceState = getDataSourceState();
|
|
14627
|
-
const cellSelection = dataSourceState.cellSelection;
|
|
14628
|
-
if (!cellSelection) {
|
|
14629
|
-
return;
|
|
14630
|
-
}
|
|
14631
|
-
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14632
|
-
const [startRowId, startColId] = getCellSelectionPosition(startOptions);
|
|
14633
|
-
const [endRowId, endColId] = getCellSelectionPosition(endOptions);
|
|
14634
|
-
const startCol = getComputed().computedVisibleColumnsMap.get(startColId);
|
|
14635
|
-
const endCol = getComputed().computedVisibleColumnsMap.get(endColId);
|
|
14636
|
-
if (!startCol || !endCol) {
|
|
14637
|
-
return;
|
|
14638
|
-
}
|
|
14639
|
-
const startColIndex = startCol.computedVisibleIndex;
|
|
14640
|
-
const endColIndex = endCol.computedVisibleIndex;
|
|
14641
|
-
const startRowInfo = getRowInfoAt(startRowId, getDataSourceState);
|
|
14642
|
-
const endRowInfo = getRowInfoAt(endRowId, getDataSourceState);
|
|
14643
|
-
if (!startRowInfo || !endRowInfo) {
|
|
14644
|
-
return;
|
|
14645
|
-
}
|
|
14646
|
-
const startRowIndex = startRowInfo.indexInAll;
|
|
14647
|
-
const endRowIndex = endRowInfo.indexInAll;
|
|
14648
|
-
const [start, end] = ensureMinMaxCellPositionByIndex(
|
|
14649
|
-
{ rowIndex: startRowIndex, colIndex: startColIndex },
|
|
14650
|
-
{ rowIndex: endRowIndex, colIndex: endColIndex }
|
|
14651
|
-
);
|
|
14652
|
-
for (let i = start.rowIndex; i <= end.rowIndex; i++) {
|
|
14653
|
-
for (let j = start.colIndex; j <= end.colIndex; j++) {
|
|
14654
|
-
const pos = {
|
|
14655
|
-
rowIndex: i,
|
|
14656
|
-
colIndex: j
|
|
14657
|
-
};
|
|
14658
|
-
const [pk, colId] = getCellSelectionPosition(pos);
|
|
14659
|
-
if (selected) {
|
|
14660
|
-
newCellSelection.selectCell(pk, colId);
|
|
14661
|
-
} else {
|
|
14662
|
-
newCellSelection.deselectCell(pk, colId);
|
|
14663
|
-
}
|
|
14664
|
-
}
|
|
14665
|
-
}
|
|
14666
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14667
|
-
},
|
|
14668
|
-
isCellSelected: (options) => {
|
|
14661
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14662
|
+
};
|
|
14663
|
+
this.selectRange = (startOptions, endOptions) => {
|
|
14664
|
+
this.setRangeSelected(startOptions, endOptions, true);
|
|
14665
|
+
};
|
|
14666
|
+
this.deselectRange = (startOptions, endOptions) => {
|
|
14667
|
+
this.setRangeSelected(startOptions, endOptions, false);
|
|
14668
|
+
};
|
|
14669
|
+
this.isCellSelected = (options) => {
|
|
14669
14670
|
var _a, _b;
|
|
14670
|
-
const [pk, colId] = getCellSelectionPosition(options);
|
|
14671
|
-
return (_b = (_a = getDataSourceState().cellSelection) == null ? void 0 : _a.isCellSelected(pk, colId)) != null ? _b : false;
|
|
14672
|
-
}
|
|
14673
|
-
selectCell
|
|
14674
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14671
|
+
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
14672
|
+
return (_b = (_a = this.getDataSourceState().cellSelection) == null ? void 0 : _a.isCellSelected(pk, colId)) != null ? _b : false;
|
|
14673
|
+
};
|
|
14674
|
+
this.selectCell = (options) => {
|
|
14675
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14675
14676
|
if (!cellSelection) {
|
|
14676
14677
|
return;
|
|
14677
14678
|
}
|
|
14678
|
-
const [pk, colId] = getCellSelectionPosition(options);
|
|
14679
|
+
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
14679
14680
|
const newCellSelection = options.clear ? new CellSelectionState() : new CellSelectionState(cellSelection);
|
|
14680
14681
|
newCellSelection.selectCell(pk, colId);
|
|
14681
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14682
|
-
}
|
|
14683
|
-
deselectCell
|
|
14684
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14682
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14683
|
+
};
|
|
14684
|
+
this.deselectCell = (options) => {
|
|
14685
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14685
14686
|
if (!cellSelection) {
|
|
14686
14687
|
return;
|
|
14687
14688
|
}
|
|
14688
|
-
const [pk, colId] = getCellSelectionPosition(options);
|
|
14689
|
+
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
14689
14690
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14690
14691
|
newCellSelection.deselectCell(pk, colId);
|
|
14691
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14692
|
-
}
|
|
14693
|
-
selectColumn
|
|
14692
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14693
|
+
};
|
|
14694
|
+
this.selectColumn = (colId, options) => {
|
|
14694
14695
|
if (options == null ? void 0 : options.clear) {
|
|
14695
|
-
|
|
14696
|
+
this.deselectAll();
|
|
14696
14697
|
}
|
|
14697
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14698
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14698
14699
|
if (!cellSelection) {
|
|
14699
14700
|
return;
|
|
14700
14701
|
}
|
|
14701
14702
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14702
14703
|
newCellSelection.selectColumn(colId);
|
|
14703
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14704
|
-
}
|
|
14705
|
-
deselectColumn
|
|
14706
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14704
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14705
|
+
};
|
|
14706
|
+
this.deselectColumn = (colId) => {
|
|
14707
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14707
14708
|
if (!cellSelection) {
|
|
14708
14709
|
return;
|
|
14709
14710
|
}
|
|
14710
14711
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14711
14712
|
newCellSelection.deselectColumn(colId);
|
|
14712
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14713
|
-
}
|
|
14714
|
-
|
|
14713
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14714
|
+
};
|
|
14715
|
+
this.getComputed = param.getComputed;
|
|
14716
|
+
this.getDataSourceState = param.getDataSourceState;
|
|
14717
|
+
this.dataSourceActions = param.dataSourceActions;
|
|
14718
|
+
}
|
|
14719
|
+
};
|
|
14720
|
+
function getCellSelectionApi(param) {
|
|
14721
|
+
const cellSelectionApi = new InfiniteTableCellSelectionApiImpl(param);
|
|
14715
14722
|
if (false) {
|
|
14716
14723
|
globalThis.cellSelectionApi = cellSelectionApi;
|
|
14717
14724
|
}
|
|
@@ -17583,7 +17590,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17583
17590
|
const valid = (0, import_react49.useMemo)(() => {
|
|
17584
17591
|
let valid2 = isValidLicense(licenseKey, {
|
|
17585
17592
|
publishedAt: 1624970570587,
|
|
17586
|
-
version: "3.0.
|
|
17593
|
+
version: "3.0.6"
|
|
17587
17594
|
});
|
|
17588
17595
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17589
17596
|
return true;
|
package/index.dev.mjs
CHANGED
|
@@ -14523,31 +14523,67 @@ function ensureMinMaxCellPositionByIndex(start, end) {
|
|
|
14523
14523
|
{ rowIndex: rowEnd, colIndex: colEnd }
|
|
14524
14524
|
];
|
|
14525
14525
|
}
|
|
14526
|
-
|
|
14527
|
-
|
|
14528
|
-
|
|
14529
|
-
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
|
|
14534
|
-
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
|
|
14539
|
-
|
|
14540
|
-
|
|
14541
|
-
|
|
14542
|
-
const
|
|
14543
|
-
const
|
|
14526
|
+
var InfiniteTableCellSelectionApiImpl = class {
|
|
14527
|
+
constructor(param) {
|
|
14528
|
+
this.getCellSelectionPosition = (options) => {
|
|
14529
|
+
var _a, _b, _c;
|
|
14530
|
+
const rowId = (_b = options.rowId) != null ? _b : (_a = getRowInfoAt(options.rowIndex, this.getDataSourceState)) == null ? void 0 : _a.id;
|
|
14531
|
+
const colId = (_c = options.colId) != null ? _c : this.getComputed().computedVisibleColumns[options.colIndex].id;
|
|
14532
|
+
return [rowId, colId];
|
|
14533
|
+
};
|
|
14534
|
+
this.setRangeSelected = (startOptions, endOptions, selected) => {
|
|
14535
|
+
const dataSourceState = this.getDataSourceState();
|
|
14536
|
+
const cellSelection = dataSourceState.cellSelection;
|
|
14537
|
+
if (!cellSelection) {
|
|
14538
|
+
return;
|
|
14539
|
+
}
|
|
14540
|
+
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14541
|
+
const [startRowId, startColId] = this.getCellSelectionPosition(startOptions);
|
|
14542
|
+
const [endRowId, endColId] = this.getCellSelectionPosition(endOptions);
|
|
14543
|
+
const startCol = this.getComputed().computedVisibleColumnsMap.get(startColId);
|
|
14544
|
+
const endCol = this.getComputed().computedVisibleColumnsMap.get(endColId);
|
|
14545
|
+
if (!startCol || !endCol) {
|
|
14546
|
+
return;
|
|
14547
|
+
}
|
|
14548
|
+
const startColIndex = startCol.computedVisibleIndex;
|
|
14549
|
+
const endColIndex = endCol.computedVisibleIndex;
|
|
14550
|
+
const startRowInfo = getRowInfoAt(startRowId, this.getDataSourceState);
|
|
14551
|
+
const endRowInfo = getRowInfoAt(endRowId, this.getDataSourceState);
|
|
14552
|
+
if (!startRowInfo || !endRowInfo) {
|
|
14553
|
+
return;
|
|
14554
|
+
}
|
|
14555
|
+
const startRowIndex = startRowInfo.indexInAll;
|
|
14556
|
+
const endRowIndex = endRowInfo.indexInAll;
|
|
14557
|
+
const [start, end] = ensureMinMaxCellPositionByIndex(
|
|
14558
|
+
{ rowIndex: startRowIndex, colIndex: startColIndex },
|
|
14559
|
+
{ rowIndex: endRowIndex, colIndex: endColIndex }
|
|
14560
|
+
);
|
|
14561
|
+
for (let i = start.rowIndex; i <= end.rowIndex; i++) {
|
|
14562
|
+
for (let j = start.colIndex; j <= end.colIndex; j++) {
|
|
14563
|
+
const pos = {
|
|
14564
|
+
rowIndex: i,
|
|
14565
|
+
colIndex: j
|
|
14566
|
+
};
|
|
14567
|
+
const [pk, colId] = this.getCellSelectionPosition(pos);
|
|
14568
|
+
if (selected) {
|
|
14569
|
+
newCellSelection.selectCell(pk, colId);
|
|
14570
|
+
} else {
|
|
14571
|
+
newCellSelection.deselectCell(pk, colId);
|
|
14572
|
+
}
|
|
14573
|
+
}
|
|
14574
|
+
}
|
|
14575
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14576
|
+
};
|
|
14577
|
+
this.getCellSelectionPositionsWithFn = (fn, emptyValue) => {
|
|
14578
|
+
const dataArray = getRowInfoArray(this.getDataSourceState);
|
|
14579
|
+
const { computedVisibleColumns } = this.getComputed();
|
|
14544
14580
|
const computedVisibleColumnsIds = computedVisibleColumns.map((x) => x.id);
|
|
14545
14581
|
const colsInSelection = /* @__PURE__ */ new Set();
|
|
14546
14582
|
const rowsInSelection = [];
|
|
14547
14583
|
const rowIdsInSelection = /* @__PURE__ */ new Set();
|
|
14548
14584
|
dataArray.filter((rowInfo) => {
|
|
14549
14585
|
computedVisibleColumns.forEach((col) => {
|
|
14550
|
-
if (
|
|
14586
|
+
if (this.isCellSelected({
|
|
14551
14587
|
rowId: rowInfo.id,
|
|
14552
14588
|
colId: col.id
|
|
14553
14589
|
})) {
|
|
@@ -14567,136 +14603,107 @@ function getCellSelectionApi(param) {
|
|
|
14567
14603
|
);
|
|
14568
14604
|
const positions = rowsInSelection.map((rowInfo) => {
|
|
14569
14605
|
return columnIds.map((colId) => {
|
|
14570
|
-
if (
|
|
14571
|
-
return
|
|
14606
|
+
if (this.isCellSelected({ rowId: rowInfo.id, colId })) {
|
|
14607
|
+
return fn(rowInfo, colId);
|
|
14572
14608
|
}
|
|
14573
|
-
return
|
|
14609
|
+
return emptyValue;
|
|
14574
14610
|
});
|
|
14575
14611
|
});
|
|
14576
14612
|
return {
|
|
14577
14613
|
columnIds,
|
|
14578
14614
|
positions
|
|
14579
14615
|
};
|
|
14580
|
-
}
|
|
14581
|
-
|
|
14582
|
-
|
|
14616
|
+
};
|
|
14617
|
+
this.getAllCellSelectionPositions = () => {
|
|
14618
|
+
return this.getCellSelectionPositionsWithFn((rowInfo, colId) => {
|
|
14619
|
+
return [rowInfo.id, colId];
|
|
14620
|
+
}, null);
|
|
14621
|
+
};
|
|
14622
|
+
this.mapCellSelectionPositions = (fn, emptyValue) => {
|
|
14623
|
+
return this.getCellSelectionPositionsWithFn(fn, emptyValue);
|
|
14624
|
+
};
|
|
14625
|
+
this.deselectAll = () => {
|
|
14626
|
+
const dataSourceState = this.getDataSourceState();
|
|
14583
14627
|
const cellSelection = dataSourceState.cellSelection;
|
|
14584
14628
|
if (!cellSelection) {
|
|
14585
14629
|
return;
|
|
14586
14630
|
}
|
|
14587
14631
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14588
14632
|
newCellSelection.deselectAll();
|
|
14589
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14590
|
-
}
|
|
14591
|
-
clear
|
|
14592
|
-
|
|
14593
|
-
}
|
|
14594
|
-
selectAll
|
|
14595
|
-
const dataSourceState = getDataSourceState();
|
|
14633
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14634
|
+
};
|
|
14635
|
+
this.clear = () => {
|
|
14636
|
+
this.deselectAll();
|
|
14637
|
+
};
|
|
14638
|
+
this.selectAll = () => {
|
|
14639
|
+
const dataSourceState = this.getDataSourceState();
|
|
14596
14640
|
const cellSelection = dataSourceState.cellSelection;
|
|
14597
14641
|
if (!cellSelection) {
|
|
14598
14642
|
return;
|
|
14599
14643
|
}
|
|
14600
14644
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14601
14645
|
newCellSelection.selectAll();
|
|
14602
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14603
|
-
}
|
|
14604
|
-
selectRange
|
|
14605
|
-
|
|
14606
|
-
}
|
|
14607
|
-
deselectRange
|
|
14608
|
-
|
|
14609
|
-
}
|
|
14610
|
-
|
|
14611
|
-
const dataSourceState = getDataSourceState();
|
|
14612
|
-
const cellSelection = dataSourceState.cellSelection;
|
|
14613
|
-
if (!cellSelection) {
|
|
14614
|
-
return;
|
|
14615
|
-
}
|
|
14616
|
-
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14617
|
-
const [startRowId, startColId] = getCellSelectionPosition(startOptions);
|
|
14618
|
-
const [endRowId, endColId] = getCellSelectionPosition(endOptions);
|
|
14619
|
-
const startCol = getComputed().computedVisibleColumnsMap.get(startColId);
|
|
14620
|
-
const endCol = getComputed().computedVisibleColumnsMap.get(endColId);
|
|
14621
|
-
if (!startCol || !endCol) {
|
|
14622
|
-
return;
|
|
14623
|
-
}
|
|
14624
|
-
const startColIndex = startCol.computedVisibleIndex;
|
|
14625
|
-
const endColIndex = endCol.computedVisibleIndex;
|
|
14626
|
-
const startRowInfo = getRowInfoAt(startRowId, getDataSourceState);
|
|
14627
|
-
const endRowInfo = getRowInfoAt(endRowId, getDataSourceState);
|
|
14628
|
-
if (!startRowInfo || !endRowInfo) {
|
|
14629
|
-
return;
|
|
14630
|
-
}
|
|
14631
|
-
const startRowIndex = startRowInfo.indexInAll;
|
|
14632
|
-
const endRowIndex = endRowInfo.indexInAll;
|
|
14633
|
-
const [start, end] = ensureMinMaxCellPositionByIndex(
|
|
14634
|
-
{ rowIndex: startRowIndex, colIndex: startColIndex },
|
|
14635
|
-
{ rowIndex: endRowIndex, colIndex: endColIndex }
|
|
14636
|
-
);
|
|
14637
|
-
for (let i = start.rowIndex; i <= end.rowIndex; i++) {
|
|
14638
|
-
for (let j = start.colIndex; j <= end.colIndex; j++) {
|
|
14639
|
-
const pos = {
|
|
14640
|
-
rowIndex: i,
|
|
14641
|
-
colIndex: j
|
|
14642
|
-
};
|
|
14643
|
-
const [pk, colId] = getCellSelectionPosition(pos);
|
|
14644
|
-
if (selected) {
|
|
14645
|
-
newCellSelection.selectCell(pk, colId);
|
|
14646
|
-
} else {
|
|
14647
|
-
newCellSelection.deselectCell(pk, colId);
|
|
14648
|
-
}
|
|
14649
|
-
}
|
|
14650
|
-
}
|
|
14651
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14652
|
-
},
|
|
14653
|
-
isCellSelected: (options) => {
|
|
14646
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14647
|
+
};
|
|
14648
|
+
this.selectRange = (startOptions, endOptions) => {
|
|
14649
|
+
this.setRangeSelected(startOptions, endOptions, true);
|
|
14650
|
+
};
|
|
14651
|
+
this.deselectRange = (startOptions, endOptions) => {
|
|
14652
|
+
this.setRangeSelected(startOptions, endOptions, false);
|
|
14653
|
+
};
|
|
14654
|
+
this.isCellSelected = (options) => {
|
|
14654
14655
|
var _a, _b;
|
|
14655
|
-
const [pk, colId] = getCellSelectionPosition(options);
|
|
14656
|
-
return (_b = (_a = getDataSourceState().cellSelection) == null ? void 0 : _a.isCellSelected(pk, colId)) != null ? _b : false;
|
|
14657
|
-
}
|
|
14658
|
-
selectCell
|
|
14659
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14656
|
+
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
14657
|
+
return (_b = (_a = this.getDataSourceState().cellSelection) == null ? void 0 : _a.isCellSelected(pk, colId)) != null ? _b : false;
|
|
14658
|
+
};
|
|
14659
|
+
this.selectCell = (options) => {
|
|
14660
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14660
14661
|
if (!cellSelection) {
|
|
14661
14662
|
return;
|
|
14662
14663
|
}
|
|
14663
|
-
const [pk, colId] = getCellSelectionPosition(options);
|
|
14664
|
+
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
14664
14665
|
const newCellSelection = options.clear ? new CellSelectionState() : new CellSelectionState(cellSelection);
|
|
14665
14666
|
newCellSelection.selectCell(pk, colId);
|
|
14666
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14667
|
-
}
|
|
14668
|
-
deselectCell
|
|
14669
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14667
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14668
|
+
};
|
|
14669
|
+
this.deselectCell = (options) => {
|
|
14670
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14670
14671
|
if (!cellSelection) {
|
|
14671
14672
|
return;
|
|
14672
14673
|
}
|
|
14673
|
-
const [pk, colId] = getCellSelectionPosition(options);
|
|
14674
|
+
const [pk, colId] = this.getCellSelectionPosition(options);
|
|
14674
14675
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14675
14676
|
newCellSelection.deselectCell(pk, colId);
|
|
14676
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14677
|
-
}
|
|
14678
|
-
selectColumn
|
|
14677
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14678
|
+
};
|
|
14679
|
+
this.selectColumn = (colId, options) => {
|
|
14679
14680
|
if (options == null ? void 0 : options.clear) {
|
|
14680
|
-
|
|
14681
|
+
this.deselectAll();
|
|
14681
14682
|
}
|
|
14682
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14683
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14683
14684
|
if (!cellSelection) {
|
|
14684
14685
|
return;
|
|
14685
14686
|
}
|
|
14686
14687
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14687
14688
|
newCellSelection.selectColumn(colId);
|
|
14688
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14689
|
-
}
|
|
14690
|
-
deselectColumn
|
|
14691
|
-
const cellSelection = getDataSourceState().cellSelection;
|
|
14689
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14690
|
+
};
|
|
14691
|
+
this.deselectColumn = (colId) => {
|
|
14692
|
+
const cellSelection = this.getDataSourceState().cellSelection;
|
|
14692
14693
|
if (!cellSelection) {
|
|
14693
14694
|
return;
|
|
14694
14695
|
}
|
|
14695
14696
|
const newCellSelection = new CellSelectionState(cellSelection);
|
|
14696
14697
|
newCellSelection.deselectColumn(colId);
|
|
14697
|
-
dataSourceActions.cellSelection = newCellSelection;
|
|
14698
|
-
}
|
|
14699
|
-
|
|
14698
|
+
this.dataSourceActions.cellSelection = newCellSelection;
|
|
14699
|
+
};
|
|
14700
|
+
this.getComputed = param.getComputed;
|
|
14701
|
+
this.getDataSourceState = param.getDataSourceState;
|
|
14702
|
+
this.dataSourceActions = param.dataSourceActions;
|
|
14703
|
+
}
|
|
14704
|
+
};
|
|
14705
|
+
function getCellSelectionApi(param) {
|
|
14706
|
+
const cellSelectionApi = new InfiniteTableCellSelectionApiImpl(param);
|
|
14700
14707
|
if (false) {
|
|
14701
14708
|
globalThis.cellSelectionApi = cellSelectionApi;
|
|
14702
14709
|
}
|
|
@@ -17572,7 +17579,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
17572
17579
|
const valid = useMemo11(() => {
|
|
17573
17580
|
let valid2 = isValidLicense(licenseKey, {
|
|
17574
17581
|
publishedAt: 1624970570587,
|
|
17575
|
-
version: "3.0.
|
|
17582
|
+
version: "3.0.6"
|
|
17576
17583
|
});
|
|
17577
17584
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
17578
17585
|
return true;
|