@economic/taco 2.26.6 → 2.26.8

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.
@@ -10923,55 +10923,57 @@ function useTableStyleGrid(tableId, table, fontSize) {
10923
10923
  const globalMinSize = getCellMinWidth(fontSize);
10924
10924
  // header body ?footer
10925
10925
  const gridTemplateRows = table.getRowModel().rows.length ? 'min-content 1fr min-content' : 'min-content 1fr';
10926
- let printGridTemplateColumns = '';
10927
- const printHiddenColumns = [];
10928
- const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {
10929
- var _column$columnDef$min, _column$columnDef$met;
10930
- if (table.options.enableGrouping && column.getIsGrouped()) {
10931
- return accum;
10932
- }
10933
- const minSize = (_column$columnDef$min = column.columnDef.minSize) !== null && _column$columnDef$min !== void 0 ? _column$columnDef$min : globalMinSize;
10934
- const width = columnSizing[column.id];
10935
- let size;
10936
- let printSize;
10937
- if (column.id === '__actions') {
10938
- const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */
10939
- size = `minmax(${minWidth}px, auto)`;
10940
- } else if (width !== undefined) {
10941
- const isLastColumn = index === allVisibleColumns.length - 1;
10942
- if (width === 'grow' || Number.isNaN(width) && !isLastColumn) {
10943
- size = `minmax(max-content, 1fr)`;
10944
- } else {
10945
- const minWidth = width < minSize ? minSize : width;
10946
- if (isLastColumn) {
10947
- size = `minmax(${minWidth}px, auto)`;
10926
+ return React__default.useMemo(() => {
10927
+ let printGridTemplateColumns = '';
10928
+ const printHiddenColumns = [];
10929
+ const gridTemplateColumns = allVisibleColumns.reduce((accum, column, index) => {
10930
+ var _column$columnDef$min, _column$columnDef$met;
10931
+ if (table.options.enableGrouping && column.getIsGrouped()) {
10932
+ return accum;
10933
+ }
10934
+ const minSize = (_column$columnDef$min = column.columnDef.minSize) !== null && _column$columnDef$min !== void 0 ? _column$columnDef$min : globalMinSize;
10935
+ const width = columnSizing[column.id];
10936
+ let size;
10937
+ let printSize;
10938
+ if (column.id === '__actions') {
10939
+ const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */
10940
+ size = `minmax(${minWidth}px, auto)`;
10941
+ } else if (width !== undefined) {
10942
+ const isLastColumn = index === allVisibleColumns.length - 1;
10943
+ if (width === 'grow' || Number.isNaN(width) && !isLastColumn) {
10944
+ size = `minmax(max-content, 1fr)`;
10948
10945
  } else {
10949
- size = `${minWidth}px`;
10946
+ const minWidth = width < minSize ? minSize : width;
10947
+ if (isLastColumn) {
10948
+ size = `minmax(${minWidth}px, auto)`;
10949
+ } else {
10950
+ size = `${minWidth}px`;
10951
+ }
10950
10952
  }
10953
+ } else {
10954
+ size = `minmax(max-content, auto)`;
10951
10955
  }
10952
- } else {
10953
- size = `minmax(max-content, auto)`;
10954
- }
10955
- if (((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enablePrinting) === false) {
10956
- printSize = '';
10957
- printHiddenColumns.push(column.id);
10958
- } else {
10959
- printSize = 'auto';
10960
- }
10961
- printGridTemplateColumns = `${printGridTemplateColumns} ${printSize}`.trim();
10962
- return `${accum} ${size}`.trim();
10963
- }, '');
10964
- // we have to be specific so that nested tables don't inherit the same css
10965
- 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(',');
10966
- const style = {
10967
- gridTemplateColumns,
10968
- gridTemplateRows
10969
- };
10970
- const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${hiddenColumns ? `${hiddenColumns} { display: none; }` : ''}}`;
10971
- return {
10972
- style,
10973
- stylesheet
10974
- };
10956
+ if (((_column$columnDef$met = column.columnDef.meta) === null || _column$columnDef$met === void 0 ? void 0 : _column$columnDef$met.enablePrinting) === false) {
10957
+ printSize = '';
10958
+ printHiddenColumns.push(column.id);
10959
+ } else {
10960
+ printSize = 'auto';
10961
+ }
10962
+ printGridTemplateColumns = `${printGridTemplateColumns} ${printSize}`.trim();
10963
+ return `${accum} ${size}`.trim();
10964
+ }, '');
10965
+ // we have to be specific so that nested tables don't inherit the same css
10966
+ 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(',');
10967
+ const style = {
10968
+ gridTemplateColumns,
10969
+ gridTemplateRows
10970
+ };
10971
+ const stylesheet = `@media print { table[data-taco^='table']#${tableId} { grid-template-columns: ${printGridTemplateColumns}; } ${hiddenColumns ? `${hiddenColumns} { display: none; }` : ''}}`;
10972
+ return {
10973
+ style,
10974
+ stylesheet
10975
+ };
10976
+ }, [allVisibleColumns, columnSizing, globalMinSize, tableMeta.rowActions.rowActionsLength]);
10975
10977
  }
10976
10978
 
10977
10979
  function useTableStyleColumnFreezing(tableId, table) {
@@ -15785,7 +15787,7 @@ function Column$1(_) {
15785
15787
  function Group$3(_) {
15786
15788
  return null;
15787
15789
  }
15788
- const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
15790
+ const BaseReport = /*#__PURE__*/fixedForwardRef(function BaseReport(props, ref) {
15789
15791
  const report = useReport(props, ref);
15790
15792
  return /*#__PURE__*/React__default.createElement(Table, null, /*#__PURE__*/React__default.createElement(Table.Toolbar, {
15791
15793
  table: report
@@ -15794,6 +15796,16 @@ const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
15794
15796
  table: report
15795
15797
  }));
15796
15798
  });
15799
+ const Report$1 = /*#__PURE__*/fixedForwardRef(function Report(props, ref) {
15800
+ const stringifiedChildren = String(props.children);
15801
+ // we force a remount (using key) when the child columns change because there are too many places to add children as an effect
15802
+ // this is cheaper from a complexity perspective, and probably performance wise as well
15803
+ const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
15804
+ return /*#__PURE__*/React__default.createElement(BaseReport, Object.assign({}, props, {
15805
+ key: key,
15806
+ ref: ref
15807
+ }));
15808
+ });
15797
15809
  Report$1.Column = Column$1;
15798
15810
  Report$1.Group = Group$3;
15799
15811
 
@@ -18507,7 +18519,7 @@ function Group$4(_) {
18507
18519
  return null;
18508
18520
  }
18509
18521
  Group$4.displayName = 'Table3Group';
18510
- const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
18522
+ const BaseTable3 = /*#__PURE__*/fixedForwardRef(function BaseTable3(props, ref) {
18511
18523
  var _table3$meta$editing, _table3$meta$editing2;
18512
18524
  const table3 = useTable3(props, ref);
18513
18525
  const handleBlur = event => {
@@ -18536,6 +18548,16 @@ const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
18536
18548
  table: table3
18537
18549
  })));
18538
18550
  });
18551
+ const Table3 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
18552
+ const stringifiedChildren = String(props.children);
18553
+ // we force a remount (using key) when the child columns change because there are too many places to add children as an effect
18554
+ // this is cheaper from a complexity perspective, and probably performance wise as well
18555
+ const key = React__default.useMemo(() => String('tableKey_' + stringifiedChildren), [stringifiedChildren]);
18556
+ return /*#__PURE__*/React__default.createElement(BaseTable3, Object.assign({}, props, {
18557
+ key: key,
18558
+ ref: ref
18559
+ }));
18560
+ });
18539
18561
  Table3.Column = Column$3;
18540
18562
  Table3.Group = Group$4;
18541
18563