material-react-table 1.8.2 → 1.8.4

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
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.8.2",
2
+ "version": "1.8.4",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -307,10 +307,10 @@ export const getCommonCellStyles = ({
307
307
  ...(tableCellProps?.sx instanceof Function
308
308
  ? tableCellProps.sx(theme)
309
309
  : (tableCellProps?.sx as any)),
310
- minWidth: `max(calc(var(--col-${parseCSSVarId(
310
+ minWidth: `max(calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(
311
311
  header?.id ?? column.id,
312
312
  )}-size) * 1px), ${column.columnDef.minSize ?? 30}px)`,
313
- width: `calc(var(--col-${parseCSSVarId(
313
+ width: `calc(var(--${header ? 'header' : 'col'}-${parseCSSVarId(
314
314
  header?.id ?? column.id,
315
315
  )}-size) * 1px)`,
316
316
  });
@@ -116,33 +116,34 @@ export const MRT_EditCellTextField = <TData extends Record<string, any> = {}>({
116
116
  onChange={handleChange}
117
117
  onKeyDown={handleEnterKeyDown}
118
118
  >
119
- {columnDef?.editSelectOptions?.map(
120
- (option: string | { text: string; value: string }) => {
121
- let value: string;
122
- let text: string;
123
- if (typeof option !== 'object') {
124
- value = option;
125
- text = option;
126
- } else {
127
- value = option.value;
128
- text = option.text;
129
- }
130
- return (
131
- <MenuItem
132
- key={value}
133
- sx={{
134
- display: 'flex',
135
- m: 0,
136
- alignItems: 'center',
137
- gap: '0.5rem',
138
- }}
139
- value={value}
140
- >
141
- {text}
142
- </MenuItem>
143
- );
144
- },
145
- )}
119
+ {textFieldProps.children ??
120
+ columnDef?.editSelectOptions?.map(
121
+ (option: string | { text: string; value: string }) => {
122
+ let value: string;
123
+ let text: string;
124
+ if (typeof option !== 'object') {
125
+ value = option;
126
+ text = option;
127
+ } else {
128
+ value = option.value;
129
+ text = option.text;
130
+ }
131
+ return (
132
+ <MenuItem
133
+ key={value}
134
+ sx={{
135
+ display: 'flex',
136
+ m: 0,
137
+ alignItems: 'center',
138
+ gap: '0.5rem',
139
+ }}
140
+ value={value}
141
+ >
142
+ {text}
143
+ </MenuItem>
144
+ );
145
+ },
146
+ )}
146
147
  </TextField>
147
148
  );
148
149
  };
@@ -349,41 +349,42 @@ export const MRT_FilterTextField = ({
349
349
  <Box sx={{ opacity: 0.5 }}>{filterPlaceholder}</Box>
350
350
  </MenuItem>
351
351
  )}
352
- {columnDef?.filterSelectOptions?.map(
353
- (option: string | { text: string; value: string }) => {
354
- let value: string;
355
- let text: string;
356
- if (typeof option !== 'object') {
357
- value = option;
358
- text = option;
359
- } else {
360
- value = option.value;
361
- text = option.text;
362
- }
363
- return (
364
- <MenuItem
365
- key={value}
366
- sx={{
367
- display: 'flex',
368
- m: 0,
369
- alignItems: 'center',
370
- gap: '0.5rem',
371
- }}
372
- value={value}
373
- >
374
- {isMultiSelectFilter && (
375
- <Checkbox
376
- checked={(
377
- (column.getFilterValue() ?? []) as string[]
378
- ).includes(value)}
379
- sx={{ mr: '0.5rem' }}
380
- />
381
- )}
382
- {text}
383
- </MenuItem>
384
- );
385
- },
386
- )}
352
+ {textFieldProps.children ??
353
+ columnDef?.filterSelectOptions?.map(
354
+ (option: string | { text: string; value: string }) => {
355
+ let value: string;
356
+ let text: string;
357
+ if (typeof option !== 'object') {
358
+ value = option;
359
+ text = option;
360
+ } else {
361
+ value = option.value;
362
+ text = option.text;
363
+ }
364
+ return (
365
+ <MenuItem
366
+ key={value}
367
+ sx={{
368
+ display: 'flex',
369
+ m: 0,
370
+ alignItems: 'center',
371
+ gap: '0.5rem',
372
+ }}
373
+ value={value}
374
+ >
375
+ {isMultiSelectFilter && (
376
+ <Checkbox
377
+ checked={(
378
+ (column.getFilterValue() ?? []) as string[]
379
+ ).includes(value)}
380
+ sx={{ mr: '0.5rem' }}
381
+ />
382
+ )}
383
+ {text}
384
+ </MenuItem>
385
+ );
386
+ },
387
+ )}
387
388
  </TextField>
388
389
  <MRT_FilterOptionMenu
389
390
  anchorEl={anchorEl}
@@ -59,9 +59,9 @@ export const MRT_Table = ({ table }: Props) => {
59
59
  const colSizes: { [key: string]: number } = {};
60
60
  for (let i = 0; i < headers.length; i++) {
61
61
  const header = headers[i];
62
- const colSize = header.getSize();
63
- colSizes[`--header-${parseCSSVarId(header.id)}-size`] = colSize;
64
- colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] = colSize;
62
+ colSizes[`--header-${parseCSSVarId(header.id)}-size`] = header.getSize();
63
+ colSizes[`--col-${parseCSSVarId(header.column.id)}-size`] =
64
+ header.column.getSize();
65
65
  }
66
66
  return colSizes;
67
67
  }, [columns, columnSizing, columnSizingInfo, columnVisibility]);