@dooherceg/material-react-table 3.2.14 → 3.2.15
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/index.d.ts +70 -64
- package/dist/index.esm.js +128 -68
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +128 -68
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.esm.js
CHANGED
|
@@ -545,7 +545,7 @@ const prepareColumns = ({ columnDefs, tableOptions, }) => {
|
|
|
545
545
|
}
|
|
546
546
|
}
|
|
547
547
|
else if (columnDef.columnDefType === 'display') {
|
|
548
|
-
columnDef = Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), columnDef), { onClickIconTypeColumn: undefined
|
|
548
|
+
columnDef = Object.assign(Object.assign(Object.assign({}, defaultDisplayColumn), columnDef), { onClickIconTypeColumn: undefined });
|
|
549
549
|
}
|
|
550
550
|
return columnDef;
|
|
551
551
|
});
|
|
@@ -4429,21 +4429,37 @@ const EnumColumnResolver = {
|
|
|
4429
4429
|
activeFilterRenderer: EnumActiveFilterItem,
|
|
4430
4430
|
};
|
|
4431
4431
|
|
|
4432
|
+
// Resolves a status color to a theme palette color when one matches (e.g. 'warning',
|
|
4433
|
+
// 'error', 'success'), otherwise falls back to the raw value as a CSS color (e.g. '#d63031').
|
|
4434
|
+
const resolveStatusColor = (theme, color) => {
|
|
4435
|
+
var _a, _b;
|
|
4436
|
+
return (_b = (_a = theme.palette[color]) === null || _a === void 0 ? void 0 : _a.main) !== null && _b !== void 0 ? _b : color;
|
|
4437
|
+
};
|
|
4438
|
+
// Small colored dot used to represent an icon column's status — meta.availableIcons
|
|
4439
|
+
// only ever carries a color token/hex value, never an icon glyph name.
|
|
4440
|
+
// Forwards its ref so it can be used directly as a MUI Tooltip child.
|
|
4441
|
+
const MRT_IconStatusDot = forwardRef(({ color, size = 12 }, ref) => (jsx(Box, { ref: ref, sx: {
|
|
4442
|
+
bgcolor: (theme) => resolveStatusColor(theme, color),
|
|
4443
|
+
borderRadius: '50%',
|
|
4444
|
+
flexShrink: 0,
|
|
4445
|
+
height: size,
|
|
4446
|
+
width: size,
|
|
4447
|
+
} })));
|
|
4448
|
+
MRT_IconStatusDot.displayName = 'MRT_IconStatusDot';
|
|
4449
|
+
|
|
4432
4450
|
const Iconify = forwardRef((_a, ref) => {
|
|
4433
4451
|
var { icon, width = 20, sx } = _a, other = __rest(_a, ["icon", "width", "sx"]);
|
|
4434
4452
|
return (jsx(Box, Object.assign({ ref: ref, component: Icon, className: "component-iconify", icon: icon, sx: Object.assign({ width, height: width }, sx) }, other)));
|
|
4435
4453
|
});
|
|
4436
4454
|
|
|
4437
4455
|
const DEFAULT_FIELD_SIZE$3 = 'small';
|
|
4438
|
-
const MRT_FormIconInput = ({ name, columnDef, fieldConfig, }) => {
|
|
4439
|
-
var _a, _b, _c
|
|
4456
|
+
const MRT_FormIconInput = ({ name, columnDef, fieldConfig, iconsList, }) => {
|
|
4457
|
+
var _a, _b, _c;
|
|
4440
4458
|
const { control } = useFormContext();
|
|
4441
4459
|
// Available options provided via column metadata — list of selectable icons
|
|
4442
4460
|
const availableIcons = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.availableIcons) !== null && _b !== void 0 ? _b : [];
|
|
4443
|
-
// iconsList maps iconCode → Iconify icon name + default colour for rendering
|
|
4444
|
-
const iconsList = (_c = columnDef.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4445
4461
|
// Prefer string headers for the Select label; fall back to accessorKey if header is a render function
|
|
4446
|
-
const label = (
|
|
4462
|
+
const label = (_c = fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.label) !== null && _c !== void 0 ? _c : (typeof columnDef.header === 'string' ? columnDef.header : name);
|
|
4447
4463
|
return (jsx(Controller, { control: control, name: name, rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.rules, render: ({ field, fieldState }) => {
|
|
4448
4464
|
var _a, _b, _c, _d;
|
|
4449
4465
|
// The form stores the iconCode string — consistent with the filter editor value shape
|
|
@@ -4456,16 +4472,20 @@ const MRT_FormIconInput = ({ name, columnDef, fieldConfig, }) => {
|
|
|
4456
4472
|
};
|
|
4457
4473
|
// Renders the selected icon + tooltip inside the collapsed Select trigger
|
|
4458
4474
|
const renderSelectedValue = (value) => {
|
|
4475
|
+
var _a;
|
|
4459
4476
|
const option = availableIcons.find((icon) => String(icon.iconType.iconCode) === value);
|
|
4460
4477
|
if (!option)
|
|
4461
4478
|
return null;
|
|
4462
4479
|
const iconDef = iconsList[value];
|
|
4463
|
-
return (jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [iconDef
|
|
4480
|
+
return (jsxs(Stack, { alignItems: "center", direction: "row", gap: 1, children: [iconDef ? (jsx(Iconify, { icon: iconDef.component, sx: { color: (_a = iconDef.defaultColor) !== null && _a !== void 0 ? _a : option.iconType.color }, width: 20 })) : (jsx(MRT_IconStatusDot, { color: option.iconType.color })), jsx(Typography, { variant: "body2", children: option.tooltip })] }));
|
|
4464
4481
|
};
|
|
4465
4482
|
return (jsxs(FormControl, { disabled: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.disabled, error: !!fieldState.error, fullWidth: true, size: (_a = fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.size) !== null && _a !== void 0 ? _a : DEFAULT_FIELD_SIZE$3, children: [jsx(InputLabel, { sx: { '&.Mui-focused': { color: 'text.primary' } }, children: label }), jsx(Select, { label: label, MenuProps: { sx: { zIndex: 1400 } }, onBlur: field.onBlur, onChange: (e) => handleChange(e.target.value), renderValue: renderSelectedValue, value: currentValue, children: availableIcons.map((icon) => {
|
|
4483
|
+
var _a;
|
|
4466
4484
|
const iconCode = String(icon.iconType.iconCode);
|
|
4467
4485
|
const iconDef = iconsList[iconCode];
|
|
4468
|
-
return (jsxs(MenuItem, { sx: { alignItems: 'center', display: 'flex', gap: 1 }, value: iconCode, children: [iconDef
|
|
4486
|
+
return (jsxs(MenuItem, { sx: { alignItems: 'center', display: 'flex', gap: 1 }, value: iconCode, children: [iconDef ? (jsx(Iconify, { icon: iconDef.component, sx: {
|
|
4487
|
+
color: (_a = iconDef.defaultColor) !== null && _a !== void 0 ? _a : icon.iconType.color,
|
|
4488
|
+
}, width: 20 })) : (jsx(MRT_IconStatusDot, { color: icon.iconType.color })), jsx(Typography, { variant: "body2", children: icon.tooltip })] }, iconCode));
|
|
4469
4489
|
}) }), (((_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) || (fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.helperText)) && (jsx(FormHelperText, { children: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.helperText }))] }));
|
|
4470
4490
|
} }));
|
|
4471
4491
|
};
|
|
@@ -4478,14 +4498,16 @@ const IconActiveFilterItem = (table, rule) => {
|
|
|
4478
4498
|
const column = getFilterColumn(table, rule.columnId);
|
|
4479
4499
|
const iconColumnDef = column === null || column === void 0 ? void 0 : column.columnDef;
|
|
4480
4500
|
const availableIcons = (_b = (_a = iconColumnDef === null || iconColumnDef === void 0 ? void 0 : iconColumnDef.meta) === null || _a === void 0 ? void 0 : _a.availableIcons) !== null && _b !== void 0 ? _b : [];
|
|
4481
|
-
|
|
4501
|
+
// Table-wide iconCode -> Iconify glyph map (table.options.iconsList)
|
|
4502
|
+
const iconsList = (_c = table.options.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4482
4503
|
const renderIconByCode = (iconCode, index) => {
|
|
4504
|
+
var _a;
|
|
4483
4505
|
const iconOption = getIconOptionByCode(iconCode, availableIcons);
|
|
4484
|
-
|
|
4485
|
-
if (!iconOption || !iconDefinition) {
|
|
4506
|
+
if (!iconOption) {
|
|
4486
4507
|
return (jsx(Typography, { variant: "body2", children: String(iconCode) }, index !== null && index !== void 0 ? index : iconCode));
|
|
4487
4508
|
}
|
|
4488
|
-
|
|
4509
|
+
const iconDef = iconsList[String(iconCode)];
|
|
4510
|
+
return (jsx(Tooltip, { title: iconOption.tooltip || iconOption.iconType.description, children: iconDef ? (jsx(Iconify, { icon: iconDef.component, sx: { color: (_a = iconDef.defaultColor) !== null && _a !== void 0 ? _a : iconOption.iconType.color }, width: 20 })) : (jsx(MRT_IconStatusDot, { color: iconOption.iconType.color })) }, index !== null && index !== void 0 ? index : iconCode));
|
|
4489
4511
|
};
|
|
4490
4512
|
if (rule.operator === 'isAnyOf' && Array.isArray(rule.value)) {
|
|
4491
4513
|
return (jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", alignItems: "center", children: rule.value.map((iconCode, index) => renderIconByCode(String(iconCode), index)) }) }));
|
|
@@ -4493,6 +4515,13 @@ const IconActiveFilterItem = (table, rule) => {
|
|
|
4493
4515
|
return (jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: renderIconByCode(String(rule.value)) }));
|
|
4494
4516
|
};
|
|
4495
4517
|
|
|
4518
|
+
// Renders the real Iconify glyph when the consumer supplied one for this
|
|
4519
|
+
// iconCode, otherwise falls back to a colored dot using the option's color.
|
|
4520
|
+
const renderIconOption$1 = (option, iconsList) => {
|
|
4521
|
+
var _a;
|
|
4522
|
+
const iconDef = iconsList[String(option.iconType.iconCode)];
|
|
4523
|
+
return iconDef ? (jsx(Iconify, { icon: iconDef.component, sx: { color: (_a = iconDef.defaultColor) !== null && _a !== void 0 ? _a : option.iconType.color }, width: 20 })) : (jsx(MRT_IconStatusDot, { color: option.iconType.color }));
|
|
4524
|
+
};
|
|
4496
4525
|
// Multi-select filter editor for icon column type.
|
|
4497
4526
|
// Used by the 'inArray' (Je bilo koje od) operator.
|
|
4498
4527
|
// Stores the selected iconCodes as string[] in the filter rule value.
|
|
@@ -4509,15 +4538,16 @@ const MRT_IconMultiValueEditor = ({ availableIcons, column, iconsList, onChange,
|
|
|
4509
4538
|
const columnLabel = typeof column.columnDef.header === 'string'
|
|
4510
4539
|
? column.columnDef.header
|
|
4511
4540
|
: column.id;
|
|
4541
|
+
// Unique per rule so multiple filter rows never collide, and the label is
|
|
4542
|
+
// properly associated with its field (fixes "no label associated"/"missing id" a11y errors).
|
|
4543
|
+
const inputId = `mrt-icon-filter-${rule.id}`;
|
|
4544
|
+
const labelId = `${inputId}-label`;
|
|
4512
4545
|
// Renders the row of selected icons inside the collapsed multi-select trigger
|
|
4513
4546
|
const renderSelectedValues = (values) => (jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", alignItems: "center", children: values.map((iconCode) => {
|
|
4514
4547
|
const option = availableIcons.find((icon) => String(icon.iconType.iconCode) === iconCode);
|
|
4515
4548
|
if (!option)
|
|
4516
4549
|
return null;
|
|
4517
|
-
|
|
4518
|
-
if (!iconDef)
|
|
4519
|
-
return null;
|
|
4520
|
-
return (jsx(Tooltip, { title: option.tooltip, children: jsx(Iconify, { icon: iconDef.icon, sx: { color: iconDef.defaultColor }, width: 20 }, iconCode) }, iconCode));
|
|
4550
|
+
return (jsx(Tooltip, { title: option.tooltip, children: renderIconOption$1(option, iconsList) }, iconCode));
|
|
4521
4551
|
}) }));
|
|
4522
4552
|
const handleChange = (event) => {
|
|
4523
4553
|
const { value } = event.target;
|
|
@@ -4525,23 +4555,21 @@ const MRT_IconMultiValueEditor = ({ availableIcons, column, iconsList, onChange,
|
|
|
4525
4555
|
const normalizedValues = typeof value === 'string' ? value.split(',') : value;
|
|
4526
4556
|
onChange(normalizedValues);
|
|
4527
4557
|
};
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
}, value: selectedValues, children: availableIcons.map((icon) => {
|
|
4535
|
-
const iconDef = iconsList[String(icon.iconType.iconCode)];
|
|
4536
|
-
return (jsxs(MenuItem, { sx: {
|
|
4537
|
-
alignItems: 'center',
|
|
4538
|
-
display: 'flex',
|
|
4539
|
-
flexDirection: 'row',
|
|
4540
|
-
gap: 1,
|
|
4541
|
-
}, value: String(icon.iconType.iconCode), children: [iconDef && (jsx(Iconify, { icon: iconDef.icon, sx: { color: iconDef.defaultColor }, width: 20 })), jsx(Typography, { variant: "body2", children: icon.tooltip })] }, String(icon.iconType.iconCode)));
|
|
4542
|
-
}) })] }));
|
|
4558
|
+
return (jsxs(FormControl, { fullWidth: true, size: "small", children: [jsx(InputLabel, { htmlFor: inputId, id: labelId, children: columnLabel }), jsx(Select, { id: inputId, label: columnLabel, labelId: labelId, MenuProps: { sx: { zIndex: 9999 } }, multiple: true, name: inputId, onChange: handleChange, renderValue: renderSelectedValues, size: "small", value: selectedValues, children: availableIcons.map((icon) => (jsxs(MenuItem, { sx: {
|
|
4559
|
+
alignItems: 'center',
|
|
4560
|
+
display: 'flex',
|
|
4561
|
+
flexDirection: 'row',
|
|
4562
|
+
gap: 1,
|
|
4563
|
+
}, value: String(icon.iconType.iconCode), children: [renderIconOption$1(icon, iconsList), jsx(Typography, { variant: "body2", children: icon.tooltip })] }, String(icon.iconType.iconCode)))) })] }));
|
|
4543
4564
|
};
|
|
4544
4565
|
|
|
4566
|
+
// Renders the real Iconify glyph when the consumer supplied one for this
|
|
4567
|
+
// iconCode, otherwise falls back to a colored dot using the option's color.
|
|
4568
|
+
const renderIconOption = (option, iconsList) => {
|
|
4569
|
+
var _a;
|
|
4570
|
+
const iconDef = iconsList[String(option.iconType.iconCode)];
|
|
4571
|
+
return iconDef ? (jsx(Iconify, { icon: iconDef.component, sx: { color: (_a = iconDef.defaultColor) !== null && _a !== void 0 ? _a : option.iconType.color }, width: 20 })) : (jsx(MRT_IconStatusDot, { color: option.iconType.color }));
|
|
4572
|
+
};
|
|
4545
4573
|
// Single-select filter editor for icon column type.
|
|
4546
4574
|
// Used by the 'is' (Je) and 'not' (Nije) operators.
|
|
4547
4575
|
// Stores the selected iconCode as a string in the filter rule value.
|
|
@@ -4556,35 +4584,57 @@ const MRT_IconSingleValueEditor = ({ availableIcons, column, iconsList, onChange
|
|
|
4556
4584
|
const columnLabel = typeof column.columnDef.header === 'string'
|
|
4557
4585
|
? column.columnDef.header
|
|
4558
4586
|
: column.id;
|
|
4587
|
+
// Unique per rule so multiple filter rows never collide, and the label is
|
|
4588
|
+
// properly associated with its field (fixes "no label associated"/"missing id" a11y errors).
|
|
4589
|
+
const inputId = `mrt-icon-filter-${rule.id}`;
|
|
4590
|
+
const labelId = `${inputId}-label`;
|
|
4559
4591
|
// Renders the selected icon + tooltip inside the collapsed Select trigger
|
|
4560
4592
|
const renderSelectedValue = (value) => {
|
|
4561
4593
|
const option = availableIcons.find((icon) => String(icon.iconType.iconCode) === value);
|
|
4562
4594
|
if (!option)
|
|
4563
4595
|
return null;
|
|
4564
|
-
|
|
4565
|
-
return (jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [iconDef && (jsx(Iconify, { icon: iconDef.icon, sx: { color: iconDef.defaultColor }, width: 20 })), jsx(Typography, { variant: "body2", children: option.tooltip })] }));
|
|
4596
|
+
return (jsxs(Stack, { direction: "row", gap: 1, alignItems: "center", children: [renderIconOption(option, iconsList), jsx(Typography, { variant: "body2", children: option.tooltip })] }));
|
|
4566
4597
|
};
|
|
4567
|
-
return (jsxs(FormControl, { fullWidth: true, size: "small", children: [jsx(InputLabel, {
|
|
4598
|
+
return (jsxs(FormControl, { fullWidth: true, size: "small", children: [jsx(InputLabel, { htmlFor: inputId, id: labelId, sx: { '&.Mui-focused': { color: 'text.primary' } }, children: columnLabel }), jsx(Select, { displayEmpty: true, id: inputId, label: columnLabel, labelId: labelId, MenuProps: { sx: { zIndex: 9999 } }, name: inputId, onChange: (event) => onChange(event.target.value), renderValue: renderSelectedValue, size: "small", sx: { '& .MuiSelect-Select': { height: 'initial' } }, SelectDisplayProps: {
|
|
4568
4599
|
style: { display: 'flex', alignItems: 'center' },
|
|
4569
|
-
}, value: currentValue, children: availableIcons.map((icon) => {
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
gap: 1,
|
|
4576
|
-
}, value: String(icon.iconType.iconCode), children: [iconDef && (jsx(Iconify, { icon: iconDef.icon, sx: { color: iconDef.defaultColor }, width: 20 })), jsx(Typography, { variant: "body2", children: icon.tooltip })] }, String(icon.iconType.iconCode)));
|
|
4577
|
-
}) })] }));
|
|
4600
|
+
}, value: currentValue, children: availableIcons.map((icon) => (jsxs(MenuItem, { sx: {
|
|
4601
|
+
alignItems: 'center',
|
|
4602
|
+
display: 'flex',
|
|
4603
|
+
flexDirection: 'row',
|
|
4604
|
+
gap: 1,
|
|
4605
|
+
}, value: String(icon.iconType.iconCode), children: [renderIconOption(icon, iconsList), jsx(Typography, { variant: "body2", children: icon.tooltip })] }, String(icon.iconType.iconCode)))) })] }));
|
|
4578
4606
|
};
|
|
4579
4607
|
|
|
4580
4608
|
const IconColumnResolver = {
|
|
4581
4609
|
createColumnDef: (column) => (Object.assign(Object.assign({}, column), { type: 'icon', Cell: ({ row, table, cell }) => {
|
|
4610
|
+
var _a, _b, _c;
|
|
4582
4611
|
const value = cell.getValue();
|
|
4583
|
-
|
|
4584
|
-
if (!iconsList[value.iconCode])
|
|
4612
|
+
if (!value)
|
|
4585
4613
|
return null;
|
|
4586
|
-
|
|
4587
|
-
|
|
4614
|
+
// Without any configured icon options this column isn't set up for icons at
|
|
4615
|
+
// all — render nothing rather than a dot backed by no real definition.
|
|
4616
|
+
const availableIcons = (_b = (_a = column.meta) === null || _a === void 0 ? void 0 : _a.availableIcons) !== null && _b !== void 0 ? _b : [];
|
|
4617
|
+
if (!availableIcons.length)
|
|
4618
|
+
return null;
|
|
4619
|
+
// meta.availableIcons carries the tooltip text per iconCode; the cell
|
|
4620
|
+
// value's own `description` is used as a fallback when no match is found.
|
|
4621
|
+
const resolveTooltip = (iconCode, fallbackDescription) => {
|
|
4622
|
+
var _a;
|
|
4623
|
+
return ((_a = availableIcons.find((option) => option.iconType.iconCode === iconCode)) === null || _a === void 0 ? void 0 : _a.tooltip) || fallbackDescription;
|
|
4624
|
+
};
|
|
4625
|
+
// Table-wide iconCode -> Iconify glyph map (table.options.iconsList).
|
|
4626
|
+
// When a code isn't in it (or no map was supplied at all), fall back to
|
|
4627
|
+
// a colored dot instead of failing to render — meta.availableIcons
|
|
4628
|
+
// always has a color at least.
|
|
4629
|
+
const iconsList = (_c = table.options.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4630
|
+
const renderStatus = (iconCode, color, forceWhite) => {
|
|
4631
|
+
var _a;
|
|
4632
|
+
const iconDef = iconsList[String(iconCode)];
|
|
4633
|
+
if (iconDef) {
|
|
4634
|
+
return (jsx(Iconify, { icon: iconDef.component, width: 20, color: forceWhite ? 'white' : ((_a = iconDef.defaultColor) !== null && _a !== void 0 ? _a : color) }));
|
|
4635
|
+
}
|
|
4636
|
+
return jsx(MRT_IconStatusDot, { color: forceWhite ? 'white' : color });
|
|
4637
|
+
};
|
|
4588
4638
|
const handleClick = (event) => {
|
|
4589
4639
|
if (column.onClickIconTypeColumn) {
|
|
4590
4640
|
column.onClickIconTypeColumn({
|
|
@@ -4595,40 +4645,43 @@ const IconColumnResolver = {
|
|
|
4595
4645
|
});
|
|
4596
4646
|
}
|
|
4597
4647
|
};
|
|
4648
|
+
const cursor = column.onClickIconTypeColumn ? 'pointer' : 'default';
|
|
4649
|
+
const { additional } = value;
|
|
4650
|
+
// Compound status — pill container (background/rounded/padded) colored by
|
|
4651
|
+
// the primary status, holding one glyph (or dot fallback) per status.
|
|
4598
4652
|
if (additional) {
|
|
4599
4653
|
return (jsxs(Box, { sx: {
|
|
4600
4654
|
display: 'flex',
|
|
4601
4655
|
gap: 0.5,
|
|
4602
4656
|
alignItems: 'center',
|
|
4603
|
-
backgroundColor:
|
|
4657
|
+
backgroundColor: (theme) => resolveStatusColor(theme, value.color),
|
|
4604
4658
|
borderRadius: 16,
|
|
4605
4659
|
p: 0.5,
|
|
4606
|
-
cursor
|
|
4607
|
-
}, onClick: handleClick, children: [jsx(Tooltip, { title: value.description, disableInteractive: true, children:
|
|
4608
|
-
const additionalIcon = iconsList[add.iconCode];
|
|
4609
|
-
if (!additionalIcon)
|
|
4610
|
-
return null;
|
|
4611
|
-
return (jsx(Tooltip, { title: add.description, disableInteractive: true, children: jsx(Iconify, { icon: additionalIcon.icon, color: "white" }) }, index));
|
|
4612
|
-
})] }));
|
|
4660
|
+
cursor,
|
|
4661
|
+
}, onClick: handleClick, children: [jsx(Tooltip, { title: resolveTooltip(value.iconCode, value.description), disableInteractive: true, children: renderStatus(value.iconCode, value.color, true) }), Object.values(additional).map((add, index) => (jsx(Tooltip, { title: resolveTooltip(add.iconCode, add.description), disableInteractive: true, children: renderStatus(add.iconCode, add.color, true) }, index)))] }));
|
|
4613
4662
|
}
|
|
4614
|
-
return (jsx(Tooltip, { title: value.description, disableInteractive: true, children: jsx(IconButton, {
|
|
4663
|
+
return (jsx(Tooltip, { title: resolveTooltip(value.iconCode, value.description), disableInteractive: true, children: jsx(IconButton, { disableRipple: true, onClick: handleClick, sx: { p: 0, cursor }, children: renderStatus(value.iconCode, value.color) }) }));
|
|
4615
4664
|
} })),
|
|
4616
4665
|
getFilterOperators: (column) => {
|
|
4617
|
-
var _a, _b
|
|
4666
|
+
var _a, _b;
|
|
4618
4667
|
// Available selectable icon options come from backend-provided column metadata
|
|
4619
4668
|
const availableIcons = (_b = (_a = column.meta) === null || _a === void 0 ? void 0 : _a.availableIcons) !== null && _b !== void 0 ? _b : [];
|
|
4620
|
-
// Safe cast for iconsList — this resolver is only registered for icon columns in registy.ts
|
|
4621
|
-
const iconsList = (_c = column.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4622
4669
|
// Without available options no meaningful filter can be built
|
|
4623
4670
|
if (!availableIcons.length) {
|
|
4624
4671
|
return [];
|
|
4625
4672
|
}
|
|
4626
4673
|
// Single-select editor factory — used by 'is' and 'not'
|
|
4627
|
-
const createSingleSelectEditor = (props) =>
|
|
4628
|
-
|
|
4674
|
+
const createSingleSelectEditor = (props) => {
|
|
4675
|
+
var _a;
|
|
4676
|
+
return MRT_IconSingleValueEditor(Object.assign(Object.assign({}, props), { availableIcons,
|
|
4677
|
+
// Table-wide iconCode -> Iconify glyph map (table.options.iconsList)
|
|
4678
|
+
iconsList: (_a = props.table.options.iconsList) !== null && _a !== void 0 ? _a : {} }));
|
|
4679
|
+
};
|
|
4629
4680
|
// Multi-select editor factory — used by 'inArray'
|
|
4630
|
-
const createMultiSelectEditor = (props) =>
|
|
4631
|
-
|
|
4681
|
+
const createMultiSelectEditor = (props) => {
|
|
4682
|
+
var _a;
|
|
4683
|
+
return MRT_IconMultiValueEditor(Object.assign(Object.assign({}, props), { availableIcons, iconsList: (_a = props.table.options.iconsList) !== null && _a !== void 0 ? _a : {} }));
|
|
4684
|
+
};
|
|
4632
4685
|
return [
|
|
4633
4686
|
{
|
|
4634
4687
|
// 'Je' — selected iconCode must match the cell value exactly
|
|
@@ -4661,11 +4714,13 @@ const IconColumnResolver = {
|
|
|
4661
4714
|
];
|
|
4662
4715
|
},
|
|
4663
4716
|
activeFilterRenderer: IconActiveFilterItem,
|
|
4664
|
-
getFormFieldRenderer: (column) => {
|
|
4665
|
-
var _a;
|
|
4717
|
+
getFormFieldRenderer: (column, table) => {
|
|
4718
|
+
var _a, _b;
|
|
4666
4719
|
// Cast TValue to string | null — icon fields store the selected iconCode string
|
|
4667
4720
|
const fieldConfig = (_a = column.formField) !== null && _a !== void 0 ? _a : null;
|
|
4668
|
-
|
|
4721
|
+
// Table-wide iconCode -> Iconify glyph map (table.options.iconsList)
|
|
4722
|
+
const iconsList = (_b = table.options.iconsList) !== null && _b !== void 0 ? _b : {};
|
|
4723
|
+
return ({ name, columnDef }) => (jsx(MRT_FormIconInput, { columnDef: columnDef, fieldConfig: fieldConfig, iconsList: iconsList, name: name }));
|
|
4669
4724
|
},
|
|
4670
4725
|
};
|
|
4671
4726
|
|
|
@@ -5624,7 +5679,12 @@ const Inner = ({ children }) => {
|
|
|
5624
5679
|
const hasProvider = useHasSnackbarProvider();
|
|
5625
5680
|
if (hasProvider)
|
|
5626
5681
|
return jsx(Fragment, { children: children });
|
|
5627
|
-
return (jsx(SnackbarProvider, { maxSnack: 5, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, children:
|
|
5682
|
+
return (jsx(SnackbarProvider, { maxSnack: 5, anchorOrigin: { vertical: 'bottom', horizontal: 'right' }, children:
|
|
5683
|
+
// Cast needed because notistack's bundled types predate a @types/react
|
|
5684
|
+
// 19.2 change to ReactPortal's shape, which they haven't caught up to
|
|
5685
|
+
// yet — this is a types-only mismatch, not an actual runtime issue.
|
|
5686
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5687
|
+
children }));
|
|
5628
5688
|
};
|
|
5629
5689
|
// Wraps children with SnackbarProvider only when no provider exists in the tree.
|
|
5630
5690
|
// When the user's app already has a SnackbarProvider, notifications from MRT
|
|
@@ -8529,7 +8589,7 @@ const MRT_TablePaper = (_a) => {
|
|
|
8529
8589
|
//@ts-expect-error
|
|
8530
8590
|
paperProps.ref.current = ref;
|
|
8531
8591
|
}
|
|
8532
|
-
}, style: Object.assign({}, paperProps === null || paperProps === void 0 ? void 0 : paperProps.style), sx: (theme) => (Object.assign({ backgroundImage: 'unset', borderRadius: 0, display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(paperProps === null || paperProps === void 0 ? void 0 : paperProps.sx, theme))), children: [jsx(MRT_QuickFiltersBar, { table: table }), jsx(MRT_ActiveFilters, { table: table }), enableTopToolbar &&
|
|
8592
|
+
}, style: Object.assign({}, paperProps === null || paperProps === void 0 ? void 0 : paperProps.style), sx: (theme) => (Object.assign({ backgroundImage: 'unset', borderRadius: 0, display: 'flex', flexDirection: 'column', height: '100%', overflow: 'hidden', transition: 'all 100ms ease-in-out' }, parseFromValuesOrFunc(paperProps === null || paperProps === void 0 ? void 0 : paperProps.sx, theme))), children: [jsxs(FormControl, { children: [jsx(InputLabel, { children: "Test" }), jsxs(Select, { children: [jsx(MenuItem, { children: "Test 1" }), jsx(MenuItem, { children: "Test 2" }), jsx(MenuItem, { children: "Test 3" })] })] }), jsx(MRT_QuickFiltersBar, { table: table }), jsx(MRT_ActiveFilters, { table: table }), enableTopToolbar &&
|
|
8533
8593
|
((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsx(MRT_TopToolbar, { table: table }))), jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
|
8534
8594
|
((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsx(MRT_BottomToolbar, { table: table })))] })));
|
|
8535
8595
|
};
|