date-picker.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  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.82
  5. */
  6. import { Component, h, Prop, Event, Element, Host, State, Watch, Build } from "@stencil/core";
  7. import { getLocaleData } from "./utils";
  8. import { dateFromRange, dateFromISO, dateToISO, getDaysDiff } from "../../utils/date";
  9. import { HEADING_LEVEL, TEXT } from "./resources";
  10. export class DatePicker {
  11. constructor() {
  12. /** Localized string for "previous month" (used for aria label)
  13. * @default "Previous month"
  14. */
  15. this.intlPrevMonth = TEXT.prevMonth;
  16. /** Localized string for "next month" (used for aria label)
  17. * @default "Next month"
  18. */
  19. this.intlNextMonth = TEXT.nextMonth;
  20. /** Localized string for "year" (used for aria label)
  21. * @default "Year"
  22. */
  23. this.intlYear = TEXT.year;
  24. /** BCP 47 language tag for desired language and country format */
  25. this.locale = document.documentElement.lang || "en";
  26. /** specify the scale of the date picker */
  27. this.scale = "m";
  28. /** Range mode activation */
  29. this.range = false;
  30. /** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
  31. this.proximitySelectionDisabled = false;
  32. //--------------------------------------------------------------------------
  33. //
  34. // Private Methods
  35. //
  36. //--------------------------------------------------------------------------
  37. this.keyUpHandler = (e) => {
  38. if (e.key === "Escape") {
  39. this.reset();
  40. }
  41. };
  42. this.monthHeaderSelectChange = (e) => {
  43. const date = new Date(e.detail);
  44. if (!this.range) {
  45. this.activeDate = date;
  46. }
  47. else {
  48. if (this.activeRange === "end") {
  49. this.activeEndDate = date;
  50. }
  51. else {
  52. this.activeStartDate = date;
  53. }
  54. this.mostRecentRangeValue = date;
  55. }
  56. };
  57. this.monthActiveDateChange = (e) => {
  58. const date = new Date(e.detail);
  59. if (!this.range) {
  60. this.activeDate = date;
  61. }
  62. else {
  63. if (this.activeRange === "end") {
  64. this.activeEndDate = date;
  65. }
  66. else {
  67. this.activeStartDate = date;
  68. }
  69. this.mostRecentRangeValue = date;
  70. }
  71. };
  72. this.monthHoverChange = (e) => {
  73. if (!this.startAsDate) {
  74. this.hoverRange = undefined;
  75. return;
  76. }
  77. const date = new Date(e.detail);
  78. this.hoverRange = {
  79. focused: this.activeRange || "start",
  80. start: this.startAsDate,
  81. end: this.endAsDate
  82. };
  83. if (!this.proximitySelectionDisabled) {
  84. if (this.endAsDate) {
  85. const startDiff = getDaysDiff(date, this.startAsDate);
  86. const endDiff = getDaysDiff(date, this.endAsDate);
  87. if (endDiff > 0) {
  88. this.hoverRange.end = date;
  89. this.hoverRange.focused = "end";
  90. }
  91. else if (startDiff < 0) {
  92. this.hoverRange.start = date;
  93. this.hoverRange.focused = "start";
  94. }
  95. else if (startDiff > endDiff) {
  96. this.hoverRange.start = date;
  97. this.hoverRange.focused = "start";
  98. }
  99. else {
  100. this.hoverRange.end = date;
  101. this.hoverRange.focused = "end";
  102. }
  103. }
  104. else {
  105. if (date < this.startAsDate) {
  106. this.hoverRange = {
  107. focused: "start",
  108. start: date,
  109. end: this.startAsDate
  110. };
  111. }
  112. else {
  113. this.hoverRange.end = date;
  114. this.hoverRange.focused = "end";
  115. }
  116. }
  117. }
  118. else {
  119. if (!this.endAsDate) {
  120. if (date < this.startAsDate) {
  121. this.hoverRange = {
  122. focused: "start",
  123. start: date,
  124. end: this.startAsDate
  125. };
  126. }
  127. else {
  128. this.hoverRange.end = date;
  129. this.hoverRange.focused = "end";
  130. }
  131. }
  132. else {
  133. this.hoverRange = undefined;
  134. }
  135. }
  136. };
  137. this.monthMouseOutChange = () => {
  138. if (this.hoverRange) {
  139. this.hoverRange = undefined;
  140. }
  141. };
  142. /**
  143. * Reset active date and close
  144. */
  145. this.reset = () => {
  146. var _a, _b, _c, _d, _e, _f;
  147. if (!Array.isArray(this.valueAsDate) &&
  148. this.valueAsDate &&
  149. ((_a = this.valueAsDate) === null || _a === void 0 ? void 0 : _a.getTime()) !== ((_b = this.activeDate) === null || _b === void 0 ? void 0 : _b.getTime())) {
  150. this.activeDate = new Date(this.valueAsDate);
  151. }
  152. if (this.startAsDate && ((_c = this.startAsDate) === null || _c === void 0 ? void 0 : _c.getTime()) !== ((_d = this.activeStartDate) === null || _d === void 0 ? void 0 : _d.getTime())) {
  153. this.activeStartDate = new Date(this.startAsDate);
  154. }
  155. if (this.endAsDate && ((_e = this.endAsDate) === null || _e === void 0 ? void 0 : _e.getTime()) !== ((_f = this.activeEndDate) === null || _f === void 0 ? void 0 : _f.getTime())) {
  156. this.activeEndDate = new Date(this.endAsDate);
  157. }
  158. };
  159. /**
  160. * Event handler for when the selected date changes
  161. */
  162. this.monthDateChange = (e) => {
  163. const date = new Date(e.detail);
  164. if (!this.range) {
  165. this.value = date ? dateToISO(date) : "";
  166. this.valueAsDate = date || null;
  167. this.activeDate = date || null;
  168. this.calciteDatePickerChange.emit(date);
  169. return;
  170. }
  171. if (!this.startAsDate || (!this.endAsDate && date < this.startAsDate)) {
  172. if (this.startAsDate) {
  173. this.setEndDate(new Date(this.startAsDate));
  174. }
  175. if (this.activeRange == "end") {
  176. this.setEndDate(date);
  177. }
  178. else {
  179. this.setStartDate(date);
  180. }
  181. }
  182. else if (!this.endAsDate) {
  183. this.setEndDate(date);
  184. }
  185. else {
  186. if (!this.proximitySelectionDisabled) {
  187. if (this.activeRange) {
  188. if (this.activeRange == "end") {
  189. this.setEndDate(date);
  190. }
  191. else {
  192. this.setStartDate(date);
  193. }
  194. }
  195. else {
  196. const startDiff = getDaysDiff(date, this.startAsDate);
  197. const endDiff = getDaysDiff(date, this.endAsDate);
  198. if (endDiff === 0 || startDiff < 0) {
  199. this.setStartDate(date);
  200. }
  201. else if (startDiff === 0 || endDiff < 0) {
  202. this.setEndDate(date);
  203. }
  204. else if (startDiff < endDiff) {
  205. this.setStartDate(date);
  206. }
  207. else {
  208. this.setEndDate(date);
  209. }
  210. }
  211. }
  212. else {
  213. this.setStartDate(date);
  214. this.endAsDate = this.activeEndDate = this.end = undefined;
  215. }
  216. }
  217. this.calciteDatePickerChange.emit(date);
  218. };
  219. }
  220. handleValueAsDate(date) {
  221. if (!Array.isArray(date) && date && date !== this.activeDate) {
  222. this.activeDate = date;
  223. }
  224. }
  225. handleRangeChange() {
  226. const { startAsDate: startDate, endAsDate: endDate } = this;
  227. this.activeEndDate = endDate;
  228. this.activeStartDate = startDate;
  229. }
  230. onMinChanged(min) {
  231. if (min) {
  232. this.minAsDate = dateFromISO(min);
  233. }
  234. }
  235. onMaxChanged(max) {
  236. if (max) {
  237. this.maxAsDate = dateFromISO(max);
  238. }
  239. }
  240. // --------------------------------------------------------------------------
  241. //
  242. // Lifecycle
  243. //
  244. // --------------------------------------------------------------------------
  245. connectedCallback() {
  246. if (Array.isArray(this.value)) {
  247. this.valueAsDate = this.value.map((v) => dateFromISO(v));
  248. this.start = this.value[0];
  249. this.end = this.value[1];
  250. }
  251. else if (this.value) {
  252. this.valueAsDate = dateFromISO(this.value);
  253. }
  254. if (this.start) {
  255. this.setStartAsDate(dateFromISO(this.start));
  256. }
  257. if (this.end) {
  258. this.setEndAsDate(dateFromISO(this.end));
  259. }
  260. if (this.min) {
  261. this.minAsDate = dateFromISO(this.min);
  262. }
  263. if (this.max) {
  264. this.maxAsDate = dateFromISO(this.max);
  265. }
  266. }
  267. async componentWillLoad() {
  268. await this.loadLocaleData();
  269. this.onMinChanged(this.min);
  270. this.onMaxChanged(this.max);
  271. }
  272. render() {
  273. var _a;
  274. const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
  275. const activeStartDate = this.range
  276. ? this.getActiveStartDate(date, this.minAsDate, this.maxAsDate)
  277. : this.getActiveDate(date, this.minAsDate, this.maxAsDate);
  278. let activeDate = activeStartDate;
  279. const endDate = this.range
  280. ? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
  281. : null;
  282. const activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
  283. if ((this.activeRange === "end" ||
  284. (((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "end" && (!this.proximitySelectionDisabled || endDate))) &&
  285. activeEndDate) {
  286. activeDate = activeEndDate;
  287. }
  288. if (this.range && this.mostRecentRangeValue) {
  289. activeDate = this.mostRecentRangeValue;
  290. }
  291. const minDate = this.range && this.activeRange
  292. ? this.activeRange === "start"
  293. ? this.minAsDate
  294. : date || this.minAsDate
  295. : this.minAsDate;
  296. const maxDate = this.range && this.activeRange
  297. ? this.activeRange === "start"
  298. ? endDate || this.maxAsDate
  299. : this.maxAsDate
  300. : this.maxAsDate;
  301. return (h(Host, { onBlur: this.reset, onKeyUp: this.keyUpHandler, role: "application" }, this.renderCalendar(activeDate, maxDate, minDate, date, endDate)));
  302. }
  303. valueHandler(value) {
  304. if (Array.isArray(value)) {
  305. this.valueAsDate = value.map((v) => dateFromISO(v));
  306. this.start = value[0];
  307. this.end = value[1];
  308. }
  309. else if (value) {
  310. this.valueAsDate = dateFromISO(value);
  311. this.start = "";
  312. this.end = "";
  313. }
  314. }
  315. startWatcher(start) {
  316. this.setStartAsDate(dateFromISO(start));
  317. }
  318. endWatcher(end) {
  319. this.setEndAsDate(dateFromISO(end));
  320. }
  321. async loadLocaleData() {
  322. if (!Build.isBrowser) {
  323. return;
  324. }
  325. const { locale } = this;
  326. this.localeData = await getLocaleData(locale);
  327. }
  328. /**
  329. * Render calcite-date-picker-month-header and calcite-date-picker-month
  330. */
  331. renderCalendar(activeDate, maxDate, minDate, date, endDate) {
  332. return (this.localeData && [
  333. h("calcite-date-picker-month-header", { activeDate: activeDate, headingLevel: this.headingLevel || HEADING_LEVEL, intlNextMonth: this.intlNextMonth, intlPrevMonth: this.intlPrevMonth, intlYear: this.intlYear, localeData: this.localeData, max: maxDate, min: minDate, onCalciteDatePickerSelect: this.monthHeaderSelectChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date || new Date() }),
  334. h("calcite-date-picker-month", { activeDate: activeDate, endDate: this.range ? endDate : undefined, hoverRange: this.hoverRange, localeData: this.localeData, max: maxDate, min: minDate, onCalciteDatePickerActiveDateChange: this.monthActiveDateChange, onCalciteDatePickerHover: this.monthHoverChange, onCalciteDatePickerMouseOut: this.monthMouseOutChange, onCalciteDatePickerSelect: this.monthDateChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date, startDate: this.range ? date : undefined })
  335. ]);
  336. }
  337. /**
  338. * Update date instance of start if valid
  339. */
  340. setStartAsDate(startDate, emit) {
  341. this.startAsDate = startDate;
  342. this.mostRecentRangeValue = this.startAsDate;
  343. if (emit) {
  344. this.calciteDatePickerRangeChange.emit({
  345. startDate,
  346. endDate: this.endAsDate
  347. });
  348. }
  349. }
  350. /**
  351. * Update date instance of end if valid
  352. */
  353. setEndAsDate(endDate, emit) {
  354. this.endAsDate = endDate;
  355. this.mostRecentRangeValue = this.endAsDate;
  356. if (emit) {
  357. this.calciteDatePickerRangeChange.emit({
  358. startDate: this.startAsDate,
  359. endDate
  360. });
  361. }
  362. }
  363. setEndDate(date) {
  364. this.end = date ? dateToISO(date) : "";
  365. this.setEndAsDate(date, true);
  366. this.activeEndDate = date || null;
  367. }
  368. setStartDate(date) {
  369. this.start = date ? dateToISO(date) : "";
  370. this.setStartAsDate(date, true);
  371. this.activeStartDate = date || null;
  372. }
  373. /**
  374. * Get an active date using the value, or current date as default
  375. */
  376. getActiveDate(value, min, max) {
  377. return dateFromRange(this.activeDate, min, max) || value || dateFromRange(new Date(), min, max);
  378. }
  379. getActiveStartDate(value, min, max) {
  380. return (dateFromRange(this.activeStartDate, min, max) || value || dateFromRange(new Date(), min, max));
  381. }
  382. getActiveEndDate(value, min, max) {
  383. return (dateFromRange(this.activeEndDate, min, max) || value || dateFromRange(new Date(), min, max));
  384. }
  385. static get is() { return "calcite-date-picker"; }
  386. static get encapsulation() { return "shadow"; }
  387. static get originalStyleUrls() { return {
  388. "$": ["date-picker.scss"]
  389. }; }
  390. static get styleUrls() { return {
  391. "$": ["date-picker.css"]
  392. }; }
  393. static get assetsDirs() { return ["assets"]; }
  394. static get properties() { return {
  395. "activeRange": {
  396. "type": "string",
  397. "mutable": false,
  398. "complexType": {
  399. "original": "\"start\" | \"end\"",
  400. "resolved": "\"end\" | \"start\"",
  401. "references": {}
  402. },
  403. "required": false,
  404. "optional": true,
  405. "docs": {
  406. "tags": [],
  407. "text": "Active range"
  408. },
  409. "attribute": "active-range",
  410. "reflect": false
  411. },
  412. "value": {
  413. "type": "string",
  414. "mutable": true,
  415. "complexType": {
  416. "original": "string | string[]",
  417. "resolved": "string | string[]",
  418. "references": {}
  419. },
  420. "required": false,
  421. "optional": true,
  422. "docs": {
  423. "tags": [],
  424. "text": "Selected date"
  425. },
  426. "attribute": "value",
  427. "reflect": false
  428. },
  429. "headingLevel": {
  430. "type": "number",
  431. "mutable": false,
  432. "complexType": {
  433. "original": "HeadingLevel",
  434. "resolved": "1 | 2 | 3 | 4 | 5 | 6",
  435. "references": {
  436. "HeadingLevel": {
  437. "location": "import",
  438. "path": "../functional/Heading"
  439. }
  440. }
  441. },
  442. "required": false,
  443. "optional": false,
  444. "docs": {
  445. "tags": [],
  446. "text": "Number at which section headings should start for this component."
  447. },
  448. "attribute": "heading-level",
  449. "reflect": false
  450. },
  451. "valueAsDate": {
  452. "type": "unknown",
  453. "mutable": true,
  454. "complexType": {
  455. "original": "Date | Date[]",
  456. "resolved": "Date | Date[]",
  457. "references": {
  458. "Date": {
  459. "location": "global"
  460. }
  461. }
  462. },
  463. "required": false,
  464. "optional": true,
  465. "docs": {
  466. "tags": [],
  467. "text": "Selected date as full date object"
  468. }
  469. },
  470. "startAsDate": {
  471. "type": "unknown",
  472. "mutable": true,
  473. "complexType": {
  474. "original": "Date",
  475. "resolved": "Date",
  476. "references": {
  477. "Date": {
  478. "location": "global"
  479. }
  480. }
  481. },
  482. "required": false,
  483. "optional": true,
  484. "docs": {
  485. "tags": [{
  486. "name": "deprecated",
  487. "text": "use valueAsDate instead"
  488. }],
  489. "text": "Selected start date as full date object"
  490. }
  491. },
  492. "endAsDate": {
  493. "type": "unknown",
  494. "mutable": true,
  495. "complexType": {
  496. "original": "Date",
  497. "resolved": "Date",
  498. "references": {
  499. "Date": {
  500. "location": "global"
  501. }
  502. }
  503. },
  504. "required": false,
  505. "optional": true,
  506. "docs": {
  507. "tags": [{
  508. "name": "deprecated",
  509. "text": "use valueAsDate instead"
  510. }],
  511. "text": "Selected end date as full date object"
  512. }
  513. },
  514. "minAsDate": {
  515. "type": "unknown",
  516. "mutable": true,
  517. "complexType": {
  518. "original": "Date",
  519. "resolved": "Date",
  520. "references": {
  521. "Date": {
  522. "location": "global"
  523. }
  524. }
  525. },
  526. "required": false,
  527. "optional": true,
  528. "docs": {
  529. "tags": [],
  530. "text": "Earliest allowed date as full date object"
  531. }
  532. },
  533. "maxAsDate": {
  534. "type": "unknown",
  535. "mutable": true,
  536. "complexType": {
  537. "original": "Date",
  538. "resolved": "Date",
  539. "references": {
  540. "Date": {
  541. "location": "global"
  542. }
  543. }
  544. },
  545. "required": false,
  546. "optional": true,
  547. "docs": {
  548. "tags": [],
  549. "text": "Latest allowed date as full date object"
  550. }
  551. },
  552. "min": {
  553. "type": "string",
  554. "mutable": true,
  555. "complexType": {
  556. "original": "string",
  557. "resolved": "string",
  558. "references": {}
  559. },
  560. "required": false,
  561. "optional": true,
  562. "docs": {
  563. "tags": [],
  564. "text": "Earliest allowed date (\"yyyy-mm-dd\")"
  565. },
  566. "attribute": "min",
  567. "reflect": false
  568. },
  569. "max": {
  570. "type": "string",
  571. "mutable": true,
  572. "complexType": {
  573. "original": "string",
  574. "resolved": "string",
  575. "references": {}
  576. },
  577. "required": false,
  578. "optional": true,
  579. "docs": {
  580. "tags": [],
  581. "text": "Latest allowed date (\"yyyy-mm-dd\")"
  582. },
  583. "attribute": "max",
  584. "reflect": false
  585. },
  586. "intlPrevMonth": {
  587. "type": "string",
  588. "mutable": false,
  589. "complexType": {
  590. "original": "string",
  591. "resolved": "string",
  592. "references": {}
  593. },
  594. "required": false,
  595. "optional": true,
  596. "docs": {
  597. "tags": [{
  598. "name": "default",
  599. "text": "\"Previous month\""
  600. }],
  601. "text": "Localized string for \"previous month\" (used for aria label)"
  602. },
  603. "attribute": "intl-prev-month",
  604. "reflect": false,
  605. "defaultValue": "TEXT.prevMonth"
  606. },
  607. "intlNextMonth": {
  608. "type": "string",
  609. "mutable": false,
  610. "complexType": {
  611. "original": "string",
  612. "resolved": "string",
  613. "references": {}
  614. },
  615. "required": false,
  616. "optional": true,
  617. "docs": {
  618. "tags": [{
  619. "name": "default",
  620. "text": "\"Next month\""
  621. }],
  622. "text": "Localized string for \"next month\" (used for aria label)"
  623. },
  624. "attribute": "intl-next-month",
  625. "reflect": false,
  626. "defaultValue": "TEXT.nextMonth"
  627. },
  628. "intlYear": {
  629. "type": "string",
  630. "mutable": false,
  631. "complexType": {
  632. "original": "string",
  633. "resolved": "string",
  634. "references": {}
  635. },
  636. "required": false,
  637. "optional": true,
  638. "docs": {
  639. "tags": [{
  640. "name": "default",
  641. "text": "\"Year\""
  642. }],
  643. "text": "Localized string for \"year\" (used for aria label)"
  644. },
  645. "attribute": "intl-year",
  646. "reflect": false,
  647. "defaultValue": "TEXT.year"
  648. },
  649. "locale": {
  650. "type": "string",
  651. "mutable": false,
  652. "complexType": {
  653. "original": "string",
  654. "resolved": "string",
  655. "references": {}
  656. },
  657. "required": false,
  658. "optional": true,
  659. "docs": {
  660. "tags": [],
  661. "text": "BCP 47 language tag for desired language and country format"
  662. },
  663. "attribute": "locale",
  664. "reflect": false,
  665. "defaultValue": "document.documentElement.lang || \"en\""
  666. },
  667. "scale": {
  668. "type": "string",
  669. "mutable": false,
  670. "complexType": {
  671. "original": "\"s\" | \"m\" | \"l\"",
  672. "resolved": "\"l\" | \"m\" | \"s\"",
  673. "references": {}
  674. },
  675. "required": false,
  676. "optional": false,
  677. "docs": {
  678. "tags": [],
  679. "text": "specify the scale of the date picker"
  680. },
  681. "attribute": "scale",
  682. "reflect": true,
  683. "defaultValue": "\"m\""
  684. },
  685. "range": {
  686. "type": "boolean",
  687. "mutable": false,
  688. "complexType": {
  689. "original": "boolean",
  690. "resolved": "boolean",
  691. "references": {}
  692. },
  693. "required": false,
  694. "optional": false,
  695. "docs": {
  696. "tags": [],
  697. "text": "Range mode activation"
  698. },
  699. "attribute": "range",
  700. "reflect": true,
  701. "defaultValue": "false"
  702. },
  703. "start": {
  704. "type": "string",
  705. "mutable": true,
  706. "complexType": {
  707. "original": "string",
  708. "resolved": "string",
  709. "references": {}
  710. },
  711. "required": false,
  712. "optional": true,
  713. "docs": {
  714. "tags": [{
  715. "name": "deprecated",
  716. "text": "use value instead"
  717. }],
  718. "text": "Selected start date"
  719. },
  720. "attribute": "start",
  721. "reflect": false
  722. },
  723. "end": {
  724. "type": "string",
  725. "mutable": true,
  726. "complexType": {
  727. "original": "string",
  728. "resolved": "string",
  729. "references": {}
  730. },
  731. "required": false,
  732. "optional": true,
  733. "docs": {
  734. "tags": [{
  735. "name": "deprecated",
  736. "text": "use value instead"
  737. }],
  738. "text": "Selected end date"
  739. },
  740. "attribute": "end",
  741. "reflect": false
  742. },
  743. "proximitySelectionDisabled": {
  744. "type": "boolean",
  745. "mutable": false,
  746. "complexType": {
  747. "original": "boolean",
  748. "resolved": "boolean",
  749. "references": {}
  750. },
  751. "required": false,
  752. "optional": false,
  753. "docs": {
  754. "tags": [],
  755. "text": "Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range."
  756. },
  757. "attribute": "proximity-selection-disabled",
  758. "reflect": false,
  759. "defaultValue": "false"
  760. }
  761. }; }
  762. static get states() { return {
  763. "activeDate": {},
  764. "activeStartDate": {},
  765. "activeEndDate": {},
  766. "localeData": {},
  767. "hoverRange": {}
  768. }; }
  769. static get events() { return [{
  770. "method": "calciteDatePickerChange",
  771. "name": "calciteDatePickerChange",
  772. "bubbles": true,
  773. "cancelable": true,
  774. "composed": true,
  775. "docs": {
  776. "tags": [],
  777. "text": "Trigger calcite date change when a user changes the date."
  778. },
  779. "complexType": {
  780. "original": "Date",
  781. "resolved": "Date",
  782. "references": {
  783. "Date": {
  784. "location": "global"
  785. }
  786. }
  787. }
  788. }, {
  789. "method": "calciteDatePickerRangeChange",
  790. "name": "calciteDatePickerRangeChange",
  791. "bubbles": true,
  792. "cancelable": true,
  793. "composed": true,
  794. "docs": {
  795. "tags": [{
  796. "name": "see",
  797. "text": "[DateRangeChange](https://github.com/Esri/calcite-components/blob/master/src/components/date-picker/interfaces.ts#L1)"
  798. }],
  799. "text": "Trigger calcite date change when a user changes the date range."
  800. },
  801. "complexType": {
  802. "original": "DateRangeChange",
  803. "resolved": "DateRangeChange",
  804. "references": {
  805. "DateRangeChange": {
  806. "location": "import",
  807. "path": "./interfaces"
  808. }
  809. }
  810. }
  811. }]; }
  812. static get elementRef() { return "el"; }
  813. static get watchers() { return [{
  814. "propName": "valueAsDate",
  815. "methodName": "handleValueAsDate"
  816. }, {
  817. "propName": "startAsDate",
  818. "methodName": "handleRangeChange"
  819. }, {
  820. "propName": "endAsDate",
  821. "methodName": "handleRangeChange"
  822. }, {
  823. "propName": "min",
  824. "methodName": "onMinChanged"
  825. }, {
  826. "propName": "max",
  827. "methodName": "onMaxChanged"
  828. }, {
  829. "propName": "value",
  830. "methodName": "valueHandler"
  831. }, {
  832. "propName": "start",
  833. "methodName": "startWatcher"
  834. }, {
  835. "propName": "end",
  836. "methodName": "endWatcher"
  837. }, {
  838. "propName": "locale",
  839. "methodName": "loadLocaleData"
  840. }]; }
  841. }