DatePicker rework (#737)

* fix(date-picker): append calendar to date picker element #345

Fixes #345

* fix(date-picker): do not import rangePlugin from esm folder

* fix(date-picker): correctly type change event for single/range types

* feat(date-picker): add valueFrom, valueTo for range datepicker

* docs(date-picker): add range type example

* docs(date-picker): extract range example to iframe

* docs(date-picker): extract single type to iframe
This commit is contained in:
Eric Liu 2021-07-08 16:33:03 -07:00 committed by GitHub
commit edefd6429b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 139 additions and 56 deletions

View file

@ -16,9 +16,18 @@ export interface DatePickerProps
value?: number | string;
/**
* Specify the element to append the calendar to
* Specify the date picker start date value (from)
* Only works with the "range" date picker type
* @default ""
*/
appendTo?: HTMLElement;
valueFrom?: string;
/**
* Specify the date picker end date value (to)
* Only works with the "range" date picker type
* @default ""
*/
valueTo?: string;
/**
* Specify the date format
@ -66,11 +75,17 @@ export interface DatePickerProps
export default class DatePicker extends SvelteComponentTyped<
DatePickerProps,
{
change: CustomEvent<
| string
| {
selectedDates: [dateFrom: Date, dateTo?: Date];
dateStr: string | { from: string; to: string };
}
>;
click: WindowEventMap["click"];
mouseover: WindowEventMap["mouseover"];
mouseenter: WindowEventMap["mouseenter"];
mouseleave: WindowEventMap["mouseleave"];
change: CustomEvent<any>;
},
{ default: {} }
> {}