@economic/taco 2.2.2 → 2.2.4

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.
Files changed (52) hide show
  1. package/dist/components/Table3/Table3.d.ts +1 -1
  2. package/dist/components/Table3/components/columns/internal/Actions.d.ts +1 -2
  3. package/dist/components/Table3/components/rows/Row.d.ts +1 -0
  4. package/dist/components/Table3/hooks/features/useRowActions.d.ts +5 -0
  5. package/dist/components/Table3/hooks/useTable.d.ts +2 -0
  6. package/dist/components/Table3/hooks/useTableDataLoader.d.ts +1 -2
  7. package/dist/components/Table3/types.d.ts +0 -2
  8. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js +1 -1
  9. package/dist/esm/packages/taco/src/components/Header/components/MenuButton.js.map +1 -1
  10. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js +3 -1
  11. package/dist/esm/packages/taco/src/components/SearchInput2/SearchInput2.js.map +1 -1
  12. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js +2 -2
  14. package/dist/esm/packages/taco/src/components/Table3/components/columns/cell/DisplayCell.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js +5 -0
  16. package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Header.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js +24 -18
  18. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Actions.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js +2 -2
  20. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Drag.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js +2 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Expansion.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js +2 -2
  24. package/dist/esm/packages/taco/src/components/Table3/components/columns/internal/Selection.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js +11 -2
  26. package/dist/esm/packages/taco/src/components/Table3/components/rows/Row.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js +32 -20
  28. package/dist/esm/packages/taco/src/components/Table3/components/toolbar/Search.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowActions.js +10 -0
  30. package/dist/esm/packages/taco/src/components/Table3/hooks/features/useRowActions.js.map +1 -0
  31. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js +1 -1
  32. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSettingsStateListener.js.map +1 -1
  33. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js +1 -1
  34. package/dist/esm/packages/taco/src/components/Table3/hooks/useConvertChildrenToColumns.js.map +1 -1
  35. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +2 -3
  36. package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
  37. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js +10 -9
  38. package/dist/esm/packages/taco/src/components/Table3/hooks/useTable.js.map +1 -1
  39. package/dist/esm/packages/taco/src/components/Table3/hooks/useTableDataLoader.js +0 -8
  40. package/dist/esm/packages/taco/src/components/Table3/hooks/useTableDataLoader.js.map +1 -1
  41. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js +4 -0
  42. package/dist/esm/packages/taco/src/components/Table3/strategies/virtualised.js.map +1 -1
  43. package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
  44. package/dist/taco.cjs.development.js +108 -115
  45. package/dist/taco.cjs.development.js.map +1 -1
  46. package/dist/taco.cjs.production.min.js +1 -1
  47. package/dist/taco.cjs.production.min.js.map +1 -1
  48. package/package.json +2 -2
  49. package/types.json +5430 -5460
  50. package/dist/components/Table3/hooks/listeners/useSearchStateListener.d.ts +0 -3
  51. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSearchStateListener.js +0 -51
  52. package/dist/esm/packages/taco/src/components/Table3/hooks/listeners/useSearchStateListener.js.map +0 -1
@@ -8829,7 +8829,9 @@ const SearchInput2 = /*#__PURE__*/React__default.forwardRef(function SearchInput
8829
8829
  const handleBlur = event => {
8830
8830
  var _settingsRef$current, _attributes$onBlur;
8831
8831
  // trigger searches when leaving the field
8832
- handleSubmit();
8832
+ if (!isSynced) {
8833
+ handleSubmit();
8834
+ }
8833
8835
  if (settingsRef.current && (settingsRef.current === event.relatedTarget || (_settingsRef$current = settingsRef.current) !== null && _settingsRef$current !== void 0 && _settingsRef$current.contains(event.relatedTarget))) {
8834
8836
  return;
8835
8837
  }
@@ -15977,6 +15979,10 @@ const MemoedHeader = /*#__PURE__*/React__default.memo(function MemoedHeader(prop
15977
15979
  const [internalRef, setInternalRef] = React__default.useState(null);
15978
15980
  React__default.useLayoutEffect(() => {
15979
15981
  if (internalRef && length) {
15982
+ // the actions column size gets set by the column itself
15983
+ if (id === COLUMN_ID) {
15984
+ return;
15985
+ }
15980
15986
  table.setColumnSizing(sizes => ({
15981
15987
  ...sizes,
15982
15988
  [id]: internalRef.getBoundingClientRect().width
@@ -16070,7 +16076,7 @@ function DisplayCell(props) {
16070
16076
  return isCellHighlighted(tableMeta.search.query, value, memoedProps.children);
16071
16077
  }
16072
16078
  return false;
16073
- }, [memoedProps.children, tableMeta.search.isHighlightingEnabled, tableMeta.search.query]);
16079
+ }, [memoedProps.children, tableMeta.search.isHighlightingEnabled, tableMeta.search.excludeUnmatchedResults, tableMeta.search.query]);
16074
16080
  const memoedHighlightCurrent = React__default.useMemo(() => {
16075
16081
  if (!tableMeta.search.isHighlightingEnabled || !memoedHighlight || tableMeta.search.currentHighlightColumnIndex === undefined) {
16076
16082
  return false;
@@ -16102,7 +16108,7 @@ const MemoedDisplayCell = /*#__PURE__*/React__default.memo(function MemoedDispla
16102
16108
  } = props;
16103
16109
  const layoutClassName = cn('py-[var(--table3-row-padding)]', customClassName);
16104
16110
  const className = highlighted ? undefined : layoutClassName;
16105
- const content = enableTruncate || typeof children === 'string' ? /*#__PURE__*/React__default.createElement("span", {
16111
+ const content = enableTruncate ? /*#__PURE__*/React__default.createElement("span", {
16106
16112
  className: "truncate"
16107
16113
  }, children) : children;
16108
16114
  if (debug) {
@@ -16193,7 +16199,6 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
16193
16199
  });
16194
16200
 
16195
16201
  const COLUMN_ID = '__actions';
16196
- const ACTIONS_ON_ROW_LENGTH$1 = 4;
16197
16202
  const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16198
16203
  const {
16199
16204
  actions,
@@ -16202,7 +16207,8 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16202
16207
  isEditing,
16203
16208
  isResizingColumn,
16204
16209
  isHoverStatePaused,
16205
- row
16210
+ row,
16211
+ table
16206
16212
  } = props;
16207
16213
  const {
16208
16214
  isHovered
@@ -16210,15 +16216,29 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16210
16216
  const {
16211
16217
  texts
16212
16218
  } = useLocalization();
16219
+ const ref = React__default.useRef(null);
16220
+ const size = table.getState().columnSizing[COLUMN_ID];
16221
+ // the actions column needs to set its size based on its content, not the actual column
16222
+ // so we do this here instead of in the header
16223
+ React__default.useLayoutEffect(() => {
16224
+ if (ref.current && !size) {
16225
+ const width = ref.current.getBoundingClientRect().width;
16226
+ table.setColumnSizing(sizes => ({
16227
+ ...sizes,
16228
+ [COLUMN_ID]: width
16229
+ }));
16230
+ }
16231
+ }, [ref.current]);
16213
16232
  let content;
16214
16233
  // We don't want to show actions in edit mode, since we have editing actions,
16215
16234
  // which is shown in edit mode instead.
16216
- if (!isEditing && (isCurrentRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
16235
+ if (actions !== null && actions !== void 0 && actions.length && !isEditing && (isCurrentRow || isHovered && !isHoverStatePaused && !isResizingColumn)) {
16217
16236
  const visibleActions = actions.map(action => action(row.original)).filter(action => !!action);
16218
16237
  const actionsOnRow = visibleActions.length === actionsLength ? visibleActions : visibleActions.slice(0, actionsLength - 1);
16219
16238
  const actionsInMenu = visibleActions.slice(visibleActions.length === actionsLength ? actionsLength : actionsLength - 1);
16220
16239
  content = /*#__PURE__*/React__default.createElement("span", {
16221
- className: "-mb-2 -mt-2 flex justify-end text-right"
16240
+ className: "-mb-2 -mt-2 flex justify-end pl-2 text-right",
16241
+ ref: ref
16222
16242
  }, actionsOnRow.map((button, index) => {
16223
16243
  var _ref, _button$props$tooltip;
16224
16244
  const tooltip = String((_ref = (_button$props$tooltip = button.props.tooltip) !== null && _button$props$tooltip !== void 0 ? _button$props$tooltip : button.props['aria-label']) !== null && _ref !== void 0 ? _ref : '');
@@ -16245,37 +16265,29 @@ const MemoedCell = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
16245
16265
  }
16246
16266
  return /*#__PURE__*/React__default.createElement(DisplayCell, Object.assign({}, props), content);
16247
16267
  });
16248
- function Cell$1(props) {
16249
- const {
16250
- actionsForRow,
16251
- actionsForRowLength,
16252
- ...context
16253
- } = props;
16268
+ function Cell$1(context) {
16254
16269
  const {
16255
16270
  rowIndex
16256
16271
  } = React__default.useContext(RowContext$1);
16257
16272
  const tableMeta = context.table.options.meta;
16258
16273
  return /*#__PURE__*/React__default.createElement(MemoedCell, Object.assign({}, context, {
16259
- actions: actionsForRow,
16260
- actionsLength: actionsForRowLength,
16274
+ actions: tableMeta.rowActions.actionsForRow,
16275
+ actionsLength: tableMeta.rowActions.actionsForRowLength,
16261
16276
  isCurrentRow: tableMeta.currentRow.currentRowIndex === rowIndex,
16262
16277
  isEditing: tableMeta.editing.isEditing,
16263
16278
  isResizingColumn: !!context.table.getState().columnSizingInfo.isResizingColumn,
16264
16279
  isHoverStatePaused: !!tableMeta.hoverState.isPaused
16265
16280
  }));
16266
16281
  }
16267
- function createRowActionsColumn$1(actionsForRow, actionsForRowLength = ACTIONS_ON_ROW_LENGTH$1) {
16282
+ function createRowActionsColumn$1() {
16268
16283
  return {
16269
16284
  id: COLUMN_ID,
16270
16285
  header: Header$2,
16271
- cell: context => /*#__PURE__*/React__default.createElement(Cell$1, Object.assign({}, context, {
16272
- actionsForRow: actionsForRow,
16273
- actionsForRowLength: actionsForRowLength
16274
- })),
16286
+ cell: Cell$1,
16275
16287
  footer: Footer$4,
16276
16288
  meta: {
16277
16289
  align: 'right',
16278
- className: cn('items-center print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-0 !pr-1', '[[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:shadow-[-6px_0px_6px] [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:shadow-[-6px_0px_6px]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
16290
+ className: cn('!pt-[var(--table3-row-padding)] print:opacity-0 [[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:sticky [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:sticky right-0 !pl-1 !pr-1', '[[role="table"][data-editing="false"]_&]:group-[[data-current="true"]]/row:shadow-[-6px_0px_6px] [[role="table"][data-pause-hover="false"][data-editing="false"]_&]:group-hover/row:shadow-[-6px_0px_6px]', 'group-[[data-current="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-selected="true"]]/row:text-blue-100', 'group-[[data-selected="false"]:hover]/row:text-grey-100'),
16279
16291
  enableOrdering: false,
16280
16292
  enableSearch: false,
16281
16293
  enableTruncate: false,
@@ -16287,6 +16299,7 @@ function createRowActionsColumn$1(actionsForRow, actionsForRowLength = ACTIONS_O
16287
16299
  };
16288
16300
  }
16289
16301
 
16302
+ const REACT_TABLE_DEFAULT_COLUMN_SIZE_DO_NOT_CHANGE = 150;
16290
16303
  const useCssGrid = table => {
16291
16304
  const allVisibleColumns = table.getVisibleLeafColumns();
16292
16305
  const columnSizing = table.getState().columnSizing;
@@ -16300,9 +16313,7 @@ const useCssGrid = table => {
16300
16313
  const width = columnSizing[column.id];
16301
16314
  if (isInternalColumn$1(column.id)) {
16302
16315
  if (column.id === COLUMN_ID) {
16303
- // it's important to set a min width so that when the the column width is maintained
16304
- // when the current row is scrolled out of the virtualisation view
16305
- size = `minmax(${column.getSize()}px, auto)`;
16316
+ size = column.getSize() !== REACT_TABLE_DEFAULT_COLUMN_SIZE_DO_NOT_CHANGE ? `minmax(${column.getSize()}px, 1fr)` : '1fr';
16306
16317
  } else {
16307
16318
  size = `${column.getSize()}px`;
16308
16319
  }
@@ -16580,7 +16591,7 @@ function useSettingsStateListener$1(table, onChangeSettings) {
16580
16591
  }), 250);
16581
16592
  }
16582
16593
  return () => clearTimeout(handler);
16583
- }, [onChangeSettings, meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnPinning, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.printWarningDialogVisibility, state.sorting]);
16594
+ }, [meta.columnFreezing.frozenColumnIndex, state.columnOrder, state.columnPinning, state.columnSizing, state.columnVisibility, meta.search.excludeUnmatchedResults, meta.fontSize.size, meta.rowHeight.height, meta.printing.printWarningDialogVisibility, state.sorting]);
16584
16595
  }
16585
16596
 
16586
16597
  var Table3FilterComparator;
@@ -16861,51 +16872,6 @@ function useRowClick(onRowClick) {
16861
16872
  };
16862
16873
  }
16863
16874
 
16864
- // we use a listener, and not the internal "controlled" change handlers because we don't actually want consumers
16865
- // to control the state outside the table. this listener is really here to let the consumer make a server request
16866
- // and provide the server with the search state, so that it can search server side
16867
- function useSearchStateListener(table, onSearch) {
16868
- const tableMeta = table.options.meta;
16869
- const rows = table.getRowModel().rows;
16870
- const loadingRef = React__default.useRef(false);
16871
- const lastUsedExcludeRef = React__default.useRef(tableMeta.search.excludeUnmatchedResults);
16872
- const handleSearch = function (query, excludeUnmatchedResults) {
16873
- try {
16874
- const _temp4 = function () {
16875
- if (tableMeta.search.isEnabled && !loadingRef.current) {
16876
- function _temp3() {
16877
- if (excludeUnmatchedResults && table.options.enableRowSelection) {
16878
- table.resetRowSelection();
16879
- }
16880
- }
16881
- const _temp2 = function () {
16882
- if (typeof onSearch === 'function' && (excludeUnmatchedResults || lastUsedExcludeRef.current)) {
16883
- const _temp = _finallyRethrows(function () {
16884
- loadingRef.current = true;
16885
- // if we are transitioning from true to false on exclude, then we need to "reset" by searching with no value
16886
- return Promise.resolve(onSearch(!excludeUnmatchedResults && lastUsedExcludeRef.current ? undefined : query)).then(function () {});
16887
- }, function (_wasThrown, _result) {
16888
- loadingRef.current = false;
16889
- lastUsedExcludeRef.current = excludeUnmatchedResults;
16890
- if (_wasThrown) throw _result;
16891
- return _result;
16892
- });
16893
- if (_temp && _temp.then) return _temp.then(function () {});
16894
- }
16895
- }();
16896
- return _temp2 && _temp2.then ? _temp2.then(_temp3) : _temp3(_temp2);
16897
- }
16898
- }();
16899
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function () {}) : void 0);
16900
- } catch (e) {
16901
- return Promise.reject(e);
16902
- }
16903
- };
16904
- useLazyEffect(() => {
16905
- handleSearch(tableMeta.search.query, tableMeta.search.excludeUnmatchedResults);
16906
- }, [tableMeta.search.isEnabled, tableMeta.search.query, tableMeta.search.excludeUnmatchedResults, rows.length]);
16907
- }
16908
-
16909
16875
  var SavingStateValue;
16910
16876
  (function (SavingStateValue) {
16911
16877
  SavingStateValue["Saving"] = "saving";
@@ -17724,7 +17690,7 @@ const Cell$4 = /*#__PURE__*/React__default.memo(function MemoedCell(context) {
17724
17690
  }) : null));
17725
17691
  }
17726
17692
  }, function arePropsEqual(oldProps, newProps) {
17727
- const oldTableMeta = newProps.table.options.meta;
17693
+ const oldTableMeta = oldProps.table.options.meta;
17728
17694
  const newTableMeta = newProps.table.options.meta;
17729
17695
  // we memo because we don't want the row re-rendering and removing focus from the checkbox
17730
17696
  // we can't default to the standard comparison because we need currentRow off the table meta
@@ -17739,7 +17705,7 @@ function createRowSelectionColumn$1(onRowDrag) {
17739
17705
  footer: Footer$4,
17740
17706
  meta: {
17741
17707
  align: 'center',
17742
- className: 'items-center !justify-end !p-0 !pr-0.5',
17708
+ className: '!pt-[var(--table3-row-padding)] !justify-end !p-0 !pr-0.5',
17743
17709
  enableOrdering: false,
17744
17710
  enableSearch: false,
17745
17711
  enableTruncate: false,
@@ -17798,6 +17764,7 @@ const MemoedCell$2 = /*#__PURE__*/React__default.memo(function MemoedCell(props)
17798
17764
  title: title
17799
17765
  }, /*#__PURE__*/React__default.createElement(IconButton, {
17800
17766
  appearance: "discrete",
17767
+ className: "-mt-1.5",
17801
17768
  icon: isExpanded ? 'chevron-down' : 'chevron-right',
17802
17769
  onClick: handleClick,
17803
17770
  tabIndex: tabIndex,
@@ -17831,7 +17798,7 @@ function createRowExpansionColumn$1(expandedRowRenderer) {
17831
17798
  footer: Footer$4,
17832
17799
  meta: {
17833
17800
  align: 'center',
17834
- className: 'items-center !p-0',
17801
+ className: '!p-0 !pt-[var(--table3-row-padding)]',
17835
17802
  enableOrdering: false,
17836
17803
  enableSearch: false,
17837
17804
  enableTruncate: false,
@@ -17893,7 +17860,7 @@ const Cell$6 = /*#__PURE__*/React__default.memo(function MemoedCell(props) {
17893
17860
  }, /*#__PURE__*/React__default.createElement(Icon, {
17894
17861
  "aria-label": texts.table3.columns.drag.tooltip,
17895
17862
  name: "drag",
17896
- className: "text-grey-darkest invisible w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white"
17863
+ className: "text-grey-darkest invisible -mt-1 w-[20px] cursor-grab active:cursor-grabbing group-hover/row:visible group-[[aria-grabbed='true']]/row:text-white"
17897
17864
  })));
17898
17865
  });
17899
17866
  function createRowDragColumn(onRowDrag) {
@@ -17907,7 +17874,7 @@ function createRowDragColumn(onRowDrag) {
17907
17874
  footer: Footer$4,
17908
17875
  meta: {
17909
17876
  align: 'center',
17910
- className: 'items-center !p-0',
17877
+ className: '!p-0 !pt-[var(--table3-row-padding)]',
17911
17878
  enableOrdering: false,
17912
17879
  enableSearch: false,
17913
17880
  enableTruncate: false,
@@ -18010,7 +17977,7 @@ function useConvertChildrenToColumns(props, options, editing) {
18010
17977
  columns.unshift(columnHelper.display(createRowDragColumn(props.onRowDrag)));
18011
17978
  }
18012
17979
  if ((_props$actionsForRow = props.actionsForRow) !== null && _props$actionsForRow !== void 0 && _props$actionsForRow.length) {
18013
- columns.push(columnHelper.display(createRowActionsColumn$1(props.actionsForRow, props.actionsForRowLength)));
17980
+ columns.push(columnHelper.display(createRowActionsColumn$1()));
18014
17981
  }
18015
17982
  if (editing.isEnabled && editing.isEditing) {
18016
17983
  columns.push(columnHelper.display(createRowEditingActionsColumn()));
@@ -18139,6 +18106,14 @@ function useSearch(isEnabled, excludeUnmatchedResultsInSearch = false, loadAll)
18139
18106
  };
18140
18107
  }
18141
18108
 
18109
+ const ACTIONS_ON_ROW_LENGTH$1 = 4;
18110
+ function useRowActions$1(actionsForRow, actionsForRowLength = ACTIONS_ON_ROW_LENGTH$1) {
18111
+ return {
18112
+ actionsForRow,
18113
+ actionsForRowLength
18114
+ };
18115
+ }
18116
+
18142
18117
  function useTable$2(props) {
18143
18118
  var _ref, _props$defaultSetting, _props$defaultSetting2, _props$defaultSetting3, _props$defaultSetting4, _props$defaultSetting5, _props$defaultSetting6, _props$defaultSetting7, _props$defaultSetting8, _props$defaultSetting9, _props$length;
18144
18119
  // options
@@ -18171,13 +18146,13 @@ function useTable$2(props) {
18171
18146
  }
18172
18147
  // search
18173
18148
  if (tableOptions.enableGlobalFilter) {
18174
- if (props.onSearch) {
18175
- tableOptions.manualFiltering = true;
18176
- // onSearch is called as a listener to let the consumer update their data, so we don't use onColumnFiltersChange
18177
- } else {
18178
- tableOptions.globalFilterFn = (row, columnId, searchQuery) => globalFilterFn$1(row.getValue(columnId), searchQuery);
18179
- tableOptions.getFilteredRowModel = reactTable$1.getFilteredRowModel();
18180
- }
18149
+ tableOptions.globalFilterFn = (row, columnId, searchQuery) => {
18150
+ if (row.original) {
18151
+ return globalFilterFn$1(row.getValue(columnId), searchQuery);
18152
+ }
18153
+ return false;
18154
+ };
18155
+ tableOptions.getFilteredRowModel = reactTable$1.getFilteredRowModel();
18181
18156
  }
18182
18157
  // sorting
18183
18158
  if (options.enableSorting) {
@@ -18197,6 +18172,7 @@ function useTable$2(props) {
18197
18172
  const fontSize = useFontSize(options.enableFontSize, (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.fontSize);
18198
18173
  const hoverState = usePauseHoverState();
18199
18174
  const printing = usePrinting(options.enablePrinting, props.loadAll, (_props$defaultSetting5 = props.defaultSettings) === null || _props$defaultSetting5 === void 0 ? void 0 : _props$defaultSetting5.showWarningWhenPrintingLargeDataset);
18175
+ const rowActions = useRowActions$1(props.actionsForRow, props.actionsForRowLength);
18200
18176
  const rowClick = useRowClick(props.onRowClick);
18201
18177
  const rowDrag = useRowDrag(options.enableRowDrag);
18202
18178
  const rowDrop = useRowDrop(options.enableRowDrop, props.onRowDrop);
@@ -18239,6 +18215,7 @@ function useTable$2(props) {
18239
18215
  hoverState,
18240
18216
  isUsingServer: !!props.loadPage,
18241
18217
  printing,
18218
+ rowActions: rowActions,
18242
18219
  rowClick: rowClick,
18243
18220
  rowDrag,
18244
18221
  rowDrop,
@@ -18253,7 +18230,6 @@ function useTable$2(props) {
18253
18230
  useEditingStateListener(table);
18254
18231
  useFilteringStateListener(table, props.onFilter);
18255
18232
  useRowSelectionListener$1(table, props.onRowSelect);
18256
- useSearchStateListener(table, props.onSearch);
18257
18233
  useSettingsStateListener$1(table, props.onChangeSettings);
18258
18234
  useShortcutsListener(table, props.shortcuts);
18259
18235
  useServerLoadingListener(table, props.loadPage);
@@ -18440,6 +18416,7 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
18440
18416
  const {
18441
18417
  index,
18442
18418
  isLastRow: _1,
18419
+ measureRef,
18443
18420
  onClick,
18444
18421
  onClickCapture,
18445
18422
  onDrop,
@@ -18453,6 +18430,14 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
18453
18430
  const {
18454
18431
  setIsHovered
18455
18432
  } = useRowContext$1();
18433
+ // we measure the first cell (since the row has display: contents) so that the virtualiser height is correct
18434
+ React__default.useEffect(() => {
18435
+ var _ref$current;
18436
+ const firstCell = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.querySelector('[role=cell]:first-child');
18437
+ if (firstCell) {
18438
+ measureRef(firstCell);
18439
+ }
18440
+ }, [ref.current]);
18456
18441
  // we use capture because it also picks up clicks on e.g. select checkboxes
18457
18442
  const handleClickCapture = event => {
18458
18443
  if (typeof onClickCapture === 'function') {
@@ -18463,9 +18448,9 @@ const MemoedRow = /*#__PURE__*/React__default.memo(function MemoedRow(props) {
18463
18448
  };
18464
18449
  const handleClick = event => {
18465
18450
  if (typeof onClick === 'function') {
18466
- var _ref$current;
18451
+ var _ref$current2;
18467
18452
  const clickedElement = event.target;
18468
- if (!((_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.contains(event.target)) || clickableElements.includes(clickedElement.tagName.toLowerCase()) || clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))) {
18453
+ if (!((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.contains(event.target)) || clickableElements.includes(clickedElement.tagName.toLowerCase()) || clickedElement.closest(clickableElements.map(tag => `[role=row] ${tag}`).join(','))) {
18469
18454
  return;
18470
18455
  }
18471
18456
  onClick(row.original);
@@ -18579,6 +18564,9 @@ function SkeletonRow(props) {
18579
18564
  }, otherProps))));
18580
18565
  }
18581
18566
 
18567
+ // Note - latest react-virtual requires an inner container, and that doesn't work with css grid,
18568
+ // so if you update react-virtual, you would need to refactor the entire table away from css grid,
18569
+ // and that would break a number of layout things - auto sizing, resizing etc
18582
18570
  function createBodyRenderer(props, rows, table, tableRef, virtualiser, setExpandedRowSizes) {
18583
18571
  return () => {
18584
18572
  if (rows.length) {
@@ -18618,6 +18606,7 @@ function createBodyRenderer(props, rows, table, tableRef, virtualiser, setExpand
18618
18606
  }, /*#__PURE__*/React__default.createElement(Row$2, {
18619
18607
  index: virtualRow.index,
18620
18608
  isLastRow: virtualRow.index === rows.length - 1,
18609
+ measureRef: virtualRow.measureRef,
18621
18610
  row: row,
18622
18611
  table: table,
18623
18612
  tableRef: tableRef
@@ -18726,30 +18715,39 @@ function Search$3(props) {
18726
18715
  if (firstRowIndex) {
18727
18716
  scrollTo(firstRowIndex);
18728
18717
  }
18729
- }, [table.getRowModel().rows.length, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility)]);
18730
- const handleSearch = query => {
18731
- const value = String(query !== null && query !== void 0 ? query : '');
18732
- tableMeta.search.setQuery(value);
18733
- if (tableMeta.search.excludeUnmatchedResults) {
18734
- if (value !== null && value !== void 0 && value.length) {
18735
- table.setGlobalFilter(value);
18736
- } else {
18737
- table.resetGlobalFilter();
18718
+ }, [tableMeta.search.query, tableMeta.search.excludeUnmatchedResults, table.getRowModel().rows.length, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility)]);
18719
+ const handleSearch = function (query) {
18720
+ try {
18721
+ function _temp2() {
18722
+ if (tableMeta.search.excludeUnmatchedResults) {
18723
+ if (value !== null && value !== void 0 && value.length) {
18724
+ table.setGlobalFilter(value);
18725
+ } else {
18726
+ table.resetGlobalFilter();
18727
+ }
18728
+ }
18729
+ tableMeta.search.setQuery(value);
18738
18730
  }
18739
- } else if (tableMeta.search.loadAll) {
18740
- // don't pass the search query because filters when loading all, we need all - not filtered data
18741
- tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined);
18742
- }
18743
- const firstRowIndex = resetHighlightedColumnIndexes(tableMeta.search.isHighlightingEnabled, value, table);
18744
- if (firstRowIndex) {
18745
- scrollTo(firstRowIndex);
18731
+ const value = String(query !== null && query !== void 0 ? query : '');
18732
+ // load all data if that is possible
18733
+ const _temp = function () {
18734
+ if (tableMeta.search.loadAll) {
18735
+ // don't pass the search query because we need all data - not filtered data
18736
+ return Promise.resolve(tableMeta.search.loadAll(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
18737
+ }
18738
+ }();
18739
+ return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
18740
+ } catch (e) {
18741
+ return Promise.reject(e);
18746
18742
  }
18747
18743
  };
18748
18744
  const handleToggleExcludeUnmatchedResults = enabled => {
18749
18745
  tableMeta.search.toggleExcludeUnmatchedResults(enabled);
18750
18746
  if (enabled) {
18751
- if (tableMeta.search.query) {
18752
- table.setGlobalFilter(tableMeta.search.query);
18747
+ var _ref$current2;
18748
+ if ((_ref$current2 = ref.current) !== null && _ref$current2 !== void 0 && _ref$current2.value) {
18749
+ var _ref$current3;
18750
+ table.setGlobalFilter((_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.value);
18753
18751
  } else {
18754
18752
  table.resetGlobalFilter();
18755
18753
  }
@@ -18757,8 +18755,8 @@ function Search$3(props) {
18757
18755
  table.resetGlobalFilter();
18758
18756
  }
18759
18757
  requestAnimationFrame(() => {
18760
- var _ref$current2;
18761
- return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.focus();
18758
+ var _ref$current4;
18759
+ return (_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.focus();
18762
18760
  });
18763
18761
  };
18764
18762
  const handleNextResult = () => {
@@ -18836,6 +18834,9 @@ function resetHighlightedColumnIndexes(enabled, value, table) {
18836
18834
  tableMeta.search.setHighlightedColumnIndexes([]);
18837
18835
  tableMeta.search.setCurrentHighlightColumnIndex(undefined);
18838
18836
  }
18837
+ if (firstRowIndex !== undefined) {
18838
+ tableMeta.currentRow.setCurrentRowIndex(firstRowIndex);
18839
+ }
18839
18840
  return firstRowIndex;
18840
18841
  }
18841
18842
 
@@ -20078,20 +20079,12 @@ function useTable3DataLoader(fetch, fetchAll, options = {
20078
20079
  return Promise.reject(e);
20079
20080
  }
20080
20081
  };
20081
- const handleSearch = function (query) {
20082
- try {
20083
- return loadAll(_lastUsedSorting.current, _lastUsedFilters.current, query);
20084
- } catch (e) {
20085
- return Promise.reject(e);
20086
- }
20087
- };
20088
20082
  return [{
20089
20083
  data,
20090
20084
  length: length.current,
20091
20085
  loadAll,
20092
20086
  loadPage,
20093
20087
  onFilter: handleFilter,
20094
- onSearch: handleSearch,
20095
20088
  onSort: handleSort,
20096
20089
  pageSize
20097
20090
  }, invalidate];
@@ -20643,7 +20636,7 @@ const SecondaryNavigation = /*#__PURE__*/React__default.forwardRef(function Seco
20643
20636
  });
20644
20637
 
20645
20638
  const MenuButton = /*#__PURE__*/React__default.forwardRef(function MenuButton(props, ref) {
20646
- const className = cn(getButtonClasses$1(false), 'mr-1 !bg-transparent hover:!bg-white/[.08] focus:!bg-white/[.08]] lg:hidden z-[2]');
20639
+ const className = cn(getButtonClasses$1(false), 'mr-1 !bg-transparent hover:!bg-white/[.08] focus:!bg-white/[.08]] lg:hidden z-[2] !text-white');
20647
20640
  return /*#__PURE__*/React__default.createElement(IconButton, Object.assign({}, props, {
20648
20641
  className: className,
20649
20642
  "data-taco": "header-toggle-sidebar",