@infinite-table/infinite-react 0.4.5 → 0.4.8
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 +1 -1
- package/index.esm.js +28 -15
- package/index.js +28 -15
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -1703,7 +1703,7 @@ declare type InfiniteTableSelectionApi = {
|
|
|
1703
1703
|
deselectGroupRow(groupKeys: any[], children?: ArrayOfIds): void;
|
|
1704
1704
|
toggleGroupRowSelection(groupKeys: any[], children?: ArrayOfIds): void;
|
|
1705
1705
|
getGroupRowSelectionState(groupKeys: any[]): boolean | null;
|
|
1706
|
-
getSelectedPrimaryKeys(): (string | number)[];
|
|
1706
|
+
getSelectedPrimaryKeys(rowSelection?: RowSelectionStateObject): (string | number)[];
|
|
1707
1707
|
selectAll(): void;
|
|
1708
1708
|
deselectAll(): void;
|
|
1709
1709
|
};
|
package/index.esm.js
CHANGED
|
@@ -6785,6 +6785,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6785
6785
|
};
|
|
6786
6786
|
const align = column.align || "start";
|
|
6787
6787
|
const renderChildren = () => {
|
|
6788
|
+
var _a2;
|
|
6788
6789
|
if (column.renderSortIcon) {
|
|
6789
6790
|
renderParam.renderBag.sortIcon = /* @__PURE__ */ createElement25(RenderHeaderCellHookComponent, {
|
|
6790
6791
|
render: column.renderSortIcon,
|
|
@@ -6798,9 +6799,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6798
6799
|
render: defaultRenderSelectionCheckBox2,
|
|
6799
6800
|
renderParam
|
|
6800
6801
|
});
|
|
6801
|
-
|
|
6802
|
+
const renderHeaderSelectionCheckBox = (_a2 = column.renderHeaderSelectionCheckBox) != null ? _a2 : column.renderSelectionCheckBox;
|
|
6803
|
+
if (renderHeaderSelectionCheckBox && renderHeaderSelectionCheckBox !== true) {
|
|
6802
6804
|
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ createElement25(RenderHeaderCellHookComponent, {
|
|
6803
|
-
render:
|
|
6805
|
+
render: renderHeaderSelectionCheckBox,
|
|
6804
6806
|
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6805
6807
|
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6806
6808
|
})
|
|
@@ -9402,11 +9404,17 @@ function getSelectionApi(param) {
|
|
|
9402
9404
|
}
|
|
9403
9405
|
return rowSelection.getGroupRowSelectionState(groupKeys);
|
|
9404
9406
|
},
|
|
9405
|
-
getSelectedPrimaryKeys: () => {
|
|
9407
|
+
getSelectedPrimaryKeys: (rowSelection) => {
|
|
9408
|
+
const state = getDataSourceState();
|
|
9409
|
+
const rowSelectionState = rowSelection ? new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(state)) : state.rowSelection;
|
|
9406
9410
|
const selected = [];
|
|
9407
|
-
|
|
9408
|
-
|
|
9409
|
-
|
|
9411
|
+
if (state.lazyLoad) {
|
|
9412
|
+
console.error(`getSelectedPrimaryKeys should not be called for lazy-loaded datasources as it wont return reliable results`);
|
|
9413
|
+
}
|
|
9414
|
+
state.originalDataArray.forEach((data) => {
|
|
9415
|
+
const id = state.toPrimaryKey(data);
|
|
9416
|
+
if (rowSelectionState.isRowSelected(id)) {
|
|
9417
|
+
selected.push(id);
|
|
9410
9418
|
}
|
|
9411
9419
|
});
|
|
9412
9420
|
return selected;
|
|
@@ -9582,7 +9590,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
9582
9590
|
return livePaginationCursor;
|
|
9583
9591
|
}
|
|
9584
9592
|
function mapPropsToState(params) {
|
|
9585
|
-
var _a
|
|
9593
|
+
var _a;
|
|
9586
9594
|
const { props, state, oldState } = params;
|
|
9587
9595
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
9588
9596
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -9601,7 +9609,7 @@ function mapPropsToState(params) {
|
|
|
9601
9609
|
if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
|
|
9602
9610
|
selectionMode = "multi-cell";
|
|
9603
9611
|
} else {
|
|
9604
|
-
const rowSelectionProp =
|
|
9612
|
+
const rowSelectionProp = props.rowSelection !== void 0 ? props.rowSelection : props.defaultRowSelection;
|
|
9605
9613
|
if (rowSelectionProp !== void 0) {
|
|
9606
9614
|
if (rowSelectionProp && typeof rowSelectionProp === "object") {
|
|
9607
9615
|
selectionMode = "multi-row";
|
|
@@ -9636,7 +9644,7 @@ function mapPropsToState(params) {
|
|
|
9636
9644
|
operatorsByFilterType,
|
|
9637
9645
|
controlledSort,
|
|
9638
9646
|
controlledFilter,
|
|
9639
|
-
filterMode: ((
|
|
9647
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
9640
9648
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
9641
9649
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
9642
9650
|
};
|
|
@@ -12374,7 +12382,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12374
12382
|
const valid = useMemo11(() => {
|
|
12375
12383
|
let valid2 = isValidLicense(licenseKey, {
|
|
12376
12384
|
publishedAt: 1624970570587,
|
|
12377
|
-
version: "0.4.
|
|
12385
|
+
version: "0.4.8"
|
|
12378
12386
|
});
|
|
12379
12387
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12380
12388
|
return true;
|
|
@@ -12436,7 +12444,7 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
12436
12444
|
times++;
|
|
12437
12445
|
rafId.current = requestAnimationFrame(() => {
|
|
12438
12446
|
didScrollRef.current = imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
12439
|
-
offset:
|
|
12447
|
+
offset: 0
|
|
12440
12448
|
});
|
|
12441
12449
|
if (!didScrollRef.current && times < RETRIES2) {
|
|
12442
12450
|
tryScroll(times);
|
|
@@ -12709,11 +12717,10 @@ function onCellClick(context, event) {
|
|
|
12709
12717
|
updateRowSelectionOnCellClick(context, event);
|
|
12710
12718
|
}
|
|
12711
12719
|
function updateRowSelectionOnCellClick(context, event) {
|
|
12712
|
-
const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
|
|
12720
|
+
const { rowIndex, getDataSourceState, getComputed, dataSourceActions, api } = context;
|
|
12713
12721
|
const { multiRowSelector, renderSelectionCheckBox } = getComputed();
|
|
12714
12722
|
const dataSourceState = getDataSourceState();
|
|
12715
|
-
const { selectionMode, groupBy } = dataSourceState;
|
|
12716
|
-
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12723
|
+
const { selectionMode, groupBy, dataArray } = dataSourceState;
|
|
12717
12724
|
if (groupBy.length) {
|
|
12718
12725
|
return false;
|
|
12719
12726
|
}
|
|
@@ -12721,6 +12728,7 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12721
12728
|
if (renderSelectionCheckBox && !event.key) {
|
|
12722
12729
|
return false;
|
|
12723
12730
|
}
|
|
12731
|
+
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12724
12732
|
rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12725
12733
|
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
12726
12734
|
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
@@ -12735,6 +12743,12 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12735
12743
|
return true;
|
|
12736
12744
|
}
|
|
12737
12745
|
} else if (selectionMode === "single-row") {
|
|
12746
|
+
const id = dataArray[rowIndex].id;
|
|
12747
|
+
if (event.metaKey || event.ctrlKey) {
|
|
12748
|
+
api.selectionApi.toggleRowSelection(id);
|
|
12749
|
+
} else {
|
|
12750
|
+
api.selectionApi.selectRow(id);
|
|
12751
|
+
}
|
|
12738
12752
|
}
|
|
12739
12753
|
return false;
|
|
12740
12754
|
}
|
|
@@ -12987,7 +13001,6 @@ function handleKeyboardSelection(context) {
|
|
|
12987
13001
|
const event = __spreadValues({}, context);
|
|
12988
13002
|
const { renderSelectionCheckBox } = context.getComputed();
|
|
12989
13003
|
if (renderSelectionCheckBox) {
|
|
12990
|
-
event.shiftKey = false;
|
|
12991
13004
|
event.metaKey = false;
|
|
12992
13005
|
event.ctrlKey = true;
|
|
12993
13006
|
}
|
package/index.js
CHANGED
|
@@ -6717,6 +6717,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6717
6717
|
};
|
|
6718
6718
|
const align = column.align || "start";
|
|
6719
6719
|
const renderChildren = () => {
|
|
6720
|
+
var _a2;
|
|
6720
6721
|
if (column.renderSortIcon) {
|
|
6721
6722
|
renderParam.renderBag.sortIcon = /* @__PURE__ */ React28.createElement(RenderHeaderCellHookComponent, {
|
|
6722
6723
|
render: column.renderSortIcon,
|
|
@@ -6730,9 +6731,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6730
6731
|
render: defaultRenderSelectionCheckBox2,
|
|
6731
6732
|
renderParam
|
|
6732
6733
|
});
|
|
6733
|
-
|
|
6734
|
+
const renderHeaderSelectionCheckBox = (_a2 = column.renderHeaderSelectionCheckBox) != null ? _a2 : column.renderSelectionCheckBox;
|
|
6735
|
+
if (renderHeaderSelectionCheckBox && renderHeaderSelectionCheckBox !== true) {
|
|
6734
6736
|
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ React28.createElement(RenderHeaderCellHookComponent, {
|
|
6735
|
-
render:
|
|
6737
|
+
render: renderHeaderSelectionCheckBox,
|
|
6736
6738
|
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6737
6739
|
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6738
6740
|
})
|
|
@@ -9309,11 +9311,17 @@ function getSelectionApi(param) {
|
|
|
9309
9311
|
}
|
|
9310
9312
|
return rowSelection.getGroupRowSelectionState(groupKeys);
|
|
9311
9313
|
},
|
|
9312
|
-
getSelectedPrimaryKeys: () => {
|
|
9314
|
+
getSelectedPrimaryKeys: (rowSelection) => {
|
|
9315
|
+
const state = getDataSourceState();
|
|
9316
|
+
const rowSelectionState = rowSelection ? new RowSelectionState(rowSelection, rowSelectionStateConfigGetter(state)) : state.rowSelection;
|
|
9313
9317
|
const selected = [];
|
|
9314
|
-
|
|
9315
|
-
|
|
9316
|
-
|
|
9318
|
+
if (state.lazyLoad) {
|
|
9319
|
+
console.error(`getSelectedPrimaryKeys should not be called for lazy-loaded datasources as it wont return reliable results`);
|
|
9320
|
+
}
|
|
9321
|
+
state.originalDataArray.forEach((data) => {
|
|
9322
|
+
const id = state.toPrimaryKey(data);
|
|
9323
|
+
if (rowSelectionState.isRowSelected(id)) {
|
|
9324
|
+
selected.push(id);
|
|
9317
9325
|
}
|
|
9318
9326
|
});
|
|
9319
9327
|
return selected;
|
|
@@ -9489,7 +9497,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
9489
9497
|
return livePaginationCursor;
|
|
9490
9498
|
}
|
|
9491
9499
|
function mapPropsToState(params) {
|
|
9492
|
-
var _a
|
|
9500
|
+
var _a;
|
|
9493
9501
|
const { props, state, oldState } = params;
|
|
9494
9502
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
9495
9503
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -9508,7 +9516,7 @@ function mapPropsToState(params) {
|
|
|
9508
9516
|
if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
|
|
9509
9517
|
selectionMode = "multi-cell";
|
|
9510
9518
|
} else {
|
|
9511
|
-
const rowSelectionProp =
|
|
9519
|
+
const rowSelectionProp = props.rowSelection !== void 0 ? props.rowSelection : props.defaultRowSelection;
|
|
9512
9520
|
if (rowSelectionProp !== void 0) {
|
|
9513
9521
|
if (rowSelectionProp && typeof rowSelectionProp === "object") {
|
|
9514
9522
|
selectionMode = "multi-row";
|
|
@@ -9543,7 +9551,7 @@ function mapPropsToState(params) {
|
|
|
9543
9551
|
operatorsByFilterType,
|
|
9544
9552
|
controlledSort,
|
|
9545
9553
|
controlledFilter,
|
|
9546
|
-
filterMode: ((
|
|
9554
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
9547
9555
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
9548
9556
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
9549
9557
|
};
|
|
@@ -12275,7 +12283,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12275
12283
|
const valid = (0, import_react44.useMemo)(() => {
|
|
12276
12284
|
let valid2 = isValidLicense(licenseKey, {
|
|
12277
12285
|
publishedAt: 1624970570587,
|
|
12278
|
-
version: "0.4.
|
|
12286
|
+
version: "0.4.8"
|
|
12279
12287
|
});
|
|
12280
12288
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12281
12289
|
return true;
|
|
@@ -12337,7 +12345,7 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
12337
12345
|
times++;
|
|
12338
12346
|
rafId.current = requestAnimationFrame(() => {
|
|
12339
12347
|
didScrollRef.current = imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
12340
|
-
offset:
|
|
12348
|
+
offset: 0
|
|
12341
12349
|
});
|
|
12342
12350
|
if (!didScrollRef.current && times < RETRIES2) {
|
|
12343
12351
|
tryScroll(times);
|
|
@@ -12610,11 +12618,10 @@ function onCellClick(context, event) {
|
|
|
12610
12618
|
updateRowSelectionOnCellClick(context, event);
|
|
12611
12619
|
}
|
|
12612
12620
|
function updateRowSelectionOnCellClick(context, event) {
|
|
12613
|
-
const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
|
|
12621
|
+
const { rowIndex, getDataSourceState, getComputed, dataSourceActions, api } = context;
|
|
12614
12622
|
const { multiRowSelector, renderSelectionCheckBox } = getComputed();
|
|
12615
12623
|
const dataSourceState = getDataSourceState();
|
|
12616
|
-
const { selectionMode, groupBy } = dataSourceState;
|
|
12617
|
-
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12624
|
+
const { selectionMode, groupBy, dataArray } = dataSourceState;
|
|
12618
12625
|
if (groupBy.length) {
|
|
12619
12626
|
return false;
|
|
12620
12627
|
}
|
|
@@ -12622,6 +12629,7 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12622
12629
|
if (renderSelectionCheckBox && !event.key) {
|
|
12623
12630
|
return false;
|
|
12624
12631
|
}
|
|
12632
|
+
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12625
12633
|
rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12626
12634
|
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
12627
12635
|
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
@@ -12636,6 +12644,12 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12636
12644
|
return true;
|
|
12637
12645
|
}
|
|
12638
12646
|
} else if (selectionMode === "single-row") {
|
|
12647
|
+
const id = dataArray[rowIndex].id;
|
|
12648
|
+
if (event.metaKey || event.ctrlKey) {
|
|
12649
|
+
api.selectionApi.toggleRowSelection(id);
|
|
12650
|
+
} else {
|
|
12651
|
+
api.selectionApi.selectRow(id);
|
|
12652
|
+
}
|
|
12639
12653
|
}
|
|
12640
12654
|
return false;
|
|
12641
12655
|
}
|
|
@@ -12888,7 +12902,6 @@ function handleKeyboardSelection(context) {
|
|
|
12888
12902
|
const event = __spreadValues({}, context);
|
|
12889
12903
|
const { renderSelectionCheckBox } = context.getComputed();
|
|
12890
12904
|
if (renderSelectionCheckBox) {
|
|
12891
|
-
event.shiftKey = false;
|
|
12892
12905
|
event.metaKey = false;
|
|
12893
12906
|
event.ctrlKey = true;
|
|
12894
12907
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinite-table/infinite-react",
|
|
3
3
|
"description": "Infinite Table for React",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.8",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
7
7
|
"typings": "index.d.ts",
|
|
@@ -14,5 +14,5 @@
|
|
|
14
14
|
},
|
|
15
15
|
"license": "Commercial & Open Source",
|
|
16
16
|
"//": "will be updated at build time",
|
|
17
|
-
"publishedAt":
|
|
17
|
+
"publishedAt": 1660912348938
|
|
18
18
|
}
|