@esri/solutions-components 0.8.7 → 0.8.9
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/cjs/{calcite-action-menu_2.cjs.entry.js → calcite-action-menu_3.cjs.entry.js} +114 -7
- package/dist/cjs/calcite-alert_4.cjs.entry.js +46 -5
- package/dist/cjs/{calcite-input-date-picker_3.cjs.entry.js → calcite-block_5.cjs.entry.js} +691 -13
- package/dist/cjs/{calcite-combobox_5.cjs.entry.js → calcite-combobox_3.cjs.entry.js} +876 -844
- package/dist/cjs/calcite-dropdown_4.cjs.entry.js +1023 -0
- package/dist/cjs/{calcite-flow_5.cjs.entry.js → calcite-flow_6.cjs.entry.js} +327 -2
- package/dist/cjs/card-manager_3.cjs.entry.js +5 -5
- package/dist/cjs/crowdsource-manager.cjs.entry.js +5 -1
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +122 -23
- package/dist/cjs/{downloadUtils-8b05d7cc.js → downloadUtils-dc349b1a.js} +2 -2
- package/dist/cjs/{index.es-e7587227.js → index.es-1830a1e6.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +8 -8
- package/dist/cjs/{mapViewUtils-3e0fa457.js → mapViewUtils-9dc05308.js} +11 -5
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/create-feature/create-feature.js +18 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +72 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +16 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +155 -71
- package/dist/collection/components/feature-details/feature-details.css +18 -0
- package/dist/collection/components/feature-details/feature-details.js +500 -0
- package/dist/collection/components/feature-details/test/feature-details.e2e.js +14 -0
- package/dist/collection/components/feature-details/test/feature-details.spec.js +22 -0
- package/dist/collection/components/feature-list/feature-list.js +14 -1
- package/dist/collection/components/info-card/info-card.css +15 -5
- package/dist/collection/components/info-card/info-card.js +178 -5
- package/dist/collection/components/layer-table/layer-table.js +2 -2
- package/dist/collection/components/map-card/map-card.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +5 -5
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/demos/crowdsource-reporter.html +115 -1
- package/dist/collection/utils/interfaces.ts +4 -4
- package/dist/collection/utils/mapViewUtils.js +11 -5
- package/dist/collection/utils/mapViewUtils.ts +13 -5
- package/dist/components/create-feature2.js +4 -0
- package/dist/components/crowdsource-manager.js +8 -0
- package/dist/components/crowdsource-reporter.js +270 -85
- package/dist/components/feature-details.d.ts +11 -0
- package/dist/components/feature-details.js +11 -0
- package/dist/components/feature-details2.js +449 -0
- package/dist/components/feature-list2.js +14 -1
- package/dist/components/info-card2.js +53 -5
- package/dist/components/layer-table2.js +2 -2
- package/dist/components/map-card2.js +1 -1
- package/dist/components/map-select-tools2.js +5 -5
- package/dist/components/mapViewUtils.js +11 -5
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/{calcite-action-menu_2.entry.js → calcite-action-menu_3.entry.js} +118 -12
- package/dist/esm/calcite-alert_4.entry.js +46 -5
- package/dist/esm/{calcite-input-date-picker_3.entry.js → calcite-block_5.entry.js} +688 -12
- package/dist/esm/{calcite-combobox_5.entry.js → calcite-combobox_3.entry.js} +878 -844
- package/dist/esm/calcite-date-picker-day_3.entry.js +1 -1
- package/dist/esm/calcite-dropdown_4.entry.js +1016 -0
- package/dist/esm/{calcite-flow_5.entry.js → calcite-flow_6.entry.js} +327 -3
- package/dist/esm/card-manager_3.entry.js +5 -5
- package/dist/esm/crowdsource-manager.entry.js +5 -1
- package/dist/esm/crowdsource-reporter.entry.js +122 -23
- package/dist/esm/{date-5630530d.js → date-0c026a8b.js} +1 -1
- package/dist/esm/{downloadUtils-0c1e4d7b.js → downloadUtils-df4f21f6.js} +2 -2
- package/dist/esm/{index.es-286e3cfa.js → index.es-904fb846.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +8 -8
- package/dist/esm/{mapViewUtils-253178f1.js → mapViewUtils-2ec19fb0.js} +11 -5
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +115 -1
- package/dist/solutions-components/{p-813fd8a4.entry.js → p-29f518fd.entry.js} +2 -2
- package/dist/solutions-components/p-452fd697.entry.js +6 -0
- package/dist/solutions-components/p-511b1c91.entry.js +23 -0
- package/dist/solutions-components/p-577efb16.js +36 -0
- package/dist/solutions-components/{p-94de9279.js → p-5817d78c.js} +1 -1
- package/dist/solutions-components/p-602cd811.entry.js +17 -0
- package/dist/solutions-components/{p-15f9624a.entry.js → p-6557b703.entry.js} +1 -1
- package/dist/solutions-components/p-7269c49b.entry.js +6 -0
- package/dist/solutions-components/p-760bd17e.entry.js +6 -0
- package/dist/solutions-components/p-95fea07a.entry.js +17 -0
- package/dist/solutions-components/{p-212b02e7.js → p-ae4d86e8.js} +1 -1
- package/dist/solutions-components/{p-038fcd93.entry.js → p-c273ab7a.entry.js} +1 -1
- package/dist/solutions-components/p-d742b915.entry.js +29 -0
- package/dist/solutions-components/p-dfad61a8.entry.js +24 -0
- package/dist/solutions-components/{p-331b5d1e.js → p-fca434c8.js} +2 -2
- package/dist/solutions-components/p-fd82a00f.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +4 -4
- package/dist/solutions-components/utils/mapViewUtils.ts +13 -5
- package/dist/types/components/create-feature/create-feature.d.ts +4 -4
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +16 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +91 -18
- package/dist/types/components/feature-details/feature-details.d.ts +151 -0
- package/dist/types/components/feature-list/feature-list.d.ts +6 -0
- package/dist/types/components/info-card/info-card.d.ts +33 -1
- package/dist/types/components.d.ts +161 -28
- package/dist/types/preact.d.ts +6 -1
- package/dist/types/utils/interfaces.d.ts +4 -4
- package/dist/types/utils/mapViewUtils.d.ts +5 -3
- package/package.json +1 -1
- package/dist/cjs/calcite-block_2.cjs.entry.js +0 -652
- package/dist/cjs/calcite-graph_2.cjs.entry.js +0 -1055
- package/dist/cjs/calcite-scrim.cjs.entry.js +0 -125
- package/dist/cjs/utils-7bc7f595.js +0 -64
- package/dist/esm/calcite-block_2.entry.js +0 -647
- package/dist/esm/calcite-graph_2.entry.js +0 -1050
- package/dist/esm/calcite-scrim.entry.js +0 -121
- package/dist/esm/utils-9fb4104a.js +0 -61
- package/dist/solutions-components/p-04c37d69.entry.js +0 -17
- package/dist/solutions-components/p-0b92e4b1.entry.js +0 -11
- package/dist/solutions-components/p-238d3b5f.entry.js +0 -6
- package/dist/solutions-components/p-3af79063.js +0 -36
- package/dist/solutions-components/p-6db185bf.entry.js +0 -6
- package/dist/solutions-components/p-80b11ec1.entry.js +0 -17
- package/dist/solutions-components/p-aec06ce4.entry.js +0 -18
- package/dist/solutions-components/p-bfdf89c2.js +0 -11
- package/dist/solutions-components/p-c4ff3b52.entry.js +0 -17
- package/dist/solutions-components/p-ced067bd.entry.js +0 -17
- package/dist/solutions-components/p-d136eab0.entry.js +0 -23
- package/dist/solutions-components/p-e0446d5b.entry.js +0 -6
- package/dist/solutions-components/p-e8f13354.entry.js +0 -6
@@ -8,18 +8,19 @@
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
9
9
|
|
10
10
|
const index = require('./index-105cf2b9.js');
|
11
|
-
const
|
11
|
+
const conditionalSlot = require('./conditionalSlot-9d7b60d1.js');
|
12
12
|
const dom = require('./dom-c9c2c835.js');
|
13
|
+
const interactive = require('./interactive-3ab7044d.js');
|
14
|
+
const locale = require('./locale-d237c9d5.js');
|
15
|
+
const t9n = require('./t9n-993a84de.js');
|
16
|
+
const Heading = require('./Heading-bd401e0a.js');
|
17
|
+
const loadable = require('./loadable-5a794992.js');
|
18
|
+
const openCloseComponent = require('./openCloseComponent-19a769d0.js');
|
19
|
+
const date = require('./date-9de4dd6f.js');
|
13
20
|
const floatingUi = require('./floating-ui-984cc970.js');
|
14
21
|
const form = require('./form-fed676d6.js');
|
15
|
-
const interactive = require('./interactive-3ab7044d.js');
|
16
22
|
const key = require('./key-c5504030.js');
|
17
23
|
const label = require('./label-32573e1d.js');
|
18
|
-
const loadable = require('./loadable-5a794992.js');
|
19
|
-
const locale = require('./locale-d237c9d5.js');
|
20
|
-
const openCloseComponent = require('./openCloseComponent-19a769d0.js');
|
21
|
-
const utils = require('./utils-7bc7f595.js');
|
22
|
-
const t9n = require('./t9n-993a84de.js');
|
23
24
|
const focusTrapComponent = require('./focusTrapComponent-faae7d7e.js');
|
24
25
|
const guid = require('./guid-ae73cd27.js');
|
25
26
|
const component = require('./component-ac7c3bd8.js');
|
@@ -27,14 +28,689 @@ const Validation = require('./Validation-b02c6710.js');
|
|
27
28
|
const loadModules = require('./loadModules-01306709.js');
|
28
29
|
const locale$1 = require('./locale-4cef466e.js');
|
29
30
|
const mode = require('./mode-d6c12b38.js');
|
31
|
+
require('./observers-db4527e4.js');
|
30
32
|
require('./resources-9447c777.js');
|
31
|
-
require('./debounce-30afab47.js');
|
32
33
|
require('./browser-d08a5f99.js');
|
33
|
-
require('./
|
34
|
+
require('./debounce-30afab47.js');
|
34
35
|
require('./esri-loader-ce6c3d3d.js');
|
35
36
|
require('./_commonjsHelpers-480c2e77.js');
|
36
37
|
require('./languageUtil-0df39c0c.js');
|
37
38
|
|
39
|
+
/*!
|
40
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
41
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
42
|
+
* v2.4.0
|
43
|
+
*/
|
44
|
+
const IDS = {
|
45
|
+
content: "content",
|
46
|
+
toggle: "toggle",
|
47
|
+
header: "header",
|
48
|
+
};
|
49
|
+
const CSS$3 = {
|
50
|
+
button: "button",
|
51
|
+
container: "container",
|
52
|
+
content: "content",
|
53
|
+
controlContainer: "control-container",
|
54
|
+
description: "description",
|
55
|
+
header: "header",
|
56
|
+
headerContainer: "header-container",
|
57
|
+
heading: "heading",
|
58
|
+
icon: "icon",
|
59
|
+
invalid: "invalid",
|
60
|
+
statusIcon: "status-icon",
|
61
|
+
summary: "summary",
|
62
|
+
title: "title",
|
63
|
+
toggle: "toggle",
|
64
|
+
toggleIcon: "toggle-icon",
|
65
|
+
valid: "valid",
|
66
|
+
};
|
67
|
+
const SLOTS = {
|
68
|
+
icon: "icon",
|
69
|
+
control: "control",
|
70
|
+
headerMenuActions: "header-menu-actions",
|
71
|
+
};
|
72
|
+
const ICONS = {
|
73
|
+
opened: "chevron-up",
|
74
|
+
closed: "chevron-down",
|
75
|
+
valid: "check-circle",
|
76
|
+
invalid: "exclamation-mark-triangle",
|
77
|
+
};
|
78
|
+
|
79
|
+
const blockCss = ":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{--calcite-icon-size:1rem;--calcite-spacing-eighth:0.125rem;--calcite-spacing-quarter:0.25rem;--calcite-spacing-half:0.5rem;--calcite-spacing-three-quarters:0.75rem;--calcite-spacing:1rem;--calcite-spacing-plus-quarter:1.25rem;--calcite-spacing-plus-half:1.5rem;--calcite-spacing-double:2rem;--calcite-menu-min-width:10rem;--calcite-header-min-height:3rem;--calcite-footer-min-height:3rem}:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{display:flex;flex-shrink:0;flex-grow:0;flex-direction:column;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);padding:0px;transition-property:margin;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;transition-timing-function:cubic-bezier(0.215, 0.440, 0.420, 0.880);flex-basis:auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.interaction-container{display:contents}.header{margin:0px;display:flex;align-content:space-between;align-items:center;fill:var(--calcite-color-text-2);color:var(--calcite-color-text-2)}.heading{margin:0px;padding:0px;font-weight:var(--calcite-font-weight-medium)}.header .heading{flex:1 1 auto;padding:0.5rem}.header{justify-content:flex-start;padding:0px}.header,.toggle{grid-area:header}.header-container{display:grid;align-items:stretch;grid-template:auto/auto 1fr auto auto;grid-template-areas:\"handle header control menu\";grid-column:header-start/menu-end;grid-row:1/2}.toggle{margin:0px;display:flex;cursor:pointer;flex-wrap:nowrap;align-items:center;justify-content:space-between;border-style:none;padding:0px;font-family:inherit;outline-color:transparent;text-align:initial;background-color:transparent}.toggle:hover{background-color:var(--calcite-color-foreground-2)}.toggle:focus{outline:2px solid var(--calcite-color-brand);outline-offset:calc(\n -2px *\n calc(\n 1 -\n 2 * clamp(\n 0,\n var(--calcite-offset-invert-focus),\n 1\n )\n )\n )}calcite-loader[inline]{grid-area:control;align-self:center}calcite-handle{grid-area:handle}.title{margin:0px;padding:0.75rem}.header .title .heading{padding:0px;font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-medium);line-height:1.25;color:var(--calcite-color-text-2);transition-property:color;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);word-wrap:break-word;word-break:break-word}.description{margin-block-start:0.125rem;padding:0px;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text-3);word-wrap:break-word;word-break:break-word}.icon{display:flex;margin-inline-start:0.75rem;margin-inline-end:0px}.status-icon.valid{color:var(--calcite-color-status-success)}.status-icon.invalid{color:var(--calcite-color-status-danger)}@keyframes spin{0%{transform:rotate(0deg)}50%{transform:rotate(180deg)}100%{transform:rotate(360deg)}}.toggle-icon{margin-block:0.75rem;align-self:center;justify-self:end;color:var(--calcite-color-text-3);transition-property:color;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);margin-inline-end:0.75rem;margin-inline-start:auto}.toggle:hover .toggle-icon{color:var(--calcite-color-text-1)}.container{position:relative;display:flex;block-size:100%;flex-direction:column}.content{position:relative;min-block-size:0px;flex:1 1 0%}@keyframes in{0%{opacity:0}100%{opacity:1}}.content{animation:in var(--calcite-internal-animation-timing-slow) ease-in-out;padding-block:var(--calcite-block-padding, 0.5rem);padding-inline:var(--calcite-block-padding, 0.625rem)}.control-container{margin:0px;display:flex;grid-area:control}calcite-action-menu{grid-area:menu}:host([open]){margin-block:0.5rem}:host([open]) .header .title .heading{color:var(--calcite-color-text-1)}:host([hidden]){display:none}[hidden]{display:none}";
|
80
|
+
|
81
|
+
const Block = class {
|
82
|
+
constructor(hostRef) {
|
83
|
+
index.registerInstance(this, hostRef);
|
84
|
+
this.calciteBlockBeforeClose = index.createEvent(this, "calciteBlockBeforeClose", 6);
|
85
|
+
this.calciteBlockBeforeOpen = index.createEvent(this, "calciteBlockBeforeOpen", 6);
|
86
|
+
this.calciteBlockClose = index.createEvent(this, "calciteBlockClose", 6);
|
87
|
+
this.calciteBlockOpen = index.createEvent(this, "calciteBlockOpen", 6);
|
88
|
+
this.calciteBlockToggle = index.createEvent(this, "calciteBlockToggle", 6);
|
89
|
+
this.openTransitionProp = "opacity";
|
90
|
+
// --------------------------------------------------------------------------
|
91
|
+
//
|
92
|
+
// Private Methods
|
93
|
+
//
|
94
|
+
// --------------------------------------------------------------------------
|
95
|
+
this.onHeaderClick = () => {
|
96
|
+
this.open = !this.open;
|
97
|
+
this.calciteBlockToggle.emit();
|
98
|
+
};
|
99
|
+
this.setTransitionEl = (el) => {
|
100
|
+
this.transitionEl = el;
|
101
|
+
};
|
102
|
+
this.collapsible = false;
|
103
|
+
this.disabled = false;
|
104
|
+
this.dragHandle = false;
|
105
|
+
this.heading = undefined;
|
106
|
+
this.headingLevel = undefined;
|
107
|
+
this.loading = false;
|
108
|
+
this.open = false;
|
109
|
+
this.status = undefined;
|
110
|
+
this.description = undefined;
|
111
|
+
this.messages = undefined;
|
112
|
+
this.messageOverrides = undefined;
|
113
|
+
this.overlayPositioning = "absolute";
|
114
|
+
this.effectiveLocale = undefined;
|
115
|
+
this.defaultMessages = undefined;
|
116
|
+
}
|
117
|
+
openHandler() {
|
118
|
+
openCloseComponent.onToggleOpenCloseComponent(this);
|
119
|
+
}
|
120
|
+
onMessagesChange() {
|
121
|
+
/* wired up by t9n util */
|
122
|
+
}
|
123
|
+
//--------------------------------------------------------------------------
|
124
|
+
//
|
125
|
+
// Public Methods
|
126
|
+
//
|
127
|
+
//--------------------------------------------------------------------------
|
128
|
+
/**
|
129
|
+
* Sets focus on the component's first tabbable element.
|
130
|
+
*
|
131
|
+
*/
|
132
|
+
async setFocus() {
|
133
|
+
await loadable.componentFocusable(this);
|
134
|
+
dom.focusFirstTabbable(this.el);
|
135
|
+
}
|
136
|
+
onBeforeOpen() {
|
137
|
+
this.calciteBlockBeforeOpen.emit();
|
138
|
+
}
|
139
|
+
onOpen() {
|
140
|
+
this.calciteBlockOpen.emit();
|
141
|
+
}
|
142
|
+
onBeforeClose() {
|
143
|
+
this.calciteBlockBeforeClose.emit();
|
144
|
+
}
|
145
|
+
onClose() {
|
146
|
+
this.calciteBlockClose.emit();
|
147
|
+
}
|
148
|
+
effectiveLocaleChange() {
|
149
|
+
t9n.updateMessages(this, this.effectiveLocale);
|
150
|
+
}
|
151
|
+
// --------------------------------------------------------------------------
|
152
|
+
//
|
153
|
+
// Lifecycle
|
154
|
+
//
|
155
|
+
// --------------------------------------------------------------------------
|
156
|
+
connectedCallback() {
|
157
|
+
conditionalSlot.connectConditionalSlotComponent(this);
|
158
|
+
interactive.connectInteractive(this);
|
159
|
+
locale.connectLocalized(this);
|
160
|
+
t9n.connectMessages(this);
|
161
|
+
}
|
162
|
+
disconnectedCallback() {
|
163
|
+
interactive.disconnectInteractive(this);
|
164
|
+
locale.disconnectLocalized(this);
|
165
|
+
t9n.disconnectMessages(this);
|
166
|
+
conditionalSlot.disconnectConditionalSlotComponent(this);
|
167
|
+
}
|
168
|
+
async componentWillLoad() {
|
169
|
+
await t9n.setUpMessages(this);
|
170
|
+
loadable.setUpLoadableComponent(this);
|
171
|
+
if (this.open) {
|
172
|
+
openCloseComponent.onToggleOpenCloseComponent(this);
|
173
|
+
}
|
174
|
+
}
|
175
|
+
componentDidLoad() {
|
176
|
+
loadable.setComponentLoaded(this);
|
177
|
+
}
|
178
|
+
componentDidRender() {
|
179
|
+
interactive.updateHostInteraction(this);
|
180
|
+
}
|
181
|
+
// --------------------------------------------------------------------------
|
182
|
+
//
|
183
|
+
// Render Methods
|
184
|
+
//
|
185
|
+
// --------------------------------------------------------------------------
|
186
|
+
renderScrim() {
|
187
|
+
const { loading } = this;
|
188
|
+
const defaultSlot = index.h("slot", null);
|
189
|
+
return [loading ? index.h("calcite-scrim", { loading: loading }) : null, defaultSlot];
|
190
|
+
}
|
191
|
+
renderIcon() {
|
192
|
+
const { loading, messages, status } = this;
|
193
|
+
const hasSlottedIcon = !!dom.getSlotted(this.el, SLOTS.icon);
|
194
|
+
return loading ? (index.h("div", { class: CSS$3.icon, key: "loader" }, index.h("calcite-loader", { inline: true, label: messages.loading }))) : !!status ? (index.h("div", { class: CSS$3.icon, key: "status-icon" }, index.h("calcite-icon", { class: {
|
195
|
+
[CSS$3.statusIcon]: true,
|
196
|
+
[CSS$3.valid]: status == "valid",
|
197
|
+
[CSS$3.invalid]: status == "invalid",
|
198
|
+
}, icon: ICONS[status], scale: "s" }))) : hasSlottedIcon ? (index.h("div", { class: CSS$3.icon, key: "icon-slot" }, index.h("slot", { key: "icon-slot", name: SLOTS.icon }))) : null;
|
199
|
+
}
|
200
|
+
renderTitle() {
|
201
|
+
const { heading, headingLevel, description } = this;
|
202
|
+
return heading || description ? (index.h("div", { class: CSS$3.title }, index.h(Heading.Heading, { class: CSS$3.heading, level: headingLevel }, heading), description ? index.h("div", { class: CSS$3.description }, description) : null)) : null;
|
203
|
+
}
|
204
|
+
render() {
|
205
|
+
const { collapsible, el, loading, open, heading, messages } = this;
|
206
|
+
const toggleLabel = open ? messages.collapse : messages.expand;
|
207
|
+
const headerContent = (index.h("header", { class: CSS$3.header, id: IDS.header }, this.renderIcon(), this.renderTitle()));
|
208
|
+
const hasControl = !!dom.getSlotted(el, SLOTS.control);
|
209
|
+
const hasMenuActions = !!dom.getSlotted(el, SLOTS.headerMenuActions);
|
210
|
+
const collapseIcon = open ? ICONS.opened : ICONS.closed;
|
211
|
+
const headerNode = (index.h("div", { class: CSS$3.headerContainer }, this.dragHandle ? index.h("calcite-handle", { label: heading }) : null, collapsible ? (index.h("button", { "aria-controls": IDS.content, "aria-describedby": IDS.header, "aria-expanded": collapsible ? dom.toAriaBoolean(open) : null, class: CSS$3.toggle, id: IDS.toggle, onClick: this.onHeaderClick, title: toggleLabel }, headerContent, index.h("calcite-icon", { "aria-hidden": "true", class: CSS$3.toggleIcon, icon: collapseIcon, scale: "s" }))) : (headerContent), hasControl ? (index.h("div", { class: CSS$3.controlContainer }, index.h("slot", { name: SLOTS.control }))) : null, hasMenuActions ? (index.h("calcite-action-menu", { label: messages.options, overlayPositioning: this.overlayPositioning }, index.h("slot", { name: SLOTS.headerMenuActions }))) : null));
|
212
|
+
return (index.h(index.Host, null, index.h(interactive.InteractiveContainer, { disabled: this.disabled }, index.h("article", { "aria-busy": dom.toAriaBoolean(loading), class: {
|
213
|
+
[CSS$3.container]: true,
|
214
|
+
} }, headerNode, index.h("section", { "aria-labelledby": IDS.toggle, class: CSS$3.content, hidden: !open, id: IDS.content,
|
215
|
+
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
|
216
|
+
ref: this.setTransitionEl }, this.renderScrim())))));
|
217
|
+
}
|
218
|
+
static get assetsDirs() { return ["assets"]; }
|
219
|
+
get el() { return index.getElement(this); }
|
220
|
+
static get watchers() { return {
|
221
|
+
"open": ["openHandler"],
|
222
|
+
"messageOverrides": ["onMessagesChange"],
|
223
|
+
"effectiveLocale": ["effectiveLocaleChange"]
|
224
|
+
}; }
|
225
|
+
};
|
226
|
+
Block.style = blockCss;
|
227
|
+
|
228
|
+
/*!
|
229
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
230
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
231
|
+
* v2.4.0
|
232
|
+
*/
|
233
|
+
const HEADING_LEVEL = 2;
|
234
|
+
const DATE_PICKER_FORMAT_OPTIONS = { dateStyle: "full" };
|
235
|
+
|
236
|
+
/*!
|
237
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
238
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
239
|
+
* v2.4.0
|
240
|
+
*/
|
241
|
+
/**
|
242
|
+
* CLDR cache.
|
243
|
+
* Exported for testing purposes.
|
244
|
+
*
|
245
|
+
* @private
|
246
|
+
*/
|
247
|
+
const translationCache = {};
|
248
|
+
/**
|
249
|
+
* CLDR request cache.
|
250
|
+
* Exported for testing purposes.
|
251
|
+
*
|
252
|
+
* @private
|
253
|
+
*/
|
254
|
+
const requestCache = {};
|
255
|
+
/**
|
256
|
+
* Fetch calendar data for a given locale from list of supported languages
|
257
|
+
*
|
258
|
+
* @param lang
|
259
|
+
* @public
|
260
|
+
*/
|
261
|
+
async function getLocaleData(lang) {
|
262
|
+
const locale$1 = locale.getSupportedLocale(lang);
|
263
|
+
if (translationCache[locale$1]) {
|
264
|
+
return translationCache[locale$1];
|
265
|
+
}
|
266
|
+
if (!requestCache[locale$1]) {
|
267
|
+
requestCache[locale$1] = fetch(index.getAssetPath(`./assets/date-picker/nls/${locale$1}.json`))
|
268
|
+
.then((resp) => resp.json())
|
269
|
+
.catch(() => {
|
270
|
+
console.error(`Translations for "${locale$1}" not found or invalid, falling back to english`);
|
271
|
+
return getLocaleData("en");
|
272
|
+
});
|
273
|
+
}
|
274
|
+
const data = await requestCache[locale$1];
|
275
|
+
translationCache[locale$1] = data;
|
276
|
+
return data;
|
277
|
+
}
|
278
|
+
/**
|
279
|
+
* Maps value to valueAsDate
|
280
|
+
*
|
281
|
+
* @param value
|
282
|
+
*/
|
283
|
+
function getValueAsDateRange(value) {
|
284
|
+
return value.map((v, index) => date.dateFromISO(v, index === 1));
|
285
|
+
}
|
286
|
+
|
287
|
+
const datePickerCss = ":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{display:inline-block;inline-size:auto;overflow:visible;border-radius:0px;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-1);vertical-align:top}:host([scale=s]){inline-size:234px;min-inline-size:216px;max-inline-size:380px}:host([scale=m]){inline-size:304px;min-inline-size:272px;max-inline-size:480px}:host([scale=l]){inline-size:370px;min-inline-size:320px;max-inline-size:600px}:host([hidden]){display:none}[hidden]{display:none}";
|
288
|
+
|
289
|
+
const DatePicker = class {
|
290
|
+
constructor(hostRef) {
|
291
|
+
index.registerInstance(this, hostRef);
|
292
|
+
this.calciteDatePickerChange = index.createEvent(this, "calciteDatePickerChange", 6);
|
293
|
+
this.calciteDatePickerRangeChange = index.createEvent(this, "calciteDatePickerRangeChange", 6);
|
294
|
+
//--------------------------------------------------------------------------
|
295
|
+
//
|
296
|
+
// Private Methods
|
297
|
+
//
|
298
|
+
//--------------------------------------------------------------------------
|
299
|
+
this.keyDownHandler = (event) => {
|
300
|
+
if (event.key === "Escape") {
|
301
|
+
this.resetActiveDates();
|
302
|
+
}
|
303
|
+
};
|
304
|
+
this.monthHeaderSelectChange = (event) => {
|
305
|
+
const date = new Date(event.detail);
|
306
|
+
if (!this.range) {
|
307
|
+
this.activeDate = date;
|
308
|
+
}
|
309
|
+
else {
|
310
|
+
if (this.activeRange === "end") {
|
311
|
+
this.activeEndDate = date;
|
312
|
+
}
|
313
|
+
else {
|
314
|
+
this.activeStartDate = date;
|
315
|
+
}
|
316
|
+
this.mostRecentRangeValue = date;
|
317
|
+
}
|
318
|
+
};
|
319
|
+
this.monthActiveDateChange = (event) => {
|
320
|
+
const date = new Date(event.detail);
|
321
|
+
if (!this.range) {
|
322
|
+
this.activeDate = date;
|
323
|
+
}
|
324
|
+
else {
|
325
|
+
if (this.activeRange === "end") {
|
326
|
+
this.activeEndDate = date;
|
327
|
+
}
|
328
|
+
else {
|
329
|
+
this.activeStartDate = date;
|
330
|
+
}
|
331
|
+
this.mostRecentRangeValue = date;
|
332
|
+
}
|
333
|
+
};
|
334
|
+
this.monthHoverChange = (event) => {
|
335
|
+
if (!this.range) {
|
336
|
+
this.hoverRange = undefined;
|
337
|
+
return;
|
338
|
+
}
|
339
|
+
const { valueAsDate } = this;
|
340
|
+
const start = Array.isArray(valueAsDate) && valueAsDate[0];
|
341
|
+
const end = Array.isArray(valueAsDate) && valueAsDate[1];
|
342
|
+
const date$1 = new Date(event.detail);
|
343
|
+
this.hoverRange = {
|
344
|
+
focused: this.activeRange || "start",
|
345
|
+
start,
|
346
|
+
end,
|
347
|
+
};
|
348
|
+
if (!this.proximitySelectionDisabled) {
|
349
|
+
if (start && end) {
|
350
|
+
const startDiff = date.getDaysDiff(date$1, start);
|
351
|
+
const endDiff = date.getDaysDiff(date$1, end);
|
352
|
+
if (endDiff > 0) {
|
353
|
+
this.hoverRange.end = date$1;
|
354
|
+
this.hoverRange.focused = "end";
|
355
|
+
}
|
356
|
+
else if (startDiff < 0) {
|
357
|
+
this.hoverRange.start = date$1;
|
358
|
+
this.hoverRange.focused = "start";
|
359
|
+
}
|
360
|
+
else if (startDiff > endDiff) {
|
361
|
+
this.hoverRange.start = date$1;
|
362
|
+
this.hoverRange.focused = "start";
|
363
|
+
}
|
364
|
+
else {
|
365
|
+
this.hoverRange.end = date$1;
|
366
|
+
this.hoverRange.focused = "end";
|
367
|
+
}
|
368
|
+
}
|
369
|
+
else {
|
370
|
+
if (start) {
|
371
|
+
if (date$1 < start) {
|
372
|
+
this.hoverRange = {
|
373
|
+
focused: "start",
|
374
|
+
start: date$1,
|
375
|
+
end: start,
|
376
|
+
};
|
377
|
+
}
|
378
|
+
else {
|
379
|
+
this.hoverRange.end = date$1;
|
380
|
+
this.hoverRange.focused = "end";
|
381
|
+
}
|
382
|
+
}
|
383
|
+
}
|
384
|
+
}
|
385
|
+
else {
|
386
|
+
if (!end) {
|
387
|
+
if (date$1 < start) {
|
388
|
+
this.hoverRange = {
|
389
|
+
focused: "start",
|
390
|
+
start: date$1,
|
391
|
+
end: start,
|
392
|
+
};
|
393
|
+
}
|
394
|
+
else {
|
395
|
+
this.hoverRange.end = date$1;
|
396
|
+
this.hoverRange.focused = "end";
|
397
|
+
}
|
398
|
+
}
|
399
|
+
else {
|
400
|
+
this.hoverRange = undefined;
|
401
|
+
}
|
402
|
+
}
|
403
|
+
event.stopPropagation();
|
404
|
+
};
|
405
|
+
this.monthMouseOutChange = () => {
|
406
|
+
if (this.hoverRange) {
|
407
|
+
this.hoverRange = undefined;
|
408
|
+
}
|
409
|
+
};
|
410
|
+
this.resetActiveDates = () => {
|
411
|
+
const { valueAsDate } = this;
|
412
|
+
if (!Array.isArray(valueAsDate) && valueAsDate && valueAsDate !== this.activeDate) {
|
413
|
+
this.activeDate = new Date(valueAsDate);
|
414
|
+
}
|
415
|
+
if (Array.isArray(valueAsDate)) {
|
416
|
+
if (valueAsDate[0] && valueAsDate[0] !== this.activeStartDate) {
|
417
|
+
this.activeStartDate = new Date(valueAsDate[0]);
|
418
|
+
}
|
419
|
+
if (valueAsDate[1] && valueAsDate[1] !== this.activeEndDate) {
|
420
|
+
this.activeEndDate = new Date(valueAsDate[1]);
|
421
|
+
}
|
422
|
+
}
|
423
|
+
};
|
424
|
+
/**
|
425
|
+
* Event handler for when the selected date changes
|
426
|
+
*
|
427
|
+
* @param event
|
428
|
+
*/
|
429
|
+
this.monthDateChange = (event) => {
|
430
|
+
const date$1 = new Date(event.detail);
|
431
|
+
const isoDate = date.dateToISO(date$1);
|
432
|
+
if (!this.range && isoDate === date.dateToISO(this.valueAsDate)) {
|
433
|
+
return;
|
434
|
+
}
|
435
|
+
if (!this.range) {
|
436
|
+
this.value = isoDate || "";
|
437
|
+
this.valueAsDate = date$1 || null;
|
438
|
+
this.activeDate = date$1 || null;
|
439
|
+
this.calciteDatePickerChange.emit();
|
440
|
+
return;
|
441
|
+
}
|
442
|
+
const start = this.getStartDate();
|
443
|
+
const end = this.getEndDate();
|
444
|
+
if (!start || (!end && date$1 < start)) {
|
445
|
+
if (start) {
|
446
|
+
this.setEndDate(new Date(start));
|
447
|
+
}
|
448
|
+
if (this.activeRange == "end") {
|
449
|
+
this.setEndDate(date$1);
|
450
|
+
}
|
451
|
+
else {
|
452
|
+
this.setStartDate(date$1);
|
453
|
+
}
|
454
|
+
}
|
455
|
+
else if (!end) {
|
456
|
+
this.setEndDate(date$1);
|
457
|
+
}
|
458
|
+
else {
|
459
|
+
if (!this.proximitySelectionDisabled) {
|
460
|
+
if (this.activeRange) {
|
461
|
+
if (this.activeRange == "end") {
|
462
|
+
this.setEndDate(date$1);
|
463
|
+
}
|
464
|
+
else {
|
465
|
+
this.setStartDate(date$1);
|
466
|
+
}
|
467
|
+
}
|
468
|
+
else {
|
469
|
+
const startDiff = date.getDaysDiff(date$1, start);
|
470
|
+
const endDiff = date.getDaysDiff(date$1, end);
|
471
|
+
if (endDiff === 0 || startDiff < 0) {
|
472
|
+
this.setStartDate(date$1);
|
473
|
+
}
|
474
|
+
else if (startDiff === 0 || endDiff < 0) {
|
475
|
+
this.setEndDate(date$1);
|
476
|
+
}
|
477
|
+
else if (startDiff < endDiff) {
|
478
|
+
this.setStartDate(date$1);
|
479
|
+
}
|
480
|
+
else {
|
481
|
+
this.setEndDate(date$1);
|
482
|
+
}
|
483
|
+
}
|
484
|
+
}
|
485
|
+
else {
|
486
|
+
this.setStartDate(date$1);
|
487
|
+
}
|
488
|
+
}
|
489
|
+
this.calciteDatePickerChange.emit();
|
490
|
+
};
|
491
|
+
this.activeDate = undefined;
|
492
|
+
this.activeRange = undefined;
|
493
|
+
this.value = undefined;
|
494
|
+
this.headingLevel = undefined;
|
495
|
+
this.valueAsDate = undefined;
|
496
|
+
this.minAsDate = undefined;
|
497
|
+
this.maxAsDate = undefined;
|
498
|
+
this.min = undefined;
|
499
|
+
this.max = undefined;
|
500
|
+
this.numberingSystem = undefined;
|
501
|
+
this.scale = "m";
|
502
|
+
this.range = false;
|
503
|
+
this.proximitySelectionDisabled = false;
|
504
|
+
this.messageOverrides = undefined;
|
505
|
+
this.messages = undefined;
|
506
|
+
this.activeEndDate = undefined;
|
507
|
+
this.activeStartDate = undefined;
|
508
|
+
this.dateTimeFormat = undefined;
|
509
|
+
this.defaultMessages = undefined;
|
510
|
+
this.effectiveLocale = "";
|
511
|
+
this.endAsDate = undefined;
|
512
|
+
this.hoverRange = undefined;
|
513
|
+
this.localeData = undefined;
|
514
|
+
this.mostRecentRangeValue = undefined;
|
515
|
+
this.startAsDate = undefined;
|
516
|
+
}
|
517
|
+
activeDateWatcher(newActiveDate) {
|
518
|
+
if (this.activeRange === "end") {
|
519
|
+
this.activeEndDate = newActiveDate;
|
520
|
+
}
|
521
|
+
}
|
522
|
+
valueAsDateWatcher(newValueAsDate) {
|
523
|
+
if (this.range && Array.isArray(newValueAsDate)) {
|
524
|
+
const { activeStartDate, activeEndDate } = this;
|
525
|
+
const newActiveStartDate = newValueAsDate[0];
|
526
|
+
const newActiveEndDate = newValueAsDate[1];
|
527
|
+
this.activeStartDate = activeStartDate !== newActiveStartDate && newActiveStartDate;
|
528
|
+
this.activeEndDate = activeEndDate !== newActiveEndDate && newActiveEndDate;
|
529
|
+
}
|
530
|
+
else if (newValueAsDate && newValueAsDate !== this.activeDate) {
|
531
|
+
this.activeDate = newValueAsDate;
|
532
|
+
}
|
533
|
+
}
|
534
|
+
onMinChanged(min) {
|
535
|
+
if (min) {
|
536
|
+
this.minAsDate = date.dateFromISO(min);
|
537
|
+
}
|
538
|
+
}
|
539
|
+
onMaxChanged(max) {
|
540
|
+
if (max) {
|
541
|
+
this.maxAsDate = date.dateFromISO(max);
|
542
|
+
}
|
543
|
+
}
|
544
|
+
onMessagesChange() {
|
545
|
+
/* wired up by t9n util */
|
546
|
+
}
|
547
|
+
//--------------------------------------------------------------------------
|
548
|
+
//
|
549
|
+
// Public Methods
|
550
|
+
//
|
551
|
+
//--------------------------------------------------------------------------
|
552
|
+
/** Sets focus on the component's first focusable element. */
|
553
|
+
async setFocus() {
|
554
|
+
await loadable.componentFocusable(this);
|
555
|
+
this.el.focus();
|
556
|
+
}
|
557
|
+
/**
|
558
|
+
* Resets active date state.
|
559
|
+
* @internal
|
560
|
+
*/
|
561
|
+
async reset() {
|
562
|
+
this.resetActiveDates();
|
563
|
+
this.mostRecentRangeValue = undefined;
|
564
|
+
}
|
565
|
+
// --------------------------------------------------------------------------
|
566
|
+
//
|
567
|
+
// Lifecycle
|
568
|
+
//
|
569
|
+
// --------------------------------------------------------------------------
|
570
|
+
connectedCallback() {
|
571
|
+
locale.connectLocalized(this);
|
572
|
+
t9n.connectMessages(this);
|
573
|
+
if (Array.isArray(this.value)) {
|
574
|
+
this.valueAsDate = getValueAsDateRange(this.value);
|
575
|
+
}
|
576
|
+
else if (this.value) {
|
577
|
+
this.valueAsDate = date.dateFromISO(this.value);
|
578
|
+
}
|
579
|
+
if (this.min) {
|
580
|
+
this.minAsDate = date.dateFromISO(this.min);
|
581
|
+
}
|
582
|
+
if (this.max) {
|
583
|
+
this.maxAsDate = date.dateFromISO(this.max);
|
584
|
+
}
|
585
|
+
}
|
586
|
+
disconnectedCallback() {
|
587
|
+
locale.disconnectLocalized(this);
|
588
|
+
t9n.disconnectMessages(this);
|
589
|
+
}
|
590
|
+
async componentWillLoad() {
|
591
|
+
loadable.setUpLoadableComponent(this);
|
592
|
+
await this.loadLocaleData();
|
593
|
+
this.onMinChanged(this.min);
|
594
|
+
this.onMaxChanged(this.max);
|
595
|
+
await t9n.setUpMessages(this);
|
596
|
+
}
|
597
|
+
componentDidLoad() {
|
598
|
+
loadable.setComponentLoaded(this);
|
599
|
+
}
|
600
|
+
render() {
|
601
|
+
var _a;
|
602
|
+
const date$1 = date.dateFromRange(this.range && Array.isArray(this.valueAsDate) ? this.valueAsDate[0] : this.valueAsDate, this.minAsDate, this.maxAsDate);
|
603
|
+
let activeDate = this.getActiveDate(date$1, this.minAsDate, this.maxAsDate);
|
604
|
+
const endDate = this.range && Array.isArray(this.valueAsDate)
|
605
|
+
? date.dateFromRange(this.valueAsDate[1], this.minAsDate, this.maxAsDate)
|
606
|
+
: null;
|
607
|
+
const activeEndDate = this.getActiveEndDate(endDate, this.minAsDate, this.maxAsDate);
|
608
|
+
if ((this.activeRange === "end" ||
|
609
|
+
(((_a = this.hoverRange) === null || _a === void 0 ? void 0 : _a.focused) === "end" && (!this.proximitySelectionDisabled || endDate))) &&
|
610
|
+
activeEndDate) {
|
611
|
+
activeDate = activeEndDate;
|
612
|
+
}
|
613
|
+
if (this.range && this.mostRecentRangeValue) {
|
614
|
+
activeDate = this.mostRecentRangeValue;
|
615
|
+
}
|
616
|
+
const minDate = this.range && this.activeRange
|
617
|
+
? this.activeRange === "start"
|
618
|
+
? this.minAsDate
|
619
|
+
: date$1 || this.minAsDate
|
620
|
+
: this.minAsDate;
|
621
|
+
const maxDate = this.range && this.activeRange
|
622
|
+
? this.activeRange === "start"
|
623
|
+
? endDate || this.maxAsDate
|
624
|
+
: this.maxAsDate
|
625
|
+
: this.maxAsDate;
|
626
|
+
return (index.h(index.Host, { onBlur: this.resetActiveDates, onKeyDown: this.keyDownHandler }, this.renderCalendar(activeDate, maxDate, minDate, date$1, endDate)));
|
627
|
+
}
|
628
|
+
effectiveLocaleChange() {
|
629
|
+
t9n.updateMessages(this, this.effectiveLocale);
|
630
|
+
}
|
631
|
+
valueHandler(value) {
|
632
|
+
if (Array.isArray(value)) {
|
633
|
+
this.valueAsDate = getValueAsDateRange(value);
|
634
|
+
}
|
635
|
+
else if (value) {
|
636
|
+
this.valueAsDate = date.dateFromISO(value);
|
637
|
+
}
|
638
|
+
}
|
639
|
+
async loadLocaleData() {
|
640
|
+
locale.numberStringFormatter.numberFormatOptions = {
|
641
|
+
numberingSystem: this.numberingSystem,
|
642
|
+
locale: this.effectiveLocale,
|
643
|
+
useGrouping: false,
|
644
|
+
};
|
645
|
+
this.localeData = await getLocaleData(this.effectiveLocale);
|
646
|
+
this.dateTimeFormat = locale.getDateTimeFormat(this.effectiveLocale, DATE_PICKER_FORMAT_OPTIONS);
|
647
|
+
}
|
648
|
+
/**
|
649
|
+
* Render calcite-date-picker-month-header and calcite-date-picker-month
|
650
|
+
*
|
651
|
+
* @param activeDate
|
652
|
+
* @param maxDate
|
653
|
+
* @param minDate
|
654
|
+
* @param date
|
655
|
+
* @param endDate
|
656
|
+
*/
|
657
|
+
renderCalendar(activeDate, maxDate, minDate, date, endDate) {
|
658
|
+
return (this.localeData && [
|
659
|
+
index.h("calcite-date-picker-month-header", { activeDate: activeDate, headingLevel: this.headingLevel || HEADING_LEVEL, localeData: this.localeData, max: maxDate, messages: this.messages, min: minDate, onCalciteInternalDatePickerSelect: this.monthHeaderSelectChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date || new Date() }),
|
660
|
+
index.h("calcite-date-picker-month", { activeDate: activeDate, dateTimeFormat: this.dateTimeFormat, endDate: this.range ? endDate : undefined, hoverRange: this.hoverRange, localeData: this.localeData, max: maxDate, min: minDate, onCalciteInternalDatePickerActiveDateChange: this.monthActiveDateChange, onCalciteInternalDatePickerHover: this.monthHoverChange, onCalciteInternalDatePickerMouseOut: this.monthMouseOutChange, onCalciteInternalDatePickerSelect: this.monthDateChange, scale: this.scale, selectedDate: this.activeRange === "end" ? endDate : date, startDate: this.range ? date : undefined }),
|
661
|
+
]);
|
662
|
+
}
|
663
|
+
getEndDate() {
|
664
|
+
return (Array.isArray(this.valueAsDate) && this.valueAsDate[1]) || undefined;
|
665
|
+
}
|
666
|
+
setEndDate(date$1) {
|
667
|
+
const startDate = this.getStartDate();
|
668
|
+
const newEndDate = date$1 ? date.setEndOfDay(date$1) : date$1;
|
669
|
+
this.value = [date.dateToISO(startDate), date.dateToISO(date$1)];
|
670
|
+
this.valueAsDate = [startDate, date$1];
|
671
|
+
this.mostRecentRangeValue = newEndDate;
|
672
|
+
this.calciteDatePickerRangeChange.emit();
|
673
|
+
this.activeEndDate = date$1 || null;
|
674
|
+
}
|
675
|
+
getStartDate() {
|
676
|
+
return Array.isArray(this.valueAsDate) && this.valueAsDate[0];
|
677
|
+
}
|
678
|
+
setStartDate(date$1) {
|
679
|
+
const endDate = this.getEndDate();
|
680
|
+
this.value = [date.dateToISO(date$1), date.dateToISO(endDate)];
|
681
|
+
this.valueAsDate = [date$1, endDate];
|
682
|
+
this.mostRecentRangeValue = date$1;
|
683
|
+
this.calciteDatePickerRangeChange.emit();
|
684
|
+
this.activeStartDate = date$1 || null;
|
685
|
+
}
|
686
|
+
/**
|
687
|
+
* Get an active date using the value, or current date as default
|
688
|
+
*
|
689
|
+
* @param value
|
690
|
+
* @param min
|
691
|
+
* @param max
|
692
|
+
*/
|
693
|
+
getActiveDate(value, min, max) {
|
694
|
+
return date.dateFromRange(this.activeDate, min, max) || value || date.dateFromRange(new Date(), min, max);
|
695
|
+
}
|
696
|
+
getActiveEndDate(value, min, max) {
|
697
|
+
return (date.dateFromRange(this.activeEndDate, min, max) || value || date.dateFromRange(new Date(), min, max));
|
698
|
+
}
|
699
|
+
static get delegatesFocus() { return true; }
|
700
|
+
static get assetsDirs() { return ["assets"]; }
|
701
|
+
get el() { return index.getElement(this); }
|
702
|
+
static get watchers() { return {
|
703
|
+
"activeDate": ["activeDateWatcher"],
|
704
|
+
"valueAsDate": ["valueAsDateWatcher"],
|
705
|
+
"min": ["onMinChanged"],
|
706
|
+
"max": ["onMaxChanged"],
|
707
|
+
"messageOverrides": ["onMessagesChange"],
|
708
|
+
"effectiveLocale": ["effectiveLocaleChange", "loadLocaleData"],
|
709
|
+
"value": ["valueHandler"]
|
710
|
+
}; }
|
711
|
+
};
|
712
|
+
DatePicker.style = datePickerCss;
|
713
|
+
|
38
714
|
/*!
|
39
715
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
40
716
|
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
@@ -272,7 +948,7 @@ const InputDatePicker = class {
|
|
272
948
|
}
|
273
949
|
this.userChangedValue = true;
|
274
950
|
this.value = newValue;
|
275
|
-
this.valueAsDate = newValue ?
|
951
|
+
this.valueAsDate = newValue ? getValueAsDateRange(newValue) : undefined;
|
276
952
|
const changeEvent = this.calciteInputDatePickerChange.emit();
|
277
953
|
if (changeEvent && changeEvent.defaultPrevented) {
|
278
954
|
this.value = oldValue;
|
@@ -373,7 +1049,7 @@ const InputDatePicker = class {
|
|
373
1049
|
if (!this.userChangedValue) {
|
374
1050
|
let newValueAsDate;
|
375
1051
|
if (Array.isArray(newValue)) {
|
376
|
-
newValueAsDate =
|
1052
|
+
newValueAsDate = getValueAsDateRange(newValue);
|
377
1053
|
}
|
378
1054
|
else if (newValue) {
|
379
1055
|
newValueAsDate = date.dateFromISO(newValue);
|
@@ -475,7 +1151,7 @@ const InputDatePicker = class {
|
|
475
1151
|
const { open } = this;
|
476
1152
|
open && this.openHandler();
|
477
1153
|
if (Array.isArray(this.value)) {
|
478
|
-
this.valueAsDate =
|
1154
|
+
this.valueAsDate = getValueAsDateRange(this.value);
|
479
1155
|
}
|
480
1156
|
else if (this.value) {
|
481
1157
|
try {
|
@@ -669,7 +1345,7 @@ const InputDatePicker = class {
|
|
669
1345
|
locale: this.effectiveLocale,
|
670
1346
|
useGrouping: false,
|
671
1347
|
};
|
672
|
-
this.localeData = await
|
1348
|
+
this.localeData = await getLocaleData(this.effectiveLocale);
|
673
1349
|
this.localizeInputValues();
|
674
1350
|
}
|
675
1351
|
shouldFocusRangeStart() {
|
@@ -2282,6 +2958,8 @@ const InstantAppsSocialShare = class {
|
|
2282
2958
|
};
|
2283
2959
|
InstantAppsSocialShare.style = instantAppsSocialShareCss;
|
2284
2960
|
|
2961
|
+
exports.calcite_block = Block;
|
2962
|
+
exports.calcite_date_picker = DatePicker;
|
2285
2963
|
exports.calcite_input_date_picker = InputDatePicker;
|
2286
2964
|
exports.instant_apps_filter_list = InstantAppsFilterList;
|
2287
2965
|
exports.instant_apps_social_share = InstantAppsSocialShare;
|