@dooherceg/material-react-table 3.2.12 → 3.2.14
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 +6 -1
- package/dist/index.esm.js +54 -40
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +54 -40
- 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 +1 -1
package/dist/index.js
CHANGED
|
@@ -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
|
{
|
|
@@ -4540,7 +4545,7 @@ const MRT_IconMultiValueEditor = ({ availableIcons, column, iconsList, onChange,
|
|
|
4540
4545
|
};
|
|
4541
4546
|
|
|
4542
4547
|
// Single-select filter editor for icon column type.
|
|
4543
|
-
// Used by the '
|
|
4548
|
+
// Used by the 'is' (Je) and 'not' (Nije) operators.
|
|
4544
4549
|
// Stores the selected iconCode as a string in the filter rule value.
|
|
4545
4550
|
const MRT_IconSingleValueEditor = ({ availableIcons, column, iconsList, onChange, rule, table, }) => {
|
|
4546
4551
|
// Render a localised fallback when no options are available (guard against misconfigured columns)
|
|
@@ -4620,7 +4625,7 @@ const IconColumnResolver = {
|
|
|
4620
4625
|
if (!availableIcons.length) {
|
|
4621
4626
|
return [];
|
|
4622
4627
|
}
|
|
4623
|
-
// Single-select editor factory — used by '
|
|
4628
|
+
// Single-select editor factory — used by 'is' and 'not'
|
|
4624
4629
|
const createSingleSelectEditor = (props) => MRT_IconSingleValueEditor(Object.assign(Object.assign({}, props), { availableIcons,
|
|
4625
4630
|
iconsList }));
|
|
4626
4631
|
// Multi-select editor factory — used by 'inArray'
|
|
@@ -4631,18 +4636,18 @@ const IconColumnResolver = {
|
|
|
4631
4636
|
// 'Je' — selected iconCode must match the cell value exactly
|
|
4632
4637
|
editComponent: createSingleSelectEditor,
|
|
4633
4638
|
getInitialValue: () => '',
|
|
4634
|
-
id: '
|
|
4639
|
+
id: 'is',
|
|
4635
4640
|
isValueEmpty: (value) => value === '' || value == null,
|
|
4636
|
-
label: '
|
|
4641
|
+
label: 'Is',
|
|
4637
4642
|
valueShape: 'single',
|
|
4638
4643
|
},
|
|
4639
4644
|
{
|
|
4640
4645
|
// 'Nije' — selected iconCode must not match the cell value
|
|
4641
4646
|
editComponent: createSingleSelectEditor,
|
|
4642
4647
|
getInitialValue: () => '',
|
|
4643
|
-
id: '
|
|
4648
|
+
id: 'not',
|
|
4644
4649
|
isValueEmpty: (value) => value === '' || value == null,
|
|
4645
|
-
label: 'Not
|
|
4650
|
+
label: 'Not',
|
|
4646
4651
|
valueShape: 'single',
|
|
4647
4652
|
},
|
|
4648
4653
|
{
|
|
@@ -4685,9 +4690,6 @@ const MRT_FormNumberInput = ({ name, columnDef, fieldConfig, }) => {
|
|
|
4685
4690
|
const NumberActiveFilterItem = (table, rule) => {
|
|
4686
4691
|
if (typeof rule.value !== 'number' && !Array.isArray(rule.value))
|
|
4687
4692
|
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
4693
|
if (rule.operator === 'isAnyOf' && Array.isArray(rule.value)) {
|
|
4692
4694
|
return (jsxRuntime.jsx(MRT_ActiveFilterItemContainer, { table: table, rule: rule, children: jsxRuntime.jsx(Typography, { variant: "body2", children: rule.value.join(', ') }) }));
|
|
4693
4695
|
}
|
|
@@ -4703,7 +4705,7 @@ const NumberColumnResolver = {
|
|
|
4703
4705
|
{
|
|
4704
4706
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4705
4707
|
getInitialValue: () => '',
|
|
4706
|
-
id: '
|
|
4708
|
+
id: '=',
|
|
4707
4709
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4708
4710
|
label: 'Equals',
|
|
4709
4711
|
triggerMode: 'commit',
|
|
@@ -4713,7 +4715,7 @@ const NumberColumnResolver = {
|
|
|
4713
4715
|
// Mirrors MUI != operator — cell value must not equal the entered number
|
|
4714
4716
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4715
4717
|
getInitialValue: () => '',
|
|
4716
|
-
id: '
|
|
4718
|
+
id: '!=',
|
|
4717
4719
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4718
4720
|
label: 'Not Equals',
|
|
4719
4721
|
triggerMode: 'commit',
|
|
@@ -4722,7 +4724,7 @@ const NumberColumnResolver = {
|
|
|
4722
4724
|
{
|
|
4723
4725
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4724
4726
|
getInitialValue: () => '',
|
|
4725
|
-
id: '
|
|
4727
|
+
id: '>',
|
|
4726
4728
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4727
4729
|
label: 'Greater Than',
|
|
4728
4730
|
triggerMode: 'commit',
|
|
@@ -4731,7 +4733,7 @@ const NumberColumnResolver = {
|
|
|
4731
4733
|
{
|
|
4732
4734
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4733
4735
|
getInitialValue: () => '',
|
|
4734
|
-
id: '
|
|
4736
|
+
id: '>=',
|
|
4735
4737
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4736
4738
|
label: 'Greater Than Or Equal To',
|
|
4737
4739
|
triggerMode: 'commit',
|
|
@@ -4740,7 +4742,7 @@ const NumberColumnResolver = {
|
|
|
4740
4742
|
{
|
|
4741
4743
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4742
4744
|
getInitialValue: () => '',
|
|
4743
|
-
id: '
|
|
4745
|
+
id: '<',
|
|
4744
4746
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4745
4747
|
label: 'Less Than',
|
|
4746
4748
|
triggerMode: 'commit',
|
|
@@ -4749,7 +4751,7 @@ const NumberColumnResolver = {
|
|
|
4749
4751
|
{
|
|
4750
4752
|
editComponent: MRT_FilterRuleNumberEditor,
|
|
4751
4753
|
getInitialValue: () => '',
|
|
4752
|
-
id: '
|
|
4754
|
+
id: '<=',
|
|
4753
4755
|
isValueEmpty: (value) => value === '' || value === null,
|
|
4754
4756
|
label: 'Less Than Or Equal To',
|
|
4755
4757
|
triggerMode: 'commit',
|
|
@@ -4852,7 +4854,7 @@ const StringColumnResolver = {
|
|
|
4852
4854
|
// Mirrors MUI doesNotEqual — text must not match the cell value exactly
|
|
4853
4855
|
editComponent: MRT_FilterRuleTextEditor,
|
|
4854
4856
|
getInitialValue: () => '',
|
|
4855
|
-
id: '
|
|
4857
|
+
id: 'doesNotEqual',
|
|
4856
4858
|
isValueEmpty: (value) => !`${value !== null && value !== void 0 ? value : ''}`.trim(),
|
|
4857
4859
|
label: 'Does Not Equal',
|
|
4858
4860
|
triggerMode: 'commit',
|
|
@@ -4880,7 +4882,7 @@ const StringColumnResolver = {
|
|
|
4880
4882
|
// Mirrors MUI doesNotContain — cell value must not include the typed substring
|
|
4881
4883
|
editComponent: MRT_FilterRuleTextEditor,
|
|
4882
4884
|
getInitialValue: () => '',
|
|
4883
|
-
id: '
|
|
4885
|
+
id: 'doesNotContain',
|
|
4884
4886
|
isValueEmpty: (value) => !`${value !== null && value !== void 0 ? value : ''}`.trim(),
|
|
4885
4887
|
label: 'Does Not Contain',
|
|
4886
4888
|
triggerMode: 'commit',
|
|
@@ -4960,25 +4962,31 @@ const getColumnFilterOperators = (column) => {
|
|
|
4960
4962
|
// Lookup map: operator id → localization key.
|
|
4961
4963
|
// Using a map avoids a long switch statement and makes it easy to extend.
|
|
4962
4964
|
const OPERATOR_LOCALIZATION_KEYS = {
|
|
4963
|
-
|
|
4965
|
+
'!=': 'filterNotEquals',
|
|
4966
|
+
'<': 'filterLessThan',
|
|
4967
|
+
'<=': 'filterLessThanOrEqualTo',
|
|
4968
|
+
'=': 'filterEquals',
|
|
4969
|
+
'>': 'filterGreaterThan',
|
|
4970
|
+
'>=': 'filterGreaterThanOrEqualTo',
|
|
4971
|
+
after: 'filterAfter',
|
|
4972
|
+
before: 'filterBefore',
|
|
4964
4973
|
contains: 'filterContains',
|
|
4965
4974
|
'current-month': 'filterCurrentMonth',
|
|
4966
4975
|
'current-week': 'filterCurrentWeek',
|
|
4976
|
+
doesNotContain: 'filterNotContains',
|
|
4977
|
+
doesNotEqual: 'filterNotEquals',
|
|
4967
4978
|
endsWith: 'filterEndsWith',
|
|
4968
4979
|
equals: 'filterEquals',
|
|
4969
4980
|
'from-today': 'filterFromToday',
|
|
4970
|
-
|
|
4971
|
-
greaterThanOrEqualTo: 'filterGreaterThanOrEqualTo',
|
|
4981
|
+
is: 'filterIs',
|
|
4972
4982
|
isAnyOf: 'filterIsAnyOf',
|
|
4973
4983
|
isEmpty: 'filterEmpty',
|
|
4974
4984
|
isNotEmpty: 'filterNotEmpty',
|
|
4975
4985
|
'last-7-days': 'filterLast7Days',
|
|
4976
4986
|
'last-month': 'filterLastMonth',
|
|
4977
4987
|
'last-week': 'filterLastWeek',
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
notContains: 'filterNotContains',
|
|
4981
|
-
notEquals: 'filterNotEquals',
|
|
4988
|
+
not: 'filterNot',
|
|
4989
|
+
range: 'filterRange',
|
|
4982
4990
|
startsWith: 'filterStartsWith',
|
|
4983
4991
|
'to-today': 'filterToToday',
|
|
4984
4992
|
};
|
|
@@ -5446,6 +5454,11 @@ const MRT_Localization_HR = {
|
|
|
5446
5454
|
filterEndsWith: 'Završava s',
|
|
5447
5455
|
filterEquals: 'Jednako',
|
|
5448
5456
|
filterEqualsString: 'Jednako',
|
|
5457
|
+
filterIs: 'Je',
|
|
5458
|
+
filterNot: 'Nije',
|
|
5459
|
+
filterBefore: 'Prije',
|
|
5460
|
+
filterAfter: 'Poslije',
|
|
5461
|
+
filterRange: 'Raspon',
|
|
5449
5462
|
filterFuzzy: 'Maglovito',
|
|
5450
5463
|
filterGreaterThan: 'Veće od',
|
|
5451
5464
|
filterGreaterThanOrEqualTo: 'Veće od ili jednako',
|
|
@@ -7049,13 +7062,14 @@ const MRT_NewEntryFormActions = ({ table, }) => {
|
|
|
7049
7062
|
var _a, _b;
|
|
7050
7063
|
const methods = reactHookForm.useFormContext();
|
|
7051
7064
|
const { handleCancel, handleSave } = useMRT_NewEntryFormActions();
|
|
7065
|
+
const { isSubmitting } = methods.formState;
|
|
7052
7066
|
const { options: { formConfig, localization, muiNewEntryModalProps }, } = table;
|
|
7053
7067
|
const newEntryModal = useMRT_SliceValue(table._uiStore, (s) => s.newEntryModal);
|
|
7054
7068
|
const mode = (_a = newEntryModal.mode) !== null && _a !== void 0 ? _a : 'create';
|
|
7055
7069
|
const resolvedModalProps = muiNewEntryModalProps !== null && muiNewEntryModalProps !== void 0 ? muiNewEntryModalProps : {};
|
|
7056
7070
|
const { footerProps, footerSx } = resolvedModalProps;
|
|
7057
7071
|
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)))] })));
|
|
7072
|
+
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
7073
|
};
|
|
7060
7074
|
|
|
7061
7075
|
// Thin wrapper that provides RHF context to all descendants and wraps them in a native <form>.
|