@infinite-table/infinite-react 0.4.4 → 0.4.5
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 +13 -5
- package/index.esm.js +78 -28
- package/index.js +78 -28
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -196,6 +196,7 @@ declare type InfiniteTableColumnRenderParamBase<DATA_TYPE, COL_TYPE = InfiniteTa
|
|
|
196
196
|
api: InfiniteTableApi<DATA_TYPE>;
|
|
197
197
|
column: COL_TYPE;
|
|
198
198
|
columnsMap: Map<string, COL_TYPE>;
|
|
199
|
+
fieldsToColumn: Map<keyof DATA_TYPE, COL_TYPE>;
|
|
199
200
|
groupByColumn?: InfiniteTableComputedColumn<DATA_TYPE>;
|
|
200
201
|
toggleCurrentGroupRow: () => void;
|
|
201
202
|
toggleGroupRow: InfiniteTableToggleGroupRowFn;
|
|
@@ -222,6 +223,9 @@ declare type InfiniteTableColumnRowspanParam<DATA_TYPE, COL_TYPE = InfiniteTable
|
|
|
222
223
|
declare type InfiniteTableColumnRenderFunctionForGroupRows<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
|
|
223
224
|
isGroupRow: true;
|
|
224
225
|
}) => Renderable | null;
|
|
226
|
+
declare type InfiniteTableColumnRenderFunctionForNormalRows<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE> & {
|
|
227
|
+
isGroupRow: false;
|
|
228
|
+
}) => Renderable | null;
|
|
225
229
|
declare type InfiniteTableColumnRenderFunction<DATA_TYPE, COL_TYPE = InfiniteTableComputedColumn<DATA_TYPE>> = (renderParams: InfiniteTableColumnRenderParam<DATA_TYPE, COL_TYPE>) => Renderable | null;
|
|
226
230
|
declare type InfiniteTableColumnHeaderRenderFunction<T> = (headerParams: InfiniteTableColumnHeaderParam<T>) => Renderable;
|
|
227
231
|
declare type InfiniteTableColumnAlign = 'start' | 'center' | 'end';
|
|
@@ -285,8 +289,8 @@ declare type InfiniteTableColumn<DATA_TYPE> = {
|
|
|
285
289
|
field?: keyof DATA_TYPE;
|
|
286
290
|
render?: InfiniteTableColumnRenderFunction<DATA_TYPE>;
|
|
287
291
|
renderValue?: InfiniteTableColumnRenderFunction<DATA_TYPE>;
|
|
288
|
-
renderGroupValue?:
|
|
289
|
-
renderLeafValue?:
|
|
292
|
+
renderGroupValue?: InfiniteTableColumnRenderFunctionForGroupRows<DATA_TYPE>;
|
|
293
|
+
renderLeafValue?: InfiniteTableColumnRenderFunctionForNormalRows<DATA_TYPE>;
|
|
290
294
|
valueGetter?: InfiniteTableColumnValueGetter<DATA_TYPE>;
|
|
291
295
|
valueFormatter?: InfiniteTableColumnValueFormatter<DATA_TYPE>;
|
|
292
296
|
defaultWidth?: number;
|
|
@@ -797,6 +801,7 @@ interface InfiniteTableComputedValues<T> {
|
|
|
797
801
|
computedUnpinnedOffset: number;
|
|
798
802
|
computedPinnedEndOffset: number;
|
|
799
803
|
computedRemainingSpace: number;
|
|
804
|
+
fieldsToColumn: Map<keyof T, InfiniteTableComputedColumn<T>>;
|
|
800
805
|
toggleGroupRow: (groupKeys: any[]) => void;
|
|
801
806
|
columnSize: (colIndex: number) => number;
|
|
802
807
|
}
|
|
@@ -943,6 +948,7 @@ interface InfiniteTableSetupState<T> {
|
|
|
943
948
|
focused: boolean;
|
|
944
949
|
ready: boolean;
|
|
945
950
|
columnReorderDragColumnId: false | string;
|
|
951
|
+
columnVisibilityForGrouping: Record<string, false>;
|
|
946
952
|
focusedWithin: boolean;
|
|
947
953
|
scrollPosition: ScrollPosition;
|
|
948
954
|
pinnedStartScrollListener: ScrollListener;
|
|
@@ -1418,7 +1424,7 @@ declare type AggregationReducerResult<AggregationResultType extends any = any> =
|
|
|
1418
1424
|
*
|
|
1419
1425
|
*/
|
|
1420
1426
|
declare type InfiniteTableRowInfo<T> = InfiniteTable_HasGrouping_RowInfoNormal<T> | InfiniteTable_HasGrouping_RowInfoGroup<T> | InfiniteTable_NoGrouping_RowInfoNormal<T>;
|
|
1421
|
-
declare type
|
|
1427
|
+
declare type InfiniteTableRowInfoDataDiscriminator_RowInfoNormal<T> = {
|
|
1422
1428
|
data: T;
|
|
1423
1429
|
isGroupRow: false;
|
|
1424
1430
|
rowActive: boolean;
|
|
@@ -1426,7 +1432,8 @@ declare type InfiniteTableRowInfoDataDiscriminator<T> = {
|
|
|
1426
1432
|
field?: keyof T;
|
|
1427
1433
|
value: any;
|
|
1428
1434
|
rowSelected: boolean | null;
|
|
1429
|
-
}
|
|
1435
|
+
};
|
|
1436
|
+
declare type InfiniteTableRowInfoDataDiscriminator_RowInfoGroup<T> = {
|
|
1430
1437
|
rowActive: boolean;
|
|
1431
1438
|
data: Partial<T> | null;
|
|
1432
1439
|
rowInfo: InfiniteTable_HasGrouping_RowInfoGroup<T>;
|
|
@@ -1435,6 +1442,7 @@ declare type InfiniteTableRowInfoDataDiscriminator<T> = {
|
|
|
1435
1442
|
value: any;
|
|
1436
1443
|
rowSelected: boolean | null;
|
|
1437
1444
|
};
|
|
1445
|
+
declare type InfiniteTableRowInfoDataDiscriminator<T> = InfiniteTableRowInfoDataDiscriminator_RowInfoNormal<T> | InfiniteTableRowInfoDataDiscriminator_RowInfoGroup<T>;
|
|
1438
1446
|
/**
|
|
1439
1447
|
* This is the base row info for all scenarios - things every
|
|
1440
1448
|
* rowInfo is guaranteed to have (be it group or normal row, or dataSource with or without grouping)
|
|
@@ -2019,4 +2027,4 @@ declare const components: {
|
|
|
2019
2027
|
LoadMask: (props: LoadMaskProps) => JSX.Element;
|
|
2020
2028
|
};
|
|
2021
2029
|
|
|
2022
|
-
export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnsMap, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableFilterEditorProps, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropFilterEditors, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, NumberFilterEditor, RowSelectionState, Scrollbars, StringFilterEditor, components, debounce, defaultFilterEditors, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };
|
|
2030
|
+
export { ColumnTypeWithInherit, DataSource, DataSourceAction, DataSourceActionType, DataSourceAggregationReducer, DataSourceComponentActions, DataSourceContextValue, DataSourceData, DataSourceDataParams, DataSourceDataParamsChanges, DataSourceDerivedState, DataSourceFilterFunctionParam, DataSourceFilterOperator, DataSourceFilterOperatorFunction, DataSourceFilterOperatorFunctionParam, DataSourceFilterType, DataSourceFilterValueItem, DataSourceFilterValueItemValueGetter, DataSourceGroupBy, DataSourceGroupRowsList, DataSourceLivePaginationCursorFn, DataSourceLivePaginationCursorParams, DataSourceLivePaginationCursorValue, DataSourceMappedState, DataSourceMappings, DataSourcePivotBy, DataSourcePropAggregationReducers, DataSourcePropCellSelection, DataSourcePropFilterFunction, DataSourcePropFilterTypes, DataSourcePropFilterValue, DataSourcePropGroupBy, DataSourcePropGroupRowsStateObject, DataSourcePropIsRowSelected, DataSourcePropLivePaginationCursor, DataSourcePropMultiRowSelectionChangeParamType, DataSourcePropOnCellSelectionChange, DataSourcePropOnRowSelectionChange, DataSourcePropOnRowSelectionChange_MultiRow, DataSourcePropOnRowSelectionChange_SingleRow, DataSourcePropPivotBy, DataSourcePropRowSelection, DataSourcePropRowSelection_MultiRow, DataSourcePropRowSelection_SingleRow, DataSourcePropSelectionMode, DataSourcePropSortInfo, DataSourcePropSortTypes, DataSourceProps, DataSourceReducer, DataSourceRemoteData, DataSourceSetupState, DataSourceSingleSortInfo, DataSourceSortInfo, DataSourceState, GroupRowsState, InfiniteTable, InfiniteTableAction, InfiniteTableActionType, InfiniteTableApi, InfiniteTableClassName, InfiniteTableColumn, InfiniteTableColumnAggregator, InfiniteTableColumnComparer, InfiniteTableColumnGroup, InfiniteTableColumnRenderFunctionForGroupRows, InfiniteTableColumnRenderFunctionForNormalRows, InfiniteTableColumnRenderParam, InfiniteTableColumnRenderValueParam, InfiniteTableColumnRowspanParam, InfiniteTableColumnSizingOptions, InfiniteTableColumnsMap, InfiniteTableComponent, InfiniteTableComputedColumn, InfiniteTableComputedValues, InfiniteTableContextValue, InfiniteTableFilterEditorProps, InfiniteTableGroupColumnBase, InfiniteTableGroupColumnFunction, InfiniteTableGroupColumnGetterOptions, InfiniteTablePivotColumn, InfiniteTablePropAutoSizeColumnsKey, InfiniteTablePropColumnGroups, InfiniteTablePropColumnOrder, InfiniteTablePropColumnPinning, InfiniteTablePropColumnSizing, InfiniteTablePropColumnTypes, InfiniteTablePropColumnVisibility, InfiniteTablePropColumns, InfiniteTablePropComponents, InfiniteTablePropFilterEditors, InfiniteTablePropGroupColumn, InfiniteTablePropGroupRenderStrategy, InfiniteTablePropHeaderOptions, InfiniteTablePropKeyboardNavigation, InfiniteTablePropRowClassName, InfiniteTablePropRowStyle, InfiniteTableProps, InfiniteTableRowClassNameFn, InfiniteTableRowInfo, InfiniteTableRowStyleFn, InfiniteTableState, LazyGroupDataDeepMap, LazyGroupDataItem, LazyRowInfoGroup, NumberFilterEditor, RowSelectionState, Scrollbars, StringFilterEditor, components, debounce, defaultFilterEditors, defaultFilterTypes, defaultFilterTypes as filterTypes, flatten, getComponentStateRoot, group, interceptMap, multisort, useComponentState, useDataSource, useEffectWithChanges, useInfiniteColumnCell, useInfiniteHeaderCell };
|
package/index.esm.js
CHANGED
|
@@ -5063,7 +5063,6 @@ var useColumnPointerEvents = ({
|
|
|
5063
5063
|
if (!equalPinning(getState().columnPinning, columnPinning)) {
|
|
5064
5064
|
componentActions.columnPinning = columnPinning;
|
|
5065
5065
|
}
|
|
5066
|
-
console.log("old order", getComputed().computedColumnOrder);
|
|
5067
5066
|
const currentComputedColumnOrder = getComputed().computedColumnOrder;
|
|
5068
5067
|
if (JSON.stringify(columnOrder, currentComputedColumnOrder)) {
|
|
5069
5068
|
computedVisibleColumns.forEach((col) => {
|
|
@@ -5469,8 +5468,15 @@ function isColumnWithField(c) {
|
|
|
5469
5468
|
return typeof c.field === "string";
|
|
5470
5469
|
}
|
|
5471
5470
|
function getGroupByColumn(options) {
|
|
5472
|
-
const { column, rowInfo,
|
|
5473
|
-
|
|
5471
|
+
const { column, rowInfo, fieldsToColumn } = options;
|
|
5472
|
+
let groupByColumn = void 0;
|
|
5473
|
+
if (column.groupByField) {
|
|
5474
|
+
if (rowInfo.isGroupRow) {
|
|
5475
|
+
groupByColumn = fieldsToColumn.get(rowInfo.groupBy[rowInfo.groupBy.length - 1]);
|
|
5476
|
+
} else if (column.field) {
|
|
5477
|
+
groupByColumn = fieldsToColumn.get(column.field);
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5474
5480
|
return groupByColumn;
|
|
5475
5481
|
}
|
|
5476
5482
|
function getColumnRenderingParams(options) {
|
|
@@ -5486,11 +5492,11 @@ function getColumnRenderingParams(options) {
|
|
|
5486
5492
|
}, formattedValueContext),
|
|
5487
5493
|
formattedValueContext,
|
|
5488
5494
|
renderFunctions: {
|
|
5489
|
-
renderGroupIcon: (groupByColumn == null ? void 0 : groupByColumn.renderGroupIcon)
|
|
5495
|
+
renderGroupIcon: column.renderGroupIcon || (groupByColumn == null ? void 0 : groupByColumn.renderGroupIcon),
|
|
5490
5496
|
renderSelectionCheckBox: column.renderSelectionCheckBox,
|
|
5491
|
-
renderValue: (groupByColumn == null ? void 0 : groupByColumn.renderValue)
|
|
5492
|
-
renderGroupValue: (groupByColumn == null ? void 0 : groupByColumn.renderGroupValue)
|
|
5493
|
-
renderLeafValue: (groupByColumn == null ? void 0 : groupByColumn.renderLeafValue)
|
|
5497
|
+
renderValue: column.renderValue || (groupByColumn == null ? void 0 : groupByColumn.renderValue),
|
|
5498
|
+
renderGroupValue: column.renderGroupValue || (groupByColumn == null ? void 0 : groupByColumn.renderGroupValue),
|
|
5499
|
+
renderLeafValue: column.renderLeafValue || (groupByColumn == null ? void 0 : groupByColumn.renderLeafValue)
|
|
5494
5500
|
},
|
|
5495
5501
|
renderParams: getColumnRenderParam(__spreadProps(__spreadValues({}, options), {
|
|
5496
5502
|
formattedValueContext
|
|
@@ -5499,17 +5505,25 @@ function getColumnRenderingParams(options) {
|
|
|
5499
5505
|
};
|
|
5500
5506
|
}
|
|
5501
5507
|
function getColumnRenderParam(options) {
|
|
5502
|
-
const {
|
|
5508
|
+
const {
|
|
5509
|
+
column,
|
|
5510
|
+
context,
|
|
5511
|
+
rowInfo,
|
|
5512
|
+
columnsMap,
|
|
5513
|
+
fieldsToColumn,
|
|
5514
|
+
formattedValueContext
|
|
5515
|
+
} = options;
|
|
5503
5516
|
const { value } = formattedValueContext;
|
|
5504
5517
|
const { api: imperativeApi, getDataSourceState } = context;
|
|
5505
5518
|
const { indexInAll: rowIndex } = rowInfo;
|
|
5506
5519
|
const dataSourceState = getDataSourceState();
|
|
5507
5520
|
const { selectionMode } = dataSourceState;
|
|
5508
|
-
const groupByColumn =
|
|
5521
|
+
const groupByColumn = getGroupByColumn({ rowInfo, column, fieldsToColumn });
|
|
5509
5522
|
const toggleGroupRow = imperativeApi.toggleGroupRow;
|
|
5510
5523
|
const renderParam = __spreadProps(__spreadValues({
|
|
5511
5524
|
column,
|
|
5512
|
-
columnsMap
|
|
5525
|
+
columnsMap,
|
|
5526
|
+
fieldsToColumn
|
|
5513
5527
|
}, formattedValueContext), {
|
|
5514
5528
|
groupByColumn,
|
|
5515
5529
|
selectionMode,
|
|
@@ -5718,6 +5732,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5718
5732
|
rowIndex,
|
|
5719
5733
|
rowHeight,
|
|
5720
5734
|
columnsMap,
|
|
5735
|
+
fieldsToColumn,
|
|
5721
5736
|
domRef,
|
|
5722
5737
|
hidden,
|
|
5723
5738
|
showZebraRows
|
|
@@ -5748,6 +5763,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5748
5763
|
column,
|
|
5749
5764
|
rowInfo,
|
|
5750
5765
|
columnsMap,
|
|
5766
|
+
fieldsToColumn,
|
|
5751
5767
|
context: renderingContext
|
|
5752
5768
|
});
|
|
5753
5769
|
const renderParam = renderParams;
|
|
@@ -10599,6 +10615,7 @@ function useCellRendering(param) {
|
|
|
10599
10615
|
computedPinnedEndColumns,
|
|
10600
10616
|
computedVisibleColumns,
|
|
10601
10617
|
computedColumnsMap,
|
|
10618
|
+
fieldsToColumn,
|
|
10602
10619
|
rowspan,
|
|
10603
10620
|
toggleGroupRow,
|
|
10604
10621
|
columnSize
|
|
@@ -10703,6 +10720,7 @@ function useCellRendering(param) {
|
|
|
10703
10720
|
width,
|
|
10704
10721
|
column,
|
|
10705
10722
|
columnsMap: computedColumnsMap,
|
|
10723
|
+
fieldsToColumn,
|
|
10706
10724
|
rowStyle,
|
|
10707
10725
|
rowClassName
|
|
10708
10726
|
};
|
|
@@ -10712,6 +10730,7 @@ function useCellRendering(param) {
|
|
|
10712
10730
|
getData,
|
|
10713
10731
|
computedVisibleColumns,
|
|
10714
10732
|
computedColumnsMap,
|
|
10733
|
+
fieldsToColumn,
|
|
10715
10734
|
groupRenderStrategy,
|
|
10716
10735
|
toggleGroupRow,
|
|
10717
10736
|
showZebraRows,
|
|
@@ -11323,24 +11342,45 @@ function useHideColumns(groupByMap) {
|
|
|
11323
11342
|
useEffect23(() => {
|
|
11324
11343
|
const isGrouped = groupBy.length > 0;
|
|
11325
11344
|
const currentState = getComponentState();
|
|
11326
|
-
const {
|
|
11345
|
+
const {
|
|
11346
|
+
columnVisibility,
|
|
11347
|
+
columnVisibilityForGrouping,
|
|
11348
|
+
hideColumnWhenGrouped: hideColumnWhenGrouped2
|
|
11349
|
+
} = currentState;
|
|
11327
11350
|
const newColumnVisibility = __spreadValues({}, columnVisibility);
|
|
11328
|
-
let
|
|
11351
|
+
let newColumnVisibilityForGrouping = __spreadValues({}, columnVisibilityForGrouping);
|
|
11352
|
+
let updatedVisibilityWhenGrouping = false;
|
|
11353
|
+
let newlyHiddenColumns = new Set();
|
|
11354
|
+
let newlyDisplayedColumns = new Set();
|
|
11329
11355
|
computedColumns.forEach((col, id) => {
|
|
11330
|
-
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2) {
|
|
11331
|
-
const
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11356
|
+
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2 != null) {
|
|
11357
|
+
const hideWhenGrouped = col.defaultHiddenWhenGroupedBy === "*" && isGrouped || (col.defaultHiddenWhenGroupedBy === true || hideColumnWhenGrouped2) && col.field && groupByMap.get(col.field) || typeof col.defaultHiddenWhenGroupedBy === "string" && groupByMap.get(col.defaultHiddenWhenGroupedBy) || typeof col.defaultHiddenWhenGroupedBy === "object" && Object.keys(col.defaultHiddenWhenGroupedBy).reduce((acc, field) => acc || groupByMap.has(field), false);
|
|
11358
|
+
if (hideWhenGrouped) {
|
|
11359
|
+
if (newColumnVisibilityForGrouping[id] !== false) {
|
|
11360
|
+
if (columnVisibility[id] === false) {
|
|
11361
|
+
return;
|
|
11362
|
+
}
|
|
11363
|
+
newColumnVisibilityForGrouping[id] = false;
|
|
11364
|
+
updatedVisibilityWhenGrouping = true;
|
|
11365
|
+
newlyHiddenColumns.add(id);
|
|
11366
|
+
}
|
|
11367
|
+
} else {
|
|
11368
|
+
if (newColumnVisibilityForGrouping[id] === false) {
|
|
11369
|
+
delete newColumnVisibilityForGrouping[id];
|
|
11370
|
+
updatedVisibilityWhenGrouping = true;
|
|
11371
|
+
newlyDisplayedColumns.add(id);
|
|
11339
11372
|
}
|
|
11340
11373
|
}
|
|
11341
11374
|
}
|
|
11342
11375
|
});
|
|
11343
|
-
if (
|
|
11376
|
+
if (updatedVisibilityWhenGrouping) {
|
|
11377
|
+
componentActions.columnVisibilityForGrouping = newColumnVisibilityForGrouping;
|
|
11378
|
+
newlyDisplayedColumns.forEach((colId) => {
|
|
11379
|
+
delete newColumnVisibility[colId];
|
|
11380
|
+
});
|
|
11381
|
+
newlyHiddenColumns.forEach((colId) => {
|
|
11382
|
+
newColumnVisibility[colId] = false;
|
|
11383
|
+
});
|
|
11344
11384
|
componentActions.columnVisibility = newColumnVisibility;
|
|
11345
11385
|
}
|
|
11346
11386
|
}, [
|
|
@@ -11678,6 +11718,7 @@ var getComputedVisibleColumns = ({
|
|
|
11678
11718
|
orderedColumns.set(key, c);
|
|
11679
11719
|
}
|
|
11680
11720
|
});
|
|
11721
|
+
const fieldsToColumn = new Map();
|
|
11681
11722
|
orderedColumns.forEach((c, id) => {
|
|
11682
11723
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
11683
11724
|
let theComputedVisibleIndex = columnIdsToVisibleIndex.get(id);
|
|
@@ -11848,6 +11889,9 @@ var getComputedVisibleColumns = ({
|
|
|
11848
11889
|
groupColumns.push(result2);
|
|
11849
11890
|
}
|
|
11850
11891
|
computedColumnsMap.set(result2.id, result2);
|
|
11892
|
+
if (result2.field && !result2.groupByField && !fieldsToColumn.has(result2.field)) {
|
|
11893
|
+
fieldsToColumn.set(result2.field, result2);
|
|
11894
|
+
}
|
|
11851
11895
|
});
|
|
11852
11896
|
groupColumns.forEach((col) => {
|
|
11853
11897
|
col.computedSortable = isGroupColumnSortable(col, computedColumnsMap);
|
|
@@ -11872,7 +11916,8 @@ var getComputedVisibleColumns = ({
|
|
|
11872
11916
|
computedPinnedStartWidth,
|
|
11873
11917
|
renderSelectionCheckBox: computedVisibleColumns.reduce((bool, c) => {
|
|
11874
11918
|
return bool || !!c.renderSelectionCheckBox;
|
|
11875
|
-
}, false)
|
|
11919
|
+
}, false),
|
|
11920
|
+
fieldsToColumn
|
|
11876
11921
|
};
|
|
11877
11922
|
return result;
|
|
11878
11923
|
};
|
|
@@ -11935,7 +11980,8 @@ var useComputedVisibleColumns = ({
|
|
|
11935
11980
|
computedPinnedEndWidth,
|
|
11936
11981
|
computedPinnedStartWidth,
|
|
11937
11982
|
renderSelectionCheckBox,
|
|
11938
|
-
computedColumnsMap
|
|
11983
|
+
computedColumnsMap,
|
|
11984
|
+
fieldsToColumn
|
|
11939
11985
|
} = useMemo10(() => {
|
|
11940
11986
|
return getComputedVisibleColumns({
|
|
11941
11987
|
columns,
|
|
@@ -12002,7 +12048,8 @@ var useComputedVisibleColumns = ({
|
|
|
12002
12048
|
computedUnpinnedColumns,
|
|
12003
12049
|
computedVisibleColumns,
|
|
12004
12050
|
computedVisibleColumnsMap,
|
|
12005
|
-
computedColumnOrder
|
|
12051
|
+
computedColumnOrder,
|
|
12052
|
+
fieldsToColumn
|
|
12006
12053
|
};
|
|
12007
12054
|
return result;
|
|
12008
12055
|
};
|
|
@@ -12097,7 +12144,8 @@ function useComputed() {
|
|
|
12097
12144
|
computedPinnedStartWidth,
|
|
12098
12145
|
computedPinnedEndWidth,
|
|
12099
12146
|
renderSelectionCheckBox,
|
|
12100
|
-
computedColumnsMap
|
|
12147
|
+
computedColumnsMap,
|
|
12148
|
+
fieldsToColumn
|
|
12101
12149
|
} = useComputedVisibleColumns({
|
|
12102
12150
|
columns,
|
|
12103
12151
|
columnCssEllipsis: componentState.columnCssEllipsis,
|
|
@@ -12159,7 +12207,8 @@ function useComputed() {
|
|
|
12159
12207
|
computedPinnedEndColumnsWidth,
|
|
12160
12208
|
computedUnpinnedColumnsWidth,
|
|
12161
12209
|
computedUnpinnedOffset,
|
|
12162
|
-
computedPinnedEndOffset
|
|
12210
|
+
computedPinnedEndOffset,
|
|
12211
|
+
fieldsToColumn
|
|
12163
12212
|
};
|
|
12164
12213
|
}
|
|
12165
12214
|
|
|
@@ -12325,7 +12374,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12325
12374
|
const valid = useMemo11(() => {
|
|
12326
12375
|
let valid2 = isValidLicense(licenseKey, {
|
|
12327
12376
|
publishedAt: 1624970570587,
|
|
12328
|
-
version: "0.4.
|
|
12377
|
+
version: "0.4.5"
|
|
12329
12378
|
});
|
|
12330
12379
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12331
12380
|
return true;
|
|
@@ -12520,6 +12569,7 @@ function initSetupState2() {
|
|
|
12520
12569
|
focused: false,
|
|
12521
12570
|
focusedWithin: false,
|
|
12522
12571
|
columnsWhenGrouping: columnsGeneratedForGrouping,
|
|
12572
|
+
columnVisibilityForGrouping: {},
|
|
12523
12573
|
pinnedStartScrollListener: new ScrollListener(),
|
|
12524
12574
|
pinnedEndScrollListener: new ScrollListener(),
|
|
12525
12575
|
columnsWhenInlineGroupRenderStrategy: void 0
|
package/index.js
CHANGED
|
@@ -5026,7 +5026,6 @@ var useColumnPointerEvents = ({
|
|
|
5026
5026
|
if (!equalPinning(getState().columnPinning, columnPinning)) {
|
|
5027
5027
|
componentActions.columnPinning = columnPinning;
|
|
5028
5028
|
}
|
|
5029
|
-
console.log("old order", getComputed().computedColumnOrder);
|
|
5030
5029
|
const currentComputedColumnOrder = getComputed().computedColumnOrder;
|
|
5031
5030
|
if (JSON.stringify(columnOrder, currentComputedColumnOrder)) {
|
|
5032
5031
|
computedVisibleColumns.forEach((col) => {
|
|
@@ -5416,8 +5415,15 @@ function isColumnWithField(c) {
|
|
|
5416
5415
|
return typeof c.field === "string";
|
|
5417
5416
|
}
|
|
5418
5417
|
function getGroupByColumn(options) {
|
|
5419
|
-
const { column, rowInfo,
|
|
5420
|
-
|
|
5418
|
+
const { column, rowInfo, fieldsToColumn } = options;
|
|
5419
|
+
let groupByColumn = void 0;
|
|
5420
|
+
if (column.groupByField) {
|
|
5421
|
+
if (rowInfo.isGroupRow) {
|
|
5422
|
+
groupByColumn = fieldsToColumn.get(rowInfo.groupBy[rowInfo.groupBy.length - 1]);
|
|
5423
|
+
} else if (column.field) {
|
|
5424
|
+
groupByColumn = fieldsToColumn.get(column.field);
|
|
5425
|
+
}
|
|
5426
|
+
}
|
|
5421
5427
|
return groupByColumn;
|
|
5422
5428
|
}
|
|
5423
5429
|
function getColumnRenderingParams(options) {
|
|
@@ -5433,11 +5439,11 @@ function getColumnRenderingParams(options) {
|
|
|
5433
5439
|
}, formattedValueContext),
|
|
5434
5440
|
formattedValueContext,
|
|
5435
5441
|
renderFunctions: {
|
|
5436
|
-
renderGroupIcon: (groupByColumn == null ? void 0 : groupByColumn.renderGroupIcon)
|
|
5442
|
+
renderGroupIcon: column.renderGroupIcon || (groupByColumn == null ? void 0 : groupByColumn.renderGroupIcon),
|
|
5437
5443
|
renderSelectionCheckBox: column.renderSelectionCheckBox,
|
|
5438
|
-
renderValue: (groupByColumn == null ? void 0 : groupByColumn.renderValue)
|
|
5439
|
-
renderGroupValue: (groupByColumn == null ? void 0 : groupByColumn.renderGroupValue)
|
|
5440
|
-
renderLeafValue: (groupByColumn == null ? void 0 : groupByColumn.renderLeafValue)
|
|
5444
|
+
renderValue: column.renderValue || (groupByColumn == null ? void 0 : groupByColumn.renderValue),
|
|
5445
|
+
renderGroupValue: column.renderGroupValue || (groupByColumn == null ? void 0 : groupByColumn.renderGroupValue),
|
|
5446
|
+
renderLeafValue: column.renderLeafValue || (groupByColumn == null ? void 0 : groupByColumn.renderLeafValue)
|
|
5441
5447
|
},
|
|
5442
5448
|
renderParams: getColumnRenderParam(__spreadProps(__spreadValues({}, options), {
|
|
5443
5449
|
formattedValueContext
|
|
@@ -5446,17 +5452,25 @@ function getColumnRenderingParams(options) {
|
|
|
5446
5452
|
};
|
|
5447
5453
|
}
|
|
5448
5454
|
function getColumnRenderParam(options) {
|
|
5449
|
-
const {
|
|
5455
|
+
const {
|
|
5456
|
+
column,
|
|
5457
|
+
context,
|
|
5458
|
+
rowInfo,
|
|
5459
|
+
columnsMap,
|
|
5460
|
+
fieldsToColumn,
|
|
5461
|
+
formattedValueContext
|
|
5462
|
+
} = options;
|
|
5450
5463
|
const { value } = formattedValueContext;
|
|
5451
5464
|
const { api: imperativeApi, getDataSourceState } = context;
|
|
5452
5465
|
const { indexInAll: rowIndex } = rowInfo;
|
|
5453
5466
|
const dataSourceState = getDataSourceState();
|
|
5454
5467
|
const { selectionMode } = dataSourceState;
|
|
5455
|
-
const groupByColumn =
|
|
5468
|
+
const groupByColumn = getGroupByColumn({ rowInfo, column, fieldsToColumn });
|
|
5456
5469
|
const toggleGroupRow = imperativeApi.toggleGroupRow;
|
|
5457
5470
|
const renderParam = __spreadProps(__spreadValues({
|
|
5458
5471
|
column,
|
|
5459
|
-
columnsMap
|
|
5472
|
+
columnsMap,
|
|
5473
|
+
fieldsToColumn
|
|
5460
5474
|
}, formattedValueContext), {
|
|
5461
5475
|
groupByColumn,
|
|
5462
5476
|
selectionMode,
|
|
@@ -5661,6 +5675,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5661
5675
|
rowIndex,
|
|
5662
5676
|
rowHeight,
|
|
5663
5677
|
columnsMap,
|
|
5678
|
+
fieldsToColumn,
|
|
5664
5679
|
domRef,
|
|
5665
5680
|
hidden,
|
|
5666
5681
|
showZebraRows
|
|
@@ -5691,6 +5706,7 @@ function InfiniteTableColumnCellFn(props) {
|
|
|
5691
5706
|
column,
|
|
5692
5707
|
rowInfo,
|
|
5693
5708
|
columnsMap,
|
|
5709
|
+
fieldsToColumn,
|
|
5694
5710
|
context: renderingContext
|
|
5695
5711
|
});
|
|
5696
5712
|
const renderParam = renderParams;
|
|
@@ -10500,6 +10516,7 @@ function useCellRendering(param) {
|
|
|
10500
10516
|
computedPinnedEndColumns,
|
|
10501
10517
|
computedVisibleColumns,
|
|
10502
10518
|
computedColumnsMap,
|
|
10519
|
+
fieldsToColumn,
|
|
10503
10520
|
rowspan,
|
|
10504
10521
|
toggleGroupRow,
|
|
10505
10522
|
columnSize
|
|
@@ -10604,6 +10621,7 @@ function useCellRendering(param) {
|
|
|
10604
10621
|
width,
|
|
10605
10622
|
column,
|
|
10606
10623
|
columnsMap: computedColumnsMap,
|
|
10624
|
+
fieldsToColumn,
|
|
10607
10625
|
rowStyle,
|
|
10608
10626
|
rowClassName
|
|
10609
10627
|
};
|
|
@@ -10613,6 +10631,7 @@ function useCellRendering(param) {
|
|
|
10613
10631
|
getData,
|
|
10614
10632
|
computedVisibleColumns,
|
|
10615
10633
|
computedColumnsMap,
|
|
10634
|
+
fieldsToColumn,
|
|
10616
10635
|
groupRenderStrategy,
|
|
10617
10636
|
toggleGroupRow,
|
|
10618
10637
|
showZebraRows,
|
|
@@ -11224,24 +11243,45 @@ function useHideColumns(groupByMap) {
|
|
|
11224
11243
|
(0, import_react39.useEffect)(() => {
|
|
11225
11244
|
const isGrouped = groupBy.length > 0;
|
|
11226
11245
|
const currentState = getComponentState();
|
|
11227
|
-
const {
|
|
11246
|
+
const {
|
|
11247
|
+
columnVisibility,
|
|
11248
|
+
columnVisibilityForGrouping,
|
|
11249
|
+
hideColumnWhenGrouped: hideColumnWhenGrouped2
|
|
11250
|
+
} = currentState;
|
|
11228
11251
|
const newColumnVisibility = __spreadValues({}, columnVisibility);
|
|
11229
|
-
let
|
|
11252
|
+
let newColumnVisibilityForGrouping = __spreadValues({}, columnVisibilityForGrouping);
|
|
11253
|
+
let updatedVisibilityWhenGrouping = false;
|
|
11254
|
+
let newlyHiddenColumns = new Set();
|
|
11255
|
+
let newlyDisplayedColumns = new Set();
|
|
11230
11256
|
computedColumns.forEach((col, id) => {
|
|
11231
|
-
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2) {
|
|
11232
|
-
const
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11257
|
+
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2 != null) {
|
|
11258
|
+
const hideWhenGrouped = col.defaultHiddenWhenGroupedBy === "*" && isGrouped || (col.defaultHiddenWhenGroupedBy === true || hideColumnWhenGrouped2) && col.field && groupByMap.get(col.field) || typeof col.defaultHiddenWhenGroupedBy === "string" && groupByMap.get(col.defaultHiddenWhenGroupedBy) || typeof col.defaultHiddenWhenGroupedBy === "object" && Object.keys(col.defaultHiddenWhenGroupedBy).reduce((acc, field) => acc || groupByMap.has(field), false);
|
|
11259
|
+
if (hideWhenGrouped) {
|
|
11260
|
+
if (newColumnVisibilityForGrouping[id] !== false) {
|
|
11261
|
+
if (columnVisibility[id] === false) {
|
|
11262
|
+
return;
|
|
11263
|
+
}
|
|
11264
|
+
newColumnVisibilityForGrouping[id] = false;
|
|
11265
|
+
updatedVisibilityWhenGrouping = true;
|
|
11266
|
+
newlyHiddenColumns.add(id);
|
|
11267
|
+
}
|
|
11268
|
+
} else {
|
|
11269
|
+
if (newColumnVisibilityForGrouping[id] === false) {
|
|
11270
|
+
delete newColumnVisibilityForGrouping[id];
|
|
11271
|
+
updatedVisibilityWhenGrouping = true;
|
|
11272
|
+
newlyDisplayedColumns.add(id);
|
|
11240
11273
|
}
|
|
11241
11274
|
}
|
|
11242
11275
|
}
|
|
11243
11276
|
});
|
|
11244
|
-
if (
|
|
11277
|
+
if (updatedVisibilityWhenGrouping) {
|
|
11278
|
+
componentActions.columnVisibilityForGrouping = newColumnVisibilityForGrouping;
|
|
11279
|
+
newlyDisplayedColumns.forEach((colId) => {
|
|
11280
|
+
delete newColumnVisibility[colId];
|
|
11281
|
+
});
|
|
11282
|
+
newlyHiddenColumns.forEach((colId) => {
|
|
11283
|
+
newColumnVisibility[colId] = false;
|
|
11284
|
+
});
|
|
11245
11285
|
componentActions.columnVisibility = newColumnVisibility;
|
|
11246
11286
|
}
|
|
11247
11287
|
}, [
|
|
@@ -11579,6 +11619,7 @@ var getComputedVisibleColumns = ({
|
|
|
11579
11619
|
orderedColumns.set(key, c);
|
|
11580
11620
|
}
|
|
11581
11621
|
});
|
|
11622
|
+
const fieldsToColumn = new Map();
|
|
11582
11623
|
orderedColumns.forEach((c, id) => {
|
|
11583
11624
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
11584
11625
|
let theComputedVisibleIndex = columnIdsToVisibleIndex.get(id);
|
|
@@ -11749,6 +11790,9 @@ var getComputedVisibleColumns = ({
|
|
|
11749
11790
|
groupColumns.push(result2);
|
|
11750
11791
|
}
|
|
11751
11792
|
computedColumnsMap.set(result2.id, result2);
|
|
11793
|
+
if (result2.field && !result2.groupByField && !fieldsToColumn.has(result2.field)) {
|
|
11794
|
+
fieldsToColumn.set(result2.field, result2);
|
|
11795
|
+
}
|
|
11752
11796
|
});
|
|
11753
11797
|
groupColumns.forEach((col) => {
|
|
11754
11798
|
col.computedSortable = isGroupColumnSortable(col, computedColumnsMap);
|
|
@@ -11773,7 +11817,8 @@ var getComputedVisibleColumns = ({
|
|
|
11773
11817
|
computedPinnedStartWidth,
|
|
11774
11818
|
renderSelectionCheckBox: computedVisibleColumns.reduce((bool, c) => {
|
|
11775
11819
|
return bool || !!c.renderSelectionCheckBox;
|
|
11776
|
-
}, false)
|
|
11820
|
+
}, false),
|
|
11821
|
+
fieldsToColumn
|
|
11777
11822
|
};
|
|
11778
11823
|
return result;
|
|
11779
11824
|
};
|
|
@@ -11836,7 +11881,8 @@ var useComputedVisibleColumns = ({
|
|
|
11836
11881
|
computedPinnedEndWidth,
|
|
11837
11882
|
computedPinnedStartWidth,
|
|
11838
11883
|
renderSelectionCheckBox,
|
|
11839
|
-
computedColumnsMap
|
|
11884
|
+
computedColumnsMap,
|
|
11885
|
+
fieldsToColumn
|
|
11840
11886
|
} = (0, import_react41.useMemo)(() => {
|
|
11841
11887
|
return getComputedVisibleColumns({
|
|
11842
11888
|
columns,
|
|
@@ -11903,7 +11949,8 @@ var useComputedVisibleColumns = ({
|
|
|
11903
11949
|
computedUnpinnedColumns,
|
|
11904
11950
|
computedVisibleColumns,
|
|
11905
11951
|
computedVisibleColumnsMap,
|
|
11906
|
-
computedColumnOrder
|
|
11952
|
+
computedColumnOrder,
|
|
11953
|
+
fieldsToColumn
|
|
11907
11954
|
};
|
|
11908
11955
|
return result;
|
|
11909
11956
|
};
|
|
@@ -11998,7 +12045,8 @@ function useComputed() {
|
|
|
11998
12045
|
computedPinnedStartWidth,
|
|
11999
12046
|
computedPinnedEndWidth,
|
|
12000
12047
|
renderSelectionCheckBox,
|
|
12001
|
-
computedColumnsMap
|
|
12048
|
+
computedColumnsMap,
|
|
12049
|
+
fieldsToColumn
|
|
12002
12050
|
} = useComputedVisibleColumns({
|
|
12003
12051
|
columns,
|
|
12004
12052
|
columnCssEllipsis: componentState.columnCssEllipsis,
|
|
@@ -12060,7 +12108,8 @@ function useComputed() {
|
|
|
12060
12108
|
computedPinnedEndColumnsWidth,
|
|
12061
12109
|
computedUnpinnedColumnsWidth,
|
|
12062
12110
|
computedUnpinnedOffset,
|
|
12063
|
-
computedPinnedEndOffset
|
|
12111
|
+
computedPinnedEndOffset,
|
|
12112
|
+
fieldsToColumn
|
|
12064
12113
|
};
|
|
12065
12114
|
}
|
|
12066
12115
|
|
|
@@ -12226,7 +12275,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12226
12275
|
const valid = (0, import_react44.useMemo)(() => {
|
|
12227
12276
|
let valid2 = isValidLicense(licenseKey, {
|
|
12228
12277
|
publishedAt: 1624970570587,
|
|
12229
|
-
version: "0.4.
|
|
12278
|
+
version: "0.4.5"
|
|
12230
12279
|
});
|
|
12231
12280
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12232
12281
|
return true;
|
|
@@ -12421,6 +12470,7 @@ function initSetupState2() {
|
|
|
12421
12470
|
focused: false,
|
|
12422
12471
|
focusedWithin: false,
|
|
12423
12472
|
columnsWhenGrouping: columnsGeneratedForGrouping,
|
|
12473
|
+
columnVisibilityForGrouping: {},
|
|
12424
12474
|
pinnedStartScrollListener: new ScrollListener(),
|
|
12425
12475
|
pinnedEndScrollListener: new ScrollListener(),
|
|
12426
12476
|
columnsWhenInlineGroupRenderStrategy: void 0
|
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.5",
|
|
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": 1660890090935
|
|
18
18
|
}
|