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