Skip to content

Commit

Permalink
✨ Add the types for the Flatpickr custom options for the widget
Browse files Browse the repository at this point in the history
Related to open-formulieren/open-forms#3755 where the widget needs to have a configuration option set so that invalid values are not automatically removed from the widget
  • Loading branch information
SilviaAmAm committed Jan 22, 2024
1 parent 5d76946 commit 5b550cc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/formio/components/date.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
PastDateConstraint as BasePastDateConstraint,
DateConstraintConfiguration,
DatePickerConfig,
PickerCustomOptions,
} from '../dates';

type Validator = 'required';
Expand Down Expand Up @@ -33,6 +34,7 @@ export interface BaseDateComponentSchema extends Omit<DateInputSchema, 'hideLabe
maxDate?: Exclude<DateConstraintConfiguration, FutureOrPastDateConstraint> | PastDateConstraint;
};
datePicker?: DatePickerConfig;
customOptions?: PickerCustomOptions;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/formio/components/datetime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
DatePickerConfig,
FutureDateConstraint,
PastDateConstraint,
PickerCustomOptions,
} from '../dates';

type Validator = 'required';
Expand All @@ -25,6 +26,7 @@ export interface BaseDateTimeComponentSchema
maxDate?: Exclude<DateConstraintConfiguration, FutureDateConstraint>;
};
datePicker?: DatePickerConfig;
customOptions?: PickerCustomOptions;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/formio/dates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 5b550cc

Please sign in to comment.