1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213 |
- /*!
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
- * v1.0.0-beta.82
- */
- import { Component, h, Prop, Element, Host, State, Listen, Watch, Method, Event, Build } from "@stencil/core";
- import { getLocaleData } from "../date-picker/utils";
- import { dateFromRange, inRange, dateFromISO, dateToISO, parseDateString, sameDate } from "../../utils/date";
- import { TEXT } from "../date-picker/resources";
- import { connectLabel, disconnectLabel, getLabelText } from "../../utils/label";
- import { connectForm, disconnectForm, HiddenFormInputSlot, submitForm } from "../../utils/form";
- import { createPopper, updatePopper, CSS as PopperCSS, popperMenuComputedPlacements, defaultMenuPlacement, filterComputedPlacements } from "../../utils/popper";
- import { updateHostInteraction } from "../../utils/interactive";
- import { toAriaBoolean } from "../../utils/dom";
- export class InputDatePicker {
- constructor() {
- //--------------------------------------------------------------------------
- //
- // Public Properties
- //
- //--------------------------------------------------------------------------
- /**
- * When false, the component won't be interactive.
- */
- this.disabled = false;
- /** Expand or collapse when calendar does not have input */
- this.active = false;
- /** Localized string for "previous month" (used for aria label)
- * @default "Previous month"
- */
- this.intlPrevMonth = TEXT.prevMonth;
- /** Localized string for "next month" (used for aria label)
- * @default "Next month"
- */
- this.intlNextMonth = TEXT.nextMonth;
- /** Localized string for "year" (used for aria label)
- * @default "Year"
- */
- this.intlYear = TEXT.year;
- /** BCP 47 language tag for desired language and country format */
- this.locale = document.documentElement.lang || "en";
- /** specify the scale of the date picker */
- this.scale = "m";
- /**
- * Determines where the date-picker component will be positioned relative to the input.
- * @default "bottom-leading"
- */
- this.placement = defaultMenuPlacement;
- /** Range mode activation */
- this.range = false;
- /**
- * When true, makes the component required for form-submission.
- *
- * @internal
- */
- this.required = false;
- /** Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value. */
- this.overlayPositioning = "absolute";
- /** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
- this.proximitySelectionDisabled = false;
- /** Layout */
- this.layout = "horizontal";
- this.focusedInput = "start";
- this.activeTransitionProp = "opacity";
- //--------------------------------------------------------------------------
- //
- // Private Methods
- //
- //--------------------------------------------------------------------------
- this.setFilteredPlacements = () => {
- const { el, flipPlacements } = this;
- this.filteredFlipPlacements = flipPlacements
- ? filterComputedPlacements(flipPlacements, el)
- : null;
- };
- this.transitionEnd = (event) => {
- if (event.propertyName === this.activeTransitionProp) {
- this.active
- ? this.calciteInputDatePickerOpen.emit()
- : this.calciteInputDatePickerClose.emit();
- }
- };
- this.setStartInput = (el) => {
- this.startInput = el;
- };
- this.setEndInput = (el) => {
- this.endInput = el;
- };
- this.deactivate = () => {
- this.active = false;
- };
- this.keyDownHandler = (event) => {
- if (event.key === "Enter" && !event.defaultPrevented) {
- submitForm(this);
- }
- };
- this.keyUpHandler = (e) => {
- if (e.key === "Escape") {
- this.active = false;
- }
- };
- this.inputBlur = (e) => {
- this.blur(e.detail);
- };
- this.startInputFocus = () => {
- this.active = true;
- this.focusedInput = "start";
- };
- this.endInputFocus = () => {
- this.active = true;
- this.focusedInput = "end";
- };
- this.inputInput = (e) => {
- this.input(e.detail.value);
- };
- this.setMenuEl = (el) => {
- if (el) {
- this.menuEl = el;
- this.createPopper();
- }
- };
- this.setStartWrapper = (el) => {
- this.startWrapper = el;
- this.setReferenceEl();
- };
- this.setEndWrapper = (el) => {
- this.endWrapper = el;
- this.setReferenceEl();
- };
- /**
- * Event handler for when the selected date changes
- */
- this.handleDateChange = (event) => {
- if (this.range) {
- return;
- }
- this.value = dateToISO(event.detail);
- };
- this.handleDateRangeChange = (event) => {
- var _a, _b;
- if (!this.range || !event.detail) {
- return;
- }
- const { startDate, endDate } = event.detail;
- this.start = dateToISO(startDate);
- this.end = dateToISO(endDate);
- this.value = [this.start, this.end];
- if (this.shouldFocusRangeEnd()) {
- (_a = this.endInput) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- else if (this.shouldFocusRangeStart()) {
- (_b = this.startInput) === null || _b === void 0 ? void 0 : _b.setFocus();
- }
- };
- }
- handleDisabledChange(value) {
- if (!value) {
- this.active = false;
- }
- }
- valueHandler(value) {
- if (Array.isArray(value)) {
- this.valueAsDate = value.map((v) => dateFromISO(v));
- this.start = value[0];
- this.end = value[1];
- }
- else if (value) {
- this.valueAsDate = dateFromISO(value);
- this.start = "";
- this.end = "";
- }
- else {
- this.valueAsDate = undefined;
- this.start = undefined;
- this.end = undefined;
- }
- }
- flipPlacementsHandler() {
- this.setFilteredPlacements();
- }
- onMinChanged(min) {
- if (min) {
- this.minAsDate = dateFromISO(min);
- }
- }
- onMaxChanged(max) {
- if (max) {
- this.maxAsDate = dateFromISO(max);
- }
- }
- activeHandler() {
- if (!this.disabled) {
- this.reposition();
- return;
- }
- this.active = false;
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- handleDateOrRangeChange() {
- this.calciteInputDatePickerChange.emit();
- }
- calciteDaySelectHandler() {
- if (this.shouldFocusRangeStart() || this.shouldFocusRangeEnd()) {
- return;
- }
- this.active = false;
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Updates the position of the component. */
- async setFocus() {
- var _a;
- (_a = this.startInput) === null || _a === void 0 ? void 0 : _a.setFocus();
- }
- /** Updates the position of the component. */
- async reposition() {
- const { placement, popper, menuEl } = this;
- const modifiers = this.getModifiers();
- popper
- ? await updatePopper({
- el: menuEl,
- modifiers,
- placement,
- popper
- })
- : this.createPopper();
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- if (Array.isArray(this.value)) {
- this.valueAsDate = this.value.map((v) => dateFromISO(v));
- this.start = this.value[0];
- this.end = this.value[1];
- }
- else if (this.value) {
- this.valueAsDate = dateFromISO(this.value);
- this.start = "";
- this.end = "";
- }
- if (this.start) {
- this.startAsDate = dateFromISO(this.start);
- }
- if (this.end) {
- this.endAsDate = dateFromISO(this.end);
- }
- if (this.min) {
- this.minAsDate = dateFromISO(this.min);
- }
- if (this.max) {
- this.maxAsDate = dateFromISO(this.max);
- }
- this.createPopper();
- connectLabel(this);
- connectForm(this);
- this.setFilteredPlacements();
- }
- async componentWillLoad() {
- await this.loadLocaleData();
- this.onMinChanged(this.min);
- this.onMaxChanged(this.max);
- }
- disconnectedCallback() {
- this.destroyPopper();
- disconnectLabel(this);
- disconnectForm(this);
- }
- componentDidRender() {
- updateHostInteraction(this);
- }
- render() {
- var _a, _b;
- const { disabled } = this;
- const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
- const endDate = this.range
- ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
- : null;
- const formattedEndDate = endDate ? endDate.toLocaleDateString(this.locale) : "";
- const formattedDate = date ? date.toLocaleDateString(this.locale) : "";
- return (h(Host, { onBlur: this.deactivate, onKeyDown: this.keyDownHandler, onKeyUp: this.keyUpHandler, role: "application" },
- this.localeData && (h("div", { "aria-expanded": toAriaBoolean(this.active), class: "input-container", role: "application" },
- h("div", { class: "input-wrapper", ref: this.setStartWrapper },
- h("calcite-input", { class: `input ${this.layout === "vertical" && this.range ? `no-bottom-border` : ``}`, disabled: disabled, icon: "calendar", label: getLabelText(this), "number-button-type": "none", onCalciteInputBlur: this.inputBlur, onCalciteInputFocus: this.startInputFocus, onCalciteInputInput: this.inputInput, placeholder: (_a = this.localeData) === null || _a === void 0 ? void 0 : _a.placeholder, ref: this.setStartInput, scale: this.scale, type: "text", value: formattedDate })),
- h("div", { "aria-hidden": toAriaBoolean(!this.active), class: {
- "menu-container": true,
- "menu-container--active": this.active
- }, ref: this.setMenuEl },
- h("div", { class: {
- ["calendar-picker-wrapper"]: true,
- ["calendar-picker-wrapper--end"]: this.focusedInput === "end",
- [PopperCSS.animation]: true,
- [PopperCSS.animationActive]: this.active
- }, onTransitionEnd: this.transitionEnd },
- h("calcite-date-picker", { activeRange: this.focusedInput, endAsDate: this.endAsDate, headingLevel: this.headingLevel, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, locale: this.locale, max: this.max, maxAsDate: this.maxAsDate, min: this.min, minAsDate: this.minAsDate, onCalciteDatePickerChange: this.handleDateChange, onCalciteDatePickerRangeChange: this.handleDateRangeChange, proximitySelectionDisabled: this.proximitySelectionDisabled, range: this.range, scale: this.scale, startAsDate: this.startAsDate, tabIndex: 0, valueAsDate: this.valueAsDate }))),
- this.range && this.layout === "horizontal" && (h("div", { class: "horizontal-arrow-container" },
- h("calcite-icon", { flipRtl: true, icon: "arrow-right", scale: "s" }))),
- this.range && this.layout === "vertical" && this.scale !== "s" && (h("div", { class: "vertical-arrow-container" },
- h("calcite-icon", { icon: "arrow-down", scale: "s" }))),
- this.range && (h("div", { class: "input-wrapper", ref: this.setEndWrapper },
- h("calcite-input", { class: {
- input: true,
- "border-top-color-one": this.layout === "vertical" && this.range
- }, disabled: disabled, icon: "calendar", "number-button-type": "none", onCalciteInputBlur: this.inputBlur, onCalciteInputFocus: this.endInputFocus, onCalciteInputInput: this.inputInput, placeholder: (_b = this.localeData) === null || _b === void 0 ? void 0 : _b.placeholder, ref: this.setEndInput, scale: this.scale, type: "text", value: formattedEndDate }))))),
- h(HiddenFormInputSlot, { component: this })));
- }
- setReferenceEl() {
- const { focusedInput, layout, endWrapper, startWrapper } = this;
- this.referenceEl =
- focusedInput === "end" || layout === "vertical"
- ? endWrapper || startWrapper
- : startWrapper || endWrapper;
- this.createPopper();
- }
- onLabelClick() {
- this.setFocus();
- }
- getModifiers() {
- const flipModifier = {
- name: "flip",
- enabled: true
- };
- flipModifier.options = {
- fallbackPlacements: this.filteredFlipPlacements || popperMenuComputedPlacements
- };
- const eventListenerModifier = {
- name: "eventListeners",
- enabled: this.active
- };
- return [flipModifier, eventListenerModifier];
- }
- createPopper() {
- this.destroyPopper();
- const { menuEl, placement, referenceEl, overlayPositioning } = this;
- if (!menuEl || !referenceEl) {
- return;
- }
- const modifiers = this.getModifiers();
- this.popper = createPopper({
- el: menuEl,
- modifiers,
- overlayPositioning,
- placement,
- referenceEl
- });
- }
- destroyPopper() {
- const { popper } = this;
- if (popper) {
- popper.destroy();
- }
- this.popper = null;
- }
- startWatcher(start) {
- this.startAsDate = dateFromISO(start);
- }
- endWatcher(end) {
- this.endAsDate = dateFromISO(end);
- }
- async loadLocaleData() {
- if (!Build.isBrowser) {
- return;
- }
- const { locale } = this;
- this.localeData = await getLocaleData(locale);
- }
- clearCurrentValue() {
- if (!this.range) {
- if (typeof this.value === "string" && this.value) {
- this.calciteDatePickerChange.emit();
- }
- this.value = "";
- return;
- }
- const { focusedInput } = this;
- if (focusedInput === "start") {
- if (this.start) {
- this.calciteDatePickerRangeChange.emit();
- }
- this.value = Array.isArray(this.value) ? ["", this.value[1] || ""] : [""];
- this.start = undefined;
- }
- else if (focusedInput === "end") {
- if (this.end) {
- this.calciteDatePickerRangeChange.emit();
- }
- this.value = Array.isArray(this.value) ? [this.value[0] || "", ""] : ["", ""];
- this.end = undefined;
- }
- }
- /**
- * If inputted string is a valid date, update value/active
- */
- input(value) {
- const date = this.getDateFromInput(value);
- if (!date) {
- this.clearCurrentValue();
- return;
- }
- if (!this.range) {
- this.value = dateToISO(date);
- this.calciteDatePickerChange.emit(date);
- return;
- }
- const { focusedInput } = this;
- if (focusedInput === "start") {
- if (!this.startAsDate || !sameDate(date, this.startAsDate)) {
- const startDateISO = dateToISO(date);
- this.value = Array.isArray(this.value)
- ? [startDateISO, this.value[1] || ""]
- : [startDateISO];
- this.start = startDateISO;
- this.calciteDatePickerRangeChange.emit({
- startDate: date,
- endDate: this.endAsDate
- });
- }
- }
- else if (focusedInput === "end") {
- if (!this.endAsDate || !sameDate(date, this.endAsDate)) {
- const endDateISO = dateToISO(date);
- this.value = Array.isArray(this.value)
- ? [this.value[0] || "", endDateISO]
- : ["", endDateISO];
- this.end = endDateISO;
- this.calciteDatePickerRangeChange.emit({
- startDate: this.startAsDate,
- endDate: date
- });
- }
- }
- }
- /**
- * Clean up invalid date from input on blur
- */
- blur(target) {
- const { locale, focusedInput, endAsDate, range, startAsDate, valueAsDate } = this;
- const date = this.getDateFromInput(target.value);
- if (!date) {
- if (!range && valueAsDate) {
- target.value = Array.isArray(valueAsDate)
- ? valueAsDate[focusedInput === "end" ? 1 : 0].toLocaleDateString(locale)
- : valueAsDate.toLocaleDateString(locale);
- }
- else if (focusedInput === "start" && startAsDate) {
- target.value = startAsDate.toLocaleDateString(locale);
- }
- else if (focusedInput === "end" && endAsDate) {
- target.value = endAsDate.toLocaleDateString(locale);
- }
- }
- }
- shouldFocusRangeStart() {
- return !!(this.endAsDate &&
- !this.startAsDate &&
- this.focusedInput === "end" &&
- this.startInput);
- }
- shouldFocusRangeEnd() {
- return !!(this.startAsDate &&
- !this.endAsDate &&
- this.focusedInput === "start" &&
- this.endInput);
- }
- /**
- * Find a date from input string
- * return false if date is invalid, or out of range
- */
- getDateFromInput(value) {
- if (!this.localeData) {
- return false;
- }
- const { separator } = this.localeData;
- const { day, month, year } = parseDateString(value, this.localeData);
- const validDay = day > 0;
- const validMonth = month > -1;
- const date = new Date(year, month, day);
- date.setFullYear(year);
- const validDate = !isNaN(date.getTime());
- const validLength = value.split(separator).filter((c) => c).length > 2;
- const validYear = year.toString().length > 0;
- if (validDay &&
- validMonth &&
- validDate &&
- validLength &&
- validYear &&
- inRange(date, this.min, this.max)) {
- return date;
- }
- return false;
- }
- static get is() { return "calcite-input-date-picker"; }
- static get encapsulation() { return "shadow"; }
- static get originalStyleUrls() { return {
- "$": ["input-date-picker.scss"]
- }; }
- static get styleUrls() { return {
- "$": ["input-date-picker.css"]
- }; }
- static get properties() { return {
- "disabled": {
- "type": "boolean",
- "mutable": false,
- "complexType": {
- "original": "boolean",
- "resolved": "boolean",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "When false, the component won't be interactive."
- },
- "attribute": "disabled",
- "reflect": true,
- "defaultValue": "false"
- },
- "value": {
- "type": "string",
- "mutable": true,
- "complexType": {
- "original": "string | string[]",
- "resolved": "string | string[]",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Selected date"
- },
- "attribute": "value",
- "reflect": false
- },
- "flipPlacements": {
- "type": "unknown",
- "mutable": false,
- "complexType": {
- "original": "ComputedPlacement[]",
- "resolved": "ComputedPlacement[]",
- "references": {
- "ComputedPlacement": {
- "location": "import",
- "path": "../../utils/popper"
- }
- }
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "Defines the available placements that can be used when a flip occurs."
- }
- },
- "headingLevel": {
- "type": "number",
- "mutable": false,
- "complexType": {
- "original": "HeadingLevel",
- "resolved": "1 | 2 | 3 | 4 | 5 | 6",
- "references": {
- "HeadingLevel": {
- "location": "import",
- "path": "../functional/Heading"
- }
- }
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Number at which section headings should start for this component."
- },
- "attribute": "heading-level",
- "reflect": false
- },
- "valueAsDate": {
- "type": "unknown",
- "mutable": true,
- "complexType": {
- "original": "Date | Date[]",
- "resolved": "Date | Date[]",
- "references": {
- "Date": {
- "location": "global"
- }
- }
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "Selected date as full date object"
- }
- },
- "startAsDate": {
- "type": "unknown",
- "mutable": true,
- "complexType": {
- "original": "Date",
- "resolved": "Date",
- "references": {
- "Date": {
- "location": "global"
- }
- }
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "deprecated",
- "text": "use valueAsDate instead"
- }],
- "text": "Selected start date as full date object"
- }
- },
- "endAsDate": {
- "type": "unknown",
- "mutable": true,
- "complexType": {
- "original": "Date",
- "resolved": "Date",
- "references": {
- "Date": {
- "location": "global"
- }
- }
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "deprecated",
- "text": "use valueAsDate instead"
- }],
- "text": "Selected end date as full date object"
- }
- },
- "minAsDate": {
- "type": "unknown",
- "mutable": true,
- "complexType": {
- "original": "Date",
- "resolved": "Date",
- "references": {
- "Date": {
- "location": "global"
- }
- }
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "Earliest allowed date as full date object"
- }
- },
- "maxAsDate": {
- "type": "unknown",
- "mutable": true,
- "complexType": {
- "original": "Date",
- "resolved": "Date",
- "references": {
- "Date": {
- "location": "global"
- }
- }
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "Latest allowed date as full date object"
- }
- },
- "min": {
- "type": "string",
- "mutable": true,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "Earliest allowed date (\"yyyy-mm-dd\")"
- },
- "attribute": "min",
- "reflect": false
- },
- "max": {
- "type": "string",
- "mutable": true,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "Latest allowed date (\"yyyy-mm-dd\")"
- },
- "attribute": "max",
- "reflect": false
- },
- "active": {
- "type": "boolean",
- "mutable": true,
- "complexType": {
- "original": "boolean",
- "resolved": "boolean",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Expand or collapse when calendar does not have input"
- },
- "attribute": "active",
- "reflect": true,
- "defaultValue": "false"
- },
- "name": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "The picker's name. Gets submitted with the form."
- },
- "attribute": "name",
- "reflect": false
- },
- "intlPrevMonth": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "default",
- "text": "\"Previous month\""
- }],
- "text": "Localized string for \"previous month\" (used for aria label)"
- },
- "attribute": "intl-prev-month",
- "reflect": false,
- "defaultValue": "TEXT.prevMonth"
- },
- "intlNextMonth": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "default",
- "text": "\"Next month\""
- }],
- "text": "Localized string for \"next month\" (used for aria label)"
- },
- "attribute": "intl-next-month",
- "reflect": false,
- "defaultValue": "TEXT.nextMonth"
- },
- "intlYear": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "default",
- "text": "\"Year\""
- }],
- "text": "Localized string for \"year\" (used for aria label)"
- },
- "attribute": "intl-year",
- "reflect": false,
- "defaultValue": "TEXT.year"
- },
- "locale": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [],
- "text": "BCP 47 language tag for desired language and country format"
- },
- "attribute": "locale",
- "reflect": false,
- "defaultValue": "document.documentElement.lang || \"en\""
- },
- "scale": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "\"s\" | \"m\" | \"l\"",
- "resolved": "\"l\" | \"m\" | \"s\"",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "specify the scale of the date picker"
- },
- "attribute": "scale",
- "reflect": true,
- "defaultValue": "\"m\""
- },
- "placement": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "MenuPlacement",
- "resolved": "\"bottom\" | \"bottom-end\" | \"bottom-leading\" | \"bottom-start\" | \"bottom-trailing\" | \"top\" | \"top-end\" | \"top-leading\" | \"top-start\" | \"top-trailing\"",
- "references": {
- "MenuPlacement": {
- "location": "import",
- "path": "../../utils/popper"
- }
- }
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [{
- "name": "default",
- "text": "\"bottom-leading\""
- }],
- "text": "Determines where the date-picker component will be positioned relative to the input."
- },
- "attribute": "placement",
- "reflect": true,
- "defaultValue": "defaultMenuPlacement"
- },
- "range": {
- "type": "boolean",
- "mutable": false,
- "complexType": {
- "original": "boolean",
- "resolved": "boolean",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Range mode activation"
- },
- "attribute": "range",
- "reflect": true,
- "defaultValue": "false"
- },
- "required": {
- "type": "boolean",
- "mutable": false,
- "complexType": {
- "original": "boolean",
- "resolved": "boolean",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [{
- "name": "internal",
- "text": undefined
- }],
- "text": "When true, makes the component required for form-submission."
- },
- "attribute": "required",
- "reflect": true,
- "defaultValue": "false"
- },
- "start": {
- "type": "string",
- "mutable": true,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "deprecated",
- "text": "use value instead"
- }],
- "text": "Selected start date"
- },
- "attribute": "start",
- "reflect": false
- },
- "end": {
- "type": "string",
- "mutable": true,
- "complexType": {
- "original": "string",
- "resolved": "string",
- "references": {}
- },
- "required": false,
- "optional": true,
- "docs": {
- "tags": [{
- "name": "deprecated",
- "text": "use value instead"
- }],
- "text": "Selected end date"
- },
- "attribute": "end",
- "reflect": false
- },
- "overlayPositioning": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "OverlayPositioning",
- "resolved": "\"absolute\" | \"fixed\"",
- "references": {
- "OverlayPositioning": {
- "location": "import",
- "path": "../../utils/popper"
- }
- }
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Describes the type of positioning to use for the overlaid content. If your element is in a fixed container, use the 'fixed' value."
- },
- "attribute": "overlay-positioning",
- "reflect": false,
- "defaultValue": "\"absolute\""
- },
- "proximitySelectionDisabled": {
- "type": "boolean",
- "mutable": false,
- "complexType": {
- "original": "boolean",
- "resolved": "boolean",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range."
- },
- "attribute": "proximity-selection-disabled",
- "reflect": false,
- "defaultValue": "false"
- },
- "layout": {
- "type": "string",
- "mutable": false,
- "complexType": {
- "original": "\"horizontal\" | \"vertical\"",
- "resolved": "\"horizontal\" | \"vertical\"",
- "references": {}
- },
- "required": false,
- "optional": false,
- "docs": {
- "tags": [],
- "text": "Layout"
- },
- "attribute": "layout",
- "reflect": true,
- "defaultValue": "\"horizontal\""
- }
- }; }
- static get states() { return {
- "focusedInput": {},
- "localeData": {}
- }; }
- static get events() { return [{
- "method": "calciteDatePickerChange",
- "name": "calciteDatePickerChange",
- "bubbles": true,
- "cancelable": true,
- "composed": true,
- "docs": {
- "tags": [{
- "name": "deprecated",
- "text": "use `calciteInputDatePickerChange` instead."
- }],
- "text": "Trigger calcite date change when a user changes the date."
- },
- "complexType": {
- "original": "Date",
- "resolved": "Date",
- "references": {
- "Date": {
- "location": "global"
- }
- }
- }
- }, {
- "method": "calciteDatePickerRangeChange",
- "name": "calciteDatePickerRangeChange",
- "bubbles": true,
- "cancelable": true,
- "composed": true,
- "docs": {
- "tags": [{
- "name": "see",
- "text": "[DateRangeChange](https://github.com/Esri/calcite-components/blob/master/src/components/calcite-date-picker/interfaces.ts#L1)"
- }, {
- "name": "deprecated",
- "text": "use `calciteInputDatePickerChange` instead."
- }],
- "text": "Trigger calcite date change when a user changes the date range."
- },
- "complexType": {
- "original": "DateRangeChange",
- "resolved": "DateRangeChange",
- "references": {
- "DateRangeChange": {
- "location": "import",
- "path": "../date-picker/interfaces"
- }
- }
- }
- }, {
- "method": "calciteInputDatePickerChange",
- "name": "calciteInputDatePickerChange",
- "bubbles": true,
- "cancelable": true,
- "composed": true,
- "docs": {
- "tags": [],
- "text": "This event fires when the input date picker value changes."
- },
- "complexType": {
- "original": "void",
- "resolved": "void",
- "references": {}
- }
- }, {
- "method": "calciteInputDatePickerOpen",
- "name": "calciteInputDatePickerOpen",
- "bubbles": true,
- "cancelable": true,
- "composed": true,
- "docs": {
- "tags": [{
- "name": "internal",
- "text": undefined
- }],
- "text": ""
- },
- "complexType": {
- "original": "any",
- "resolved": "any",
- "references": {}
- }
- }, {
- "method": "calciteInputDatePickerClose",
- "name": "calciteInputDatePickerClose",
- "bubbles": true,
- "cancelable": true,
- "composed": true,
- "docs": {
- "tags": [{
- "name": "internal",
- "text": undefined
- }],
- "text": ""
- },
- "complexType": {
- "original": "any",
- "resolved": "any",
- "references": {}
- }
- }]; }
- static get methods() { return {
- "setFocus": {
- "complexType": {
- "signature": "() => Promise<void>",
- "parameters": [],
- "references": {
- "Promise": {
- "location": "global"
- }
- },
- "return": "Promise<void>"
- },
- "docs": {
- "text": "Updates the position of the component.",
- "tags": []
- }
- },
- "reposition": {
- "complexType": {
- "signature": "() => Promise<void>",
- "parameters": [],
- "references": {
- "Promise": {
- "location": "global"
- }
- },
- "return": "Promise<void>"
- },
- "docs": {
- "text": "Updates the position of the component.",
- "tags": []
- }
- }
- }; }
- static get elementRef() { return "el"; }
- static get watchers() { return [{
- "propName": "disabled",
- "methodName": "handleDisabledChange"
- }, {
- "propName": "value",
- "methodName": "valueHandler"
- }, {
- "propName": "flipPlacements",
- "methodName": "flipPlacementsHandler"
- }, {
- "propName": "min",
- "methodName": "onMinChanged"
- }, {
- "propName": "max",
- "methodName": "onMaxChanged"
- }, {
- "propName": "active",
- "methodName": "activeHandler"
- }, {
- "propName": "layout",
- "methodName": "setReferenceEl"
- }, {
- "propName": "focusedInput",
- "methodName": "setReferenceEl"
- }, {
- "propName": "start",
- "methodName": "startWatcher"
- }, {
- "propName": "end",
- "methodName": "endWatcher"
- }, {
- "propName": "locale",
- "methodName": "loadLocaleData"
- }]; }
- static get listeners() { return [{
- "name": "calciteDatePickerChange",
- "method": "handleDateOrRangeChange",
- "target": undefined,
- "capture": false,
- "passive": false
- }, {
- "name": "calciteDatePickerRangeChange",
- "method": "handleDateOrRangeChange",
- "target": undefined,
- "capture": false,
- "passive": false
- }, {
- "name": "calciteDaySelect",
- "method": "calciteDaySelectHandler",
- "target": undefined,
- "capture": false,
- "passive": false
- }]; }
- }
|