From 5b550ccc931170767045c470c862ea6ab244d7aa Mon Sep 17 00:00:00 2001 From: SilviaAmAm Date: Mon, 22 Jan 2024 14:34:53 +0100 Subject: [PATCH] :sparkles: Add the types for the Flatpickr custom options for the widget Related to https://github.com/open-formulieren/open-forms/issues/3755 where the widget needs to have a configuration option set so that invalid values are not automatically removed from the widget --- src/formio/components/date.ts | 2 ++ src/formio/components/datetime.ts | 2 ++ src/formio/dates.ts | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/src/formio/components/date.ts b/src/formio/components/date.ts index 281b5f5..bab307f 100644 --- a/src/formio/components/date.ts +++ b/src/formio/components/date.ts @@ -5,6 +5,7 @@ import { PastDateConstraint as BasePastDateConstraint, DateConstraintConfiguration, DatePickerConfig, + PickerCustomOptions, } from '../dates'; type Validator = 'required'; @@ -33,6 +34,7 @@ export interface BaseDateComponentSchema extends Omit | PastDateConstraint; }; datePicker?: DatePickerConfig; + customOptions?: PickerCustomOptions; } /** diff --git a/src/formio/components/datetime.ts b/src/formio/components/datetime.ts index a734d3a..fee4264 100644 --- a/src/formio/components/datetime.ts +++ b/src/formio/components/datetime.ts @@ -5,6 +5,7 @@ import { DatePickerConfig, FutureDateConstraint, PastDateConstraint, + PickerCustomOptions, } from '../dates'; type Validator = 'required'; @@ -25,6 +26,7 @@ export interface BaseDateTimeComponentSchema maxDate?: Exclude; }; datePicker?: DatePickerConfig; + customOptions?: PickerCustomOptions; } /** diff --git a/src/formio/dates.ts b/src/formio/dates.ts index 8ffd9a6..a605d8b 100644 --- a/src/formio/dates.ts +++ b/src/formio/dates.ts @@ -83,3 +83,8 @@ export interface DatePickerConfig { minDate: string | null; maxDate: string | null; } + +/** Flatpickr specific custom options for the widget **/ +export interface PickerCustomOptions { + allowInvalidPreload: boolean; +}