@infinite-table/infinite-react 3.0.1 → 3.0.2

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/README.md CHANGED
@@ -24,6 +24,7 @@
24
24
  - [❤️ TypeScript](#-typescript)
25
25
  - [🏢 Enterprise-ready](#-enterprise-ready)
26
26
  - [🔒 Secure by default](#-secure-by-default)
27
+ - [🚫 No dependencies](#-no-dependencies)
27
28
  - [📦 Small bundle size](#-small-bundle-size)
28
29
  - [🧪 Automated end-to-end tests](#-automated-end-to-end-tests)
29
30
  - [🎨 Themable](#-themable)
@@ -83,17 +84,21 @@ It's fully typed and offers you great developer experience to help you get up an
83
84
 
84
85
  ## 🏢 Enterprise-ready
85
86
 
86
- Infinite Table is ready to power your enterprise apps, as it supports advanced [data fetching](https://infinite-table.com/docs/learn/working-with-data#data-loading-strategies), [filtering](https://infinite-table.com/docs/learn/filtering), [sorting](https://infinite-table.com/docs/learn/sorting/overview), [grouping](https://infinite-table.com/docs/learn/grouping-and-pivoting/grouping-rows), [pivoting](https://infinite-table.com/docs/learn/grouping-and-pivoting/pivoting/overview), [aggregations](https://infinite-table.com/docs/learn/grouping-and-pivoting/group-aggregations), [live pagination](https://infinite-table.com/docs/learn/working-with-data/live-pagination), [lazy loading](https://infinite-table.com/docs/learn/working-with-data/lazy-loading) - all of those with support for both client-side and server-side implementations.
87
+ Infinite Table is ready to power your enterprise apps, as it supports advanced [data fetching](https://infinite-table.com/docs/learn/working-with-data#data-loading-strategies), [filtering](https://infinite-table.com/docs/learn/filtering), [sorting](https://infinite-table.com/docs/learn/sorting/overview), [grouping](https://infinite-table.com/docs/learn/grouping-and-pivoting/grouping-rows), [pivoting](https://infinite-table.com/docs/learn/grouping-and-pivoting/pivoting/overview), [aggregations](https://infinite-table.com/docs/learn/grouping-and-pivoting/group-aggregations), [https://infinite-table.com/docs/learn/selection/row-selection](row & cell selection), [live pagination](https://infinite-table.com/docs/learn/working-with-data/live-pagination), [lazy loading](https://infinite-table.com/docs/learn/working-with-data/lazy-loading) - all of those with support for both client-side and server-side implementations.
87
88
 
88
89
  You can choose to leverage our built-in implementations in the browser or you can process your data on the server with full support from our-side.
89
90
 
90
91
  ### 🔒 Secure by default
91
92
 
92
- We take security seriously and only have a total of 3 dependencies in our full dependency graph - and this number will only go down.
93
+ We take security seriously and we're not installing any dependencies. No extra fluff to slow down your code or make installs less secure.
94
+
95
+ ### 🚫 No dependencies
96
+
97
+ We don't depend on any external package, so you can be sure that you're not introducing any security vulnerabilities in your app.
93
98
 
94
99
  ### 📦 Small bundle size
95
100
 
96
- Our bundle size is under `250kB` and we're [keeping it small](https://bundlephobia.com/package/@infinite-table/infinite-react).
101
+ Our bundle size is under `300kB` and we're [keeping it small](https://bundlephobia.com/package/@infinite-table/infinite-react).
97
102
 
98
103
  ### 🧪 Automated end-to-end tests
99
104
 
package/index.d.ts CHANGED
@@ -1391,6 +1391,10 @@ declare type InfiniteTableCellSelectionApi = {
1391
1391
  deselectColumn(colId: string): void;
1392
1392
  selectRange(start: CellPositionOptions, end: CellPositionOptions): void;
1393
1393
  deselectRange(start: CellPositionOptions, end: CellPositionOptions): void;
1394
+ getAllCellSelectionPositions(): {
1395
+ columnIds: string[];
1396
+ positions: (CellSelectionPosition | null)[][];
1397
+ };
1394
1398
  };
1395
1399
 
1396
1400
  declare type ArrayOfIds = Pick<InfiniteTable_RowInfoBase<any>, 'id'>[];
package/index.dev.js CHANGED
@@ -14517,6 +14517,15 @@ function notNullable(value) {
14517
14517
  }
14518
14518
 
14519
14519
  // src/components/InfiniteTable/api/getCellSelectionApi.ts
14520
+ function ensureSortedPerOrder(arr, sortPattern) {
14521
+ const arrSet = new Set(arr);
14522
+ return sortPattern.map((item) => {
14523
+ if (arrSet.has(item)) {
14524
+ return item;
14525
+ }
14526
+ return null;
14527
+ }).filter((x) => x != null);
14528
+ }
14520
14529
  function ensureMinMaxCellPositionByIndex(start, end) {
14521
14530
  let { rowIndex: startRowIndex, colIndex: startColIndex } = start;
14522
14531
  let { rowIndex: endRowIndex, colIndex: endColIndex } = end;
@@ -14542,6 +14551,46 @@ function getCellSelectionApi(param) {
14542
14551
  return [rowId, colId];
14543
14552
  };
14544
14553
  const cellSelectionApi = {
14554
+ getAllCellSelectionPositions: () => {
14555
+ const dataArray = getRowInfoArray(getDataSourceState);
14556
+ const { computedVisibleColumns } = getComputed();
14557
+ const computedVisibleColumnsIds = computedVisibleColumns.map((x) => x.id);
14558
+ const colsInSelection = /* @__PURE__ */ new Set();
14559
+ const rowsInSelection = [];
14560
+ const rowIdsInSelection = /* @__PURE__ */ new Set();
14561
+ dataArray.filter((rowInfo) => {
14562
+ computedVisibleColumns.forEach((col) => {
14563
+ if (cellSelectionApi.isCellSelected({
14564
+ rowId: rowInfo.id,
14565
+ colId: col.id
14566
+ })) {
14567
+ if (!colsInSelection.has(col.id)) {
14568
+ colsInSelection.add(col.id);
14569
+ }
14570
+ if (!rowIdsInSelection.has(rowInfo.id)) {
14571
+ rowIdsInSelection.add(rowInfo.id);
14572
+ rowsInSelection.push(rowInfo);
14573
+ }
14574
+ }
14575
+ });
14576
+ });
14577
+ const columnIds = ensureSortedPerOrder(
14578
+ Array.from(colsInSelection),
14579
+ computedVisibleColumnsIds
14580
+ );
14581
+ const positions = rowsInSelection.map((rowInfo) => {
14582
+ return columnIds.map((colId) => {
14583
+ if (cellSelectionApi.isCellSelected({ rowId: rowInfo.id, colId })) {
14584
+ return [rowInfo.id, colId];
14585
+ }
14586
+ return null;
14587
+ });
14588
+ });
14589
+ return {
14590
+ columnIds,
14591
+ positions
14592
+ };
14593
+ },
14545
14594
  deselectAll: () => {
14546
14595
  const dataSourceState = getDataSourceState();
14547
14596
  const cellSelection = dataSourceState.cellSelection;
@@ -17532,7 +17581,7 @@ var useLicense = (licenseKey = "") => {
17532
17581
  const valid = (0, import_react49.useMemo)(() => {
17533
17582
  let valid2 = isValidLicense(licenseKey, {
17534
17583
  publishedAt: 1624970570587,
17535
- version: "3.0.1"
17584
+ version: "3.0.2"
17536
17585
  });
17537
17586
  if (!licenseKey && !valid2 && isInsidePlayground) {
17538
17587
  return true;
package/index.dev.mjs CHANGED
@@ -14502,6 +14502,15 @@ function notNullable(value) {
14502
14502
  }
14503
14503
 
14504
14504
  // src/components/InfiniteTable/api/getCellSelectionApi.ts
14505
+ function ensureSortedPerOrder(arr, sortPattern) {
14506
+ const arrSet = new Set(arr);
14507
+ return sortPattern.map((item) => {
14508
+ if (arrSet.has(item)) {
14509
+ return item;
14510
+ }
14511
+ return null;
14512
+ }).filter((x) => x != null);
14513
+ }
14505
14514
  function ensureMinMaxCellPositionByIndex(start, end) {
14506
14515
  let { rowIndex: startRowIndex, colIndex: startColIndex } = start;
14507
14516
  let { rowIndex: endRowIndex, colIndex: endColIndex } = end;
@@ -14527,6 +14536,46 @@ function getCellSelectionApi(param) {
14527
14536
  return [rowId, colId];
14528
14537
  };
14529
14538
  const cellSelectionApi = {
14539
+ getAllCellSelectionPositions: () => {
14540
+ const dataArray = getRowInfoArray(getDataSourceState);
14541
+ const { computedVisibleColumns } = getComputed();
14542
+ const computedVisibleColumnsIds = computedVisibleColumns.map((x) => x.id);
14543
+ const colsInSelection = /* @__PURE__ */ new Set();
14544
+ const rowsInSelection = [];
14545
+ const rowIdsInSelection = /* @__PURE__ */ new Set();
14546
+ dataArray.filter((rowInfo) => {
14547
+ computedVisibleColumns.forEach((col) => {
14548
+ if (cellSelectionApi.isCellSelected({
14549
+ rowId: rowInfo.id,
14550
+ colId: col.id
14551
+ })) {
14552
+ if (!colsInSelection.has(col.id)) {
14553
+ colsInSelection.add(col.id);
14554
+ }
14555
+ if (!rowIdsInSelection.has(rowInfo.id)) {
14556
+ rowIdsInSelection.add(rowInfo.id);
14557
+ rowsInSelection.push(rowInfo);
14558
+ }
14559
+ }
14560
+ });
14561
+ });
14562
+ const columnIds = ensureSortedPerOrder(
14563
+ Array.from(colsInSelection),
14564
+ computedVisibleColumnsIds
14565
+ );
14566
+ const positions = rowsInSelection.map((rowInfo) => {
14567
+ return columnIds.map((colId) => {
14568
+ if (cellSelectionApi.isCellSelected({ rowId: rowInfo.id, colId })) {
14569
+ return [rowInfo.id, colId];
14570
+ }
14571
+ return null;
14572
+ });
14573
+ });
14574
+ return {
14575
+ columnIds,
14576
+ positions
14577
+ };
14578
+ },
14530
14579
  deselectAll: () => {
14531
14580
  const dataSourceState = getDataSourceState();
14532
14581
  const cellSelection = dataSourceState.cellSelection;
@@ -17521,7 +17570,7 @@ var useLicense = (licenseKey = "") => {
17521
17570
  const valid = useMemo11(() => {
17522
17571
  let valid2 = isValidLicense(licenseKey, {
17523
17572
  publishedAt: 1624970570587,
17524
- version: "3.0.1"
17573
+ version: "3.0.2"
17525
17574
  });
17526
17575
  if (!licenseKey && !valid2 && isInsidePlayground) {
17527
17576
  return true;