@economic/taco 2.26.6 → 2.26.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/esm/packages/taco/src/components/Report/Report.js +11 -1
- package/dist/esm/packages/taco/src/components/Report/Report.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +11 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +49 -46
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
- package/dist/primitives/Table/Core/features/useTableStyle.d.ts +60 -60
- package/dist/taco.cjs.development.js +70 -48
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
@@ -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
|
-
|
10927
|
-
|
10928
|
-
|
10929
|
-
|
10930
|
-
|
10931
|
-
|
10932
|
-
|
10933
|
-
|
10934
|
-
|
10935
|
-
|
10936
|
-
|
10937
|
-
|
10938
|
-
|
10939
|
-
|
10940
|
-
|
10941
|
-
|
10942
|
-
|
10943
|
-
|
10944
|
-
|
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
|
-
|
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
|
-
|
10953
|
-
|
10954
|
-
|
10955
|
-
|
10956
|
-
|
10957
|
-
|
10958
|
-
|
10959
|
-
|
10960
|
-
}
|
10961
|
-
|
10962
|
-
|
10963
|
-
|
10964
|
-
|
10965
|
-
|
10966
|
-
|
10967
|
-
|
10968
|
-
|
10969
|
-
|
10970
|
-
|
10971
|
-
|
10972
|
-
|
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
|
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
|
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
|
|