Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ export const useColumnsDeps = (hooks: ReactTableHooks) => {
hooks.columnsDeps.push(columnsDeps);
hooks.visibleColumnsDeps.push(visibleColumnsDeps);
};
useColumnsDeps.pluginName = 'useColumnsDeps';
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,4 @@ function getHeaderProps(
export function useColumnDragAndDrop(hooks: ReactTableHooks) {
hooks.getHeaderProps.push(getHeaderProps);
}
useColumnDragAndDrop.pluginName = 'useColumnDragAndDrop';
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ensurePluginOrder } from 'react-table';
import { AnalyticalTableScaleWidthMode } from '../../../enums/AnalyticalTableScaleWidthMode.js';
import type {
AnalyticalTableColumnDefinition,
Expand Down Expand Up @@ -483,7 +484,10 @@ function captureRawColumnWidths(columns: AnalyticalTableColumnDefinition[], { in
* This function follows `react-table`'s own `useResizeColumns` pattern: mutate `header.width` directly, to prevent cascading updates and rerenders.
*/
const adjustColumnWidths = (instance: TableInstance) => {
const { flatHeaders, state, rows, data, webComponentsReactProperties } = instance;
const { flatHeaders, state, rows, data, webComponentsReactProperties, plugins } = instance;

ensurePluginOrder(plugins, ['useColumnResizing'], 'useDynamicColumnWidths');

const { scaleWidthMode, loading, fontsReady } = webComponentsReactProperties;
const { hiddenColumns, tableClientWidth: totalWidth, tableColResized, columnResizing } = state;

Expand Down Expand Up @@ -605,3 +609,4 @@ export const useDynamicColumnWidths = (hooks: ReactTableHooks) => {
hooks.columns.push(captureRawColumnWidths);
hooks.useInstanceBeforeDimensions.push(adjustColumnWidths);
};
useDynamicColumnWidths.pluginName = 'useDynamicColumnWidths';
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,4 @@ export const useKeyboardNavigation = (hooks: ReactTableHooks) => {
hooks.getTableProps.push(useGetTableProps);
hooks.getHeaderProps.push(setHeaderProps);
};
useKeyboardNavigation.pluginName = 'useKeyboardNavigation';
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,4 @@ export const useRowNavigationIndicators = (hooks: ReactTableHooks) => {
hooks.columns.push(columns);
hooks.visibleColumns.push(visibleColumns);
};
useRowNavigationIndicators.pluginName = 'useRowNavigationIndicators';
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import { enrichEventWithDetails } from '@ui5/webcomponents-react-base/internal/utils';
import { useEffect, useRef } from 'react';
import { ensurePluginOrder } from 'react-table';
import { AnalyticalTableSelectionMode } from '../../../enums/AnalyticalTableSelectionMode.js';
import type { AnalyticalTablePropTypes, ReactTableHooks, TableInstance } from '../types/index.js';

type OnRowSelectEvent = Parameters<NonNullable<AnalyticalTablePropTypes['onRowSelect']>>[0];
type OnRowSelectDetail = OnRowSelectEvent['detail'];

const useInstance = (instance: TableInstance) => {
const { webComponentsReactProperties, rowsById, preFilteredRowsById, state } = instance;
const { webComponentsReactProperties, rowsById, preFilteredRowsById, state, plugins } = instance;
const { selectedRowIds, filters, globalFilter } = state;
const { onRowSelect, selectionMode } = webComponentsReactProperties;

ensurePluginOrder(plugins, ['useRowSelect'], 'useSelectionChangeCallback');

const prevSelectedRowIdsRef = useRef(selectedRowIds);

useEffect(() => {
Expand Down
Loading