@economic/taco 2.26.8 → 2.26.10
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.
- package/dist/esm/index.css +4 -0
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js +28 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +17 -10
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js +9 -4
- package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableStyleGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +2 -1
- package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
- package/dist/index.css +4 -0
- package/dist/primitives/Table/Core/components/Columns/Cell/BuiltIns/DisplayCell.d.ts +1 -1
- package/dist/primitives/Table/useTableManager/useTableManager.d.ts +2 -1
- package/dist/taco.cjs.development.js +54 -18
- 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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TableMeta as ReactTableMeta, RowData } from '@tanstack/react-table';
|
|
2
|
-
import { TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnMenu, TableColumnRendererControl, TableFilterComparator, TableProps } from '../types';
|
|
2
|
+
import { TableColumnAlignment, TableColumnClassNameHandler, TableColumnDataType, TableColumnMenu, TableColumnRenderer, TableColumnRendererControl, TableFilterComparator, TableProps } from '../types';
|
|
3
3
|
import { useTableColumnFreezing } from './features/useTableColumnFreezing';
|
|
4
4
|
import { useTableColumnOrdering } from './features/useTableColumnOrdering';
|
|
5
5
|
import { useTableFooter } from './features/useTableFooter';
|
|
@@ -54,6 +54,7 @@ declare module '@tanstack/table-core' {
|
|
|
54
54
|
header: string;
|
|
55
55
|
headerClassName?: string;
|
|
56
56
|
menu?: TableColumnMenu;
|
|
57
|
+
renderer?: TableColumnRenderer<TValue, TData>;
|
|
57
58
|
tooltip?: string;
|
|
58
59
|
}
|
|
59
60
|
}
|
|
@@ -9594,7 +9594,8 @@ function processChildren(child, columns, defaultSizing, defaultSorting, defaultV
|
|
|
9594
9594
|
enableOrdering: isGrouped ? false : enableOrdering,
|
|
9595
9595
|
enablePrinting,
|
|
9596
9596
|
enableTruncate,
|
|
9597
|
-
header
|
|
9597
|
+
header,
|
|
9598
|
+
renderer
|
|
9598
9599
|
}
|
|
9599
9600
|
};
|
|
9600
9601
|
// renderers
|
|
@@ -10935,9 +10936,14 @@ function useTableStyleGrid(tableId, table, fontSize) {
|
|
|
10935
10936
|
const width = columnSizing[column.id];
|
|
10936
10937
|
let size;
|
|
10937
10938
|
let printSize;
|
|
10938
|
-
if (column.id
|
|
10939
|
-
|
|
10940
|
-
|
|
10939
|
+
if (isInternalColumn(column.id)) {
|
|
10940
|
+
if (column.id === '__actions') {
|
|
10941
|
+
const minWidth = tableMeta.rowActions.rowActionsLength * 32 + 8; /* button margins l+r */
|
|
10942
|
+
size = `minmax(${minWidth}px, auto)`;
|
|
10943
|
+
} else {
|
|
10944
|
+
// getSize method is used instead of columnSizing state because internal columns have defined widths
|
|
10945
|
+
size = `${column.getSize()}px`;
|
|
10946
|
+
}
|
|
10941
10947
|
} else if (width !== undefined) {
|
|
10942
10948
|
const isLastColumn = index === allVisibleColumns.length - 1;
|
|
10943
10949
|
if (width === 'grow' || Number.isNaN(width) && !isLastColumn) {
|
|
@@ -11490,7 +11496,7 @@ const renderer = {
|
|
|
11490
11496
|
renderer: Cell,
|
|
11491
11497
|
meta: {
|
|
11492
11498
|
align: 'right',
|
|
11493
|
-
className: /*#__PURE__*/cn('print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky
|
|
11499
|
+
className: /*#__PURE__*/cn('print:opacity-0 !px-0 !pr-1 overflow-hidden [table_&]:group-[[data-row-active="true"]]/row:sticky right-0', 'group-[[data-row-active="true"][data-selected="false"]]/row:text-grey-200', 'group-[[data-row-selected="true"]]/row:text-blue-100', 'group-[[data-row-selected="false"]:hover]/row:text-grey-100'),
|
|
11494
11500
|
// TODO: remove when table3 is migrated, this satisfies the legacy table3 type
|
|
11495
11501
|
enableSearch: false,
|
|
11496
11502
|
header: ''
|
|
@@ -11892,6 +11898,7 @@ function useSearchHighlighting(cell, cellIndex, ref) {
|
|
|
11892
11898
|
}
|
|
11893
11899
|
|
|
11894
11900
|
function GroupedCell(props) {
|
|
11901
|
+
var _ref, _columnMeta$renderer, _columnMeta$renderer2;
|
|
11895
11902
|
const {
|
|
11896
11903
|
cell,
|
|
11897
11904
|
cellRef,
|
|
@@ -11899,6 +11906,7 @@ function GroupedCell(props) {
|
|
|
11899
11906
|
isHighlighted
|
|
11900
11907
|
} = props;
|
|
11901
11908
|
const tableMeta = cell.getContext().table.options.meta;
|
|
11909
|
+
const columnMeta = cell.column.columnDef.meta;
|
|
11902
11910
|
const attributes = getCellAttributes(cell, index, isHighlighted);
|
|
11903
11911
|
const {
|
|
11904
11912
|
isHovered,
|
|
@@ -11906,25 +11914,31 @@ function GroupedCell(props) {
|
|
|
11906
11914
|
} = React__default.useContext(RowContext);
|
|
11907
11915
|
const isActiveRow = tableMeta.rowActive.rowActiveIndex === rowIndex;
|
|
11908
11916
|
const canShowActions = isActiveRow || isHovered && !tableMeta.rowActive.isHoverStatePaused;
|
|
11917
|
+
const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
|
|
11918
|
+
const 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;
|
|
11919
|
+
const subRows = cell.getContext().row.subRows.map(row => row.original);
|
|
11909
11920
|
return /*#__PURE__*/React__default.createElement(MemoedGroupedCell, Object.assign({}, attributes, {
|
|
11910
|
-
cell: cell,
|
|
11911
|
-
cellRef: cellRef,
|
|
11912
11921
|
canShowActions: canShowActions,
|
|
11922
|
+
cellRef: cellRef,
|
|
11923
|
+
colSpan: colSpan,
|
|
11913
11924
|
fontSize: tableMeta.fontSize.size,
|
|
11914
|
-
rowActions: tableMeta.rowGroups.rowActionsForGroup
|
|
11915
|
-
|
|
11925
|
+
rowActions: tableMeta.rowGroups.rowActionsForGroup,
|
|
11926
|
+
rowId: cell.row.id,
|
|
11927
|
+
subRows: subRows
|
|
11928
|
+
}), content);
|
|
11916
11929
|
}
|
|
11917
11930
|
const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupedCell(props) {
|
|
11918
11931
|
const {
|
|
11919
11932
|
canShowActions,
|
|
11920
|
-
cell,
|
|
11921
11933
|
cellRef,
|
|
11934
|
+
children,
|
|
11935
|
+
colSpan,
|
|
11922
11936
|
fontSize,
|
|
11923
11937
|
rowActions,
|
|
11938
|
+
rowId,
|
|
11939
|
+
subRows,
|
|
11924
11940
|
...attributes
|
|
11925
11941
|
} = props;
|
|
11926
|
-
const colSpan = cell.row.getVisibleCells().filter(c => !isInternalColumn(c.column.id)).length - 1;
|
|
11927
|
-
const subRows = cell.getContext().row.subRows.map(row => row.original);
|
|
11928
11942
|
return /*#__PURE__*/React__default.createElement("td", Object.assign({}, attributes, {
|
|
11929
11943
|
ref: cellRef,
|
|
11930
11944
|
style: {
|
|
@@ -11932,13 +11946,13 @@ const MemoedGroupedCell = /*#__PURE__*/React__default.memo(function MemoedGroupe
|
|
|
11932
11946
|
}
|
|
11933
11947
|
}), /*#__PURE__*/React__default.createElement("span", {
|
|
11934
11948
|
className: "grow"
|
|
11935
|
-
},
|
|
11949
|
+
}, children), rowActions !== null && rowActions !== void 0 && rowActions.length && canShowActions ? ( /*#__PURE__*/React__default.createElement(Actions$1, {
|
|
11936
11950
|
actions: rowActions,
|
|
11937
11951
|
actionsLength: 4,
|
|
11938
11952
|
data: subRows,
|
|
11939
11953
|
fontSize: fontSize,
|
|
11940
11954
|
isActiveRow: true,
|
|
11941
|
-
rowId:
|
|
11955
|
+
rowId: rowId
|
|
11942
11956
|
})) : null);
|
|
11943
11957
|
});
|
|
11944
11958
|
|
|
@@ -12080,7 +12094,7 @@ function useSetVirtualisedRowHeight(measureRow, rowEl, expansionEl, isExpanded)
|
|
|
12080
12094
|
}, [isExpanded, rowEl, expansionEl]);
|
|
12081
12095
|
}
|
|
12082
12096
|
|
|
12083
|
-
|
|
12097
|
+
function DisplayCell(props) {
|
|
12084
12098
|
const {
|
|
12085
12099
|
cell,
|
|
12086
12100
|
cellRef,
|
|
@@ -12088,15 +12102,37 @@ const DisplayCell = /*#__PURE__*/React__default.memo(function DisplayCell(props)
|
|
|
12088
12102
|
isHighlighted,
|
|
12089
12103
|
...cellAttributes
|
|
12090
12104
|
} = props;
|
|
12105
|
+
const {
|
|
12106
|
+
isHovered
|
|
12107
|
+
} = React__default.useContext(RowContext);
|
|
12091
12108
|
const columnMeta = cell.column.columnDef.meta;
|
|
12092
12109
|
const attributes = getCellAttributes(cell, index, isHighlighted);
|
|
12093
12110
|
const isTruncated = !!columnMeta.enableTruncate;
|
|
12094
|
-
|
|
12095
|
-
|
|
12111
|
+
let content;
|
|
12112
|
+
if (isInternalColumn(cell.column.id)) {
|
|
12113
|
+
content = reactTable.flexRender(cell.column.columnDef.cell, cell.getContext());
|
|
12114
|
+
} else {
|
|
12115
|
+
var _ref, _columnMeta$renderer, _columnMeta$renderer2;
|
|
12116
|
+
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;
|
|
12117
|
+
}
|
|
12118
|
+
return /*#__PURE__*/React__default.createElement(MemoedDisplayCell, Object.assign({}, cellAttributes, attributes, {
|
|
12119
|
+
cellRef: cellRef,
|
|
12120
|
+
isTruncated: isTruncated,
|
|
12121
|
+
key: `${cell.id}_${isHovered}`
|
|
12122
|
+
}), content);
|
|
12123
|
+
}
|
|
12124
|
+
const MemoedDisplayCell = /*#__PURE__*/React__default.memo(function MemoedDisplayCell(props) {
|
|
12125
|
+
const {
|
|
12126
|
+
cellRef,
|
|
12127
|
+
children,
|
|
12128
|
+
isTruncated,
|
|
12129
|
+
...cellAttributes
|
|
12130
|
+
} = props;
|
|
12131
|
+
return /*#__PURE__*/React__default.createElement("td", Object.assign({}, cellAttributes, {
|
|
12096
12132
|
ref: cellRef
|
|
12097
12133
|
}), isTruncated ? /*#__PURE__*/React__default.createElement("span", {
|
|
12098
12134
|
className: "truncate print:overflow-visible print:whitespace-normal"
|
|
12099
|
-
},
|
|
12135
|
+
}, children) : children);
|
|
12100
12136
|
});
|
|
12101
12137
|
|
|
12102
12138
|
const RENDERERS = {
|