@esri/solutions-components 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/deduct-calculator.cjs.entry.js +1 -1
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/{pciUtils-6a806ba4.js → pciUtils-423cfc68.js} +25 -7
- package/dist/collection/demos/deduct-calculator.html +2 -5
- package/dist/collection/demos/new-public-notification.html +6 -4
- package/dist/collection/utils/pciUtils.js +25 -7
- package/dist/collection/utils/pciUtils.ts +30 -7
- package/dist/components/ExpandToggle.js +110 -0
- package/dist/components/Heading.js +22 -0
- package/dist/components/_commonjsHelpers.js +22 -0
- package/dist/components/action-bar.js +276 -0
- package/dist/components/action-group.js +149 -0
- package/dist/components/action-menu.js +356 -0
- package/dist/components/action.js +214 -0
- package/dist/components/add-record-modal.d.ts +11 -0
- package/dist/components/add-record-modal.js +171 -0
- package/dist/components/array.js +15 -0
- package/dist/components/block.js +272 -0
- package/dist/components/buffer-tools.d.ts +11 -0
- package/dist/components/buffer-tools.js +11 -0
- package/dist/components/buffer-tools2.js +262 -0
- package/dist/components/button.js +263 -0
- package/dist/components/calcite-accordion-item.js +244 -0
- package/dist/components/calcite-accordion.js +180 -0
- package/dist/components/calcite-action-bar.js +11 -0
- package/dist/components/calcite-action-group.js +11 -0
- package/dist/components/calcite-action-menu.js +11 -0
- package/dist/components/calcite-action-pad.js +197 -0
- package/dist/components/calcite-action.js +11 -0
- package/dist/components/calcite-alert.js +297 -0
- package/dist/components/calcite-avatar.js +182 -0
- package/dist/components/calcite-block-section.js +155 -0
- package/dist/components/calcite-block.js +11 -0
- package/dist/components/calcite-button.js +11 -0
- package/dist/components/calcite-card.js +187 -0
- package/dist/components/calcite-checkbox.js +11 -0
- package/dist/components/calcite-chip.js +11 -0
- package/dist/components/calcite-color-picker-hex-input.js +11 -0
- package/dist/components/calcite-color-picker-swatch.js +11 -0
- package/dist/components/calcite-color-picker.js +1036 -0
- package/dist/components/calcite-combobox-item-group.js +75 -0
- package/dist/components/calcite-combobox-item.js +11 -0
- package/dist/components/calcite-combobox.js +11 -0
- package/dist/components/calcite-date-picker-day.js +11 -0
- package/dist/components/calcite-date-picker-month-header.js +11 -0
- package/dist/components/calcite-date-picker-month.js +11 -0
- package/dist/components/calcite-date-picker.js +11 -0
- package/dist/components/calcite-dropdown-group.js +11 -0
- package/dist/components/calcite-dropdown-item.js +11 -0
- package/dist/components/calcite-dropdown.js +11 -0
- package/dist/components/calcite-fab.js +144 -0
- package/dist/components/calcite-filter.js +195 -0
- package/dist/components/calcite-flow-item.js +243 -0
- package/dist/components/calcite-flow.js +147 -0
- package/dist/components/calcite-graph.js +11 -0
- package/dist/components/calcite-handle.js +11 -0
- package/dist/components/calcite-icon.js +11 -0
- package/dist/components/calcite-inline-editable.js +294 -0
- package/dist/components/calcite-input-date-picker.js +713 -0
- package/dist/components/calcite-input-message.js +11 -0
- package/dist/components/calcite-input-number.js +637 -0
- package/dist/components/calcite-input-text.js +400 -0
- package/dist/components/calcite-input-time-picker.js +434 -0
- package/dist/components/calcite-input.js +11 -0
- package/dist/components/calcite-label.js +11 -0
- package/dist/components/calcite-link.js +11 -0
- package/dist/components/calcite-list-item-group.js +65 -0
- package/dist/components/calcite-list-item.js +11 -0
- package/dist/components/calcite-list.js +11 -0
- package/dist/components/calcite-loader.js +11 -0
- package/dist/components/calcite-modal.js +11 -0
- package/dist/components/calcite-notice.js +11 -0
- package/dist/components/calcite-option-group.js +64 -0
- package/dist/components/calcite-option.js +11 -0
- package/dist/components/calcite-pagination.js +258 -0
- package/dist/components/calcite-panel.js +11 -0
- package/dist/components/calcite-pick-list-group.js +74 -0
- package/dist/components/calcite-pick-list-item.js +11 -0
- package/dist/components/calcite-pick-list.js +11 -0
- package/dist/components/calcite-popover-manager.js +94 -0
- package/dist/components/calcite-popover.js +11 -0
- package/dist/components/calcite-progress.js +11 -0
- package/dist/components/calcite-radio-button-group.js +132 -0
- package/dist/components/calcite-radio-button.js +310 -0
- package/dist/components/calcite-radio-group-item.js +11 -0
- package/dist/components/calcite-radio-group.js +11 -0
- package/dist/components/calcite-rating.js +201 -0
- package/dist/components/calcite-scrim.js +11 -0
- package/dist/components/calcite-select.js +11 -0
- package/dist/components/calcite-shell-center-row.js +100 -0
- package/dist/components/calcite-shell-panel.js +11 -0
- package/dist/components/calcite-shell.js +11 -0
- package/dist/components/calcite-slider.js +11 -0
- package/dist/components/calcite-sortable-list.js +202 -0
- package/dist/components/calcite-split-button.js +11 -0
- package/dist/components/calcite-stepper-item.js +271 -0
- package/dist/components/calcite-stepper.js +256 -0
- package/dist/components/calcite-switch.js +11 -0
- package/dist/components/calcite-tab-nav.js +11 -0
- package/dist/components/calcite-tab-title.js +11 -0
- package/dist/components/calcite-tab.js +11 -0
- package/dist/components/calcite-tabs.js +11 -0
- package/dist/components/calcite-tile-select-group.js +65 -0
- package/dist/components/calcite-tile-select.js +266 -0
- package/dist/components/calcite-tile.js +11 -0
- package/dist/components/calcite-time-picker.js +11 -0
- package/dist/components/calcite-tip-group.js +41 -0
- package/dist/components/calcite-tip-manager.js +223 -0
- package/dist/components/calcite-tip.js +162 -0
- package/dist/components/calcite-tooltip-manager.js +57 -0
- package/dist/components/calcite-tooltip.js +11 -0
- package/dist/components/calcite-tree-item.js +11 -0
- package/dist/components/calcite-tree.js +11 -0
- package/dist/components/calcite-value-list-item.js +11 -0
- package/dist/components/calcite-value-list.js +11 -0
- package/dist/components/card-manager.d.ts +11 -0
- package/dist/components/card-manager.js +143 -0
- package/dist/components/check-list.d.ts +11 -0
- package/dist/components/check-list.js +11 -0
- package/dist/components/check-list2.js +131 -0
- package/dist/components/checkbox.js +165 -0
- package/dist/components/chip.js +170 -0
- package/dist/components/color-picker-hex-input.js +363 -0
- package/dist/components/color-picker-swatch.js +2034 -0
- package/dist/components/combobox-item.js +182 -0
- package/dist/components/combobox.js +912 -0
- package/dist/components/comment-card.d.ts +11 -0
- package/dist/components/comment-card.js +90 -0
- package/dist/components/conditionalSlot.js +50 -0
- package/dist/components/config-buffer-tools.d.ts +11 -0
- package/dist/components/config-buffer-tools.js +187 -0
- package/dist/components/config-draw-tools.d.ts +11 -0
- package/dist/components/config-draw-tools.js +121 -0
- package/dist/components/config-layer-picker.d.ts +11 -0
- package/dist/components/config-layer-picker.js +163 -0
- package/dist/components/config-pdf-download.d.ts +11 -0
- package/dist/components/config-pdf-download.js +154 -0
- package/dist/components/crowdsource-manager.d.ts +11 -0
- package/dist/components/crowdsource-manager.js +90 -0
- package/dist/components/crowdsource-reporter.d.ts +11 -0
- package/dist/components/crowdsource-reporter.js +90 -0
- package/dist/components/csvUtils.js +74 -0
- package/dist/components/date-picker-day.js +111 -0
- package/dist/components/date-picker-month-header.js +224 -0
- package/dist/components/date-picker-month.js +344 -0
- package/dist/components/date-picker.js +575 -0
- package/dist/components/date.js +180 -0
- package/dist/components/debounce.js +487 -0
- package/dist/components/deduct-calculator.d.ts +11 -0
- package/dist/components/deduct-calculator.js +11 -0
- package/dist/components/deduct-calculator2.js +1002 -0
- package/dist/components/dom.js +231 -0
- package/dist/components/dropdown-group.js +96 -0
- package/dist/components/dropdown-item.js +232 -0
- package/dist/components/dropdown.js +505 -0
- package/dist/components/edit-record-modal.d.ts +11 -0
- package/dist/components/edit-record-modal.js +11 -0
- package/dist/components/edit-record-modal2.js +161 -0
- package/dist/components/filter.js +763 -0
- package/dist/components/floating-ui.js +1768 -0
- package/dist/components/form.js +228 -0
- package/dist/components/graph.js +254 -0
- package/dist/components/guid.js +24 -0
- package/dist/components/handle.js +119 -0
- package/dist/components/icon.js +202 -0
- package/dist/components/index.d.ts +61 -0
- package/dist/components/index.js +196 -0
- package/dist/components/index2.js +199 -0
- package/dist/components/info-card.d.ts +11 -0
- package/dist/components/info-card.js +11 -0
- package/dist/components/info-card2.js +97 -0
- package/dist/components/input-message.js +101 -0
- package/dist/components/input.js +740 -0
- package/dist/components/interactive.js +51 -0
- package/dist/components/interfaces.js +19 -0
- package/dist/components/interfaces2.js +21 -0
- package/dist/components/interfaces3.js +80 -0
- package/dist/components/json-editor.d.ts +11 -0
- package/dist/components/json-editor.js +11 -0
- package/dist/components/json-editor2.js +441 -0
- package/dist/components/key.js +16 -0
- package/dist/components/label.js +106 -0
- package/dist/components/label2.js +131 -0
- package/dist/components/labelFormats.js +210 -0
- package/dist/components/layer-table.d.ts +11 -0
- package/dist/components/layer-table.js +453 -0
- package/dist/components/link.js +123 -0
- package/dist/components/list-item.d.ts +11 -0
- package/dist/components/list-item.js +90 -0
- package/dist/components/list-item2.js +149 -0
- package/dist/components/list.js +83 -0
- package/dist/components/loadModules.js +28 -0
- package/dist/components/loader.js +116 -0
- package/dist/components/locale.js +412 -0
- package/dist/components/locale2.js +413 -0
- package/dist/components/map-card.d.ts +11 -0
- package/dist/components/map-card.js +354 -0
- package/dist/components/map-draw-tools.d.ts +11 -0
- package/dist/components/map-draw-tools.js +11 -0
- package/dist/components/map-draw-tools2.js +228 -0
- package/dist/components/map-layer-picker.d.ts +11 -0
- package/dist/components/map-layer-picker.js +11 -0
- package/dist/components/map-layer-picker2.js +188 -0
- package/dist/components/map-search.d.ts +11 -0
- package/dist/components/map-search.js +155 -0
- package/dist/components/map-select-tools.d.ts +11 -0
- package/dist/components/map-select-tools.js +11 -0
- package/dist/components/map-select-tools2.js +588 -0
- package/dist/components/mapViewUtils.js +129 -0
- package/dist/components/math.js +24 -0
- package/dist/components/media-card.d.ts +11 -0
- package/dist/components/media-card.js +11 -0
- package/dist/components/media-card2.js +177 -0
- package/dist/components/modal.js +495 -0
- package/dist/components/nonChromiumPlatformUtils.js +503 -0
- package/dist/components/notice.js +192 -0
- package/dist/components/observers.js +56 -0
- package/dist/components/openCloseComponent.js +56 -0
- package/dist/components/option.js +109 -0
- package/dist/components/panel.js +459 -0
- package/dist/components/pci-calculator.d.ts +11 -0
- package/dist/components/pci-calculator.js +193 -0
- package/dist/components/pdf-download.d.ts +11 -0
- package/dist/components/pdf-download.js +11 -0
- package/dist/components/pdf-download2.js +189 -0
- package/dist/components/pick-list-item.js +255 -0
- package/dist/components/pick-list.js +170 -0
- package/dist/components/popover.js +500 -0
- package/dist/components/progress.js +60 -0
- package/dist/components/public-notification.d.ts +11 -0
- package/dist/components/public-notification.js +825 -0
- package/dist/components/publicNotificationStore.js +38 -0
- package/dist/components/queryUtils.js +187 -0
- package/dist/components/radio-group-item.js +101 -0
- package/dist/components/radio-group.js +235 -0
- package/dist/components/refine-selection-tools.d.ts +11 -0
- package/dist/components/refine-selection-tools.js +11 -0
- package/dist/components/refine-selection-tools2.js +492 -0
- package/dist/components/refine-selection.d.ts +11 -0
- package/dist/components/refine-selection.js +11 -0
- package/dist/components/refine-selection2.js +376 -0
- package/dist/components/resources.js +24 -0
- package/dist/components/resources2.js +21 -0
- package/dist/components/resources3.js +38 -0
- package/dist/components/scrim.js +83 -0
- package/dist/components/select.js +259 -0
- package/dist/components/shared-list-render.js +319 -0
- package/dist/components/shell-panel.js +281 -0
- package/dist/components/shell.js +121 -0
- package/dist/components/slider.js +896 -0
- package/dist/components/solution-configuration.d.ts +11 -0
- package/dist/components/solution-configuration.js +2233 -0
- package/dist/components/solution-contents.d.ts +11 -0
- package/dist/components/solution-contents.js +11 -0
- package/dist/components/solution-contents2.js +128 -0
- package/dist/components/solution-item-details.d.ts +11 -0
- package/dist/components/solution-item-details.js +11 -0
- package/dist/components/solution-item-details2.js +234 -0
- package/dist/components/solution-item-icon.d.ts +11 -0
- package/dist/components/solution-item-icon.js +11 -0
- package/dist/components/solution-item-icon2.js +342 -0
- package/dist/components/solution-item-sharing.d.ts +11 -0
- package/dist/components/solution-item-sharing.js +11 -0
- package/dist/components/solution-item-sharing2.js +167 -0
- package/dist/components/solution-item.d.ts +11 -0
- package/dist/components/solution-item.js +11 -0
- package/dist/components/solution-item2.js +315 -0
- package/dist/components/solution-organization-variables.d.ts +11 -0
- package/dist/components/solution-organization-variables.js +11 -0
- package/dist/components/solution-organization-variables2.js +132 -0
- package/dist/components/solution-resource-item.d.ts +11 -0
- package/dist/components/solution-resource-item.js +11 -0
- package/dist/components/solution-resource-item2.js +356 -0
- package/dist/components/solution-spatial-ref.d.ts +11 -0
- package/dist/components/solution-spatial-ref.js +11 -0
- package/dist/components/solution-spatial-ref2.js +21446 -0
- package/dist/components/solution-store.js +4092 -0
- package/dist/components/solution-template-data.d.ts +11 -0
- package/dist/components/solution-template-data.js +11 -0
- package/dist/components/solution-template-data2.js +233 -0
- package/dist/components/solution-variables.d.ts +11 -0
- package/dist/components/solution-variables.js +11 -0
- package/dist/components/solution-variables2.js +150 -0
- package/dist/components/sortable.esm.js +3026 -0
- package/dist/components/split-button.js +165 -0
- package/dist/components/store-manager.d.ts +11 -0
- package/dist/components/store-manager.js +83 -0
- package/dist/components/switch.js +139 -0
- package/dist/components/tab-nav.js +241 -0
- package/dist/components/tab-title.js +276 -0
- package/dist/components/tab.js +154 -0
- package/dist/components/tabs.js +188 -0
- package/dist/components/tile.js +129 -0
- package/dist/components/time-picker.js +943 -0
- package/dist/components/tooltip.js +399 -0
- package/dist/components/tree-item.js +294 -0
- package/dist/components/tree.js +327 -0
- package/dist/components/utils.js +119 -0
- package/dist/components/utils2.js +51 -0
- package/dist/components/value-list-item.js +204 -0
- package/dist/components/value-list.js +333 -0
- package/dist/esm/deduct-calculator.entry.js +1 -1
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/{pciUtils-e3007a1c.js → pciUtils-ecda46e5.js} +25 -7
- package/dist/solutions-components/demos/deduct-calculator.html +2 -5
- package/dist/solutions-components/demos/new-public-notification.html +6 -4
- package/dist/solutions-components/{p-ff80ffbb.entry.js → p-0512635b.entry.js} +1 -1
- package/dist/solutions-components/{p-5ec407c2.entry.js → p-0c088725.entry.js} +1 -1
- package/dist/solutions-components/p-cc815aca.js +21 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/pciUtils.ts +30 -7
- package/dist/types/utils/pciUtils.d.ts +2 -1
- package/package.json +4 -3
- package/dist/solutions-components/p-647bbd18.js +0 -21
@@ -0,0 +1,575 @@
|
|
1
|
+
/*!
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
* Licensed under the Apache License, Version 2.0
|
4
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
+
*/
|
6
|
+
import { getAssetPath, proxyCustomElement, HTMLElement, createEvent, h, Host, Build } from '@stencil/core/internal/client';
|
7
|
+
import { g as getSupportedLocale, c as connectLocalized, d as disconnectLocalized, n as numberStringFormatter } from './locale2.js';
|
8
|
+
import { a as dateFromISO, g as getDaysDiff, d as dateToISO, b as dateFromRange, s as setEndOfDay } from './date.js';
|
9
|
+
import { d as defineCustomElement$4 } from './date-picker-day.js';
|
10
|
+
import { d as defineCustomElement$3 } from './date-picker-month.js';
|
11
|
+
import { d as defineCustomElement$2 } from './date-picker-month-header.js';
|
12
|
+
import { d as defineCustomElement$1 } from './icon.js';
|
13
|
+
|
14
|
+
/*!
|
15
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
16
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
17
|
+
* v1.0.0-beta.97
|
18
|
+
*/
|
19
|
+
/**
|
20
|
+
* CLDR cache.
|
21
|
+
* Exported for testing purposes.
|
22
|
+
*
|
23
|
+
* @private
|
24
|
+
*/
|
25
|
+
const translationCache = {};
|
26
|
+
/**
|
27
|
+
* CLDR request cache.
|
28
|
+
* Exported for testing purposes.
|
29
|
+
*
|
30
|
+
* @private
|
31
|
+
*/
|
32
|
+
const requestCache = {};
|
33
|
+
/**
|
34
|
+
* Fetch calendar data for a given locale from list of supported languages
|
35
|
+
*
|
36
|
+
* @param lang
|
37
|
+
* @public
|
38
|
+
*/
|
39
|
+
async function getLocaleData(lang) {
|
40
|
+
const locale = getSupportedLocale(lang);
|
41
|
+
if (translationCache[locale]) {
|
42
|
+
return translationCache[locale];
|
43
|
+
}
|
44
|
+
if (!requestCache[locale]) {
|
45
|
+
requestCache[locale] = fetch(getAssetPath(`./assets/date-picker/nls/${locale}.json`))
|
46
|
+
.then((resp) => resp.json())
|
47
|
+
.catch(() => {
|
48
|
+
console.error(`Translations for "${locale}" not found or invalid, falling back to english`);
|
49
|
+
return getLocaleData("en");
|
50
|
+
});
|
51
|
+
}
|
52
|
+
const data = await requestCache[locale];
|
53
|
+
translationCache[locale] = data;
|
54
|
+
return data;
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Maps value to valueAsDate
|
58
|
+
*
|
59
|
+
* @param value
|
60
|
+
*/
|
61
|
+
function getValueAsDateRange(value) {
|
62
|
+
return value.map((v, index) => dateFromISO(v, index === 1));
|
63
|
+
}
|
64
|
+
|
65
|
+
/*!
|
66
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
67
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
68
|
+
* v1.0.0-beta.97
|
69
|
+
*/
|
70
|
+
const HEADING_LEVEL = 2;
|
71
|
+
const TEXT = {
|
72
|
+
nextMonth: "Next month",
|
73
|
+
prevMonth: "Previous month",
|
74
|
+
year: "Year"
|
75
|
+
};
|
76
|
+
|
77
|
+
const datePickerCss = "@keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in-down{0%{opacity:0;transform:translate3D(0, -5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;transform:translate3D(0, 5px, 0)}100%{opacity:1;transform:translate3D(0, 0, 0)}}@keyframes in-scale{0%{opacity:0;transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;animation-fill-mode:both;animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{animation-name:in}.calcite-animate__in-down{animation-name:in-down}.calcite-animate__in-up{animation-name:in-up}.calcite-animate__in-scale{animation-name:in-scale}@media (prefers-reduced-motion: reduce){:root{--calcite-internal-duration-factor:0.01}}:root{--calcite-floating-ui-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{position:relative;display:inline-block;inline-size:100%;overflow:visible;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2);background-color:var(--calcite-ui-foreground-1);vertical-align:top}:host([scale=s]){max-inline-size:216px}:host([scale=m]){max-inline-size:286px}:host([scale=l]){max-inline-size:398px}";
|
78
|
+
|
79
|
+
const DatePicker = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
80
|
+
constructor() {
|
81
|
+
super();
|
82
|
+
this.__registerHost();
|
83
|
+
this.__attachShadow();
|
84
|
+
this.calciteDatePickerChange = createEvent(this, "calciteDatePickerChange", 6);
|
85
|
+
this.calciteDatePickerRangeChange = createEvent(this, "calciteDatePickerRangeChange", 6);
|
86
|
+
/**
|
87
|
+
* Localized string for "previous month" (used for aria label)
|
88
|
+
*
|
89
|
+
* @default "Previous month"
|
90
|
+
*/
|
91
|
+
this.intlPrevMonth = TEXT.prevMonth;
|
92
|
+
/**
|
93
|
+
* Localized string for "next month" (used for aria label)
|
94
|
+
*
|
95
|
+
* @default "Next month"
|
96
|
+
*/
|
97
|
+
this.intlNextMonth = TEXT.nextMonth;
|
98
|
+
/**
|
99
|
+
* Localized string for "year" (used for aria label)
|
100
|
+
*
|
101
|
+
* @default "Year"
|
102
|
+
*/
|
103
|
+
this.intlYear = TEXT.year;
|
104
|
+
/** specify the scale of the date picker */
|
105
|
+
this.scale = "m";
|
106
|
+
/** Range mode activation */
|
107
|
+
this.range = false;
|
108
|
+
/** Disables the default behaviour on the third click of narrowing or extending the range and instead starts a new range. */
|
109
|
+
this.proximitySelectionDisabled = false;
|
110
|
+
this.globalAttributes = {};
|
111
|
+
//--------------------------------------------------------------------------
|
112
|
+
//
|
113
|
+
// Private State/Props
|
114
|
+
//
|
115
|
+
//--------------------------------------------------------------------------
|
116
|
+
this.effectiveLocale = "";
|
117
|
+
//--------------------------------------------------------------------------
|
118
|
+
//
|
119
|
+
// Private Methods
|
120
|
+
//
|
121
|
+
//--------------------------------------------------------------------------
|
122
|
+
this.keyDownHandler = (event) => {
|
123
|
+
if (event.key === "Escape") {
|
124
|
+
this.reset();
|
125
|
+
}
|
126
|
+
};
|
127
|
+
this.monthHeaderSelectChange = (event) => {
|
128
|
+
const date = new Date(event.detail);
|
129
|
+
if (!this.range) {
|
130
|
+
this.activeDate = date;
|
131
|
+
}
|
132
|
+
else {
|
133
|
+
if (this.activeRange === "end") {
|
134
|
+
this.activeEndDate = date;
|
135
|
+
}
|
136
|
+
else {
|
137
|
+
this.activeStartDate = date;
|
138
|
+
}
|
139
|
+
this.mostRecentRangeValue = date;
|
140
|
+
}
|
141
|
+
};
|
142
|
+
this.monthActiveDateChange = (event) => {
|
143
|
+
const date = new Date(event.detail);
|
144
|
+
if (!this.range) {
|
145
|
+
this.activeDate = date;
|
146
|
+
}
|
147
|
+
else {
|
148
|
+
if (this.activeRange === "end") {
|
149
|
+
this.activeEndDate = date;
|
150
|
+
}
|
151
|
+
else {
|
152
|
+
this.activeStartDate = date;
|
153
|
+
}
|
154
|
+
this.mostRecentRangeValue = date;
|
155
|
+
}
|
156
|
+
};
|
157
|
+
this.monthHoverChange = (event) => {
|
158
|
+
if (!this.startAsDate) {
|
159
|
+
this.hoverRange = undefined;
|
160
|
+
return;
|
161
|
+
}
|
162
|
+
const date = new Date(event.detail);
|
163
|
+
this.hoverRange = {
|
164
|
+
focused: this.activeRange || "start",
|
165
|
+
start: this.startAsDate,
|
166
|
+
end: this.endAsDate
|
167
|
+
};
|
168
|
+
if (!this.proximitySelectionDisabled) {
|
169
|
+
if (this.endAsDate) {
|
170
|
+
const startDiff = getDaysDiff(date, this.startAsDate);
|
171
|
+
const endDiff = getDaysDiff(date, this.endAsDate);
|
172
|
+
if (endDiff > 0) {
|
173
|
+
this.hoverRange.end = date;
|
174
|
+
this.hoverRange.focused = "end";
|
175
|
+
}
|
176
|
+
else if (startDiff < 0) {
|
177
|
+
this.hoverRange.start = date;
|
178
|
+
this.hoverRange.focused = "start";
|
179
|
+
}
|
180
|
+
else if (startDiff > endDiff) {
|
181
|
+
this.hoverRange.start = date;
|
182
|
+
this.hoverRange.focused = "start";
|
183
|
+
}
|
184
|
+
else {
|
185
|
+
this.hoverRange.end = date;
|
186
|
+
this.hoverRange.focused = "end";
|
187
|
+
}
|
188
|
+
}
|
189
|
+
else {
|
190
|
+
if (date < this.startAsDate) {
|
191
|
+
this.hoverRange = {
|
192
|
+
focused: "start",
|
193
|
+
start: date,
|
194
|
+
end: this.startAsDate
|
195
|
+
};
|
196
|
+
}
|
197
|
+
else {
|
198
|
+
this.hoverRange.end = date;
|
199
|
+
this.hoverRange.focused = "end";
|
200
|
+
}
|
201
|
+
}
|
202
|
+
}
|
203
|
+
else {
|
204
|
+
if (!this.endAsDate) {
|
205
|
+
if (date < this.startAsDate) {
|
206
|
+
this.hoverRange = {
|
207
|
+
focused: "start",
|
208
|
+
start: date,
|
209
|
+
end: this.startAsDate
|
210
|
+
};
|
211
|
+
}
|
212
|
+
else {
|
213
|
+
this.hoverRange.end = date;
|
214
|
+
this.hoverRange.focused = "end";
|
215
|
+
}
|
216
|
+
}
|
217
|
+
else {
|
218
|
+
this.hoverRange = undefined;
|
219
|
+
}
|
220
|
+
}
|
221
|
+
event.stopPropagation();
|
222
|
+
};
|
223
|
+
this.monthMouseOutChange = () => {
|
224
|
+
if (this.hoverRange) {
|
225
|
+
this.hoverRange = undefined;
|
226
|
+
}
|
227
|
+
};
|
228
|
+
/**
|
229
|
+
* Reset active date and close
|
230
|
+
*/
|
231
|
+
this.reset = () => {
|
232
|
+
var _a, _b, _c, _d, _e, _f;
|
233
|
+
if (!Array.isArray(this.valueAsDate) &&
|
234
|
+
this.valueAsDate &&
|
235
|
+
((_a = this.valueAsDate) === null || _a === void 0 ? void 0 : _a.getTime()) !== ((_b = this.activeDate) === null || _b === void 0 ? void 0 : _b.getTime())) {
|
236
|
+
this.activeDate = new Date(this.valueAsDate);
|
237
|
+
}
|
238
|
+
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())) {
|
239
|
+
this.activeStartDate = new Date(this.startAsDate);
|
240
|
+
}
|
241
|
+
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())) {
|
242
|
+
this.activeEndDate = new Date(this.endAsDate);
|
243
|
+
}
|
244
|
+
};
|
245
|
+
/**
|
246
|
+
* Event handler for when the selected date changes
|
247
|
+
*
|
248
|
+
* @param event
|
249
|
+
*/
|
250
|
+
this.monthDateChange = (event) => {
|
251
|
+
const date = new Date(event.detail);
|
252
|
+
if (!this.range) {
|
253
|
+
this.value = date ? dateToISO(date) : "";
|
254
|
+
this.valueAsDate = date || null;
|
255
|
+
this.activeDate = date || null;
|
256
|
+
this.calciteDatePickerChange.emit(date);
|
257
|
+
return;
|
258
|
+
}
|
259
|
+
if (!this.startAsDate || (!this.endAsDate && date < this.startAsDate)) {
|
260
|
+
if (this.startAsDate) {
|
261
|
+
this.setEndDate(new Date(this.startAsDate));
|
262
|
+
}
|
263
|
+
if (this.activeRange == "end") {
|
264
|
+
this.setEndDate(date);
|
265
|
+
}
|
266
|
+
else {
|
267
|
+
this.setStartDate(date);
|
268
|
+
}
|
269
|
+
}
|
270
|
+
else if (!this.endAsDate) {
|
271
|
+
this.setEndDate(date);
|
272
|
+
}
|
273
|
+
else {
|
274
|
+
if (!this.proximitySelectionDisabled) {
|
275
|
+
if (this.activeRange) {
|
276
|
+
if (this.activeRange == "end") {
|
277
|
+
this.setEndDate(date);
|
278
|
+
}
|
279
|
+
else {
|
280
|
+
this.setStartDate(date);
|
281
|
+
}
|
282
|
+
}
|
283
|
+
else {
|
284
|
+
const startDiff = getDaysDiff(date, this.startAsDate);
|
285
|
+
const endDiff = getDaysDiff(date, this.endAsDate);
|
286
|
+
if (endDiff === 0 || startDiff < 0) {
|
287
|
+
this.setStartDate(date);
|
288
|
+
}
|
289
|
+
else if (startDiff === 0 || endDiff < 0) {
|
290
|
+
this.setEndDate(date);
|
291
|
+
}
|
292
|
+
else if (startDiff < endDiff) {
|
293
|
+
this.setStartDate(date);
|
294
|
+
}
|
295
|
+
else {
|
296
|
+
this.setEndDate(date);
|
297
|
+
}
|
298
|
+
}
|
299
|
+
}
|
300
|
+
else {
|
301
|
+
this.setStartDate(date);
|
302
|
+
this.endAsDate = this.activeEndDate = this.end = undefined;
|
303
|
+
}
|
304
|
+
}
|
305
|
+
this.calciteDatePickerChange.emit(date);
|
306
|
+
};
|
307
|
+
}
|
308
|
+
handleValueAsDate(date) {
|
309
|
+
if (!Array.isArray(date) && date && date !== this.activeDate) {
|
310
|
+
this.activeDate = date;
|
311
|
+
}
|
312
|
+
}
|
313
|
+
handleRangeChange() {
|
314
|
+
const { startAsDate: startDate, endAsDate: endDate } = this;
|
315
|
+
this.activeEndDate = endDate;
|
316
|
+
this.activeStartDate = startDate;
|
317
|
+
}
|
318
|
+
onMinChanged(min) {
|
319
|
+
if (min) {
|
320
|
+
this.minAsDate = dateFromISO(min);
|
321
|
+
}
|
322
|
+
}
|
323
|
+
onMaxChanged(max) {
|
324
|
+
if (max) {
|
325
|
+
this.maxAsDate = dateFromISO(max);
|
326
|
+
}
|
327
|
+
}
|
328
|
+
// --------------------------------------------------------------------------
|
329
|
+
//
|
330
|
+
// Lifecycle
|
331
|
+
//
|
332
|
+
// --------------------------------------------------------------------------
|
333
|
+
connectedCallback() {
|
334
|
+
connectLocalized(this);
|
335
|
+
if (Array.isArray(this.value)) {
|
336
|
+
this.valueAsDate = getValueAsDateRange(this.value);
|
337
|
+
this.start = this.value[0];
|
338
|
+
this.end = this.value[1];
|
339
|
+
}
|
340
|
+
else if (this.value) {
|
341
|
+
this.valueAsDate = dateFromISO(this.value);
|
342
|
+
}
|
343
|
+
if (this.start) {
|
344
|
+
this.setStartAsDate(dateFromISO(this.start));
|
345
|
+
}
|
346
|
+
if (this.end) {
|
347
|
+
this.setEndAsDate(dateFromISO(this.end));
|
348
|
+
}
|
349
|
+
if (this.min) {
|
350
|
+
this.minAsDate = dateFromISO(this.min);
|
351
|
+
}
|
352
|
+
if (this.max) {
|
353
|
+
this.maxAsDate = dateFromISO(this.max);
|
354
|
+
}
|
355
|
+
}
|
356
|
+
disconnectedCallback() {
|
357
|
+
disconnectLocalized(this);
|
358
|
+
}
|
359
|
+
async componentWillLoad() {
|
360
|
+
await this.loadLocaleData();
|
361
|
+
this.onMinChanged(this.min);
|
362
|
+
this.onMaxChanged(this.max);
|
363
|
+
}
|
364
|
+
render() {
|
365
|
+
var _a;
|
366
|
+
const date = dateFromRange(this.range ? this.startAsDate : this.valueAsDate, this.minAsDate, this.maxAsDate);
|
367
|
+
const activeStartDate = this.range
|
368
|
+
? this.getActiveStartDate(date, this.minAsDate, this.maxAsDate)
|
369
|
+
: this.getActiveDate(date, this.minAsDate, this.maxAsDate);
|
370
|
+
let activeDate = activeStartDate;
|
371
|
+
const endDate = this.range
|
372
|
+
? dateFromRange(this.endAsDate, this.minAsDate, this.maxAsDate)
|
373
|
+
: null;
|
374
|
+
const activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
|
375
|
+
if ((this.activeRange === "end" ||
|
376
|
+
(((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "end" && (!this.proximitySelectionDisabled || endDate))) &&
|
377
|
+
activeEndDate) {
|
378
|
+
activeDate = activeEndDate;
|
379
|
+
}
|
380
|
+
if (this.range && this.mostRecentRangeValue) {
|
381
|
+
activeDate = this.mostRecentRangeValue;
|
382
|
+
}
|
383
|
+
const minDate = this.range && this.activeRange
|
384
|
+
? this.activeRange === "start"
|
385
|
+
? this.minAsDate
|
386
|
+
: date || this.minAsDate
|
387
|
+
: this.minAsDate;
|
388
|
+
const maxDate = this.range && this.activeRange
|
389
|
+
? this.activeRange === "start"
|
390
|
+
? endDate || this.maxAsDate
|
391
|
+
: this.maxAsDate
|
392
|
+
: this.maxAsDate;
|
393
|
+
return (h(Host, { onBlur: this.reset, onKeyDown: this.keyDownHandler, role: "application" }, this.renderCalendar(activeDate, maxDate, minDate, date, endDate)));
|
394
|
+
}
|
395
|
+
valueHandler(value) {
|
396
|
+
if (Array.isArray(value)) {
|
397
|
+
this.valueAsDate = getValueAsDateRange(value);
|
398
|
+
this.start = value[0];
|
399
|
+
this.end = value[1];
|
400
|
+
}
|
401
|
+
else if (value) {
|
402
|
+
this.valueAsDate = dateFromISO(value);
|
403
|
+
this.start = "";
|
404
|
+
this.end = "";
|
405
|
+
}
|
406
|
+
}
|
407
|
+
startWatcher(start) {
|
408
|
+
this.setStartAsDate(dateFromISO(start));
|
409
|
+
}
|
410
|
+
endWatcher(end) {
|
411
|
+
this.setEndAsDate(dateFromISO(end));
|
412
|
+
}
|
413
|
+
async loadLocaleData() {
|
414
|
+
if (!Build.isBrowser) {
|
415
|
+
return;
|
416
|
+
}
|
417
|
+
numberStringFormatter.numberFormatOptions = {
|
418
|
+
numberingSystem: this.numberingSystem,
|
419
|
+
locale: this.effectiveLocale,
|
420
|
+
useGrouping: false
|
421
|
+
};
|
422
|
+
this.localeData = await getLocaleData(this.effectiveLocale);
|
423
|
+
}
|
424
|
+
/**
|
425
|
+
* Render calcite-date-picker-month-header and calcite-date-picker-month
|
426
|
+
*
|
427
|
+
* @param activeDate
|
428
|
+
* @param maxDate
|
429
|
+
* @param minDate
|
430
|
+
* @param date
|
431
|
+
* @param endDate
|
432
|
+
*/
|
433
|
+
renderCalendar(activeDate, maxDate, minDate, date, endDate) {
|
434
|
+
return (this.localeData && [
|
435
|
+
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() }),
|
436
|
+
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, onCalciteDatePickerSelect: this.monthDateChange, onCalciteInternalDatePickerHover: this.monthHoverChange, onCalciteInternalDatePickerMouseOut: this.monthMouseOutChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date, startDate: this.range ? date : undefined })
|
437
|
+
]);
|
438
|
+
}
|
439
|
+
/**
|
440
|
+
* Update date instance of start if valid
|
441
|
+
*
|
442
|
+
* @param startDate
|
443
|
+
* @param emit
|
444
|
+
*/
|
445
|
+
setStartAsDate(startDate, emit) {
|
446
|
+
this.startAsDate = startDate;
|
447
|
+
this.mostRecentRangeValue = this.startAsDate;
|
448
|
+
if (emit) {
|
449
|
+
this.calciteDatePickerRangeChange.emit({
|
450
|
+
startDate,
|
451
|
+
endDate: this.endAsDate
|
452
|
+
});
|
453
|
+
}
|
454
|
+
}
|
455
|
+
/**
|
456
|
+
* Update date instance of end if valid
|
457
|
+
*
|
458
|
+
* @param endDate
|
459
|
+
* @param emit
|
460
|
+
*/
|
461
|
+
setEndAsDate(endDate, emit) {
|
462
|
+
this.endAsDate = endDate ? setEndOfDay(endDate) : endDate;
|
463
|
+
this.mostRecentRangeValue = this.endAsDate;
|
464
|
+
if (emit) {
|
465
|
+
this.calciteDatePickerRangeChange.emit({
|
466
|
+
startDate: this.startAsDate,
|
467
|
+
endDate
|
468
|
+
});
|
469
|
+
}
|
470
|
+
}
|
471
|
+
setEndDate(date) {
|
472
|
+
this.end = date ? dateToISO(date) : "";
|
473
|
+
this.setEndAsDate(date, true);
|
474
|
+
this.activeEndDate = date || null;
|
475
|
+
}
|
476
|
+
setStartDate(date) {
|
477
|
+
this.start = date ? dateToISO(date) : "";
|
478
|
+
this.setStartAsDate(date, true);
|
479
|
+
this.activeStartDate = date || null;
|
480
|
+
}
|
481
|
+
/**
|
482
|
+
* Get an active date using the value, or current date as default
|
483
|
+
*
|
484
|
+
* @param value
|
485
|
+
* @param min
|
486
|
+
* @param max
|
487
|
+
*/
|
488
|
+
getActiveDate(value, min, max) {
|
489
|
+
return dateFromRange(this.activeDate, min, max) || value || dateFromRange(new Date(), min, max);
|
490
|
+
}
|
491
|
+
getActiveStartDate(value, min, max) {
|
492
|
+
return (dateFromRange(this.activeStartDate, min, max) || value || dateFromRange(new Date(), min, max));
|
493
|
+
}
|
494
|
+
getActiveEndDate(value, min, max) {
|
495
|
+
return (dateFromRange(this.activeEndDate, min, max) || value || dateFromRange(new Date(), min, max));
|
496
|
+
}
|
497
|
+
static get assetsDirs() { return ["assets"]; }
|
498
|
+
get el() { return this; }
|
499
|
+
static get watchers() { return {
|
500
|
+
"valueAsDate": ["handleValueAsDate"],
|
501
|
+
"startAsDate": ["handleRangeChange"],
|
502
|
+
"endAsDate": ["handleRangeChange"],
|
503
|
+
"min": ["onMinChanged"],
|
504
|
+
"max": ["onMaxChanged"],
|
505
|
+
"value": ["valueHandler"],
|
506
|
+
"start": ["startWatcher"],
|
507
|
+
"end": ["endWatcher"],
|
508
|
+
"effectiveLocale": ["loadLocaleData"]
|
509
|
+
}; }
|
510
|
+
static get style() { return datePickerCss; }
|
511
|
+
}, [1, "calcite-date-picker", {
|
512
|
+
"activeRange": [513, "active-range"],
|
513
|
+
"value": [1025],
|
514
|
+
"headingLevel": [514, "heading-level"],
|
515
|
+
"valueAsDate": [1040],
|
516
|
+
"startAsDate": [1040],
|
517
|
+
"endAsDate": [1040],
|
518
|
+
"minAsDate": [1040],
|
519
|
+
"maxAsDate": [1040],
|
520
|
+
"min": [1537],
|
521
|
+
"max": [1537],
|
522
|
+
"intlPrevMonth": [1, "intl-prev-month"],
|
523
|
+
"intlNextMonth": [1, "intl-next-month"],
|
524
|
+
"intlYear": [1, "intl-year"],
|
525
|
+
"locale": [1],
|
526
|
+
"numberingSystem": [513, "numbering-system"],
|
527
|
+
"scale": [513],
|
528
|
+
"range": [516],
|
529
|
+
"start": [1537],
|
530
|
+
"end": [1537],
|
531
|
+
"proximitySelectionDisabled": [516, "proximity-selection-disabled"],
|
532
|
+
"activeDate": [32],
|
533
|
+
"activeStartDate": [32],
|
534
|
+
"activeEndDate": [32],
|
535
|
+
"globalAttributes": [32],
|
536
|
+
"effectiveLocale": [32],
|
537
|
+
"localeData": [32],
|
538
|
+
"hoverRange": [32]
|
539
|
+
}]);
|
540
|
+
function defineCustomElement() {
|
541
|
+
if (typeof customElements === "undefined") {
|
542
|
+
return;
|
543
|
+
}
|
544
|
+
const components = ["calcite-date-picker", "calcite-date-picker-day", "calcite-date-picker-month", "calcite-date-picker-month-header", "calcite-icon"];
|
545
|
+
components.forEach(tagName => { switch (tagName) {
|
546
|
+
case "calcite-date-picker":
|
547
|
+
if (!customElements.get(tagName)) {
|
548
|
+
customElements.define(tagName, DatePicker);
|
549
|
+
}
|
550
|
+
break;
|
551
|
+
case "calcite-date-picker-day":
|
552
|
+
if (!customElements.get(tagName)) {
|
553
|
+
defineCustomElement$4();
|
554
|
+
}
|
555
|
+
break;
|
556
|
+
case "calcite-date-picker-month":
|
557
|
+
if (!customElements.get(tagName)) {
|
558
|
+
defineCustomElement$3();
|
559
|
+
}
|
560
|
+
break;
|
561
|
+
case "calcite-date-picker-month-header":
|
562
|
+
if (!customElements.get(tagName)) {
|
563
|
+
defineCustomElement$2();
|
564
|
+
}
|
565
|
+
break;
|
566
|
+
case "calcite-icon":
|
567
|
+
if (!customElements.get(tagName)) {
|
568
|
+
defineCustomElement$1();
|
569
|
+
}
|
570
|
+
break;
|
571
|
+
} });
|
572
|
+
}
|
573
|
+
defineCustomElement();
|
574
|
+
|
575
|
+
export { DatePicker as D, TEXT as T, getLocaleData as a, defineCustomElement as d, getValueAsDateRange as g };
|