Skip to content

Commit

Permalink
enhancement(Datepicker) implemented open by default option materializ…
Browse files Browse the repository at this point in the history
  • Loading branch information
gselderslaghs committed Jan 24, 2025
1 parent 2b3769f commit 2dc12dc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/datepicker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ export interface DatepickerOptions extends BaseOptions {
* @default false
*/
showDaysInNextAndPreviousMonths: boolean;
/**
* Specify if the docked datepicker is in open state by default
*/
openByDefault: boolean;
/**
* Specify a DOM element OR selector for a DOM element to render
* the calendar in, by default it will be placed before the input.
Expand Down Expand Up @@ -208,6 +212,8 @@ const _defaults: DatepickerOptions = {
showMonthAfterYear: false,
// Render days of the calendar grid that fall in the next or previous month
showDaysInNextAndPreviousMonths: false,
// Specify if docked picker is in open state by default
openByDefault: false,
// Specify a DOM element to render the calendar in
container: null,
// Show clear button
Expand Down Expand Up @@ -475,6 +481,7 @@ export class Datepicker extends Component<DatepickerOptions> {
} else {
//this.containerEl.before(this.el);
const appendTo = !this.endDateEl ? this.el : this.endDateEl;
if (!this.options.openByDefault) (this.containerEl as HTMLElement).setAttribute('style', 'display: none; visibility: hidden;');
appendTo.parentElement.after(this.containerEl);
}
}
Expand Down

0 comments on commit 2dc12dc

Please sign in to comment.