@esri/solutions-components 0.3.5 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/buffer-tools_6.cjs.entry.js +26 -8
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +2 -2
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +6 -4
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{csvUtils-83af7ae1.js → csvUtils-34666909.js} +1 -1
- package/dist/cjs/{interfaces-772edf61.js → interfaces-17c631bf.js} +1 -1
- package/dist/cjs/layer-table.cjs.entry.js +3 -3
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-card.cjs.entry.js +1 -1
- package/dist/cjs/{mapViewUtils-55ac76cb.js → mapViewUtils-24d1d859.js} +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +41 -7
- package/dist/cjs/solution-configuration.cjs.entry.js +2 -2
- package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
- package/dist/cjs/{solution-store-39726b81.js → solution-store-2dbab624.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/buffer-tools/buffer-tools.js +48 -0
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +10 -4
- package/dist/collection/components/public-notification/public-notification.css +12 -12
- package/dist/collection/components/public-notification/public-notification.js +50 -4
- package/dist/collection/components/refine-selection/refine-selection.js +4 -2
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.css +1 -0
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +3 -1
- package/dist/collection/demos/new-public-notification.html +7 -6
- package/dist/collection/utils/interfaces.js +1 -1
- package/dist/collection/utils/interfaces.ts +7 -2
- package/dist/components/buffer-tools2.js +10 -0
- package/dist/components/interfaces3.js +1 -1
- package/dist/components/map-draw-tools2.js +10 -4
- package/dist/components/public-notification.js +40 -6
- package/dist/components/refine-selection-tools2.js +4 -2
- package/dist/components/refine-selection2.js +4 -2
- package/dist/esm/buffer-tools_6.entry.js +26 -8
- package/dist/esm/calcite-combobox_3.entry.js +2 -2
- package/dist/esm/calcite-input-message_5.entry.js +6 -4
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{csvUtils-eb231cfb.js → csvUtils-ae3004b9.js} +1 -1
- package/dist/esm/{interfaces-3b23a5f9.js → interfaces-d0d83efa.js} +1 -1
- package/dist/esm/layer-table.entry.js +3 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-card.entry.js +1 -1
- package/dist/esm/{mapViewUtils-e5d8a1e1.js → mapViewUtils-541e7a3c.js} +1 -1
- package/dist/esm/public-notification.entry.js +41 -7
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-c0bf9200.js → solution-store-41e15f1c.js} +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/new-public-notification.html +7 -6
- package/dist/solutions-components/p-05e64bd1.js +498 -2
- package/dist/solutions-components/p-08a95b33.entry.js +138 -0
- package/dist/solutions-components/p-0da5bbdf.entry.js +91 -0
- package/dist/solutions-components/p-0ef91144.entry.js +913 -0
- package/dist/solutions-components/p-0f523243.entry.js +1916 -0
- package/dist/solutions-components/p-11b9510e.entry.js +173 -0
- package/dist/solutions-components/p-1b875d94.entry.js +58 -0
- package/dist/solutions-components/p-1c567f3a.js +23 -16
- package/dist/solutions-components/p-1c883db9.entry.js +43 -0
- package/dist/solutions-components/p-1f225056.js +322 -0
- package/dist/solutions-components/p-1f499e67.entry.js +72 -0
- package/dist/solutions-components/p-20d3d758.entry.js +881 -0
- package/dist/solutions-components/p-2274ac9e.entry.js +160 -0
- package/dist/solutions-components/p-23ec5ac5.entry.js +93 -0
- package/dist/solutions-components/p-2447798c.entry.js +155 -0
- package/dist/solutions-components/p-2525e691.entry.js +432 -0
- package/dist/solutions-components/p-2561f5b5.js +4092 -0
- package/dist/solutions-components/p-29f887c0.entry.js +234 -0
- package/dist/solutions-components/p-2a0d8047.entry.js +345 -0
- package/dist/solutions-components/p-2c177e6a.entry.js +101 -0
- package/dist/solutions-components/p-2e9ed892.js +46 -1
- package/dist/solutions-components/p-316f56db.js +219 -2
- package/dist/solutions-components/p-327f3ebf.entry.js +98 -0
- package/dist/solutions-components/p-356f8b54.entry.js +138 -0
- package/dist/solutions-components/p-359c58de.entry.js +172 -0
- package/dist/solutions-components/p-37336c0d.entry.js +116 -0
- package/dist/solutions-components/p-374a5031.js +105 -2
- package/dist/solutions-components/p-39ea6ef4.entry.js +71 -0
- package/dist/solutions-components/p-3b010ce1.js +17 -1
- package/dist/solutions-components/p-4307dacd.js +194 -1
- package/dist/solutions-components/p-44da2507.js +405 -14
- package/dist/solutions-components/p-46bdffe8.entry.js +54 -0
- package/dist/solutions-components/p-4894bbeb.js +53 -2
- package/dist/solutions-components/p-4cd569f1.entry.js +1298 -0
- package/dist/solutions-components/p-4d4160f9.entry.js +121 -0
- package/dist/solutions-components/p-4e32bf8c.js +482 -1
- package/dist/solutions-components/p-4e9cbd32.entry.js +184 -0
- package/dist/solutions-components/p-508317b3.js +13 -2
- package/dist/solutions-components/p-54697d58.entry.js +198 -0
- package/dist/solutions-components/p-55c79103.entry.js +311 -0
- package/dist/solutions-components/p-57fd19c0.entry.js +706 -0
- package/dist/solutions-components/p-59b48fde.entry.js +443 -0
- package/dist/solutions-components/p-60e0e6a0.entry.js +214 -0
- package/dist/solutions-components/p-621d0534.entry.js +123 -0
- package/dist/solutions-components/p-63f6e8f1.js +14 -1
- package/dist/solutions-components/p-66aeec57.entry.js +61 -0
- package/dist/solutions-components/p-69834f46.entry.js +618 -0
- package/dist/solutions-components/p-6d9da8e5.entry.js +21530 -0
- package/dist/solutions-components/p-6e0da576.js +13 -1
- package/dist/solutions-components/p-6ec3f294.entry.js +106 -0
- package/dist/solutions-components/p-6fe17794.js +9 -1
- package/dist/solutions-components/p-7024cb16.entry.js +72 -0
- package/dist/solutions-components/p-70535506.entry.js +226 -0
- package/dist/solutions-components/p-708a63a8.js +12 -1
- package/dist/solutions-components/p-729708a3.js +14 -1
- package/dist/solutions-components/p-73e23995.js +6 -1
- package/dist/solutions-components/p-74b29d75.entry.js +231 -0
- package/dist/solutions-components/p-74b7ee25.entry.js +711 -0
- package/dist/solutions-components/p-77182c3a.js +3015 -1
- package/dist/solutions-components/p-78b3ef80.entry.js +456 -0
- package/dist/solutions-components/p-79709c19.js +60 -3
- package/dist/solutions-components/p-7a46ef97.js +181 -2
- package/dist/solutions-components/p-7be159e6.entry.js +175 -0
- package/dist/solutions-components/p-7d4451c2.entry.js +71 -0
- package/dist/solutions-components/p-7daea1df.js +41 -1
- package/dist/solutions-components/p-7e39e5ad.entry.js +102 -0
- package/dist/solutions-components/p-7fb45059.entry.js +43 -0
- package/dist/solutions-components/p-815533de.js +306 -3
- package/dist/solutions-components/p-816622ca.entry.js +248 -0
- package/dist/solutions-components/p-83166522.js +205 -2
- package/dist/solutions-components/p-83bd1991.entry.js +36 -0
- package/dist/solutions-components/p-856464d7.entry.js +572 -0
- package/dist/solutions-components/p-8c349bad.entry.js +347 -0
- package/dist/solutions-components/p-8dccb390.entry.js +1986 -0
- package/dist/solutions-components/p-904c185a.entry.js +228 -0
- package/dist/solutions-components/p-9092f8b3.entry.js +156 -0
- package/dist/solutions-components/p-9371145a.entry.js +477 -0
- package/dist/solutions-components/p-93d3119d.js +1948 -1
- package/dist/solutions-components/p-95ec8062.entry.js +173 -0
- package/dist/solutions-components/p-991ee695.js +109 -1
- package/dist/solutions-components/p-9a57dab7.entry.js +213 -0
- package/dist/solutions-components/p-9a9955db.js +41 -1
- package/dist/solutions-components/p-9c1ebc90.js +35 -16
- package/dist/solutions-components/p-9eba5c66.js +399 -3
- package/dist/solutions-components/p-a033a507.entry.js +252 -0
- package/dist/solutions-components/p-a3773415.entry.js +1132 -0
- package/dist/solutions-components/p-a44fe40f.entry.js +94 -0
- package/dist/solutions-components/p-a5b1ab03.js +33 -3
- package/dist/solutions-components/p-a5b2c13d.entry.js +723 -0
- package/dist/solutions-components/p-a6d729b7.entry.js +85 -0
- package/dist/solutions-components/p-a8005026.entry.js +565 -0
- package/dist/solutions-components/p-a80b3880.js +14 -1
- package/dist/solutions-components/p-a89198a3.entry.js +2620 -0
- package/dist/solutions-components/p-aa04bd1f.entry.js +95 -0
- package/dist/solutions-components/p-aa0a0922.entry.js +80 -0
- package/dist/solutions-components/p-ae1fd76b.js +11 -1
- package/dist/solutions-components/p-b2cf435e.entry.js +87 -0
- package/dist/solutions-components/p-b359dc78.js +41 -1
- package/dist/solutions-components/p-b57bc4eb.entry.js +71 -0
- package/dist/solutions-components/p-b75cc407.entry.js +145 -0
- package/dist/solutions-components/p-b911cb75.entry.js +71 -0
- package/dist/solutions-components/p-b965e177.entry.js +335 -0
- package/dist/solutions-components/p-b978636e.js +14 -1
- package/dist/solutions-components/p-ba10a5c8.entry.js +42 -0
- package/dist/solutions-components/p-bd67334c.js +122 -2
- package/dist/solutions-components/p-bde20dba.entry.js +212 -0
- package/dist/solutions-components/p-be0b5a94.entry.js +248 -0
- package/dist/solutions-components/p-c023e6a1.js +2028 -2
- package/dist/solutions-components/p-c27b0c2d.entry.js +150 -0
- package/dist/solutions-components/p-c579ed60.entry.js +447 -0
- package/dist/solutions-components/p-c92bc231.js +101 -2
- package/dist/solutions-components/p-cc815aca.js +839 -16
- package/dist/solutions-components/p-cc8beabb.entry.js +695 -0
- package/dist/solutions-components/p-cdc46c0c.js +1751 -2
- package/dist/solutions-components/p-d12e6992.entry.js +118 -0
- package/dist/solutions-components/p-d1dfed6b.entry.js +179 -0
- package/dist/solutions-components/p-d48a24e6.js +754 -2
- package/dist/solutions-components/p-d96ee3ef.entry.js +579 -0
- package/dist/solutions-components/p-dbc9a5a8.js +80 -0
- package/dist/solutions-components/p-dcdbe712.entry.js +278 -0
- package/dist/solutions-components/p-de39206f.entry.js +113 -0
- package/dist/solutions-components/p-de5416e8.js +28 -1
- package/dist/solutions-components/p-df420d54.entry.js +213 -0
- package/dist/solutions-components/p-e3138cf0.entry.js +20 -0
- package/dist/solutions-components/p-e4845fec.entry.js +152 -0
- package/dist/solutions-components/p-e611d8c8.js +28 -1
- package/dist/solutions-components/p-e947d3b0.js +5 -1
- package/dist/solutions-components/p-ea534300.js +41 -2
- package/dist/solutions-components/p-ec84ee85.entry.js +55 -0
- package/dist/solutions-components/p-ed36c637.entry.js +85 -0
- package/dist/solutions-components/p-f0add71c.js +74 -0
- package/dist/solutions-components/p-f42e014b.js +171 -2
- package/dist/solutions-components/p-fc02e7de.entry.js +308 -0
- package/dist/solutions-components/p-fc884dd6.js +28 -16
- package/dist/solutions-components/p-fcbfa59c.entry.js +181 -0
- package/dist/solutions-components/p-fdc5cf5f.entry.js +138 -0
- package/dist/solutions-components/solutions-components.esm.js +20 -1
- package/dist/solutions-components/utils/interfaces.ts +7 -2
- package/dist/types/components/buffer-tools/buffer-tools.d.ts +9 -1
- package/dist/types/components/public-notification/public-notification.d.ts +26 -0
- package/dist/types/components.d.ts +9 -1
- package/dist/types/preact.d.ts +3 -1
- package/dist/types/utils/interfaces.d.ts +4 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-021432b8.entry.js +0 -12
- package/dist/solutions-components/p-03440b1e.entry.js +0 -11
- package/dist/solutions-components/p-0512635b.entry.js +0 -6
- package/dist/solutions-components/p-086ef115.entry.js +0 -29
- package/dist/solutions-components/p-0b4bf57f.entry.js +0 -6
- package/dist/solutions-components/p-0c088725.entry.js +0 -6
- package/dist/solutions-components/p-0f820c08.entry.js +0 -6
- package/dist/solutions-components/p-164780a0.entry.js +0 -6
- package/dist/solutions-components/p-179a68a0.entry.js +0 -6
- package/dist/solutions-components/p-184b5005.entry.js +0 -11
- package/dist/solutions-components/p-1d082fee.entry.js +0 -11
- package/dist/solutions-components/p-1e6c02a2.entry.js +0 -11
- package/dist/solutions-components/p-20a58e62.entry.js +0 -17
- package/dist/solutions-components/p-20b2458c.entry.js +0 -11
- package/dist/solutions-components/p-245d47c1.entry.js +0 -6
- package/dist/solutions-components/p-2cb057a9.entry.js +0 -11
- package/dist/solutions-components/p-2cc72806.entry.js +0 -23
- package/dist/solutions-components/p-2de1db9c.entry.js +0 -11
- package/dist/solutions-components/p-2e9c7055.entry.js +0 -11
- package/dist/solutions-components/p-2ed5e6c8.entry.js +0 -11
- package/dist/solutions-components/p-3109d940.entry.js +0 -6
- package/dist/solutions-components/p-31a8bcfa.entry.js +0 -6
- package/dist/solutions-components/p-3f88ba73.entry.js +0 -6
- package/dist/solutions-components/p-3fa9b3c8.js +0 -36
- package/dist/solutions-components/p-40c41709.entry.js +0 -6
- package/dist/solutions-components/p-40e963c7.entry.js +0 -11
- package/dist/solutions-components/p-40f480da.entry.js +0 -11
- package/dist/solutions-components/p-49d5d2d3.entry.js +0 -11
- package/dist/solutions-components/p-4f7049a4.entry.js +0 -11
- package/dist/solutions-components/p-506e4d78.entry.js +0 -6
- package/dist/solutions-components/p-576fdcab.entry.js +0 -6
- package/dist/solutions-components/p-5bd0cf34.entry.js +0 -23
- package/dist/solutions-components/p-65e177f1.entry.js +0 -6
- package/dist/solutions-components/p-67d710c2.entry.js +0 -6
- package/dist/solutions-components/p-7268b445.entry.js +0 -11
- package/dist/solutions-components/p-75ea4667.entry.js +0 -6
- package/dist/solutions-components/p-778c0a36.entry.js +0 -17
- package/dist/solutions-components/p-7a22509b.entry.js +0 -12
- package/dist/solutions-components/p-7bff51db.entry.js +0 -6
- package/dist/solutions-components/p-7d2d0d5d.entry.js +0 -6
- package/dist/solutions-components/p-7f0036f1.entry.js +0 -11
- package/dist/solutions-components/p-8060fb94.entry.js +0 -6
- package/dist/solutions-components/p-80a1b305.entry.js +0 -6
- package/dist/solutions-components/p-81eae877.entry.js +0 -12
- package/dist/solutions-components/p-84e86b8b.entry.js +0 -6
- package/dist/solutions-components/p-877dd0dc.entry.js +0 -18
- package/dist/solutions-components/p-9106950a.entry.js +0 -11
- package/dist/solutions-components/p-979804a4.entry.js +0 -11
- package/dist/solutions-components/p-9862baa8.entry.js +0 -11
- package/dist/solutions-components/p-9b5a9117.entry.js +0 -12
- package/dist/solutions-components/p-9deff0c2.entry.js +0 -6
- package/dist/solutions-components/p-9f400eeb.entry.js +0 -6
- package/dist/solutions-components/p-a0639ad1.entry.js +0 -11
- package/dist/solutions-components/p-a33c044e.entry.js +0 -6
- package/dist/solutions-components/p-a516c658.entry.js +0 -6
- package/dist/solutions-components/p-aa0ef36d.entry.js +0 -11
- package/dist/solutions-components/p-aaccbdf3.entry.js +0 -18
- package/dist/solutions-components/p-ab03a5c9.entry.js +0 -11
- package/dist/solutions-components/p-ad469b92.entry.js +0 -11
- package/dist/solutions-components/p-adc86ac3.entry.js +0 -6
- package/dist/solutions-components/p-addc1156.entry.js +0 -11
- package/dist/solutions-components/p-ae846934.entry.js +0 -11
- package/dist/solutions-components/p-b0572fc4.entry.js +0 -37
- package/dist/solutions-components/p-b4e476b7.js +0 -257
- package/dist/solutions-components/p-b668daf8.js +0 -21
- package/dist/solutions-components/p-b6e6eae1.entry.js +0 -6
- package/dist/solutions-components/p-bc317a7f.entry.js +0 -6
- package/dist/solutions-components/p-bd4d0773.entry.js +0 -6
- package/dist/solutions-components/p-be41429f.js +0 -21
- package/dist/solutions-components/p-bf6b6353.entry.js +0 -11
- package/dist/solutions-components/p-c2e3dfbb.entry.js +0 -11
- package/dist/solutions-components/p-c4afae53.entry.js +0 -12
- package/dist/solutions-components/p-c9da1c26.entry.js +0 -6
- package/dist/solutions-components/p-cbf8cd49.entry.js +0 -6
- package/dist/solutions-components/p-cc1a064a.entry.js +0 -11
- package/dist/solutions-components/p-d09a168c.entry.js +0 -6
- package/dist/solutions-components/p-d377f913.entry.js +0 -11
- package/dist/solutions-components/p-d4cefead.entry.js +0 -37
- package/dist/solutions-components/p-d7bc0baf.entry.js +0 -16
- package/dist/solutions-components/p-d8968487.entry.js +0 -11
- package/dist/solutions-components/p-e00a0b86.entry.js +0 -11
- package/dist/solutions-components/p-e9a7ed49.entry.js +0 -11
- package/dist/solutions-components/p-ec27e493.entry.js +0 -11
- package/dist/solutions-components/p-ed6404eb.entry.js +0 -6
- package/dist/solutions-components/p-ef21e195.entry.js +0 -23
- package/dist/solutions-components/p-f6068a2d.entry.js +0 -11
- package/dist/solutions-components/p-f6c4cff3.entry.js +0 -11
- package/dist/solutions-components/p-f847291f.entry.js +0 -6
- package/dist/solutions-components/p-f90fd262.entry.js +0 -11
- package/dist/solutions-components/p-fc973005.entry.js +0 -6
- package/dist/solutions-components/p-ff9fb6bc.entry.js +0 -11
@@ -0,0 +1,1132 @@
|
|
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 { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './p-c023e6a1.js';
|
7
|
+
import { f as filter } from './p-d48a24e6.js';
|
8
|
+
import { d as defaultMenuPlacement, f as filterComputedPlacements, c as connectFloatingUI, u as updateAfterClose, r as reposition, a as disconnectFloatingUI, F as FloatingCSS } from './p-cdc46c0c.js';
|
9
|
+
import { g as guid } from './p-a80b3880.js';
|
10
|
+
import { T as TEXT, C as ComboboxChildSelector, b as getItemAncestors, c as getItemChildren, h as hasActiveChildren, d as ComboboxItem$1, e as ComboboxItemGroup, g as getAncestors, a as getDepth } from './p-a5b1ab03.js';
|
11
|
+
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './p-bd67334c.js';
|
12
|
+
import { s as submitForm, c as connectForm, a as afterConnectDefaultValueSet, d as disconnectForm, H as HiddenFormInputSlot } from './p-316f56db.js';
|
13
|
+
import { c as createObserver } from './p-9a9955db.js';
|
14
|
+
import { u as updateHostInteraction } from './p-7daea1df.js';
|
15
|
+
import { i as isPrimaryPointerButton, t as toAriaBoolean, g as getElementProp, a as getSlotted } from './p-83166522.js';
|
16
|
+
import { c as connectOpenCloseComponent, d as disconnectOpenCloseComponent } from './p-2e9ed892.js';
|
17
|
+
import { d as debounce } from './p-4e32bf8c.js';
|
18
|
+
import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './p-ea534300.js';
|
19
|
+
import { i as getMapLayerIds, j as getMapLayerHash } from './p-1f225056.js';
|
20
|
+
import { s as state } from './p-9c1ebc90.js';
|
21
|
+
import './p-729708a3.js';
|
22
|
+
import './p-dbc9a5a8.js';
|
23
|
+
import './p-4307dacd.js';
|
24
|
+
|
25
|
+
const comboboxCss = "@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([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host{position:relative;display:block}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host([scale=s]){font-size:var(--calcite-font-size--2);--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-input-height:1.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-input-height:2rem}:host([scale=l]){font-size:var(--calcite-font-size-0);--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-input-height:2.75rem}.wrapper{display:flex;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-input);background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-1);outline-color:transparent;padding-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}:host(:focus-within) .wrapper,.wrapper--active{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.wrapper--single{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l);cursor:pointer;flex-wrap:nowrap}.grid-input{display:flex;flex-grow:1;flex-wrap:wrap;align-items:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px}.input{flex-grow:1;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-style:none;background-color:transparent;padding:0px;font-family:inherit;color:var(--calcite-ui-text-1);font-size:inherit;block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height);min-inline-size:120px;-webkit-margin-after:var(--calcite-combobox-item-spacing-unit-s);margin-block-end:var(--calcite-combobox-item-spacing-unit-s)}.input:focus{outline:2px solid transparent;outline-offset:2px}.input--transparent{opacity:0}.input--single{margin-block:0px;padding:0px}.wrapper--active .input-single{cursor:text}.input--hidden{pointer-events:none;inline-size:0px;min-inline-size:0px;opacity:0}.input--icon{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.input-wrap{display:flex;flex-grow:1}.input-wrap--single{flex:1 1 0%;overflow:hidden}.label{pointer-events:none;display:flex;max-inline-size:100%;flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:0px;font-weight:var(--calcite-font-weight-normal);block-size:var(--calcite-combobox-input-height);line-height:var(--calcite-combobox-input-height)}.label--icon{padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon-end,.icon-start{display:flex;inline-size:1rem;cursor:pointer;align-items:center}.icon-end{flex:none}.floating-ui-container{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}.floating-ui-container .calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);visibility:hidden;transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:1;border-radius:0.25rem}.floating-ui-container[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.floating-ui-container[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.floating-ui-container[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.floating-ui-container[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.floating-ui-container[data-placement] .calcite-floating-ui-anim--active{opacity:1;visibility:visible;transform:translate(0)}.floating-ui-container--active{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}@media (forced-colors: active){.wrapper,.floating-ui-container--active{border:1px solid canvasText}}.screen-readers-only{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0}.list-container{max-block-size:45vh;overflow-y:auto;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.list{margin:0px;display:block;padding:0px}.list--hide{block-size:0px;overflow:hidden}.chip{margin-block:calc(var(--calcite-combobox-item-spacing-unit-s) / 4);margin-inline:0 var(--calcite-combobox-item-spacing-unit-s);max-inline-size:100%}.chip--active{background-color:var(--calcite-ui-foreground-3)}.item{display:block}::slotted(input[slot=hidden-form-input]){margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;inset:0 !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
|
26
|
+
|
27
|
+
const isGroup = (el) => el.tagName === ComboboxItemGroup;
|
28
|
+
const itemUidPrefix = "combobox-item-";
|
29
|
+
const chipUidPrefix = "combobox-chip-";
|
30
|
+
const labelUidPrefix = "combobox-label-";
|
31
|
+
const listboxUidPrefix = "combobox-listbox-";
|
32
|
+
const inputUidPrefix = "combobox-input-";
|
33
|
+
const Combobox = class {
|
34
|
+
constructor(hostRef) {
|
35
|
+
registerInstance(this, hostRef);
|
36
|
+
this.calciteLookupChange = createEvent(this, "calciteLookupChange", 6);
|
37
|
+
this.calciteComboboxChange = createEvent(this, "calciteComboboxChange", 6);
|
38
|
+
this.calciteComboboxFilterChange = createEvent(this, "calciteComboboxFilterChange", 6);
|
39
|
+
this.calciteComboboxChipDismiss = createEvent(this, "calciteComboboxChipDismiss", 6);
|
40
|
+
this.calciteComboboxBeforeClose = createEvent(this, "calciteComboboxBeforeClose", 6);
|
41
|
+
this.calciteComboboxClose = createEvent(this, "calciteComboboxClose", 6);
|
42
|
+
this.calciteComboboxBeforeOpen = createEvent(this, "calciteComboboxBeforeOpen", 6);
|
43
|
+
this.calciteComboboxOpen = createEvent(this, "calciteComboboxOpen", 6);
|
44
|
+
//--------------------------------------------------------------------------
|
45
|
+
//
|
46
|
+
// Public Properties
|
47
|
+
//
|
48
|
+
//--------------------------------------------------------------------------
|
49
|
+
/**
|
50
|
+
* When `true`, displays and positions the component.
|
51
|
+
*
|
52
|
+
* @deprecated use `open` instead.
|
53
|
+
*/
|
54
|
+
this.active = false;
|
55
|
+
/**When `true`, displays and positions the component. */
|
56
|
+
this.open = false;
|
57
|
+
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
|
58
|
+
this.disabled = false;
|
59
|
+
/** Specifies the maximum number of `calcite-combobox-item`s (including nested children) to display before displaying a scrollbar. */
|
60
|
+
this.maxItems = 0;
|
61
|
+
/**
|
62
|
+
* Determines the type of positioning to use for the overlaid content.
|
63
|
+
*
|
64
|
+
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
65
|
+
*
|
66
|
+
* `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
67
|
+
*
|
68
|
+
*/
|
69
|
+
this.overlayPositioning = "absolute";
|
70
|
+
/**
|
71
|
+
* When `true`, the component must have a value in order for the form to submit.
|
72
|
+
*
|
73
|
+
* @internal
|
74
|
+
*/
|
75
|
+
this.required = false;
|
76
|
+
/**
|
77
|
+
* Specifies the selection mode -
|
78
|
+
* `"multi"` (allow any number of selected items),
|
79
|
+
* `"single"` (allow only one selection), or
|
80
|
+
* `"ancestors"` (like `"multi"`, but show ancestors of selected items as selected. Only the deepest children are shown in `calcite-chip`s).
|
81
|
+
*/
|
82
|
+
this.selectionMode = "multi";
|
83
|
+
/** Specifies the size of the component. */
|
84
|
+
this.scale = "m";
|
85
|
+
/** The component's value(s) from the selected `calcite-combobox-item`(s). */
|
86
|
+
this.value = null;
|
87
|
+
/**
|
88
|
+
* Accessible name for the component's remove tag when a `calcite-combobox-item` is selected.
|
89
|
+
*
|
90
|
+
* @default "Remove tag"
|
91
|
+
*/
|
92
|
+
this.intlRemoveTag = TEXT.removeTag;
|
93
|
+
//--------------------------------------------------------------------------
|
94
|
+
//
|
95
|
+
// Private State/Props
|
96
|
+
//
|
97
|
+
//--------------------------------------------------------------------------
|
98
|
+
this.placement = defaultMenuPlacement;
|
99
|
+
this.internalValueChangeFlag = false;
|
100
|
+
this.items = [];
|
101
|
+
this.groupItems = [];
|
102
|
+
this.selectedItems = [];
|
103
|
+
this.visibleItems = [];
|
104
|
+
this.activeItemIndex = -1;
|
105
|
+
this.activeChipIndex = -1;
|
106
|
+
this.activeDescendant = "";
|
107
|
+
this.text = "";
|
108
|
+
this.textInput = null;
|
109
|
+
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
110
|
+
this.resizeObserver = createObserver("resize", () => this.setMaxScrollerHeight());
|
111
|
+
this.guid = guid();
|
112
|
+
this.inputHeight = 0;
|
113
|
+
this.ignoreSelectedEventsFlag = false;
|
114
|
+
this.openTransitionProp = "opacity";
|
115
|
+
// --------------------------------------------------------------------------
|
116
|
+
//
|
117
|
+
// Private Methods
|
118
|
+
//
|
119
|
+
// --------------------------------------------------------------------------
|
120
|
+
this.setFilteredPlacements = () => {
|
121
|
+
const { el, flipPlacements } = this;
|
122
|
+
this.filteredFlipPlacements = flipPlacements
|
123
|
+
? filterComputedPlacements(flipPlacements, el)
|
124
|
+
: null;
|
125
|
+
};
|
126
|
+
this.getValue = () => {
|
127
|
+
const items = this.selectedItems.map((item) => { var _a; return (_a = item === null || item === void 0 ? void 0 : item.value) === null || _a === void 0 ? void 0 : _a.toString(); });
|
128
|
+
return (items === null || items === void 0 ? void 0 : items.length) ? (items.length > 1 ? items : items[0]) : "";
|
129
|
+
};
|
130
|
+
this.onLabelClick = () => {
|
131
|
+
this.setFocus();
|
132
|
+
};
|
133
|
+
this.keydownHandler = (event) => {
|
134
|
+
const { key } = event;
|
135
|
+
switch (key) {
|
136
|
+
case "Tab":
|
137
|
+
this.activeChipIndex = -1;
|
138
|
+
this.activeItemIndex = -1;
|
139
|
+
if (this.allowCustomValues && this.text) {
|
140
|
+
this.addCustomChip(this.text, true);
|
141
|
+
event.preventDefault();
|
142
|
+
}
|
143
|
+
else if (this.open) {
|
144
|
+
this.open = false;
|
145
|
+
event.preventDefault();
|
146
|
+
}
|
147
|
+
break;
|
148
|
+
case "ArrowLeft":
|
149
|
+
this.previousChip();
|
150
|
+
event.preventDefault();
|
151
|
+
break;
|
152
|
+
case "ArrowRight":
|
153
|
+
this.nextChip();
|
154
|
+
event.preventDefault();
|
155
|
+
break;
|
156
|
+
case "ArrowUp":
|
157
|
+
event.preventDefault();
|
158
|
+
this.shiftActiveItemIndex(-1);
|
159
|
+
if (!this.comboboxInViewport()) {
|
160
|
+
this.el.scrollIntoView();
|
161
|
+
}
|
162
|
+
break;
|
163
|
+
case "ArrowDown":
|
164
|
+
event.preventDefault();
|
165
|
+
if (!this.open) {
|
166
|
+
this.open = true;
|
167
|
+
}
|
168
|
+
this.shiftActiveItemIndex(1);
|
169
|
+
if (!this.comboboxInViewport()) {
|
170
|
+
this.el.scrollIntoView();
|
171
|
+
}
|
172
|
+
break;
|
173
|
+
case " ":
|
174
|
+
if (!this.textInput.value) {
|
175
|
+
event.preventDefault();
|
176
|
+
this.open = true;
|
177
|
+
this.shiftActiveItemIndex(1);
|
178
|
+
}
|
179
|
+
break;
|
180
|
+
case "Home":
|
181
|
+
if (!this.open) {
|
182
|
+
return;
|
183
|
+
}
|
184
|
+
event.preventDefault();
|
185
|
+
this.updateActiveItemIndex(0);
|
186
|
+
this.scrollToActiveItem();
|
187
|
+
if (!this.comboboxInViewport()) {
|
188
|
+
this.el.scrollIntoView();
|
189
|
+
}
|
190
|
+
break;
|
191
|
+
case "End":
|
192
|
+
if (!this.open) {
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
event.preventDefault();
|
196
|
+
this.updateActiveItemIndex(this.visibleItems.length - 1);
|
197
|
+
this.scrollToActiveItem();
|
198
|
+
if (!this.comboboxInViewport()) {
|
199
|
+
this.el.scrollIntoView();
|
200
|
+
}
|
201
|
+
break;
|
202
|
+
case "Escape":
|
203
|
+
this.open = false;
|
204
|
+
event.preventDefault();
|
205
|
+
break;
|
206
|
+
case "Enter":
|
207
|
+
if (this.activeItemIndex > -1) {
|
208
|
+
this.toggleSelection(this.visibleItems[this.activeItemIndex]);
|
209
|
+
event.preventDefault();
|
210
|
+
}
|
211
|
+
else if (this.activeChipIndex > -1) {
|
212
|
+
this.removeActiveChip();
|
213
|
+
event.preventDefault();
|
214
|
+
}
|
215
|
+
else if (this.allowCustomValues && this.text) {
|
216
|
+
this.addCustomChip(this.text, true);
|
217
|
+
event.preventDefault();
|
218
|
+
}
|
219
|
+
else if (!event.defaultPrevented) {
|
220
|
+
if (submitForm(this)) {
|
221
|
+
event.preventDefault();
|
222
|
+
}
|
223
|
+
}
|
224
|
+
break;
|
225
|
+
case "Delete":
|
226
|
+
case "Backspace":
|
227
|
+
if (this.activeChipIndex > -1) {
|
228
|
+
event.preventDefault();
|
229
|
+
this.removeActiveChip();
|
230
|
+
}
|
231
|
+
else if (!this.text && this.isMulti()) {
|
232
|
+
event.preventDefault();
|
233
|
+
this.removeLastChip();
|
234
|
+
}
|
235
|
+
break;
|
236
|
+
}
|
237
|
+
};
|
238
|
+
this.toggleCloseEnd = () => {
|
239
|
+
this.open = false;
|
240
|
+
this.el.removeEventListener("calciteComboboxClose", this.toggleCloseEnd);
|
241
|
+
};
|
242
|
+
this.toggleOpenEnd = () => {
|
243
|
+
this.open = false;
|
244
|
+
this.el.removeEventListener("calciteComboboxOpen", this.toggleOpenEnd);
|
245
|
+
};
|
246
|
+
this.setMaxScrollerHeight = async () => {
|
247
|
+
const { listContainerEl, open, referenceEl } = this;
|
248
|
+
if (!listContainerEl || !open) {
|
249
|
+
return;
|
250
|
+
}
|
251
|
+
await this.reposition(true);
|
252
|
+
const maxScrollerHeight = this.getMaxScrollerHeight();
|
253
|
+
listContainerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
|
254
|
+
listContainerEl.style.minWidth = `${referenceEl.clientWidth}px`;
|
255
|
+
await this.reposition(true);
|
256
|
+
};
|
257
|
+
this.calciteChipDismissHandler = (event, comboboxItem) => {
|
258
|
+
this.open = false;
|
259
|
+
const selection = this.items.find((item) => item === comboboxItem);
|
260
|
+
if (selection) {
|
261
|
+
this.toggleSelection(selection, false);
|
262
|
+
}
|
263
|
+
this.calciteComboboxChipDismiss.emit(event.detail);
|
264
|
+
};
|
265
|
+
this.clickHandler = (event) => {
|
266
|
+
if (event.composedPath().some((node) => node.tagName === "CALCITE-CHIP")) {
|
267
|
+
return;
|
268
|
+
}
|
269
|
+
this.open = !this.open;
|
270
|
+
this.updateActiveItemIndex(0);
|
271
|
+
this.setFocus();
|
272
|
+
};
|
273
|
+
this.setInactiveIfNotContained = (event) => {
|
274
|
+
const composedPath = event.composedPath();
|
275
|
+
if (!this.open || composedPath.includes(this.el) || composedPath.includes(this.referenceEl)) {
|
276
|
+
return;
|
277
|
+
}
|
278
|
+
if (this.allowCustomValues && this.text.trim().length) {
|
279
|
+
this.addCustomChip(this.text);
|
280
|
+
}
|
281
|
+
if (this.selectionMode === "single") {
|
282
|
+
if (this.textInput) {
|
283
|
+
this.textInput.value = "";
|
284
|
+
}
|
285
|
+
this.text = "";
|
286
|
+
this.filterItems("");
|
287
|
+
this.updateActiveItemIndex(-1);
|
288
|
+
}
|
289
|
+
this.open = false;
|
290
|
+
};
|
291
|
+
this.setFloatingEl = (el) => {
|
292
|
+
this.floatingEl = el;
|
293
|
+
connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
294
|
+
};
|
295
|
+
this.setContainerEl = (el) => {
|
296
|
+
this.resizeObserver.observe(el);
|
297
|
+
this.listContainerEl = el;
|
298
|
+
this.transitionEl = el;
|
299
|
+
connectOpenCloseComponent(this);
|
300
|
+
};
|
301
|
+
this.setReferenceEl = (el) => {
|
302
|
+
this.referenceEl = el;
|
303
|
+
connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
304
|
+
};
|
305
|
+
this.inputHandler = (event) => {
|
306
|
+
const value = event.target.value;
|
307
|
+
this.text = value;
|
308
|
+
this.filterItems(value);
|
309
|
+
if (value) {
|
310
|
+
this.activeChipIndex = -1;
|
311
|
+
}
|
312
|
+
};
|
313
|
+
this.filterItems = (() => {
|
314
|
+
const find = (item, filteredData) => item &&
|
315
|
+
filteredData.some(({ label, value }) => {
|
316
|
+
if (isGroup(item)) {
|
317
|
+
return value === item.label;
|
318
|
+
}
|
319
|
+
return (value === item.textLabel ||
|
320
|
+
value === item.value ||
|
321
|
+
label === item.textLabel ||
|
322
|
+
label === item.value);
|
323
|
+
});
|
324
|
+
return debounce((text) => {
|
325
|
+
const filteredData = filter(this.data, text);
|
326
|
+
const items = this.getCombinedItems();
|
327
|
+
items.forEach((item) => {
|
328
|
+
const hidden = !find(item, filteredData);
|
329
|
+
item.hidden = hidden;
|
330
|
+
const [parent, grandparent] = item.ancestors;
|
331
|
+
if (find(parent, filteredData) || find(grandparent, filteredData)) {
|
332
|
+
item.hidden = false;
|
333
|
+
}
|
334
|
+
if (!hidden) {
|
335
|
+
item.ancestors.forEach((ancestor) => (ancestor.hidden = false));
|
336
|
+
}
|
337
|
+
});
|
338
|
+
this.visibleItems = this.getVisibleItems();
|
339
|
+
this.calciteComboboxFilterChange.emit({ visibleItems: [...this.visibleItems], text: text });
|
340
|
+
}, 100);
|
341
|
+
})();
|
342
|
+
this.internalCalciteLookupChangeEvent = () => {
|
343
|
+
this.calciteLookupChange.emit(this.selectedItems);
|
344
|
+
};
|
345
|
+
this.emitCalciteLookupChange = debounce(this.internalCalciteLookupChangeEvent, 0);
|
346
|
+
this.internalComboboxChangeEvent = () => {
|
347
|
+
const { selectedItems } = this;
|
348
|
+
this.calciteComboboxChange.emit({ selectedItems });
|
349
|
+
};
|
350
|
+
this.emitComboboxChange = debounce(this.internalComboboxChangeEvent, 0);
|
351
|
+
this.updateItems = () => {
|
352
|
+
this.items = this.getItems();
|
353
|
+
this.groupItems = this.getGroupItems();
|
354
|
+
this.data = this.getData();
|
355
|
+
this.selectedItems = this.getSelectedItems();
|
356
|
+
this.visibleItems = this.getVisibleItems();
|
357
|
+
this.needsIcon = this.getNeedsIcon();
|
358
|
+
if (!this.allowCustomValues) {
|
359
|
+
this.setMaxScrollerHeight();
|
360
|
+
}
|
361
|
+
};
|
362
|
+
this.scrollToActiveItem = () => {
|
363
|
+
const activeItem = this.visibleItems[this.activeItemIndex];
|
364
|
+
const height = this.calculateSingleItemHeight(activeItem);
|
365
|
+
const { offsetHeight, scrollTop } = this.listContainerEl;
|
366
|
+
if (offsetHeight + scrollTop < activeItem.offsetTop + height) {
|
367
|
+
this.listContainerEl.scrollTop = activeItem.offsetTop - offsetHeight + height;
|
368
|
+
}
|
369
|
+
else if (activeItem.offsetTop < scrollTop) {
|
370
|
+
this.listContainerEl.scrollTop = activeItem.offsetTop;
|
371
|
+
}
|
372
|
+
};
|
373
|
+
this.comboboxFocusHandler = () => {
|
374
|
+
var _a;
|
375
|
+
(_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
|
376
|
+
};
|
377
|
+
this.comboboxBlurHandler = (event) => {
|
378
|
+
this.setInactiveIfNotContained(event);
|
379
|
+
};
|
380
|
+
}
|
381
|
+
activeHandler(value) {
|
382
|
+
if (this.disabled) {
|
383
|
+
this.active = false;
|
384
|
+
this.open = false;
|
385
|
+
return;
|
386
|
+
}
|
387
|
+
this.open = value;
|
388
|
+
}
|
389
|
+
openHandler(value) {
|
390
|
+
if (!value) {
|
391
|
+
updateAfterClose(this.floatingEl);
|
392
|
+
}
|
393
|
+
if (this.disabled) {
|
394
|
+
this.active = false;
|
395
|
+
this.open = false;
|
396
|
+
return;
|
397
|
+
}
|
398
|
+
this.active = value;
|
399
|
+
this.setMaxScrollerHeight();
|
400
|
+
}
|
401
|
+
handleDisabledChange(value) {
|
402
|
+
if (!value) {
|
403
|
+
this.active = false;
|
404
|
+
this.open = false;
|
405
|
+
}
|
406
|
+
}
|
407
|
+
maxItemsHandler() {
|
408
|
+
this.setMaxScrollerHeight();
|
409
|
+
}
|
410
|
+
overlayPositioningHandler() {
|
411
|
+
this.reposition(true);
|
412
|
+
}
|
413
|
+
valueHandler(value) {
|
414
|
+
if (!this.internalValueChangeFlag) {
|
415
|
+
const items = this.getItems();
|
416
|
+
if (Array.isArray(value)) {
|
417
|
+
items.forEach((item) => (item.selected = value.includes(item.value)));
|
418
|
+
}
|
419
|
+
else if (value) {
|
420
|
+
items.forEach((item) => (item.selected = value === item.value));
|
421
|
+
}
|
422
|
+
else {
|
423
|
+
items.forEach((item) => (item.selected = false));
|
424
|
+
}
|
425
|
+
this.updateItems();
|
426
|
+
}
|
427
|
+
}
|
428
|
+
flipPlacementsHandler() {
|
429
|
+
this.setFilteredPlacements();
|
430
|
+
this.reposition(true);
|
431
|
+
}
|
432
|
+
//--------------------------------------------------------------------------
|
433
|
+
//
|
434
|
+
// Event Listeners
|
435
|
+
//
|
436
|
+
//--------------------------------------------------------------------------
|
437
|
+
documentClickHandler(event) {
|
438
|
+
if (!isPrimaryPointerButton(event)) {
|
439
|
+
return;
|
440
|
+
}
|
441
|
+
this.setInactiveIfNotContained(event);
|
442
|
+
}
|
443
|
+
calciteComboboxItemChangeHandler(event) {
|
444
|
+
if (this.ignoreSelectedEventsFlag) {
|
445
|
+
return;
|
446
|
+
}
|
447
|
+
const target = event.target;
|
448
|
+
const newIndex = this.visibleItems.indexOf(target);
|
449
|
+
this.updateActiveItemIndex(newIndex);
|
450
|
+
this.toggleSelection(target, target.selected);
|
451
|
+
}
|
452
|
+
//--------------------------------------------------------------------------
|
453
|
+
//
|
454
|
+
// Public Methods
|
455
|
+
//
|
456
|
+
//--------------------------------------------------------------------------
|
457
|
+
/**
|
458
|
+
* Updates the position of the component.
|
459
|
+
*
|
460
|
+
* @param delayed
|
461
|
+
*/
|
462
|
+
async reposition(delayed = false) {
|
463
|
+
const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
|
464
|
+
return reposition(this, {
|
465
|
+
floatingEl,
|
466
|
+
referenceEl,
|
467
|
+
overlayPositioning,
|
468
|
+
placement,
|
469
|
+
flipPlacements: filteredFlipPlacements,
|
470
|
+
type: "menu"
|
471
|
+
}, delayed);
|
472
|
+
}
|
473
|
+
/** Sets focus on the component. */
|
474
|
+
async setFocus() {
|
475
|
+
var _a;
|
476
|
+
(_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
|
477
|
+
this.activeChipIndex = -1;
|
478
|
+
this.activeItemIndex = -1;
|
479
|
+
}
|
480
|
+
// --------------------------------------------------------------------------
|
481
|
+
//
|
482
|
+
// Lifecycle
|
483
|
+
//
|
484
|
+
// --------------------------------------------------------------------------
|
485
|
+
connectedCallback() {
|
486
|
+
var _a;
|
487
|
+
this.internalValueChangeFlag = true;
|
488
|
+
this.value = this.getValue();
|
489
|
+
this.internalValueChangeFlag = false;
|
490
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
491
|
+
connectLabel(this);
|
492
|
+
connectForm(this);
|
493
|
+
connectOpenCloseComponent(this);
|
494
|
+
this.setFilteredPlacements();
|
495
|
+
this.reposition(true);
|
496
|
+
if (this.active) {
|
497
|
+
this.activeHandler(this.active);
|
498
|
+
}
|
499
|
+
if (this.open) {
|
500
|
+
this.openHandler(this.open);
|
501
|
+
}
|
502
|
+
}
|
503
|
+
componentWillLoad() {
|
504
|
+
this.updateItems();
|
505
|
+
}
|
506
|
+
componentDidLoad() {
|
507
|
+
afterConnectDefaultValueSet(this, this.getValue());
|
508
|
+
this.reposition(true);
|
509
|
+
}
|
510
|
+
componentDidRender() {
|
511
|
+
if (this.el.offsetHeight !== this.inputHeight) {
|
512
|
+
this.reposition(true);
|
513
|
+
this.inputHeight = this.el.offsetHeight;
|
514
|
+
}
|
515
|
+
updateHostInteraction(this);
|
516
|
+
}
|
517
|
+
disconnectedCallback() {
|
518
|
+
var _a, _b;
|
519
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
520
|
+
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
521
|
+
disconnectLabel(this);
|
522
|
+
disconnectForm(this);
|
523
|
+
disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
|
524
|
+
disconnectOpenCloseComponent(this);
|
525
|
+
}
|
526
|
+
selectedItemsHandler() {
|
527
|
+
this.internalValueChangeFlag = true;
|
528
|
+
this.value = this.getValue();
|
529
|
+
this.internalValueChangeFlag = false;
|
530
|
+
}
|
531
|
+
/** when search text is cleared, reset active to */
|
532
|
+
textHandler() {
|
533
|
+
this.updateActiveItemIndex(-1);
|
534
|
+
}
|
535
|
+
comboboxInViewport() {
|
536
|
+
const bounding = this.el.getBoundingClientRect();
|
537
|
+
return (bounding.top >= 0 &&
|
538
|
+
bounding.left >= 0 &&
|
539
|
+
bounding.right <= (window.innerWidth || document.documentElement.clientWidth) &&
|
540
|
+
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight));
|
541
|
+
}
|
542
|
+
onBeforeOpen() {
|
543
|
+
this.calciteComboboxBeforeOpen.emit();
|
544
|
+
}
|
545
|
+
onOpen() {
|
546
|
+
this.calciteComboboxOpen.emit();
|
547
|
+
}
|
548
|
+
onBeforeClose() {
|
549
|
+
this.calciteComboboxBeforeClose.emit();
|
550
|
+
}
|
551
|
+
onClose() {
|
552
|
+
this.calciteComboboxClose.emit();
|
553
|
+
}
|
554
|
+
getMaxScrollerHeight() {
|
555
|
+
const items = this.getCombinedItems().filter((item) => !item.hidden);
|
556
|
+
const { maxItems } = this;
|
557
|
+
let itemsToProcess = 0;
|
558
|
+
let maxScrollerHeight = 0;
|
559
|
+
if (items.length > maxItems) {
|
560
|
+
items.forEach((item) => {
|
561
|
+
if (itemsToProcess < maxItems && maxItems > 0) {
|
562
|
+
const height = this.calculateSingleItemHeight(item);
|
563
|
+
if (height > 0) {
|
564
|
+
maxScrollerHeight += height;
|
565
|
+
itemsToProcess++;
|
566
|
+
}
|
567
|
+
}
|
568
|
+
});
|
569
|
+
}
|
570
|
+
return maxScrollerHeight;
|
571
|
+
}
|
572
|
+
calculateSingleItemHeight(item) {
|
573
|
+
let height = item.offsetHeight;
|
574
|
+
// if item has children items, don't count their height twice
|
575
|
+
const children = Array.from(item.querySelectorAll(ComboboxChildSelector));
|
576
|
+
children
|
577
|
+
.map((child) => child === null || child === void 0 ? void 0 : child.offsetHeight)
|
578
|
+
.forEach((offsetHeight) => {
|
579
|
+
height -= offsetHeight;
|
580
|
+
});
|
581
|
+
return height;
|
582
|
+
}
|
583
|
+
getCombinedItems() {
|
584
|
+
return [...this.groupItems, ...this.items];
|
585
|
+
}
|
586
|
+
toggleSelection(item, value = !item.selected) {
|
587
|
+
if (!item) {
|
588
|
+
return;
|
589
|
+
}
|
590
|
+
if (this.isMulti()) {
|
591
|
+
item.selected = value;
|
592
|
+
this.updateAncestors(item);
|
593
|
+
this.selectedItems = this.getSelectedItems();
|
594
|
+
this.emitCalciteLookupChange();
|
595
|
+
this.emitComboboxChange();
|
596
|
+
this.resetText();
|
597
|
+
this.filterItems("");
|
598
|
+
}
|
599
|
+
else {
|
600
|
+
this.ignoreSelectedEventsFlag = true;
|
601
|
+
this.items.forEach((el) => (el.selected = el === item ? value : false));
|
602
|
+
this.ignoreSelectedEventsFlag = false;
|
603
|
+
this.selectedItems = this.getSelectedItems();
|
604
|
+
this.emitComboboxChange();
|
605
|
+
if (this.textInput) {
|
606
|
+
this.textInput.value = item.textLabel;
|
607
|
+
}
|
608
|
+
this.open = false;
|
609
|
+
this.updateActiveItemIndex(-1);
|
610
|
+
this.resetText();
|
611
|
+
this.filterItems("");
|
612
|
+
}
|
613
|
+
}
|
614
|
+
updateAncestors(item) {
|
615
|
+
if (this.selectionMode !== "ancestors") {
|
616
|
+
return;
|
617
|
+
}
|
618
|
+
const ancestors = getItemAncestors(item);
|
619
|
+
const children = getItemChildren(item);
|
620
|
+
if (item.selected) {
|
621
|
+
ancestors.forEach((el) => {
|
622
|
+
el.selected = true;
|
623
|
+
});
|
624
|
+
}
|
625
|
+
else {
|
626
|
+
children.forEach((el) => (el.selected = false));
|
627
|
+
[...ancestors].forEach((el) => {
|
628
|
+
if (!hasActiveChildren(el)) {
|
629
|
+
el.selected = false;
|
630
|
+
}
|
631
|
+
});
|
632
|
+
}
|
633
|
+
}
|
634
|
+
getVisibleItems() {
|
635
|
+
return this.items.filter((item) => !item.hidden);
|
636
|
+
}
|
637
|
+
getSelectedItems() {
|
638
|
+
if (!this.isMulti()) {
|
639
|
+
const match = this.items.find(({ selected }) => selected);
|
640
|
+
return match ? [match] : [];
|
641
|
+
}
|
642
|
+
return (this.items
|
643
|
+
.filter((item) => item.selected && (this.selectionMode !== "ancestors" || !hasActiveChildren(item)))
|
644
|
+
/** Preserve order of entered tags */
|
645
|
+
.sort((a, b) => {
|
646
|
+
const aIdx = this.selectedItems.indexOf(a);
|
647
|
+
const bIdx = this.selectedItems.indexOf(b);
|
648
|
+
if (aIdx > -1 && bIdx > -1) {
|
649
|
+
return aIdx - bIdx;
|
650
|
+
}
|
651
|
+
return bIdx - aIdx;
|
652
|
+
}));
|
653
|
+
}
|
654
|
+
getData() {
|
655
|
+
return this.items.map((item) => ({
|
656
|
+
constant: item.constant,
|
657
|
+
filterDisabled: item.filterDisabled,
|
658
|
+
value: item.value,
|
659
|
+
label: item.textLabel
|
660
|
+
}));
|
661
|
+
}
|
662
|
+
getNeedsIcon() {
|
663
|
+
return this.selectionMode === "single" && this.items.some((item) => item.icon);
|
664
|
+
}
|
665
|
+
resetText() {
|
666
|
+
if (this.textInput) {
|
667
|
+
this.textInput.value = "";
|
668
|
+
}
|
669
|
+
this.text = "";
|
670
|
+
}
|
671
|
+
getItems() {
|
672
|
+
const items = Array.from(this.el.querySelectorAll(ComboboxItem$1));
|
673
|
+
return items.filter((item) => !item.disabled);
|
674
|
+
}
|
675
|
+
getGroupItems() {
|
676
|
+
return Array.from(this.el.querySelectorAll(ComboboxItemGroup));
|
677
|
+
}
|
678
|
+
addCustomChip(value, focus) {
|
679
|
+
const existingItem = this.items.find((el) => el.textLabel === value);
|
680
|
+
if (existingItem) {
|
681
|
+
this.toggleSelection(existingItem, true);
|
682
|
+
}
|
683
|
+
else {
|
684
|
+
if (!this.isMulti()) {
|
685
|
+
this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
|
686
|
+
}
|
687
|
+
const item = document.createElement(ComboboxItem$1);
|
688
|
+
item.value = value;
|
689
|
+
item.textLabel = value;
|
690
|
+
item.selected = true;
|
691
|
+
this.el.appendChild(item);
|
692
|
+
this.resetText();
|
693
|
+
if (focus) {
|
694
|
+
this.setFocus();
|
695
|
+
}
|
696
|
+
this.updateItems();
|
697
|
+
this.filterItems("");
|
698
|
+
this.emitCalciteLookupChange();
|
699
|
+
this.emitComboboxChange();
|
700
|
+
}
|
701
|
+
}
|
702
|
+
removeActiveChip() {
|
703
|
+
this.toggleSelection(this.selectedItems[this.activeChipIndex], false);
|
704
|
+
this.setFocus();
|
705
|
+
}
|
706
|
+
removeLastChip() {
|
707
|
+
this.toggleSelection(this.selectedItems[this.selectedItems.length - 1], false);
|
708
|
+
this.setFocus();
|
709
|
+
}
|
710
|
+
previousChip() {
|
711
|
+
if (this.text) {
|
712
|
+
return;
|
713
|
+
}
|
714
|
+
const length = this.selectedItems.length - 1;
|
715
|
+
const active = this.activeChipIndex;
|
716
|
+
this.activeChipIndex = active === -1 ? length : Math.max(active - 1, 0);
|
717
|
+
this.updateActiveItemIndex(-1);
|
718
|
+
this.focusChip();
|
719
|
+
}
|
720
|
+
nextChip() {
|
721
|
+
if (this.text || this.activeChipIndex === -1) {
|
722
|
+
return;
|
723
|
+
}
|
724
|
+
const last = this.selectedItems.length - 1;
|
725
|
+
const newIndex = this.activeChipIndex + 1;
|
726
|
+
if (newIndex > last) {
|
727
|
+
this.activeChipIndex = -1;
|
728
|
+
this.setFocus();
|
729
|
+
}
|
730
|
+
else {
|
731
|
+
this.activeChipIndex = newIndex;
|
732
|
+
this.focusChip();
|
733
|
+
}
|
734
|
+
this.updateActiveItemIndex(-1);
|
735
|
+
}
|
736
|
+
focusChip() {
|
737
|
+
var _a;
|
738
|
+
const guid = (_a = this.selectedItems[this.activeChipIndex]) === null || _a === void 0 ? void 0 : _a.guid;
|
739
|
+
const chip = guid
|
740
|
+
? this.referenceEl.querySelector(`#${chipUidPrefix}${guid}`)
|
741
|
+
: null;
|
742
|
+
chip === null || chip === void 0 ? void 0 : chip.setFocus();
|
743
|
+
}
|
744
|
+
shiftActiveItemIndex(delta) {
|
745
|
+
const { length } = this.visibleItems;
|
746
|
+
const newIndex = (this.activeItemIndex + length + delta) % length;
|
747
|
+
this.updateActiveItemIndex(newIndex);
|
748
|
+
this.scrollToActiveItem();
|
749
|
+
}
|
750
|
+
updateActiveItemIndex(index) {
|
751
|
+
var _a;
|
752
|
+
this.activeItemIndex = index;
|
753
|
+
let activeDescendant = null;
|
754
|
+
this.visibleItems.forEach((el, i) => {
|
755
|
+
if (i === index) {
|
756
|
+
el.active = true;
|
757
|
+
activeDescendant = `${itemUidPrefix}${el.guid}`;
|
758
|
+
}
|
759
|
+
else {
|
760
|
+
el.active = false;
|
761
|
+
}
|
762
|
+
});
|
763
|
+
this.activeDescendant = activeDescendant;
|
764
|
+
if (this.activeItemIndex > -1) {
|
765
|
+
this.activeChipIndex = -1;
|
766
|
+
(_a = this.textInput) === null || _a === void 0 ? void 0 : _a.focus();
|
767
|
+
}
|
768
|
+
}
|
769
|
+
isMulti() {
|
770
|
+
return this.selectionMode !== "single";
|
771
|
+
}
|
772
|
+
//--------------------------------------------------------------------------
|
773
|
+
//
|
774
|
+
// Render Methods
|
775
|
+
//
|
776
|
+
//--------------------------------------------------------------------------
|
777
|
+
renderChips() {
|
778
|
+
const { activeChipIndex, scale, selectionMode, intlRemoveTag } = this;
|
779
|
+
return this.selectedItems.map((item, i) => {
|
780
|
+
const chipClasses = {
|
781
|
+
chip: true,
|
782
|
+
"chip--active": activeChipIndex === i
|
783
|
+
};
|
784
|
+
const ancestors = [...getItemAncestors(item)].reverse();
|
785
|
+
const pathLabel = [...ancestors, item].map((el) => el.textLabel);
|
786
|
+
const label = selectionMode !== "ancestors" ? item.textLabel : pathLabel.join(" / ");
|
787
|
+
return (h("calcite-chip", { class: chipClasses, dismissLabel: intlRemoveTag, dismissible: true, icon: item.icon, id: item.guid ? `${chipUidPrefix}${item.guid}` : null, key: item.textLabel, onCalciteChipDismiss: (event) => this.calciteChipDismissHandler(event, item), scale: scale, title: label, value: item.value }, label));
|
788
|
+
});
|
789
|
+
}
|
790
|
+
renderInput() {
|
791
|
+
const { guid, active, disabled, placeholder, selectionMode, selectedItems, open } = this;
|
792
|
+
const single = selectionMode === "single";
|
793
|
+
const selectedItem = selectedItems[0];
|
794
|
+
const showLabel = !(open || active) && single && !!selectedItem;
|
795
|
+
return (h("span", { class: {
|
796
|
+
"input-wrap": true,
|
797
|
+
"input-wrap--single": single
|
798
|
+
} }, showLabel && (h("span", { class: {
|
799
|
+
label: true,
|
800
|
+
"label--icon": !!(selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon)
|
801
|
+
}, key: "label" }, selectedItem.textLabel)), h("input", { "aria-activedescendant": this.activeDescendant, "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-label": getLabelText(this), class: {
|
802
|
+
input: true,
|
803
|
+
"input--single": true,
|
804
|
+
"input--transparent": this.activeChipIndex > -1,
|
805
|
+
"input--hidden": showLabel,
|
806
|
+
"input--icon": !!this.placeholderIcon
|
807
|
+
}, disabled: disabled, id: `${inputUidPrefix}${guid}`, key: "input", onBlur: this.comboboxBlurHandler, onFocus: this.comboboxFocusHandler, onInput: this.inputHandler, placeholder: placeholder, ref: (el) => (this.textInput = el), type: "text" })));
|
808
|
+
}
|
809
|
+
renderListBoxOptions() {
|
810
|
+
return this.visibleItems.map((item) => (h("li", { "aria-selected": toAriaBoolean(item.selected), id: item.guid ? `${itemUidPrefix}${item.guid}` : null, role: "option", tabindex: "-1" }, item.textLabel)));
|
811
|
+
}
|
812
|
+
renderFloatingUIContainer() {
|
813
|
+
const { active, setFloatingEl, setContainerEl, open } = this;
|
814
|
+
const classes = {
|
815
|
+
"list-container": true,
|
816
|
+
[FloatingCSS.animation]: true,
|
817
|
+
[FloatingCSS.animationActive]: open || active
|
818
|
+
};
|
819
|
+
return (h("div", { "aria-hidden": "true", class: {
|
820
|
+
"floating-ui-container": true,
|
821
|
+
"floating-ui-container--active": open || active
|
822
|
+
}, ref: setFloatingEl }, h("div", { class: classes, ref: setContainerEl }, h("ul", { class: { list: true, "list--hide": !(open || active) } }, h("slot", null)))));
|
823
|
+
}
|
824
|
+
renderIconStart() {
|
825
|
+
const { selectedItems, placeholderIcon, selectionMode } = this;
|
826
|
+
const selectedItem = selectedItems[0];
|
827
|
+
const selectedIcon = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.icon;
|
828
|
+
const singleSelectionMode = selectionMode === "single";
|
829
|
+
const iconAtStart = !this.open && selectedItem
|
830
|
+
? !!selectedIcon && singleSelectionMode
|
831
|
+
: !!this.placeholderIcon && (!selectedItem || singleSelectionMode);
|
832
|
+
return (iconAtStart && (h("span", { class: "icon-start" }, h("calcite-icon", { class: "selected-icon", icon: !this.open && selectedItem ? selectedIcon : placeholderIcon, scale: "s" }))));
|
833
|
+
}
|
834
|
+
renderIconEnd() {
|
835
|
+
const { active, open } = this;
|
836
|
+
return (h("span", { class: "icon-end" }, h("calcite-icon", { icon: active || open ? "chevron-up" : "chevron-down", scale: "s" })));
|
837
|
+
}
|
838
|
+
render() {
|
839
|
+
const { active, guid, label, open } = this;
|
840
|
+
const single = this.selectionMode === "single";
|
841
|
+
return (h(Host, null, h("div", { "aria-autocomplete": "list", "aria-controls": `${listboxUidPrefix}${guid}`, "aria-expanded": toAriaBoolean(open || active), "aria-haspopup": "listbox", "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-live": "polite", "aria-owns": `${listboxUidPrefix}${guid}`, class: {
|
842
|
+
wrapper: true,
|
843
|
+
"wrapper--single": single || !this.selectedItems.length,
|
844
|
+
"wrapper--active": open || active
|
845
|
+
}, onClick: this.clickHandler, onKeyDown: this.keydownHandler, ref: this.setReferenceEl, role: "combobox" }, h("div", { class: "grid-input" }, this.renderIconStart(), !single && this.renderChips(), h("label", { class: "screen-readers-only", htmlFor: `${inputUidPrefix}${guid}`, id: `${labelUidPrefix}${guid}` }, label), this.renderInput()), this.renderIconEnd()), h("ul", { "aria-labelledby": `${labelUidPrefix}${guid}`, "aria-multiselectable": "true", class: "screen-readers-only", id: `${listboxUidPrefix}${guid}`, role: "listbox", tabIndex: -1 }, this.renderListBoxOptions()), this.renderFloatingUIContainer(), h(HiddenFormInputSlot, { component: this })));
|
846
|
+
}
|
847
|
+
get el() { return getElement(this); }
|
848
|
+
static get watchers() { return {
|
849
|
+
"active": ["activeHandler"],
|
850
|
+
"open": ["openHandler"],
|
851
|
+
"disabled": ["handleDisabledChange"],
|
852
|
+
"maxItems": ["maxItemsHandler"],
|
853
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
854
|
+
"value": ["valueHandler"],
|
855
|
+
"flipPlacements": ["flipPlacementsHandler"],
|
856
|
+
"selectedItems": ["selectedItemsHandler"],
|
857
|
+
"text": ["textHandler"]
|
858
|
+
}; }
|
859
|
+
};
|
860
|
+
Combobox.style = comboboxCss;
|
861
|
+
|
862
|
+
/*!
|
863
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
864
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
865
|
+
* v1.0.0-beta.97
|
866
|
+
*/
|
867
|
+
const CSS = {
|
868
|
+
icon: "icon",
|
869
|
+
iconActive: "icon--active",
|
870
|
+
custom: "icon--custom",
|
871
|
+
dot: "icon--dot",
|
872
|
+
single: "label--single",
|
873
|
+
label: "label",
|
874
|
+
active: "label--active",
|
875
|
+
selected: "label--selected",
|
876
|
+
title: "title",
|
877
|
+
textContainer: "text-container"
|
878
|
+
};
|
879
|
+
|
880
|
+
const comboboxItemCss = "@charset \"UTF-8\";@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([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}.scale--s{font-size:var(--calcite-font-size--2);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.5rem;--calcite-combobox-item-spacing-unit-s:0.25rem;--calcite-combobox-item-spacing-indent:0.5rem}.scale--m{font-size:var(--calcite-font-size--1);line-height:1rem;--calcite-combobox-item-spacing-unit-l:0.75rem;--calcite-combobox-item-spacing-unit-s:0.5rem;--calcite-combobox-item-spacing-indent:0.75rem}.scale--l{font-size:var(--calcite-font-size-0);line-height:1.25rem;--calcite-combobox-item-spacing-unit-l:1rem;--calcite-combobox-item-spacing-unit-s:0.75rem;--calcite-combobox-item-spacing-indent:1rem}.container{--calcite-combobox-item-indent-value:calc(\n var(--calcite-combobox-item-spacing-indent) * var(--calcite-combobox-item-spacing-indent-multiplier)\n )}:host(:focus){--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host,ul{margin:0px;display:flex;flex-direction:column;padding:0px}:host(:focus),ul:focus{outline:2px solid transparent;outline-offset:2px}.label{position:relative;box-sizing:border-box;display:flex;inline-size:100%;min-inline-size:100%;cursor:pointer;align-items:center;color:var(--calcite-ui-text-3);-webkit-text-decoration-line:none;text-decoration-line:none;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);outline-color:transparent;padding-block:var(--calcite-combobox-item-spacing-unit-s);padding-inline:var(--calcite-combobox-item-spacing-unit-l)}:host([disabled]) .label{cursor:default}.label--selected{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.label--active{outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}.label:hover,.label:active{background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1);-webkit-text-decoration-line:none;text-decoration-line:none;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.title{padding-block:0;padding-inline:var(--calcite-combobox-item-spacing-unit-l)}.icon{display:inline-flex;opacity:0;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);color:var(--calcite-ui-border-1)}.icon--indent{-webkit-padding-start:var(--calcite-combobox-item-indent-value);padding-inline-start:var(--calcite-combobox-item-indent-value)}.icon--custom{-webkit-margin-before:-1px;margin-block-start:-1px;color:var(--calcite-ui-text-3)}.icon--active{color:var(--calcite-ui-text-1)}.icon--dot{display:flex;justify-content:flex-end;min-inline-size:var(--calcite-combobox-item-spacing-unit-l)}.icon--dot:before{text-align:start;content:\"•\"}.label--active .icon{opacity:1}.label--selected .icon{opacity:1;color:var(--calcite-ui-brand)}:host(:hover[disabled]) .icon{opacity:1}";
|
881
|
+
|
882
|
+
const ComboboxItem = class {
|
883
|
+
constructor(hostRef) {
|
884
|
+
registerInstance(this, hostRef);
|
885
|
+
this.calciteComboboxItemChange = createEvent(this, "calciteComboboxItemChange", 6);
|
886
|
+
// --------------------------------------------------------------------------
|
887
|
+
//
|
888
|
+
// Properties
|
889
|
+
//
|
890
|
+
// --------------------------------------------------------------------------
|
891
|
+
/** When `true`, interaction is prevented and the component is displayed with lower opacity. */
|
892
|
+
this.disabled = false;
|
893
|
+
/**
|
894
|
+
* When `true`, the component is selected.
|
895
|
+
*/
|
896
|
+
this.selected = false;
|
897
|
+
/** When `true`, the component is active. */
|
898
|
+
this.active = false;
|
899
|
+
/** The `id` attribute of the component. When omitted, a globally unique identifier is used. */
|
900
|
+
this.guid = guid();
|
901
|
+
this.scale = "m";
|
902
|
+
// --------------------------------------------------------------------------
|
903
|
+
//
|
904
|
+
// Private Methods
|
905
|
+
//
|
906
|
+
// --------------------------------------------------------------------------
|
907
|
+
this.itemClickHandler = (event) => {
|
908
|
+
event.preventDefault();
|
909
|
+
if (this.disabled) {
|
910
|
+
return;
|
911
|
+
}
|
912
|
+
this.selected = !this.selected;
|
913
|
+
};
|
914
|
+
}
|
915
|
+
selectedWatchHandler() {
|
916
|
+
this.calciteComboboxItemChange.emit(this.el);
|
917
|
+
}
|
918
|
+
// --------------------------------------------------------------------------
|
919
|
+
//
|
920
|
+
// Lifecycle
|
921
|
+
//
|
922
|
+
// --------------------------------------------------------------------------
|
923
|
+
connectedCallback() {
|
924
|
+
this.ancestors = getAncestors(this.el);
|
925
|
+
this.scale = getElementProp(this.el, "scale", this.scale);
|
926
|
+
connectConditionalSlotComponent(this);
|
927
|
+
}
|
928
|
+
disconnectedCallback() {
|
929
|
+
disconnectConditionalSlotComponent(this);
|
930
|
+
}
|
931
|
+
componentDidRender() {
|
932
|
+
updateHostInteraction(this);
|
933
|
+
}
|
934
|
+
// --------------------------------------------------------------------------
|
935
|
+
//
|
936
|
+
// Public Methods
|
937
|
+
//
|
938
|
+
// --------------------------------------------------------------------------
|
939
|
+
/**
|
940
|
+
* Used to toggle the selection state. By default this won't trigger an event.
|
941
|
+
* The first argument allows the value to be coerced, rather than swapping values.
|
942
|
+
*
|
943
|
+
* @param coerce
|
944
|
+
*/
|
945
|
+
async toggleSelected(coerce) {
|
946
|
+
if (this.disabled) {
|
947
|
+
return;
|
948
|
+
}
|
949
|
+
this.selected = typeof coerce === "boolean" ? coerce : !this.selected;
|
950
|
+
}
|
951
|
+
// --------------------------------------------------------------------------
|
952
|
+
//
|
953
|
+
// Render Methods
|
954
|
+
//
|
955
|
+
// --------------------------------------------------------------------------
|
956
|
+
renderIcon(isSingle) {
|
957
|
+
const { icon, disabled, selected } = this;
|
958
|
+
const level = `${CSS.icon}--indent`;
|
959
|
+
const defaultIcon = isSingle ? "dot" : "check";
|
960
|
+
const iconPath = disabled ? "circle-disallowed" : defaultIcon;
|
961
|
+
const showDot = isSingle && !icon && !disabled;
|
962
|
+
return showDot ? (h("span", { class: {
|
963
|
+
[CSS.icon]: true,
|
964
|
+
[CSS.dot]: true,
|
965
|
+
[level]: true
|
966
|
+
} })) : (h("calcite-icon", { class: {
|
967
|
+
[CSS.icon]: !icon,
|
968
|
+
[CSS.custom]: !!icon,
|
969
|
+
[CSS.iconActive]: icon && selected,
|
970
|
+
[level]: true
|
971
|
+
}, icon: icon || iconPath, scale: "s" }));
|
972
|
+
}
|
973
|
+
renderChildren() {
|
974
|
+
if (getSlotted(this.el)) {
|
975
|
+
return (h("ul", { key: "default-slot-container" }, h("slot", null)));
|
976
|
+
}
|
977
|
+
return null;
|
978
|
+
}
|
979
|
+
render() {
|
980
|
+
const isSingleSelect = getElementProp(this.el, "selection-mode", "multi") === "single";
|
981
|
+
const classes = {
|
982
|
+
[CSS.label]: true,
|
983
|
+
[CSS.selected]: this.selected,
|
984
|
+
[CSS.active]: this.active,
|
985
|
+
[CSS.single]: isSingleSelect
|
986
|
+
};
|
987
|
+
const depth = getDepth(this.el);
|
988
|
+
return (h(Host, { "aria-hidden": "true" }, h("div", { class: `container scale--${this.scale}`, style: { "--calcite-combobox-item-spacing-indent-multiplier": `${depth}` } }, h("li", { class: classes, id: this.guid, onClick: this.itemClickHandler }, this.renderIcon(isSingleSelect), h("span", { class: CSS.title }, this.textLabel)), this.renderChildren())));
|
989
|
+
}
|
990
|
+
get el() { return getElement(this); }
|
991
|
+
static get watchers() { return {
|
992
|
+
"selected": ["selectedWatchHandler"]
|
993
|
+
}; }
|
994
|
+
};
|
995
|
+
ComboboxItem.style = comboboxItemCss;
|
996
|
+
|
997
|
+
const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}";
|
998
|
+
|
999
|
+
const MapLayerPicker = class {
|
1000
|
+
constructor(hostRef) {
|
1001
|
+
registerInstance(this, hostRef);
|
1002
|
+
this.layerSelectionChange = createEvent(this, "layerSelectionChange", 7);
|
1003
|
+
this.enabledLayerIds = [];
|
1004
|
+
this.mapView = undefined;
|
1005
|
+
this.selectedLayerIds = [];
|
1006
|
+
this.selectionMode = "single";
|
1007
|
+
this.layerIds = [];
|
1008
|
+
}
|
1009
|
+
//--------------------------------------------------------------------------
|
1010
|
+
//
|
1011
|
+
// Watch handlers
|
1012
|
+
//
|
1013
|
+
//--------------------------------------------------------------------------
|
1014
|
+
/**
|
1015
|
+
* Called each time the mapView prop is changed.
|
1016
|
+
*
|
1017
|
+
*/
|
1018
|
+
async watchStateHandler(newValue, oldValue) {
|
1019
|
+
if (newValue !== oldValue) {
|
1020
|
+
await this._setLayers();
|
1021
|
+
if (this.selectionMode === "single") {
|
1022
|
+
this.layerSelectionChange.emit([this.layerIds[0]]);
|
1023
|
+
}
|
1024
|
+
}
|
1025
|
+
}
|
1026
|
+
//--------------------------------------------------------------------------
|
1027
|
+
//
|
1028
|
+
// Functions (lifecycle)
|
1029
|
+
//
|
1030
|
+
//--------------------------------------------------------------------------
|
1031
|
+
/**
|
1032
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
1033
|
+
*/
|
1034
|
+
async componentWillLoad() {
|
1035
|
+
await this._setLayers();
|
1036
|
+
if (this.selectionMode === "single" && (this.layerIds.length > 0 || this.selectedLayerIds.length === 1)) {
|
1037
|
+
this.layerSelectionChange.emit(this.selectedLayerIds.length === 1 ? [this.selectedLayerIds[0]] : [this.layerIds[0]]);
|
1038
|
+
}
|
1039
|
+
}
|
1040
|
+
/**
|
1041
|
+
* Renders the component.
|
1042
|
+
*/
|
1043
|
+
render() {
|
1044
|
+
return (h(Host, null, h("div", { class: "map-layer-picker-container" }, h("div", { class: "map-layer-picker" }, this.selectionMode === "multi" ? this._getCombobox() : this._getSelect()))));
|
1045
|
+
}
|
1046
|
+
//--------------------------------------------------------------------------
|
1047
|
+
//
|
1048
|
+
// Functions (protected)
|
1049
|
+
//
|
1050
|
+
//--------------------------------------------------------------------------
|
1051
|
+
/**
|
1052
|
+
* Create a list of layers from the map
|
1053
|
+
*
|
1054
|
+
* Used for selecting a single layer.
|
1055
|
+
*
|
1056
|
+
* @returns Calcite Select component with the ids of the layers from the map
|
1057
|
+
*/
|
1058
|
+
_getSelect() {
|
1059
|
+
return (h("calcite-select", { label: "", onCalciteSelectChange: (evt) => this._layerSelectionChange(evt), ref: (el) => { this._layerElement = el; } }, this._addMapLayersOptions()));
|
1060
|
+
}
|
1061
|
+
/**
|
1062
|
+
* Create a list of layer ids from the map
|
1063
|
+
*
|
1064
|
+
* Used for selecting multiple layers
|
1065
|
+
*
|
1066
|
+
* @returns Calcite ComboBox component with the ids of the layers from the map
|
1067
|
+
*/
|
1068
|
+
_getCombobox() {
|
1069
|
+
return (h("calcite-combobox", { label: "", onCalciteComboboxChange: (evt) => this._layerSelectionChange(evt), "selection-mode": this.selectionMode }, this._addMapLayersOptions()));
|
1070
|
+
}
|
1071
|
+
/**
|
1072
|
+
* Hydrate a select or combobox component with the ids of the layers in the map
|
1073
|
+
*
|
1074
|
+
* @returns Array of ComboBox items or Select options for the ids of the layers
|
1075
|
+
*/
|
1076
|
+
_addMapLayersOptions() {
|
1077
|
+
return this.layerIds.reduce((prev, cur) => {
|
1078
|
+
if (state.managedLayers.indexOf(state.layerNameHash[cur]) < 0 && (this.enabledLayerIds.length > 0 ? this.enabledLayerIds.indexOf(cur) > -1 : true)) {
|
1079
|
+
prev.push(this.selectionMode === "multi" && this.selectedLayerIds.indexOf(cur) > -1 ?
|
1080
|
+
(h("calcite-combobox-item", { selected: true, textLabel: state.layerNameHash[cur], value: cur })) :
|
1081
|
+
this.selectionMode === "multi" ?
|
1082
|
+
(h("calcite-combobox-item", { textLabel: state.layerNameHash[cur], value: cur })) :
|
1083
|
+
this.selectedLayerIds.indexOf(cur) > -1 ?
|
1084
|
+
(h("calcite-option", { label: state.layerNameHash[cur], selected: true, value: cur })) :
|
1085
|
+
(h("calcite-option", { label: state.layerNameHash[cur], value: cur })));
|
1086
|
+
}
|
1087
|
+
return prev;
|
1088
|
+
}, []);
|
1089
|
+
}
|
1090
|
+
/**
|
1091
|
+
* Fetch the ids of the layers from the map
|
1092
|
+
*
|
1093
|
+
* @returns Promise when the operation has completed
|
1094
|
+
*/
|
1095
|
+
async _setLayers() {
|
1096
|
+
if (this.mapView) {
|
1097
|
+
const mapLayerIds = await getMapLayerIds(this.mapView);
|
1098
|
+
this.layerIds = mapLayerIds.filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.indexOf(n) > -1 : true; });
|
1099
|
+
await this._initLayerHashState();
|
1100
|
+
}
|
1101
|
+
}
|
1102
|
+
/**
|
1103
|
+
* Create a layer id:title hash for layer name display
|
1104
|
+
*
|
1105
|
+
* @returns Promise when the operation has completed
|
1106
|
+
*/
|
1107
|
+
async _initLayerHashState() {
|
1108
|
+
if (this.mapView) {
|
1109
|
+
state.layerNameHash = await getMapLayerHash(this.mapView);
|
1110
|
+
}
|
1111
|
+
}
|
1112
|
+
/**
|
1113
|
+
* Fetch the ids of the layers from the map
|
1114
|
+
*
|
1115
|
+
* @returns Promise when the operation has completed
|
1116
|
+
*/
|
1117
|
+
_layerSelectionChange(evt) {
|
1118
|
+
var _a;
|
1119
|
+
this.selectedLayerIds = this.selectionMode === "single" ?
|
1120
|
+
[this._layerElement.value] : ((_a = evt.detail) === null || _a === void 0 ? void 0 : _a.selectedItems.map((item) => {
|
1121
|
+
return item.value;
|
1122
|
+
})) || [];
|
1123
|
+
this.layerSelectionChange.emit(this.selectedLayerIds);
|
1124
|
+
}
|
1125
|
+
get el() { return getElement(this); }
|
1126
|
+
static get watchers() { return {
|
1127
|
+
"mapView": ["watchStateHandler"]
|
1128
|
+
}; }
|
1129
|
+
};
|
1130
|
+
MapLayerPicker.style = mapLayerPickerCss;
|
1131
|
+
|
1132
|
+
export { Combobox as calcite_combobox, ComboboxItem as calcite_combobox_item, MapLayerPicker as map_layer_picker };
|