From bf71a589bfaa23ebeab0dd9462c2bd2df01a686d Mon Sep 17 00:00:00 2001 From: Flavien DELANGLE Date: Fri, 6 Sep 2024 13:29:22 +0200 Subject: [PATCH 1/7] [pickers] Stop using utils in locales (#14505) --- .../DesktopDatePicker/DesktopDatePicker.tsx | 9 ++++- .../DesktopDateTimePicker.tsx | 9 ++++- .../DesktopTimePicker/DesktopTimePicker.tsx | 9 ++++- .../src/MobileDatePicker/MobileDatePicker.tsx | 9 ++++- .../MobileDateTimePicker.tsx | 9 ++++- .../src/MobileTimePicker/MobileTimePicker.tsx | 9 ++++- .../x-date-pickers/src/TimeClock/Clock.tsx | 7 +++- .../useDesktopPicker/useDesktopPicker.tsx | 4 +- .../useDesktopPicker.types.ts | 9 +---- .../hooks/useMobilePicker/useMobilePicker.tsx | 4 +- .../useMobilePicker/useMobilePicker.types.ts | 9 +---- packages/x-date-pickers/src/locales/beBY.ts | 16 ++++---- packages/x-date-pickers/src/locales/caES.ts | 16 ++++---- packages/x-date-pickers/src/locales/csCZ.ts | 16 ++++---- packages/x-date-pickers/src/locales/daDK.ts | 16 ++++---- packages/x-date-pickers/src/locales/deDE.ts | 16 ++++---- packages/x-date-pickers/src/locales/elGR.ts | 16 ++++---- packages/x-date-pickers/src/locales/enUS.ts | 18 +++++---- packages/x-date-pickers/src/locales/esES.ts | 16 ++++---- packages/x-date-pickers/src/locales/eu.ts | 16 ++++---- packages/x-date-pickers/src/locales/faIR.ts | 16 ++++---- packages/x-date-pickers/src/locales/fiFI.ts | 16 ++++---- packages/x-date-pickers/src/locales/frFR.ts | 16 ++++---- packages/x-date-pickers/src/locales/heIL.ts | 16 ++++---- packages/x-date-pickers/src/locales/huHU.ts | 16 ++++---- packages/x-date-pickers/src/locales/isIS.ts | 16 ++++---- packages/x-date-pickers/src/locales/itIT.ts | 16 ++++---- packages/x-date-pickers/src/locales/jaJP.ts | 16 ++++---- packages/x-date-pickers/src/locales/koKR.ts | 16 ++++---- packages/x-date-pickers/src/locales/kzKZ.ts | 16 ++++---- packages/x-date-pickers/src/locales/mk.ts | 16 ++++---- packages/x-date-pickers/src/locales/nbNO.ts | 16 ++++---- packages/x-date-pickers/src/locales/nlNL.ts | 16 ++++---- packages/x-date-pickers/src/locales/nnNO.ts | 16 ++++---- packages/x-date-pickers/src/locales/plPL.ts | 14 +++---- packages/x-date-pickers/src/locales/ptBR.ts | 16 ++++---- packages/x-date-pickers/src/locales/roRO.ts | 16 ++++---- packages/x-date-pickers/src/locales/ruRU.ts | 16 ++++---- packages/x-date-pickers/src/locales/skSK.ts | 16 ++++---- packages/x-date-pickers/src/locales/svSE.ts | 16 ++++---- packages/x-date-pickers/src/locales/trTR.ts | 16 ++++---- packages/x-date-pickers/src/locales/ukUA.ts | 16 ++++---- packages/x-date-pickers/src/locales/urPK.ts | 16 ++++---- .../locales/utils/getPickersLocalization.ts | 27 +++++++++++++ .../src/locales/utils/pickersLocaleTextApi.ts | 40 +++++++++++++++++-- packages/x-date-pickers/src/locales/viVN.ts | 16 ++++---- packages/x-date-pickers/src/locales/zhCN.ts | 16 ++++---- packages/x-date-pickers/src/locales/zhHK.ts | 16 ++++---- 48 files changed, 399 insertions(+), 315 deletions(-) diff --git a/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx b/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx index 663e4174dd44..fcea15c593a7 100644 --- a/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx +++ b/packages/x-date-pickers/src/DesktopDatePicker/DesktopDatePicker.tsx @@ -15,6 +15,7 @@ import { DateField } from '../DateField'; import { extractValidationProps } from '../internals/utils/validation/extractValidationProps'; import { renderDateViewCalendar } from '../dateViewRenderers'; import { resolveDateFormat } from '../internals/utils/date-utils'; +import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; type DesktopDatePickerComponent = (< TDate extends PickerValidDate, @@ -91,8 +92,12 @@ const DesktopDatePicker = React.forwardRef(function DesktopDatePicker< props, valueManager: singleItemValueManager, valueType: 'date', - getOpenDialogAriaText: - props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue, + getOpenDialogAriaText: buildGetOpenDialogAriaText({ + utils, + formatKey: 'fullDate', + contextTranslation: translations.openDatePickerDialogue, + propsTranslation: props.localeText?.openDatePickerDialogue, + }), validator: validateDate, }); diff --git a/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx b/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx index 08342cd65fa6..259a84364176 100644 --- a/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx +++ b/packages/x-date-pickers/src/DesktopDateTimePicker/DesktopDateTimePicker.tsx @@ -41,6 +41,7 @@ import { DefaultizedProps } from '../internals/models/helpers'; import { UsePickerViewsProps } from '../internals/hooks/usePicker/usePickerViews'; import { isInternalTimeView } from '../internals/utils/time-utils'; import { isDatePickerView } from '../internals/utils/date-utils'; +import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; const rendererInterceptor = function rendererInterceptor< TDate extends PickerValidDate, @@ -226,8 +227,12 @@ const DesktopDateTimePicker = React.forwardRef(function DesktopDateTimePicker< props, valueManager: singleItemValueManager, valueType: 'date-time', - getOpenDialogAriaText: - props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue, + getOpenDialogAriaText: buildGetOpenDialogAriaText({ + utils, + formatKey: 'fullDate', + contextTranslation: translations.openDatePickerDialogue, + propsTranslation: props.localeText?.openDatePickerDialogue, + }), validator: validateDateTime, rendererInterceptor, }); diff --git a/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx b/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx index 516f63d636aa..42919188531c 100644 --- a/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx +++ b/packages/x-date-pickers/src/DesktopTimePicker/DesktopTimePicker.tsx @@ -21,6 +21,7 @@ import { TimeViewWithMeridiem } from '../internals/models'; import { resolveTimeFormat } from '../internals/utils/time-utils'; import { resolveTimeViewsResponse } from '../internals/utils/date-time-utils'; import { TimeView, PickerValidDate } from '../models'; +import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; type DesktopTimePickerComponent = (< TDate extends PickerValidDate, @@ -129,8 +130,12 @@ const DesktopTimePicker = React.forwardRef(function DesktopTimePicker< props, valueManager: singleItemValueManager, valueType: 'time', - getOpenDialogAriaText: - props.localeText?.openTimePickerDialogue ?? translations.openTimePickerDialogue, + getOpenDialogAriaText: buildGetOpenDialogAriaText({ + utils, + formatKey: 'fullTime', + contextTranslation: translations.openTimePickerDialogue, + propsTranslation: props.localeText?.openTimePickerDialogue, + }), validator: validateTime, }); diff --git a/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx b/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx index 15b1b45d7615..34fece6808b9 100644 --- a/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx +++ b/packages/x-date-pickers/src/MobileDatePicker/MobileDatePicker.tsx @@ -14,6 +14,7 @@ import { extractValidationProps } from '../internals/utils/validation/extractVal import { singleItemValueManager } from '../internals/utils/valueManagers'; import { renderDateViewCalendar } from '../dateViewRenderers'; import { resolveDateFormat } from '../internals/utils/date-utils'; +import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; type MobileDatePickerComponent = (< TDate extends PickerValidDate, @@ -88,8 +89,12 @@ const MobileDatePicker = React.forwardRef(function MobileDatePicker< props, valueManager: singleItemValueManager, valueType: 'date', - getOpenDialogAriaText: - props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue, + getOpenDialogAriaText: buildGetOpenDialogAriaText({ + utils, + formatKey: 'fullDate', + contextTranslation: translations.openDatePickerDialogue, + propsTranslation: props.localeText?.openDatePickerDialogue, + }), validator: validateDate, }); diff --git a/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx b/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx index 5f92e1939cb9..b04083666c4e 100644 --- a/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx +++ b/packages/x-date-pickers/src/MobileDateTimePicker/MobileDateTimePicker.tsx @@ -18,6 +18,7 @@ import { extractValidationProps } from '../internals/utils/validation/extractVal import { renderDateViewCalendar } from '../dateViewRenderers'; import { renderTimeViewClock } from '../timeViewRenderers'; import { resolveDateTimeFormat } from '../internals/utils/date-time-utils'; +import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; type MobileDateTimePickerComponent = (< TDate extends PickerValidDate, @@ -103,8 +104,12 @@ const MobileDateTimePicker = React.forwardRef(function MobileDateTimePicker< props, valueManager: singleItemValueManager, valueType: 'date-time', - getOpenDialogAriaText: - props.localeText?.openDatePickerDialogue ?? translations.openDatePickerDialogue, + getOpenDialogAriaText: buildGetOpenDialogAriaText({ + utils, + formatKey: 'fullDate', + contextTranslation: translations.openDatePickerDialogue, + propsTranslation: props.localeText?.openDatePickerDialogue, + }), validator: validateDateTime, }); diff --git a/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx b/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx index f4af4c984ddb..7a398cc43d1a 100644 --- a/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx +++ b/packages/x-date-pickers/src/MobileTimePicker/MobileTimePicker.tsx @@ -14,6 +14,7 @@ import { useMobilePicker } from '../internals/hooks/useMobilePicker'; import { extractValidationProps } from '../internals/utils/validation/extractValidationProps'; import { renderTimeViewClock } from '../timeViewRenderers'; import { resolveTimeFormat } from '../internals/utils/time-utils'; +import { buildGetOpenDialogAriaText } from '../locales/utils/getPickersLocalization'; type MobileTimePickerComponent = (< TDate extends PickerValidDate, @@ -92,8 +93,12 @@ const MobileTimePicker = React.forwardRef(function MobileTimePicker< props, valueManager: singleItemValueManager, valueType: 'time', - getOpenDialogAriaText: - props.localeText?.openTimePickerDialogue ?? translations.openTimePickerDialogue, + getOpenDialogAriaText: buildGetOpenDialogAriaText({ + utils, + formatKey: 'fullTime', + contextTranslation: translations.openTimePickerDialogue, + propsTranslation: props.localeText?.openTimePickerDialogue, + }), validator: validateTime, }); diff --git a/packages/x-date-pickers/src/TimeClock/Clock.tsx b/packages/x-date-pickers/src/TimeClock/Clock.tsx index fc69d7d028fe..d7fc0a8b2e60 100644 --- a/packages/x-date-pickers/src/TimeClock/Clock.tsx +++ b/packages/x-date-pickers/src/TimeClock/Clock.tsx @@ -370,7 +370,12 @@ export function Clock(inProps: ClockProps) )} (); const containerRef = React.useRef(null); const fieldRef = React.useRef>(null); @@ -113,7 +111,7 @@ export const useDesktopPicker = < additionalProps: { disabled: disabled || readOnly, onClick: open ? actions.onClose : actions.onOpen, - 'aria-label': getOpenDialogAriaText(pickerFieldProps.value, utils), + 'aria-label': getOpenDialogAriaText(pickerFieldProps.value), edge: inputAdornmentProps.position, }, ownerState: props, diff --git a/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.types.ts b/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.types.ts index c9cc83019e06..494e25e6b25a 100644 --- a/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.types.ts +++ b/packages/x-date-pickers/src/internals/hooks/useDesktopPicker/useDesktopPicker.types.ts @@ -10,12 +10,7 @@ import { } from '../../models/props/basePickerProps'; import { PickersPopperSlots, PickersPopperSlotProps } from '../../components/PickersPopper'; import { UsePickerParams, UsePickerProps } from '../usePicker'; -import { - BaseSingleInputFieldProps, - FieldSection, - MuiPickersAdapter, - PickerValidDate, -} from '../../../models'; +import { BaseSingleInputFieldProps, FieldSection, PickerValidDate } from '../../../models'; import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, @@ -151,5 +146,5 @@ export interface UseDesktopPickerParams< 'valueManager' | 'valueType' | 'validator' | 'rendererInterceptor' > { props: TExternalProps; - getOpenDialogAriaText: (date: TDate | null, utils: MuiPickersAdapter) => string; + getOpenDialogAriaText: (date: TDate | null) => string; } diff --git a/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx b/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx index b98cf417300b..15b31e4fc63a 100644 --- a/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx +++ b/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.tsx @@ -10,7 +10,6 @@ import { } from './useMobilePicker.types'; import { usePicker } from '../usePicker'; import { onSpaceOrEnter } from '../../utils/utils'; -import { useUtils } from '../useUtils'; import { LocalizationProvider } from '../../../LocalizationProvider'; import { PickersLayout } from '../../../PickersLayout'; import { InferError } from '../useValidation'; @@ -63,7 +62,6 @@ export const useMobilePicker = < localeText, } = props; - const utils = useUtils(); const fieldRef = React.useRef>(null); const labelId = useId(); @@ -128,7 +126,7 @@ export const useMobilePicker = < // TODO: Move to `useSlotProps` when https://github.com/mui/material-ui/pull/35088 will be merged fieldProps.inputProps = { ...fieldProps.inputProps, - 'aria-label': getOpenDialogAriaText(pickerFieldProps.value, utils), + 'aria-label': getOpenDialogAriaText(pickerFieldProps.value), } as typeof fieldProps.inputProps; const slotsForField = { diff --git a/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.types.ts b/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.types.ts index d741a588e9e5..afb1302cf103 100644 --- a/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.types.ts +++ b/packages/x-date-pickers/src/internals/hooks/useMobilePicker/useMobilePicker.types.ts @@ -11,12 +11,7 @@ import { PickersModalDialogSlotProps, } from '../../components/PickersModalDialog'; import { UsePickerParams, UsePickerProps } from '../usePicker'; -import { - BaseSingleInputFieldProps, - FieldSection, - MuiPickersAdapter, - PickerValidDate, -} from '../../../models'; +import { BaseSingleInputFieldProps, FieldSection, PickerValidDate } from '../../../models'; import { ExportedPickersLayoutSlots, ExportedPickersLayoutSlotProps, @@ -112,5 +107,5 @@ export interface UseMobilePickerParams< 'valueManager' | 'valueType' | 'validator' > { props: TExternalProps; - getOpenDialogAriaText: (date: TDate | null, utils: MuiPickersAdapter) => string; + getOpenDialogAriaText: (date: TDate | null) => string; } diff --git a/packages/x-date-pickers/src/locales/beBY.ts b/packages/x-date-pickers/src/locales/beBY.ts index b178d543d92a..cb89116745a2 100644 --- a/packages/x-date-pickers/src/locales/beBY.ts +++ b/packages/x-date-pickers/src/locales/beBY.ts @@ -44,8 +44,8 @@ const beBYPickers: Partial> = { dateRangePickerToolbarTitle: 'Абраць каляндарны перыяд', // Clock labels - clockLabelText: (view, time, adapter) => - `Абярыце ${views[view]}. ${time === null ? 'Час не абраны' : `Абраны час ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Абярыце ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Час не абраны' : `Абраны час ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} гадзін`, minutesClockNumberText: (minutes) => `${minutes} хвілін`, secondsClockNumberText: (seconds) => `${seconds} секунд`, @@ -60,13 +60,13 @@ const beBYPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Абраць дату, абрана дата ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Абраць дату, абрана дата ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Абраць дату', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Абраць час, абрыны час ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Абраць час, абрыны час ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Абраць час', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/caES.ts b/packages/x-date-pickers/src/locales/caES.ts index a20b33f90f2e..a0f05b0cd908 100644 --- a/packages/x-date-pickers/src/locales/caES.ts +++ b/packages/x-date-pickers/src/locales/caES.ts @@ -43,8 +43,8 @@ const caESPickers: Partial> = { dateRangePickerToolbarTitle: 'Seleccionar rang de dates', // Clock labels - clockLabelText: (view, time, adapter) => - `Selecciona ${views[view]}. ${time === null ? 'Hora no seleccionada' : `L'hora seleccionada és ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Selecciona ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Hora no seleccionada' : `L'hora seleccionada és ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} hores`, minutesClockNumberText: (minutes) => `${minutes} minuts`, secondsClockNumberText: (seconds) => `${seconds} segons`, @@ -59,13 +59,13 @@ const caESPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Tria la data, la data triada és ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Tria la data, la data triada és ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Tria la data', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Tria l'hora, l'hora triada és ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Tria l'hora, l'hora triada és ${formattedTime ?? utils.format(value, 'fullTime')}` : "Tria l'hora", fieldClearLabel: 'Netega el valor', diff --git a/packages/x-date-pickers/src/locales/csCZ.ts b/packages/x-date-pickers/src/locales/csCZ.ts index 50d61430a2b9..dfa515b13767 100644 --- a/packages/x-date-pickers/src/locales/csCZ.ts +++ b/packages/x-date-pickers/src/locales/csCZ.ts @@ -44,8 +44,8 @@ const csCZPickers: Partial> = { dateRangePickerToolbarTitle: 'Vyberete rozmezí dat', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view] ?? view} vybrány. ${time === null ? 'Není vybrán čas' : `Vybraný čas je ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view] ?? view} vybrány. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Není vybrán čas' : `Vybraný čas je ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} hodin`, minutesClockNumberText: (minutes) => `${minutes} minut`, secondsClockNumberText: (seconds) => `${seconds} sekund`, @@ -60,13 +60,13 @@ const csCZPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vyberte datum, vybrané datum je ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Vyberte datum, vybrané datum je ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Vyberte datum', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vyberte čas, vybraný čas je ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Vyberte čas, vybraný čas je ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Vyberte čas', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/daDK.ts b/packages/x-date-pickers/src/locales/daDK.ts index 80b81cc54a47..cacd45248825 100644 --- a/packages/x-date-pickers/src/locales/daDK.ts +++ b/packages/x-date-pickers/src/locales/daDK.ts @@ -44,8 +44,8 @@ const daDKPickers: Partial> = { dateRangePickerToolbarTitle: 'Vælg datointerval', // Clock labels - clockLabelText: (view, time, adapter) => - `Vælg ${timeViews[view] ?? view}. ${time === null ? 'Intet tidspunkt valgt' : `Valgte tidspunkt er ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Vælg ${timeViews[view] ?? view}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Intet tidspunkt valgt' : `Valgte tidspunkt er ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} timer`, minutesClockNumberText: (minutes) => `${minutes} minutter`, secondsClockNumberText: (seconds) => `${seconds} sekunder`, @@ -60,13 +60,13 @@ const daDKPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vælg dato, valgte dato er ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Vælg dato, valgte dato er ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Vælg dato', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vælg tidspunkt, valgte tidspunkt er ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Vælg tidspunkt, valgte tidspunkt er ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Vælg tidspunkt', fieldClearLabel: 'ryd felt', diff --git a/packages/x-date-pickers/src/locales/deDE.ts b/packages/x-date-pickers/src/locales/deDE.ts index 185963fd7486..197ebad04770 100644 --- a/packages/x-date-pickers/src/locales/deDE.ts +++ b/packages/x-date-pickers/src/locales/deDE.ts @@ -44,8 +44,8 @@ const deDEPickers: Partial> = { dateRangePickerToolbarTitle: 'Datumsbereich auswählen', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view] ?? view} auswählen. ${time === null ? 'Keine Uhrzeit ausgewählt' : `Gewählte Uhrzeit ist ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view] ?? view} auswählen. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Keine Uhrzeit ausgewählt' : `Gewählte Uhrzeit ist ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} ${timeViews.hours}`, minutesClockNumberText: (minutes) => `${minutes} ${timeViews.minutes}`, secondsClockNumberText: (seconds) => `${seconds} ${timeViews.seconds}`, @@ -60,13 +60,13 @@ const deDEPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Datum auswählen, gewähltes Datum ist ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Datum auswählen, gewähltes Datum ist ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Datum auswählen', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Uhrzeit auswählen, gewählte Uhrzeit ist ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Uhrzeit auswählen, gewählte Uhrzeit ist ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Uhrzeit auswählen', fieldClearLabel: 'Wert leeren', diff --git a/packages/x-date-pickers/src/locales/elGR.ts b/packages/x-date-pickers/src/locales/elGR.ts index 90143fdbff0d..c6cb153a0371 100644 --- a/packages/x-date-pickers/src/locales/elGR.ts +++ b/packages/x-date-pickers/src/locales/elGR.ts @@ -43,8 +43,8 @@ const elGRPickers: Partial> = { dateRangePickerToolbarTitle: 'Επιλέξτε εύρος ημερομηνιών', // Clock labels - clockLabelText: (view, time, adapter) => - `Επιλέξτε ${views[view]}. ${time === null ? 'Δεν έχει επιλεγεί ώρα' : `Η επιλεγμένη ώρα είναι ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Επιλέξτε ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Δεν έχει επιλεγεί ώρα' : `Η επιλεγμένη ώρα είναι ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} ώρες`, minutesClockNumberText: (minutes) => `${minutes} λεπτά`, secondsClockNumberText: (seconds) => `${seconds} δευτερόλεπτα`, @@ -59,13 +59,13 @@ const elGRPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Επιλέξτε ημερομηνία, η επιλεγμένη ημερομηνία είναι ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Επιλέξτε ημερομηνία, η επιλεγμένη ημερομηνία είναι ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Επιλέξτε ημερομηνία', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Επιλέξτε ώρα, η επιλεγμένη ώρα είναι ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Επιλέξτε ώρα, η επιλεγμένη ώρα είναι ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Επιλέξτε ώρα', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/enUS.ts b/packages/x-date-pickers/src/locales/enUS.ts index 39cf369f9a36..a9b22341fe38 100644 --- a/packages/x-date-pickers/src/locales/enUS.ts +++ b/packages/x-date-pickers/src/locales/enUS.ts @@ -37,9 +37,11 @@ const enUSPickers: PickersLocaleText = { dateRangePickerToolbarTitle: 'Select date range', // Clock labels - clockLabelText: (view, time, adapter) => + clockLabelText: (view, time, utils, formattedTime) => `Select ${view}. ${ - time === null ? 'No time selected' : `Selected time is ${adapter.format(time, 'fullTime')}` + !formattedTime && (time === null || !utils.isValid(time)) + ? 'No time selected' + : `Selected time is ${formattedTime ?? utils.format(time, 'fullTime')}` }`, hoursClockNumberText: (hours) => `${hours} hours`, minutesClockNumberText: (minutes) => `${minutes} minutes`, @@ -55,13 +57,13 @@ const enUSPickers: PickersLocaleText = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Choose date, selected date is ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Choose date, selected date is ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Choose date', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Choose time, selected time is ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Choose time, selected time is ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Choose time', fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/esES.ts b/packages/x-date-pickers/src/locales/esES.ts index f66c4c3848c9..c8d94e4c6f5f 100644 --- a/packages/x-date-pickers/src/locales/esES.ts +++ b/packages/x-date-pickers/src/locales/esES.ts @@ -43,8 +43,8 @@ const esESPickers: Partial> = { dateRangePickerToolbarTitle: 'Seleccionar rango de fecha', // Clock labels - clockLabelText: (view, time, adapter) => - `Seleccione ${views[view]}. ${time === null ? 'No hay hora seleccionada' : `La hora seleccionada es ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Seleccione ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'No hay hora seleccionada' : `La hora seleccionada es ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} horas`, minutesClockNumberText: (minutes) => `${minutes} minutos`, secondsClockNumberText: (seconds) => `${seconds} segundos`, @@ -59,13 +59,13 @@ const esESPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Elige fecha, la fecha elegida es ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Elige fecha, la fecha elegida es ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Elige fecha', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Elige hora, la hora elegida es ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Elige hora, la hora elegida es ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Elige hora', fieldClearLabel: 'Limpiar valor', diff --git a/packages/x-date-pickers/src/locales/eu.ts b/packages/x-date-pickers/src/locales/eu.ts index c65709ab678e..36be6036e3ff 100644 --- a/packages/x-date-pickers/src/locales/eu.ts +++ b/packages/x-date-pickers/src/locales/eu.ts @@ -43,8 +43,8 @@ const euPickers: Partial> = { dateRangePickerToolbarTitle: 'Data tartea aukeratu', // Clock labels - clockLabelText: (view, time, adapter) => - `Aukeratu ${views[view]}. ${time === null ? 'Ez da ordurik aukertau' : `Aukeratutako ordua ${adapter.format(time, 'fullTime')} da`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Aukeratu ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Ez da ordurik aukertau' : `Aukeratutako ordua ${formattedTime ?? utils.format(time, 'fullTime')} da`}`, hoursClockNumberText: (hours) => `${hours} ordu`, minutesClockNumberText: (minutes) => `${minutes} minutu`, secondsClockNumberText: (seconds) => `${seconds} segundu`, @@ -59,13 +59,13 @@ const euPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Data aukeratu, aukeratutako data ${utils.format(value, 'fullDate')} da` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Data aukeratu, aukeratutako data ${formattedDate ?? utils.format(value, 'fullDate')} da` : 'Data aukeratu', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Ordua aukeratu, aukeratutako ordua ${utils.format(value, 'fullTime')} da` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Ordua aukeratu, aukeratutako ordua ${formattedTime ?? utils.format(value, 'fullTime')} da` : 'Ordua aukeratu', fieldClearLabel: 'Balioa garbitu', diff --git a/packages/x-date-pickers/src/locales/faIR.ts b/packages/x-date-pickers/src/locales/faIR.ts index d28ebb837dd5..bcab518ca78e 100644 --- a/packages/x-date-pickers/src/locales/faIR.ts +++ b/packages/x-date-pickers/src/locales/faIR.ts @@ -43,8 +43,8 @@ const faIRPickers: Partial> = { dateRangePickerToolbarTitle: 'محدوده تاریخ را انتخاب کنید', // Clock labels - clockLabelText: (view, time, adapter) => - ` را انتخاب کنید ${timeViews[view]}. ${time === null ? 'هیچ ساعتی انتخاب نشده است' : `ساعت انتخاب ${adapter.format(time, 'fullTime')} می باشد`}`, + clockLabelText: (view, time, utils, formattedTime) => + ` را انتخاب کنید ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'هیچ ساعتی انتخاب نشده است' : `ساعت انتخاب ${formattedTime ?? utils.format(time, 'fullTime')} می باشد`}`, hoursClockNumberText: (hours) => `${hours} ساعت‌ها`, minutesClockNumberText: (minutes) => `${minutes} دقیقه‌ها`, secondsClockNumberText: (seconds) => `${seconds} ثانیه‌ها`, @@ -59,13 +59,13 @@ const faIRPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `تاریخ را انتخاب کنید، تاریخ انتخاب شده ${utils.format(value, 'fullDate')} می‌باشد` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `تاریخ را انتخاب کنید، تاریخ انتخاب شده ${formattedDate ?? utils.format(value, 'fullDate')} می‌باشد` : 'تاریخ را انتخاب کنید', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `ساعت را انتخاب کنید، ساعت انتخاب شده ${utils.format(value, 'fullTime')} می‌باشد` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `ساعت را انتخاب کنید، ساعت انتخاب شده ${formattedTime ?? utils.format(value, 'fullTime')} می‌باشد` : 'ساعت را انتخاب کنید', fieldClearLabel: 'پاک کردن مقدار', diff --git a/packages/x-date-pickers/src/locales/fiFI.ts b/packages/x-date-pickers/src/locales/fiFI.ts index 0b2c5772db2c..61e1f23ddd9e 100644 --- a/packages/x-date-pickers/src/locales/fiFI.ts +++ b/packages/x-date-pickers/src/locales/fiFI.ts @@ -43,8 +43,8 @@ const fiFIPickers: Partial> = { dateRangePickerToolbarTitle: 'Valitse aikaväli', // Clock labels - clockLabelText: (view, time, adapter) => - `Valitse ${views[view]}. ${time === null ? 'Ei aikaa valittuna' : `Valittu aika on ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Valitse ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Ei aikaa valittuna' : `Valittu aika on ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} tuntia`, minutesClockNumberText: (minutes) => `${minutes} minuuttia`, secondsClockNumberText: (seconds) => `${seconds} sekuntia`, @@ -59,13 +59,13 @@ const fiFIPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Valitse päivä, valittu päivä on ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Valitse päivä, valittu päivä on ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Valitse päivä', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Valitse aika, valittu aika on ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Valitse aika, valittu aika on ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Valitse aika', fieldClearLabel: 'Tyhjennä arvo', diff --git a/packages/x-date-pickers/src/locales/frFR.ts b/packages/x-date-pickers/src/locales/frFR.ts index 05c5e3efe89b..3e50710db585 100644 --- a/packages/x-date-pickers/src/locales/frFR.ts +++ b/packages/x-date-pickers/src/locales/frFR.ts @@ -43,8 +43,8 @@ const frFRPickers: Partial> = { dateRangePickerToolbarTitle: 'Choisir la plage de dates', // Clock labels - clockLabelText: (view, time, adapter) => - `Choix des ${views[view]}. ${time === null ? 'Aucune heure choisie' : `L'heure choisie est ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Choix des ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Aucune heure choisie' : `L'heure choisie est ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} heures`, minutesClockNumberText: (minutes) => `${minutes} minutes`, secondsClockNumberText: (seconds) => `${seconds} secondes`, @@ -59,13 +59,13 @@ const frFRPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Choisir la date, la date sélectionnée est ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Choisir la date, la date sélectionnée est ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Choisir la date', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Choisir l'heure, l'heure sélectionnée est ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime + ? `Choisir l'heure, l'heure sélectionnée est ${formattedTime ?? utils.format(value, 'fullTime')}` : "Choisir l'heure", fieldClearLabel: 'Effacer la valeur', diff --git a/packages/x-date-pickers/src/locales/heIL.ts b/packages/x-date-pickers/src/locales/heIL.ts index cb588abaf349..2102a2a23c48 100644 --- a/packages/x-date-pickers/src/locales/heIL.ts +++ b/packages/x-date-pickers/src/locales/heIL.ts @@ -43,8 +43,8 @@ const heILPickers: Partial> = { dateRangePickerToolbarTitle: 'בחירת טווח תאריכים', // Clock labels - clockLabelText: (view, time, adapter) => - `בחירת ${views[view]}. ${time === null ? 'לא נבחרה שעה' : `השעה הנבחרת היא ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `בחירת ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'לא נבחרה שעה' : `השעה הנבחרת היא ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} שעות`, minutesClockNumberText: (minutes) => `${minutes} דקות`, secondsClockNumberText: (seconds) => `${seconds} שניות`, @@ -59,13 +59,13 @@ const heILPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `בחירת תאריך, התאריך שנבחר הוא ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `בחירת תאריך, התאריך שנבחר הוא ${formattedDate ?? utils.format(value, 'fullDate')}` : 'בחירת תאריך', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `בחירת שעה, השעה שנבחרה היא ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `בחירת שעה, השעה שנבחרה היא ${formattedTime ?? utils.format(value, 'fullTime')}` : 'בחירת שעה', fieldClearLabel: 'נקה ערך', diff --git a/packages/x-date-pickers/src/locales/huHU.ts b/packages/x-date-pickers/src/locales/huHU.ts index 2738f681e3c7..df92c047482b 100644 --- a/packages/x-date-pickers/src/locales/huHU.ts +++ b/packages/x-date-pickers/src/locales/huHU.ts @@ -44,8 +44,8 @@ const huHUPickers: Partial> = { dateRangePickerToolbarTitle: 'Dátumhatárok kiválasztása', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view] ?? view} kiválasztása. ${time === null ? 'Nincs kiválasztva idő' : `A kiválasztott idő ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view] ?? view} kiválasztása. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Nincs kiválasztva idő' : `A kiválasztott idő ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} ${timeViews.hours.toLowerCase()}`, minutesClockNumberText: (minutes) => `${minutes} ${timeViews.minutes.toLowerCase()}`, secondsClockNumberText: (seconds) => `${seconds} ${timeViews.seconds.toLowerCase()}`, @@ -60,13 +60,13 @@ const huHUPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Válasszon dátumot, a kiválasztott dátum: ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Válasszon dátumot, a kiválasztott dátum: ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Válasszon dátumot', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Válasszon időt, a kiválasztott idő: ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Válasszon időt, a kiválasztott idő: ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Válasszon időt', fieldClearLabel: 'Tartalom ürítése', diff --git a/packages/x-date-pickers/src/locales/isIS.ts b/packages/x-date-pickers/src/locales/isIS.ts index 9e6be431be08..1dee0b9057cb 100644 --- a/packages/x-date-pickers/src/locales/isIS.ts +++ b/packages/x-date-pickers/src/locales/isIS.ts @@ -43,8 +43,8 @@ const isISPickers: Partial> = { dateRangePickerToolbarTitle: 'Velja tímabil', // Clock labels - clockLabelText: (view, time, adapter) => - `Velja ${timeViews[view]}. ${time === null ? 'Enginn tími valinn' : `Valinn tími er ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Velja ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Enginn tími valinn' : `Valinn tími er ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} klukkustundir`, minutesClockNumberText: (minutes) => `${minutes} mínútur`, secondsClockNumberText: (seconds) => `${seconds} sekúndur`, @@ -59,13 +59,13 @@ const isISPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Velja dagsetningu, valin dagsetning er ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Velja dagsetningu, valin dagsetning er ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Velja dagsetningu', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Velja tíma, valinn tími er ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Velja tíma, valinn tími er ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Velja tíma', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/itIT.ts b/packages/x-date-pickers/src/locales/itIT.ts index 46e19c0b96b1..d88041c3aba4 100644 --- a/packages/x-date-pickers/src/locales/itIT.ts +++ b/packages/x-date-pickers/src/locales/itIT.ts @@ -43,8 +43,8 @@ const itITPickers: Partial> = { dateRangePickerToolbarTitle: 'Seleziona intervallo di date', // Clock labels - clockLabelText: (view, time, adapter) => - `Seleziona ${views[view]}. ${time === null ? 'Nessun orario selezionato' : `L'ora selezionata è ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Seleziona ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Nessun orario selezionato' : `L'ora selezionata è ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} ore`, minutesClockNumberText: (minutes) => `${minutes} minuti`, secondsClockNumberText: (seconds) => `${seconds} secondi`, @@ -59,13 +59,13 @@ const itITPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Scegli la data, la data selezionata è ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Scegli la data, la data selezionata è ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Scegli la data', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Scegli l'ora, l'ora selezionata è ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Scegli l'ora, l'ora selezionata è ${formattedTime ?? utils.format(value, 'fullTime')}` : "Scegli l'ora", fieldClearLabel: 'Cancella valore', diff --git a/packages/x-date-pickers/src/locales/jaJP.ts b/packages/x-date-pickers/src/locales/jaJP.ts index 6220e261c23b..bddc697c9f1f 100644 --- a/packages/x-date-pickers/src/locales/jaJP.ts +++ b/packages/x-date-pickers/src/locales/jaJP.ts @@ -44,8 +44,8 @@ const jaJPPickers: Partial> = { dateRangePickerToolbarTitle: '日付の範囲を選択', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view] ?? view}を選択してください ${time === null ? '時間が選択されていません' : `選択した時間は ${adapter.format(time, 'fullTime')} です`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view] ?? view}を選択してください ${!formattedTime && (time === null || !utils.isValid(time)) ? '時間が選択されていません' : `選択した時間は ${formattedTime ?? utils.format(time, 'fullTime')} です`}`, hoursClockNumberText: (hours) => `${hours} ${timeViews.hours}`, minutesClockNumberText: (minutes) => `${minutes} ${timeViews.minutes}`, secondsClockNumberText: (seconds) => `${seconds} ${timeViews.seconds}`, @@ -60,13 +60,13 @@ const jaJPPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `日付を選択してください。選択した日付は ${utils.format(value, 'fullDate')} です` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `日付を選択してください。選択した日付は ${formattedDate ?? utils.format(value, 'fullDate')} です` : '日付を選択してください', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `時間を選択してください。選択した時間は ${utils.format(value, 'fullTime')} です` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `時間を選択してください。選択した時間は ${formattedTime ?? utils.format(value, 'fullTime')} です` : '時間を選択してください', fieldClearLabel: 'クリア', diff --git a/packages/x-date-pickers/src/locales/koKR.ts b/packages/x-date-pickers/src/locales/koKR.ts index c298cc71010b..6b72286dba1e 100644 --- a/packages/x-date-pickers/src/locales/koKR.ts +++ b/packages/x-date-pickers/src/locales/koKR.ts @@ -43,8 +43,8 @@ const koKRPickers: Partial> = { dateRangePickerToolbarTitle: '날짜 범위 선택하기', // Clock labels - clockLabelText: (view, time, adapter) => - `${views[view]} 선택하세요. ${time === null ? '시간을 선택하지 않았습니다.' : `현재 선택된 시간은 ${adapter.format(time, 'fullTime')}입니다.`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${views[view]} 선택하세요. ${!formattedTime && (time === null || !utils.isValid(time)) ? '시간을 선택하지 않았습니다.' : `현재 선택된 시간은 ${formattedTime ?? utils.format(time, 'fullTime')}입니다.`}`, hoursClockNumberText: (hours) => `${hours}시`, minutesClockNumberText: (minutes) => `${minutes}분`, secondsClockNumberText: (seconds) => `${seconds}초`, @@ -59,13 +59,13 @@ const koKRPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `날짜를 선택하세요. 현재 선택된 날짜는 ${utils.format(value, 'fullDate')}입니다.` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `날짜를 선택하세요. 현재 선택된 날짜는 ${formattedDate ?? utils.format(value, 'fullDate')}입니다.` : '날짜를 선택하세요', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `시간을 선택하세요. 현재 선택된 시간은 ${utils.format(value, 'fullTime')}입니다.` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `시간을 선택하세요. 현재 선택된 시간은 ${formattedTime ?? utils.format(value, 'fullTime')}입니다.` : '시간을 선택하세요', fieldClearLabel: '지우기', diff --git a/packages/x-date-pickers/src/locales/kzKZ.ts b/packages/x-date-pickers/src/locales/kzKZ.ts index eefb19d00bf7..29d9c6b9824a 100644 --- a/packages/x-date-pickers/src/locales/kzKZ.ts +++ b/packages/x-date-pickers/src/locales/kzKZ.ts @@ -44,8 +44,8 @@ const kzKZPickers: Partial> = { dateRangePickerToolbarTitle: 'Кезеңді таңдаңыз', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view]} таңдау. ${time === null ? 'Уақыт таңдалмаған' : `Таңдалған уақыт ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view]} таңдау. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Уақыт таңдалмаған' : `Таңдалған уақыт ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} сағат`, minutesClockNumberText: (minutes) => `${minutes} минут`, secondsClockNumberText: (seconds) => `${seconds} секунд`, @@ -60,13 +60,13 @@ const kzKZPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Күнді таңдаңыз, таңдалған күн ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Күнді таңдаңыз, таңдалған күн ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Күнді таңдаңыз', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Уақытты таңдаңыз, таңдалған уақыт ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Уақытты таңдаңыз, таңдалған уақыт ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Уақытты таңдаңыз', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/mk.ts b/packages/x-date-pickers/src/locales/mk.ts index 1a7eca9c3d21..c5e965e450e6 100644 --- a/packages/x-date-pickers/src/locales/mk.ts +++ b/packages/x-date-pickers/src/locales/mk.ts @@ -37,8 +37,8 @@ const mkPickers: Partial> = { dateRangePickerToolbarTitle: 'Избери временски опсег', // Clock labels - clockLabelText: (view, time, adapter) => - `Select ${view}. ${time === null ? 'Нема избрано време' : `Избраното време е ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Select ${view}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Нема избрано време' : `Избраното време е ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} часа`, minutesClockNumberText: (minutes) => `${minutes} минути`, secondsClockNumberText: (seconds) => `${seconds} секунди`, @@ -53,13 +53,13 @@ const mkPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Избери датум, избраниот датум е ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Избери датум, избраниот датум е ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Избери датум', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Избери време, избраното време е ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Избери време, избраното време е ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Избери време', fieldClearLabel: 'Избриши', diff --git a/packages/x-date-pickers/src/locales/nbNO.ts b/packages/x-date-pickers/src/locales/nbNO.ts index 3ac5c0e73bbb..dd4b065d094d 100644 --- a/packages/x-date-pickers/src/locales/nbNO.ts +++ b/packages/x-date-pickers/src/locales/nbNO.ts @@ -43,8 +43,8 @@ const nbNOPickers: Partial> = { dateRangePickerToolbarTitle: 'Velg datoperiode', // Clock labels - clockLabelText: (view, time, adapter) => - `Velg ${timeViews[view]}. ${time === null ? 'Ingen tid valgt' : `Valgt tid er ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Velg ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Ingen tid valgt' : `Valgt tid er ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} timer`, minutesClockNumberText: (minutes) => `${minutes} minutter`, secondsClockNumberText: (seconds) => `${seconds} sekunder`, @@ -59,13 +59,13 @@ const nbNOPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Velg dato, valgt dato er ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Velg dato, valgt dato er ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Velg dato', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Velg tid, valgt tid er ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Velg tid, valgt tid er ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Velg tid', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/nlNL.ts b/packages/x-date-pickers/src/locales/nlNL.ts index d1caa93adba3..6c8f7d3490d0 100644 --- a/packages/x-date-pickers/src/locales/nlNL.ts +++ b/packages/x-date-pickers/src/locales/nlNL.ts @@ -43,8 +43,8 @@ const nlNLPickers: Partial> = { dateRangePickerToolbarTitle: 'Selecteer datumbereik', // Clock labels - clockLabelText: (view, time, adapter) => - `Selecteer ${timeViews[view]}. ${time === null ? 'Geen tijd geselecteerd' : `Geselecteerde tijd is ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Selecteer ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Geen tijd geselecteerd' : `Geselecteerde tijd is ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} uren`, minutesClockNumberText: (minutes) => `${minutes} minuten`, secondsClockNumberText: (seconds) => `${seconds} seconden`, @@ -59,13 +59,13 @@ const nlNLPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Kies datum, geselecteerde datum is ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Kies datum, geselecteerde datum is ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Kies datum', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Kies tijd, geselecteerde tijd is ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Kies tijd, geselecteerde tijd is ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Kies tijd', fieldClearLabel: 'Wissen', diff --git a/packages/x-date-pickers/src/locales/nnNO.ts b/packages/x-date-pickers/src/locales/nnNO.ts index 8603b926a464..e547e022647c 100644 --- a/packages/x-date-pickers/src/locales/nnNO.ts +++ b/packages/x-date-pickers/src/locales/nnNO.ts @@ -43,8 +43,8 @@ const nnNOPickers: Partial> = { dateRangePickerToolbarTitle: 'Vel datoperiode', // Clock labels - clockLabelText: (view, time, adapter) => - `Vel ${timeViews[view]}. ${time === null ? 'Ingen tid vald' : `Vald tid er ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Vel ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Ingen tid vald' : `Vald tid er ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} timar`, minutesClockNumberText: (minutes) => `${minutes} minuttar`, secondsClockNumberText: (seconds) => `${seconds} sekundar`, @@ -59,13 +59,13 @@ const nnNOPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vel dato, vald dato er ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Vel dato, vald dato er ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Vel dato', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vel tid, vald tid er ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Vel tid, vald tid er ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Vel tid', fieldClearLabel: 'Fjern verdi', diff --git a/packages/x-date-pickers/src/locales/plPL.ts b/packages/x-date-pickers/src/locales/plPL.ts index c338bbaee088..8a95d3ebff17 100644 --- a/packages/x-date-pickers/src/locales/plPL.ts +++ b/packages/x-date-pickers/src/locales/plPL.ts @@ -43,8 +43,8 @@ const plPLPickers: Partial> = { dateRangePickerToolbarTitle: 'Wybierz zakres dat', // Clock labels - clockLabelText: (view, time, adapter) => - `Wybierz ${timeViews[view]}. ${time === null ? 'Nie wybrano czasu' : `Wybrany czas to ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Wybierz ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Nie wybrano czasu' : `Wybrany czas to ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} godzin`, minutesClockNumberText: (minutes) => `${minutes} minut`, secondsClockNumberText: (seconds) => `${seconds} sekund`, @@ -59,13 +59,13 @@ const plPLPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => + openDatePickerDialogue: (value, utils, formattedDate) => value != null && utils.isValid(value) - ? `Wybierz datę, obecnie wybrana data to ${utils.format(value, 'fullDate')}` + ? `Wybierz datę, obecnie wybrana data to ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Wybierz datę', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Wybierz czas, obecnie wybrany czas to ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Wybierz czas, obecnie wybrany czas to ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Wybierz czas', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/ptBR.ts b/packages/x-date-pickers/src/locales/ptBR.ts index 0e6385db7628..22d4b086a74d 100644 --- a/packages/x-date-pickers/src/locales/ptBR.ts +++ b/packages/x-date-pickers/src/locales/ptBR.ts @@ -43,8 +43,8 @@ const ptBRPickers: Partial> = { dateRangePickerToolbarTitle: 'Selecione o intervalo entre datas', // Clock labels - clockLabelText: (view, time, adapter) => - `Selecione ${timeViews[view]}. ${time === null ? 'Hora não selecionada' : `Selecionado a hora ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Selecione ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Hora não selecionada' : `Selecionado a hora ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} horas`, minutesClockNumberText: (minutes) => `${minutes} minutos`, secondsClockNumberText: (seconds) => `${seconds} segundos`, @@ -59,13 +59,13 @@ const ptBRPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Escolha uma data, data selecionada ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Escolha uma data, data selecionada ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Escolha uma data', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Escolha uma hora, hora selecionada ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Escolha uma hora, hora selecionada ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Escolha uma hora', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/roRO.ts b/packages/x-date-pickers/src/locales/roRO.ts index 1b84639c2b9d..61ea968f77a9 100644 --- a/packages/x-date-pickers/src/locales/roRO.ts +++ b/packages/x-date-pickers/src/locales/roRO.ts @@ -44,8 +44,8 @@ const roROPickers: Partial> = { dateRangePickerToolbarTitle: 'Selectați intervalul de date', // Clock labels - clockLabelText: (view, time, adapter) => - `Selectați ${timeViews[view] ?? view}. ${time === null ? 'Nicio oră selectată' : `Ora selectată este ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Selectați ${timeViews[view] ?? view}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Nicio oră selectată' : `Ora selectată este ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} ${timeViews.hours}`, minutesClockNumberText: (minutes) => `${minutes} ${timeViews.minutes}`, secondsClockNumberText: (seconds) => `${seconds} ${timeViews.seconds}`, @@ -60,13 +60,13 @@ const roROPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Selectați data, data selectată este ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Selectați data, data selectată este ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Selectați data', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Selectați ora, ora selectată este ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Selectați ora, ora selectată este ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Selectați ora', fieldClearLabel: 'Golire conținut', diff --git a/packages/x-date-pickers/src/locales/ruRU.ts b/packages/x-date-pickers/src/locales/ruRU.ts index c91b2a4a594e..6b9286b59cb2 100644 --- a/packages/x-date-pickers/src/locales/ruRU.ts +++ b/packages/x-date-pickers/src/locales/ruRU.ts @@ -44,8 +44,8 @@ const ruRUPickers: Partial> = { dateRangePickerToolbarTitle: 'Выбрать период', // Clock labels - clockLabelText: (view, time, adapter) => - `Выбрать ${timeViews[view]}. ${time === null ? 'Время не выбрано' : `Выбрано время ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Выбрать ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Время не выбрано' : `Выбрано время ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} часов`, minutesClockNumberText: (minutes) => `${minutes} минут`, secondsClockNumberText: (seconds) => `${seconds} секунд`, @@ -60,13 +60,13 @@ const ruRUPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Выберите дату, выбрана дата ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Выберите дату, выбрана дата ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Выберите дату', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Выберите время, выбрано время ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Выберите время, выбрано время ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Выберите время', fieldClearLabel: 'Очистить значение', diff --git a/packages/x-date-pickers/src/locales/skSK.ts b/packages/x-date-pickers/src/locales/skSK.ts index 65bec28a0116..02b789b210a6 100644 --- a/packages/x-date-pickers/src/locales/skSK.ts +++ b/packages/x-date-pickers/src/locales/skSK.ts @@ -44,8 +44,8 @@ const skSKPickers: Partial> = { dateRangePickerToolbarTitle: 'Vyberete rozmedzie dátumov', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view] ?? view} vybraný. ${time === null ? 'Nie je vybraný čas' : `Vybraný čas je ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view] ?? view} vybraný. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Nie je vybraný čas' : `Vybraný čas je ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} hodín`, minutesClockNumberText: (minutes) => `${minutes} minút`, secondsClockNumberText: (seconds) => `${seconds} sekúnd`, @@ -60,13 +60,13 @@ const skSKPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vyberte dátum, vybraný dátum je ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Vyberte dátum, vybraný dátum je ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Vyberte dátum', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Vyberte čas, vybraný čas je ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Vyberte čas, vybraný čas je ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Vyberte čas', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/svSE.ts b/packages/x-date-pickers/src/locales/svSE.ts index f2a8465c30e8..339919c475ba 100644 --- a/packages/x-date-pickers/src/locales/svSE.ts +++ b/packages/x-date-pickers/src/locales/svSE.ts @@ -43,8 +43,8 @@ const svSEPickers: Partial> = { dateRangePickerToolbarTitle: 'Välj datumintervall', // Clock labels - clockLabelText: (view, time, adapter) => - `Välj ${timeViews[view]}. ${time === null ? 'Ingen tid vald' : `Vald tid är ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Välj ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Ingen tid vald' : `Vald tid är ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} timmar`, minutesClockNumberText: (minutes) => `${minutes} minuter`, secondsClockNumberText: (seconds) => `${seconds} sekunder`, @@ -59,13 +59,13 @@ const svSEPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Välj datum, valt datum är ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Välj datum, valt datum är ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Välj datum', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Välj tid, vald tid är ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Välj tid, vald tid är ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Välj tid', fieldClearLabel: 'Rensa värde', diff --git a/packages/x-date-pickers/src/locales/trTR.ts b/packages/x-date-pickers/src/locales/trTR.ts index c2335b0677fd..7cbab5da56b1 100644 --- a/packages/x-date-pickers/src/locales/trTR.ts +++ b/packages/x-date-pickers/src/locales/trTR.ts @@ -43,8 +43,8 @@ const trTRPickers: Partial> = { dateRangePickerToolbarTitle: 'Tarih aralığı seçin', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view]} seç. ${time === null ? 'Zaman seçilmedi' : `Seçilen zaman: ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view]} seç. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Zaman seçilmedi' : `Seçilen zaman: ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} saat`, minutesClockNumberText: (minutes) => `${minutes} dakika`, secondsClockNumberText: (seconds) => `${seconds} saniye`, @@ -59,13 +59,13 @@ const trTRPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Tarih seçin, seçilen tarih: ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Tarih seçin, seçilen tarih: ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Tarih seç', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Saat seçin, seçilen saat: ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Saat seçin, seçilen saat: ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Saat seç', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/ukUA.ts b/packages/x-date-pickers/src/locales/ukUA.ts index 2742d5dad70a..16ee5ef430a5 100644 --- a/packages/x-date-pickers/src/locales/ukUA.ts +++ b/packages/x-date-pickers/src/locales/ukUA.ts @@ -43,8 +43,8 @@ const ukUAPickers: Partial> = { dateRangePickerToolbarTitle: 'Вибрати календарний період', // Clock labels - clockLabelText: (view, time, adapter) => - `Вибрати ${timeViews[view]}. ${time === null ? 'Час не вибраний' : `Вибрано час ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Вибрати ${timeViews[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Час не вибраний' : `Вибрано час ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} годин`, minutesClockNumberText: (minutes) => `${minutes} хвилин`, secondsClockNumberText: (seconds) => `${seconds} секунд`, @@ -59,13 +59,13 @@ const ukUAPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Оберіть дату, обрана дата ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Оберіть дату, обрана дата ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Оберіть дату', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Оберіть час, обраний час ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Оберіть час, обраний час ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Оберіть час', fieldClearLabel: 'Очистити дані', diff --git a/packages/x-date-pickers/src/locales/urPK.ts b/packages/x-date-pickers/src/locales/urPK.ts index 125bd4fafbb9..557bd7dadcfc 100644 --- a/packages/x-date-pickers/src/locales/urPK.ts +++ b/packages/x-date-pickers/src/locales/urPK.ts @@ -43,8 +43,8 @@ const urPKPickers: Partial> = { dateRangePickerToolbarTitle: 'تاریخوں کی رینج منتخب کریں', // Clock labels - clockLabelText: (view, time, adapter) => - `${timeViews[view]} منتخب کریں ${time === null ? 'کوئی وقت منتخب نہیں' : `منتخب وقت ہے ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `${timeViews[view]} منتخب کریں ${!formattedTime && (time === null || !utils.isValid(time)) ? 'کوئی وقت منتخب نہیں' : `منتخب وقت ہے ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} گھنٹے`, minutesClockNumberText: (minutes) => `${minutes} منٹ`, secondsClockNumberText: (seconds) => `${seconds} سیکنڈ`, @@ -59,13 +59,13 @@ const urPKPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `تاریخ منتخب کریں، منتخب شدہ تاریخ ہے ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `تاریخ منتخب کریں، منتخب شدہ تاریخ ہے ${formattedDate ?? utils.format(value, 'fullDate')}` : 'تاریخ منتخب کریں', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `وقت منتخب کریں، منتخب شدہ وقت ہے ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `وقت منتخب کریں، منتخب شدہ وقت ہے ${formattedTime ?? utils.format(value, 'fullTime')}` : 'وقت منتخب کریں', // fieldClearLabel: 'Clear value', diff --git a/packages/x-date-pickers/src/locales/utils/getPickersLocalization.ts b/packages/x-date-pickers/src/locales/utils/getPickersLocalization.ts index 34b925b3773e..20600845e335 100644 --- a/packages/x-date-pickers/src/locales/utils/getPickersLocalization.ts +++ b/packages/x-date-pickers/src/locales/utils/getPickersLocalization.ts @@ -1,3 +1,4 @@ +import { AdapterFormats, MuiPickersAdapter, PickerValidDate } from '../../models'; import { PickersLocaleText } from './pickersLocaleTextApi'; export const getPickersLocalization = (pickersTranslations: Partial>) => { @@ -11,3 +12,29 @@ export const getPickersLocalization = (pickersTranslations: Partial(params: { + utils: MuiPickersAdapter; + formatKey: keyof AdapterFormats; + contextTranslation: ( + date: TDate | null, + utils: MuiPickersAdapter, + formattedValue: string | null, + ) => string; + propsTranslation: + | (( + date: TDate | null, + utils: MuiPickersAdapter, + formattedValue: string | null, + ) => string) + | undefined; +}) => { + const { utils, formatKey, contextTranslation, propsTranslation } = params; + + return (value: TDate | null) => { + const formattedValue = + value !== null && utils.isValid(value) ? utils.format(value, formatKey) : null; + const translation = propsTranslation ?? contextTranslation; + return translation(value, utils, formattedValue); + }; +}; diff --git a/packages/x-date-pickers/src/locales/utils/pickersLocaleTextApi.ts b/packages/x-date-pickers/src/locales/utils/pickersLocaleTextApi.ts index 9b6d77349cc8..38f4371fbe22 100644 --- a/packages/x-date-pickers/src/locales/utils/pickersLocaleTextApi.ts +++ b/packages/x-date-pickers/src/locales/utils/pickersLocaleTextApi.ts @@ -61,7 +61,19 @@ export interface PickersComponentAgnosticLocaleText) => string; + clockLabelText: ( + view: TimeView, + /** + * @deprecated Use `formattedTime` instead + */ + time: TDate | null, + /** + * @deprecated Use `formattedTime` instead + */ + utils: MuiPickersAdapter, + // TODO v8: Make it required + formattedTime?: string | null, + ) => string; hoursClockNumberText: (hours: string) => string; minutesClockNumberText: (minutes: string) => string; secondsClockNumberText: (seconds: string) => string; @@ -70,8 +82,30 @@ export interface PickersComponentAgnosticLocaleText string; // Open picker labels - openDatePickerDialogue: (date: TDate | null, utils: MuiPickersAdapter) => string; - openTimePickerDialogue: (date: TDate | null, utils: MuiPickersAdapter) => string; + openDatePickerDialogue: ( + /** + * @deprecated Use `formattedTime` instead + */ + date: TDate | null, + /** + * @deprecated Use `formattedTime` instead + */ + utils: MuiPickersAdapter, + // TODO v8: Make it required + formattedDate: string | null, + ) => string; + openTimePickerDialogue: ( + /** + * @deprecated Use `formattedTime` instead + */ + date: TDate | null, + /** + * @deprecated Use `formattedTime` instead + */ + utils: MuiPickersAdapter, + // TODO v8: Make it required + formattedTime: string | null, + ) => string; // Clear button label fieldClearLabel: string; diff --git a/packages/x-date-pickers/src/locales/viVN.ts b/packages/x-date-pickers/src/locales/viVN.ts index 6e269490c20a..5fddced07adc 100644 --- a/packages/x-date-pickers/src/locales/viVN.ts +++ b/packages/x-date-pickers/src/locales/viVN.ts @@ -43,8 +43,8 @@ const viVNPickers: Partial> = { dateRangePickerToolbarTitle: 'Chọn khoảng ngày', // Clock labels - clockLabelText: (view, time, adapter) => - `Chọn ${views[view]}. ${time === null ? 'Không có giờ được chọn' : `Giờ được chọn là ${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `Chọn ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? 'Không có giờ được chọn' : `Giờ được chọn là ${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours} giờ`, minutesClockNumberText: (minutes) => `${minutes} phút`, secondsClockNumberText: (seconds) => `${seconds} giây`, @@ -59,13 +59,13 @@ const viVNPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Chọn ngày, ngày đã chọn là ${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `Chọn ngày, ngày đã chọn là ${formattedDate ?? utils.format(value, 'fullDate')}` : 'Chọn ngày', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `Chọn giờ, giờ đã chọn là ${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `Chọn giờ, giờ đã chọn là ${formattedTime ?? utils.format(value, 'fullTime')}` : 'Chọn giờ', fieldClearLabel: 'Xóa giá trị', diff --git a/packages/x-date-pickers/src/locales/zhCN.ts b/packages/x-date-pickers/src/locales/zhCN.ts index d105f8fa5263..b564ce25b6e9 100644 --- a/packages/x-date-pickers/src/locales/zhCN.ts +++ b/packages/x-date-pickers/src/locales/zhCN.ts @@ -41,8 +41,8 @@ const zhCNPickers: Partial> = { dateRangePickerToolbarTitle: '选择时间范围', // Clock labels - clockLabelText: (view, time, adapter) => - `选择 ${views[view]}. ${time === null ? '未选择时间' : `已选择${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `选择 ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? '未选择时间' : `已选择${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours}小时`, minutesClockNumberText: (minutes) => `${minutes}分钟`, secondsClockNumberText: (seconds) => `${seconds}秒`, @@ -57,13 +57,13 @@ const zhCNPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `选择日期,已选择${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `选择日期,已选择${formattedDate ?? utils.format(value, 'fullDate')}` : '选择日期', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `选择时间,已选择${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `选择时间,已选择${formattedTime ?? utils.format(value, 'fullTime')}` : '选择时间', fieldClearLabel: '清除', diff --git a/packages/x-date-pickers/src/locales/zhHK.ts b/packages/x-date-pickers/src/locales/zhHK.ts index 9fb72b4769c5..067106afac2d 100644 --- a/packages/x-date-pickers/src/locales/zhHK.ts +++ b/packages/x-date-pickers/src/locales/zhHK.ts @@ -41,8 +41,8 @@ const zhHKPickers: Partial> = { dateRangePickerToolbarTitle: '選擇時間範圍', // Clock labels - clockLabelText: (view, time, adapter) => - `選擇 ${views[view]}. ${time === null ? '未選擇時間' : `已選擇${adapter.format(time, 'fullTime')}`}`, + clockLabelText: (view, time, utils, formattedTime) => + `選擇 ${views[view]}. ${!formattedTime && (time === null || !utils.isValid(time)) ? '未選擇時間' : `已選擇${formattedTime ?? utils.format(time, 'fullTime')}`}`, hoursClockNumberText: (hours) => `${hours}小時`, minutesClockNumberText: (minutes) => `${minutes}分鐘`, secondsClockNumberText: (seconds) => `${seconds}秒`, @@ -57,13 +57,13 @@ const zhHKPickers: Partial> = { calendarWeekNumberText: (weekNumber) => `${weekNumber}`, // Open picker labels - openDatePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `選擇日期,已選擇${utils.format(value, 'fullDate')}` + openDatePickerDialogue: (value, utils, formattedDate) => + formattedDate || (value !== null && utils.isValid(value)) + ? `選擇日期,已選擇${formattedDate ?? utils.format(value, 'fullDate')}` : '選擇日期', - openTimePickerDialogue: (value, utils) => - value !== null && utils.isValid(value) - ? `選擇時間,已選擇${utils.format(value, 'fullTime')}` + openTimePickerDialogue: (value, utils, formattedTime) => + formattedTime || (value !== null && utils.isValid(value)) + ? `選擇時間,已選擇${formattedTime ?? utils.format(value, 'fullTime')}` : '選擇時間', fieldClearLabel: '清除', From 94e84eea990df7ef5611a5a0bb3d75e95b817c13 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 8 Sep 2024 15:54:14 +0200 Subject: [PATCH 2/7] [core] Sync with core release flow --- docs/package.json | 2 +- scripts/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/package.json b/docs/package.json index 79341f12f452..6b1e887e152e 100644 --- a/docs/package.json +++ b/docs/package.json @@ -9,7 +9,7 @@ "build:clean": "rimraf .next && pnpm build", "build-sw": "node ./scripts/buildServiceWorker.js", "dev": "next dev --port 3001", - "deploy": "git push -f upstream next:docs-next", + "deploy": "git push -f upstream master:docs-v7", "icons": "rimraf public/static/icons/* && node ./scripts/buildIcons.js", "serve": "serve ./export -l 3010", "create-playground": "cpy --cwd=scripts playground.template.tsx ../../pages/playground --rename=index.tsx", diff --git a/scripts/README.md b/scripts/README.md index 930642d967a5..c6e13c5b3fdb 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -57,7 +57,7 @@ Push the working branch on the documentation release branch to deploy the docume ```bash -git push -f upstream master:docs-v7 +pnpm docs:deploy ``` You can follow the deployment process [on the Netlify Dashboard](https://app.netlify.com/sites/material-ui-x/deploys?filter=docs-v7) From 13a2ff112d2a7dec41625b06db04db860f590f58 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 8 Sep 2024 18:20:18 +0200 Subject: [PATCH 3/7] [docs] Match title with blog posts I'm reverting a bit #12309 to match the blog titles. --- docs/src/modules/components/WhatsNewLayout.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/src/modules/components/WhatsNewLayout.js b/docs/src/modules/components/WhatsNewLayout.js index d2df9ca9e718..e8c9e98729ef 100644 --- a/docs/src/modules/components/WhatsNewLayout.js +++ b/docs/src/modules/components/WhatsNewLayout.js @@ -18,7 +18,7 @@ import TimelineOppositeContent from '@mui/lab/TimelineOppositeContent'; const entries = [ { - title: 'MUI X v7.0.0', + title: 'MUI X v7', description: 'Featuring new components and multiple enhancements for both developers and end-users.', date: new Date(2024, 2, 21), @@ -63,7 +63,7 @@ const entries = [ ], }, { - title: 'MUI X v6.18.0', + title: 'MUI X v6.18', description: 'New stable components, polished features, better performance, and more.', date: new Date(2023, 10, 13), url: 'https://mui.com/blog/mui-x-end-v6-features/', @@ -95,7 +95,7 @@ const entries = [ ], }, { - title: 'MUI X v6.11.0', + title: 'MUI X v6.11', description: 'A roundup of all new features since v6.0.0.', date: new Date(2023, 7, 14), url: 'https://mui.com/blog/mui-x-mid-v6-features/', @@ -127,7 +127,7 @@ const entries = [ ], }, { - title: 'MUI X v6.0.0', + title: 'MUI X v6', description: 'A new major is available, with many new features and improvements.', date: new Date(2023, 2, 6), url: 'https://mui.com/blog/mui-x-v6/', @@ -163,7 +163,7 @@ const entries = [ ], }, { - title: 'MUI X Date Pickers v5.0.0', + title: 'MUI X Date Pickers v5', description: 'After some months of polishing in pre-releases, the Date Pickers finally get a stable.', date: new Date(2022, 8, 22), @@ -184,7 +184,7 @@ const entries = [ ], }, { - title: 'MUI X Data Grid v5.15.0', + title: 'MUI X Data Grid v5.15', description: 'This version brings an amazing set of new supported use cases with the Data Grid Premium.', date: new Date(2022, 7, 12), @@ -212,7 +212,7 @@ const entries = [ ], }, { - title: 'MUI X v5.0.0', + title: 'MUI X v5', description: 'A new Data Grid virtualization engine, and improvements in several APIs.', date: new Date(2021, 10, 22), url: 'https://mui.com/blog/mui-x-v5/', From 6e3ce20b130be51741b18444ba63eff64a7c3930 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Sun, 8 Sep 2024 19:29:12 +0200 Subject: [PATCH 4/7] [docs] Fix broken redirection to MUI X v5 --- docs/public/_redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/public/_redirects b/docs/public/_redirects index 07d154b73402..d025efe45dd5 100644 --- a/docs/public/_redirects +++ b/docs/public/_redirects @@ -53,7 +53,7 @@ /x/api/date-pickers/calendar-picker-skeleton/ /x/api/date-pickers/day-calendar-skeleton/ 301 /x/api/date-pickers/month-picker/ /x/api/date-pickers/month-calendar/ 301 /x/api/date-pickers/year-picker/ /x/api/date-pickers/year-calendar/ 301 -/x/react-data-grid/editing-legacy/ https://https://v5.mui.com/x/react-data-grid/editing-legacy/ 301 +/x/react-data-grid/editing-legacy/ https://v5.mui.com/x/react-data-grid/editing-legacy/ 301 /x/api/date-pickers/desktop-next-date-picker/ /x/api/date-pickers/desktop-date-picker/ 301 /x/api/date-pickers/next-date-picker/ /x/api/date-pickers/date-picker/ 301 /x/react-date-pickers/calendar/ /x/react-date-pickers/date-calendar/ 301 From 06b8c1322077a116086c17c894df0ebc198e4a43 Mon Sep 17 00:00:00 2001 From: Kristian Ignatov Date: Mon, 9 Sep 2024 16:03:04 +0900 Subject: [PATCH 5/7] [DateRangePicker] Fix `currentMonthCalendarPosition` not scrolling to future sibling (#14442) Co-authored-by: Lukas --- .../DateRangeCalendar.test.tsx | 17 +++++++ .../DateRangeCalendar/DateRangeCalendar.tsx | 2 +- .../tests/MobileDateRangePicker.test.tsx | 49 ++++++++++++++++--- 3 files changed, 60 insertions(+), 8 deletions(-) diff --git a/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx b/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx index 6c4f54626d5a..085f45fcde1b 100644 --- a/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx +++ b/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.test.tsx @@ -487,6 +487,23 @@ describe('', () => { clock.runToLast(); expect(getPickerDay('1', 'April 2018')).not.to.equal(null); }); + + describe('prop: currentMonthCalendarPosition', () => { + it('should switch to the selected month when changing value from the outside', () => { + const { setProps } = render( + , + ); + + setProps({ + value: [adapterToUse.date('2018-02-11'), adapterToUse.date('2018-02-22')], + }); + clock.runToLast(); + expect(getPickerDay('1', 'February 2018')).not.to.equal(null); + }); + }); }); ['readOnly', 'disabled'].forEach((prop) => { diff --git a/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.tsx b/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.tsx index aaa0bee3165c..0cc267212084 100644 --- a/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.tsx +++ b/packages/x-date-pickers-pro/src/DateRangeCalendar/DateRangeCalendar.tsx @@ -386,7 +386,7 @@ const DateRangeCalendar = React.forwardRef(function DateRangeCalendar< return; } - const displayingMonthRange = calendars - 1; + const displayingMonthRange = calendars - currentMonthCalendarPosition; const currentMonthNumber = utils.getMonth(calendarState.currentMonth); const requestedMonthNumber = utils.getMonth(date); diff --git a/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx b/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx index 76383fe45d87..3d4a95698bb5 100644 --- a/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx +++ b/packages/x-date-pickers-pro/src/MobileDateRangePicker/tests/MobileDateRangePicker.test.tsx @@ -92,7 +92,12 @@ describe('', () => { ); // Open the picker - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'start' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'start', + click: user.click, + }); expect(onChange.callCount).to.equal(0); expect(onAccept.callCount).to.equal(0); expect(onClose.callCount).to.equal(0); @@ -133,7 +138,12 @@ describe('', () => { ); // Open the picker - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'end' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'end', + click: user.click, + }); expect(onChange.callCount).to.equal(0); expect(onAccept.callCount).to.equal(0); expect(onClose.callCount).to.equal(0); @@ -165,7 +175,12 @@ describe('', () => { />, ); - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'end' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'end', + click: user.click, + }); // Change the end date await user.click(screen.getByRole('gridcell', { name: '3' })); @@ -196,7 +211,12 @@ describe('', () => { />, ); - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'start' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'start', + click: user.click, + }); // Change the start date (already tested) await user.click(screen.getByRole('gridcell', { name: '3' })); @@ -229,7 +249,12 @@ describe('', () => { />, ); - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'start' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'start', + click: user.click, + }); // Change the start date (already tested) await user.click(screen.getByRole('gridcell', { name: '3' })); @@ -263,7 +288,12 @@ describe('', () => { />, ); - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'start' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'start', + click: user.click, + }); // Clear the date await user.click(screen.getByText(/clear/i)); @@ -290,7 +320,12 @@ describe('', () => { />, ); - openPicker({ type: 'date-range', variant: 'mobile', initialFocus: 'start' }); + await openPicker({ + type: 'date-range', + variant: 'mobile', + initialFocus: 'start', + click: user.click, + }); // Clear the date await user.click(screen.getByText(/clear/i)); From f9e4b843654df774c2d9b9b17de6634129e126d0 Mon Sep 17 00:00:00 2001 From: Kenan Yusuf Date: Mon, 9 Sep 2024 09:10:21 +0100 Subject: [PATCH 6/7] [DataGrid] Add "does not equal" and "does not contain" filter operators (#14489) --- docs/data/data-grid/localization/data.json | 140 +++++++++--------- .../src/colDef/gridStringOperators.ts | 30 ++++ .../panel/filterPanel/GridFilterForm.tsx | 2 +- .../src/constants/localeTextConstants.ts | 4 + packages/x-data-grid/src/locales/arSD.ts | 4 + packages/x-data-grid/src/locales/beBY.ts | 4 + packages/x-data-grid/src/locales/bgBG.ts | 4 + packages/x-data-grid/src/locales/csCZ.ts | 4 + packages/x-data-grid/src/locales/daDK.ts | 4 + packages/x-data-grid/src/locales/deDE.ts | 4 + packages/x-data-grid/src/locales/elGR.ts | 4 + packages/x-data-grid/src/locales/esES.ts | 4 + packages/x-data-grid/src/locales/faIR.ts | 4 + packages/x-data-grid/src/locales/fiFI.ts | 4 + packages/x-data-grid/src/locales/frFR.ts | 4 + packages/x-data-grid/src/locales/heIL.ts | 4 + packages/x-data-grid/src/locales/hrHR.ts | 4 + packages/x-data-grid/src/locales/huHU.ts | 4 + packages/x-data-grid/src/locales/isIS.ts | 4 + packages/x-data-grid/src/locales/itIT.ts | 4 + packages/x-data-grid/src/locales/jaJP.ts | 4 + packages/x-data-grid/src/locales/koKR.ts | 4 + packages/x-data-grid/src/locales/nbNO.ts | 4 + packages/x-data-grid/src/locales/nlNL.ts | 4 + packages/x-data-grid/src/locales/nnNO.ts | 4 + packages/x-data-grid/src/locales/plPL.ts | 4 + packages/x-data-grid/src/locales/ptBR.ts | 4 + packages/x-data-grid/src/locales/ptPT.ts | 4 + packages/x-data-grid/src/locales/roRO.ts | 4 + packages/x-data-grid/src/locales/ruRU.ts | 4 + packages/x-data-grid/src/locales/skSK.ts | 4 + packages/x-data-grid/src/locales/svSE.ts | 4 + packages/x-data-grid/src/locales/trTR.ts | 4 + packages/x-data-grid/src/locales/ukUA.ts | 4 + packages/x-data-grid/src/locales/urPK.ts | 4 + packages/x-data-grid/src/locales/viVN.ts | 4 + packages/x-data-grid/src/locales/zhCN.ts | 4 + packages/x-data-grid/src/locales/zhHK.ts | 4 + packages/x-data-grid/src/locales/zhTW.ts | 4 + .../src/models/api/gridLocaleTextApi.ts | 4 + .../src/tests/filtering.DataGrid.test.tsx | 121 +++++++++++++++ 41 files changed, 370 insertions(+), 71 deletions(-) diff --git a/docs/data/data-grid/localization/data.json b/docs/data/data-grid/localization/data.json index fab29456d103..749218b3547d 100644 --- a/docs/data/data-grid/localization/data.json +++ b/docs/data/data-grid/localization/data.json @@ -3,280 +3,280 @@ "languageTag": "ar-SD", "importName": "arSD", "localeName": "Arabic (Sudan)", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/arSD.ts" }, { "languageTag": "be-BY", "importName": "beBY", "localeName": "Belarusian", - "missingKeysCount": 30, - "totalKeysCount": 118, + "missingKeysCount": 34, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/beBY.ts" }, { "languageTag": "bg-BG", "importName": "bgBG", "localeName": "Bulgarian", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/bgBG.ts" }, { "languageTag": "zh-HK", "importName": "zhHK", "localeName": "Chinese (Hong Kong)", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/zhHK.ts" }, { "languageTag": "zh-CN", "importName": "zhCN", "localeName": "Chinese (Simplified)", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/zhCN.ts" }, { "languageTag": "zh-TW", "importName": "zhTW", "localeName": "Chinese (Taiwan)", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/zhTW.ts" }, { "languageTag": "hr-HR", "importName": "hrHR", "localeName": "Croatian", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/hrHR.ts" }, { "languageTag": "cs-CZ", "importName": "csCZ", "localeName": "Czech", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/csCZ.ts" }, { "languageTag": "da-DK", "importName": "daDK", "localeName": "Danish", - "missingKeysCount": 1, - "totalKeysCount": 118, + "missingKeysCount": 5, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/daDK.ts" }, { "languageTag": "nl-NL", "importName": "nlNL", "localeName": "Dutch", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/nlNL.ts" }, { "languageTag": "fi-FI", "importName": "fiFI", "localeName": "Finnish", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/fiFI.ts" }, { "languageTag": "fr-FR", "importName": "frFR", "localeName": "French", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/frFR.ts" }, { "languageTag": "de-DE", "importName": "deDE", "localeName": "German", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/deDE.ts" }, { "languageTag": "el-GR", "importName": "elGR", "localeName": "Greek", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/elGR.ts" }, { "languageTag": "he-IL", "importName": "heIL", "localeName": "Hebrew", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/heIL.ts" }, { "languageTag": "hu-HU", "importName": "huHU", "localeName": "Hungarian", - "missingKeysCount": 6, - "totalKeysCount": 118, + "missingKeysCount": 10, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/huHU.ts" }, { "languageTag": "is-IS", "importName": "isIS", "localeName": "Icelandic", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/isIS.ts" }, { "languageTag": "it-IT", "importName": "itIT", "localeName": "Italian", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/itIT.ts" }, { "languageTag": "ja-JP", "importName": "jaJP", "localeName": "Japanese", - "missingKeysCount": 1, - "totalKeysCount": 118, + "missingKeysCount": 5, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/jaJP.ts" }, { "languageTag": "ko-KR", "importName": "koKR", "localeName": "Korean", - "missingKeysCount": 31, - "totalKeysCount": 118, + "missingKeysCount": 35, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/koKR.ts" }, { "languageTag": "nb-NO", "importName": "nbNO", "localeName": "Norwegian (Bokmål)", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/nbNO.ts" }, { "languageTag": "nn-NO", "importName": "nnNO", "localeName": "Norwegian (Nynorsk)", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/nnNO.ts" }, { "languageTag": "fa-IR", "importName": "faIR", "localeName": "Persian", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/faIR.ts" }, { "languageTag": "pl-PL", "importName": "plPL", "localeName": "Polish", - "missingKeysCount": 31, - "totalKeysCount": 118, + "missingKeysCount": 35, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/plPL.ts" }, { "languageTag": "pt-PT", "importName": "ptPT", "localeName": "Portuguese", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/ptPT.ts" }, { "languageTag": "pt-BR", "importName": "ptBR", "localeName": "Portuguese (Brazil)", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/ptBR.ts" }, { "languageTag": "ro-RO", "importName": "roRO", "localeName": "Romanian", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/roRO.ts" }, { "languageTag": "ru-RU", "importName": "ruRU", "localeName": "Russian", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/ruRU.ts" }, { "languageTag": "sk-SK", "importName": "skSK", "localeName": "Slovak", - "missingKeysCount": 1, - "totalKeysCount": 118, + "missingKeysCount": 5, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/skSK.ts" }, { "languageTag": "es-ES", "importName": "esES", "localeName": "Spanish", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/esES.ts" }, { "languageTag": "sv-SE", "importName": "svSE", "localeName": "Swedish", - "missingKeysCount": 1, - "totalKeysCount": 118, + "missingKeysCount": 5, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/svSE.ts" }, { "languageTag": "tr-TR", "importName": "trTR", "localeName": "Turkish", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/trTR.ts" }, { "languageTag": "uk-UA", "importName": "ukUA", "localeName": "Ukrainian", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/ukUA.ts" }, { "languageTag": "ur-PK", "importName": "urPK", "localeName": "Urdu (Pakistan)", - "missingKeysCount": 4, - "totalKeysCount": 118, + "missingKeysCount": 8, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/urPK.ts" }, { "languageTag": "vi-VN", "importName": "viVN", "localeName": "Vietnamese", - "missingKeysCount": 0, - "totalKeysCount": 118, + "missingKeysCount": 4, + "totalKeysCount": 122, "githubLink": "https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/locales/viVN.ts" } ] diff --git a/packages/x-data-grid/src/colDef/gridStringOperators.ts b/packages/x-data-grid/src/colDef/gridStringOperators.ts index 5d35dc96e696..00c0c0a5b82f 100644 --- a/packages/x-data-grid/src/colDef/gridStringOperators.ts +++ b/packages/x-data-grid/src/colDef/gridStringOperators.ts @@ -38,6 +38,21 @@ export const getGridStringOperators = ( }, InputComponent: GridFilterInputValue, }, + { + value: 'doesNotContain', + getApplyFilterFn: (filterItem: GridFilterItem) => { + if (!filterItem.value) { + return null; + } + const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim(); + + const filterRegex = new RegExp(escapeRegExp(filterItemValue), 'i'); + return (value): boolean => { + return value != null ? !filterRegex.test(String(value)) : true; + }; + }, + InputComponent: GridFilterInputValue, + }, { value: 'equals', getApplyFilterFn: (filterItem: GridFilterItem) => { @@ -53,6 +68,21 @@ export const getGridStringOperators = ( }, InputComponent: GridFilterInputValue, }, + { + value: 'doesNotEqual', + getApplyFilterFn: (filterItem: GridFilterItem) => { + if (!filterItem.value) { + return null; + } + const filterItemValue = disableTrim ? filterItem.value : filterItem.value.trim(); + + const collator = new Intl.Collator(undefined, { sensitivity: 'base', usage: 'search' }); + return (value): boolean => { + return value != null ? collator.compare(filterItemValue, value.toString()) !== 0 : true; + }; + }, + InputComponent: GridFilterInputValue, + }, { value: 'startsWith', getApplyFilterFn: (filterItem: GridFilterItem) => { diff --git a/packages/x-data-grid/src/components/panel/filterPanel/GridFilterForm.tsx b/packages/x-data-grid/src/components/panel/filterPanel/GridFilterForm.tsx index c30e5af630d0..7b77c926b43a 100644 --- a/packages/x-data-grid/src/components/panel/filterPanel/GridFilterForm.tsx +++ b/packages/x-data-grid/src/components/panel/filterPanel/GridFilterForm.tsx @@ -180,7 +180,7 @@ const FilterFormOperatorInput = styled('div', { name: 'MuiDataGrid', slot: 'FilterFormOperatorInput', overridesResolver: (_, styles) => styles.filterFormOperatorInput, -})<{ ownerState: OwnerState }>({ width: 120 }); +})<{ ownerState: OwnerState }>({ width: 150 }); const FilterFormValueInput = styled('div', { name: 'MuiDataGrid', diff --git a/packages/x-data-grid/src/constants/localeTextConstants.ts b/packages/x-data-grid/src/constants/localeTextConstants.ts index 9e250f030f7d..c0d29a97a0e9 100644 --- a/packages/x-data-grid/src/constants/localeTextConstants.ts +++ b/packages/x-data-grid/src/constants/localeTextConstants.ts @@ -56,7 +56,9 @@ export const GRID_DEFAULT_LOCALE_TEXT: GridLocaleText = { // Filter operators text filterOperatorContains: 'contains', + filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'equals', + filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'starts with', filterOperatorEndsWith: 'ends with', filterOperatorIs: 'is', @@ -77,7 +79,9 @@ export const GRID_DEFAULT_LOCALE_TEXT: GridLocaleText = { // Header filter operators text headerFilterOperatorContains: 'Contains', + headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Equals', + headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Starts with', headerFilterOperatorEndsWith: 'Ends with', headerFilterOperatorIs: 'Is', diff --git a/packages/x-data-grid/src/locales/arSD.ts b/packages/x-data-grid/src/locales/arSD.ts index a7e21456418e..5d3ebd5993e5 100644 --- a/packages/x-data-grid/src/locales/arSD.ts +++ b/packages/x-data-grid/src/locales/arSD.ts @@ -58,7 +58,9 @@ const arSDGrid: Partial = { // Filter operators text filterOperatorContains: 'يحتوي', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'يساوي', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'يبدأ بـ', filterOperatorEndsWith: 'ينتهي بـ', filterOperatorIs: 'يكون', @@ -79,7 +81,9 @@ const arSDGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'يحتوي على', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'يساوي', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'يبدأ ب', headerFilterOperatorEndsWith: 'ينتهي ب', headerFilterOperatorIs: 'هو', diff --git a/packages/x-data-grid/src/locales/beBY.ts b/packages/x-data-grid/src/locales/beBY.ts index b10dd30d81fd..bba9d37e0fbd 100644 --- a/packages/x-data-grid/src/locales/beBY.ts +++ b/packages/x-data-grid/src/locales/beBY.ts @@ -81,7 +81,9 @@ const beBYGrid: Partial = { // Filter operators text filterOperatorContains: 'змяшчае', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'роўны', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'пачынаецца з', filterOperatorEndsWith: 'скончваецца на', filterOperatorIs: 'роўны', @@ -102,7 +104,9 @@ const beBYGrid: Partial = { // Header filter operators text // headerFilterOperatorContains: 'Contains', + // headerFilterOperatorDoesNotContain: 'Does not contain', // headerFilterOperatorEquals: 'Equals', + // headerFilterOperatorDoesNotEqual: 'Does not equal', // headerFilterOperatorStartsWith: 'Starts with', // headerFilterOperatorEndsWith: 'Ends with', // headerFilterOperatorIs: 'Is', diff --git a/packages/x-data-grid/src/locales/bgBG.ts b/packages/x-data-grid/src/locales/bgBG.ts index 9dccb867a252..01420eeb886f 100644 --- a/packages/x-data-grid/src/locales/bgBG.ts +++ b/packages/x-data-grid/src/locales/bgBG.ts @@ -57,7 +57,9 @@ const bgBGGrid: Partial = { // Filter operators text filterOperatorContains: 'съдържа', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'равно', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'започва с', filterOperatorEndsWith: 'завършва с', filterOperatorIs: 'е', @@ -78,7 +80,9 @@ const bgBGGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Съдържа', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Равнo', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Започва с', headerFilterOperatorEndsWith: 'Завършва с', headerFilterOperatorIs: 'Равно е на', diff --git a/packages/x-data-grid/src/locales/csCZ.ts b/packages/x-data-grid/src/locales/csCZ.ts index 420a6fa81191..c5b26a3ce10e 100644 --- a/packages/x-data-grid/src/locales/csCZ.ts +++ b/packages/x-data-grid/src/locales/csCZ.ts @@ -65,7 +65,9 @@ const csCZGrid: Partial = { // Filter operators text filterOperatorContains: 'obsahuje', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'rovná se', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'začíná na', filterOperatorEndsWith: 'končí na', filterOperatorIs: 'je', @@ -86,7 +88,9 @@ const csCZGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Obsahuje', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Rovná se', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Začíná na', headerFilterOperatorEndsWith: 'Končí na', headerFilterOperatorIs: 'Je', diff --git a/packages/x-data-grid/src/locales/daDK.ts b/packages/x-data-grid/src/locales/daDK.ts index 903707551090..9e31979bb081 100644 --- a/packages/x-data-grid/src/locales/daDK.ts +++ b/packages/x-data-grid/src/locales/daDK.ts @@ -58,7 +58,9 @@ const daDKGrid: Partial = { // Filter operators text filterOperatorContains: 'indeholder', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'lig med', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'begynder med', filterOperatorEndsWith: 'ender med', filterOperatorIs: 'er lig med', @@ -79,7 +81,9 @@ const daDKGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Indeholder', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Lig med', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Begynder med', headerFilterOperatorEndsWith: 'Ender med', headerFilterOperatorIs: 'Er lig med', diff --git a/packages/x-data-grid/src/locales/deDE.ts b/packages/x-data-grid/src/locales/deDE.ts index 6d4faf098abd..38787ebf21ae 100644 --- a/packages/x-data-grid/src/locales/deDE.ts +++ b/packages/x-data-grid/src/locales/deDE.ts @@ -58,7 +58,9 @@ const deDEGrid: Partial = { // Filter operators text filterOperatorContains: 'enthält', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'ist gleich', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'beginnt mit', filterOperatorEndsWith: 'endet mit', filterOperatorIs: 'ist', @@ -79,7 +81,9 @@ const deDEGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Enthält', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Gleich', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Beginnt mit', headerFilterOperatorEndsWith: 'Endet mit', headerFilterOperatorIs: 'Ist', diff --git a/packages/x-data-grid/src/locales/elGR.ts b/packages/x-data-grid/src/locales/elGR.ts index be950a449d3b..dbd6bdc36f3d 100644 --- a/packages/x-data-grid/src/locales/elGR.ts +++ b/packages/x-data-grid/src/locales/elGR.ts @@ -58,7 +58,9 @@ const elGRGrid: Partial = { // Filter operators text filterOperatorContains: 'περιέχει', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'ισούται', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'ξεκινάει με', filterOperatorEndsWith: 'τελειώνει με', filterOperatorIs: 'είναι', @@ -79,7 +81,9 @@ const elGRGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Περιέχει', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Ισούται', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Ξεκινάει με', headerFilterOperatorEndsWith: 'Τελειώνει με', headerFilterOperatorIs: 'Είναι', diff --git a/packages/x-data-grid/src/locales/esES.ts b/packages/x-data-grid/src/locales/esES.ts index 6393ea8f9506..8547eb2602ea 100644 --- a/packages/x-data-grid/src/locales/esES.ts +++ b/packages/x-data-grid/src/locales/esES.ts @@ -58,7 +58,9 @@ const esESGrid: Partial = { // Filter operators text filterOperatorContains: 'contiene', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'es igual', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'comienza con', filterOperatorEndsWith: 'termina con', filterOperatorIs: 'es', @@ -79,7 +81,9 @@ const esESGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Contiene', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Es igual a', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Comienza con', headerFilterOperatorEndsWith: 'Termina con', headerFilterOperatorIs: 'Es', diff --git a/packages/x-data-grid/src/locales/faIR.ts b/packages/x-data-grid/src/locales/faIR.ts index 80da042c1396..41dbdd4ca402 100644 --- a/packages/x-data-grid/src/locales/faIR.ts +++ b/packages/x-data-grid/src/locales/faIR.ts @@ -58,7 +58,9 @@ const faIRGrid: Partial = { // Filter operators text filterOperatorContains: 'شامل', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'مساوی', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'شروع با', filterOperatorEndsWith: 'پایان با', filterOperatorIs: 'هست', @@ -79,7 +81,9 @@ const faIRGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'شامل', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'مساوی', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'شروع با', headerFilterOperatorEndsWith: 'پایان با', headerFilterOperatorIs: 'هست', diff --git a/packages/x-data-grid/src/locales/fiFI.ts b/packages/x-data-grid/src/locales/fiFI.ts index ba94f12f0644..d8fee01123fb 100644 --- a/packages/x-data-grid/src/locales/fiFI.ts +++ b/packages/x-data-grid/src/locales/fiFI.ts @@ -58,7 +58,9 @@ const fiFIGrid: Partial = { // Filter operators text filterOperatorContains: 'sisältää', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'on yhtä suuri kuin', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'alkaa', filterOperatorEndsWith: 'päättyy', filterOperatorIs: 'on', @@ -79,7 +81,9 @@ const fiFIGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Sisältää', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'On yhtä suuri kuin', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Alkaa', headerFilterOperatorEndsWith: 'Päättyy', headerFilterOperatorIs: 'On', diff --git a/packages/x-data-grid/src/locales/frFR.ts b/packages/x-data-grid/src/locales/frFR.ts index 7f6d91858cf9..2b1f3805a77a 100644 --- a/packages/x-data-grid/src/locales/frFR.ts +++ b/packages/x-data-grid/src/locales/frFR.ts @@ -58,7 +58,9 @@ const frFRGrid: Partial = { // Filter operators text filterOperatorContains: 'contient', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'est égal à', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'commence par', filterOperatorEndsWith: 'se termine par', filterOperatorIs: 'est', @@ -79,7 +81,9 @@ const frFRGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Contient', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Est égal à', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Commence par', headerFilterOperatorEndsWith: 'Se termine par', headerFilterOperatorIs: 'Est', diff --git a/packages/x-data-grid/src/locales/heIL.ts b/packages/x-data-grid/src/locales/heIL.ts index aad7217923e9..61556403a76a 100644 --- a/packages/x-data-grid/src/locales/heIL.ts +++ b/packages/x-data-grid/src/locales/heIL.ts @@ -58,7 +58,9 @@ const heILGrid: Partial = { // Filter operators text filterOperatorContains: 'מכיל', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'שווה', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'מתחיל ב-', filterOperatorEndsWith: 'נגמר ב-', filterOperatorIs: 'הינו', @@ -79,7 +81,9 @@ const heILGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'מכיל', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'שווה', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'מתחיל ב-', headerFilterOperatorEndsWith: 'נגמר ב-', headerFilterOperatorIs: 'הינו', diff --git a/packages/x-data-grid/src/locales/hrHR.ts b/packages/x-data-grid/src/locales/hrHR.ts index 810bb643c637..3691ee737004 100644 --- a/packages/x-data-grid/src/locales/hrHR.ts +++ b/packages/x-data-grid/src/locales/hrHR.ts @@ -58,7 +58,9 @@ const hrHRGrid: Partial = { // Filter operators text filterOperatorContains: 'sadrži', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'jednaki', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'počinje sa', filterOperatorEndsWith: 'završava sa', filterOperatorIs: 'je', @@ -79,7 +81,9 @@ const hrHRGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Sadrži', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Jednako', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Počinje sa', headerFilterOperatorEndsWith: 'Završava s', headerFilterOperatorIs: 'Je', diff --git a/packages/x-data-grid/src/locales/huHU.ts b/packages/x-data-grid/src/locales/huHU.ts index d2ef0c74e648..83c03dd7b42d 100644 --- a/packages/x-data-grid/src/locales/huHU.ts +++ b/packages/x-data-grid/src/locales/huHU.ts @@ -57,7 +57,9 @@ const huHUGrid: Partial = { // Filter operators text filterOperatorContains: 'tartalmazza:', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'egyenlő ezzel:', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'ezzel kezdődik:', filterOperatorEndsWith: 'ezzel végződik:', filterOperatorIs: 'a következő:', @@ -78,7 +80,9 @@ const huHUGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Tartalmazza:', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Egyenlő ezzel:', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Ezzel kezdődik:', headerFilterOperatorEndsWith: 'Ezzel végződik:', // headerFilterOperatorIs: 'Is', diff --git a/packages/x-data-grid/src/locales/isIS.ts b/packages/x-data-grid/src/locales/isIS.ts index 00ccef4cd83c..307231873d9d 100644 --- a/packages/x-data-grid/src/locales/isIS.ts +++ b/packages/x-data-grid/src/locales/isIS.ts @@ -58,7 +58,9 @@ const isISGrid: Partial = { // Filter operators text filterOperatorContains: 'inniheldur', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'jafnt og', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'byrjar með', filterOperatorEndsWith: 'endar með', filterOperatorIs: 'er líka með', @@ -79,7 +81,9 @@ const isISGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Inniheldur', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Jafnt og', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Byrjar með', headerFilterOperatorEndsWith: 'Endar með', headerFilterOperatorIs: 'Er jafnt og', diff --git a/packages/x-data-grid/src/locales/itIT.ts b/packages/x-data-grid/src/locales/itIT.ts index a3f37daa1ab3..31b09da652c5 100644 --- a/packages/x-data-grid/src/locales/itIT.ts +++ b/packages/x-data-grid/src/locales/itIT.ts @@ -58,7 +58,9 @@ const itITGrid: Partial = { // Filter operators text filterOperatorContains: 'contiene', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'uguale a', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'comincia per', filterOperatorEndsWith: 'termina per', filterOperatorIs: 'uguale a', @@ -79,7 +81,9 @@ const itITGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Contiene', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'uguale a', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'comincia per', headerFilterOperatorEndsWith: 'termina per', headerFilterOperatorIs: 'uguale a', diff --git a/packages/x-data-grid/src/locales/jaJP.ts b/packages/x-data-grid/src/locales/jaJP.ts index 716735e96847..e34a41428381 100644 --- a/packages/x-data-grid/src/locales/jaJP.ts +++ b/packages/x-data-grid/src/locales/jaJP.ts @@ -57,7 +57,9 @@ const jaJPGrid: Partial = { // Filter operators text filterOperatorContains: '...を含む', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: '...に等しい', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: '...で始まる', filterOperatorEndsWith: '...で終わる', filterOperatorIs: '...である', @@ -78,7 +80,9 @@ const jaJPGrid: Partial = { // Header filter operators text headerFilterOperatorContains: '含む', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: '等しい', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'で始まる', headerFilterOperatorEndsWith: 'で終わる', headerFilterOperatorIs: 'である', diff --git a/packages/x-data-grid/src/locales/koKR.ts b/packages/x-data-grid/src/locales/koKR.ts index 6f0546460d61..671f6abd0520 100644 --- a/packages/x-data-grid/src/locales/koKR.ts +++ b/packages/x-data-grid/src/locales/koKR.ts @@ -57,7 +57,9 @@ const koKRGrid: Partial = { // Filter operators text filterOperatorContains: '포함하는', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: '값이 같은', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: '시작하는', filterOperatorEndsWith: '끝나는', filterOperatorIs: '~인', @@ -78,7 +80,9 @@ const koKRGrid: Partial = { // Header filter operators text // headerFilterOperatorContains: 'Contains', + // headerFilterOperatorDoesNotContain: 'Does not contain', // headerFilterOperatorEquals: 'Equals', + // headerFilterOperatorDoesNotEqual: 'Does not equal', // headerFilterOperatorStartsWith: 'Starts with', // headerFilterOperatorEndsWith: 'Ends with', // headerFilterOperatorIs: 'Is', diff --git a/packages/x-data-grid/src/locales/nbNO.ts b/packages/x-data-grid/src/locales/nbNO.ts index 16de342b6999..9fa25b0cc4f8 100644 --- a/packages/x-data-grid/src/locales/nbNO.ts +++ b/packages/x-data-grid/src/locales/nbNO.ts @@ -58,7 +58,9 @@ const nbNOGrid: Partial = { // Filter operators text filterOperatorContains: 'inneholder', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'er lik', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'starter med', filterOperatorEndsWith: 'slutter med', filterOperatorIs: 'er', @@ -79,7 +81,9 @@ const nbNOGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Inneholder', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Lik', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Starter på', headerFilterOperatorEndsWith: 'Slutter på', headerFilterOperatorIs: 'Er', diff --git a/packages/x-data-grid/src/locales/nlNL.ts b/packages/x-data-grid/src/locales/nlNL.ts index d60dd87015c1..ccc1f5378ab4 100644 --- a/packages/x-data-grid/src/locales/nlNL.ts +++ b/packages/x-data-grid/src/locales/nlNL.ts @@ -58,7 +58,9 @@ const nlNLGrid: Partial = { // Filter operators text filterOperatorContains: 'bevat', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'gelijk aan', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'begint met', filterOperatorEndsWith: 'eindigt met', filterOperatorIs: 'is', @@ -79,7 +81,9 @@ const nlNLGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Bevat', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Gelijk aan', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Begint met', headerFilterOperatorEndsWith: 'Eindigt met', headerFilterOperatorIs: 'Is', diff --git a/packages/x-data-grid/src/locales/nnNO.ts b/packages/x-data-grid/src/locales/nnNO.ts index 8ef20a566b6c..58595a0a4456 100644 --- a/packages/x-data-grid/src/locales/nnNO.ts +++ b/packages/x-data-grid/src/locales/nnNO.ts @@ -58,7 +58,9 @@ const nnNOGrid: Partial = { // Filter operators text filterOperatorContains: 'inneheld', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'er lik', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'startar med', filterOperatorEndsWith: 'sluttar med', filterOperatorIs: 'er', @@ -79,7 +81,9 @@ const nnNOGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Inneheld', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Lik', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Startar på', headerFilterOperatorEndsWith: 'Sluttar på', headerFilterOperatorIs: 'Er', diff --git a/packages/x-data-grid/src/locales/plPL.ts b/packages/x-data-grid/src/locales/plPL.ts index bf9bcb6eae46..07ea181044ea 100644 --- a/packages/x-data-grid/src/locales/plPL.ts +++ b/packages/x-data-grid/src/locales/plPL.ts @@ -57,7 +57,9 @@ const plPLGrid: Partial = { // Filter operators text filterOperatorContains: 'zawiera', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'równa się', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'zaczyna się od', filterOperatorEndsWith: 'kończy się na', filterOperatorIs: 'równa się', @@ -78,7 +80,9 @@ const plPLGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Zawiera', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Równa się', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Zaczyna się od', headerFilterOperatorEndsWith: 'Kończy się na', // headerFilterOperatorIs: 'Is', diff --git a/packages/x-data-grid/src/locales/ptBR.ts b/packages/x-data-grid/src/locales/ptBR.ts index 09480e624907..bd9a3153b868 100644 --- a/packages/x-data-grid/src/locales/ptBR.ts +++ b/packages/x-data-grid/src/locales/ptBR.ts @@ -58,7 +58,9 @@ const ptBRGrid: Partial = { // Filter operators text filterOperatorContains: 'contém', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'é igual a', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'começa com', filterOperatorEndsWith: 'termina com', filterOperatorIs: 'é', @@ -79,7 +81,9 @@ const ptBRGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Contém', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Igual', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Começa com', headerFilterOperatorEndsWith: 'Termina com', headerFilterOperatorIs: 'É', diff --git a/packages/x-data-grid/src/locales/ptPT.ts b/packages/x-data-grid/src/locales/ptPT.ts index 9c1e56604e5f..892802ec2cc4 100644 --- a/packages/x-data-grid/src/locales/ptPT.ts +++ b/packages/x-data-grid/src/locales/ptPT.ts @@ -58,7 +58,9 @@ const ptPTGrid: Partial = { // Filter operators text filterOperatorContains: 'contém', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'é igual a', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'começa com', filterOperatorEndsWith: 'termina com', filterOperatorIs: 'é', @@ -79,7 +81,9 @@ const ptPTGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Contém', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'É igual a', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Começa com', headerFilterOperatorEndsWith: 'Termina com', headerFilterOperatorIs: 'É', diff --git a/packages/x-data-grid/src/locales/roRO.ts b/packages/x-data-grid/src/locales/roRO.ts index b9e9cf9c8411..2a2db174eeac 100644 --- a/packages/x-data-grid/src/locales/roRO.ts +++ b/packages/x-data-grid/src/locales/roRO.ts @@ -58,7 +58,9 @@ const roROGrid: Partial = { // Filter operators text filterOperatorContains: 'conține', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'este egal cu', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'începe cu', filterOperatorEndsWith: 'se termină cu', filterOperatorIs: 'este', @@ -79,7 +81,9 @@ const roROGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Conține', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Egal cu', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Începe cu', headerFilterOperatorEndsWith: 'Se termină cu', headerFilterOperatorIs: 'Este', diff --git a/packages/x-data-grid/src/locales/ruRU.ts b/packages/x-data-grid/src/locales/ruRU.ts index 5118149bd36a..54a7b8514962 100644 --- a/packages/x-data-grid/src/locales/ruRU.ts +++ b/packages/x-data-grid/src/locales/ruRU.ts @@ -82,7 +82,9 @@ const ruRUGrid: Partial = { // Filter operators text filterOperatorContains: 'содержит', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'равен', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'начинается с', filterOperatorEndsWith: 'заканчивается на', filterOperatorIs: 'равен', @@ -103,7 +105,9 @@ const ruRUGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'содержит', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'равен', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'начинается с', headerFilterOperatorEndsWith: 'заканчивается на', headerFilterOperatorIs: 'равен', diff --git a/packages/x-data-grid/src/locales/skSK.ts b/packages/x-data-grid/src/locales/skSK.ts index 4106d3cb3482..f1d2f3be0513 100644 --- a/packages/x-data-grid/src/locales/skSK.ts +++ b/packages/x-data-grid/src/locales/skSK.ts @@ -65,7 +65,9 @@ const skSKGrid: Partial = { // Filter operators text filterOperatorContains: 'obsahuje', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'rovná sa', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'začína s', filterOperatorEndsWith: 'končí na', filterOperatorIs: 'je', @@ -86,7 +88,9 @@ const skSKGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Obsahuje', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Rovná sa', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Začína s', headerFilterOperatorEndsWith: 'Končí na', headerFilterOperatorIs: 'Je', diff --git a/packages/x-data-grid/src/locales/svSE.ts b/packages/x-data-grid/src/locales/svSE.ts index dbb5add8ddd4..516d93b53f01 100644 --- a/packages/x-data-grid/src/locales/svSE.ts +++ b/packages/x-data-grid/src/locales/svSE.ts @@ -58,7 +58,9 @@ const svSEGrid: Partial = { // Filter operators text filterOperatorContains: 'innehåller', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'lika med', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'börjar med', filterOperatorEndsWith: 'slutar med', filterOperatorIs: 'är', @@ -79,7 +81,9 @@ const svSEGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Innehåller', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Lika med', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Börjar med', headerFilterOperatorEndsWith: 'Slutar med', headerFilterOperatorIs: 'Är', diff --git a/packages/x-data-grid/src/locales/trTR.ts b/packages/x-data-grid/src/locales/trTR.ts index fbbd318ff9ca..1ef472441f6c 100644 --- a/packages/x-data-grid/src/locales/trTR.ts +++ b/packages/x-data-grid/src/locales/trTR.ts @@ -57,7 +57,9 @@ const trTRGrid: Partial = { // Filter operators text filterOperatorContains: 'içerir', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'eşittir', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'ile başlar', filterOperatorEndsWith: 'ile biter', filterOperatorIs: 'eşittir', @@ -78,7 +80,9 @@ const trTRGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Şunu içerir', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Şuna eşittir', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Şununla başlar', headerFilterOperatorEndsWith: 'Şununla biter', headerFilterOperatorIs: 'Eşittir', diff --git a/packages/x-data-grid/src/locales/ukUA.ts b/packages/x-data-grid/src/locales/ukUA.ts index bfb45ead7c68..456bf8b00f06 100644 --- a/packages/x-data-grid/src/locales/ukUA.ts +++ b/packages/x-data-grid/src/locales/ukUA.ts @@ -82,7 +82,9 @@ const ukUAGrid: Partial = { // Filter operators text filterOperatorContains: 'містить', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'дорівнює', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'починається з', filterOperatorEndsWith: 'закінчується на', filterOperatorIs: 'дорівнює', @@ -103,7 +105,9 @@ const ukUAGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Містить', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Дорівнює', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Починається з', headerFilterOperatorEndsWith: 'Закінчується на', headerFilterOperatorIs: 'Дорівнює', diff --git a/packages/x-data-grid/src/locales/urPK.ts b/packages/x-data-grid/src/locales/urPK.ts index 13c4e58b189b..2001e0ea29d1 100644 --- a/packages/x-data-grid/src/locales/urPK.ts +++ b/packages/x-data-grid/src/locales/urPK.ts @@ -58,7 +58,9 @@ const urPKGrid: Partial = { // Filter operators text filterOperatorContains: 'شامل ہے', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'برابر ہے', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'شروع ہوتا ہے', filterOperatorEndsWith: 'ختم ہوتا ہے', filterOperatorIs: 'ہے', @@ -79,7 +81,9 @@ const urPKGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'شامل ہے', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'برابر ہے', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'شروع ہوتا ہے', headerFilterOperatorEndsWith: 'ختم ہوتا ہے', headerFilterOperatorIs: 'ہے', diff --git a/packages/x-data-grid/src/locales/viVN.ts b/packages/x-data-grid/src/locales/viVN.ts index 94ca679d2cde..389cd79b4acf 100644 --- a/packages/x-data-grid/src/locales/viVN.ts +++ b/packages/x-data-grid/src/locales/viVN.ts @@ -58,7 +58,9 @@ const viVNGrid: Partial = { // Filter operators text filterOperatorContains: 'Chứa', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: 'Bằng', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: 'Bắt đầu bằng', filterOperatorEndsWith: 'Kết thúc bằng', filterOperatorIs: 'Là', @@ -79,7 +81,9 @@ const viVNGrid: Partial = { // Header filter operators text headerFilterOperatorContains: 'Chứa', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: 'Bằng', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: 'Bắt đầu với', headerFilterOperatorEndsWith: 'Kết thúc với', headerFilterOperatorIs: 'là', diff --git a/packages/x-data-grid/src/locales/zhCN.ts b/packages/x-data-grid/src/locales/zhCN.ts index 7e4aa7aa81f8..0de5f7988f01 100644 --- a/packages/x-data-grid/src/locales/zhCN.ts +++ b/packages/x-data-grid/src/locales/zhCN.ts @@ -57,7 +57,9 @@ const zhCNGrid: Partial = { // Filter operators text filterOperatorContains: '包含', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: '等于', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: '开始于', filterOperatorEndsWith: '结束于', filterOperatorIs: '是', @@ -78,7 +80,9 @@ const zhCNGrid: Partial = { // Header filter operators text headerFilterOperatorContains: '包含', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: '等于', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: '开始于', headerFilterOperatorEndsWith: '结束于', headerFilterOperatorIs: '是', diff --git a/packages/x-data-grid/src/locales/zhHK.ts b/packages/x-data-grid/src/locales/zhHK.ts index ec6b193f07fd..3f53e6b7d9ee 100644 --- a/packages/x-data-grid/src/locales/zhHK.ts +++ b/packages/x-data-grid/src/locales/zhHK.ts @@ -58,7 +58,9 @@ const zhHKGrid: Partial = { // Filter operators text filterOperatorContains: '包含', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: '等於', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: '以。。開始', filterOperatorEndsWith: '以。。結束', filterOperatorIs: '是', @@ -79,7 +81,9 @@ const zhHKGrid: Partial = { // Header filter operators text headerFilterOperatorContains: '包含', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: '等於', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: '以。。開始', headerFilterOperatorEndsWith: '以。。結束', headerFilterOperatorIs: '是', diff --git a/packages/x-data-grid/src/locales/zhTW.ts b/packages/x-data-grid/src/locales/zhTW.ts index 6197d8122307..facba1f16343 100644 --- a/packages/x-data-grid/src/locales/zhTW.ts +++ b/packages/x-data-grid/src/locales/zhTW.ts @@ -57,7 +57,9 @@ const zhTWGrid: Partial = { // Filter operators text filterOperatorContains: '包含', + // filterOperatorDoesNotContain: 'does not contain', filterOperatorEquals: '等於', + // filterOperatorDoesNotEqual: 'does not equal', filterOperatorStartsWith: '以...開頭', filterOperatorEndsWith: '以...結束', filterOperatorIs: '為', @@ -78,7 +80,9 @@ const zhTWGrid: Partial = { // Header filter operators text headerFilterOperatorContains: '包含', + // headerFilterOperatorDoesNotContain: 'Does not contain', headerFilterOperatorEquals: '等於', + // headerFilterOperatorDoesNotEqual: 'Does not equal', headerFilterOperatorStartsWith: '以...開頭', headerFilterOperatorEndsWith: '以...結束', headerFilterOperatorIs: '為', diff --git a/packages/x-data-grid/src/models/api/gridLocaleTextApi.ts b/packages/x-data-grid/src/models/api/gridLocaleTextApi.ts index 0c8b4ef2f874..b2ce738ff721 100644 --- a/packages/x-data-grid/src/models/api/gridLocaleTextApi.ts +++ b/packages/x-data-grid/src/models/api/gridLocaleTextApi.ts @@ -68,7 +68,9 @@ export interface GridLocaleText { // Filter operators text filterOperatorContains: string; + filterOperatorDoesNotContain: string; filterOperatorEquals: string; + filterOperatorDoesNotEqual: string; filterOperatorStartsWith: string; filterOperatorEndsWith: string; filterOperatorIs: string; @@ -89,7 +91,9 @@ export interface GridLocaleText { // Header filter operators text headerFilterOperatorContains: string; + headerFilterOperatorDoesNotContain: string; headerFilterOperatorEquals: string; + headerFilterOperatorDoesNotEqual: string; headerFilterOperatorStartsWith: string; headerFilterOperatorEndsWith: string; headerFilterOperatorIs: string; diff --git a/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx b/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx index b67d56f5a4be..a73d332d63c8 100644 --- a/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx +++ b/packages/x-data-grid/src/tests/filtering.DataGrid.test.tsx @@ -349,6 +349,74 @@ describe(' - Filter', () => { }); }); + it('should filter with operator "does not contain"', () => { + testEval(() => { + expect(getRows({ operator: 'doesNotContain', value: 'Fra' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + + // Trim value + expect(getRows({ operator: 'doesNotContain', value: ' Fra ' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + + // Case-insensitive + expect(getRows({ operator: 'doesNotContain', value: 'fra' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + + // Number casting + expect(getRows({ operator: 'doesNotContain', value: '0' })).to.deep.equal([ + '', + '', + '', + 'France (fr)', + 'Germany', + '1', + ]); + expect(getRows({ operator: 'doesNotContain', value: '1' })).to.deep.equal([ + '', + '', + '', + 'France (fr)', + 'Germany', + '0', + ]); + + // Empty values + expect(getRows({ operator: 'doesNotContain', value: undefined })).to.deep.equal(ALL_ROWS); + expect(getRows({ operator: 'doesNotContain', value: '' })).to.deep.equal(ALL_ROWS); + + // Value with regexp special literal + expect( + getRows({ operator: 'doesNotContain', value: '[-[]{}()*+?.,\\^$|#s]' }), + ).to.deep.equal(ALL_ROWS); + expect(getRows({ operator: 'doesNotContain', value: '(fr)' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + }); + }); + it('should filter with operator "equals"', () => { expect(getRows({ operator: 'equals', value: 'France (fr)' })).to.deep.equal(['France (fr)']); @@ -369,6 +437,59 @@ describe(' - Filter', () => { expect(getRows({ operator: 'equals', value: '' })).to.deep.equal(ALL_ROWS); }); + it('should filter with operator "doesNotEqual"', () => { + expect(getRows({ operator: 'doesNotEqual', value: 'France (fr)' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + + // Trim value + expect(getRows({ operator: 'doesNotEqual', value: ' France (fr) ' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + + // Case-insensitive + expect(getRows({ operator: 'doesNotEqual', value: 'france (fr)' })).to.deep.equal([ + '', + '', + '', + 'Germany', + '0', + '1', + ]); + + // Number casting + expect(getRows({ operator: 'doesNotEqual', value: '0' })).to.deep.equal([ + '', + '', + '', + 'France (fr)', + 'Germany', + '1', + ]); + expect(getRows({ operator: 'doesNotEqual', value: '1' })).to.deep.equal([ + '', + '', + '', + 'France (fr)', + 'Germany', + '0', + ]); + + // Empty values + expect(getRows({ operator: 'doesNotEqual', value: undefined })).to.deep.equal(ALL_ROWS); + expect(getRows({ operator: 'doesNotEqual', value: '' })).to.deep.equal(ALL_ROWS); + }); + it('should filter with operator "startsWith"', () => { expect(getRows({ operator: 'startsWith', value: 'Fra' })).to.deep.equal(['France (fr)']); From e248730003542e9ae375283af5d9a2ae0e19eb28 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 9 Sep 2024 11:44:04 +0200 Subject: [PATCH 7/7] [test] Remove dead `act()` logic (#14529) --- .../src/tests/detailPanel.DataGridPro.test.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx b/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx index 29a8ffe8b2b9..1f71824e507f 100644 --- a/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx +++ b/packages/x-data-grid-pro/src/tests/detailPanel.DataGridPro.test.tsx @@ -489,9 +489,7 @@ describe(' - Detail panel', () => { } detailPanelExpandedRowIds={[0]} />, ); expect(screen.getByTestId(`detail-panel-content`).textContent).to.equal(`${counter}`); - act(() => { - setProps({ detailPanelExpandedRowIds: [1] }); - }); + setProps({ detailPanelExpandedRowIds: [1] }); expect(screen.getByTestId(`detail-panel-content`).textContent).to.equal(`${counter}`); });