@economic/taco 2.26.6 → 2.26.7
Sign up to get free protection for your applications and to get access to all the features.
- 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 +48 -46
- 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) {
|