@infinite-table/infinite-react 0.4.4 → 0.4.7
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 +95 -38
- package/index.js +95 -38
- 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;
|
|
@@ -6769,6 +6785,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6769
6785
|
};
|
|
6770
6786
|
const align = column.align || "start";
|
|
6771
6787
|
const renderChildren = () => {
|
|
6788
|
+
var _a2;
|
|
6772
6789
|
if (column.renderSortIcon) {
|
|
6773
6790
|
renderParam.renderBag.sortIcon = /* @__PURE__ */ createElement25(RenderHeaderCellHookComponent, {
|
|
6774
6791
|
render: column.renderSortIcon,
|
|
@@ -6782,9 +6799,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6782
6799
|
render: defaultRenderSelectionCheckBox2,
|
|
6783
6800
|
renderParam
|
|
6784
6801
|
});
|
|
6785
|
-
|
|
6802
|
+
const renderHeaderSelectionCheckBox = (_a2 = column.renderHeaderSelectionCheckBox) != null ? _a2 : column.renderSelectionCheckBox;
|
|
6803
|
+
if (renderHeaderSelectionCheckBox && renderHeaderSelectionCheckBox !== true) {
|
|
6786
6804
|
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ createElement25(RenderHeaderCellHookComponent, {
|
|
6787
|
-
render:
|
|
6805
|
+
render: renderHeaderSelectionCheckBox,
|
|
6788
6806
|
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6789
6807
|
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6790
6808
|
})
|
|
@@ -9566,7 +9584,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
9566
9584
|
return livePaginationCursor;
|
|
9567
9585
|
}
|
|
9568
9586
|
function mapPropsToState(params) {
|
|
9569
|
-
var _a
|
|
9587
|
+
var _a;
|
|
9570
9588
|
const { props, state, oldState } = params;
|
|
9571
9589
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
9572
9590
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -9585,7 +9603,7 @@ function mapPropsToState(params) {
|
|
|
9585
9603
|
if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
|
|
9586
9604
|
selectionMode = "multi-cell";
|
|
9587
9605
|
} else {
|
|
9588
|
-
const rowSelectionProp =
|
|
9606
|
+
const rowSelectionProp = props.rowSelection !== void 0 ? props.rowSelection : props.defaultRowSelection;
|
|
9589
9607
|
if (rowSelectionProp !== void 0) {
|
|
9590
9608
|
if (rowSelectionProp && typeof rowSelectionProp === "object") {
|
|
9591
9609
|
selectionMode = "multi-row";
|
|
@@ -9620,7 +9638,7 @@ function mapPropsToState(params) {
|
|
|
9620
9638
|
operatorsByFilterType,
|
|
9621
9639
|
controlledSort,
|
|
9622
9640
|
controlledFilter,
|
|
9623
|
-
filterMode: ((
|
|
9641
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
9624
9642
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
9625
9643
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
9626
9644
|
};
|
|
@@ -10599,6 +10617,7 @@ function useCellRendering(param) {
|
|
|
10599
10617
|
computedPinnedEndColumns,
|
|
10600
10618
|
computedVisibleColumns,
|
|
10601
10619
|
computedColumnsMap,
|
|
10620
|
+
fieldsToColumn,
|
|
10602
10621
|
rowspan,
|
|
10603
10622
|
toggleGroupRow,
|
|
10604
10623
|
columnSize
|
|
@@ -10703,6 +10722,7 @@ function useCellRendering(param) {
|
|
|
10703
10722
|
width,
|
|
10704
10723
|
column,
|
|
10705
10724
|
columnsMap: computedColumnsMap,
|
|
10725
|
+
fieldsToColumn,
|
|
10706
10726
|
rowStyle,
|
|
10707
10727
|
rowClassName
|
|
10708
10728
|
};
|
|
@@ -10712,6 +10732,7 @@ function useCellRendering(param) {
|
|
|
10712
10732
|
getData,
|
|
10713
10733
|
computedVisibleColumns,
|
|
10714
10734
|
computedColumnsMap,
|
|
10735
|
+
fieldsToColumn,
|
|
10715
10736
|
groupRenderStrategy,
|
|
10716
10737
|
toggleGroupRow,
|
|
10717
10738
|
showZebraRows,
|
|
@@ -11323,24 +11344,45 @@ function useHideColumns(groupByMap) {
|
|
|
11323
11344
|
useEffect23(() => {
|
|
11324
11345
|
const isGrouped = groupBy.length > 0;
|
|
11325
11346
|
const currentState = getComponentState();
|
|
11326
|
-
const {
|
|
11347
|
+
const {
|
|
11348
|
+
columnVisibility,
|
|
11349
|
+
columnVisibilityForGrouping,
|
|
11350
|
+
hideColumnWhenGrouped: hideColumnWhenGrouped2
|
|
11351
|
+
} = currentState;
|
|
11327
11352
|
const newColumnVisibility = __spreadValues({}, columnVisibility);
|
|
11328
|
-
let
|
|
11353
|
+
let newColumnVisibilityForGrouping = __spreadValues({}, columnVisibilityForGrouping);
|
|
11354
|
+
let updatedVisibilityWhenGrouping = false;
|
|
11355
|
+
let newlyHiddenColumns = new Set();
|
|
11356
|
+
let newlyDisplayedColumns = new Set();
|
|
11329
11357
|
computedColumns.forEach((col, id) => {
|
|
11330
|
-
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2) {
|
|
11331
|
-
const
|
|
11332
|
-
|
|
11333
|
-
|
|
11334
|
-
|
|
11335
|
-
|
|
11336
|
-
|
|
11337
|
-
|
|
11338
|
-
|
|
11358
|
+
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2 != null) {
|
|
11359
|
+
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);
|
|
11360
|
+
if (hideWhenGrouped) {
|
|
11361
|
+
if (newColumnVisibilityForGrouping[id] !== false) {
|
|
11362
|
+
if (columnVisibility[id] === false) {
|
|
11363
|
+
return;
|
|
11364
|
+
}
|
|
11365
|
+
newColumnVisibilityForGrouping[id] = false;
|
|
11366
|
+
updatedVisibilityWhenGrouping = true;
|
|
11367
|
+
newlyHiddenColumns.add(id);
|
|
11368
|
+
}
|
|
11369
|
+
} else {
|
|
11370
|
+
if (newColumnVisibilityForGrouping[id] === false) {
|
|
11371
|
+
delete newColumnVisibilityForGrouping[id];
|
|
11372
|
+
updatedVisibilityWhenGrouping = true;
|
|
11373
|
+
newlyDisplayedColumns.add(id);
|
|
11339
11374
|
}
|
|
11340
11375
|
}
|
|
11341
11376
|
}
|
|
11342
11377
|
});
|
|
11343
|
-
if (
|
|
11378
|
+
if (updatedVisibilityWhenGrouping) {
|
|
11379
|
+
componentActions.columnVisibilityForGrouping = newColumnVisibilityForGrouping;
|
|
11380
|
+
newlyDisplayedColumns.forEach((colId) => {
|
|
11381
|
+
delete newColumnVisibility[colId];
|
|
11382
|
+
});
|
|
11383
|
+
newlyHiddenColumns.forEach((colId) => {
|
|
11384
|
+
newColumnVisibility[colId] = false;
|
|
11385
|
+
});
|
|
11344
11386
|
componentActions.columnVisibility = newColumnVisibility;
|
|
11345
11387
|
}
|
|
11346
11388
|
}, [
|
|
@@ -11678,6 +11720,7 @@ var getComputedVisibleColumns = ({
|
|
|
11678
11720
|
orderedColumns.set(key, c);
|
|
11679
11721
|
}
|
|
11680
11722
|
});
|
|
11723
|
+
const fieldsToColumn = new Map();
|
|
11681
11724
|
orderedColumns.forEach((c, id) => {
|
|
11682
11725
|
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
11726
|
let theComputedVisibleIndex = columnIdsToVisibleIndex.get(id);
|
|
@@ -11848,6 +11891,9 @@ var getComputedVisibleColumns = ({
|
|
|
11848
11891
|
groupColumns.push(result2);
|
|
11849
11892
|
}
|
|
11850
11893
|
computedColumnsMap.set(result2.id, result2);
|
|
11894
|
+
if (result2.field && !result2.groupByField && !fieldsToColumn.has(result2.field)) {
|
|
11895
|
+
fieldsToColumn.set(result2.field, result2);
|
|
11896
|
+
}
|
|
11851
11897
|
});
|
|
11852
11898
|
groupColumns.forEach((col) => {
|
|
11853
11899
|
col.computedSortable = isGroupColumnSortable(col, computedColumnsMap);
|
|
@@ -11872,7 +11918,8 @@ var getComputedVisibleColumns = ({
|
|
|
11872
11918
|
computedPinnedStartWidth,
|
|
11873
11919
|
renderSelectionCheckBox: computedVisibleColumns.reduce((bool, c) => {
|
|
11874
11920
|
return bool || !!c.renderSelectionCheckBox;
|
|
11875
|
-
}, false)
|
|
11921
|
+
}, false),
|
|
11922
|
+
fieldsToColumn
|
|
11876
11923
|
};
|
|
11877
11924
|
return result;
|
|
11878
11925
|
};
|
|
@@ -11935,7 +11982,8 @@ var useComputedVisibleColumns = ({
|
|
|
11935
11982
|
computedPinnedEndWidth,
|
|
11936
11983
|
computedPinnedStartWidth,
|
|
11937
11984
|
renderSelectionCheckBox,
|
|
11938
|
-
computedColumnsMap
|
|
11985
|
+
computedColumnsMap,
|
|
11986
|
+
fieldsToColumn
|
|
11939
11987
|
} = useMemo10(() => {
|
|
11940
11988
|
return getComputedVisibleColumns({
|
|
11941
11989
|
columns,
|
|
@@ -12002,7 +12050,8 @@ var useComputedVisibleColumns = ({
|
|
|
12002
12050
|
computedUnpinnedColumns,
|
|
12003
12051
|
computedVisibleColumns,
|
|
12004
12052
|
computedVisibleColumnsMap,
|
|
12005
|
-
computedColumnOrder
|
|
12053
|
+
computedColumnOrder,
|
|
12054
|
+
fieldsToColumn
|
|
12006
12055
|
};
|
|
12007
12056
|
return result;
|
|
12008
12057
|
};
|
|
@@ -12097,7 +12146,8 @@ function useComputed() {
|
|
|
12097
12146
|
computedPinnedStartWidth,
|
|
12098
12147
|
computedPinnedEndWidth,
|
|
12099
12148
|
renderSelectionCheckBox,
|
|
12100
|
-
computedColumnsMap
|
|
12149
|
+
computedColumnsMap,
|
|
12150
|
+
fieldsToColumn
|
|
12101
12151
|
} = useComputedVisibleColumns({
|
|
12102
12152
|
columns,
|
|
12103
12153
|
columnCssEllipsis: componentState.columnCssEllipsis,
|
|
@@ -12159,7 +12209,8 @@ function useComputed() {
|
|
|
12159
12209
|
computedPinnedEndColumnsWidth,
|
|
12160
12210
|
computedUnpinnedColumnsWidth,
|
|
12161
12211
|
computedUnpinnedOffset,
|
|
12162
|
-
computedPinnedEndOffset
|
|
12212
|
+
computedPinnedEndOffset,
|
|
12213
|
+
fieldsToColumn
|
|
12163
12214
|
};
|
|
12164
12215
|
}
|
|
12165
12216
|
|
|
@@ -12325,7 +12376,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12325
12376
|
const valid = useMemo11(() => {
|
|
12326
12377
|
let valid2 = isValidLicense(licenseKey, {
|
|
12327
12378
|
publishedAt: 1624970570587,
|
|
12328
|
-
version: "0.4.
|
|
12379
|
+
version: "0.4.7"
|
|
12329
12380
|
});
|
|
12330
12381
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12331
12382
|
return true;
|
|
@@ -12387,7 +12438,7 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
12387
12438
|
times++;
|
|
12388
12439
|
rafId.current = requestAnimationFrame(() => {
|
|
12389
12440
|
didScrollRef.current = imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
12390
|
-
offset:
|
|
12441
|
+
offset: 0
|
|
12391
12442
|
});
|
|
12392
12443
|
if (!didScrollRef.current && times < RETRIES2) {
|
|
12393
12444
|
tryScroll(times);
|
|
@@ -12520,6 +12571,7 @@ function initSetupState2() {
|
|
|
12520
12571
|
focused: false,
|
|
12521
12572
|
focusedWithin: false,
|
|
12522
12573
|
columnsWhenGrouping: columnsGeneratedForGrouping,
|
|
12574
|
+
columnVisibilityForGrouping: {},
|
|
12523
12575
|
pinnedStartScrollListener: new ScrollListener(),
|
|
12524
12576
|
pinnedEndScrollListener: new ScrollListener(),
|
|
12525
12577
|
columnsWhenInlineGroupRenderStrategy: void 0
|
|
@@ -12659,11 +12711,10 @@ function onCellClick(context, event) {
|
|
|
12659
12711
|
updateRowSelectionOnCellClick(context, event);
|
|
12660
12712
|
}
|
|
12661
12713
|
function updateRowSelectionOnCellClick(context, event) {
|
|
12662
|
-
const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
|
|
12714
|
+
const { rowIndex, getDataSourceState, getComputed, dataSourceActions, api } = context;
|
|
12663
12715
|
const { multiRowSelector, renderSelectionCheckBox } = getComputed();
|
|
12664
12716
|
const dataSourceState = getDataSourceState();
|
|
12665
|
-
const { selectionMode, groupBy } = dataSourceState;
|
|
12666
|
-
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12717
|
+
const { selectionMode, groupBy, dataArray } = dataSourceState;
|
|
12667
12718
|
if (groupBy.length) {
|
|
12668
12719
|
return false;
|
|
12669
12720
|
}
|
|
@@ -12671,6 +12722,7 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12671
12722
|
if (renderSelectionCheckBox && !event.key) {
|
|
12672
12723
|
return false;
|
|
12673
12724
|
}
|
|
12725
|
+
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12674
12726
|
rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12675
12727
|
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
12676
12728
|
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
@@ -12685,6 +12737,12 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12685
12737
|
return true;
|
|
12686
12738
|
}
|
|
12687
12739
|
} else if (selectionMode === "single-row") {
|
|
12740
|
+
const id = dataArray[rowIndex].id;
|
|
12741
|
+
if (event.metaKey || event.ctrlKey) {
|
|
12742
|
+
api.selectionApi.toggleRowSelection(id);
|
|
12743
|
+
} else {
|
|
12744
|
+
api.selectionApi.selectRow(id);
|
|
12745
|
+
}
|
|
12688
12746
|
}
|
|
12689
12747
|
return false;
|
|
12690
12748
|
}
|
|
@@ -12937,7 +12995,6 @@ function handleKeyboardSelection(context) {
|
|
|
12937
12995
|
const event = __spreadValues({}, context);
|
|
12938
12996
|
const { renderSelectionCheckBox } = context.getComputed();
|
|
12939
12997
|
if (renderSelectionCheckBox) {
|
|
12940
|
-
event.shiftKey = false;
|
|
12941
12998
|
event.metaKey = false;
|
|
12942
12999
|
event.ctrlKey = true;
|
|
12943
13000
|
}
|
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;
|
|
@@ -6701,6 +6717,7 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6701
6717
|
};
|
|
6702
6718
|
const align = column.align || "start";
|
|
6703
6719
|
const renderChildren = () => {
|
|
6720
|
+
var _a2;
|
|
6704
6721
|
if (column.renderSortIcon) {
|
|
6705
6722
|
renderParam.renderBag.sortIcon = /* @__PURE__ */ React28.createElement(RenderHeaderCellHookComponent, {
|
|
6706
6723
|
render: column.renderSortIcon,
|
|
@@ -6714,9 +6731,10 @@ function InfiniteTableHeaderCell(props) {
|
|
|
6714
6731
|
render: defaultRenderSelectionCheckBox2,
|
|
6715
6732
|
renderParam
|
|
6716
6733
|
});
|
|
6717
|
-
|
|
6734
|
+
const renderHeaderSelectionCheckBox = (_a2 = column.renderHeaderSelectionCheckBox) != null ? _a2 : column.renderSelectionCheckBox;
|
|
6735
|
+
if (renderHeaderSelectionCheckBox && renderHeaderSelectionCheckBox !== true) {
|
|
6718
6736
|
renderParam.renderBag.selectionCheckBox = /* @__PURE__ */ React28.createElement(RenderHeaderCellHookComponent, {
|
|
6719
|
-
render:
|
|
6737
|
+
render: renderHeaderSelectionCheckBox,
|
|
6720
6738
|
renderParam: __spreadProps(__spreadValues({}, renderParam), {
|
|
6721
6739
|
renderBag: __spreadValues({}, renderParam.renderBag)
|
|
6722
6740
|
})
|
|
@@ -9473,7 +9491,7 @@ function getLivePaginationCursorValue(livePaginationCursorProp, state) {
|
|
|
9473
9491
|
return livePaginationCursor;
|
|
9474
9492
|
}
|
|
9475
9493
|
function mapPropsToState(params) {
|
|
9476
|
-
var _a
|
|
9494
|
+
var _a;
|
|
9477
9495
|
const { props, state, oldState } = params;
|
|
9478
9496
|
const controlledSort = isControlledValue(props.sortInfo);
|
|
9479
9497
|
const controlledFilter = isControlledValue(props.filterValue);
|
|
@@ -9492,7 +9510,7 @@ function mapPropsToState(params) {
|
|
|
9492
9510
|
if (props.cellSelection !== void 0 || props.defaultCellSelection !== void 0) {
|
|
9493
9511
|
selectionMode = "multi-cell";
|
|
9494
9512
|
} else {
|
|
9495
|
-
const rowSelectionProp =
|
|
9513
|
+
const rowSelectionProp = props.rowSelection !== void 0 ? props.rowSelection : props.defaultRowSelection;
|
|
9496
9514
|
if (rowSelectionProp !== void 0) {
|
|
9497
9515
|
if (rowSelectionProp && typeof rowSelectionProp === "object") {
|
|
9498
9516
|
selectionMode = "multi-row";
|
|
@@ -9527,7 +9545,7 @@ function mapPropsToState(params) {
|
|
|
9527
9545
|
operatorsByFilterType,
|
|
9528
9546
|
controlledSort,
|
|
9529
9547
|
controlledFilter,
|
|
9530
|
-
filterMode: ((
|
|
9548
|
+
filterMode: ((_a = props.filterMode) != null ? _a : props.filterFunction != null) ? "local" : typeof props.data === "function" ? "remote" : "local",
|
|
9531
9549
|
multiSort: Array.isArray(controlledSort ? props.sortInfo : props.defaultSortInfo),
|
|
9532
9550
|
lazyLoadBatchSize: typeof props.lazyLoad === "object" ? props.lazyLoad.batchSize : void 0
|
|
9533
9551
|
};
|
|
@@ -10500,6 +10518,7 @@ function useCellRendering(param) {
|
|
|
10500
10518
|
computedPinnedEndColumns,
|
|
10501
10519
|
computedVisibleColumns,
|
|
10502
10520
|
computedColumnsMap,
|
|
10521
|
+
fieldsToColumn,
|
|
10503
10522
|
rowspan,
|
|
10504
10523
|
toggleGroupRow,
|
|
10505
10524
|
columnSize
|
|
@@ -10604,6 +10623,7 @@ function useCellRendering(param) {
|
|
|
10604
10623
|
width,
|
|
10605
10624
|
column,
|
|
10606
10625
|
columnsMap: computedColumnsMap,
|
|
10626
|
+
fieldsToColumn,
|
|
10607
10627
|
rowStyle,
|
|
10608
10628
|
rowClassName
|
|
10609
10629
|
};
|
|
@@ -10613,6 +10633,7 @@ function useCellRendering(param) {
|
|
|
10613
10633
|
getData,
|
|
10614
10634
|
computedVisibleColumns,
|
|
10615
10635
|
computedColumnsMap,
|
|
10636
|
+
fieldsToColumn,
|
|
10616
10637
|
groupRenderStrategy,
|
|
10617
10638
|
toggleGroupRow,
|
|
10618
10639
|
showZebraRows,
|
|
@@ -11224,24 +11245,45 @@ function useHideColumns(groupByMap) {
|
|
|
11224
11245
|
(0, import_react39.useEffect)(() => {
|
|
11225
11246
|
const isGrouped = groupBy.length > 0;
|
|
11226
11247
|
const currentState = getComponentState();
|
|
11227
|
-
const {
|
|
11248
|
+
const {
|
|
11249
|
+
columnVisibility,
|
|
11250
|
+
columnVisibilityForGrouping,
|
|
11251
|
+
hideColumnWhenGrouped: hideColumnWhenGrouped2
|
|
11252
|
+
} = currentState;
|
|
11228
11253
|
const newColumnVisibility = __spreadValues({}, columnVisibility);
|
|
11229
|
-
let
|
|
11254
|
+
let newColumnVisibilityForGrouping = __spreadValues({}, columnVisibilityForGrouping);
|
|
11255
|
+
let updatedVisibilityWhenGrouping = false;
|
|
11256
|
+
let newlyHiddenColumns = new Set();
|
|
11257
|
+
let newlyDisplayedColumns = new Set();
|
|
11230
11258
|
computedColumns.forEach((col, id) => {
|
|
11231
|
-
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2) {
|
|
11232
|
-
const
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11259
|
+
if (col.defaultHiddenWhenGroupedBy || hideColumnWhenGrouped2 != null) {
|
|
11260
|
+
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);
|
|
11261
|
+
if (hideWhenGrouped) {
|
|
11262
|
+
if (newColumnVisibilityForGrouping[id] !== false) {
|
|
11263
|
+
if (columnVisibility[id] === false) {
|
|
11264
|
+
return;
|
|
11265
|
+
}
|
|
11266
|
+
newColumnVisibilityForGrouping[id] = false;
|
|
11267
|
+
updatedVisibilityWhenGrouping = true;
|
|
11268
|
+
newlyHiddenColumns.add(id);
|
|
11269
|
+
}
|
|
11270
|
+
} else {
|
|
11271
|
+
if (newColumnVisibilityForGrouping[id] === false) {
|
|
11272
|
+
delete newColumnVisibilityForGrouping[id];
|
|
11273
|
+
updatedVisibilityWhenGrouping = true;
|
|
11274
|
+
newlyDisplayedColumns.add(id);
|
|
11240
11275
|
}
|
|
11241
11276
|
}
|
|
11242
11277
|
}
|
|
11243
11278
|
});
|
|
11244
|
-
if (
|
|
11279
|
+
if (updatedVisibilityWhenGrouping) {
|
|
11280
|
+
componentActions.columnVisibilityForGrouping = newColumnVisibilityForGrouping;
|
|
11281
|
+
newlyDisplayedColumns.forEach((colId) => {
|
|
11282
|
+
delete newColumnVisibility[colId];
|
|
11283
|
+
});
|
|
11284
|
+
newlyHiddenColumns.forEach((colId) => {
|
|
11285
|
+
newColumnVisibility[colId] = false;
|
|
11286
|
+
});
|
|
11245
11287
|
componentActions.columnVisibility = newColumnVisibility;
|
|
11246
11288
|
}
|
|
11247
11289
|
}, [
|
|
@@ -11579,6 +11621,7 @@ var getComputedVisibleColumns = ({
|
|
|
11579
11621
|
orderedColumns.set(key, c);
|
|
11580
11622
|
}
|
|
11581
11623
|
});
|
|
11624
|
+
const fieldsToColumn = new Map();
|
|
11582
11625
|
orderedColumns.forEach((c, id) => {
|
|
11583
11626
|
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
11627
|
let theComputedVisibleIndex = columnIdsToVisibleIndex.get(id);
|
|
@@ -11749,6 +11792,9 @@ var getComputedVisibleColumns = ({
|
|
|
11749
11792
|
groupColumns.push(result2);
|
|
11750
11793
|
}
|
|
11751
11794
|
computedColumnsMap.set(result2.id, result2);
|
|
11795
|
+
if (result2.field && !result2.groupByField && !fieldsToColumn.has(result2.field)) {
|
|
11796
|
+
fieldsToColumn.set(result2.field, result2);
|
|
11797
|
+
}
|
|
11752
11798
|
});
|
|
11753
11799
|
groupColumns.forEach((col) => {
|
|
11754
11800
|
col.computedSortable = isGroupColumnSortable(col, computedColumnsMap);
|
|
@@ -11773,7 +11819,8 @@ var getComputedVisibleColumns = ({
|
|
|
11773
11819
|
computedPinnedStartWidth,
|
|
11774
11820
|
renderSelectionCheckBox: computedVisibleColumns.reduce((bool, c) => {
|
|
11775
11821
|
return bool || !!c.renderSelectionCheckBox;
|
|
11776
|
-
}, false)
|
|
11822
|
+
}, false),
|
|
11823
|
+
fieldsToColumn
|
|
11777
11824
|
};
|
|
11778
11825
|
return result;
|
|
11779
11826
|
};
|
|
@@ -11836,7 +11883,8 @@ var useComputedVisibleColumns = ({
|
|
|
11836
11883
|
computedPinnedEndWidth,
|
|
11837
11884
|
computedPinnedStartWidth,
|
|
11838
11885
|
renderSelectionCheckBox,
|
|
11839
|
-
computedColumnsMap
|
|
11886
|
+
computedColumnsMap,
|
|
11887
|
+
fieldsToColumn
|
|
11840
11888
|
} = (0, import_react41.useMemo)(() => {
|
|
11841
11889
|
return getComputedVisibleColumns({
|
|
11842
11890
|
columns,
|
|
@@ -11903,7 +11951,8 @@ var useComputedVisibleColumns = ({
|
|
|
11903
11951
|
computedUnpinnedColumns,
|
|
11904
11952
|
computedVisibleColumns,
|
|
11905
11953
|
computedVisibleColumnsMap,
|
|
11906
|
-
computedColumnOrder
|
|
11954
|
+
computedColumnOrder,
|
|
11955
|
+
fieldsToColumn
|
|
11907
11956
|
};
|
|
11908
11957
|
return result;
|
|
11909
11958
|
};
|
|
@@ -11998,7 +12047,8 @@ function useComputed() {
|
|
|
11998
12047
|
computedPinnedStartWidth,
|
|
11999
12048
|
computedPinnedEndWidth,
|
|
12000
12049
|
renderSelectionCheckBox,
|
|
12001
|
-
computedColumnsMap
|
|
12050
|
+
computedColumnsMap,
|
|
12051
|
+
fieldsToColumn
|
|
12002
12052
|
} = useComputedVisibleColumns({
|
|
12003
12053
|
columns,
|
|
12004
12054
|
columnCssEllipsis: componentState.columnCssEllipsis,
|
|
@@ -12060,7 +12110,8 @@ function useComputed() {
|
|
|
12060
12110
|
computedPinnedEndColumnsWidth,
|
|
12061
12111
|
computedUnpinnedColumnsWidth,
|
|
12062
12112
|
computedUnpinnedOffset,
|
|
12063
|
-
computedPinnedEndOffset
|
|
12113
|
+
computedPinnedEndOffset,
|
|
12114
|
+
fieldsToColumn
|
|
12064
12115
|
};
|
|
12065
12116
|
}
|
|
12066
12117
|
|
|
@@ -12226,7 +12277,7 @@ var useLicense = (licenseKey = "") => {
|
|
|
12226
12277
|
const valid = (0, import_react44.useMemo)(() => {
|
|
12227
12278
|
let valid2 = isValidLicense(licenseKey, {
|
|
12228
12279
|
publishedAt: 1624970570587,
|
|
12229
|
-
version: "0.4.
|
|
12280
|
+
version: "0.4.7"
|
|
12230
12281
|
});
|
|
12231
12282
|
if (!licenseKey && !valid2 && isInsidePlayground) {
|
|
12232
12283
|
return true;
|
|
@@ -12288,7 +12339,7 @@ function useScrollToActiveRow(activeRowIndex, dataCount, imperativeApi) {
|
|
|
12288
12339
|
times++;
|
|
12289
12340
|
rafId.current = requestAnimationFrame(() => {
|
|
12290
12341
|
didScrollRef.current = imperativeApi.scrollRowIntoView(activeRowIndex, {
|
|
12291
|
-
offset:
|
|
12342
|
+
offset: 0
|
|
12292
12343
|
});
|
|
12293
12344
|
if (!didScrollRef.current && times < RETRIES2) {
|
|
12294
12345
|
tryScroll(times);
|
|
@@ -12421,6 +12472,7 @@ function initSetupState2() {
|
|
|
12421
12472
|
focused: false,
|
|
12422
12473
|
focusedWithin: false,
|
|
12423
12474
|
columnsWhenGrouping: columnsGeneratedForGrouping,
|
|
12475
|
+
columnVisibilityForGrouping: {},
|
|
12424
12476
|
pinnedStartScrollListener: new ScrollListener(),
|
|
12425
12477
|
pinnedEndScrollListener: new ScrollListener(),
|
|
12426
12478
|
columnsWhenInlineGroupRenderStrategy: void 0
|
|
@@ -12560,11 +12612,10 @@ function onCellClick(context, event) {
|
|
|
12560
12612
|
updateRowSelectionOnCellClick(context, event);
|
|
12561
12613
|
}
|
|
12562
12614
|
function updateRowSelectionOnCellClick(context, event) {
|
|
12563
|
-
const { rowIndex, getDataSourceState, getComputed, dataSourceActions } = context;
|
|
12615
|
+
const { rowIndex, getDataSourceState, getComputed, dataSourceActions, api } = context;
|
|
12564
12616
|
const { multiRowSelector, renderSelectionCheckBox } = getComputed();
|
|
12565
12617
|
const dataSourceState = getDataSourceState();
|
|
12566
|
-
const { selectionMode, groupBy } = dataSourceState;
|
|
12567
|
-
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12618
|
+
const { selectionMode, groupBy, dataArray } = dataSourceState;
|
|
12568
12619
|
if (groupBy.length) {
|
|
12569
12620
|
return false;
|
|
12570
12621
|
}
|
|
@@ -12572,6 +12623,7 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12572
12623
|
if (renderSelectionCheckBox && !event.key) {
|
|
12573
12624
|
return false;
|
|
12574
12625
|
}
|
|
12626
|
+
let { rowSelection: rowSelectionState } = dataSourceState;
|
|
12575
12627
|
rowSelectionState = new RowSelectionState(rowSelectionState, rowSelectionStateConfigGetter(getDataSourceState));
|
|
12576
12628
|
multiRowSelector.rowSelectionState = rowSelectionState;
|
|
12577
12629
|
if (rowSelectionState && typeof rowSelectionState === "object") {
|
|
@@ -12586,6 +12638,12 @@ function updateRowSelectionOnCellClick(context, event) {
|
|
|
12586
12638
|
return true;
|
|
12587
12639
|
}
|
|
12588
12640
|
} else if (selectionMode === "single-row") {
|
|
12641
|
+
const id = dataArray[rowIndex].id;
|
|
12642
|
+
if (event.metaKey || event.ctrlKey) {
|
|
12643
|
+
api.selectionApi.toggleRowSelection(id);
|
|
12644
|
+
} else {
|
|
12645
|
+
api.selectionApi.selectRow(id);
|
|
12646
|
+
}
|
|
12589
12647
|
}
|
|
12590
12648
|
return false;
|
|
12591
12649
|
}
|
|
@@ -12838,7 +12896,6 @@ function handleKeyboardSelection(context) {
|
|
|
12838
12896
|
const event = __spreadValues({}, context);
|
|
12839
12897
|
const { renderSelectionCheckBox } = context.getComputed();
|
|
12840
12898
|
if (renderSelectionCheckBox) {
|
|
12841
|
-
event.shiftKey = false;
|
|
12842
12899
|
event.metaKey = false;
|
|
12843
12900
|
event.ctrlKey = true;
|
|
12844
12901
|
}
|
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.7",
|
|
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": 1660906320492
|
|
18
18
|
}
|