@esri/solutions-components 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/assets/data/images/grid.png +0 -0
- package/dist/assets/data/images/horizontal.png +0 -0
- package/dist/assets/data/images/vertical.png +0 -0
- package/dist/assets/t9n/crowdsource-manager/resources.json +7 -1
- package/dist/assets/t9n/crowdsource-manager/resources_en.json +7 -1
- package/dist/cjs/buffer-tools_6.cjs.entry.js +85 -85
- package/dist/cjs/{calcite-block_2.cjs.entry.js → calcite-action-bar_4.cjs.entry.js} +307 -18
- package/dist/cjs/{calcite-action.cjs.entry.js → calcite-action_2.cjs.entry.js} +84 -1
- package/dist/cjs/{calcite-combobox_3.cjs.entry.js → calcite-chip_4.cjs.entry.js} +187 -61
- package/dist/cjs/{calcite-dropdown-group_4.cjs.entry.js → calcite-dropdown_5.cjs.entry.js} +467 -1
- package/dist/cjs/calcite-input-message_5.cjs.entry.js +283 -283
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
- package/dist/cjs/{calcite-action-bar_2.cjs.entry.js → calcite-tooltip.cjs.entry.js} +2 -208
- package/dist/cjs/crowdsource-manager.cjs.entry.js +88 -14
- package/dist/cjs/{downloadUtils-b85476e8.js → downloadUtils-9359e9ff.js} +1218 -1127
- package/dist/cjs/{index.es-3ba50626.js → index.es-9c0d0ed6.js} +10682 -10682
- package/dist/cjs/{interfaces-17c631bf.js → interfaces-cac36920.js} +6 -0
- package/dist/cjs/layer-table_2.cjs.entry.js +512 -0
- package/dist/cjs/loader.cjs.js +30 -30
- package/dist/cjs/{mapViewUtils-df63bfa4.js → mapViewUtils-090f4d4d.js} +24 -24
- package/dist/cjs/public-notification.cjs.entry.js +69 -49
- 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-b86759b2.js → solution-store-d28c332e.js} +1 -1
- package/dist/cjs/solutions-components.cjs.js +31 -31
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator.js +6 -3
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_jsPDF.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFCreator_pdf_lib.js +1 -1
- package/dist/collection/assets/arcgis-pdf-creator/PDFLabels.js +54 -3
- package/dist/collection/assets/arcgis-pdf-creator/grid.js +1 -1
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +122 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +130 -14
- package/dist/collection/components/layer-table/layer-table.css +2 -70
- package/dist/collection/components/layer-table/layer-table.js +66 -106
- package/dist/collection/components/map-card/map-card.css +4 -7
- package/dist/collection/components/map-card/map-card.js +44 -10
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +45 -27
- package/dist/collection/components/refine-selection-tools/refine-selection-tools.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +14 -41
- package/dist/collection/utils/csvDownload.js +41 -0
- package/dist/collection/utils/csvDownload.ts +42 -0
- package/dist/collection/utils/csvUtils.js +6 -23
- package/dist/collection/utils/csvUtils.ts +8 -27
- package/dist/collection/utils/downloadUtils.js +30 -14
- package/dist/collection/utils/downloadUtils.ts +36 -14
- package/dist/collection/utils/interfaces.js +6 -0
- package/dist/collection/utils/interfaces.ts +6 -0
- package/dist/collection/utils/pdfUtils.js +9 -6
- package/dist/collection/utils/pdfUtils.ts +13 -8
- package/dist/collection/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/collection/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/components/crowdsource-manager.js +293 -17
- package/dist/components/downloadUtils.js +133 -42
- package/dist/components/interfaces3.js +7 -1
- package/dist/components/layer-table.js +1 -443
- package/dist/components/layer-table2.js +429 -0
- package/dist/components/map-card.js +1 -339
- package/dist/{esm/map-card.entry.js → components/map-card2.js} +118 -22
- package/dist/components/map-draw-tools2.js +16 -16
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +38 -38
- package/dist/components/public-notification.js +102 -82
- package/dist/components/queryUtils.js +10 -10
- package/dist/components/refine-selection-tools2.js +3 -3
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-store.js +1 -1
- package/dist/esm/buffer-tools_6.entry.js +76 -76
- package/dist/esm/{calcite-block_2.entry.js → calcite-action-bar_4.entry.js} +307 -20
- package/dist/esm/{calcite-action.entry.js → calcite-action_2.entry.js} +84 -2
- package/dist/esm/{calcite-combobox_3.entry.js → calcite-chip_4.entry.js} +181 -56
- package/dist/esm/{calcite-dropdown-group_4.entry.js → calcite-dropdown_5.entry.js} +468 -3
- package/dist/esm/calcite-input-message_5.entry.js +275 -275
- package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
- package/dist/esm/{calcite-action-bar_2.entry.js → calcite-tooltip.entry.js} +4 -209
- package/dist/esm/crowdsource-manager.entry.js +88 -14
- package/dist/esm/{downloadUtils-f278742f.js → downloadUtils-a8f139c5.js} +1214 -1123
- package/dist/esm/{index.es-6f3a1143.js → index.es-a75412ff.js} +10596 -10596
- package/dist/esm/{interfaces-d0d83efa.js → interfaces-cd4054e5.js} +7 -1
- package/dist/esm/layer-table_2.entry.js +507 -0
- package/dist/esm/loader.js +26 -26
- package/dist/esm/{mapViewUtils-bd1809f0.js → mapViewUtils-8ffcd36d.js} +12 -12
- package/dist/esm/public-notification.entry.js +65 -45
- package/dist/esm/solution-configuration.entry.js +2 -2
- package/dist/esm/solution-contents_3.entry.js +2 -2
- package/dist/esm/{solution-store-477288ac.js → solution-store-1b67f2c8.js} +1 -1
- package/dist/esm/solutions-components.js +26 -26
- package/dist/solutions-components/demos/crowdsource-manager.html +14 -41
- package/dist/solutions-components/{p-dd11eeb2.js → p-1395b0ef.js} +1 -1
- package/dist/solutions-components/{p-cbac29fb.entry.js → p-1affd711.entry.js} +18 -18
- package/dist/solutions-components/p-30de8da1.entry.js +17 -0
- package/dist/solutions-components/{p-91cad71e.entry.js → p-439c878d.entry.js} +3 -9
- package/dist/solutions-components/{p-03e2c6fd.js → p-765a27f3.js} +60 -60
- package/dist/solutions-components/p-813a04c3.entry.js +6 -0
- package/dist/solutions-components/{p-9e8a371f.entry.js → p-874b39a7.entry.js} +3 -3
- package/dist/solutions-components/p-8cece97f.js +21 -0
- package/dist/solutions-components/{p-dd0241fb.entry.js → p-97aa7211.entry.js} +1 -1
- package/dist/solutions-components/{p-0e459cc7.entry.js → p-a955a3e6.entry.js} +10 -4
- package/dist/solutions-components/{p-40c12650.js → p-bb64bd47.js} +453 -437
- package/dist/solutions-components/{p-70e1d4d8.entry.js → p-c392dd95.entry.js} +17 -17
- package/dist/solutions-components/p-ca386a72.entry.js +6 -0
- package/dist/solutions-components/p-d47d74a6.entry.js +23 -0
- package/dist/solutions-components/p-db846ee2.entry.js +11 -0
- package/dist/solutions-components/{p-88e5a76d.js → p-dc53c9c1.js} +36 -36
- package/dist/solutions-components/p-e1c93241.entry.js +6 -0
- package/dist/solutions-components/{p-4cbaf0f1.entry.js → p-e6d235d6.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +6 -6
- package/dist/solutions-components/utils/csvDownload.ts +42 -0
- package/dist/solutions-components/utils/csvUtils.ts +8 -27
- package/dist/solutions-components/utils/downloadUtils.ts +36 -14
- package/dist/solutions-components/utils/interfaces.ts +6 -0
- package/dist/solutions-components/utils/pdfUtils.ts +13 -8
- package/dist/solutions-components/utils/test/csvUtils.spec.tsx +56 -0
- package/dist/solutions-components/utils/test/downloadUtils.spec.tsx +133 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +39 -0
- package/dist/types/components/layer-table/layer-table.d.ts +35 -48
- package/dist/types/components/map-card/map-card.d.ts +10 -6
- package/dist/types/components/public-notification/public-notification.d.ts +18 -6
- package/dist/types/components.d.ts +1621 -1601
- package/dist/types/preact.d.ts +2 -1
- package/dist/types/utils/csvDownload.d.ts +24 -0
- package/dist/types/utils/csvUtils.d.ts +2 -1
- package/dist/types/utils/downloadUtils.d.ts +25 -0
- package/dist/types/utils/interfaces.d.ts +5 -0
- package/dist/types/utils/pdfUtils.d.ts +2 -1
- package/package.json +4 -4
- package/dist/cjs/calcite-chip.cjs.entry.js +0 -142
- package/dist/cjs/calcite-dropdown.cjs.entry.js +0 -481
- package/dist/cjs/calcite-handle.cjs.entry.js +0 -99
- package/dist/cjs/calcite-loader.cjs.entry.js +0 -95
- package/dist/cjs/layer-table.cjs.entry.js +0 -317
- package/dist/cjs/map-card.cjs.entry.js +0 -252
- package/dist/esm/calcite-chip.entry.js +0 -138
- package/dist/esm/calcite-dropdown.entry.js +0 -477
- package/dist/esm/calcite-handle.entry.js +0 -95
- package/dist/esm/calcite-loader.entry.js +0 -91
- package/dist/esm/layer-table.entry.js +0 -313
- package/dist/solutions-components/p-045d3988.entry.js +0 -12
- package/dist/solutions-components/p-11132485.entry.js +0 -11
- package/dist/solutions-components/p-15b43c29.entry.js +0 -11
- package/dist/solutions-components/p-5034aabc.entry.js +0 -11
- package/dist/solutions-components/p-6f012424.entry.js +0 -6
- package/dist/solutions-components/p-7fd10eb3.entry.js +0 -11
- package/dist/solutions-components/p-a57ef371.entry.js +0 -6
- package/dist/solutions-components/p-bc39f296.entry.js +0 -6
- package/dist/solutions-components/p-c93d8e80.entry.js +0 -6
- package/dist/solutions-components/p-dbc9a5a8.js +0 -21
- package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
- package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -1,138 +0,0 @@
|
|
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, g as getElement } from './index-c246d90e.js';
|
7
|
-
import { a as getSlotted } from './dom-3bdc69ee.js';
|
8
|
-
import { g as guid } from './guid-15fce7c0.js';
|
9
|
-
import { c as connectConditionalSlotComponent, d as disconnectConditionalSlotComponent } from './conditionalSlot-d09506c4.js';
|
10
|
-
import './resources-436ae282.js';
|
11
|
-
import './observers-31601001.js';
|
12
|
-
|
13
|
-
/*!
|
14
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
15
|
-
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
16
|
-
* v1.0.0-beta.97
|
17
|
-
*/
|
18
|
-
const CSS = {
|
19
|
-
title: "title",
|
20
|
-
close: "close",
|
21
|
-
imageContainer: "image-container",
|
22
|
-
chipIcon: "chip-icon",
|
23
|
-
closeIcon: "close-icon"
|
24
|
-
};
|
25
|
-
const TEXT = {
|
26
|
-
close: "Close"
|
27
|
-
};
|
28
|
-
const SLOTS = {
|
29
|
-
image: "image"
|
30
|
-
};
|
31
|
-
const ICONS = {
|
32
|
-
close: "x"
|
33
|
-
};
|
34
|
-
|
35
|
-
const chipCss = "@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([scale=s]){block-size:1.5rem;font-size:var(--calcite-font-size--2);--calcite-chip-spacing-unit-l:0.5rem;--calcite-chip-spacing-unit-s:0.25rem}:host([scale=s]) .image-container{block-size:1.25rem;inline-size:1.25rem}:host([scale=m]){block-size:2rem;font-size:var(--calcite-font-size--1);--calcite-chip-spacing-unit-l:0.75rem;--calcite-chip-spacing-unit-s:6px}:host([scale=m]) .image-container{block-size:1.5rem;inline-size:1.5rem;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}:host([scale=l]){block-size:2.75rem;font-size:var(--calcite-font-size-0);--calcite-chip-spacing-unit-l:1rem;--calcite-chip-spacing-unit-s:0.5rem}:host([scale=l]) .image-container{block-size:2rem;inline-size:2rem;-webkit-padding-start:0.25rem;padding-inline-start:0.25rem}:host{box-sizing:border-box;display:inline-flex;cursor:default;align-items:center;border-radius:9999px;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1)}.container{display:inline-flex;block-size:100%;max-inline-size:100%;align-items:center}.title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:host span{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}:host([closable]) span{padding-inline:var(--calcite-chip-spacing-unit-l) var(--calcite-chip-spacing-unit-s)}:host([icon]:not([closable])) span{padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-l)}:host button{margin:0px;display:inline-flex;max-block-size:100%;min-block-size:100%;cursor:pointer;align-items:center;align-self:stretch;border-style:none;background-color:transparent;color:var(--calcite-ui-text-1);outline-color:transparent;transition:all var(--calcite-animation-timing) ease-in-out 0s, outline 0s, outline-offset 0s;-webkit-appearance:none;border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0;padding-block:0;padding-inline:var(--calcite-chip-spacing-unit-s);color:inherit;--calcite-chip-transparent-hover:var(--calcite-button-transparent-hover);--calcite-chip-transparent-press:var(--calcite-button-transparent-press)}:host button:hover{background-color:var(--calcite-chip-transparent-hover)}:host button:focus{background-color:var(--calcite-chip-transparent-hover);outline:2px solid var(--calcite-ui-brand);outline-offset:-2px}:host button:active{background-color:var(--calcite-chip-transparent-press)}.image-container{display:inline-flex;overflow:hidden;border-radius:50%}:host slot[name=image]::slotted(*){display:flex;block-size:100%;inline-size:100%;overflow:hidden;border-radius:50%}.chip-icon{position:relative;margin-block:0px;display:inline-flex;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-margin-end:0;margin-inline-end:0;-webkit-margin-start:var(--calcite-chip-spacing-unit-l);margin-inline-start:var(--calcite-chip-spacing-unit-l);border-start-start-radius:0;border-start-end-radius:50px;border-end-end-radius:50px;border-end-start-radius:0}:host([color=blue]){border-color:transparent;background-color:var(--calcite-ui-info);color:var(--calcite-ui-text-inverse)}:host([color=red]){border-color:transparent;background-color:var(--calcite-ui-danger);color:var(--calcite-ui-text-inverse)}:host([color=yellow]){border-color:transparent;background-color:var(--calcite-ui-warning);color:#151515}:host([color=green]){border-color:transparent;background-color:var(--calcite-ui-success);color:#151515}:host([color=grey]){border-color:transparent;background-color:var(--calcite-ui-foreground-2);color:var(--calcite-ui-text-1)}:host([color=grey]) button,:host([color=grey]) .close-icon{color:var(--calcite-ui-text-3)}:host([color=grey]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([appearance=clear]),:host([appearance=transparent]){background-color:transparent;color:var(--calcite-ui-text-1)}:host([color=blue][appearance=clear]),:host([color=blue][appearance=transparent]){border-color:var(--calcite-ui-info)}:host([color=blue][appearance=clear]) .chip-icon,:host([color=blue][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-info))}:host([color=red][appearance=clear]),:host([color=red][appearance=transparent]){border-color:var(--calcite-ui-danger)}:host([color=red][appearance=clear]) .chip-icon,:host([color=red][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-danger))}:host([color=yellow][appearance=clear]),:host([color=yellow][appearance=transparent]){border-color:var(--calcite-ui-warning)}:host([color=yellow][appearance=clear]) .chip-icon,:host([color=yellow][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-warning))}:host([color=green][appearance=clear]),:host([color=green][appearance=transparent]){border-color:var(--calcite-ui-success)}:host([color=green][appearance=clear]) .chip-icon,:host([color=green][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-success))}:host([color=grey][appearance=clear]),:host([color=grey][appearance=transparent]){border-color:var(--calcite-ui-border-1)}:host([color=grey][appearance=clear]) .chip-icon,:host([color=grey][appearance=transparent]) .chip-icon{color:var(--calcite-ui-icon-color, var(--calcite-ui-text-3))}:host([closed]){display:none}";
|
36
|
-
|
37
|
-
const Chip = class {
|
38
|
-
constructor(hostRef) {
|
39
|
-
registerInstance(this, hostRef);
|
40
|
-
this.calciteChipDismiss = createEvent(this, "calciteChipDismiss", 6);
|
41
|
-
//--------------------------------------------------------------------------
|
42
|
-
//
|
43
|
-
// Public Properties
|
44
|
-
//
|
45
|
-
//--------------------------------------------------------------------------
|
46
|
-
/** Specifies the appearance style of the component. */
|
47
|
-
this.appearance = "solid";
|
48
|
-
/** Specifies the color for the component. */
|
49
|
-
this.color = "grey";
|
50
|
-
/**
|
51
|
-
* When `true`, a close button is added to the component.
|
52
|
-
*
|
53
|
-
* @deprecated use `closable` instead.
|
54
|
-
*/
|
55
|
-
this.dismissible = false;
|
56
|
-
/** When `true`, a close button is added to the component. */
|
57
|
-
this.closable = false;
|
58
|
-
/**
|
59
|
-
* Accessible name for the component's close button.
|
60
|
-
*
|
61
|
-
* @default "Close"
|
62
|
-
*/
|
63
|
-
this.dismissLabel = TEXT.close;
|
64
|
-
/** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
|
65
|
-
this.iconFlipRtl = false;
|
66
|
-
/** Specifies the size of the component. */
|
67
|
-
this.scale = "m";
|
68
|
-
/** When `true`, hides the component. */
|
69
|
-
this.closed = false;
|
70
|
-
// --------------------------------------------------------------------------
|
71
|
-
//
|
72
|
-
// Private Methods
|
73
|
-
//
|
74
|
-
// --------------------------------------------------------------------------
|
75
|
-
this.closeClickHandler = (event) => {
|
76
|
-
event.preventDefault();
|
77
|
-
this.calciteChipDismiss.emit(this.el);
|
78
|
-
this.closed = true;
|
79
|
-
};
|
80
|
-
this.guid = guid();
|
81
|
-
}
|
82
|
-
handleDismissible(value) {
|
83
|
-
this.closable = value;
|
84
|
-
}
|
85
|
-
handleClosable(value) {
|
86
|
-
this.dismissible = value;
|
87
|
-
}
|
88
|
-
// --------------------------------------------------------------------------
|
89
|
-
//
|
90
|
-
// Lifecycle
|
91
|
-
//
|
92
|
-
// --------------------------------------------------------------------------
|
93
|
-
connectedCallback() {
|
94
|
-
connectConditionalSlotComponent(this);
|
95
|
-
if (this.dismissible) {
|
96
|
-
this.handleDismissible(this.dismissible);
|
97
|
-
}
|
98
|
-
if (this.closable) {
|
99
|
-
this.handleClosable(this.closable);
|
100
|
-
}
|
101
|
-
}
|
102
|
-
disconnectedCallback() {
|
103
|
-
disconnectConditionalSlotComponent(this);
|
104
|
-
}
|
105
|
-
//--------------------------------------------------------------------------
|
106
|
-
//
|
107
|
-
// Public Methods
|
108
|
-
//
|
109
|
-
//--------------------------------------------------------------------------
|
110
|
-
/** Sets focus on the component. */
|
111
|
-
async setFocus() {
|
112
|
-
var _a;
|
113
|
-
(_a = this.closeButton) === null || _a === void 0 ? void 0 : _a.focus();
|
114
|
-
}
|
115
|
-
//--------------------------------------------------------------------------
|
116
|
-
//
|
117
|
-
// Render Methods
|
118
|
-
//
|
119
|
-
//--------------------------------------------------------------------------
|
120
|
-
renderChipImage() {
|
121
|
-
const { el } = this;
|
122
|
-
const hasChipImage = getSlotted(el, SLOTS.image);
|
123
|
-
return hasChipImage ? (h("div", { class: CSS.imageContainer, key: "image" }, h("slot", { name: SLOTS.image }))) : null;
|
124
|
-
}
|
125
|
-
render() {
|
126
|
-
const iconEl = (h("calcite-icon", { class: CSS.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
|
127
|
-
const closeButton = (h("button", { "aria-describedby": this.guid, "aria-label": this.dismissLabel, class: CSS.close, onClick: this.closeClickHandler, ref: (el) => (this.closeButton = el) }, h("calcite-icon", { class: CSS.closeIcon, icon: ICONS.close, scale: "s" })));
|
128
|
-
return (h("div", { class: "container" }, this.renderChipImage(), this.icon ? iconEl : null, h("span", { class: CSS.title, id: this.guid }, h("slot", null)), this.closable ? closeButton : null));
|
129
|
-
}
|
130
|
-
get el() { return getElement(this); }
|
131
|
-
static get watchers() { return {
|
132
|
-
"dismissible": ["handleDismissible"],
|
133
|
-
"closable": ["handleClosable"]
|
134
|
-
}; }
|
135
|
-
};
|
136
|
-
Chip.style = chipCss;
|
137
|
-
|
138
|
-
export { Chip as calcite_chip };
|
@@ -1,477 +0,0 @@
|
|
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 './index-c246d90e.js';
|
7
|
-
import { t as toAriaBoolean, i as isPrimaryPointerButton, f as focusElement } from './dom-3bdc69ee.js';
|
8
|
-
import { d as defaultMenuPlacement, f as filterComputedPlacements, c as connectFloatingUI, u as updateAfterClose, a as disconnectFloatingUI, F as FloatingCSS, r as reposition } from './floating-ui-63460291.js';
|
9
|
-
import { c as createObserver } from './observers-31601001.js';
|
10
|
-
import { u as updateHostInteraction } from './interactive-822ffed6.js';
|
11
|
-
import { c as connectOpenCloseComponent, d as disconnectOpenCloseComponent } from './openCloseComponent-5caff873.js';
|
12
|
-
import { g as guid } from './guid-15fce7c0.js';
|
13
|
-
import { i as isActivationKey } from './key-acb660e7.js';
|
14
|
-
import './resources-436ae282.js';
|
15
|
-
import './debounce-4c884e5c.js';
|
16
|
-
|
17
|
-
/*!
|
18
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
19
|
-
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
20
|
-
* v1.0.0-beta.97
|
21
|
-
*/
|
22
|
-
const SLOTS = {
|
23
|
-
dropdownTrigger: "dropdown-trigger"
|
24
|
-
};
|
25
|
-
|
26
|
-
const dropdownCss = "@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{display:inline-flex;flex:0 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}:host .calcite-dropdown-wrapper{display:block;position:absolute;z-index:900;visibility:hidden;pointer-events:none;inline-size:0;block-size:0;overflow:hidden}.calcite-dropdown-wrapper .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}.calcite-dropdown-wrapper[data-placement^=bottom] .calcite-floating-ui-anim{transform:translateY(-5px)}.calcite-dropdown-wrapper[data-placement^=top] .calcite-floating-ui-anim{transform:translateY(5px)}.calcite-dropdown-wrapper[data-placement^=left] .calcite-floating-ui-anim{transform:translateX(5px)}.calcite-dropdown-wrapper[data-placement^=right] .calcite-floating-ui-anim{transform:translateX(-5px)}.calcite-dropdown-wrapper[data-placement] .calcite-floating-ui-anim--active{opacity:1;visibility:visible;transform:translate(0)}:host([open]) .calcite-dropdown-wrapper{pointer-events:initial;visibility:visible;inline-size:unset;block-size:unset;overflow:unset}:host .calcite-dropdown-content{max-block-size:45vh;inline-size:auto;overflow-y:auto;overflow-x:hidden;background-color:var(--calcite-ui-foreground-1);inline-size:var(--calcite-dropdown-width)}.calcite-dropdown-trigger-container{position:relative;display:flex;flex:1 1 auto}@media (forced-colors: active){:host([open]) .calcite-dropdown-wrapper{border:1px solid canvasText}}:host([width=s]){--calcite-dropdown-width:12rem}:host([width=m]){--calcite-dropdown-width:14rem}:host([width=l]){--calcite-dropdown-width:16rem}";
|
27
|
-
|
28
|
-
const Dropdown = class {
|
29
|
-
constructor(hostRef) {
|
30
|
-
registerInstance(this, hostRef);
|
31
|
-
this.calciteDropdownSelect = createEvent(this, "calciteDropdownSelect", 6);
|
32
|
-
this.calciteDropdownBeforeClose = createEvent(this, "calciteDropdownBeforeClose", 6);
|
33
|
-
this.calciteDropdownClose = createEvent(this, "calciteDropdownClose", 6);
|
34
|
-
this.calciteDropdownBeforeOpen = createEvent(this, "calciteDropdownBeforeOpen", 6);
|
35
|
-
this.calciteDropdownOpen = createEvent(this, "calciteDropdownOpen", 6);
|
36
|
-
//--------------------------------------------------------------------------
|
37
|
-
//
|
38
|
-
// Public Properties
|
39
|
-
//
|
40
|
-
//--------------------------------------------------------------------------
|
41
|
-
/**
|
42
|
-
* Opens or closes the dropdown
|
43
|
-
*
|
44
|
-
* @deprecated use open instead.
|
45
|
-
*/
|
46
|
-
this.active = false;
|
47
|
-
/** When true, opens the dropdown */
|
48
|
-
this.open = false;
|
49
|
-
/**
|
50
|
-
allow the dropdown to remain open after a selection is made
|
51
|
-
if the selection-mode of the selected item's containing group is "none", the dropdown will always close
|
52
|
-
*/
|
53
|
-
this.disableCloseOnSelect = false;
|
54
|
-
/** is the dropdown disabled */
|
55
|
-
this.disabled = false;
|
56
|
-
/**
|
57
|
-
specify the maximum number of calcite-dropdown-items to display before showing the scroller, must be greater than 0 -
|
58
|
-
this value does not include groupTitles passed to calcite-dropdown-group
|
59
|
-
*/
|
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
|
-
* Determines where the dropdown will be positioned relative to the button.
|
72
|
-
*
|
73
|
-
* @default "bottom-start"
|
74
|
-
*/
|
75
|
-
this.placement = defaultMenuPlacement;
|
76
|
-
/** specify the scale of dropdown, defaults to m */
|
77
|
-
this.scale = "m";
|
78
|
-
/**
|
79
|
-
* **read-only** The currently selected items
|
80
|
-
*
|
81
|
-
* @readonly
|
82
|
-
*/
|
83
|
-
this.selectedItems = [];
|
84
|
-
/** specify whether the dropdown is opened by hover or click of a trigger element */
|
85
|
-
this.type = "click";
|
86
|
-
this.items = [];
|
87
|
-
this.groups = [];
|
88
|
-
this.mutationObserver = createObserver("mutation", () => this.updateItems());
|
89
|
-
this.resizeObserver = createObserver("resize", (entries) => this.resizeObserverCallback(entries));
|
90
|
-
this.openTransitionProp = "visibility";
|
91
|
-
this.guid = `calcite-dropdown-${guid()}`;
|
92
|
-
this.defaultAssignedElements = [];
|
93
|
-
//--------------------------------------------------------------------------
|
94
|
-
//
|
95
|
-
// Private Methods
|
96
|
-
//
|
97
|
-
//--------------------------------------------------------------------------
|
98
|
-
this.slotChangeHandler = (event) => {
|
99
|
-
this.defaultAssignedElements = event.target.assignedElements({
|
100
|
-
flatten: true
|
101
|
-
});
|
102
|
-
this.updateItems();
|
103
|
-
};
|
104
|
-
this.setFilteredPlacements = () => {
|
105
|
-
const { el, flipPlacements } = this;
|
106
|
-
this.filteredFlipPlacements = flipPlacements
|
107
|
-
? filterComputedPlacements(flipPlacements, el)
|
108
|
-
: null;
|
109
|
-
};
|
110
|
-
this.updateTriggers = (event) => {
|
111
|
-
this.triggers = event.target.assignedElements({
|
112
|
-
flatten: true
|
113
|
-
});
|
114
|
-
this.reposition(true);
|
115
|
-
};
|
116
|
-
this.updateItems = () => {
|
117
|
-
this.items = this.groups
|
118
|
-
.map((group) => Array.from(group === null || group === void 0 ? void 0 : group.querySelectorAll("calcite-dropdown-item")))
|
119
|
-
.reduce((previousValue, currentValue) => [...previousValue, ...currentValue], []);
|
120
|
-
this.updateSelectedItems();
|
121
|
-
this.reposition(true);
|
122
|
-
};
|
123
|
-
this.updateGroups = (event) => {
|
124
|
-
const groups = event.target
|
125
|
-
.assignedElements({ flatten: true })
|
126
|
-
.filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-dropdown-group"));
|
127
|
-
this.groups = groups;
|
128
|
-
this.updateItems();
|
129
|
-
};
|
130
|
-
this.resizeObserverCallback = (entries) => {
|
131
|
-
entries.forEach((entry) => {
|
132
|
-
const { target } = entry;
|
133
|
-
if (target === this.referenceEl) {
|
134
|
-
this.setDropdownWidth();
|
135
|
-
}
|
136
|
-
else if (target === this.scrollerEl) {
|
137
|
-
this.setMaxScrollerHeight();
|
138
|
-
}
|
139
|
-
});
|
140
|
-
};
|
141
|
-
this.setDropdownWidth = () => {
|
142
|
-
const { referenceEl, scrollerEl } = this;
|
143
|
-
const referenceElWidth = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.clientWidth;
|
144
|
-
if (!referenceElWidth || !scrollerEl) {
|
145
|
-
return;
|
146
|
-
}
|
147
|
-
scrollerEl.style.minWidth = `${referenceElWidth}px`;
|
148
|
-
};
|
149
|
-
this.setMaxScrollerHeight = () => {
|
150
|
-
const { scrollerEl } = this;
|
151
|
-
if (!scrollerEl) {
|
152
|
-
return;
|
153
|
-
}
|
154
|
-
this.reposition(true);
|
155
|
-
const maxScrollerHeight = this.getMaxScrollerHeight();
|
156
|
-
scrollerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
|
157
|
-
this.reposition(true);
|
158
|
-
};
|
159
|
-
this.setScrollerAndTransitionEl = (el) => {
|
160
|
-
this.resizeObserver.observe(el);
|
161
|
-
this.scrollerEl = el;
|
162
|
-
this.transitionEl = el;
|
163
|
-
connectOpenCloseComponent(this);
|
164
|
-
};
|
165
|
-
this.setReferenceEl = (el) => {
|
166
|
-
this.referenceEl = el;
|
167
|
-
connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
168
|
-
this.resizeObserver.observe(el);
|
169
|
-
};
|
170
|
-
this.setFloatingEl = (el) => {
|
171
|
-
this.floatingEl = el;
|
172
|
-
connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
173
|
-
};
|
174
|
-
this.keyDownHandler = (event) => {
|
175
|
-
const target = event.target;
|
176
|
-
if (target !== this.referenceEl) {
|
177
|
-
return;
|
178
|
-
}
|
179
|
-
const { defaultPrevented, key } = event;
|
180
|
-
if (defaultPrevented) {
|
181
|
-
return;
|
182
|
-
}
|
183
|
-
if (this.open) {
|
184
|
-
if (key === "Escape") {
|
185
|
-
this.closeCalciteDropdown();
|
186
|
-
event.preventDefault();
|
187
|
-
return;
|
188
|
-
}
|
189
|
-
else if (event.shiftKey && key === "Tab") {
|
190
|
-
this.closeCalciteDropdown();
|
191
|
-
event.preventDefault();
|
192
|
-
return;
|
193
|
-
}
|
194
|
-
}
|
195
|
-
if (isActivationKey(key)) {
|
196
|
-
this.openCalciteDropdown();
|
197
|
-
event.preventDefault();
|
198
|
-
}
|
199
|
-
else if (key === "Escape") {
|
200
|
-
this.closeCalciteDropdown();
|
201
|
-
event.preventDefault();
|
202
|
-
}
|
203
|
-
};
|
204
|
-
this.focusOnFirstActiveOrFirstItem = () => {
|
205
|
-
this.getFocusableElement(this.items.find((item) => item.selected) || this.items[0]);
|
206
|
-
};
|
207
|
-
this.toggleOpenEnd = () => {
|
208
|
-
this.focusOnFirstActiveOrFirstItem();
|
209
|
-
this.el.removeEventListener("calciteDropdownOpen", this.toggleOpenEnd);
|
210
|
-
};
|
211
|
-
this.openCalciteDropdown = () => {
|
212
|
-
this.open = !this.open;
|
213
|
-
if (this.open) {
|
214
|
-
this.el.addEventListener("calciteDropdownOpen", this.toggleOpenEnd);
|
215
|
-
}
|
216
|
-
};
|
217
|
-
}
|
218
|
-
activeHandler(value) {
|
219
|
-
this.open = value;
|
220
|
-
}
|
221
|
-
openHandler(value) {
|
222
|
-
if (!this.disabled) {
|
223
|
-
if (value) {
|
224
|
-
this.reposition(true);
|
225
|
-
}
|
226
|
-
else {
|
227
|
-
updateAfterClose(this.floatingEl);
|
228
|
-
}
|
229
|
-
this.active = value;
|
230
|
-
return;
|
231
|
-
}
|
232
|
-
if (!value) {
|
233
|
-
updateAfterClose(this.floatingEl);
|
234
|
-
}
|
235
|
-
this.open = false;
|
236
|
-
}
|
237
|
-
handleDisabledChange(value) {
|
238
|
-
if (!value) {
|
239
|
-
this.open = false;
|
240
|
-
}
|
241
|
-
}
|
242
|
-
flipPlacementsHandler() {
|
243
|
-
this.setFilteredPlacements();
|
244
|
-
this.reposition(true);
|
245
|
-
}
|
246
|
-
maxItemsHandler() {
|
247
|
-
this.setMaxScrollerHeight();
|
248
|
-
}
|
249
|
-
overlayPositioningHandler() {
|
250
|
-
this.reposition(true);
|
251
|
-
}
|
252
|
-
placementHandler() {
|
253
|
-
this.reposition(true);
|
254
|
-
}
|
255
|
-
//--------------------------------------------------------------------------
|
256
|
-
//
|
257
|
-
// Lifecycle
|
258
|
-
//
|
259
|
-
//--------------------------------------------------------------------------
|
260
|
-
connectedCallback() {
|
261
|
-
var _a;
|
262
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
263
|
-
this.setFilteredPlacements();
|
264
|
-
this.reposition(true);
|
265
|
-
if (this.open) {
|
266
|
-
this.openHandler(this.open);
|
267
|
-
}
|
268
|
-
if (this.active) {
|
269
|
-
this.activeHandler(this.active);
|
270
|
-
}
|
271
|
-
connectOpenCloseComponent(this);
|
272
|
-
}
|
273
|
-
componentDidLoad() {
|
274
|
-
this.reposition(true);
|
275
|
-
}
|
276
|
-
componentDidRender() {
|
277
|
-
updateHostInteraction(this);
|
278
|
-
}
|
279
|
-
disconnectedCallback() {
|
280
|
-
var _a, _b;
|
281
|
-
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
282
|
-
disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
|
283
|
-
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
284
|
-
disconnectOpenCloseComponent(this);
|
285
|
-
}
|
286
|
-
render() {
|
287
|
-
const { open, guid } = this;
|
288
|
-
return (h(Host, null, h("div", { class: "calcite-dropdown-trigger-container", id: `${guid}-menubutton`, onClick: this.openCalciteDropdown, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, h("slot", { "aria-controls": `${guid}-menu`, "aria-expanded": toAriaBoolean(open), "aria-haspopup": "menu", name: SLOTS.dropdownTrigger, onSlotchange: this.updateTriggers })), h("div", { "aria-hidden": toAriaBoolean(!open), class: "calcite-dropdown-wrapper", ref: this.setFloatingEl }, h("div", { "aria-labelledby": `${guid}-menubutton`, class: {
|
289
|
-
["calcite-dropdown-content"]: true,
|
290
|
-
[FloatingCSS.animation]: true,
|
291
|
-
[FloatingCSS.animationActive]: open
|
292
|
-
}, id: `${guid}-menu`, ref: this.setScrollerAndTransitionEl, role: "menu" }, h("slot", { onSlotchange: this.updateGroups })))));
|
293
|
-
}
|
294
|
-
//--------------------------------------------------------------------------
|
295
|
-
//
|
296
|
-
// Public Methods
|
297
|
-
//
|
298
|
-
//--------------------------------------------------------------------------
|
299
|
-
/**
|
300
|
-
* Updates the position of the component.
|
301
|
-
*
|
302
|
-
* @param delayed
|
303
|
-
*/
|
304
|
-
async reposition(delayed = false) {
|
305
|
-
const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
|
306
|
-
return reposition(this, {
|
307
|
-
floatingEl,
|
308
|
-
referenceEl,
|
309
|
-
overlayPositioning,
|
310
|
-
placement,
|
311
|
-
flipPlacements: filteredFlipPlacements,
|
312
|
-
type: "menu"
|
313
|
-
}, delayed);
|
314
|
-
}
|
315
|
-
closeCalciteDropdownOnClick(event) {
|
316
|
-
if (!isPrimaryPointerButton(event) || !this.open || event.composedPath().includes(this.el)) {
|
317
|
-
return;
|
318
|
-
}
|
319
|
-
this.closeCalciteDropdown(false);
|
320
|
-
}
|
321
|
-
closeCalciteDropdownOnEvent(event) {
|
322
|
-
this.closeCalciteDropdown();
|
323
|
-
event.stopPropagation();
|
324
|
-
}
|
325
|
-
closeCalciteDropdownOnOpenEvent(event) {
|
326
|
-
if (event.composedPath().includes(this.el)) {
|
327
|
-
return;
|
328
|
-
}
|
329
|
-
this.open = false;
|
330
|
-
}
|
331
|
-
mouseEnterHandler() {
|
332
|
-
if (this.type === "hover") {
|
333
|
-
this.openCalciteDropdown();
|
334
|
-
}
|
335
|
-
}
|
336
|
-
mouseLeaveHandler() {
|
337
|
-
if (this.type === "hover") {
|
338
|
-
this.closeCalciteDropdown();
|
339
|
-
}
|
340
|
-
}
|
341
|
-
calciteInternalDropdownItemKeyEvent(event) {
|
342
|
-
const { keyboardEvent } = event.detail;
|
343
|
-
// handle edge
|
344
|
-
const target = keyboardEvent.target;
|
345
|
-
const itemToFocus = target.nodeName !== "A" ? target : target.parentNode;
|
346
|
-
const isFirstItem = this.itemIndex(itemToFocus) === 0;
|
347
|
-
const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
|
348
|
-
switch (keyboardEvent.key) {
|
349
|
-
case "Tab":
|
350
|
-
if (isLastItem && !keyboardEvent.shiftKey) {
|
351
|
-
this.closeCalciteDropdown();
|
352
|
-
}
|
353
|
-
else if (isFirstItem && keyboardEvent.shiftKey) {
|
354
|
-
this.closeCalciteDropdown();
|
355
|
-
}
|
356
|
-
else if (keyboardEvent.shiftKey) {
|
357
|
-
this.focusPrevItem(itemToFocus);
|
358
|
-
}
|
359
|
-
else {
|
360
|
-
this.focusNextItem(itemToFocus);
|
361
|
-
}
|
362
|
-
break;
|
363
|
-
case "ArrowDown":
|
364
|
-
this.focusNextItem(itemToFocus);
|
365
|
-
break;
|
366
|
-
case "ArrowUp":
|
367
|
-
this.focusPrevItem(itemToFocus);
|
368
|
-
break;
|
369
|
-
case "Home":
|
370
|
-
this.focusFirstItem();
|
371
|
-
break;
|
372
|
-
case "End":
|
373
|
-
this.focusLastItem();
|
374
|
-
break;
|
375
|
-
}
|
376
|
-
event.stopPropagation();
|
377
|
-
}
|
378
|
-
handleItemSelect(event) {
|
379
|
-
this.updateSelectedItems();
|
380
|
-
event.stopPropagation();
|
381
|
-
this.calciteDropdownSelect.emit({
|
382
|
-
item: event.detail.requestedDropdownItem
|
383
|
-
});
|
384
|
-
if (!this.disableCloseOnSelect ||
|
385
|
-
event.detail.requestedDropdownGroup.selectionMode === "none") {
|
386
|
-
this.closeCalciteDropdown();
|
387
|
-
}
|
388
|
-
event.stopPropagation();
|
389
|
-
}
|
390
|
-
onBeforeOpen() {
|
391
|
-
this.calciteDropdownBeforeOpen.emit();
|
392
|
-
}
|
393
|
-
onOpen() {
|
394
|
-
this.calciteDropdownOpen.emit();
|
395
|
-
}
|
396
|
-
onBeforeClose() {
|
397
|
-
this.calciteDropdownBeforeClose.emit();
|
398
|
-
}
|
399
|
-
onClose() {
|
400
|
-
this.calciteDropdownClose.emit();
|
401
|
-
}
|
402
|
-
updateSelectedItems() {
|
403
|
-
this.selectedItems = this.items.filter((item) => item.selected);
|
404
|
-
}
|
405
|
-
getMaxScrollerHeight() {
|
406
|
-
const { maxItems, items } = this;
|
407
|
-
let itemsToProcess = 0;
|
408
|
-
let maxScrollerHeight = 0;
|
409
|
-
let groupHeaderHeight;
|
410
|
-
this.groups.forEach((group) => {
|
411
|
-
if (maxItems > 0 && itemsToProcess < maxItems) {
|
412
|
-
Array.from(group.children).forEach((item, index) => {
|
413
|
-
if (index === 0) {
|
414
|
-
if (isNaN(groupHeaderHeight)) {
|
415
|
-
groupHeaderHeight = item.offsetTop;
|
416
|
-
}
|
417
|
-
maxScrollerHeight += groupHeaderHeight;
|
418
|
-
}
|
419
|
-
if (itemsToProcess < maxItems) {
|
420
|
-
maxScrollerHeight += item.offsetHeight;
|
421
|
-
itemsToProcess += 1;
|
422
|
-
}
|
423
|
-
});
|
424
|
-
}
|
425
|
-
});
|
426
|
-
return items.length > maxItems ? maxScrollerHeight : 0;
|
427
|
-
}
|
428
|
-
closeCalciteDropdown(focusTrigger = true) {
|
429
|
-
this.open = false;
|
430
|
-
if (focusTrigger) {
|
431
|
-
focusElement(this.triggers[0]);
|
432
|
-
}
|
433
|
-
}
|
434
|
-
focusFirstItem() {
|
435
|
-
const firstItem = this.items[0];
|
436
|
-
this.getFocusableElement(firstItem);
|
437
|
-
}
|
438
|
-
focusLastItem() {
|
439
|
-
const lastItem = this.items[this.items.length - 1];
|
440
|
-
this.getFocusableElement(lastItem);
|
441
|
-
}
|
442
|
-
focusNextItem(el) {
|
443
|
-
const index = this.itemIndex(el);
|
444
|
-
const nextItem = this.items[index + 1] || this.items[0];
|
445
|
-
this.getFocusableElement(nextItem);
|
446
|
-
}
|
447
|
-
focusPrevItem(el) {
|
448
|
-
const index = this.itemIndex(el);
|
449
|
-
const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
|
450
|
-
this.getFocusableElement(prevItem);
|
451
|
-
}
|
452
|
-
itemIndex(el) {
|
453
|
-
return this.items.indexOf(el);
|
454
|
-
}
|
455
|
-
getFocusableElement(item) {
|
456
|
-
if (!item) {
|
457
|
-
return;
|
458
|
-
}
|
459
|
-
const target = item.attributes.isLink
|
460
|
-
? item.shadowRoot.querySelector("a")
|
461
|
-
: item;
|
462
|
-
focusElement(target);
|
463
|
-
}
|
464
|
-
get el() { return getElement(this); }
|
465
|
-
static get watchers() { return {
|
466
|
-
"active": ["activeHandler"],
|
467
|
-
"open": ["openHandler"],
|
468
|
-
"disabled": ["handleDisabledChange"],
|
469
|
-
"flipPlacements": ["flipPlacementsHandler"],
|
470
|
-
"maxItems": ["maxItemsHandler"],
|
471
|
-
"overlayPositioning": ["overlayPositioningHandler"],
|
472
|
-
"placement": ["placementHandler"]
|
473
|
-
}; }
|
474
|
-
};
|
475
|
-
Dropdown.style = dropdownCss;
|
476
|
-
|
477
|
-
export { Dropdown as calcite_dropdown };
|