wc-datepicker
Advanced tools
Comparing version 0.2.0 to 0.3.0
@@ -157,2 +157,3 @@ 'use strict'; | ||
this.selectDate = index.createEvent(this, "selectDate", 7); | ||
this.changeMonth = index.createEvent(this, "changeMonth", 7); | ||
this.disableDate = () => false; | ||
@@ -336,6 +337,11 @@ this.elementClassName = 'wc-datepicker'; | ||
updateCurrentDate(date, moveFocus) { | ||
const monthChanged = date.getMonth() !== this.currentDate.getMonth() || | ||
date.getFullYear() !== this.currentDate.getFullYear(); | ||
if (monthChanged && moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
const month = date.getMonth(); | ||
const year = date.getFullYear(); | ||
const monthChanged = month !== this.currentDate.getMonth() || | ||
year !== this.currentDate.getFullYear(); | ||
if (monthChanged) { | ||
this.changeMonth.emit({ month: getMonth(date), year: getYear(date) }); | ||
if (moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
} | ||
} | ||
@@ -342,0 +348,0 @@ this.currentDate = date; |
import { h, Host } from '@stencil/core'; | ||
import { addDays, getDaysOfMonth, getFirstOfMonth, getISODateString, getLastOfMonth, getMonths, getNextDay, getNextMonth, getNextYear, getPreviousDay, getPreviousMonth, getPreviousYear, getWeekDays, isDateInRange, isSameDay, subDays } from '../../utils/utils'; | ||
import { addDays, getDaysOfMonth, getFirstOfMonth, getISODateString, getLastOfMonth, getMonth, getMonths, getNextDay, getNextMonth, getNextYear, getPreviousDay, getPreviousMonth, getPreviousYear, getWeekDays, getYear, isDateInRange, isSameDay, subDays } from '../../utils/utils'; | ||
const defaultLabels = { | ||
@@ -194,6 +194,11 @@ clearButton: 'Clear value', | ||
updateCurrentDate(date, moveFocus) { | ||
const monthChanged = date.getMonth() !== this.currentDate.getMonth() || | ||
date.getFullYear() !== this.currentDate.getFullYear(); | ||
if (monthChanged && moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
const month = date.getMonth(); | ||
const year = date.getFullYear(); | ||
const monthChanged = month !== this.currentDate.getMonth() || | ||
year !== this.currentDate.getFullYear(); | ||
if (monthChanged) { | ||
this.changeMonth.emit({ month: getMonth(date), year: getYear(date) }); | ||
if (moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
} | ||
} | ||
@@ -640,2 +645,21 @@ this.currentDate = date; | ||
} | ||
}, { | ||
"method": "changeMonth", | ||
"name": "changeMonth", | ||
"bubbles": true, | ||
"cancelable": true, | ||
"composed": true, | ||
"docs": { | ||
"tags": [], | ||
"text": "" | ||
}, | ||
"complexType": { | ||
"original": "MonthChangedEventDetails", | ||
"resolved": "MonthChangedEventDetails", | ||
"references": { | ||
"MonthChangedEventDetails": { | ||
"location": "local" | ||
} | ||
} | ||
} | ||
}]; | ||
@@ -642,0 +666,0 @@ } |
@@ -154,2 +154,3 @@ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client'; | ||
this.selectDate = createEvent(this, "selectDate", 7); | ||
this.changeMonth = createEvent(this, "changeMonth", 7); | ||
this.disableDate = () => false; | ||
@@ -333,6 +334,11 @@ this.elementClassName = 'wc-datepicker'; | ||
updateCurrentDate(date, moveFocus) { | ||
const monthChanged = date.getMonth() !== this.currentDate.getMonth() || | ||
date.getFullYear() !== this.currentDate.getFullYear(); | ||
if (monthChanged && moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
const month = date.getMonth(); | ||
const year = date.getFullYear(); | ||
const monthChanged = month !== this.currentDate.getMonth() || | ||
year !== this.currentDate.getFullYear(); | ||
if (monthChanged) { | ||
this.changeMonth.emit({ month: getMonth(date), year: getYear(date) }); | ||
if (moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
} | ||
} | ||
@@ -339,0 +345,0 @@ this.currentDate = date; |
@@ -153,2 +153,3 @@ import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-2c898150.js'; | ||
this.selectDate = createEvent(this, "selectDate", 7); | ||
this.changeMonth = createEvent(this, "changeMonth", 7); | ||
this.disableDate = () => false; | ||
@@ -332,6 +333,11 @@ this.elementClassName = 'wc-datepicker'; | ||
updateCurrentDate(date, moveFocus) { | ||
const monthChanged = date.getMonth() !== this.currentDate.getMonth() || | ||
date.getFullYear() !== this.currentDate.getFullYear(); | ||
if (monthChanged && moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
const month = date.getMonth(); | ||
const year = date.getFullYear(); | ||
const monthChanged = month !== this.currentDate.getMonth() || | ||
year !== this.currentDate.getFullYear(); | ||
if (monthChanged) { | ||
this.changeMonth.emit({ month: getMonth(date), year: getYear(date) }); | ||
if (moveFocus) { | ||
this.moveFocusAfterMonthChanged = true; | ||
} | ||
} | ||
@@ -338,0 +344,0 @@ this.currentDate = date; |
@@ -8,3 +8,3 @@ /* eslint-disable */ | ||
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime"; | ||
import { WCDatepickerLabels } from "./components/wc-datepicker/wc-datepicker"; | ||
import { MonthChangedEventDetails, WCDatepickerLabels } from "./components/wc-datepicker/wc-datepicker"; | ||
export namespace Components { | ||
@@ -57,2 +57,3 @@ interface WcDatepicker { | ||
"nextYearButtonContent"?: string; | ||
"onChangeMonth"?: (event: WcDatepickerCustomEvent<MonthChangedEventDetails>) => void; | ||
"onSelectDate"?: (event: WcDatepickerCustomEvent<string | string[] | undefined>) => void; | ||
@@ -59,0 +60,0 @@ "previousMonthButtonContent"?: string; |
@@ -13,2 +13,6 @@ import { EventEmitter } from '../../stencil-public-runtime'; | ||
}; | ||
export interface MonthChangedEventDetails { | ||
month: number; | ||
year: number; | ||
} | ||
export declare class WCDatepicker { | ||
@@ -38,2 +42,3 @@ el: HTMLElement; | ||
selectDate: EventEmitter<string | string[] | undefined>; | ||
changeMonth: EventEmitter<MonthChangedEventDetails>; | ||
private moveFocusAfterMonthChanged; | ||
@@ -40,0 +45,0 @@ componentWillLoad(): void; |
@@ -1,1 +0,1 @@ | ||
import{p as t,b as e}from"./p-b662e034.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-8a16b681",[[2,"wc-datepicker",{clearButtonContent:[1,"clear-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],showClearButton:[4,"show-clear-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]}]]]],t))); | ||
import{p as t,b as e}from"./p-b662e034.js";(()=>{const e=import.meta.url,n={};return""!==e&&(n.resourcesUrl=new URL(".",e).href),t(n)})().then((t=>e([["p-5d121409",[[2,"wc-datepicker",{clearButtonContent:[1,"clear-button-content"],disableDate:[16],elementClassName:[1,"element-class-name"],firstDayOfWeek:[2,"first-day-of-week"],range:[4],labels:[16],locale:[1],nextMonthButtonContent:[1,"next-month-button-content"],nextYearButtonContent:[1,"next-year-button-content"],previousMonthButtonContent:[1,"previous-month-button-content"],previousYearButtonContent:[1,"previous-year-button-content"],showClearButton:[4,"show-clear-button"],showMonthStepper:[4,"show-month-stepper"],showTodayButton:[4,"show-today-button"],showYearStepper:[4,"show-year-stepper"],startDate:[1,"start-date"],todayButtonContent:[1,"today-button-content"],value:[1040],currentDate:[32],hoveredDate:[32],weekdays:[32]}]]]],t))); |
{ | ||
"name": "wc-datepicker", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "A small, accessible and customizable datepicker written in TypeScript.", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
442922
7904