material-react-table 0.40.2 → 0.40.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.
@@ -4,7 +4,7 @@ import { MRT_Localization } from '../localization';
4
4
  export declare const mrtFilterOptions: (localization: MRT_Localization) => MRT_InternalFilterOption[];
5
5
  interface Props<TData extends Record<string, any> = {}> {
6
6
  anchorEl: HTMLElement | null;
7
- header?: MRT_Header;
7
+ header?: MRT_Header<TData>;
8
8
  onSelect?: () => void;
9
9
  setAnchorEl: (anchorEl: HTMLElement | null) => void;
10
10
  table: MRT_TableInstance<TData>;
@@ -1,8 +1,8 @@
1
- import { FC } from 'react';
1
+ import { FC, MouseEvent } from 'react';
2
2
  import type { MRT_Row, MRT_TableInstance } from '..';
3
3
  interface Props {
4
4
  anchorEl: HTMLElement | null;
5
- handleEdit: () => void;
5
+ handleEdit: (event: MouseEvent) => void;
6
6
  row: MRT_Row;
7
7
  setAnchorEl: (anchorEl: HTMLElement | null) => void;
8
8
  table: MRT_TableInstance;
@@ -216,9 +216,16 @@ export declare type MRT_ColumnDef<TData extends Record<string, any> = {}> = Omit
216
216
  table: MRT_TableInstance<TData>;
217
217
  column: MRT_Column<TData>;
218
218
  }) => TableCellProps);
219
- renderColumnFilterModeMenuItems?: ({ table, column, }: {
219
+ renderColumnActionsMenuItems?: ({ closeMenu, column, table, }: {
220
+ closeMenu: () => void;
221
+ column: MRT_Column<TData>;
220
222
  table: MRT_TableInstance<TData>;
223
+ }) => ReactNode[];
224
+ renderColumnFilterModeMenuItems?: ({ column, internalFilterOptions, onSelectFilterMode, table, }: {
221
225
  column: MRT_Column<TData>;
226
+ internalFilterOptions: MRT_InternalFilterOption[];
227
+ onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
228
+ table: MRT_TableInstance<TData>;
222
229
  }) => ReactNode[];
223
230
  sortingFn?: MRT_SortingFn;
224
231
  };
@@ -470,12 +477,17 @@ export declare type MaterialReactTableProps<TData extends Record<string, any> =
470
477
  renderBottomToolbarCustomActions?: ({ table, }: {
471
478
  table: MRT_TableInstance<TData>;
472
479
  }) => ReactNode;
480
+ renderColumnActionsMenuItems?: ({ column, closeMenu, table, }: {
481
+ column: MRT_Column<TData>;
482
+ closeMenu: () => void;
483
+ table: MRT_TableInstance<TData>;
484
+ }) => ReactNode[];
473
485
  renderColumnFilterModeMenuItems?: ({ column, internalFilterOptions, onSelectFilterMode, table, }: {
474
486
  column: MRT_Column<TData>;
475
487
  internalFilterOptions: MRT_InternalFilterOption[];
476
488
  onSelectFilterMode: (filterMode: MRT_FilterOption) => void;
477
489
  table: MRT_TableInstance<TData>;
478
- }) => ReactNode;
490
+ }) => ReactNode[];
479
491
  renderDetailPanel?: ({ row, table, }: {
480
492
  row: MRT_Row<TData>;
481
493
  table: MRT_TableInstance<TData>;
@@ -274,12 +274,15 @@ const MRT_ExpandButton = ({ row, table }) => {
274
274
  const iconButtonProps = muiExpandButtonProps instanceof Function
275
275
  ? muiExpandButtonProps({ table, row })
276
276
  : muiExpandButtonProps;
277
- const handleToggleExpand = () => {
277
+ const handleToggleExpand = (event) => {
278
+ var _a;
279
+ event.stopPropagation();
278
280
  row.toggleExpanded();
281
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, event);
279
282
  };
280
283
  return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, title: localization.expand },
281
284
  React.createElement("span", null,
282
- React.createElement(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !row.getCanExpand() && !renderDetailPanel, onClick: handleToggleExpand }, iconButtonProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
285
+ React.createElement(IconButton, Object.assign({ "aria-label": localization.expand, disabled: !row.getCanExpand() && !renderDetailPanel }, iconButtonProps, { onClick: handleToggleExpand, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.25rem', width: density === 'compact' ? '1.75rem' : '2.25rem' }, ((iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx) instanceof Function
283
286
  ? iconButtonProps.sx(theme)
284
287
  : iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.sx))) }),
285
288
  React.createElement(ExpandMoreIcon, { style: {
@@ -379,7 +382,7 @@ const mrtFilterOptions = (localization) => [
379
382
  },
380
383
  ];
381
384
  const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table, }) => {
382
- var _a, _b;
385
+ var _a, _b, _c, _d;
383
386
  const { getState, options: { enabledGlobalFilterOptions, columnFilterModeOptions, localization, renderColumnFilterModeMenuItems, renderGlobalFilterModeMenuItems, }, setColumnFilterFns, setGlobalFilterFn, } = table;
384
387
  const { globalFilterFn, density } = getState();
385
388
  const { column } = header !== null && header !== void 0 ? header : {};
@@ -413,8 +416,13 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
413
416
  const filterOption = !!header && columnDef ? columnDef._filterFn : globalFilterFn;
414
417
  return (React.createElement(Menu, { anchorEl: anchorEl, anchorOrigin: { vertical: 'center', horizontal: 'right' }, onClose: () => setAnchorEl(null), open: !!anchorEl, MenuListProps: {
415
418
  dense: density === 'compact',
416
- } }, (_b = (header && column
417
- ? renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
419
+ } }, (_d = (header && column && columnDef
420
+ ? (_c = (_b = columnDef.renderColumnFilterModeMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
421
+ column: column,
422
+ internalFilterOptions,
423
+ onSelectFilterMode: handleSelectFilterMode,
424
+ table,
425
+ })) !== null && _c !== void 0 ? _c : renderColumnFilterModeMenuItems === null || renderColumnFilterModeMenuItems === void 0 ? void 0 : renderColumnFilterModeMenuItems({
418
426
  column: column,
419
427
  internalFilterOptions,
420
428
  onSelectFilterMode: handleSelectFilterMode,
@@ -424,7 +432,7 @@ const MRT_FilterOptionMenu = ({ anchorEl, header, onSelect, setAnchorEl, table,
424
432
  internalFilterOptions,
425
433
  onSelectFilterMode: handleSelectFilterMode,
426
434
  table,
427
- }))) !== null && _b !== void 0 ? _b : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (React.createElement(MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
435
+ }))) !== null && _d !== void 0 ? _d : internalFilterOptions.map(({ option, label, divider, symbol }, index) => (React.createElement(MenuItem, { divider: divider, key: index, onClick: () => handleSelectFilterMode(option), selected: option === filterOption, sx: {
428
436
  alignItems: 'center',
429
437
  display: 'flex',
430
438
  gap: '2ch',
@@ -458,7 +466,11 @@ const MRT_ColumnPinningButtons = ({ column, table, }) => {
458
466
  const MRT_GrabHandleButton = ({ iconButtonProps, onDragEnd, onDragStart, table, }) => {
459
467
  const { options: { icons: { DragHandleIcon }, localization, }, } = table;
460
468
  return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: localization.move },
461
- React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
469
+ React.createElement(IconButton, Object.assign({ disableRipple: true, draggable: "true", onDragStart: onDragStart, onDragEnd: onDragEnd, size: "small" }, iconButtonProps, { onClick: (e) => {
470
+ var _a;
471
+ e.stopPropagation();
472
+ (_a = iconButtonProps === null || iconButtonProps === void 0 ? void 0 : iconButtonProps.onClick) === null || _a === void 0 ? void 0 : _a.call(iconButtonProps, e);
473
+ }, sx: (theme) => (Object.assign({ cursor: 'grab', m: 0, opacity: 0.5, p: '2px', transition: 'all 0.2s ease-in-out', '&:hover': {
462
474
  backgroundColor: 'transparent',
463
475
  opacity: 1,
464
476
  }, '&:active': {
@@ -716,8 +728,8 @@ const commonListItemStyles = {
716
728
  alignItems: 'center',
717
729
  };
718
730
  const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
719
- var _a, _b, _c, _d, _e, _f, _g;
720
- const { getState, toggleAllColumnsVisible, setColumnOrder, options: { enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, columnFilterModeOptions, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, }, refs: { filterInputRefs }, setShowFilters, } = table;
731
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
732
+ const { getState, toggleAllColumnsVisible, setColumnOrder, options: { columnFilterModeOptions, enableColumnFilterModes, enableColumnFilters, enableColumnResizing, enableGrouping, enableHiding, enablePinning, enableSorting, icons: { ArrowRightIcon, ClearAllIcon, ViewColumnIcon, DynamicFeedIcon, FilterListIcon, FilterListOffIcon, PushPinIcon, SortIcon, RestartAltIcon, VisibilityOffIcon, }, localization, renderColumnActionsMenuItems, }, refs: { filterInputRefs }, setShowFilters, } = table;
721
733
  const { column } = header;
722
734
  const { columnDef } = column;
723
735
  const { columnSizing, columnVisibility, density } = getState();
@@ -782,25 +794,32 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
782
794
  !!(allowedColumnFilterOptions === null || allowedColumnFilterOptions === void 0 ? void 0 : allowedColumnFilterOptions.length));
783
795
  return (React.createElement(Menu, { anchorEl: anchorEl, open: !!anchorEl, onClose: () => setAnchorEl(null), MenuListProps: {
784
796
  dense: density === 'compact',
785
- } },
786
- enableSorting &&
787
- column.getCanSort() && [
788
- React.createElement(MenuItem, { disabled: !column.getIsSorted(), key: 0, onClick: handleClearSort, sx: commonMenuItemStyles },
789
- React.createElement(Box, { sx: commonListItemStyles },
790
- React.createElement(ListItemIcon, null,
791
- React.createElement(ClearAllIcon, null)),
792
- localization.clearSort)),
793
- React.createElement(MenuItem, { disabled: column.getIsSorted() === 'asc', key: 1, onClick: handleSortAsc, sx: commonMenuItemStyles },
794
- React.createElement(Box, { sx: commonListItemStyles },
795
- React.createElement(ListItemIcon, null,
796
- React.createElement(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } })), (_b = localization.sortByColumnAsc) === null || _b === void 0 ? void 0 :
797
- _b.replace('{column}', String(columnDef.header)))),
798
- React.createElement(MenuItem, { divider: enableColumnFilters || enableGrouping || enableHiding, key: 2, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles },
799
- React.createElement(Box, { sx: commonListItemStyles },
800
- React.createElement(ListItemIcon, null,
801
- React.createElement(SortIcon, null)), (_c = localization.sortByColumnDesc) === null || _c === void 0 ? void 0 :
802
- _c.replace('{column}', String(columnDef.header)))),
803
- ],
797
+ } }, (_d = (_c = (_b = columnDef.renderColumnActionsMenuItems) === null || _b === void 0 ? void 0 : _b.call(columnDef, {
798
+ closeMenu: () => setAnchorEl(null),
799
+ column,
800
+ table,
801
+ })) !== null && _c !== void 0 ? _c : renderColumnActionsMenuItems === null || renderColumnActionsMenuItems === void 0 ? void 0 : renderColumnActionsMenuItems({
802
+ closeMenu: () => setAnchorEl(null),
803
+ column,
804
+ table,
805
+ })) !== null && _d !== void 0 ? _d : (enableSorting &&
806
+ column.getCanSort() && [
807
+ React.createElement(MenuItem, { disabled: !column.getIsSorted(), key: 0, onClick: handleClearSort, sx: commonMenuItemStyles },
808
+ React.createElement(Box, { sx: commonListItemStyles },
809
+ React.createElement(ListItemIcon, null,
810
+ React.createElement(ClearAllIcon, null)),
811
+ localization.clearSort)),
812
+ React.createElement(MenuItem, { disabled: column.getIsSorted() === 'asc', key: 1, onClick: handleSortAsc, sx: commonMenuItemStyles },
813
+ React.createElement(Box, { sx: commonListItemStyles },
814
+ React.createElement(ListItemIcon, null,
815
+ React.createElement(SortIcon, { style: { transform: 'rotate(180deg) scaleX(-1)' } })), (_e = localization.sortByColumnAsc) === null || _e === void 0 ? void 0 :
816
+ _e.replace('{column}', String(columnDef.header)))),
817
+ React.createElement(MenuItem, { divider: enableColumnFilters || enableGrouping || enableHiding, key: 2, disabled: column.getIsSorted() === 'desc', onClick: handleSortDesc, sx: commonMenuItemStyles },
818
+ React.createElement(Box, { sx: commonListItemStyles },
819
+ React.createElement(ListItemIcon, null,
820
+ React.createElement(SortIcon, null)), (_f = localization.sortByColumnDesc) === null || _f === void 0 ? void 0 :
821
+ _f.replace('{column}', String(columnDef.header)))),
822
+ ]),
804
823
  enableColumnFilters &&
805
824
  column.getCanFilter() &&
806
825
  [
@@ -812,8 +831,8 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
812
831
  React.createElement(MenuItem, { divider: enableGrouping || enableHiding, key: 1, onClick: handleFilterByColumn, sx: commonMenuItemStyles },
813
832
  React.createElement(Box, { sx: commonListItemStyles },
814
833
  React.createElement(ListItemIcon, null,
815
- React.createElement(FilterListIcon, null)), (_d = localization.filterByColumn) === null || _d === void 0 ? void 0 :
816
- _d.replace('{column}', String(columnDef.header))),
834
+ React.createElement(FilterListIcon, null)), (_g = localization.filterByColumn) === null || _g === void 0 ? void 0 :
835
+ _g.replace('{column}', String(columnDef.header))),
817
836
  showFilterModeSubMenu && (React.createElement(IconButton, { onClick: handleOpenFilterModeMenu, onMouseEnter: handleOpenFilterModeMenu, size: "small", sx: { p: 0 } },
818
837
  React.createElement(ArrowRightIcon, null)))),
819
838
  showFilterModeSubMenu && (React.createElement(MRT_FilterOptionMenu, { anchorEl: filterMenuAnchorEl, header: header, key: 2, onSelect: handleFilterByColumn, setAnchorEl: setFilterMenuAnchorEl, table: table })),
@@ -823,8 +842,8 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
823
842
  React.createElement(MenuItem, { divider: enablePinning, key: 0, onClick: handleGroupByColumn, sx: commonMenuItemStyles },
824
843
  React.createElement(Box, { sx: commonListItemStyles },
825
844
  React.createElement(ListItemIcon, null,
826
- React.createElement(DynamicFeedIcon, null)), (_e = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _e === void 0 ? void 0 :
827
- _e.replace('{column}', String(columnDef.header)))),
845
+ React.createElement(DynamicFeedIcon, null)), (_h = localization[column.getIsGrouped() ? 'ungroupByColumn' : 'groupByColumn']) === null || _h === void 0 ? void 0 :
846
+ _h.replace('{column}', String(columnDef.header)))),
828
847
  ],
829
848
  enablePinning &&
830
849
  column.getCanPin() && [
@@ -856,14 +875,14 @@ const MRT_ColumnActionMenu = ({ anchorEl, header, setAnchorEl, table, }) => {
856
875
  React.createElement(MenuItem, { disabled: columnDef.enableHiding === false, key: 0, onClick: handleHideColumn, sx: commonMenuItemStyles },
857
876
  React.createElement(Box, { sx: commonListItemStyles },
858
877
  React.createElement(ListItemIcon, null,
859
- React.createElement(VisibilityOffIcon, null)), (_f = localization.hideColumn) === null || _f === void 0 ? void 0 :
860
- _f.replace('{column}', String(columnDef.header)))),
878
+ React.createElement(VisibilityOffIcon, null)), (_j = localization.hideColumn) === null || _j === void 0 ? void 0 :
879
+ _j.replace('{column}', String(columnDef.header)))),
861
880
  React.createElement(MenuItem, { disabled: !Object.values(columnVisibility).filter((visible) => !visible)
862
881
  .length, key: 1, onClick: handleShowAllColumns, sx: commonMenuItemStyles },
863
882
  React.createElement(Box, { sx: commonListItemStyles },
864
883
  React.createElement(ListItemIcon, null,
865
- React.createElement(ViewColumnIcon, null)), (_g = localization.showAllColumns) === null || _g === void 0 ? void 0 :
866
- _g.replace('{column}', String(columnDef.header))),
884
+ React.createElement(ViewColumnIcon, null)), (_k = localization.showAllColumns) === null || _k === void 0 ? void 0 :
885
+ _k.replace('{column}', String(columnDef.header))),
867
886
  React.createElement(IconButton, { onClick: handleOpenShowHideColumnsMenu, onMouseEnter: handleOpenShowHideColumnsMenu, size: "small", sx: { p: 0 } },
868
887
  React.createElement(ArrowRightIcon, null))),
869
888
  React.createElement(MRT_ShowHideColumnsMenu, { anchorEl: showHideColumnsMenuAnchorEl, isSubMenu: true, key: 2, setAnchorEl: setShowHideColumnsMenuAnchorEl, table: table }),
@@ -909,7 +928,7 @@ const MRT_EditActionButtons = ({ row, table, variant = 'icon', }) => {
909
928
  values: (_b = editingRow === null || editingRow === void 0 ? void 0 : editingRow._valuesCache) !== null && _b !== void 0 ? _b : Object.assign({}, row.original),
910
929
  });
911
930
  };
912
- return (React.createElement(Box, { sx: { display: 'flex', gap: '0.75rem' } }, variant === 'icon' ? (React.createElement(React.Fragment, null,
931
+ return (React.createElement(Box, { onClick: (e) => e.stopPropagation(), sx: { display: 'flex', gap: '0.75rem' } }, variant === 'icon' ? (React.createElement(React.Fragment, null,
913
932
  React.createElement(Tooltip, { arrow: true, title: localization.cancel },
914
933
  React.createElement(IconButton, { "aria-label": localization.cancel, onClick: handleCancel },
915
934
  React.createElement(CancelIcon, null))),
@@ -930,7 +949,7 @@ const commonIconButtonStyles = {
930
949
  opacity: 1,
931
950
  },
932
951
  };
933
- const MRT_ToggleRowActionMenuButton = ({ cell, row, table }) => {
952
+ const MRT_ToggleRowActionMenuButton = ({ cell, row, table, }) => {
934
953
  const { getState, options: { editingMode, enableEditing, icons: { EditIcon, MoreHorizIcon }, localization, renderRowActionMenuItems, renderRowActions, }, setEditingRow, } = table;
935
954
  const { editingRow } = getState();
936
955
  const [anchorEl, setAnchorEl] = useState(null);
@@ -939,7 +958,8 @@ const MRT_ToggleRowActionMenuButton = ({ cell, row, table }) => {
939
958
  event.preventDefault();
940
959
  setAnchorEl(event.currentTarget);
941
960
  };
942
- const handleStartEditMode = () => {
961
+ const handleStartEditMode = (event) => {
962
+ event.stopPropagation();
943
963
  setEditingRow(Object.assign({}, row));
944
964
  setAnchorEl(null);
945
965
  };
@@ -971,7 +991,11 @@ const MRT_SelectCheckbox = ({ row, selectAll, table }) => {
971
991
  ? selectAllMode === 'all'
972
992
  ? table.getToggleAllRowsSelectedHandler()
973
993
  : table.getToggleAllPageRowsSelectedHandler()
974
- : row.getToggleSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
994
+ : row.getToggleSelectedHandler(), size: density === 'compact' ? 'small' : 'medium' }, checkboxProps, { onClick: (e) => {
995
+ var _a;
996
+ e.stopPropagation();
997
+ (_a = checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.onClick) === null || _a === void 0 ? void 0 : _a.call(checkboxProps, e);
998
+ }, sx: (theme) => (Object.assign({ height: density === 'compact' ? '1.75rem' : '2.5rem', width: density === 'compact' ? '1.75rem' : '2.5rem', m: density !== 'compact' ? '-0.4rem' : undefined }, ((checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx) instanceof Function
975
999
  ? checkboxProps.sx(theme)
976
1000
  : checkboxProps === null || checkboxProps === void 0 ? void 0 : checkboxProps.sx))) }))));
977
1001
  };
@@ -1831,7 +1855,11 @@ const MRT_EditCellTextField = ({ cell, showLabel, table, }) => {
1831
1855
  textFieldProps.inputRef = inputRef;
1832
1856
  }
1833
1857
  }
1834
- }, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, onClick: (e) => e.stopPropagation(), placeholder: columnDef.header, value: value, variant: "standard" }, textFieldProps, { onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown })));
1858
+ }, label: showLabel ? column.columnDef.header : undefined, margin: "none", name: column.id, placeholder: columnDef.header, value: value, variant: "standard" }, textFieldProps, { onClick: (e) => {
1859
+ var _a;
1860
+ e.stopPropagation();
1861
+ (_a = textFieldProps === null || textFieldProps === void 0 ? void 0 : textFieldProps.onClick) === null || _a === void 0 ? void 0 : _a.call(textFieldProps, e);
1862
+ }, onBlur: handleBlur, onChange: handleChange, onKeyDown: handleEnterKeyDown })));
1835
1863
  };
1836
1864
 
1837
1865
  const MRT_CopyButton = ({ cell, children, table, }) => {
@@ -1839,7 +1867,8 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
1839
1867
  const { column, row } = cell;
1840
1868
  const { columnDef } = column;
1841
1869
  const [copied, setCopied] = useState(false);
1842
- const handleCopy = (text) => {
1870
+ const handleCopy = (event, text) => {
1871
+ event.stopPropagation();
1843
1872
  navigator.clipboard.writeText(text);
1844
1873
  setCopied(true);
1845
1874
  setTimeout(() => setCopied(false), 4000);
@@ -1855,7 +1884,7 @@ const MRT_CopyButton = ({ cell, children, table, }) => {
1855
1884
  : columnDef.muiTableBodyCellCopyButtonProps;
1856
1885
  const buttonProps = Object.assign(Object.assign({}, mTableBodyCellCopyButtonProps), mcTableBodyCellCopyButtonProps);
1857
1886
  return (React.createElement(Tooltip, { arrow: true, enterDelay: 1000, enterNextDelay: 1000, placement: "top", title: copied ? localization.copiedToClipboard : localization.clickToCopy },
1858
- React.createElement(Button, Object.assign({ onClick: () => handleCopy(cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
1887
+ React.createElement(Button, Object.assign({ onClick: (e) => handleCopy(e, cell.getValue()), size: "small", type: "button", variant: "text" }, buttonProps, { sx: (theme) => (Object.assign({ backgroundColor: 'transparent', border: 'none', color: 'inherit', cursor: 'copy', fontFamily: 'inherit', fontSize: 'inherit', letterSpacing: 'inherit', m: '-0.25rem', minWidth: 'unset', textAlign: 'inherit', textTransform: 'inherit' }, ((buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx) instanceof Function
1859
1888
  ? buttonProps.sx(theme)
1860
1889
  : buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.sx))) }), children)));
1861
1890
  };
@@ -2105,7 +2134,7 @@ const MRT_TableBodyRow = ({ row, rowIndex, table, virtualRow, }) => {
2105
2134
  };
2106
2135
 
2107
2136
  const MRT_TableBody = ({ table, tableContainerRef }) => {
2108
- const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, muiTableBodyProps, virtualizerProps, virtualizerInstanceRef, }, } = table;
2137
+ const { getRowModel, getPrePaginationRowModel, getState, options: { enableGlobalFilterRankedResults, enablePagination, enableRowVirtualization, manualFiltering, manualSorting, muiTableBodyProps, virtualizerInstanceRef, virtualizerProps, }, } = table;
2109
2138
  const { globalFilter, pagination, sorting } = getState();
2110
2139
  const tableBodyProps = muiTableBodyProps instanceof Function
2111
2140
  ? muiTableBodyProps({ table })
@@ -2116,6 +2145,8 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2116
2145
  const rows = useMemo(() => {
2117
2146
  if (enableGlobalFilterRankedResults &&
2118
2147
  globalFilter &&
2148
+ !manualFiltering &&
2149
+ !manualSorting &&
2119
2150
  !Object.values(sorting).some(Boolean)) {
2120
2151
  const rankedRows = getPrePaginationRowModel().rows.sort((a, b) => rankGlobalFuzzy(a, b));
2121
2152
  if (enablePagination) {
@@ -2136,11 +2167,9 @@ const MRT_TableBody = ({ table, tableContainerRef }) => {
2136
2167
  const virtualizer = enableRowVirtualization
2137
2168
  ? useVirtual(Object.assign({ size: rows.length, parentRef: tableContainerRef, overscan: 15 }, vProps))
2138
2169
  : {};
2139
- useEffect(() => {
2140
- if (virtualizerInstanceRef) {
2141
- virtualizerInstanceRef.current = virtualizer;
2142
- }
2143
- }, [virtualizer]);
2170
+ if (virtualizerInstanceRef) {
2171
+ virtualizerInstanceRef.current = virtualizer;
2172
+ }
2144
2173
  // const virtualizer: Virtualizer = enableRowVirtualization
2145
2174
  // ? useVirtualizer({
2146
2175
  // count: rows.length,
@@ -2447,11 +2476,9 @@ const MRT_TableRoot = (props) => {
2447
2476
  tableContainerRef,
2448
2477
  topToolbarRef,
2449
2478
  }, setColumnFilterFns: (_w = props.onFilterFnsChange) !== null && _w !== void 0 ? _w : setColumnFilterFns, setDensity: (_x = props.onDensityChange) !== null && _x !== void 0 ? _x : setDensity, setDraggingColumn: (_y = props.onDraggingColumnChange) !== null && _y !== void 0 ? _y : setDraggingColumn, setDraggingRow: (_z = props.onDraggingRowChange) !== null && _z !== void 0 ? _z : setDraggingRow, setEditingCell: (_0 = props.onEditingCellChange) !== null && _0 !== void 0 ? _0 : setEditingCell, setEditingRow: (_1 = props.onEditingRowChange) !== null && _1 !== void 0 ? _1 : setEditingRow, setGlobalFilterFn: (_2 = props.onGlobalFilterFnChange) !== null && _2 !== void 0 ? _2 : setGlobalFilterFn, setHoveredColumn: (_3 = props.onHoveredColumnChange) !== null && _3 !== void 0 ? _3 : setHoveredColumn, setHoveredRow: (_4 = props.onHoveredRowChange) !== null && _4 !== void 0 ? _4 : setHoveredRow, setIsFullScreen: (_5 = props.onIsFullScreenChange) !== null && _5 !== void 0 ? _5 : setIsFullScreen, setShowAlertBanner: (_6 = props.onShowAlertBannerChange) !== null && _6 !== void 0 ? _6 : setShowAlertBanner, setShowFilters: (_7 = props.onShowFiltersChange) !== null && _7 !== void 0 ? _7 : setShowFilters, setShowGlobalFilter: (_8 = props.onShowGlobalFilterChange) !== null && _8 !== void 0 ? _8 : setShowGlobalFilter });
2450
- useEffect(() => {
2451
- if (props.tableInstanceRef) {
2452
- props.tableInstanceRef.current = table;
2453
- }
2454
- }, [table]);
2479
+ if (props.tableInstanceRef) {
2480
+ props.tableInstanceRef.current = table;
2481
+ }
2455
2482
  return (React.createElement(React.Fragment, null,
2456
2483
  React.createElement(Dialog, { PaperComponent: Box, TransitionComponent: Grow, disablePortal: true, fullScreen: true, keepMounted: false, onClose: () => setIsFullScreen(false), open: isFullScreen, transitionDuration: 400 },
2457
2484
  React.createElement(MRT_TablePaper, { table: table })),