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