@economic/taco 2.28.0 → 2.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. package/dist/components/Icon/components/Phone.d.ts +3 -0
  2. package/dist/components/Icon/components/index.d.ts +1 -1
  3. package/dist/components/Input/Input.d.ts +1 -1
  4. package/dist/components/List/components/Item.d.ts +1 -1
  5. package/dist/components/Menu/components/Item.d.ts +1 -1
  6. package/dist/components/Menu/components/Link.d.ts +1 -1
  7. package/dist/components/Navigation2/components/Link.d.ts +1 -1
  8. package/dist/components/Select2/components/Option.d.ts +2 -2
  9. package/dist/components/Select2/components/Search.d.ts +1 -1
  10. package/dist/components/Tag/Tag.d.ts +1 -1
  11. package/dist/esm/index.css +10 -6
  12. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js +45 -43
  13. package/dist/esm/packages/taco/src/components/Combobox/useCombobox.js.map +1 -1
  14. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js +1 -1
  15. package/dist/esm/packages/taco/src/components/Datepicker/useDatepicker.js.map +1 -1
  16. package/dist/esm/packages/taco/src/components/Icon/components/Phone.js +17 -0
  17. package/dist/esm/packages/taco/src/components/Icon/components/Phone.js.map +1 -0
  18. package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
  19. package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
  20. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +1 -1
  21. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  22. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js +9 -2
  23. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/util.js.map +1 -1
  24. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +4 -1
  25. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  26. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js +3 -7
  27. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js.map +1 -1
  28. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  29. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  30. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js +11 -9
  31. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.js.map +1 -1
  32. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +3 -3
  33. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  34. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js +4 -2
  35. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleColumnFreezing.js.map +1 -1
  36. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +9 -8
  37. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
  38. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js +7 -1
  39. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/columns.js.map +1 -1
  40. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +15 -11
  41. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  42. package/dist/esm/packages/taco/src/utils/date.js +3 -3
  43. package/dist/esm/packages/taco/src/utils/date.js.map +1 -1
  44. package/dist/index.css +10 -6
  45. package/dist/primitives/Table/Core/components/Row/BuiltIns/SkeletonRow.d.ts +1 -3
  46. package/dist/primitives/Table/useTableManager/util/columns.d.ts +1 -1
  47. package/dist/taco.cjs.development.js +128 -91
  48. package/dist/taco.cjs.development.js.map +1 -1
  49. package/dist/taco.cjs.production.min.js +1 -1
  50. package/dist/taco.cjs.production.min.js.map +1 -1
  51. package/dist/utils/date.d.ts +1 -1
  52. package/package.json +2 -2
@@ -2569,6 +2569,19 @@ function IconPhoneSolid(props, svgRef) {
2569
2569
  }
2570
2570
  var PhoneSolid = /*#__PURE__*/React.forwardRef(IconPhoneSolid);
2571
2571
 
2572
+ function IconPhone(props, svgRef) {
2573
+ return /*#__PURE__*/React.createElement("svg", Object.assign({
2574
+ fill: "none",
2575
+ xmlns: "http://www.w3.org/2000/svg",
2576
+ viewBox: "0 0 24 24",
2577
+ ref: svgRef
2578
+ }, props), /*#__PURE__*/React.createElement("path", {
2579
+ d: "M4.742 3.998l1.036-.641a2.75 2.75 0 013.58.6l1.39 1.703a2.75 2.75 0 01.2 3.196l-1.082 1.732a.25.25 0 00-.035.17c.06.396.52 1.073 1.397 1.95.638.638 1.174 1.062 1.59 1.27.289.144.43.154.48.123l1.783-1.114a2.75 2.75 0 013.195.201l1.696 1.383a2.75 2.75 0 01.606 3.57l-.639 1.04a3.75 3.75 0 01-3.234 1.788c-2.86-.03-5.846-1.636-8.974-4.763-3.133-3.133-4.739-6.124-4.764-8.986a3.75 3.75 0 011.775-3.222zm.79 1.276a2.25 2.25 0 00-1.065 1.932c.021 2.408 1.445 5.06 4.324 7.939 2.876 2.876 5.524 4.3 7.93 4.324a2.25 2.25 0 001.94-1.072l.639-1.04a1.25 1.25 0 00-.276-1.623l-1.696-1.383a1.25 1.25 0 00-1.452-.092l-1.787 1.117c-1.04.64-2.31.005-3.922-1.607-1.086-1.087-1.698-1.988-1.82-2.786a1.75 1.75 0 01.247-1.19l1.083-1.732a1.25 1.25 0 00-.092-1.453l-1.39-1.704a1.25 1.25 0 00-1.627-.272l-1.036.642z",
2580
+ fill: "currentColor"
2581
+ }));
2582
+ }
2583
+ var Phone = /*#__PURE__*/React.forwardRef(IconPhone);
2584
+
2572
2585
  function IconPlay(props, svgRef) {
2573
2586
  return /*#__PURE__*/React.createElement("svg", Object.assign({
2574
2587
  xmlns: "http://www.w3.org/2000/svg",
@@ -3572,6 +3585,7 @@ const icons = {
3572
3585
  'person-plus': PersonPlus,
3573
3586
  'person-tick': PersonTick,
3574
3587
  'phone-solid': PhoneSolid,
3588
+ phone: Phone,
3575
3589
  play: Play,
3576
3590
  'plus-minus': PlusMinus,
3577
3591
  print: Print,
@@ -5810,57 +5824,59 @@ const useCombobox = ({
5810
5824
  };
5811
5825
  const handleInputKeyDown = event => {
5812
5826
  event.persist();
5813
- switch (event.key) {
5814
- case 'Backspace':
5815
- {
5816
- return;
5817
- }
5818
- case 'Escape':
5819
- {
5820
- event.preventDefault();
5821
- setInputValue(convertToInputValue(value));
5822
- setOpen(false);
5823
- return;
5824
- }
5825
- case 'Tab':
5826
- case 'Enter':
5827
- {
5828
- if (event.key !== 'Tab') {
5827
+ if (!event.ctrlKey && !event.metaKey) {
5828
+ switch (event.key) {
5829
+ case 'Backspace':
5830
+ {
5831
+ return;
5832
+ }
5833
+ case 'Escape':
5834
+ {
5829
5835
  event.preventDefault();
5836
+ setInputValue(convertToInputValue(value));
5837
+ setOpen(false);
5838
+ return;
5830
5839
  }
5831
- setCurrentValue(currentIndex);
5832
- setOpen(false);
5833
- return;
5834
- }
5835
- case 'ArrowDown':
5836
- if (open) {
5837
- event.preventDefault();
5838
- } else {
5839
- if (!inline && buttonRef.current) {
5840
- buttonRef.current.click();
5840
+ case 'Tab':
5841
+ case 'Enter':
5842
+ {
5843
+ if (event.key !== 'Tab') {
5844
+ event.preventDefault();
5845
+ }
5846
+ setCurrentValue(currentIndex);
5847
+ setOpen(false);
5848
+ return;
5841
5849
  }
5842
- }
5843
- break;
5844
- case 'ArrowUp':
5845
- case 'Home':
5846
- case 'End':
5847
- {
5850
+ case 'ArrowDown':
5848
5851
  if (open) {
5849
5852
  event.preventDefault();
5853
+ } else {
5854
+ if (!inline && buttonRef.current) {
5855
+ buttonRef.current.click();
5856
+ }
5850
5857
  }
5851
5858
  break;
5859
+ case 'ArrowUp':
5860
+ case 'Home':
5861
+ case 'End':
5862
+ {
5863
+ if (open) {
5864
+ event.preventDefault();
5865
+ }
5866
+ break;
5867
+ }
5868
+ }
5869
+ // we aren't focused on the list, so manually forward the keydown event to it
5870
+ if (listRef.current) {
5871
+ listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
5872
+ }
5873
+ if (inline && !open) {
5874
+ if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
5875
+ event.preventDefault();
5876
+ const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
5877
+ setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
5878
+ setOpen(true);
5852
5879
  }
5853
- }
5854
- // we aren't focused on the list, so manually forward the keydown event to it
5855
- if (listRef.current) {
5856
- listRef.current.dispatchEvent(createCustomKeyboardEvent(event));
5857
- }
5858
- if (inline && !open) {
5859
- if (event.key === 'ArrowUp' || event.key === 'ArrowDown') {
5860
- event.preventDefault();
5861
- const initialIndex = event.key === 'ArrowUp' ? data.length - 1 : 0;
5862
- setCurrentIndex(currentIndex !== undefined ? currentIndex : initialIndex);
5863
- setOpen(true);
5864
5880
  }
5865
5881
  }
5866
5882
  if (!event.isDefaultPrevented() && onKeyDown) {
@@ -6007,7 +6023,7 @@ const Combobox = /*#__PURE__*/React.forwardRef(function Combobox(props, ref) {
6007
6023
  });
6008
6024
 
6009
6025
  const isWeakEqual = (leftDate, rightDate) => {
6010
- return leftDate.getFullYear() === rightDate.getFullYear() && leftDate.getMonth() === rightDate.getMonth() && leftDate.getDay() === rightDate.getDay();
6026
+ return leftDate.getFullYear() === rightDate.getFullYear() && leftDate.getMonth() === rightDate.getMonth() && leftDate.getDate() === rightDate.getDate();
6011
6027
  };
6012
6028
  const format = (date, mask = 'dd.mm.yy') => {
6013
6029
  if (!date) {
@@ -6020,7 +6036,7 @@ const format = (date, mask = 'dd.mm.yy') => {
6020
6036
  const pad = v => String(v).length === 1 ? `0${v}` : v.toString();
6021
6037
  return mask.replace('dd', pad(value.getDate())).replace('mm', pad(value.getMonth() + 1)).replace('yy', String(value.getFullYear()).slice(2));
6022
6038
  };
6023
- const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultYear = undefined) => {
6039
+ const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultMonth = undefined, defaultYear = undefined) => {
6024
6040
  if (!date || !date.length) {
6025
6041
  return undefined;
6026
6042
  }
@@ -6054,7 +6070,7 @@ const parseFromCustomString = (date = '', mask = 'dd.mm.yy', defaultYear = undef
6054
6070
  month = Number.parseInt(month, 10);
6055
6071
  year = Number.parseInt(year, 10);
6056
6072
  const currentDate = new Date();
6057
- return new Date( /* year */Object.is(year, NaN) ? defaultYear !== null && defaultYear !== void 0 ? defaultYear : currentDate.getFullYear() : year, /* month */Object.is(month, NaN) ? currentDate.getMonth() : month - 1,
6073
+ return new Date( /* year */Object.is(year, NaN) ? defaultYear !== null && defaultYear !== void 0 ? defaultYear : currentDate.getFullYear() : year, /* month */Object.is(month, NaN) ? defaultMonth !== null && defaultMonth !== void 0 ? defaultMonth : currentDate.getMonth() : month - 1,
6058
6074
  // months are zero based in javascript, so subtract a day
6059
6075
  /* day */
6060
6076
  Object.is(day, NaN) ? currentDate.getDate() : day, /* hours */12, /* minutes */0 // set to midday to avoid UTC offset causing dates to be mismatched server side
@@ -6092,7 +6108,7 @@ const useDatepicker = ({
6092
6108
  // event handlers
6093
6109
  const handleInputBlur = event => {
6094
6110
  event.persist();
6095
- const valueAsDate = parseFromCustomString(event.target.value, 'dd.mm.yy', value === null || value === void 0 ? void 0 : value.getFullYear());
6111
+ const valueAsDate = parseFromCustomString(event.target.value, 'dd.mm.yy', value === null || value === void 0 ? void 0 : value.getMonth(), value === null || value === void 0 ? void 0 : value.getFullYear());
6096
6112
  const formattedValue = valueAsDate ? format(valueAsDate) || '' : '';
6097
6113
  event.target.value = formattedValue;
6098
6114
  if (onChange) {
@@ -9587,7 +9603,7 @@ function orderColumn(column, {
9587
9603
  }
9588
9604
  }
9589
9605
  // ordering
9590
- function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight = ['__actions']) {
9606
+ function ensureOrdering(columns, settingsOrder, pinnedOrder = [], internalColumnsPinnedToTheRight = ['__actions']) {
9591
9607
  // internal columns come with a defined order
9592
9608
  const internalColumns = columns.filter(column => isInternalColumn(column.id) && !internalColumnsPinnedToTheRight.includes(String(column.id))).map(column => column.id);
9593
9609
  // columns with ordering disabled should be moved to the front
@@ -9623,6 +9639,12 @@ function ensureOrdering(columns, settingsOrder, internalColumnsPinnedToTheRight
9623
9639
  // Append absent columns at the end
9624
9640
  .concat(columnsAbsentInSettingsOrder);
9625
9641
  }
9642
+ // if pinned columns are defined, make sure they are sorted first, this ensures state matches the freezing "upto" behaviour
9643
+ if (Array.isArray(pinnedOrder)) {
9644
+ orderingEnabled.sort(
9645
+ // the magic >>> 0 here ensures that columns that aren't found in settings, but are children, are pushed to the end
9646
+ (a, b) => (pinnedOrder.indexOf(a) >>> 0) - (pinnedOrder.indexOf(b) >>> 0));
9647
+ }
9626
9648
  const order = [...internalColumns, ...orderingDisabled, ...orderingEnabled];
9627
9649
  // actions should always be last, enforce that
9628
9650
  internalColumnsPinnedToTheRight.forEach(id => {
@@ -9867,16 +9889,18 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
9867
9889
  if (defaultWidth) {
9868
9890
  defaultSizing[id] = defaultWidth;
9869
9891
  }
9870
- if (child.props.sort !== undefined) {
9892
+ const isGrouped = defaultRowGroupColumnId === id;
9893
+ if (child.props.sort !== undefined || isGrouped) {
9871
9894
  defaultSorting.push({
9872
9895
  id,
9873
9896
  desc: sort === 'desc'
9874
9897
  });
9875
9898
  }
9876
- const isGrouped = defaultRowGroupColumnId === id;
9877
9899
  const column = {
9878
9900
  id,
9879
9901
  accessorKey,
9902
+ // To avoid errors caused by undefined row data values, we pass accessorFn as a preventive measure
9903
+ accessorFn: row => row === null || row === void 0 ? void 0 : row[accessorKey],
9880
9904
  header: header,
9881
9905
  // features
9882
9906
  enableColumnFilter,
@@ -9976,14 +10000,14 @@ function mapTableChildrenToColumns(props, settings, options, internalColumns) {
9976
10000
  const column = createInternalColumn('__select', internalColumns.rowSelection, defaultSizing);
9977
10001
  columns.unshift(column);
9978
10002
  }
9979
- if (options.enableRowActions && (_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length && internalColumns.rowActions) {
9980
- const column = createInternalColumn('__actions', internalColumns.rowActions, defaultSizing);
9981
- columns.push(column);
9982
- }
9983
10003
  if (options.enableRowDrag && props.onRowDrag && internalColumns.rowDrag) {
9984
10004
  const column = createInternalColumn('__drag', internalColumns.rowDrag, defaultSizing);
9985
10005
  columns.unshift(column);
9986
10006
  }
10007
+ if (options.enableRowActions && (_props$rowActions = props.rowActions) !== null && _props$rowActions !== void 0 && _props$rowActions.length && internalColumns.rowActions) {
10008
+ const column = createInternalColumn('__actions', internalColumns.rowActions, defaultSizing);
10009
+ columns.push(column);
10010
+ }
9987
10011
  }
9988
10012
  return {
9989
10013
  columns,
@@ -10057,12 +10081,14 @@ function configureReactTableOptions(options, props) {
10057
10081
  }
10058
10082
  function useReactTableInitialState(props, columns, persistedSettings, defaults) {
10059
10083
  return React__default.useMemo(() => {
10060
- var _persistedSettings$co, _props$defaultSetting, _ref, _persistedSettings$co2, _props$defaultSetting2, _columnPinning$left, _ref2, _persistedSettings$co3, _props$defaultSetting3, _ref3, _ref4, _persistedSettings$co4, _props$defaultSetting4, _ref5, _ref6, _persistedSettings$co5, _props$defaultSetting5, _persistedSettings$se, _props$defaultSetting6, _props$defaultSetting7, _props$defaultSetting8;
10084
+ var _ref, _persistedSettings$co, _props$defaultSetting, _persistedSettings$co2, _props$defaultSetting2, _columnPinning$left, _ref2, _persistedSettings$co3, _props$defaultSetting3, _ref3, _ref4, _persistedSettings$co4, _props$defaultSetting4, _ref5, _ref6, _persistedSettings$co5, _props$defaultSetting5, _persistedSettings$se, _props$defaultSetting6, _props$defaultSetting7, _props$defaultSetting8;
10061
10085
  const ignoreNotDefinedColumns = column => columns.find(definedColumn => definedColumn.id === column.id);
10062
- const columnOrder = ensureOrdering(columns, (_persistedSettings$co = persistedSettings.columnOrder) !== null && _persistedSettings$co !== void 0 ? _persistedSettings$co : (_props$defaultSetting = props.defaultSettings) === null || _props$defaultSetting === void 0 ? void 0 : _props$defaultSetting.columnOrder);
10063
- const columnPinning = (_ref = (_persistedSettings$co2 = persistedSettings.columnPinning) !== null && _persistedSettings$co2 !== void 0 ? _persistedSettings$co2 : (_props$defaultSetting2 = props.defaultSettings) === null || _props$defaultSetting2 === void 0 ? void 0 : _props$defaultSetting2.columnPinning) !== null && _ref !== void 0 ? _ref : {};
10064
- // ensure internal columns are pinned
10065
- if (!(columnPinning !== null && columnPinning !== void 0 && (_columnPinning$left = columnPinning.left) !== null && _columnPinning$left !== void 0 && _columnPinning$left.length)) {
10086
+ const columnPinning = (_ref = (_persistedSettings$co = persistedSettings.columnPinning) !== null && _persistedSettings$co !== void 0 ? _persistedSettings$co : (_props$defaultSetting = props.defaultSettings) === null || _props$defaultSetting === void 0 ? void 0 : _props$defaultSetting.columnPinning) !== null && _ref !== void 0 ? _ref : {};
10087
+ const columnOrder = ensureOrdering(columns, (_persistedSettings$co2 = persistedSettings.columnOrder) !== null && _persistedSettings$co2 !== void 0 ? _persistedSettings$co2 : (_props$defaultSetting2 = props.defaultSettings) === null || _props$defaultSetting2 === void 0 ? void 0 : _props$defaultSetting2.columnOrder, columnPinning.left);
10088
+ // ensure internal columns are pinned, and are pinned in the correct order
10089
+ if (columnPinning !== null && columnPinning !== void 0 && (_columnPinning$left = columnPinning.left) !== null && _columnPinning$left !== void 0 && _columnPinning$left.length) {
10090
+ columnPinning.left = freezeUptoExternalColumn(columnOrder.indexOf(columnPinning.left[columnPinning.left.length - 1]), columnOrder);
10091
+ } else {
10066
10092
  if (props.defaultColumnFreezingIndex) {
10067
10093
  columnPinning.left = freezeUptoExternalColumn(props.defaultColumnFreezingIndex, columnOrder);
10068
10094
  } else {
@@ -11219,7 +11245,7 @@ function useTableStyleGrid(tableId, table, fontSize) {
11219
11245
  // header body ?footer
11220
11246
  const gridTemplateRows = table.getRowModel().rows.length ? 'min-content 1fr min-content' : 'min-content 1fr';
11221
11247
  return React__default.useMemo(() => {
11222
- let printGridTemplateColumns = '';
11248
+ let printGridTemplateColumns = 0;
11223
11249
  const printHiddenColumns = [];
11224
11250
  const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {
11225
11251
  var _column$columnDef$min, _column$columnDef$met;
@@ -11229,7 +11255,6 @@ function useTableStyleGrid(tableId, table, fontSize) {
11229
11255
  const minSize = (_column$columnDef$min = column.columnDef.minSize) !== null && _column$columnDef$min !== void 0 ? _column$columnDef$min : globalMinSize;
11230
11256
  const width = columnSizing[column.id];
11231
11257
  let size;
11232
- let printSize;
11233
11258
  if (isInternalColumn(column.id)) {
11234
11259
  if (column.id === '__actions') {
11235
11260
  const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */
@@ -11253,22 +11278,24 @@ function useTableStyleGrid(tableId, table, fontSize) {
11253
11278
  } else {
11254
11279
  size = `minmax(max-content, auto)`;
11255
11280
  }
11281
+ // printing
11256
11282
  if (((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enablePrinting) === false) {
11257
- printSize = '';
11258
11283
  printHiddenColumns.push(column.id);
11259
11284
  } else {
11260
- printSize = 'auto';
11285
+ printGridTemplateColumns++;
11261
11286
  }
11262
- printGridTemplateColumns = `${printGridTemplateColumns} ${printSize}`.trim();
11263
11287
  return `${accum} ${size}`.trim();
11264
11288
  }, '');
11265
- // we have to be specific so that nested tables don't inherit the same css
11266
- const hiddenColumns = printHiddenColumns.map(id => `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco^='table']#${tableId} > tbody > tr > td[data-cell-id='${id}']\n`).join(',');
11289
+ // normal grid
11267
11290
  const style = {
11268
11291
  gridTemplateColumns,
11269
11292
  gridTemplateRows
11270
11293
  };
11271
- const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${hiddenColumns ? `${hiddenColumns} { display: none; }` : ''}}`;
11294
+ // printing grid
11295
+ // we have to be specific so that nested tables don't inherit the same css
11296
+ const hiddenColumns = printHiddenColumns.map(id => `table[data-taco^='table']#${tableId} > thead > tr > th[data-cell-id='${id}']\n,table[data-taco^='table']#${tableId} > tbody > tr > td[data-cell-id='${id}']\n`).join(',');
11297
+ const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: repeat(${printGridTemplateColumns}, auto) !important; }
11298
+ table[data-taco^='table']#${tableId} [data-cell-id^='__']${hiddenColumns ? `, ${hiddenColumns}` : ''} { display: none; }}`;
11272
11299
  return {
11273
11300
  style,
11274
11301
  stylesheet
@@ -11298,7 +11325,8 @@ function useTableStyleColumnFreezing(tableId, table) {
11298
11325
  // add right border, hide the header seperator and add shadow when scrolled
11299
11326
  // we have to be specific so that nested tables don't inherit the same css
11300
11327
  styles.push(`table[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}),
11301
- table[data-taco^='table']#${tableId} > tbody > tr > td:nth-child(${index + 1}) {
11328
+ table[data-taco^='table']#${tableId} > tbody > tr > td:nth-child(${index + 1}),
11329
+ table[data-taco^='table']#${tableId} > tfoot > tr > td:nth-child(${index + 1}):not([data-cell-id^="__"]) {
11302
11330
  border-right-width: 1px;
11303
11331
  }\ntable[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1})[data-cell-id^="__"],
11304
11332
  table[data-taco^='table']#${tableId} > tbody > tr > td:nth-child(${index + 1})[data-cell-id^="__"] {
@@ -11306,7 +11334,8 @@ function useTableStyleColumnFreezing(tableId, table) {
11306
11334
  }\ntable[data-taco^='table']#${tableId} > thead > tr > th:nth-child(${index + 1}):after {
11307
11335
  content: none;
11308
11336
  }\ntable[data-taco^='table'][data-table-horizontally-scrolled="true"]#${tableId} > thead > tr > th:nth-child(${index + 1}),
11309
- table[data-taco^='table'][data-table-horizontally-scrolled="true"]#${tableId} > tbody > tr > td:nth-child(${index + 1}) {
11337
+ table[data-taco^='table'][data-table-horizontally-scrolled="true"]#${tableId} > tbody > tr > td:nth-child(${index + 1}),
11338
+ table[data-taco^='table'][data-table-horizontally-scrolled="true"]#${tableId} > tfoot > tr > td:nth-child(${index + 1}) {
11310
11339
  border-right-color: rgb(221, 221, 221);
11311
11340
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), 6px 0px 6px rgb(0 0 0/8%);
11312
11341
  }`);
@@ -11471,11 +11500,11 @@ function SkeletonRow(props) {
11471
11500
  }));
11472
11501
  }
11473
11502
  return /*#__PURE__*/React__default.createElement(Skeleton, {
11474
- id: row.id,
11475
- cells: row.getVisibleCells()
11503
+ cellsCount: row.getVisibleCells().length
11476
11504
  });
11477
11505
  }
11478
11506
  function RowWithServerLoading(props) {
11507
+ var _table$getState$group, _table$getState;
11479
11508
  const {
11480
11509
  index,
11481
11510
  row,
@@ -11497,22 +11526,24 @@ function RowWithServerLoading(props) {
11497
11526
  (_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);
11498
11527
  }
11499
11528
  }, [inView]);
11529
+ const groupedCellCount = (_table$getState$group = (_table$getState = table.getState()) === null || _table$getState === void 0 ? void 0 : _table$getState.grouping.length) !== null && _table$getState$group !== void 0 ? _table$getState$group : 0;
11530
+ const ungroupedCellCount = row.getVisibleCells().length - groupedCellCount;
11500
11531
  return /*#__PURE__*/React__default.createElement(Skeleton, {
11501
- cells: row.getVisibleCells(),
11532
+ cellsCount: ungroupedCellCount,
11502
11533
  ref: ref
11503
11534
  });
11504
11535
  }
11505
11536
  const Skeleton = /*#__PURE__*/React__default.forwardRef(function Skeleton(props, ref) {
11506
11537
  const {
11507
- cells
11538
+ cellsCount
11508
11539
  } = props;
11509
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("tr", {
11540
+ return /*#__PURE__*/React__default.createElement("tr", {
11510
11541
  ref: ref
11511
- }, cells.map(cell => ( /*#__PURE__*/React__default.createElement("td", {
11512
- key: cell.id
11542
+ }, Array(cellsCount).fill(null).map((_, index) => ( /*#__PURE__*/React__default.createElement("td", {
11543
+ key: index
11513
11544
  }, /*#__PURE__*/React__default.createElement("span", {
11514
11545
  className: "bg-grey-100 text-grey-700 h-4 w-full text-center text-xs"
11515
- }))))));
11546
+ })))));
11516
11547
  });
11517
11548
 
11518
11549
  const RowContext = /*#__PURE__*/React__default.createContext({
@@ -11545,7 +11576,7 @@ function Row(props) {
11545
11576
  }
11546
11577
 
11547
11578
  const TABLE_SCROLL_PADDING_BOTTOM = 36;
11548
- const TABLE_PADDING_BOTTOM = 120;
11579
+ const TABLE_PADDING_BOTTOM = 0;
11549
11580
  function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11550
11581
  var _table$getState$group, _ref, _virtualItems$padding, _virtualItems$padding2, _ref2, _virtualItems;
11551
11582
  const tableMeta = table.options.meta;
@@ -11618,7 +11649,7 @@ function useTableRenderer(renderers, table, tableRef, defaultRowActiveIndex) {
11618
11649
  let content = null;
11619
11650
  if (rows.length) {
11620
11651
  style = {
11621
- height: `${virtualiser.getTotalSize()}px`,
11652
+ height: `${virtualiser.getTotalSize() - HEADER_OFFSET_TOTAL}px`,
11622
11653
  paddingBottom,
11623
11654
  paddingTop
11624
11655
  };
@@ -11697,7 +11728,7 @@ function useRowGroupVirtualisation(table) {
11697
11728
  });
11698
11729
  }
11699
11730
  return indexes;
11700
- }, []);
11731
+ }, [rows]);
11701
11732
  // this is taken from the react-virtual docs/examples
11702
11733
  const rangeExtractor = React__default.useCallback(range => {
11703
11734
  var _reverse$find;
@@ -12412,23 +12443,20 @@ function DisplayCell(props) {
12412
12443
  isHighlighted,
12413
12444
  ...cellAttributes
12414
12445
  } = props;
12415
- const {
12416
- isHovered
12417
- } = React__default.useContext(RowContext);
12418
12446
  const columnMeta = cell.column.columnDef.meta;
12419
12447
  const attributes = getCellAttributes(cell, index, isHighlighted);
12420
12448
  const isTruncated = !!columnMeta.enableTruncate;
12449
+ const value = cell.getValue();
12421
12450
  let content;
12422
12451
  if (isInternalColumn(cell.column.id)) {
12423
12452
  content = reactTable.flexRender(cell.column.columnDef.cell, cell.getContext());
12424
12453
  } else {
12425
12454
  var _ref, _columnMeta$renderer, _columnMeta$renderer2;
12426
- content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, cell.getValue(), cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : cell.getValue()) !== null && _ref !== void 0 ? _ref : null;
12455
+ content = (_ref = (_columnMeta$renderer = (_columnMeta$renderer2 = columnMeta.renderer) === null || _columnMeta$renderer2 === void 0 ? void 0 : _columnMeta$renderer2.call(columnMeta, value, cell.row.original)) !== null && _columnMeta$renderer !== void 0 ? _columnMeta$renderer : value) !== null && _ref !== void 0 ? _ref : null;
12427
12456
  }
12428
12457
  return /*#__PURE__*/React__default.createElement(MemoedDisplayCell, Object.assign({}, cellAttributes, attributes, {
12429
12458
  cellRef: cellRef,
12430
- isTruncated: isTruncated,
12431
- key: `${cell.id}_${isHovered}`
12459
+ isTruncated: isTruncated
12432
12460
  }), content);
12433
12461
  }
12434
12462
  const MemoedDisplayCell = /*#__PURE__*/React__default.memo(function MemoedDisplayCell(props) {
@@ -13144,7 +13172,7 @@ const MemoedFooter = /*#__PURE__*/React__default.memo(function MemoedFooter(prop
13144
13172
  const style = {};
13145
13173
  if (isPinned) {
13146
13174
  // pinned columns should be offset from either the left or right
13147
- style[isPinned] = `${footer.column.getStart(isPinned) - 1}px`;
13175
+ style[isPinned] = `${footer.column.getStart(isPinned)}px`;
13148
13176
  }
13149
13177
  let content;
13150
13178
  let align;
@@ -17745,7 +17773,9 @@ function useTableEditing(isEnabled = false, handleSave, validator) {
17745
17773
  const pendingChangesFns = usePendingChanges(isEnabled, handleSave, validator);
17746
17774
  // if focus leaves the table in any way, trigger a save
17747
17775
  const handleBlur = React__default.useCallback(event => {
17748
- if (event.relatedTarget !== event.currentTarget && !isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget)) {
17776
+ // custom event from datepicker, and it doesn't have the relatedTarget property set.
17777
+ const isClosingDatepicker = dateFns.isDate(event.detail);
17778
+ if (event.relatedTarget !== event.currentTarget && !isElementInsideOrTriggeredFromContainer(event.relatedTarget, event.currentTarget) && !isClosingDatepicker) {
17749
17779
  pendingChangesFns.saveChanges();
17750
17780
  }
17751
17781
  }, [pendingChangesFns.saveChanges]);
@@ -18279,8 +18309,15 @@ function useEditingCellAutofocus(props) {
18279
18309
  const tableElement = (_props$cellRef$curren3 = props.cellRef.current) === null || _props$cellRef$curren3 === void 0 ? void 0 : _props$cellRef$curren3.closest('table');
18280
18310
  if (tableElement && table.getIsSomeColumnsPinned() && !props.cell.column.getIsPinned()) {
18281
18311
  const columnFreezingOffset = table.getLeftTotalSize();
18282
- const leftOffsetFromScrollContainer = event.currentTarget.getBoundingClientRect().left - tableElement.getBoundingClientRect().left;
18283
- if (leftOffsetFromScrollContainer < columnFreezingOffset) {
18312
+ const targetRect = event.currentTarget.getBoundingClientRect();
18313
+ const tableRect = tableElement.getBoundingClientRect();
18314
+ const leftOffsetFromScrollContainer = targetRect.left - tableRect.left;
18315
+ const scrollbarWidth = tableElement.offsetWidth - tableElement.clientWidth; // the width of table vertical scrollbar
18316
+ if (
18317
+ // When pinned column overlaps the focused cell
18318
+ leftOffsetFromScrollContainer < columnFreezingOffset ||
18319
+ // When focused cell goes behidn the edge of the table
18320
+ leftOffsetFromScrollContainer + targetRect.width > tableRect.width - scrollbarWidth) {
18284
18321
  tableElement.scrollTo(props.cell.column.getStart() - columnFreezingOffset, tableElement.scrollTop);
18285
18322
  }
18286
18323
  }
@@ -18449,7 +18486,7 @@ const MemoedEditingCell = /*#__PURE__*/React__default.memo(function MemoedEditin
18449
18486
  if (type === 'datepicker') {
18450
18487
  const handleChange = event => {
18451
18488
  const newDate = event.detail;
18452
- if (dateFns.isDate(value) && dateFns.isDate(newDate) && !isWeakEqual(value, newDate)) {
18489
+ if (!value || dateFns.isDate(value) && dateFns.isDate(newDate) && !isWeakEqual(value, newDate)) {
18453
18490
  props.onChange(event.detail);
18454
18491
  }
18455
18492
  };