@economic/taco 2.27.0 → 2.27.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/dist/components/Select2/Select2.d.ts +4 -4
  2. package/dist/components/Select2/components/Trigger.d.ts +0 -1
  3. package/dist/components/Select2/utilities.d.ts +1 -2
  4. package/dist/esm/index.css +9 -3
  5. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -3
  6. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  7. package/dist/esm/packages/taco/src/components/Select2/Select2.js +5 -6
  8. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  9. package/dist/esm/packages/taco/src/components/Select2/components/Option.js +5 -6
  10. package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
  11. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +17 -17
  12. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  13. package/dist/esm/packages/taco/src/components/Select2/utilities.js +1 -2
  14. package/dist/esm/packages/taco/src/components/Select2/utilities.js.map +1 -1
  15. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js +1 -0
  16. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/Editing/TextareaWithAutosizing.js.map +1 -1
  17. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +7 -2
  18. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  19. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js +3 -7
  20. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/util.js.map +1 -1
  21. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js +2 -2
  22. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Selection.js.map +1 -1
  23. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +1 -1
  24. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  25. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Print/Print.js.map +1 -1
  27. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Search/Search.js.map +1 -1
  29. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +19 -6
  30. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  31. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  32. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js +45 -12
  33. package/dist/esm/packages/taco/src/primitives/Table/useTableDataLoader.js.map +1 -1
  34. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js +9 -2
  35. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableFontSizeListener.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js +7 -3
  37. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableSearchListener.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js +1 -2
  39. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/listeners/useTableServerLoadingListener.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  41. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  42. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +6 -1
  43. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  44. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js +15 -2
  45. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/settings.js.map +1 -1
  46. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +6 -2
  47. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  48. package/dist/index.css +9 -3
  49. package/dist/primitives/Table/Core/components/Columns/Cell/util.d.ts +0 -1
  50. package/dist/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterColumn.d.ts +1 -1
  51. package/dist/primitives/Table/types.d.ts +6 -7
  52. package/dist/primitives/Table/useTableDataLoader.d.ts +5 -4
  53. package/dist/primitives/Table/useTableManager/listeners/useTableSearchListener.d.ts +2 -1
  54. package/dist/primitives/Table/useTableManager/util/settings.d.ts +2 -1
  55. package/dist/taco.cjs.development.js +169 -94
  56. package/dist/taco.cjs.development.js.map +1 -1
  57. package/dist/taco.cjs.production.min.js +1 -1
  58. package/dist/taco.cjs.production.min.js.map +1 -1
  59. package/package.json +2 -2
@@ -4572,12 +4572,12 @@ const defaultLocalisationTexts = {
4572
4572
  },
4573
4573
  validation: {
4574
4574
  alert: {
4575
- titleOne: '[COUNT] unsaved entry: ',
4576
- titlePlural: '[COUNT] unsaved entries: ',
4575
+ titleOne: '[COUNT] unsaved entry:',
4576
+ titlePlural: '[COUNT] unsaved entries:',
4577
4577
  messageOne: "[COLUMN] [ROW] is incomplete and hasn't been saved.",
4578
4578
  messagePlural: "[COLUMN] [ROW] are incomplete and haven't been saved.",
4579
4579
  messageRow: 'Row',
4580
- messageAnd: ' and '
4580
+ messageAnd: 'and'
4581
4581
  },
4582
4582
  resetFiltersDialog: {
4583
4583
  title: 'Row is hidden',
@@ -9345,13 +9345,18 @@ function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight
9345
9345
  });
9346
9346
  });
9347
9347
  if (settingsOrder && settingsOrder.length > 0) {
9348
+ const columnsAbsentInSettingsOrder = [];
9348
9349
  orderingEnabled = orderingEnabled.reduce((acc, column) => {
9349
9350
  const index = settingsOrder.indexOf(column);
9350
9351
  if (index > -1) {
9351
9352
  acc[index] = column;
9353
+ } else {
9354
+ columnsAbsentInSettingsOrder.push(column);
9352
9355
  }
9353
9356
  return acc;
9354
- }, []).filter(column => !!column);
9357
+ }, []).filter(column => !!column)
9358
+ // Append absent columns at the end
9359
+ .concat(columnsAbsentInSettingsOrder);
9355
9360
  }
9356
9361
  const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
9357
9362
  // actions should always be last, enforce that
@@ -9518,6 +9523,36 @@ function globalFilterFn(row, columnId, searchQuery) {
9518
9523
  return false;
9519
9524
  }
9520
9525
 
9526
+ function getSettings(table) {
9527
+ const meta = table.options.meta;
9528
+ const state = table.getState();
9529
+ return {
9530
+ // commented out properties are here to highlight things we explicitly don't want them saved
9531
+ //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
9532
+ columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
9533
+ columnPinning: state.columnPinning,
9534
+ columnSizing: ignoreInternalColumns(state.columnSizing),
9535
+ columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
9536
+ excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
9537
+ fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
9538
+ //grouping: table.options.enableGrouping ? state.grouping : undefined,
9539
+ rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
9540
+ //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
9541
+ sorting: state.sorting
9542
+ };
9543
+ }
9544
+ function ignoreInternalColumns(data) {
9545
+ return Object.keys(data).reduce((accum, key) => {
9546
+ if (isInternalColumn(key)) {
9547
+ return accum;
9548
+ }
9549
+ return {
9550
+ ...accum,
9551
+ [key]: data[key]
9552
+ };
9553
+ }, {});
9554
+ }
9555
+
9521
9556
  // mapping children to react-table columns
9522
9557
  function processChildren(child, columns, defaultSizing, defaultSorting, defaultVisibility, settings, defaultRowGroupColumnId) {
9523
9558
  const columnHelper = reactTable.createColumnHelper();
@@ -9603,7 +9638,10 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
9603
9638
  column.cell = info => renderer(info.getValue(), info.row.original);
9604
9639
  }
9605
9640
  if (typeof footer === 'function') {
9606
- column.footer = info => footer(info.table.getRowModel().rows.map(row => row.original[id]));
9641
+ column.footer = info => footer(info.table.getRowModel().rows.flatMap(row => {
9642
+ var _row$original;
9643
+ return ((_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original[id]) !== undefined ? [row.original[id]] : [];
9644
+ }));
9607
9645
  }
9608
9646
  // config - filtering
9609
9647
  if (enableColumnFilter) {
@@ -9770,7 +9808,7 @@ function useReactTableInitialState(props, columns, persistedSettings, defaults)
9770
9808
  columnFilters: (_ref2 = (_persistedSettings$co3 = persistedSettings.columnFilters) !== null && _persistedSettings$co3 !== void 0 ? _persistedSettings$co3 : (_props$defaultSetting3 = props.defaultSettings) === null || _props$defaultSetting3 === void 0 ? void 0 : _props$defaultSetting3.columnFilters) !== null && _ref2 !== void 0 ? _ref2 : [],
9771
9809
  columnOrder,
9772
9810
  columnPinning,
9773
- columnSizing: (_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {},
9811
+ columnSizing: ignoreInternalColumns((_ref3 = (_ref4 = (_persistedSettings$co4 = persistedSettings.columnSizing) !== null && _persistedSettings$co4 !== void 0 ? _persistedSettings$co4 : (_props$defaultSetting4 = props.defaultSettings) === null || _props$defaultSetting4 === void 0 ? void 0 : _props$defaultSetting4.columnSizing) !== null && _ref4 !== void 0 ? _ref4 : defaults.defaultSizing) !== null && _ref3 !== void 0 ? _ref3 : {}),
9774
9812
  columnVisibility: (_ref5 = (_ref6 = (_persistedSettings$co5 = persistedSettings.columnVisibility) !== null && _persistedSettings$co5 !== void 0 ? _persistedSettings$co5 : (_props$defaultSetting5 = props.defaultSettings) === null || _props$defaultSetting5 === void 0 ? void 0 : _props$defaultSetting5.columnVisibility) !== null && _ref6 !== void 0 ? _ref6 : defaults.defaultVisibility) !== null && _ref5 !== void 0 ? _ref5 : {},
9775
9813
  globalFilter: (_persistedSettings$se = persistedSettings.searchQuery) !== null && _persistedSettings$se !== void 0 ? _persistedSettings$se : (_props$defaultSetting6 = props.defaultSettings) === null || _props$defaultSetting6 === void 0 ? void 0 : _props$defaultSetting6.searchQuery,
9776
9814
  sorting: persistedSettings.sorting ? persistedSettings.sorting.filter(ignoreNotDefinedColumns) : (_props$defaultSetting7 = (_props$defaultSetting8 = props.defaultSettings) === null || _props$defaultSetting8 === void 0 ? void 0 : _props$defaultSetting8.sorting) !== null && _props$defaultSetting7 !== void 0 ? _props$defaultSetting7 : defaults.defaultSorting
@@ -10287,7 +10325,7 @@ function _finallyRethrows(body, finalizer) {
10287
10325
  }
10288
10326
 
10289
10327
  const DEFAULT_PAGE_SIZE = 100;
10290
- function useTableDataLoader(fetch, fetchAll, options = {
10328
+ function useTableDataLoader(fetchPage, fetchAll, options = {
10291
10329
  pageSize: DEFAULT_PAGE_SIZE
10292
10330
  }) {
10293
10331
  const {
@@ -10303,11 +10341,11 @@ function useTableDataLoader(fetch, fetchAll, options = {
10303
10341
  const _lastUsedFilters = React__default.useRef([]);
10304
10342
  const _lastUsedSearch = React__default.useRef();
10305
10343
  const _forceReset = React__default.useRef(false);
10306
- const loadPage = function (pageIndex, sorting, filters, search) {
10344
+ const loadPage = function (pageIndex, sorting, filters) {
10307
10345
  try {
10308
10346
  let reset = false;
10309
10347
  // sorting or filters changed, reset everything
10310
- if (_forceReset.current || search !== _lastUsedSearch.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
10348
+ if (_forceReset.current || JSON.stringify(sorting) !== JSON.stringify(_lastUsedSorting.current) || JSON.stringify(filters) !== JSON.stringify(_lastUsedFilters.current)) {
10311
10349
  _pendingPageRequests.current = {};
10312
10350
  // nuke the dataset so that we "start again" after sorting
10313
10351
  reset = true;
@@ -10323,11 +10361,9 @@ function useTableDataLoader(fetch, fetchAll, options = {
10323
10361
  _lastUsedSorting.current = sorting;
10324
10362
  // set the filters so we can track if it changed between loads
10325
10363
  _lastUsedFilters.current = filters;
10326
- // set the search so we can track if it changed between loads
10327
- _lastUsedSearch.current = search;
10328
10364
  const _temp = _finallyRethrows(function () {
10329
10365
  return _catch(function () {
10330
- return Promise.resolve(fetch(pageIndex, pageSize, sorting, filters, search)).then(function (response) {
10366
+ return Promise.resolve(fetchPage(pageIndex, pageSize, sorting, filters)).then(function (response) {
10331
10367
  // update state, here we do some "magic" to support "load in place"
10332
10368
  setData(currentData => {
10333
10369
  let nextData;
@@ -10356,10 +10392,14 @@ function useTableDataLoader(fetch, fetchAll, options = {
10356
10392
  return Promise.reject(e);
10357
10393
  }
10358
10394
  };
10359
- const loadAll = function (sorting, filters, search) {
10395
+ const loadAll = function (sorting, filters) {
10360
10396
  try {
10397
+ // set the sorting so we can track if it changed between loads
10398
+ _lastUsedSorting.current = sorting;
10399
+ // set the filters so we can track if it changed between loads
10400
+ _lastUsedFilters.current = filters;
10361
10401
  const _temp2 = _catch(function () {
10362
- return Promise.resolve(fetchAll(sorting, filters, search)).then(function (response) {
10402
+ return Promise.resolve(fetchAll(sorting, filters)).then(function (response) {
10363
10403
  length.current = response.length;
10364
10404
  setData(() => {
10365
10405
  let nextData;
@@ -10381,22 +10421,52 @@ function useTableDataLoader(fetch, fetchAll, options = {
10381
10421
  const invalidate = function () {
10382
10422
  try {
10383
10423
  _forceReset.current = true;
10384
- return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current, _lastUsedSearch.current);
10424
+ return loadPage(0, _lastUsedSorting.current, _lastUsedFilters.current);
10385
10425
  } catch (e) {
10386
10426
  return Promise.reject(e);
10387
10427
  }
10388
10428
  };
10389
- // we reset the page to 0 whenever sorting, filtering or search changes
10429
+ // search works client side - it fetches all then works client side - so these handlers are a little "weird"
10430
+ // if a search is currently "active", we need to re load all because
10390
10431
  const handleSort = function (sorting) {
10391
10432
  try {
10392
- return loadPage(0, sorting, _lastUsedFilters.current, _lastUsedSearch.current);
10433
+ // set the sorting so we can track if it changed between loads
10434
+ _lastUsedSorting.current = sorting;
10435
+ if (_lastUsedSearch.current) {
10436
+ // we're searching, which means we need to refetch all with the correct sorting applied
10437
+ loadAll(sorting, _lastUsedFilters.current);
10438
+ } else {
10439
+ // reset the page to 0 whenever sorting
10440
+ loadPage(0, sorting, _lastUsedFilters.current);
10441
+ }
10442
+ return Promise.resolve();
10393
10443
  } catch (e) {
10394
10444
  return Promise.reject(e);
10395
10445
  }
10396
10446
  };
10397
10447
  const handleFilter = function (filters) {
10398
10448
  try {
10399
- return loadPage(0, _lastUsedSorting.current, filters, _lastUsedSearch.current);
10449
+ // set the filters so we can track if it changed between loads
10450
+ _lastUsedFilters.current = filters;
10451
+ if (_lastUsedSearch.current) {
10452
+ // we're searching, which means we need to refetch all with the correct sorting applied
10453
+ loadAll(_lastUsedSorting.current, filters);
10454
+ } else {
10455
+ // reset the page to 0 whenever sorting
10456
+ loadPage(0, _lastUsedSorting.current, filters);
10457
+ }
10458
+ return Promise.resolve();
10459
+ } catch (e) {
10460
+ return Promise.reject(e);
10461
+ }
10462
+ };
10463
+ const handleSearch = function (search) {
10464
+ try {
10465
+ // set the search so we can track if it changed between loads
10466
+ _lastUsedSearch.current = search || undefined;
10467
+ // search works client side, and focusing the search field triggers a load of all so we don't actually
10468
+ // want to load anything when search gets changed, we just store the value for other handlers
10469
+ return Promise.resolve();
10400
10470
  } catch (e) {
10401
10471
  return Promise.reject(e);
10402
10472
  }
@@ -10407,6 +10477,7 @@ function useTableDataLoader(fetch, fetchAll, options = {
10407
10477
  loadAll,
10408
10478
  loadPage,
10409
10479
  onChangeFilter: handleFilter,
10480
+ onChangeSearch: handleSearch,
10410
10481
  onChangeSort: handleSort,
10411
10482
  pageSize
10412
10483
  }, invalidate];
@@ -10583,10 +10654,17 @@ function useTableFontSizeListener(table) {
10583
10654
  const previousFontSizeRef = React__default.useRef(meta.fontSize.size);
10584
10655
  useLazyEffect(() => {
10585
10656
  const cellWidthDifference = getCellWidthDifference(`${previousFontSizeRef.current}-${meta.fontSize.size}`);
10657
+ const globalMinSize = getCellMinWidth(meta.fontSize.size);
10586
10658
  table.setColumnSizing(sizes => {
10587
- const minColumnSize = getCellMinWidth(meta.fontSize.size);
10588
10659
  return Object.fromEntries(Object.entries(sizes).map(([columnName, prevColumnSize]) => {
10660
+ var _column$columnDef$min;
10661
+ const column = table.getColumn(columnName);
10662
+ if (isInternalColumn(columnName)) {
10663
+ var _column$getSize;
10664
+ return [columnName, (_column$getSize = column === null || column === void 0 ? void 0 : column.getSize()) !== null && _column$getSize !== void 0 ? _column$getSize : prevColumnSize];
10665
+ }
10589
10666
  // Prevents width value in the setting to go below the minColumnSize
10667
+ const minColumnSize = (_column$columnDef$min = column === null || column === void 0 ? void 0 : column.columnDef.minSize) !== null && _column$columnDef$min !== void 0 ? _column$columnDef$min : globalMinSize;
10590
10668
  const newSize = Math.max(minColumnSize, prevColumnSize + cellWidthDifference);
10591
10669
  return [columnName, newSize];
10592
10670
  }));
@@ -10690,33 +10768,18 @@ function resetHighlightedColumnIndexes(value, table) {
10690
10768
  return firstRowIndex;
10691
10769
  }
10692
10770
 
10693
- function useTableSearchListener(table) {
10771
+ function useTableSearchListener(table, onChangeSearch) {
10694
10772
  const meta = table.options.meta;
10695
10773
  // recalculates highlighted indexes whenever something important changes
10696
10774
  React__default.useEffect(() => {
10697
10775
  if (meta.search.isEnabled) {
10698
- resetHighlightedColumnIndexes(table.getState().globalFilter, table);
10776
+ const query = table.getState().globalFilter;
10777
+ resetHighlightedColumnIndexes(query, table);
10778
+ if (typeof onChangeSearch === 'function') {
10779
+ onChangeSearch(query);
10780
+ }
10699
10781
  }
10700
- }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility)]);
10701
- }
10702
-
10703
- function getSettings(table) {
10704
- const meta = table.options.meta;
10705
- const state = table.getState();
10706
- return {
10707
- // commented out properties are here to highlight things we explicitly don't want them saved
10708
- //columnFilters: table.options.enableColumnFilters ? state.columnFilters : undefined,
10709
- columnOrder: meta.columnOrdering.isEnabled ? state.columnOrder : undefined,
10710
- columnPinning: state.columnPinning,
10711
- columnSizing: state.columnSizing,
10712
- columnVisibility: table.options.enableHiding ? state.columnVisibility : undefined,
10713
- excludeUnmatchedRecordsInSearch: table.options.enableGlobalFilter,
10714
- fontSize: meta.fontSize.isEnabled ? meta.fontSize.size : undefined,
10715
- //grouping: table.options.enableGrouping ? state.grouping : undefined,
10716
- rowHeight: meta.rowHeight.isEnabled ? meta.rowHeight.height : undefined,
10717
- //searchQuery: table.options.enableGlobalFilter ? state.globalFilter : undefined,
10718
- sorting: state.sorting
10719
- };
10782
+ }, [meta.server.loadAllStatus, meta.search.isEnabled, meta.search.enableGlobalFilter, table.getRowModel().rows.length, table.getState().globalFilter, JSON.stringify(table.getState().sorting), JSON.stringify(table.getState().columnVisibility), onChangeSearch]);
10720
10783
  }
10721
10784
 
10722
10785
  function useTableSettingsListener(table, onChangeSettings) {
@@ -10802,11 +10865,10 @@ function useTableSortingListener(table, onSort) {
10802
10865
  function useTableServerLoadingListener(table, loadPage) {
10803
10866
  const sorting = table.getState().sorting;
10804
10867
  const columnFilters = table.getState().columnFilters;
10805
- const search = table.getState().globalFilter;
10806
10868
  // trigger load of the first page on mount
10807
10869
  React__default.useEffect(() => {
10808
10870
  if (loadPage) {
10809
- loadPage(0, sorting, columnFilters, search);
10871
+ loadPage(0, sorting, columnFilters);
10810
10872
  }
10811
10873
  }, []);
10812
10874
  }
@@ -10907,7 +10969,7 @@ function useTableManager(props, meta, internalColumns) {
10907
10969
  useTableFontSizeListener(instance);
10908
10970
  useTableRowHeightListener(instance);
10909
10971
  useTableRowSelectionListener(instance, props.onRowSelect);
10910
- useTableSearchListener(instance);
10972
+ useTableSearchListener(instance, props.onChangeSearch);
10911
10973
  useTableServerLoadingListener(instance, server.loadPage);
10912
10974
  useTableSettingsListener(instance, setSettings);
10913
10975
  useTableShortcutsListener(instance, props.shortcuts);
@@ -10987,16 +11049,23 @@ function useTableStyleGrid(tableId, table, fontSize) {
10987
11049
 
10988
11050
  function useTableStyleColumnFreezing(tableId, table) {
10989
11051
  const {
10990
- columnPinning
11052
+ columnPinning,
11053
+ columnSizing
10991
11054
  } = table.getState();
10992
11055
  const stylesheet = React__default.useMemo(() => {
10993
11056
  const styles = [];
10994
11057
  // might be a better way to get this information, but it wasn't obvious
10995
11058
  const all = table.getFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
10996
- const left = table.getLeftFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
10997
- const right = table.getRightFlatHeaders().filter(column => !column.subHeaders.length).map(x => x.id);
11059
+ const left = table.getLeftFlatHeaders().filter(column => !column.subHeaders.length);
11060
+ const right = table.getRightFlatHeaders().filter(column => !column.subHeaders.length);
10998
11061
  if (left.length) {
10999
- const index = all.indexOf(left[left.length - 1]);
11062
+ left.forEach(cell => {
11063
+ styles.push(`table[data-taco^='table']#${tableId} [data-cell-id="${cell.column.id}"] {
11064
+ left: ${cell.column.getStart(cell.column.getIsPinned())}px;
11065
+ }`);
11066
+ });
11067
+ const leftIds = left.map(x => x.id);
11068
+ const index = all.indexOf(leftIds[leftIds.length - 1]);
11000
11069
  // add right border, hide the header seperator and add shadow when scrolled
11001
11070
  // we have to be specific so that nested tables don't inherit the same css
11002
11071
  styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}),
@@ -11014,14 +11083,20 @@ function useTableStyleColumnFreezing(tableId, table) {
11014
11083
  }`);
11015
11084
  }
11016
11085
  if (right.length) {
11017
- const index = all.indexOf(right[right.length - 1]);
11086
+ right.forEach(cell => {
11087
+ styles.push(`table[data-taco^='table']#${tableId} [data-cell-id="${cell.column.id}"] {
11088
+ right: ${cell.column.getStart(cell.column.getIsPinned())}px;
11089
+ }`);
11090
+ });
11091
+ const rightIds = right.map(x => x.id);
11092
+ const index = all.indexOf(rightIds[rightIds.length - 1]);
11018
11093
  styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}):not([data-cell-id^="__"]),
11019
11094
  table[data-taco^='table']#${tableId} > tbody > tr > td:nth-child(${index + 1}):not([data-cell-id^="__"]) {
11020
11095
  border-left-width: 1px;
11021
11096
  }`);
11022
11097
  }
11023
11098
  return styles.join('\n');
11024
- }, [columnPinning]);
11099
+ }, [columnPinning, columnSizing]);
11025
11100
  return {
11026
11101
  stylesheet
11027
11102
  };
@@ -11190,7 +11265,7 @@ function RowWithServerLoading(props) {
11190
11265
  React__default.useEffect(() => {
11191
11266
  if (inView) {
11192
11267
  var _tableMeta$server$loa, _tableMeta$server;
11193
- (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters, table.getState().globalFilter);
11268
+ (_tableMeta$server$loa = (_tableMeta$server = tableMeta.server).loadPage) === null || _tableMeta$server$loa === void 0 ? void 0 : _tableMeta$server$loa.call(_tableMeta$server, pageIndex, table.getState().sorting, table.getState().columnFilters);
11194
11269
  }
11195
11270
  }, [inView]);
11196
11271
  return /*#__PURE__*/React__default.createElement(Skeleton, {
@@ -11664,7 +11739,7 @@ function Header$4(context) {
11664
11739
  const _temp = function () {
11665
11740
  if (tableMeta.server.loadAllIfNeeded) {
11666
11741
  // don't pass the search query because we need all data - not filtered data
11667
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
11742
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
11668
11743
  }
11669
11744
  }();
11670
11745
  // load all data if that is possible
@@ -11738,7 +11813,7 @@ function Cell$3(context) {
11738
11813
  const _temp3 = function () {
11739
11814
  if (tableMeta.server.loadAllIfNeeded && selectedRows.some(row => row.original === undefined)) {
11740
11815
  // don't pass the search query because we need all data - not filtered data
11741
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
11816
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
11742
11817
  }
11743
11818
  }();
11744
11819
  return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
@@ -11842,20 +11917,16 @@ function useTable(props, externalRef, renderers, meta) {
11842
11917
  function getCellAttributes(cell, index, isHighlighted) {
11843
11918
  const columnMeta = cell.column.columnDef.meta;
11844
11919
  const isPinned = cell.column.getIsPinned();
11845
- const attributes = {
11920
+ // be careful adding new properties here, any objects will break cell memoisation (e.g. the style attribute)
11921
+ return {
11846
11922
  'data-cell-align': columnMeta === null || columnMeta === void 0 ? void 0 : columnMeta.align,
11847
11923
  'data-cell-highlighted': isHighlighted,
11848
11924
  'data-cell-id': cell.column.id,
11849
11925
  'data-cell-index': index,
11850
11926
  'data-cell-pinned': isPinned ? true : undefined,
11851
11927
  'data-cell-truncate': columnMeta.enableTruncate ? true : undefined,
11852
- className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className,
11853
- style: {}
11928
+ className: typeof columnMeta.className === 'function' ? columnMeta.className(cell.row.original) : columnMeta.className
11854
11929
  };
11855
- if (isPinned) {
11856
- attributes.style[isPinned] = `${cell.column.getStart(isPinned)}px`;
11857
- }
11858
- return attributes;
11859
11930
  }
11860
11931
  function useSearchHighlighting(cell, cellIndex, ref) {
11861
11932
  const {
@@ -13130,7 +13201,7 @@ function Search$1(props) {
13130
13201
  const _temp = function () {
13131
13202
  if (tableMeta.server.loadAllIfNeeded) {
13132
13203
  // don't pass the search query because we need all data - not filtered data
13133
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
13204
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
13134
13205
  }
13135
13206
  }();
13136
13207
  // load all data if that is possible
@@ -13892,10 +13963,9 @@ const getFontSize = fontSize => {
13892
13963
  switch (fontSize) {
13893
13964
  case exports.FontSizes.small:
13894
13965
  return 'text-xs';
13895
- case exports.FontSizes.medium:
13896
- return 'text-sm';
13897
13966
  case exports.FontSizes.large:
13898
13967
  return 'text-base';
13968
+ case exports.FontSizes.medium:
13899
13969
  default:
13900
13970
  return 'text-sm';
13901
13971
  }
@@ -14100,18 +14170,18 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
14100
14170
  ...otherProps
14101
14171
  } = props;
14102
14172
  const {
14103
- onDelete,
14104
- onEdit,
14173
+ fontSize,
14105
14174
  listboxRef,
14106
14175
  multiple,
14176
+ onDelete,
14177
+ onEdit,
14107
14178
  ref: selectRef,
14108
14179
  setOpen,
14109
14180
  shouldPauseHoverState,
14110
14181
  tags,
14111
- value,
14112
- fontSize = exports.FontSizes.medium
14182
+ value
14113
14183
  } = useSelect2Context();
14114
- const className = cn(createOptionClassName(shouldPauseHoverState), fontSize && getFontSize(fontSize), cName);
14184
+ const className = cn(createOptionClassName(shouldPauseHoverState), getFontSize(fontSize), cName);
14115
14185
  const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;
14116
14186
  const isTag = tags && !!color;
14117
14187
  const handleClick = () => {
@@ -14205,6 +14275,15 @@ const Title$5 = /*#__PURE__*/React__default.forwardRef(function Select2Title(pro
14205
14275
  }));
14206
14276
  });
14207
14277
 
14278
+ const Placeholder = ({
14279
+ disabled,
14280
+ ...props
14281
+ }) => ( /*#__PURE__*/React__default.createElement("div", Object.assign({}, props, {
14282
+ className: cn({
14283
+ 'text-grey-700': disabled,
14284
+ 'text-grey-500': !disabled
14285
+ })
14286
+ })));
14208
14287
  const Trigger$7 = /*#__PURE__*/React__default.forwardRef(function Select2Trigger(props, ref) {
14209
14288
  const {
14210
14289
  multiple,
@@ -14228,11 +14307,11 @@ const Button$2 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
14228
14307
  children,
14229
14308
  onClick,
14230
14309
  tabIndex = 0,
14231
- fontSize,
14232
14310
  ...otherProps
14233
14311
  } = props;
14234
14312
  const {
14235
14313
  disabled,
14314
+ fontSize,
14236
14315
  highlighted,
14237
14316
  invalid,
14238
14317
  open,
@@ -14244,7 +14323,7 @@ const Button$2 = /*#__PURE__*/React__default.forwardRef(function Select2TriggerB
14244
14323
  highlighted,
14245
14324
  invalid,
14246
14325
  readOnly
14247
- }).replace('w-full', '').replace('px-2', ''), fontSize && getFontSize(fontSize), {
14326
+ }).replace('w-full', '').replace('px-2', ''), getFontSize(fontSize), {
14248
14327
  'w-full': !((_props$className = props.className) !== null && _props$className !== void 0 && _props$className.includes('w-'))
14249
14328
  }, props.className);
14250
14329
  const handleClick = event => {
@@ -14288,11 +14367,8 @@ const Single = /*#__PURE__*/React__default.forwardRef(function Select2TriggerSin
14288
14367
  const currentValue = children.find(matchesValue(value));
14289
14368
  let output;
14290
14369
  if (placeholder && currentValue === undefined) {
14291
- output = /*#__PURE__*/React__default.createElement("div", {
14292
- className: cn({
14293
- 'text-grey-700': disabled,
14294
- 'text-grey-500': !disabled
14295
- })
14370
+ output = /*#__PURE__*/React__default.createElement(Placeholder, {
14371
+ disabled: disabled
14296
14372
  }, placeholder);
14297
14373
  } else if (currentValue) {
14298
14374
  if (tags && emptyValue !== value) {
@@ -14344,11 +14420,8 @@ const Multiple = /*#__PURE__*/React__default.forwardRef(function Select2TriggerM
14344
14420
  className: "my-1 flex max-h-[5.5rem] flex-col"
14345
14421
  }, /*#__PURE__*/React__default.createElement("div", {
14346
14422
  className: "flex flex-wrap gap-1"
14347
- }, valuesAsChildren.length === 0 ? ( /*#__PURE__*/React__default.createElement("div", {
14348
- className: cn({
14349
- 'text-grey-700': disabled,
14350
- 'text-grey-500': !disabled
14351
- })
14423
+ }, valuesAsChildren.length === 0 ? ( /*#__PURE__*/React__default.createElement(Placeholder, {
14424
+ disabled: disabled
14352
14425
  }, placeholder)) : valuesAsChildren.map(child => ( /*#__PURE__*/React__default.createElement(Tag$1, {
14353
14426
  key: String(child.props.value),
14354
14427
  className: "truncate",
@@ -14407,11 +14480,8 @@ const MultipleValue = ({
14407
14480
  }, /*#__PURE__*/React__default.createElement("div", {
14408
14481
  className: "flex gap-1 truncate",
14409
14482
  ref: el => setContentRef(el)
14410
- }, valuesAsChildren.length === 0 ? ( /*#__PURE__*/React__default.createElement("div", {
14411
- className: cn({
14412
- 'text-grey-700': disabled,
14413
- 'text-grey-500': !disabled
14414
- })
14483
+ }, valuesAsChildren.length === 0 ? ( /*#__PURE__*/React__default.createElement(Placeholder, {
14484
+ disabled: disabled
14415
14485
  }, placeholder)) : valuesAsChildren.map((child, index) => {
14416
14486
  const tag = /*#__PURE__*/React__default.createElement(Tag$1, {
14417
14487
  key: String(child.props.value),
@@ -14740,20 +14810,20 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
14740
14810
  defaultValue: defaultProp,
14741
14811
  disabled = false,
14742
14812
  emptyValue = undefined,
14743
- placeholder,
14813
+ fontSize,
14744
14814
  highlighted = false,
14745
14815
  invalid = false,
14816
+ loading,
14746
14817
  multiple = false,
14747
14818
  name,
14748
14819
  onChange,
14749
14820
  onCreate,
14750
14821
  onDelete,
14751
14822
  onEdit,
14823
+ placeholder,
14752
14824
  readOnly = false,
14753
14825
  tags = false,
14754
14826
  value: prop,
14755
- fontSize,
14756
- loading,
14757
14827
  ...otherProps
14758
14828
  } = props;
14759
14829
  const emptyOption = React__default.useMemo(() => {
@@ -14938,9 +15008,8 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
14938
15008
  emptyValue: emptyValue,
14939
15009
  onBlur: handleBlur,
14940
15010
  onKeyDown: handleKeyDown,
14941
- ref: internalRef,
14942
- fontSize: fontSize,
14943
- placeholder: placeholder
15011
+ placeholder: placeholder,
15012
+ ref: internalRef
14944
15013
  }), flattenedChildren)), /*#__PURE__*/React__default.createElement(PopoverPrimitive.Portal, null, /*#__PURE__*/React__default.createElement(PopoverPrimitive.Content, {
14945
15014
  asChild: true,
14946
15015
  align: "start",
@@ -15180,7 +15249,7 @@ function Print$1(props) {
15180
15249
  const _temp2 = function () {
15181
15250
  if (tableMeta.server.isEnabled && tableMeta.server.loadAllIfNeeded) {
15182
15251
  const _temp = _catch(function () {
15183
- return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters, undefined)).then(function () {});
15252
+ return Promise.resolve(tableMeta.server.loadAllIfNeeded(table.getState().sorting, table.getState().columnFilters)).then(function () {});
15184
15253
  }, function (error) {
15185
15254
  const errorMessage = `${texts.table.print.error}: ${error}`;
15186
15255
  console.error(errorMessage);
@@ -17965,6 +18034,7 @@ const TextareaWithAutosizing = /*#__PURE__*/React__default.forwardRef(function T
17965
18034
  };
17966
18035
  const handleFocus = event => {
17967
18036
  var _props$onFocus;
18037
+ toggleHeight();
17968
18038
  (_props$onFocus = props.onFocus) === null || _props$onFocus === void 0 ? void 0 : _props$onFocus.call(props, event);
17969
18039
  };
17970
18040
  const handleBlur = event => {
@@ -18450,9 +18520,13 @@ function Alert$1(props) {
18450
18520
  const tableMeta = table.options.meta;
18451
18521
  const [showFilterResetDialog, setShowFilterResetDialog] = React__default.useState(false);
18452
18522
  const pendingChangesWithErrors = tableMeta.editing.getErrors();
18523
+ const activeRow = React__default.useMemo(() => tableMeta.rowActive.rowActiveIndex ? table.getRowModel().rows[tableMeta.rowActive.rowActiveIndex] : undefined, [tableMeta.rowActive.rowActiveIndex]);
18453
18524
  // mark errors being rendered as seen
18454
18525
  React__default.useEffect(() => {
18455
18526
  pendingChangesWithErrors.forEach(error => {
18527
+ if (activeRow && error.rowId === activeRow.id) {
18528
+ return;
18529
+ }
18456
18530
  tableMeta.editing.setRowErrorsSeen(error.rowId);
18457
18531
  });
18458
18532
  }, [pendingChangesWithErrors]);
@@ -18478,7 +18552,8 @@ function Alert$1(props) {
18478
18552
  pendingChangesWithErrors.forEach((error, index) => {
18479
18553
  // if appropriate, concatenate the item with the text "and"
18480
18554
  if (pendingChangesWithErrors.length > 1 && index === pendingChangesWithErrors.length - 1) {
18481
- links.push(validationTexts.alert.messageAnd);
18555
+ // Add space before and after `messageAnd` text
18556
+ links.push(` ${validationTexts.alert.messageAnd} `);
18482
18557
  }
18483
18558
  const rowIndex = table.getRowModel().rows.findIndex(row => row.id === error.rowId);
18484
18559
  const handleClick = () => {
@@ -18536,7 +18611,7 @@ function Alert$1(props) {
18536
18611
  state: "error"
18537
18612
  }), /*#__PURE__*/React__default.createElement("span", {
18538
18613
  className: "font-bold"
18539
- }, title), message), /*#__PURE__*/React__default.createElement(FilterResetDialog, {
18614
+ }, title), "\u00A0", message), /*#__PURE__*/React__default.createElement(FilterResetDialog, {
18540
18615
  open: showFilterResetDialog !== false,
18541
18616
  onChange: () => setShowFilterResetDialog(false),
18542
18617
  onSubmit: handleResetFilters