input-date-picker.js 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  1. /*!
  2. * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
  3. * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
  4. * v1.0.0-beta.97
  5. */
  6. import { h, Host, Build } from "@stencil/core";
  7. import { getLocaleData, getValueAsDateRange } from "../date-picker/utils";
  8. import { dateFromRange, inRange, dateFromISO, dateToISO, parseDateString, sameDate, setEndOfDay } from "../../utils/date";
  9. import { TEXT } from "../date-picker/resources";
  10. import { CSS } from "./resources";
  11. import { connectLabel, disconnectLabel, getLabelText } from "../../utils/label";
  12. import { connectForm, disconnectForm, HiddenFormInputSlot, submitForm } from "../../utils/form";
  13. import { FloatingCSS, connectFloatingUI, disconnectFloatingUI, defaultMenuPlacement, filterComputedPlacements, reposition, updateAfterClose } from "../../utils/floating-ui";
  14. import { updateHostInteraction } from "../../utils/interactive";
  15. import { toAriaBoolean } from "../../utils/dom";
  16. import { connectOpenCloseComponent, disconnectOpenCloseComponent } from "../../utils/openCloseComponent";
  17. import { connectLocalized, disconnectLocalized, numberStringFormatter } from "../../utils/locale";
  18. import { numberKeys } from "../../utils/key";
  19. export class InputDatePicker {
  20. constructor() {
  21. //--------------------------------------------------------------------------
  22. //
  23. // Public Properties
  24. //
  25. //--------------------------------------------------------------------------
  26. /**
  27. * When `true`, interaction is prevented and the component is displayed with lower opacity.
  28. */
  29. this.disabled = false;
  30. /**
  31. * When `true`, the component's value can be read, but controls are not accessible and the value cannot be modified.
  32. *
  33. * @mdn [readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)
  34. */
  35. this.readOnly = false;
  36. /**
  37. * When `true`, the component is active.
  38. *
  39. * @deprecated use `open` instead.
  40. */
  41. this.active = false;
  42. /** When `true`, displays the `calcite-date-picker` component. */
  43. this.open = false;
  44. /**
  45. * Accessible name for the component's previous month button.
  46. *
  47. * @default "Previous month"
  48. */
  49. this.intlPrevMonth = TEXT.prevMonth;
  50. /**
  51. * Accessible name for the component's next month button.
  52. *
  53. * @default "Next month"
  54. */
  55. this.intlNextMonth = TEXT.nextMonth;
  56. /**
  57. * Accessible name for the component's year input.
  58. *
  59. * @default "Year"
  60. */
  61. this.intlYear = TEXT.year;
  62. /** Specifies the size of the component. */
  63. this.scale = "m";
  64. /**
  65. * Specifies the placement of the `calcite-date-picker` relative to the component.
  66. *
  67. * @default "bottom-start"
  68. */
  69. this.placement = defaultMenuPlacement;
  70. /** When `true`, activates a range for the component. */
  71. this.range = false;
  72. /**
  73. * When `true`, the component must have a value in order for the form to submit.
  74. *
  75. * @internal
  76. */
  77. this.required = false;
  78. /**
  79. * Determines the type of positioning to use for the overlaid content.
  80. *
  81. * Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
  82. *
  83. * `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
  84. *
  85. */
  86. this.overlayPositioning = "absolute";
  87. /**
  88. * When `true`, disables the default behavior on the third click of narrowing or extending the range.
  89. * Instead starts a new range.
  90. */
  91. this.proximitySelectionDisabled = false;
  92. /** Defines the layout of the component. */
  93. this.layout = "horizontal";
  94. this.effectiveLocale = "";
  95. this.focusedInput = "start";
  96. this.globalAttributes = {};
  97. this.openTransitionProp = "opacity";
  98. //--------------------------------------------------------------------------
  99. //
  100. // Private Methods
  101. //
  102. //--------------------------------------------------------------------------
  103. this.setFilteredPlacements = () => {
  104. const { el, flipPlacements } = this;
  105. this.filteredFlipPlacements = flipPlacements
  106. ? filterComputedPlacements(flipPlacements, el)
  107. : null;
  108. };
  109. this.setTransitionEl = (el) => {
  110. this.transitionEl = el;
  111. connectOpenCloseComponent(this);
  112. };
  113. this.setStartInput = (el) => {
  114. this.startInput = el;
  115. };
  116. this.setEndInput = (el) => {
  117. this.endInput = el;
  118. };
  119. this.deactivate = () => {
  120. this.open = false;
  121. };
  122. this.keyDownHandler = (event) => {
  123. const { defaultPrevented, key } = event;
  124. if (key === "Enter" && !defaultPrevented) {
  125. if (submitForm(this)) {
  126. event.preventDefault();
  127. }
  128. }
  129. else if (key === "Escape" && !defaultPrevented) {
  130. this.active = false;
  131. this.open = false;
  132. event.preventDefault();
  133. }
  134. };
  135. this.inputBlur = (event) => {
  136. this.blur(event.currentTarget);
  137. };
  138. this.startInputFocus = () => {
  139. if (!this.readOnly) {
  140. this.open = true;
  141. }
  142. this.focusedInput = "start";
  143. };
  144. this.endInputFocus = () => {
  145. if (!this.readOnly) {
  146. this.open = true;
  147. }
  148. this.focusedInput = "end";
  149. };
  150. this.startInputInput = () => {
  151. const parsedValue = this.parseNumerals(this.startInput.value);
  152. const formattedValue = this.formatNumerals(parsedValue);
  153. this.startInput.value = formattedValue;
  154. this.input(parsedValue);
  155. };
  156. this.endInputInput = () => {
  157. const parsedValue = this.parseNumerals(this.endInput.value);
  158. const formattedValue = this.formatNumerals(parsedValue);
  159. this.endInput.value = formattedValue;
  160. this.input(parsedValue);
  161. };
  162. this.setFloatingEl = (el) => {
  163. if (el) {
  164. this.floatingEl = el;
  165. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  166. }
  167. };
  168. this.setStartWrapper = (el) => {
  169. this.startWrapper = el;
  170. this.setReferenceEl();
  171. };
  172. this.setEndWrapper = (el) => {
  173. this.endWrapper = el;
  174. this.setReferenceEl();
  175. };
  176. /**
  177. * Event handler for when the selected date changes
  178. *
  179. * @param event
  180. */
  181. this.handleDateChange = (event) => {
  182. if (this.range) {
  183. return;
  184. }
  185. this.value = dateToISO(event.detail);
  186. };
  187. this.handleDateRangeChange = (event) => {
  188. var _a, _b;
  189. if (!this.range || !event.detail) {
  190. return;
  191. }
  192. const { startDate, endDate } = event.detail;
  193. this.start = dateToISO(startDate);
  194. this.end = dateToISO(endDate);
  195. this.value = [this.start, this.end];
  196. if (this.shouldFocusRangeEnd()) {
  197. (_a = this.endInput) === null || _a === void 0 ? void 0 : _a.setFocus();
  198. }
  199. else if (this.shouldFocusRangeStart()) {
  200. (_b = this.startInput) === null || _b === void 0 ? void 0 : _b.setFocus();
  201. }
  202. };
  203. this.commonDateSeparators = [".", "-", "/"];
  204. this.formatNumerals = (value) => value
  205. ? value
  206. .split("")
  207. .map((char) =>
  208. // convert common separators to the locale's
  209. this.commonDateSeparators.includes(char)
  210. ? this.localeData.separator
  211. : numberKeys.includes(char)
  212. ? numberStringFormatter.numberFormatter.format(Number(char))
  213. : char)
  214. .join("")
  215. : "";
  216. this.parseNumerals = (value) => value
  217. ? value
  218. .split("")
  219. .map((char) => numberKeys.includes(char) ? numberStringFormatter.delocalize(char) : char)
  220. .join("")
  221. : "";
  222. }
  223. handleDisabledAndReadOnlyChange(value) {
  224. if (!value) {
  225. this.open = false;
  226. }
  227. }
  228. valueHandler(value) {
  229. if (Array.isArray(value)) {
  230. this.valueAsDate = getValueAsDateRange(value);
  231. this.start = value[0];
  232. this.end = value[1];
  233. }
  234. else if (value) {
  235. this.valueAsDate = dateFromISO(value);
  236. this.start = "";
  237. this.end = "";
  238. }
  239. else {
  240. this.valueAsDate = undefined;
  241. this.start = undefined;
  242. this.end = undefined;
  243. }
  244. }
  245. flipPlacementsHandler() {
  246. this.setFilteredPlacements();
  247. this.reposition(true);
  248. }
  249. onMinChanged(min) {
  250. if (min) {
  251. this.minAsDate = dateFromISO(min);
  252. }
  253. }
  254. onMaxChanged(max) {
  255. if (max) {
  256. this.maxAsDate = dateFromISO(max);
  257. }
  258. }
  259. activeHandler(value) {
  260. this.open = value;
  261. }
  262. openHandler(value) {
  263. this.active = value;
  264. if (this.disabled || this.readOnly) {
  265. if (!value) {
  266. updateAfterClose(this.floatingEl);
  267. }
  268. this.open = false;
  269. return;
  270. }
  271. if (value) {
  272. this.reposition(true);
  273. }
  274. else {
  275. updateAfterClose(this.floatingEl);
  276. }
  277. }
  278. overlayPositioningHandler() {
  279. this.reposition(true);
  280. }
  281. //--------------------------------------------------------------------------
  282. //
  283. // Event Listeners
  284. //
  285. //--------------------------------------------------------------------------
  286. handleDateOrRangeChange() {
  287. this.calciteInputDatePickerChange.emit();
  288. }
  289. calciteDaySelectHandler() {
  290. if (this.shouldFocusRangeStart() || this.shouldFocusRangeEnd()) {
  291. return;
  292. }
  293. this.open = false;
  294. }
  295. // --------------------------------------------------------------------------
  296. //
  297. // Public Methods
  298. //
  299. // --------------------------------------------------------------------------
  300. /** Sets focus on the component. */
  301. async setFocus() {
  302. var _a;
  303. (_a = this.startInput) === null || _a === void 0 ? void 0 : _a.setFocus();
  304. }
  305. /**
  306. * Updates the position of the component.
  307. *
  308. * @param delayed
  309. */
  310. async reposition(delayed = false) {
  311. const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
  312. return reposition(this, {
  313. floatingEl,
  314. referenceEl,
  315. overlayPositioning,
  316. placement,
  317. flipPlacements: filteredFlipPlacements,
  318. type: "menu"
  319. }, delayed);
  320. }
  321. // --------------------------------------------------------------------------
  322. //
  323. // Lifecycle
  324. //
  325. // --------------------------------------------------------------------------
  326. connectedCallback() {
  327. connectLocalized(this);
  328. const isOpen = this.active || this.open;
  329. isOpen && this.activeHandler(isOpen);
  330. isOpen && this.openHandler(isOpen);
  331. if (Array.isArray(this.value)) {
  332. this.valueAsDate = getValueAsDateRange(this.value);
  333. this.start = this.value[0];
  334. this.end = this.value[1];
  335. }
  336. else if (this.value) {
  337. this.valueAsDate = dateFromISO(this.value);
  338. this.start = "";
  339. this.end = "";
  340. }
  341. if (this.start) {
  342. this.startAsDate = dateFromISO(this.start);
  343. }
  344. if (this.end) {
  345. this.endAsDate = setEndOfDay(dateFromISO(this.end));
  346. }
  347. if (this.min) {
  348. this.minAsDate = dateFromISO(this.min);
  349. }
  350. if (this.max) {
  351. this.maxAsDate = dateFromISO(this.max);
  352. }
  353. connectLabel(this);
  354. connectForm(this);
  355. connectOpenCloseComponent(this);
  356. this.setFilteredPlacements();
  357. this.reposition(true);
  358. numberStringFormatter.numberFormatOptions = {
  359. numberingSystem: this.numberingSystem,
  360. locale: this.effectiveLocale,
  361. useGrouping: false
  362. };
  363. }
  364. async componentWillLoad() {
  365. await this.loadLocaleData();
  366. this.onMinChanged(this.min);
  367. this.onMaxChanged(this.max);
  368. }
  369. componentDidLoad() {
  370. this.reposition(true);
  371. }
  372. disconnectedCallback() {
  373. disconnectLabel(this);
  374. disconnectForm(this);
  375. disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
  376. disconnectOpenCloseComponent(this);
  377. disconnectLocalized(this);
  378. }
  379. componentDidRender() {
  380. updateHostInteraction(this);
  381. }
  382. render() {
  383. var _a, _b;
  384. const { disabled, readOnly, numberingSystem, effectiveLocale } = this;
  385. numberStringFormatter.numberFormatOptions = {
  386. numberingSystem,
  387. locale: effectiveLocale,
  388. useGrouping: false
  389. };
  390. const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
  391. const endDate = this.range
  392. ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
  393. : null;
  394. const formattedEndDate = endDate
  395. ? this.formatNumerals(endDate.toLocaleDateString(effectiveLocale))
  396. : "";
  397. const formattedDate = date ? this.formatNumerals(date.toLocaleDateString(effectiveLocale)) : "";
  398. return (h(Host, { onBlur: this.deactivate, onKeyDown: this.keyDownHandler, role: "application" }, this.localeData && (h("div", { "aria-expanded": toAriaBoolean(this.open), 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), lang: effectiveLocale, "number-button-type": "none", numberingSystem: numberingSystem, onCalciteInputInput: this.startInputInput, onCalciteInternalInputBlur: this.inputBlur, onCalciteInternalInputFocus: this.startInputFocus, placeholder: (_a = this.localeData) === null || _a === void 0 ? void 0 : _a.placeholder, readOnly: readOnly, ref: this.setStartInput, scale: this.scale, type: "text", value: formattedDate })), h("div", { "aria-hidden": toAriaBoolean(!this.open), class: {
  399. [CSS.menu]: true,
  400. [CSS.menuActive]: this.open
  401. }, ref: this.setFloatingEl }, h("div", { class: {
  402. ["calendar-picker-wrapper"]: true,
  403. ["calendar-picker-wrapper--end"]: this.focusedInput === "end",
  404. [FloatingCSS.animation]: true,
  405. [FloatingCSS.animationActive]: this.open
  406. }, ref: this.setTransitionEl }, h("calcite-date-picker", { activeRange: this.focusedInput, endAsDate: this.endAsDate, headingLevel: this.headingLevel, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, lang: effectiveLocale, max: this.max, maxAsDate: this.maxAsDate, min: this.min, minAsDate: this.minAsDate, numberingSystem: numberingSystem, 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: {
  407. input: true,
  408. "border-top-color-one": this.layout === "vertical" && this.range
  409. }, disabled: disabled, icon: "calendar", lang: effectiveLocale, "number-button-type": "none", numberingSystem: numberingSystem, onCalciteInputInput: this.endInputInput, onCalciteInternalInputBlur: this.inputBlur, onCalciteInternalInputFocus: this.endInputFocus, placeholder: (_b = this.localeData) === null || _b === void 0 ? void 0 : _b.placeholder, readOnly: readOnly, ref: this.setEndInput, scale: this.scale, type: "text", value: formattedEndDate }))))), h(HiddenFormInputSlot, { component: this })));
  410. }
  411. setReferenceEl() {
  412. const { focusedInput, layout, endWrapper, startWrapper } = this;
  413. this.referenceEl =
  414. focusedInput === "end" || layout === "vertical"
  415. ? endWrapper || startWrapper
  416. : startWrapper || endWrapper;
  417. connectFloatingUI(this, this.referenceEl, this.floatingEl);
  418. }
  419. onLabelClick() {
  420. this.setFocus();
  421. }
  422. onBeforeOpen() {
  423. this.calciteInputDatePickerBeforeOpen.emit();
  424. }
  425. onOpen() {
  426. this.calciteInputDatePickerOpen.emit();
  427. }
  428. onBeforeClose() {
  429. this.calciteInputDatePickerBeforeClose.emit();
  430. }
  431. onClose() {
  432. this.calciteInputDatePickerClose.emit();
  433. }
  434. startWatcher(start) {
  435. this.startAsDate = dateFromISO(start);
  436. }
  437. endWatcher(end) {
  438. this.endAsDate = end ? setEndOfDay(dateFromISO(end)) : dateFromISO(end);
  439. }
  440. async loadLocaleData() {
  441. if (!Build.isBrowser) {
  442. return;
  443. }
  444. this.localeData = await getLocaleData(this.effectiveLocale);
  445. }
  446. clearCurrentValue() {
  447. if (!this.range) {
  448. if (typeof this.value === "string" && this.value) {
  449. this.calciteDatePickerChange.emit();
  450. }
  451. this.value = "";
  452. return;
  453. }
  454. const { focusedInput } = this;
  455. if (focusedInput === "start") {
  456. if (this.start) {
  457. this.calciteDatePickerRangeChange.emit();
  458. }
  459. this.value = Array.isArray(this.value) ? ["", this.value[1] || ""] : [""];
  460. this.start = undefined;
  461. }
  462. else if (focusedInput === "end") {
  463. if (this.end) {
  464. this.calciteDatePickerRangeChange.emit();
  465. }
  466. this.value = Array.isArray(this.value) ? [this.value[0] || "", ""] : ["", ""];
  467. this.end = undefined;
  468. }
  469. }
  470. /**
  471. * If inputted string is a valid date, update value/active
  472. *
  473. * @param value
  474. */
  475. input(value) {
  476. const date = this.getDateFromInput(value);
  477. if (!date) {
  478. this.clearCurrentValue();
  479. return;
  480. }
  481. if (!this.range) {
  482. this.value = dateToISO(date);
  483. this.calciteDatePickerChange.emit(date);
  484. return;
  485. }
  486. const { focusedInput } = this;
  487. if (focusedInput === "start") {
  488. if (!this.startAsDate || !sameDate(date, this.startAsDate)) {
  489. const startDateISO = dateToISO(date);
  490. this.value = Array.isArray(this.value)
  491. ? [startDateISO, this.value[1] || ""]
  492. : [startDateISO];
  493. this.start = startDateISO;
  494. this.calciteDatePickerRangeChange.emit({
  495. startDate: date,
  496. endDate: this.endAsDate
  497. });
  498. }
  499. }
  500. else if (focusedInput === "end") {
  501. if (!this.endAsDate || !sameDate(date, this.endAsDate)) {
  502. const endDateISO = dateToISO(date);
  503. this.value = Array.isArray(this.value)
  504. ? [this.value[0] || "", endDateISO]
  505. : ["", endDateISO];
  506. this.end = endDateISO;
  507. this.calciteDatePickerRangeChange.emit({
  508. startDate: this.startAsDate,
  509. endDate: setEndOfDay(date)
  510. });
  511. }
  512. }
  513. }
  514. /**
  515. * Clean up invalid date from input on blur
  516. *
  517. * @param target
  518. */
  519. blur(target) {
  520. const { focusedInput, endAsDate, range, startAsDate, valueAsDate } = this;
  521. const locale = this.effectiveLocale;
  522. const date = this.getDateFromInput(target.value);
  523. if (!date) {
  524. if (!range && valueAsDate) {
  525. target.value = this.formatNumerals(Array.isArray(valueAsDate)
  526. ? valueAsDate[focusedInput === "end" ? 1 : 0].toLocaleDateString(locale)
  527. : valueAsDate.toLocaleDateString(locale));
  528. }
  529. else if (focusedInput === "start" && startAsDate) {
  530. target.value = this.formatNumerals(startAsDate.toLocaleDateString(locale));
  531. }
  532. else if (focusedInput === "end" && endAsDate) {
  533. target.value = this.formatNumerals(endAsDate.toLocaleDateString(locale));
  534. }
  535. }
  536. }
  537. shouldFocusRangeStart() {
  538. return !!(this.endAsDate &&
  539. !this.startAsDate &&
  540. this.focusedInput === "end" &&
  541. this.startInput);
  542. }
  543. shouldFocusRangeEnd() {
  544. return !!(this.startAsDate &&
  545. !this.endAsDate &&
  546. this.focusedInput === "start" &&
  547. this.endInput);
  548. }
  549. /**
  550. * Find a date from input string
  551. * return false if date is invalid, or out of range
  552. *
  553. * @param value
  554. */
  555. getDateFromInput(value) {
  556. if (!this.localeData) {
  557. return false;
  558. }
  559. const { separator } = this.localeData;
  560. const { day, month, year } = parseDateString(value, this.localeData);
  561. const validDay = day > 0;
  562. const validMonth = month > -1;
  563. const date = new Date(year, month, day);
  564. date.setFullYear(year);
  565. const validDate = !isNaN(date.getTime());
  566. const validLength = value.split(separator).filter((c) => c).length > 2;
  567. const validYear = year.toString().length > 0;
  568. if (validDay &&
  569. validMonth &&
  570. validDate &&
  571. validLength &&
  572. validYear &&
  573. inRange(date, this.min, this.max)) {
  574. return date;
  575. }
  576. return false;
  577. }
  578. static get is() { return "calcite-input-date-picker"; }
  579. static get encapsulation() { return "shadow"; }
  580. static get originalStyleUrls() {
  581. return {
  582. "$": ["input-date-picker.scss"]
  583. };
  584. }
  585. static get styleUrls() {
  586. return {
  587. "$": ["input-date-picker.css"]
  588. };
  589. }
  590. static get properties() {
  591. return {
  592. "disabled": {
  593. "type": "boolean",
  594. "mutable": false,
  595. "complexType": {
  596. "original": "boolean",
  597. "resolved": "boolean",
  598. "references": {}
  599. },
  600. "required": false,
  601. "optional": false,
  602. "docs": {
  603. "tags": [],
  604. "text": "When `true`, interaction is prevented and the component is displayed with lower opacity."
  605. },
  606. "attribute": "disabled",
  607. "reflect": true,
  608. "defaultValue": "false"
  609. },
  610. "readOnly": {
  611. "type": "boolean",
  612. "mutable": false,
  613. "complexType": {
  614. "original": "boolean",
  615. "resolved": "boolean",
  616. "references": {}
  617. },
  618. "required": false,
  619. "optional": false,
  620. "docs": {
  621. "tags": [{
  622. "name": "mdn",
  623. "text": "[readOnly](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/readonly)"
  624. }],
  625. "text": "When `true`, the component's value can be read, but controls are not accessible and the value cannot be modified."
  626. },
  627. "attribute": "read-only",
  628. "reflect": true,
  629. "defaultValue": "false"
  630. },
  631. "value": {
  632. "type": "string",
  633. "mutable": true,
  634. "complexType": {
  635. "original": "string | string[]",
  636. "resolved": "string | string[]",
  637. "references": {}
  638. },
  639. "required": false,
  640. "optional": false,
  641. "docs": {
  642. "tags": [],
  643. "text": "The component's value."
  644. },
  645. "attribute": "value",
  646. "reflect": false
  647. },
  648. "flipPlacements": {
  649. "type": "unknown",
  650. "mutable": false,
  651. "complexType": {
  652. "original": "EffectivePlacement[]",
  653. "resolved": "Placement[]",
  654. "references": {
  655. "EffectivePlacement": {
  656. "location": "import",
  657. "path": "../../utils/floating-ui"
  658. }
  659. }
  660. },
  661. "required": false,
  662. "optional": true,
  663. "docs": {
  664. "tags": [],
  665. "text": "Defines the available placements that can be used when a flip occurs."
  666. }
  667. },
  668. "headingLevel": {
  669. "type": "number",
  670. "mutable": false,
  671. "complexType": {
  672. "original": "HeadingLevel",
  673. "resolved": "1 | 2 | 3 | 4 | 5 | 6",
  674. "references": {
  675. "HeadingLevel": {
  676. "location": "import",
  677. "path": "../functional/Heading"
  678. }
  679. }
  680. },
  681. "required": false,
  682. "optional": false,
  683. "docs": {
  684. "tags": [],
  685. "text": "Specifies the number at which section headings should start."
  686. },
  687. "attribute": "heading-level",
  688. "reflect": true
  689. },
  690. "valueAsDate": {
  691. "type": "unknown",
  692. "mutable": true,
  693. "complexType": {
  694. "original": "Date | Date[]",
  695. "resolved": "Date | Date[]",
  696. "references": {
  697. "Date": {
  698. "location": "global"
  699. }
  700. }
  701. },
  702. "required": false,
  703. "optional": true,
  704. "docs": {
  705. "tags": [],
  706. "text": "The component's value as a full date object."
  707. }
  708. },
  709. "startAsDate": {
  710. "type": "unknown",
  711. "mutable": true,
  712. "complexType": {
  713. "original": "Date",
  714. "resolved": "Date",
  715. "references": {
  716. "Date": {
  717. "location": "global"
  718. }
  719. }
  720. },
  721. "required": false,
  722. "optional": true,
  723. "docs": {
  724. "tags": [{
  725. "name": "deprecated",
  726. "text": "use `valueAsDate` instead."
  727. }],
  728. "text": "The component's start date as a full date object."
  729. }
  730. },
  731. "endAsDate": {
  732. "type": "unknown",
  733. "mutable": true,
  734. "complexType": {
  735. "original": "Date",
  736. "resolved": "Date",
  737. "references": {
  738. "Date": {
  739. "location": "global"
  740. }
  741. }
  742. },
  743. "required": false,
  744. "optional": true,
  745. "docs": {
  746. "tags": [{
  747. "name": "deprecated",
  748. "text": "use `valueAsDate` instead."
  749. }],
  750. "text": "The component's end date as a full date object."
  751. }
  752. },
  753. "minAsDate": {
  754. "type": "unknown",
  755. "mutable": true,
  756. "complexType": {
  757. "original": "Date",
  758. "resolved": "Date",
  759. "references": {
  760. "Date": {
  761. "location": "global"
  762. }
  763. }
  764. },
  765. "required": false,
  766. "optional": true,
  767. "docs": {
  768. "tags": [],
  769. "text": "Specifies the earliest allowed date as a full date object."
  770. }
  771. },
  772. "maxAsDate": {
  773. "type": "unknown",
  774. "mutable": true,
  775. "complexType": {
  776. "original": "Date",
  777. "resolved": "Date",
  778. "references": {
  779. "Date": {
  780. "location": "global"
  781. }
  782. }
  783. },
  784. "required": false,
  785. "optional": true,
  786. "docs": {
  787. "tags": [],
  788. "text": "Specifies the latest allowed date as a full date object."
  789. }
  790. },
  791. "min": {
  792. "type": "string",
  793. "mutable": true,
  794. "complexType": {
  795. "original": "string",
  796. "resolved": "string",
  797. "references": {}
  798. },
  799. "required": false,
  800. "optional": true,
  801. "docs": {
  802. "tags": [],
  803. "text": "Specifies the earliest allowed date (\"yyyy-mm-dd\")."
  804. },
  805. "attribute": "min",
  806. "reflect": false
  807. },
  808. "max": {
  809. "type": "string",
  810. "mutable": true,
  811. "complexType": {
  812. "original": "string",
  813. "resolved": "string",
  814. "references": {}
  815. },
  816. "required": false,
  817. "optional": true,
  818. "docs": {
  819. "tags": [],
  820. "text": "Specifies the latest allowed date (\"yyyy-mm-dd\")."
  821. },
  822. "attribute": "max",
  823. "reflect": false
  824. },
  825. "active": {
  826. "type": "boolean",
  827. "mutable": true,
  828. "complexType": {
  829. "original": "boolean",
  830. "resolved": "boolean",
  831. "references": {}
  832. },
  833. "required": false,
  834. "optional": false,
  835. "docs": {
  836. "tags": [{
  837. "name": "deprecated",
  838. "text": "use `open` instead."
  839. }],
  840. "text": "When `true`, the component is active."
  841. },
  842. "attribute": "active",
  843. "reflect": true,
  844. "defaultValue": "false"
  845. },
  846. "open": {
  847. "type": "boolean",
  848. "mutable": true,
  849. "complexType": {
  850. "original": "boolean",
  851. "resolved": "boolean",
  852. "references": {}
  853. },
  854. "required": false,
  855. "optional": false,
  856. "docs": {
  857. "tags": [],
  858. "text": "When `true`, displays the `calcite-date-picker` component."
  859. },
  860. "attribute": "open",
  861. "reflect": true,
  862. "defaultValue": "false"
  863. },
  864. "name": {
  865. "type": "string",
  866. "mutable": false,
  867. "complexType": {
  868. "original": "string",
  869. "resolved": "string",
  870. "references": {}
  871. },
  872. "required": false,
  873. "optional": false,
  874. "docs": {
  875. "tags": [],
  876. "text": "Specifies the name of the component on form submission."
  877. },
  878. "attribute": "name",
  879. "reflect": true
  880. },
  881. "intlPrevMonth": {
  882. "type": "string",
  883. "mutable": false,
  884. "complexType": {
  885. "original": "string",
  886. "resolved": "string",
  887. "references": {}
  888. },
  889. "required": false,
  890. "optional": true,
  891. "docs": {
  892. "tags": [{
  893. "name": "default",
  894. "text": "\"Previous month\""
  895. }],
  896. "text": "Accessible name for the component's previous month button."
  897. },
  898. "attribute": "intl-prev-month",
  899. "reflect": false,
  900. "defaultValue": "TEXT.prevMonth"
  901. },
  902. "intlNextMonth": {
  903. "type": "string",
  904. "mutable": false,
  905. "complexType": {
  906. "original": "string",
  907. "resolved": "string",
  908. "references": {}
  909. },
  910. "required": false,
  911. "optional": true,
  912. "docs": {
  913. "tags": [{
  914. "name": "default",
  915. "text": "\"Next month\""
  916. }],
  917. "text": "Accessible name for the component's next month button."
  918. },
  919. "attribute": "intl-next-month",
  920. "reflect": false,
  921. "defaultValue": "TEXT.nextMonth"
  922. },
  923. "intlYear": {
  924. "type": "string",
  925. "mutable": false,
  926. "complexType": {
  927. "original": "string",
  928. "resolved": "string",
  929. "references": {}
  930. },
  931. "required": false,
  932. "optional": true,
  933. "docs": {
  934. "tags": [{
  935. "name": "default",
  936. "text": "\"Year\""
  937. }],
  938. "text": "Accessible name for the component's year input."
  939. },
  940. "attribute": "intl-year",
  941. "reflect": false,
  942. "defaultValue": "TEXT.year"
  943. },
  944. "locale": {
  945. "type": "string",
  946. "mutable": false,
  947. "complexType": {
  948. "original": "string",
  949. "resolved": "string",
  950. "references": {}
  951. },
  952. "required": false,
  953. "optional": true,
  954. "docs": {
  955. "tags": [{
  956. "name": "deprecated",
  957. "text": "set the global `lang` attribute on the element instead."
  958. }, {
  959. "name": "mdn",
  960. "text": "[lang](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/lang)"
  961. }],
  962. "text": "Specifies the BCP 47 language tag for the desired language and country format."
  963. },
  964. "attribute": "locale",
  965. "reflect": false
  966. },
  967. "numberingSystem": {
  968. "type": "string",
  969. "mutable": false,
  970. "complexType": {
  971. "original": "NumberingSystem",
  972. "resolved": "\"arab\" | \"arabext\" | \"bali\" | \"beng\" | \"deva\" | \"fullwide\" | \"gujr\" | \"guru\" | \"hanidec\" | \"khmr\" | \"knda\" | \"laoo\" | \"latn\" | \"limb\" | \"mlym\" | \"mong\" | \"mymr\" | \"orya\" | \"tamldec\" | \"telu\" | \"thai\" | \"tibt\"",
  973. "references": {
  974. "NumberingSystem": {
  975. "location": "import",
  976. "path": "../../utils/locale"
  977. }
  978. }
  979. },
  980. "required": false,
  981. "optional": true,
  982. "docs": {
  983. "tags": [],
  984. "text": "Specifies the Unicode numeral system used by the component for localization. This property cannot be dynamically changed."
  985. },
  986. "attribute": "numbering-system",
  987. "reflect": true
  988. },
  989. "scale": {
  990. "type": "string",
  991. "mutable": false,
  992. "complexType": {
  993. "original": "\"s\" | \"m\" | \"l\"",
  994. "resolved": "\"l\" | \"m\" | \"s\"",
  995. "references": {}
  996. },
  997. "required": false,
  998. "optional": false,
  999. "docs": {
  1000. "tags": [],
  1001. "text": "Specifies the size of the component."
  1002. },
  1003. "attribute": "scale",
  1004. "reflect": true,
  1005. "defaultValue": "\"m\""
  1006. },
  1007. "placement": {
  1008. "type": "string",
  1009. "mutable": false,
  1010. "complexType": {
  1011. "original": "MenuPlacement",
  1012. "resolved": "\"bottom\" | \"bottom-end\" | \"bottom-leading\" | \"bottom-start\" | \"bottom-trailing\" | \"top\" | \"top-end\" | \"top-leading\" | \"top-start\" | \"top-trailing\"",
  1013. "references": {
  1014. "MenuPlacement": {
  1015. "location": "import",
  1016. "path": "../../utils/floating-ui"
  1017. }
  1018. }
  1019. },
  1020. "required": false,
  1021. "optional": false,
  1022. "docs": {
  1023. "tags": [{
  1024. "name": "default",
  1025. "text": "\"bottom-start\""
  1026. }],
  1027. "text": "Specifies the placement of the `calcite-date-picker` relative to the component."
  1028. },
  1029. "attribute": "placement",
  1030. "reflect": true,
  1031. "defaultValue": "defaultMenuPlacement"
  1032. },
  1033. "range": {
  1034. "type": "boolean",
  1035. "mutable": false,
  1036. "complexType": {
  1037. "original": "boolean",
  1038. "resolved": "boolean",
  1039. "references": {}
  1040. },
  1041. "required": false,
  1042. "optional": false,
  1043. "docs": {
  1044. "tags": [],
  1045. "text": "When `true`, activates a range for the component."
  1046. },
  1047. "attribute": "range",
  1048. "reflect": true,
  1049. "defaultValue": "false"
  1050. },
  1051. "required": {
  1052. "type": "boolean",
  1053. "mutable": false,
  1054. "complexType": {
  1055. "original": "boolean",
  1056. "resolved": "boolean",
  1057. "references": {}
  1058. },
  1059. "required": false,
  1060. "optional": false,
  1061. "docs": {
  1062. "tags": [{
  1063. "name": "internal",
  1064. "text": undefined
  1065. }],
  1066. "text": "When `true`, the component must have a value in order for the form to submit."
  1067. },
  1068. "attribute": "required",
  1069. "reflect": true,
  1070. "defaultValue": "false"
  1071. },
  1072. "start": {
  1073. "type": "string",
  1074. "mutable": true,
  1075. "complexType": {
  1076. "original": "string",
  1077. "resolved": "string",
  1078. "references": {}
  1079. },
  1080. "required": false,
  1081. "optional": true,
  1082. "docs": {
  1083. "tags": [{
  1084. "name": "deprecated",
  1085. "text": "use `value` instead."
  1086. }],
  1087. "text": "The component's start date."
  1088. },
  1089. "attribute": "start",
  1090. "reflect": true
  1091. },
  1092. "end": {
  1093. "type": "string",
  1094. "mutable": true,
  1095. "complexType": {
  1096. "original": "string",
  1097. "resolved": "string",
  1098. "references": {}
  1099. },
  1100. "required": false,
  1101. "optional": true,
  1102. "docs": {
  1103. "tags": [{
  1104. "name": "deprecated",
  1105. "text": "use `value` instead."
  1106. }],
  1107. "text": "The component's end date."
  1108. },
  1109. "attribute": "end",
  1110. "reflect": true
  1111. },
  1112. "overlayPositioning": {
  1113. "type": "string",
  1114. "mutable": false,
  1115. "complexType": {
  1116. "original": "OverlayPositioning",
  1117. "resolved": "\"absolute\" | \"fixed\"",
  1118. "references": {
  1119. "OverlayPositioning": {
  1120. "location": "import",
  1121. "path": "../../utils/floating-ui"
  1122. }
  1123. }
  1124. },
  1125. "required": false,
  1126. "optional": false,
  1127. "docs": {
  1128. "tags": [],
  1129. "text": "Determines the type of positioning to use for the overlaid content.\n\nUsing `\"absolute\"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.\n\n`\"fixed\"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `\"fixed\"`."
  1130. },
  1131. "attribute": "overlay-positioning",
  1132. "reflect": true,
  1133. "defaultValue": "\"absolute\""
  1134. },
  1135. "proximitySelectionDisabled": {
  1136. "type": "boolean",
  1137. "mutable": false,
  1138. "complexType": {
  1139. "original": "boolean",
  1140. "resolved": "boolean",
  1141. "references": {}
  1142. },
  1143. "required": false,
  1144. "optional": false,
  1145. "docs": {
  1146. "tags": [],
  1147. "text": "When `true`, disables the default behavior on the third click of narrowing or extending the range.\nInstead starts a new range."
  1148. },
  1149. "attribute": "proximity-selection-disabled",
  1150. "reflect": false,
  1151. "defaultValue": "false"
  1152. },
  1153. "layout": {
  1154. "type": "string",
  1155. "mutable": false,
  1156. "complexType": {
  1157. "original": "\"horizontal\" | \"vertical\"",
  1158. "resolved": "\"horizontal\" | \"vertical\"",
  1159. "references": {}
  1160. },
  1161. "required": false,
  1162. "optional": false,
  1163. "docs": {
  1164. "tags": [],
  1165. "text": "Defines the layout of the component."
  1166. },
  1167. "attribute": "layout",
  1168. "reflect": true,
  1169. "defaultValue": "\"horizontal\""
  1170. }
  1171. };
  1172. }
  1173. static get states() {
  1174. return {
  1175. "effectiveLocale": {},
  1176. "focusedInput": {},
  1177. "globalAttributes": {},
  1178. "localeData": {}
  1179. };
  1180. }
  1181. static get events() {
  1182. return [{
  1183. "method": "calciteDatePickerChange",
  1184. "name": "calciteDatePickerChange",
  1185. "bubbles": true,
  1186. "cancelable": false,
  1187. "composed": true,
  1188. "docs": {
  1189. "tags": [{
  1190. "name": "deprecated",
  1191. "text": "use `calciteInputDatePickerChange` instead."
  1192. }],
  1193. "text": "Fires when a user changes the date."
  1194. },
  1195. "complexType": {
  1196. "original": "Date",
  1197. "resolved": "Date",
  1198. "references": {
  1199. "Date": {
  1200. "location": "global"
  1201. }
  1202. }
  1203. }
  1204. }, {
  1205. "method": "calciteDatePickerRangeChange",
  1206. "name": "calciteDatePickerRangeChange",
  1207. "bubbles": true,
  1208. "cancelable": false,
  1209. "composed": true,
  1210. "docs": {
  1211. "tags": [{
  1212. "name": "see",
  1213. "text": "[DateRangeChange](https://github.com/Esri/calcite-components/blob/master/src/components/date-picker/interfaces.ts#L1)"
  1214. }, {
  1215. "name": "deprecated",
  1216. "text": "use `calciteInputDatePickerChange` instead."
  1217. }],
  1218. "text": "Fires when a user changes the date range."
  1219. },
  1220. "complexType": {
  1221. "original": "DateRangeChange",
  1222. "resolved": "DateRangeChange",
  1223. "references": {
  1224. "DateRangeChange": {
  1225. "location": "import",
  1226. "path": "../date-picker/interfaces"
  1227. }
  1228. }
  1229. }
  1230. }, {
  1231. "method": "calciteInputDatePickerChange",
  1232. "name": "calciteInputDatePickerChange",
  1233. "bubbles": true,
  1234. "cancelable": false,
  1235. "composed": true,
  1236. "docs": {
  1237. "tags": [],
  1238. "text": "Fires when the component's value changes."
  1239. },
  1240. "complexType": {
  1241. "original": "void",
  1242. "resolved": "void",
  1243. "references": {}
  1244. }
  1245. }, {
  1246. "method": "calciteInputDatePickerBeforeClose",
  1247. "name": "calciteInputDatePickerBeforeClose",
  1248. "bubbles": true,
  1249. "cancelable": false,
  1250. "composed": true,
  1251. "docs": {
  1252. "tags": [],
  1253. "text": "Fires when the component is requested to be closed and before the closing transition begins."
  1254. },
  1255. "complexType": {
  1256. "original": "void",
  1257. "resolved": "void",
  1258. "references": {}
  1259. }
  1260. }, {
  1261. "method": "calciteInputDatePickerClose",
  1262. "name": "calciteInputDatePickerClose",
  1263. "bubbles": true,
  1264. "cancelable": false,
  1265. "composed": true,
  1266. "docs": {
  1267. "tags": [],
  1268. "text": "Fires when the component is closed and animation is complete."
  1269. },
  1270. "complexType": {
  1271. "original": "void",
  1272. "resolved": "void",
  1273. "references": {}
  1274. }
  1275. }, {
  1276. "method": "calciteInputDatePickerBeforeOpen",
  1277. "name": "calciteInputDatePickerBeforeOpen",
  1278. "bubbles": true,
  1279. "cancelable": false,
  1280. "composed": true,
  1281. "docs": {
  1282. "tags": [],
  1283. "text": "Fires when the component is added to the DOM but not rendered, and before the opening transition begins."
  1284. },
  1285. "complexType": {
  1286. "original": "void",
  1287. "resolved": "void",
  1288. "references": {}
  1289. }
  1290. }, {
  1291. "method": "calciteInputDatePickerOpen",
  1292. "name": "calciteInputDatePickerOpen",
  1293. "bubbles": true,
  1294. "cancelable": false,
  1295. "composed": true,
  1296. "docs": {
  1297. "tags": [],
  1298. "text": "Fires when the component is open and animation is complete."
  1299. },
  1300. "complexType": {
  1301. "original": "void",
  1302. "resolved": "void",
  1303. "references": {}
  1304. }
  1305. }];
  1306. }
  1307. static get methods() {
  1308. return {
  1309. "setFocus": {
  1310. "complexType": {
  1311. "signature": "() => Promise<void>",
  1312. "parameters": [],
  1313. "references": {
  1314. "Promise": {
  1315. "location": "global"
  1316. }
  1317. },
  1318. "return": "Promise<void>"
  1319. },
  1320. "docs": {
  1321. "text": "Sets focus on the component.",
  1322. "tags": []
  1323. }
  1324. },
  1325. "reposition": {
  1326. "complexType": {
  1327. "signature": "(delayed?: boolean) => Promise<void>",
  1328. "parameters": [{
  1329. "tags": [{
  1330. "name": "param",
  1331. "text": "delayed"
  1332. }],
  1333. "text": ""
  1334. }],
  1335. "references": {
  1336. "Promise": {
  1337. "location": "global"
  1338. }
  1339. },
  1340. "return": "Promise<void>"
  1341. },
  1342. "docs": {
  1343. "text": "Updates the position of the component.",
  1344. "tags": [{
  1345. "name": "param",
  1346. "text": "delayed"
  1347. }]
  1348. }
  1349. }
  1350. };
  1351. }
  1352. static get elementRef() { return "el"; }
  1353. static get watchers() {
  1354. return [{
  1355. "propName": "disabled",
  1356. "methodName": "handleDisabledAndReadOnlyChange"
  1357. }, {
  1358. "propName": "readOnly",
  1359. "methodName": "handleDisabledAndReadOnlyChange"
  1360. }, {
  1361. "propName": "value",
  1362. "methodName": "valueHandler"
  1363. }, {
  1364. "propName": "flipPlacements",
  1365. "methodName": "flipPlacementsHandler"
  1366. }, {
  1367. "propName": "min",
  1368. "methodName": "onMinChanged"
  1369. }, {
  1370. "propName": "max",
  1371. "methodName": "onMaxChanged"
  1372. }, {
  1373. "propName": "active",
  1374. "methodName": "activeHandler"
  1375. }, {
  1376. "propName": "open",
  1377. "methodName": "openHandler"
  1378. }, {
  1379. "propName": "overlayPositioning",
  1380. "methodName": "overlayPositioningHandler"
  1381. }, {
  1382. "propName": "layout",
  1383. "methodName": "setReferenceEl"
  1384. }, {
  1385. "propName": "focusedInput",
  1386. "methodName": "setReferenceEl"
  1387. }, {
  1388. "propName": "start",
  1389. "methodName": "startWatcher"
  1390. }, {
  1391. "propName": "end",
  1392. "methodName": "endWatcher"
  1393. }, {
  1394. "propName": "effectiveLocale",
  1395. "methodName": "loadLocaleData"
  1396. }];
  1397. }
  1398. static get listeners() {
  1399. return [{
  1400. "name": "calciteDatePickerChange",
  1401. "method": "handleDateOrRangeChange",
  1402. "target": undefined,
  1403. "capture": false,
  1404. "passive": false
  1405. }, {
  1406. "name": "calciteDatePickerRangeChange",
  1407. "method": "handleDateOrRangeChange",
  1408. "target": undefined,
  1409. "capture": false,
  1410. "passive": false
  1411. }, {
  1412. "name": "calciteDaySelect",
  1413. "method": "calciteDaySelectHandler",
  1414. "target": undefined,
  1415. "capture": false,
  1416. "passive": false
  1417. }];
  1418. }
  1419. }