@dooherceg/material-react-table 3.2.13 → 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 +76 -65
- package/dist/index.esm.js +182 -108
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +182 -108
- package/dist/index.js.map +1 -1
- package/locales/de/index.esm.js +5 -0
- package/locales/de/index.js +5 -0
- package/locales/en/index.esm.js +5 -0
- package/locales/en/index.js +5 -0
- package/locales/fr/index.esm.js +6 -1
- package/locales/fr/index.js +6 -1
- package/locales/hr/index.esm.js +5 -0
- package/locales/hr/index.js +5 -0
- package/locales/nl/index.esm.js +5 -0
- package/locales/nl/index.js +5 -0
- 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
|
});
|
|
@@ -2335,6 +2335,11 @@ const MRT_Localization_EN = {
|
|
|
2335
2335
|
filterEndsWith: 'Ends With',
|
|
2336
2336
|
filterEquals: 'Equals',
|
|
2337
2337
|
filterEqualsString: 'Equals',
|
|
2338
|
+
filterIs: 'Is',
|
|
2339
|
+
filterNot: 'Not',
|
|
2340
|
+
filterBefore: 'Before',
|
|
2341
|
+
filterAfter: 'After',
|
|
2342
|
+
filterRange: 'Range',
|
|
2338
2343
|
filterFuzzy: 'Fuzzy',
|
|
2339
2344
|
filterGreaterThan: 'Greater Than',
|
|
2340
2345
|
filterGreaterThanOrEqualTo: 'Greater Than Or Equal To',
|
|
@@ -3799,10 +3804,10 @@ const BooleanColumnResolver = {
|
|
|
3799
3804
|
// A boolean filter only makes sense as equality — true or false
|
|
3800
3805
|
editComponent: MRT_FilterRuleBooleanEditor,
|
|
3801
3806
|
getInitialValue: () => '',
|
|
3802
|
-
id: '
|
|
3807
|
+
id: 'is',
|
|
3803
3808
|
// Empty unless the user has explicitly picked true or false
|
|
3804
3809
|
isValueEmpty: (value) => value !== true && value !== false,
|
|
3805
|
-
label: '
|
|
3810
|
+
label: 'Is',
|
|
3806
3811
|
valueShape: 'single',
|
|
3807
3812
|
},
|
|
3808
3813
|
],
|
|
@@ -3945,7 +3950,7 @@ const DateColumnResolver = {
|
|
|
3945
3950
|
{
|
|
3946
3951
|
editComponent: MRT_FilterRuleDateEditor,
|
|
3947
3952
|
getInitialValue: () => null,
|
|
3948
|
-
id: '
|
|
3953
|
+
id: 'before',
|
|
3949
3954
|
// null means no date selected
|
|
3950
3955
|
isValueEmpty: (value) => !value,
|
|
3951
3956
|
label: 'Before',
|
|
@@ -3954,7 +3959,7 @@ const DateColumnResolver = {
|
|
|
3954
3959
|
{
|
|
3955
3960
|
editComponent: MRT_FilterRuleDateEditor,
|
|
3956
3961
|
getInitialValue: () => null,
|
|
3957
|
-
id: '
|
|
3962
|
+
id: 'after',
|
|
3958
3963
|
isValueEmpty: (value) => !value,
|
|
3959
3964
|
label: 'After',
|
|
3960
3965
|
valueShape: 'single',
|
|
@@ -3963,7 +3968,7 @@ const DateColumnResolver = {
|
|
|
3963
3968
|
// Range value is stored as {from, to} Unix ms timestamps
|
|
3964
3969
|
editComponent: MRT_FilterRuleRangeDateEditor,
|
|
3965
3970
|
getInitialValue: () => ({ from: null, to: null }),
|
|
3966
|
-
id: '
|
|
3971
|
+
id: 'range',
|
|
3967
3972
|
isValueEmpty: (value) => {
|
|
3968
3973
|
const v = value;
|
|
3969
3974
|
return !v || !v.from || !v.to;
|
|
@@ -4114,7 +4119,7 @@ const DateTimeColumnResolver = {
|
|
|
4114
4119
|
{
|
|
4115
4120
|
editComponent: MRT_FilterRuleDateTimeEditor,
|
|
4116
4121
|
getInitialValue: () => null,
|
|
4117
|
-
id: '
|
|
4122
|
+
id: 'before',
|
|
4118
4123
|
// null means no datetime selected
|
|
4119
4124
|
isValueEmpty: (value) => !value,
|
|
4120
4125
|
label: 'Before',
|
|
@@ -4123,7 +4128,7 @@ const DateTimeColumnResolver = {
|
|
|
4123
4128
|
{
|
|
4124
4129
|
editComponent: MRT_FilterRuleDateTimeEditor,
|
|
4125
4130
|
getInitialValue: () => null,
|
|
4126
|
-
id: '
|
|
4131
|
+
id: 'after',
|
|
4127
4132
|
isValueEmpty: (value) => !value,
|
|
4128
4133
|
label: 'After',
|
|
4129
4134
|
valueShape: 'single',
|
|
@@ -4132,7 +4137,7 @@ const DateTimeColumnResolver = {
|
|
|
4132
4137
|
// Range value is stored as {from, to} Unix ms timestamps
|
|
4133
4138
|
editComponent: MRT_FilterRuleRangeDateTimeEditor,
|
|
4134
4139
|
getInitialValue: () => ({ from: null, to: null }),
|
|
4135
|
-
id: '
|
|
4140
|
+
id: 'range',
|
|
4136
4141
|
isValueEmpty: (value) => {
|
|
4137
4142
|
const v = value;
|
|
4138
4143
|
return !v || !v.from || !v.to;
|
|
@@ -4281,7 +4286,7 @@ const DimensionColumnResolver = {
|
|
|
4281
4286
|
{
|
|
4282
4287
|
editComponent: MRT_DimensionFilterEditor,
|
|
4283
4288
|
getInitialValue: () => ({}),
|
|
4284
|
-
id: '
|
|
4289
|
+
id: 'is',
|
|
4285
4290
|
// Value is empty when no dimension field has been filled in (ignoring rotation)
|
|
4286
4291
|
isValueEmpty: (value) => {
|
|
4287
4292
|
const dimensionValue = value;
|
|
@@ -4290,7 +4295,7 @@ const DimensionColumnResolver = {
|
|
|
4290
4295
|
const fieldKeys = Object.keys(dimensionValue).filter((key) => key !== 'rotation');
|
|
4291
4296
|
return fieldKeys.every((key) => dimensionValue[key] == null);
|
|
4292
4297
|
},
|
|
4293
|
-
label: '
|
|
4298
|
+
label: 'Is',
|
|
4294
4299
|
valueShape: 'single',
|
|
4295
4300
|
},
|
|
4296
4301
|
],
|
|
@@ -4382,7 +4387,7 @@ const EnumColumnResolver = {
|
|
|
4382
4387
|
if (!enumOptions.length) {
|
|
4383
4388
|
return [];
|
|
4384
4389
|
}
|
|
4385
|
-
// Shared single-select editor factory — used by '
|
|
4390
|
+
// Shared single-select editor factory — used by 'is' and 'not'
|
|
4386
4391
|
const createSingleSelectEditor = (props) => MRT_SingleValueEditor(Object.assign(Object.assign({}, props), { options: enumOptions }));
|
|
4387
4392
|
// Multi-select editor factory — used by 'inArray'
|
|
4388
4393
|
const createMultiSelectEditor = (props) => MRT_MultiValueEditor(Object.assign(Object.assign({}, props), { options: enumOptions }));
|
|
@@ -4391,18 +4396,18 @@ const EnumColumnResolver = {
|
|
|
4391
4396
|
// 'Je' — single value must match exactly
|
|
4392
4397
|
editComponent: createSingleSelectEditor,
|
|
4393
4398
|
getInitialValue: () => '',
|
|
4394
|
-
id: '
|
|
4399
|
+
id: 'is',
|
|
4395
4400
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4396
|
-
label: '
|
|
4401
|
+
label: 'Is',
|
|
4397
4402
|
valueShape: 'single',
|
|
4398
4403
|
},
|
|
4399
4404
|
{
|
|
4400
4405
|
// 'Nije' — single value must not match
|
|
4401
4406
|
editComponent: createSingleSelectEditor,
|
|
4402
4407
|
getInitialValue: () => '',
|
|
4403
|
-
id: '
|
|
4408
|
+
id: 'not',
|
|
4404
4409
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4405
|
-
label: 'Not
|
|
4410
|
+
label: 'Not',
|
|
4406
4411
|
valueShape: 'single',
|
|
4407
4412
|
},
|
|
4408
4413
|
{
|
|
@@ -4426,21 +4431,37 @@ const EnumColumnResolver = {
|
|
|
4426
4431
|
activeFilterRenderer: EnumActiveFilterItem,
|
|
4427
4432
|
};
|
|
4428
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
|
+
|
|
4429
4452
|
const Iconify = react.forwardRef((_a, ref) => {
|
|
4430
4453
|
var { icon, width = 20, sx } = _a, other = __rest(_a, ["icon", "width", "sx"]);
|
|
4431
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)));
|
|
4432
4455
|
});
|
|
4433
4456
|
|
|
4434
4457
|
const DEFAULT_FIELD_SIZE$3 = 'small';
|
|
4435
|
-
const MRT_FormIconInput = ({ name, columnDef, fieldConfig, }) => {
|
|
4436
|
-
var _a, _b, _c
|
|
4458
|
+
const MRT_FormIconInput = ({ name, columnDef, fieldConfig, iconsList, }) => {
|
|
4459
|
+
var _a, _b, _c;
|
|
4437
4460
|
const { control } = reactHookForm.useFormContext();
|
|
4438
4461
|
// Available options provided via column metadata — list of selectable icons
|
|
4439
4462
|
const availableIcons = (_b = (_a = columnDef.meta) === null || _a === void 0 ? void 0 : _a.availableIcons) !== null && _b !== void 0 ? _b : [];
|
|
4440
|
-
// iconsList maps iconCode → Iconify icon name + default colour for rendering
|
|
4441
|
-
const iconsList = (_c = columnDef.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4442
4463
|
// Prefer string headers for the Select label; fall back to accessorKey if header is a render function
|
|
4443
|
-
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);
|
|
4444
4465
|
return (jsxRuntime.jsx(reactHookForm.Controller, { control: control, name: name, rules: fieldConfig === null || fieldConfig === void 0 ? void 0 : fieldConfig.rules, render: ({ field, fieldState }) => {
|
|
4445
4466
|
var _a, _b, _c, _d;
|
|
4446
4467
|
// The form stores the iconCode string — consistent with the filter editor value shape
|
|
@@ -4453,16 +4474,20 @@ const MRT_FormIconInput = ({ name, columnDef, fieldConfig, }) => {
|
|
|
4453
4474
|
};
|
|
4454
4475
|
// Renders the selected icon + tooltip inside the collapsed Select trigger
|
|
4455
4476
|
const renderSelectedValue = (value) => {
|
|
4477
|
+
var _a;
|
|
4456
4478
|
const option = availableIcons.find((icon) => String(icon.iconType.iconCode) === value);
|
|
4457
4479
|
if (!option)
|
|
4458
4480
|
return null;
|
|
4459
4481
|
const iconDef = iconsList[value];
|
|
4460
|
-
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 })] }));
|
|
4461
4483
|
};
|
|
4462
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;
|
|
4463
4486
|
const iconCode = String(icon.iconType.iconCode);
|
|
4464
4487
|
const iconDef = iconsList[iconCode];
|
|
4465
|
-
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));
|
|
4466
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 }))] }));
|
|
4467
4492
|
} }));
|
|
4468
4493
|
};
|
|
@@ -4475,14 +4500,16 @@ const IconActiveFilterItem = (table, rule) => {
|
|
|
4475
4500
|
const column = getFilterColumn(table, rule.columnId);
|
|
4476
4501
|
const iconColumnDef = column === null || column === void 0 ? void 0 : column.columnDef;
|
|
4477
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 : [];
|
|
4478
|
-
|
|
4503
|
+
// Table-wide iconCode -> Iconify glyph map (table.options.iconsList)
|
|
4504
|
+
const iconsList = (_c = table.options.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4479
4505
|
const renderIconByCode = (iconCode, index) => {
|
|
4506
|
+
var _a;
|
|
4480
4507
|
const iconOption = getIconOptionByCode(iconCode, availableIcons);
|
|
4481
|
-
|
|
4482
|
-
if (!iconOption || !iconDefinition) {
|
|
4508
|
+
if (!iconOption) {
|
|
4483
4509
|
return (jsxRuntime.jsx(Typography, { variant: "body2", children: String(iconCode) }, index !== null && index !== void 0 ? index : iconCode));
|
|
4484
4510
|
}
|
|
4485
|
-
|
|
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));
|
|
4486
4513
|
};
|
|
4487
4514
|
if (rule.operator === 'isAnyOf' && Array.isArray(rule.value)) {
|
|
4488
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)) }) }));
|
|
@@ -4490,6 +4517,13 @@ const IconActiveFilterItem = (table, rule) => {
|
|
|
4490
4517
|
return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: renderIconByCode(String(rule.value)) }));
|
|
4491
4518
|
};
|
|
4492
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
|
+
};
|
|
4493
4527
|
// Multi-select filter editor for icon column type.
|
|
4494
4528
|
// Used by the 'inArray' (Je bilo koje od) operator.
|
|
4495
4529
|
// Stores the selected iconCodes as string[] in the filter rule value.
|
|
@@ -4506,15 +4540,16 @@ const MRT_IconMultiValueEditor = ({ availableIcons, column, iconsList, onChange,
|
|
|
4506
4540
|
const columnLabel = typeof column.columnDef.header === 'string'
|
|
4507
4541
|
? column.columnDef.header
|
|
4508
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`;
|
|
4509
4547
|
// Renders the row of selected icons inside the collapsed multi-select trigger
|
|
4510
4548
|
const renderSelectedValues = (values) => (jsxRuntime.jsx(Stack, { direction: "row", gap: 0.5, flexWrap: "wrap", alignItems: "center", children: values.map((iconCode) => {
|
|
4511
4549
|
const option = availableIcons.find((icon) => String(icon.iconType.iconCode) === iconCode);
|
|
4512
4550
|
if (!option)
|
|
4513
4551
|
return null;
|
|
4514
|
-
|
|
4515
|
-
if (!iconDef)
|
|
4516
|
-
return null;
|
|
4517
|
-
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));
|
|
4518
4553
|
}) }));
|
|
4519
4554
|
const handleChange = (event) => {
|
|
4520
4555
|
const { value } = event.target;
|
|
@@ -4522,25 +4557,23 @@ const MRT_IconMultiValueEditor = ({ availableIcons, column, iconsList, onChange,
|
|
|
4522
4557
|
const normalizedValues = typeof value === 'string' ? value.split(',') : value;
|
|
4523
4558
|
onChange(normalizedValues);
|
|
4524
4559
|
};
|
|
4525
|
-
|
|
4526
|
-
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
}, value: selectedValues, children: availableIcons.map((icon) => {
|
|
4532
|
-
const iconDef = iconsList[String(icon.iconType.iconCode)];
|
|
4533
|
-
return (jsxRuntime.jsxs(MenuItem, { sx: {
|
|
4534
|
-
alignItems: 'center',
|
|
4535
|
-
display: 'flex',
|
|
4536
|
-
flexDirection: 'row',
|
|
4537
|
-
gap: 1,
|
|
4538
|
-
}, 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)));
|
|
4539
|
-
}) })] }));
|
|
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)))) })] }));
|
|
4540
4566
|
};
|
|
4541
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
|
+
};
|
|
4542
4575
|
// Single-select filter editor for icon column type.
|
|
4543
|
-
// Used by the '
|
|
4576
|
+
// Used by the 'is' (Je) and 'not' (Nije) operators.
|
|
4544
4577
|
// Stores the selected iconCode as a string in the filter rule value.
|
|
4545
4578
|
const MRT_IconSingleValueEditor = ({ availableIcons, column, iconsList, onChange, rule, table, }) => {
|
|
4546
4579
|
// Render a localised fallback when no options are available (guard against misconfigured columns)
|
|
@@ -4553,35 +4586,57 @@ const MRT_IconSingleValueEditor = ({ availableIcons, column, iconsList, onChange
|
|
|
4553
4586
|
const columnLabel = typeof column.columnDef.header === 'string'
|
|
4554
4587
|
? column.columnDef.header
|
|
4555
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`;
|
|
4556
4593
|
// Renders the selected icon + tooltip inside the collapsed Select trigger
|
|
4557
4594
|
const renderSelectedValue = (value) => {
|
|
4558
4595
|
const option = availableIcons.find((icon) => String(icon.iconType.iconCode) === value);
|
|
4559
4596
|
if (!option)
|
|
4560
4597
|
return null;
|
|
4561
|
-
|
|
4562
|
-
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 })] }));
|
|
4563
4599
|
};
|
|
4564
|
-
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, sx: { '&.Mui-focused': { color: 'text.primary' } }, children: columnLabel }), jsxRuntime.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: {
|
|
4565
4601
|
style: { display: 'flex', alignItems: 'center' },
|
|
4566
|
-
}, value: currentValue, children: availableIcons.map((icon) => {
|
|
4567
|
-
|
|
4568
|
-
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
gap: 1,
|
|
4573
|
-
}, 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)));
|
|
4574
|
-
}) })] }));
|
|
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)))) })] }));
|
|
4575
4608
|
};
|
|
4576
4609
|
|
|
4577
4610
|
const IconColumnResolver = {
|
|
4578
4611
|
createColumnDef: (column) => (Object.assign(Object.assign({}, column), { type: 'icon', Cell: ({ row, table, cell }) => {
|
|
4612
|
+
var _a, _b, _c;
|
|
4579
4613
|
const value = cell.getValue();
|
|
4580
|
-
|
|
4581
|
-
if (!iconsList[value.iconCode])
|
|
4614
|
+
if (!value)
|
|
4582
4615
|
return null;
|
|
4583
|
-
|
|
4584
|
-
|
|
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
|
+
};
|
|
4585
4640
|
const handleClick = (event) => {
|
|
4586
4641
|
if (column.onClickIconTypeColumn) {
|
|
4587
4642
|
column.onClickIconTypeColumn({
|
|
@@ -4592,57 +4647,60 @@ const IconColumnResolver = {
|
|
|
4592
4647
|
});
|
|
4593
4648
|
}
|
|
4594
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.
|
|
4595
4654
|
if (additional) {
|
|
4596
4655
|
return (jsxRuntime.jsxs(Box, { sx: {
|
|
4597
4656
|
display: 'flex',
|
|
4598
4657
|
gap: 0.5,
|
|
4599
4658
|
alignItems: 'center',
|
|
4600
|
-
backgroundColor:
|
|
4659
|
+
backgroundColor: (theme) => resolveStatusColor(theme, value.color),
|
|
4601
4660
|
borderRadius: 16,
|
|
4602
4661
|
p: 0.5,
|
|
4603
|
-
cursor
|
|
4604
|
-
}, onClick: handleClick, children: [jsxRuntime.jsx(Tooltip, { title: value.description, disableInteractive: true, children:
|
|
4605
|
-
const additionalIcon = iconsList[add.iconCode];
|
|
4606
|
-
if (!additionalIcon)
|
|
4607
|
-
return null;
|
|
4608
|
-
return (jsxRuntime.jsx(Tooltip, { title: add.description, disableInteractive: true, children: jsxRuntime.jsx(Iconify, { icon: additionalIcon.icon, color: "white" }) }, index));
|
|
4609
|
-
})] }));
|
|
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)))] }));
|
|
4610
4664
|
}
|
|
4611
|
-
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) }) }));
|
|
4612
4666
|
} })),
|
|
4613
4667
|
getFilterOperators: (column) => {
|
|
4614
|
-
var _a, _b
|
|
4668
|
+
var _a, _b;
|
|
4615
4669
|
// Available selectable icon options come from backend-provided column metadata
|
|
4616
4670
|
const availableIcons = (_b = (_a = column.meta) === null || _a === void 0 ? void 0 : _a.availableIcons) !== null && _b !== void 0 ? _b : [];
|
|
4617
|
-
// Safe cast for iconsList — this resolver is only registered for icon columns in registy.ts
|
|
4618
|
-
const iconsList = (_c = column.iconsList) !== null && _c !== void 0 ? _c : {};
|
|
4619
4671
|
// Without available options no meaningful filter can be built
|
|
4620
4672
|
if (!availableIcons.length) {
|
|
4621
4673
|
return [];
|
|
4622
4674
|
}
|
|
4623
|
-
// Single-select editor factory — used by '
|
|
4624
|
-
const createSingleSelectEditor = (props) =>
|
|
4625
|
-
|
|
4675
|
+
// Single-select editor factory — used by 'is' and 'not'
|
|
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
|
+
};
|
|
4626
4682
|
// Multi-select editor factory — used by 'inArray'
|
|
4627
|
-
const createMultiSelectEditor = (props) =>
|
|
4628
|
-
|
|
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
|
+
};
|
|
4629
4687
|
return [
|
|
4630
4688
|
{
|
|
4631
4689
|
// 'Je' — selected iconCode must match the cell value exactly
|
|
4632
4690
|
editComponent: createSingleSelectEditor,
|
|
4633
4691
|
getInitialValue: () => '',
|
|
4634
|
-
id: '
|
|
4692
|
+
id: 'is',
|
|
4635
4693
|
isValueEmpty: (value) => value === '' || value == null,
|
|
4636
|
-
label: '
|
|
4694
|
+
label: 'Is',
|
|
4637
4695
|
valueShape: 'single',
|
|
4638
4696
|
},
|
|
4639
4697
|
{
|
|
4640
4698
|
// 'Nije' — selected iconCode must not match the cell value
|
|
4641
4699
|
editComponent: createSingleSelectEditor,
|
|
4642
4700
|
getInitialValue: () => '',
|
|
4643
|
-
id: '
|
|
4701
|
+
id: 'not',
|
|
4644
4702
|
isValueEmpty: (value) => value === '' || value == null,
|
|
4645
|
-
label: 'Not
|
|
4703
|
+
label: 'Not',
|
|
4646
4704
|
valueShape: 'single',
|
|
4647
4705
|
},
|
|
4648
4706
|
{
|
|
@@ -4658,11 +4716,13 @@ const IconColumnResolver = {
|
|
|
4658
4716
|
];
|
|
4659
4717
|
},
|
|
4660
4718
|
activeFilterRenderer: IconActiveFilterItem,
|
|
4661
|
-
getFormFieldRenderer: (column) => {
|
|
4662
|
-
var _a;
|
|
4719
|
+
getFormFieldRenderer: (column, table) => {
|
|
4720
|
+
var _a, _b;
|
|
4663
4721
|
// Cast TValue to string | null — icon fields store the selected iconCode string
|
|
4664
4722
|
const fieldConfig = (_a = column.formField) !== null && _a !== void 0 ? _a : null;
|
|
4665
|
-
|
|
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 }));
|
|
4666
4726
|
},
|
|
4667
4727
|
};
|
|
4668
4728
|
|
|
@@ -4685,9 +4745,6 @@ const MRT_FormNumberInput = ({ name, columnDef, fieldConfig, }) => {
|
|
|
4685
4745
|
const NumberActiveFilterItem = (table, rule) => {
|
|
4686
4746
|
if (typeof rule.value !== 'number' && !Array.isArray(rule.value))
|
|
4687
4747
|
return null;
|
|
4688
|
-
if (rule.operator === 'between' && Array.isArray(rule.value)) {
|
|
4689
|
-
return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: `${rule.value[0]} - ${rule.value[1]}` }) }));
|
|
4690
|
-
}
|
|
4691
4748
|
if (rule.operator === 'isAnyOf' && Array.isArray(rule.value)) {
|
|
4692
4749
|
return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: rule.value.join(', ') }) }));
|
|
4693
4750
|
}
|
|
@@ -4703,7 +4760,7 @@ const NumberColumnResolver = {
|
|
|
4703
4760
|
{
|
|
4704
4761
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4705
4762
|
getInitialValue: () => '',
|
|
4706
|
-
id: '
|
|
4763
|
+
id: '=',
|
|
4707
4764
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4708
4765
|
label: 'Equals',
|
|
4709
4766
|
triggerMode: 'commit',
|
|
@@ -4713,7 +4770,7 @@ const NumberColumnResolver = {
|
|
|
4713
4770
|
// Mirrors MUI != operator — cell value must not equal the entered number
|
|
4714
4771
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4715
4772
|
getInitialValue: () => '',
|
|
4716
|
-
id: '
|
|
4773
|
+
id: '!=',
|
|
4717
4774
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4718
4775
|
label: 'Not Equals',
|
|
4719
4776
|
triggerMode: 'commit',
|
|
@@ -4722,7 +4779,7 @@ const NumberColumnResolver = {
|
|
|
4722
4779
|
{
|
|
4723
4780
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4724
4781
|
getInitialValue: () => '',
|
|
4725
|
-
id: '
|
|
4782
|
+
id: '>',
|
|
4726
4783
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4727
4784
|
label: 'Greater Than',
|
|
4728
4785
|
triggerMode: 'commit',
|
|
@@ -4731,7 +4788,7 @@ const NumberColumnResolver = {
|
|
|
4731
4788
|
{
|
|
4732
4789
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4733
4790
|
getInitialValue: () => '',
|
|
4734
|
-
id: '
|
|
4791
|
+
id: '>=',
|
|
4735
4792
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4736
4793
|
label: 'Greater Than Or Equal To',
|
|
4737
4794
|
triggerMode: 'commit',
|
|
@@ -4740,7 +4797,7 @@ const NumberColumnResolver = {
|
|
|
4740
4797
|
{
|
|
4741
4798
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4742
4799
|
getInitialValue: () => '',
|
|
4743
|
-
id: '
|
|
4800
|
+
id: '<',
|
|
4744
4801
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4745
4802
|
label: 'Less Than',
|
|
4746
4803
|
triggerMode: 'commit',
|
|
@@ -4749,7 +4806,7 @@ const NumberColumnResolver = {
|
|
|
4749
4806
|
{
|
|
4750
4807
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4751
4808
|
getInitialValue: () => '',
|
|
4752
|
-
id: '
|
|
4809
|
+
id: '<=',
|
|
4753
4810
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4754
4811
|
label: 'Less Than Or Equal To',
|
|
4755
4812
|
triggerMode: 'commit',
|
|
@@ -4852,7 +4909,7 @@ const StringColumnResolver = {
|
|
|
4852
4909
|
// Mirrors MUI doesNotEqual — text must not match the cell value exactly
|
|
4853
4910
|
editComponent: MRT_FilterRuleTextEditor,
|
|
4854
4911
|
getInitialValue: () => '',
|
|
4855
|
-
id: '
|
|
4912
|
+
id: 'doesNotEqual',
|
|
4856
4913
|
isValueEmpty: (value) => !`${value !== null && value !== void 0 ? value : ''}`.trim(),
|
|
4857
4914
|
label: 'Does Not Equal',
|
|
4858
4915
|
triggerMode: 'commit',
|
|
@@ -4880,7 +4937,7 @@ const StringColumnResolver = {
|
|
|
4880
4937
|
// Mirrors MUI doesNotContain — cell value must not include the typed substring
|
|
4881
4938
|
editComponent: MRT_FilterRuleTextEditor,
|
|
4882
4939
|
getInitialValue: () => '',
|
|
4883
|
-
id: '
|
|
4940
|
+
id: 'doesNotContain',
|
|
4884
4941
|
isValueEmpty: (value) => !`${value !== null && value !== void 0 ? value : ''}`.trim(),
|
|
4885
4942
|
label: 'Does Not Contain',
|
|
4886
4943
|
triggerMode: 'commit',
|
|
@@ -4960,25 +5017,31 @@ const getColumnFilterOperators = (column) => {
|
|
|
4960
5017
|
// Lookup map: operator id → localization key.
|
|
4961
5018
|
// Using a map avoids a long switch statement and makes it easy to extend.
|
|
4962
5019
|
const OPERATOR_LOCALIZATION_KEYS = {
|
|
4963
|
-
|
|
5020
|
+
'!=': 'filterNotEquals',
|
|
5021
|
+
'<': 'filterLessThan',
|
|
5022
|
+
'<=': 'filterLessThanOrEqualTo',
|
|
5023
|
+
'=': 'filterEquals',
|
|
5024
|
+
'>': 'filterGreaterThan',
|
|
5025
|
+
'>=': 'filterGreaterThanOrEqualTo',
|
|
5026
|
+
after: 'filterAfter',
|
|
5027
|
+
before: 'filterBefore',
|
|
4964
5028
|
contains: 'filterContains',
|
|
4965
5029
|
'current-month': 'filterCurrentMonth',
|
|
4966
5030
|
'current-week': 'filterCurrentWeek',
|
|
5031
|
+
doesNotContain: 'filterNotContains',
|
|
5032
|
+
doesNotEqual: 'filterNotEquals',
|
|
4967
5033
|
endsWith: 'filterEndsWith',
|
|
4968
5034
|
equals: 'filterEquals',
|
|
4969
5035
|
'from-today': 'filterFromToday',
|
|
4970
|
-
|
|
4971
|
-
greaterThanOrEqualTo: 'filterGreaterThanOrEqualTo',
|
|
5036
|
+
is: 'filterIs',
|
|
4972
5037
|
isAnyOf: 'filterIsAnyOf',
|
|
4973
5038
|
isEmpty: 'filterEmpty',
|
|
4974
5039
|
isNotEmpty: 'filterNotEmpty',
|
|
4975
5040
|
'last-7-days': 'filterLast7Days',
|
|
4976
5041
|
'last-month': 'filterLastMonth',
|
|
4977
5042
|
'last-week': 'filterLastWeek',
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
notContains: 'filterNotContains',
|
|
4981
|
-
notEquals: 'filterNotEquals',
|
|
5043
|
+
not: 'filterNot',
|
|
5044
|
+
range: 'filterRange',
|
|
4982
5045
|
startsWith: 'filterStartsWith',
|
|
4983
5046
|
'to-today': 'filterToToday',
|
|
4984
5047
|
};
|
|
@@ -5446,6 +5509,11 @@ const MRT_Localization_HR = {
|
|
|
5446
5509
|
filterEndsWith: 'Završava s',
|
|
5447
5510
|
filterEquals: 'Jednako',
|
|
5448
5511
|
filterEqualsString: 'Jednako',
|
|
5512
|
+
filterIs: 'Je',
|
|
5513
|
+
filterNot: 'Nije',
|
|
5514
|
+
filterBefore: 'Prije',
|
|
5515
|
+
filterAfter: 'Poslije',
|
|
5516
|
+
filterRange: 'Raspon',
|
|
5449
5517
|
filterFuzzy: 'Maglovito',
|
|
5450
5518
|
filterGreaterThan: 'Veće od',
|
|
5451
5519
|
filterGreaterThanOrEqualTo: 'Veće od ili jednako',
|
|
@@ -5613,7 +5681,12 @@ const Inner = ({ children }) => {
|
|
|
5613
5681
|
const hasProvider = useHasSnackbarProvider();
|
|
5614
5682
|
if (hasProvider)
|
|
5615
5683
|
return jsxRuntime.jsx(jsxRuntime.Fragment, { children: children });
|
|
5616
|
-
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 }));
|
|
5617
5690
|
};
|
|
5618
5691
|
// Wraps children with SnackbarProvider only when no provider exists in the tree.
|
|
5619
5692
|
// When the user's app already has a SnackbarProvider, notifications from MRT
|
|
@@ -7049,13 +7122,14 @@ const MRT_NewEntryFormActions = ({ table, }) => {
|
|
|
7049
7122
|
var _a, _b;
|
|
7050
7123
|
const methods = reactHookForm.useFormContext();
|
|
7051
7124
|
const { handleCancel, handleSave } = useMRT_NewEntryFormActions();
|
|
7125
|
+
const { isSubmitting } = methods.formState;
|
|
7052
7126
|
const { options: { formConfig, localization, muiNewEntryModalProps }, } = table;
|
|
7053
7127
|
const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
|
|
7054
7128
|
const mode = (_a = newEntryModal.mode) !== null && _a !== void 0 ? _a : 'create';
|
|
7055
7129
|
const resolvedModalProps = muiNewEntryModalProps !== null && muiNewEntryModalProps !== void 0 ? muiNewEntryModalProps : {};
|
|
7056
7130
|
const { footerProps, footerSx } = resolvedModalProps;
|
|
7057
7131
|
const callbackProps = { form: methods, mode, table };
|
|
7058
|
-
return (jsxRuntime.jsxs(Stack, Object.assign({ direction: "row", justifyContent: "flex-end" }, footerProps, { sx: Object.assign({ gap: 1, pt: 1, px: 2 }, footerSx), children: [(formConfig === null || formConfig === void 0 ? void 0 : formConfig.renderSaveButton) ? (formConfig.renderSaveButton(Object.assign(Object.assign({}, callbackProps), { handleAction: handleSave }))) : (formConfig === null || formConfig === void 0 ? void 0 : formConfig.onSave) ? (jsxRuntime.jsx(Button, { type: "submit", variant: "contained", children: localization.save })) : null, (formConfig === null || formConfig === void 0 ? void 0 : formConfig.renderCancelButton) ? (formConfig.renderCancelButton(Object.assign(Object.assign({}, callbackProps), { handleAction: handleCancel }))) : (jsxRuntime.jsx(Button, { onClick: handleCancel, variant: "outlined", children: localization.cancel })), (_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.customActions) === null || _b === void 0 ? void 0 : _b.map((customAction) => (jsxRuntime.jsx(react.Fragment, { children: customAction.render(callbackProps) }, customAction.key)))] })));
|
|
7132
|
+
return (jsxRuntime.jsxs(Stack, Object.assign({ direction: "row", justifyContent: "flex-end" }, footerProps, { sx: Object.assign({ gap: 1, pt: 1, px: 2 }, footerSx), children: [(formConfig === null || formConfig === void 0 ? void 0 : formConfig.renderSaveButton) ? (formConfig.renderSaveButton(Object.assign(Object.assign({}, callbackProps), { handleAction: handleSave }))) : (formConfig === null || formConfig === void 0 ? void 0 : formConfig.onSave) ? (jsxRuntime.jsx(Button, { loading: isSubmitting, type: "submit", variant: "contained", children: localization.save })) : null, (formConfig === null || formConfig === void 0 ? void 0 : formConfig.renderCancelButton) ? (formConfig.renderCancelButton(Object.assign(Object.assign({}, callbackProps), { handleAction: handleCancel }))) : (jsxRuntime.jsx(Button, { onClick: handleCancel, variant: "outlined", children: localization.cancel })), (_b = formConfig === null || formConfig === void 0 ? void 0 : formConfig.customActions) === null || _b === void 0 ? void 0 : _b.map((customAction) => (jsxRuntime.jsx(react.Fragment, { children: customAction.render(callbackProps) }, customAction.key)))] })));
|
|
7059
7133
|
};
|
|
7060
7134
|
|
|
7061
7135
|
// Thin wrapper that provides RHF context to all descendants and wraps them in a native <form>.
|
|
@@ -8517,7 +8591,7 @@ const MRT_TablePaper = (_a) => {
|
|
|
8517
8591
|
//@ts-expect-error
|
|
8518
8592
|
paperProps.ref.current = ref;
|
|
8519
8593
|
}
|
|
8520
|
-
}, 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: [jsxRuntime.jsx(MRT_QuickFiltersBar, { table: table }), jsxRuntime.jsx(MRT_ActiveFilters, { table: table }), enableTopToolbar &&
|
|
8594
|
+
}, 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: [jsxRuntime.jsxs(FormControl, { children: [jsxRuntime.jsx(InputLabel, { children: "Test" }), jsxRuntime.jsxs(Select, { children: [jsxRuntime.jsx(MenuItem, { children: "Test 1" }), jsxRuntime.jsx(MenuItem, { children: "Test 2" }), jsxRuntime.jsx(MenuItem, { children: "Test 3" })] })] }), jsxRuntime.jsx(MRT_QuickFiltersBar, { table: table }), jsxRuntime.jsx(MRT_ActiveFilters, { table: table }), enableTopToolbar &&
|
|
8521
8595
|
((_b = parseFromValuesOrFunc(renderTopToolbar, { table })) !== null && _b !== void 0 ? _b : (jsxRuntime.jsx(MRT_TopToolbar, { table: table }))), jsxRuntime.jsx(MRT_TableContainer, { table: table }), enableBottomToolbar &&
|
|
8522
8596
|
((_c = parseFromValuesOrFunc(renderBottomToolbar, { table })) !== null && _c !== void 0 ? _c : (jsxRuntime.jsx(MRT_BottomToolbar, { table: table })))] })));
|
|
8523
8597
|
};
|