material-react-table 1.4.1 → 1.4.2
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/package.json
CHANGED
@@ -104,63 +104,65 @@ export const MRT_TableBody: FC<Props> = ({ table }) => {
|
|
104
104
|
sx={(theme) => ({
|
105
105
|
display: layoutMode === 'grid' ? 'grid' : 'table-row-group',
|
106
106
|
height: virtualizer ? `${virtualizer.getTotalSize()}px` : 'inherit',
|
107
|
+
minHeight: !rows.length ? '100px' : undefined,
|
107
108
|
position: 'relative',
|
108
109
|
...(tableBodyProps?.sx instanceof Function
|
109
110
|
? tableBodyProps?.sx(theme)
|
110
111
|
: (tableBodyProps?.sx as any)),
|
111
112
|
})}
|
112
113
|
>
|
113
|
-
{tableBodyProps?.children ??
|
114
|
-
|
115
|
-
<
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
<Typography
|
120
|
-
sx={{
|
121
|
-
color: 'text.secondary',
|
122
|
-
fontStyle: 'italic',
|
123
|
-
maxWidth: `min(100vw, ${
|
124
|
-
tablePaperRef.current?.clientWidth ?? 360
|
125
|
-
}px)`,
|
126
|
-
py: '2rem',
|
127
|
-
textAlign: 'center',
|
128
|
-
width: '100%',
|
129
|
-
}}
|
114
|
+
{tableBodyProps?.children ??
|
115
|
+
(!rows.length ? (
|
116
|
+
<tr style={{ display: layoutMode === 'grid' ? 'grid' : 'table-row' }}>
|
117
|
+
<td
|
118
|
+
colSpan={table.getVisibleLeafColumns().length}
|
119
|
+
style={{ display: layoutMode === 'grid' ? 'grid' : 'table-cell' }}
|
130
120
|
>
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
?
|
154
|
-
:
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
121
|
+
<Typography
|
122
|
+
sx={{
|
123
|
+
color: 'text.secondary',
|
124
|
+
fontStyle: 'italic',
|
125
|
+
maxWidth: `min(100vw, ${
|
126
|
+
tablePaperRef.current?.clientWidth ?? 360
|
127
|
+
}px)`,
|
128
|
+
py: '2rem',
|
129
|
+
textAlign: 'center',
|
130
|
+
width: '100%',
|
131
|
+
}}
|
132
|
+
>
|
133
|
+
{globalFilter || columnFilters.length
|
134
|
+
? localization.noResultsFound
|
135
|
+
: localization.noRecordsToDisplay}
|
136
|
+
</Typography>
|
137
|
+
</td>
|
138
|
+
</tr>
|
139
|
+
) : (
|
140
|
+
<>
|
141
|
+
{(virtualRows ?? rows).map((rowOrVirtualRow, rowIndex) => {
|
142
|
+
const row = virtualizer
|
143
|
+
? rows[rowOrVirtualRow.index]
|
144
|
+
: (rowOrVirtualRow as MRT_Row);
|
145
|
+
const props = {
|
146
|
+
key: row.id,
|
147
|
+
measureElement: virtualizer
|
148
|
+
? virtualizer.measureElement
|
149
|
+
: undefined,
|
150
|
+
numRows: rows.length,
|
151
|
+
row,
|
152
|
+
rowIndex: virtualizer ? rowOrVirtualRow.index : rowIndex,
|
153
|
+
table,
|
154
|
+
virtualRow: virtualizer
|
155
|
+
? (rowOrVirtualRow as VirtualItem)
|
156
|
+
: undefined,
|
157
|
+
};
|
158
|
+
return memoMode === 'rows' ? (
|
159
|
+
<Memo_MRT_TableBodyRow {...props} />
|
160
|
+
) : (
|
161
|
+
<MRT_TableBodyRow {...props} />
|
162
|
+
);
|
163
|
+
})}
|
164
|
+
</>
|
165
|
+
))}
|
164
166
|
</TableBody>
|
165
167
|
);
|
166
168
|
};
|