@infinite-table/infinite-react 0.2.5 → 0.2.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 +4 -2
- package/index.esm.js +14 -13
- package/index.js +14 -13
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -675,7 +675,9 @@ declare module "components/InfiniteTable/types/InfiniteTableColumn" {
|
|
|
675
675
|
draggable?: boolean;
|
|
676
676
|
resizable?: boolean;
|
|
677
677
|
comparer?: InfiniteTableColumnComparer<T>;
|
|
678
|
-
|
|
678
|
+
defaultHiddenWhenGroupedBy?: '*' | keyof T | {
|
|
679
|
+
[k in keyof Partial<T>]: true;
|
|
680
|
+
};
|
|
679
681
|
align?: InfiniteTableColumnAlign;
|
|
680
682
|
verticalAlign?: InfiniteTableColumnVerticalAlign;
|
|
681
683
|
columnGroup?: string;
|
|
@@ -1136,7 +1138,7 @@ declare module "components/InfiniteTable/types/InfiniteTableProps" {
|
|
|
1136
1138
|
defaultWidth?: number;
|
|
1137
1139
|
defaultFlex?: number;
|
|
1138
1140
|
defaultPinned?: InfiniteTableColumnPinnedValues;
|
|
1139
|
-
|
|
1141
|
+
defaultHiddenWhenGroupedBy?: InfiniteTableColumn<T>['defaultHiddenWhenGroupedBy'];
|
|
1140
1142
|
header?: InfiniteTableColumn<T>['header'];
|
|
1141
1143
|
comparer?: InfiniteTableColumn<T>['comparer'];
|
|
1142
1144
|
draggable?: InfiniteTableColumn<T>['draggable'];
|
package/index.esm.js
CHANGED
|
@@ -1390,7 +1390,7 @@ var getComputedVisibleColumns = ({
|
|
|
1390
1390
|
const result2 = __spreadProps(__spreadValues({
|
|
1391
1391
|
align: colType.align,
|
|
1392
1392
|
verticalAlign: colType.verticalAlign,
|
|
1393
|
-
|
|
1393
|
+
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
1394
1394
|
valueGetter: colType.valueGetter,
|
|
1395
1395
|
renderValue: colType.renderValue,
|
|
1396
1396
|
render: colType.render
|
|
@@ -3973,7 +3973,7 @@ function concludeReducer(params) {
|
|
|
3973
3973
|
state.groupDeepMap = void 0;
|
|
3974
3974
|
state.pivotColumns = void 0;
|
|
3975
3975
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
3976
|
-
if (arrayDifferentAfterSortStep) {
|
|
3976
|
+
if (arrayDifferentAfterSortStep || groupsDepsChanged) {
|
|
3977
3977
|
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
|
|
3978
3978
|
}
|
|
3979
3979
|
}
|
|
@@ -4084,7 +4084,7 @@ function useColumnsWhen() {
|
|
|
4084
4084
|
}, [pivotTotalColumnPosition]);
|
|
4085
4085
|
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
4086
4086
|
const { toggleGroupRow } = useColumnsWhenGrouping();
|
|
4087
|
-
useHideColumns();
|
|
4087
|
+
useHideColumns(groupByMap);
|
|
4088
4088
|
return { toggleGroupRow };
|
|
4089
4089
|
}
|
|
4090
4090
|
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
@@ -4206,7 +4206,7 @@ function useColumnsWhenGrouping() {
|
|
|
4206
4206
|
]);
|
|
4207
4207
|
return { toggleGroupRow };
|
|
4208
4208
|
}
|
|
4209
|
-
function useHideColumns() {
|
|
4209
|
+
function useHideColumns(groupByMap) {
|
|
4210
4210
|
const {
|
|
4211
4211
|
componentState: {
|
|
4212
4212
|
dataArray,
|
|
@@ -4283,22 +4283,23 @@ function useHideColumns() {
|
|
|
4283
4283
|
const newColumnVisibility = __spreadValues({}, columnVisibility);
|
|
4284
4284
|
let updated = false;
|
|
4285
4285
|
computedColumns.forEach((col, id) => {
|
|
4286
|
-
if (col.
|
|
4286
|
+
if (col.defaultHiddenWhenGroupedBy) {
|
|
4287
4287
|
const nowHidden = columnVisibility[id] === false;
|
|
4288
|
-
|
|
4288
|
+
const shouldBeHidden = col.defaultHiddenWhenGroupedBy === "*" && isGrouped || typeof col.defaultHiddenWhenGroupedBy === "string" && groupByMap.get(col.defaultHiddenWhenGroupedBy) || typeof col.defaultHiddenWhenGroupedBy === "object" && Object.keys(col.defaultHiddenWhenGroupedBy).reduce((acc, field) => acc || groupByMap.has(field), false);
|
|
4289
|
+
if (nowHidden !== shouldBeHidden) {
|
|
4289
4290
|
updated = true;
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4291
|
+
if (shouldBeHidden) {
|
|
4292
|
+
newColumnVisibility[id] = false;
|
|
4293
|
+
} else {
|
|
4294
|
+
delete newColumnVisibility[id];
|
|
4295
|
+
}
|
|
4295
4296
|
}
|
|
4296
4297
|
}
|
|
4297
4298
|
});
|
|
4298
4299
|
if (updated) {
|
|
4299
4300
|
componentActions.columnVisibility = newColumnVisibility;
|
|
4300
4301
|
}
|
|
4301
|
-
}, [computedColumns, columnTypes, groupBy]);
|
|
4302
|
+
}, [computedColumns, columnTypes, groupBy, groupByMap]);
|
|
4302
4303
|
}
|
|
4303
4304
|
function getColumnsWhenGrouping(params) {
|
|
4304
4305
|
const {
|
|
@@ -7770,7 +7771,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7770
7771
|
const valid = useMemo12(() => {
|
|
7771
7772
|
let valid2 = isValidLicense(licenseKey, {
|
|
7772
7773
|
publishedAt: 1624970570587,
|
|
7773
|
-
version: "0.2.
|
|
7774
|
+
version: "0.2.6"
|
|
7774
7775
|
});
|
|
7775
7776
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7776
7777
|
return true;
|
package/index.js
CHANGED
|
@@ -1399,7 +1399,7 @@ var getComputedVisibleColumns = ({
|
|
|
1399
1399
|
const result2 = __spreadProps(__spreadValues({
|
|
1400
1400
|
align: colType.align,
|
|
1401
1401
|
verticalAlign: colType.verticalAlign,
|
|
1402
|
-
|
|
1402
|
+
defaultHiddenWhenGroupedBy: colType.defaultHiddenWhenGroupedBy,
|
|
1403
1403
|
valueGetter: colType.valueGetter,
|
|
1404
1404
|
renderValue: colType.renderValue,
|
|
1405
1405
|
render: colType.render
|
|
@@ -3959,7 +3959,7 @@ function concludeReducer(params) {
|
|
|
3959
3959
|
state.groupDeepMap = void 0;
|
|
3960
3960
|
state.pivotColumns = void 0;
|
|
3961
3961
|
const arrayDifferentAfterSortStep = previousState.postSortDataArray != state.postSortDataArray;
|
|
3962
|
-
if (arrayDifferentAfterSortStep) {
|
|
3962
|
+
if (arrayDifferentAfterSortStep || groupsDepsChanged) {
|
|
3963
3963
|
rowInfoDataArray = dataArray.map((data, index) => toRowInfo(data, data ? toPrimaryKey(data) : index, index));
|
|
3964
3964
|
}
|
|
3965
3965
|
}
|
|
@@ -4070,7 +4070,7 @@ function useColumnsWhen() {
|
|
|
4070
4070
|
}, [pivotTotalColumnPosition]);
|
|
4071
4071
|
useColumnsWhenInlineGroupRenderStrategy(groupByMap);
|
|
4072
4072
|
const { toggleGroupRow } = useColumnsWhenGrouping();
|
|
4073
|
-
useHideColumns();
|
|
4073
|
+
useHideColumns(groupByMap);
|
|
4074
4074
|
return { toggleGroupRow };
|
|
4075
4075
|
}
|
|
4076
4076
|
function useColumnsWhenInlineGroupRenderStrategy(groupByMap) {
|
|
@@ -4192,7 +4192,7 @@ function useColumnsWhenGrouping() {
|
|
|
4192
4192
|
]);
|
|
4193
4193
|
return { toggleGroupRow };
|
|
4194
4194
|
}
|
|
4195
|
-
function useHideColumns() {
|
|
4195
|
+
function useHideColumns(groupByMap) {
|
|
4196
4196
|
const {
|
|
4197
4197
|
componentState: {
|
|
4198
4198
|
dataArray,
|
|
@@ -4269,22 +4269,23 @@ function useHideColumns() {
|
|
|
4269
4269
|
const newColumnVisibility = __spreadValues({}, columnVisibility);
|
|
4270
4270
|
let updated = false;
|
|
4271
4271
|
computedColumns.forEach((col, id) => {
|
|
4272
|
-
if (col.
|
|
4272
|
+
if (col.defaultHiddenWhenGroupedBy) {
|
|
4273
4273
|
const nowHidden = columnVisibility[id] === false;
|
|
4274
|
-
|
|
4274
|
+
const shouldBeHidden = col.defaultHiddenWhenGroupedBy === "*" && isGrouped || typeof col.defaultHiddenWhenGroupedBy === "string" && groupByMap.get(col.defaultHiddenWhenGroupedBy) || typeof col.defaultHiddenWhenGroupedBy === "object" && Object.keys(col.defaultHiddenWhenGroupedBy).reduce((acc, field) => acc || groupByMap.has(field), false);
|
|
4275
|
+
if (nowHidden !== shouldBeHidden) {
|
|
4275
4276
|
updated = true;
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4277
|
+
if (shouldBeHidden) {
|
|
4278
|
+
newColumnVisibility[id] = false;
|
|
4279
|
+
} else {
|
|
4280
|
+
delete newColumnVisibility[id];
|
|
4281
|
+
}
|
|
4281
4282
|
}
|
|
4282
4283
|
}
|
|
4283
4284
|
});
|
|
4284
4285
|
if (updated) {
|
|
4285
4286
|
componentActions.columnVisibility = newColumnVisibility;
|
|
4286
4287
|
}
|
|
4287
|
-
}, [computedColumns, columnTypes, groupBy]);
|
|
4288
|
+
}, [computedColumns, columnTypes, groupBy, groupByMap]);
|
|
4288
4289
|
}
|
|
4289
4290
|
function getColumnsWhenGrouping(params) {
|
|
4290
4291
|
const {
|
|
@@ -7677,7 +7678,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
7677
7678
|
const valid = (0, import_react43.useMemo)(() => {
|
|
7678
7679
|
let valid2 = isValidLicense(licenseKey, {
|
|
7679
7680
|
publishedAt: 1624970570587,
|
|
7680
|
-
version: "0.2.
|
|
7681
|
+
version: "0.2.6"
|
|
7681
7682
|
});
|
|
7682
7683
|
if (!licenseKey && !valid2 && isInsideSandbox) {
|
|
7683
7684
|
return true;
|
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.2.
|
|
4
|
+
"version": "0.2.6",
|
|
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": 1644931690394
|
|
18
18
|
}
|