@esri/solutions-components 0.5.0 → 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 +88 -92
- 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} +131 -5
- 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 +19 -17
- 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-415ab342.js → downloadUtils-9359e9ff.js} +135 -44
- package/dist/cjs/{index.es-98008aa0.js → index.es-9c0d0ed6.js} +3 -3
- 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 +1 -1
- package/dist/cjs/{mapViewUtils-f617ae9a.js → mapViewUtils-090f4d4d.js} +3 -3
- package/dist/cjs/public-notification.cjs.entry.js +173 -48
- 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 +1 -1
- 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 +4 -8
- package/dist/collection/components/map-select-tools/map-select-tools.js +75 -15
- package/dist/collection/components/public-notification/public-notification.js +217 -25
- 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/queryUtils.js +2 -2
- package/dist/collection/utils/queryUtils.ts +2 -2
- 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 +19 -23
- package/dist/components/map-layer-picker2.js +1 -1
- package/dist/components/map-select-tools2.js +21 -16
- package/dist/components/public-notification.js +209 -81
- package/dist/components/queryUtils.js +2 -2
- 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 +79 -83
- 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} +134 -9
- 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 +19 -17
- 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-606b0f0e.js → downloadUtils-a8f139c5.js} +135 -44
- package/dist/esm/{index.es-c736c805.js → index.es-a75412ff.js} +3 -3
- 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 +1 -1
- package/dist/esm/{mapViewUtils-4e945e07.js → mapViewUtils-8ffcd36d.js} +4 -4
- package/dist/esm/public-notification.entry.js +169 -44
- 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 +1 -1
- 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-4f5641b4.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-72117a18.js → p-765a27f3.js} +1 -1
- 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-6a657ff6.js → p-bb64bd47.js} +25 -9
- package/dist/solutions-components/p-c392dd95.entry.js +17 -0
- 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-dc53c9c1.js +36 -0
- 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/queryUtils.ts +2 -2
- 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/map-select-tools/map-select-tools.d.ts +16 -1
- package/dist/types/components/public-notification/public-notification.d.ts +86 -4
- package/dist/types/components.d.ts +68 -0
- 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-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-5ee7b022.entry.js +0 -12
- 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-84bbaebf.entry.js +0 -6
- package/dist/solutions-components/p-88e28de2.js +0 -36
- package/dist/solutions-components/p-a57ef371.entry.js +0 -6
- package/dist/solutions-components/p-ac76d270.entry.js +0 -17
- package/dist/solutions-components/p-dbc9a5a8.js +0 -21
- package/dist/solutions-components/p-e162304e.entry.js +0 -6
- package/dist/solutions-components/p-f5c70be2.entry.js +0 -6
- package/dist/solutions-components/p-f6b17cc6.entry.js +0 -11
@@ -8,24 +8,149 @@
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
9
9
|
|
10
10
|
const index = require('./index-c6979cbb.js');
|
11
|
+
const dom = require('./dom-4a580af6.js');
|
12
|
+
const guid = require('./guid-84ac4d91.js');
|
13
|
+
const conditionalSlot = require('./conditionalSlot-baada7a3.js');
|
11
14
|
const filter = require('./filter-325f654f.js');
|
12
15
|
const floatingUi = require('./floating-ui-7e3d7775.js');
|
13
|
-
const guid = require('./guid-84ac4d91.js');
|
14
16
|
const utils = require('./utils-b4236001.js');
|
15
17
|
const label = require('./label-24fcd8a5.js');
|
16
18
|
const form = require('./form-ef410342.js');
|
17
19
|
const observers = require('./observers-5311faf8.js');
|
18
20
|
const interactive = require('./interactive-0a68ab99.js');
|
19
|
-
const dom = require('./dom-4a580af6.js');
|
20
21
|
const openCloseComponent = require('./openCloseComponent-bf986132.js');
|
21
22
|
const debounce = require('./debounce-69c3bada.js');
|
22
|
-
const
|
23
|
-
const mapViewUtils = require('./mapViewUtils-f617ae9a.js');
|
23
|
+
const mapViewUtils = require('./mapViewUtils-090f4d4d.js');
|
24
24
|
const publicNotificationStore = require('./publicNotificationStore-20e924f5.js');
|
25
25
|
require('./resources-b56bce71.js');
|
26
|
-
require('./interfaces-
|
26
|
+
require('./interfaces-cac36920.js');
|
27
27
|
require('./index-763f87ac.js');
|
28
28
|
|
29
|
+
/*!
|
30
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
31
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
32
|
+
* v1.0.0-beta.97
|
33
|
+
*/
|
34
|
+
const CSS$1 = {
|
35
|
+
title: "title",
|
36
|
+
close: "close",
|
37
|
+
imageContainer: "image-container",
|
38
|
+
chipIcon: "chip-icon",
|
39
|
+
closeIcon: "close-icon"
|
40
|
+
};
|
41
|
+
const TEXT = {
|
42
|
+
close: "Close"
|
43
|
+
};
|
44
|
+
const SLOTS = {
|
45
|
+
image: "image"
|
46
|
+
};
|
47
|
+
const ICONS = {
|
48
|
+
close: "x"
|
49
|
+
};
|
50
|
+
|
51
|
+
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}";
|
52
|
+
|
53
|
+
const Chip = class {
|
54
|
+
constructor(hostRef) {
|
55
|
+
index.registerInstance(this, hostRef);
|
56
|
+
this.calciteChipDismiss = index.createEvent(this, "calciteChipDismiss", 6);
|
57
|
+
//--------------------------------------------------------------------------
|
58
|
+
//
|
59
|
+
// Public Properties
|
60
|
+
//
|
61
|
+
//--------------------------------------------------------------------------
|
62
|
+
/** Specifies the appearance style of the component. */
|
63
|
+
this.appearance = "solid";
|
64
|
+
/** Specifies the color for the component. */
|
65
|
+
this.color = "grey";
|
66
|
+
/**
|
67
|
+
* When `true`, a close button is added to the component.
|
68
|
+
*
|
69
|
+
* @deprecated use `closable` instead.
|
70
|
+
*/
|
71
|
+
this.dismissible = false;
|
72
|
+
/** When `true`, a close button is added to the component. */
|
73
|
+
this.closable = false;
|
74
|
+
/**
|
75
|
+
* Accessible name for the component's close button.
|
76
|
+
*
|
77
|
+
* @default "Close"
|
78
|
+
*/
|
79
|
+
this.dismissLabel = TEXT.close;
|
80
|
+
/** When `true`, the icon will be flipped when the element direction is right-to-left (`"rtl"`). */
|
81
|
+
this.iconFlipRtl = false;
|
82
|
+
/** Specifies the size of the component. */
|
83
|
+
this.scale = "m";
|
84
|
+
/** When `true`, hides the component. */
|
85
|
+
this.closed = false;
|
86
|
+
// --------------------------------------------------------------------------
|
87
|
+
//
|
88
|
+
// Private Methods
|
89
|
+
//
|
90
|
+
// --------------------------------------------------------------------------
|
91
|
+
this.closeClickHandler = (event) => {
|
92
|
+
event.preventDefault();
|
93
|
+
this.calciteChipDismiss.emit(this.el);
|
94
|
+
this.closed = true;
|
95
|
+
};
|
96
|
+
this.guid = guid.guid();
|
97
|
+
}
|
98
|
+
handleDismissible(value) {
|
99
|
+
this.closable = value;
|
100
|
+
}
|
101
|
+
handleClosable(value) {
|
102
|
+
this.dismissible = value;
|
103
|
+
}
|
104
|
+
// --------------------------------------------------------------------------
|
105
|
+
//
|
106
|
+
// Lifecycle
|
107
|
+
//
|
108
|
+
// --------------------------------------------------------------------------
|
109
|
+
connectedCallback() {
|
110
|
+
conditionalSlot.connectConditionalSlotComponent(this);
|
111
|
+
if (this.dismissible) {
|
112
|
+
this.handleDismissible(this.dismissible);
|
113
|
+
}
|
114
|
+
if (this.closable) {
|
115
|
+
this.handleClosable(this.closable);
|
116
|
+
}
|
117
|
+
}
|
118
|
+
disconnectedCallback() {
|
119
|
+
conditionalSlot.disconnectConditionalSlotComponent(this);
|
120
|
+
}
|
121
|
+
//--------------------------------------------------------------------------
|
122
|
+
//
|
123
|
+
// Public Methods
|
124
|
+
//
|
125
|
+
//--------------------------------------------------------------------------
|
126
|
+
/** Sets focus on the component. */
|
127
|
+
async setFocus() {
|
128
|
+
var _a;
|
129
|
+
(_a = this.closeButton) === null || _a === void 0 ? void 0 : _a.focus();
|
130
|
+
}
|
131
|
+
//--------------------------------------------------------------------------
|
132
|
+
//
|
133
|
+
// Render Methods
|
134
|
+
//
|
135
|
+
//--------------------------------------------------------------------------
|
136
|
+
renderChipImage() {
|
137
|
+
const { el } = this;
|
138
|
+
const hasChipImage = dom.getSlotted(el, SLOTS.image);
|
139
|
+
return hasChipImage ? (index.h("div", { class: CSS$1.imageContainer, key: "image" }, index.h("slot", { name: SLOTS.image }))) : null;
|
140
|
+
}
|
141
|
+
render() {
|
142
|
+
const iconEl = (index.h("calcite-icon", { class: CSS$1.chipIcon, flipRtl: this.iconFlipRtl, icon: this.icon, scale: "s" }));
|
143
|
+
const closeButton = (index.h("button", { "aria-describedby": this.guid, "aria-label": this.dismissLabel, class: CSS$1.close, onClick: this.closeClickHandler, ref: (el) => (this.closeButton = el) }, index.h("calcite-icon", { class: CSS$1.closeIcon, icon: ICONS.close, scale: "s" })));
|
144
|
+
return (index.h("div", { class: "container" }, this.renderChipImage(), this.icon ? iconEl : null, index.h("span", { class: CSS$1.title, id: this.guid }, index.h("slot", null)), this.closable ? closeButton : null));
|
145
|
+
}
|
146
|
+
get el() { return index.getElement(this); }
|
147
|
+
static get watchers() { return {
|
148
|
+
"dismissible": ["handleDismissible"],
|
149
|
+
"closable": ["handleClosable"]
|
150
|
+
}; }
|
151
|
+
};
|
152
|
+
Chip.style = chipCss;
|
153
|
+
|
29
154
|
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}";
|
30
155
|
|
31
156
|
const isGroup = (el) => el.tagName === utils.ComboboxItemGroup;
|
@@ -1133,6 +1258,7 @@ const MapLayerPicker = class {
|
|
1133
1258
|
};
|
1134
1259
|
MapLayerPicker.style = mapLayerPickerCss;
|
1135
1260
|
|
1261
|
+
exports.calcite_chip = Chip;
|
1136
1262
|
exports.calcite_combobox = Combobox;
|
1137
1263
|
exports.calcite_combobox_item = ComboboxItem;
|
1138
1264
|
exports.map_layer_picker = MapLayerPicker;
|
@@ -9,12 +9,477 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
10
10
|
const index = require('./index-c6979cbb.js');
|
11
11
|
const dom = require('./dom-4a580af6.js');
|
12
|
+
const floatingUi = require('./floating-ui-7e3d7775.js');
|
13
|
+
const observers = require('./observers-5311faf8.js');
|
12
14
|
const interactive = require('./interactive-0a68ab99.js');
|
15
|
+
const openCloseComponent = require('./openCloseComponent-bf986132.js');
|
16
|
+
const guid = require('./guid-84ac4d91.js');
|
17
|
+
const key = require('./key-55aca5c0.js');
|
13
18
|
const locale = require('./locale-04da9a8c.js');
|
14
19
|
require('./resources-b56bce71.js');
|
15
|
-
require('./
|
20
|
+
require('./debounce-69c3bada.js');
|
16
21
|
require('./_commonjsHelpers-384729db.js');
|
17
22
|
|
23
|
+
/*!
|
24
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
25
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
26
|
+
* v1.0.0-beta.97
|
27
|
+
*/
|
28
|
+
const SLOTS = {
|
29
|
+
dropdownTrigger: "dropdown-trigger"
|
30
|
+
};
|
31
|
+
|
32
|
+
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}";
|
33
|
+
|
34
|
+
const Dropdown = class {
|
35
|
+
constructor(hostRef) {
|
36
|
+
index.registerInstance(this, hostRef);
|
37
|
+
this.calciteDropdownSelect = index.createEvent(this, "calciteDropdownSelect", 6);
|
38
|
+
this.calciteDropdownBeforeClose = index.createEvent(this, "calciteDropdownBeforeClose", 6);
|
39
|
+
this.calciteDropdownClose = index.createEvent(this, "calciteDropdownClose", 6);
|
40
|
+
this.calciteDropdownBeforeOpen = index.createEvent(this, "calciteDropdownBeforeOpen", 6);
|
41
|
+
this.calciteDropdownOpen = index.createEvent(this, "calciteDropdownOpen", 6);
|
42
|
+
//--------------------------------------------------------------------------
|
43
|
+
//
|
44
|
+
// Public Properties
|
45
|
+
//
|
46
|
+
//--------------------------------------------------------------------------
|
47
|
+
/**
|
48
|
+
* Opens or closes the dropdown
|
49
|
+
*
|
50
|
+
* @deprecated use open instead.
|
51
|
+
*/
|
52
|
+
this.active = false;
|
53
|
+
/** When true, opens the dropdown */
|
54
|
+
this.open = false;
|
55
|
+
/**
|
56
|
+
allow the dropdown to remain open after a selection is made
|
57
|
+
if the selection-mode of the selected item's containing group is "none", the dropdown will always close
|
58
|
+
*/
|
59
|
+
this.disableCloseOnSelect = false;
|
60
|
+
/** is the dropdown disabled */
|
61
|
+
this.disabled = false;
|
62
|
+
/**
|
63
|
+
specify the maximum number of calcite-dropdown-items to display before showing the scroller, must be greater than 0 -
|
64
|
+
this value does not include groupTitles passed to calcite-dropdown-group
|
65
|
+
*/
|
66
|
+
this.maxItems = 0;
|
67
|
+
/**
|
68
|
+
* Determines the type of positioning to use for the overlaid content.
|
69
|
+
*
|
70
|
+
* Using `"absolute"` will work for most cases. The component will be positioned inside of overflowing parent containers and will affect the container's layout.
|
71
|
+
*
|
72
|
+
* `"fixed"` should be used to escape an overflowing parent container, or when the reference element's `position` CSS property is `"fixed"`.
|
73
|
+
*
|
74
|
+
*/
|
75
|
+
this.overlayPositioning = "absolute";
|
76
|
+
/**
|
77
|
+
* Determines where the dropdown will be positioned relative to the button.
|
78
|
+
*
|
79
|
+
* @default "bottom-start"
|
80
|
+
*/
|
81
|
+
this.placement = floatingUi.defaultMenuPlacement;
|
82
|
+
/** specify the scale of dropdown, defaults to m */
|
83
|
+
this.scale = "m";
|
84
|
+
/**
|
85
|
+
* **read-only** The currently selected items
|
86
|
+
*
|
87
|
+
* @readonly
|
88
|
+
*/
|
89
|
+
this.selectedItems = [];
|
90
|
+
/** specify whether the dropdown is opened by hover or click of a trigger element */
|
91
|
+
this.type = "click";
|
92
|
+
this.items = [];
|
93
|
+
this.groups = [];
|
94
|
+
this.mutationObserver = observers.createObserver("mutation", () => this.updateItems());
|
95
|
+
this.resizeObserver = observers.createObserver("resize", (entries) => this.resizeObserverCallback(entries));
|
96
|
+
this.openTransitionProp = "visibility";
|
97
|
+
this.guid = `calcite-dropdown-${guid.guid()}`;
|
98
|
+
this.defaultAssignedElements = [];
|
99
|
+
//--------------------------------------------------------------------------
|
100
|
+
//
|
101
|
+
// Private Methods
|
102
|
+
//
|
103
|
+
//--------------------------------------------------------------------------
|
104
|
+
this.slotChangeHandler = (event) => {
|
105
|
+
this.defaultAssignedElements = event.target.assignedElements({
|
106
|
+
flatten: true
|
107
|
+
});
|
108
|
+
this.updateItems();
|
109
|
+
};
|
110
|
+
this.setFilteredPlacements = () => {
|
111
|
+
const { el, flipPlacements } = this;
|
112
|
+
this.filteredFlipPlacements = flipPlacements
|
113
|
+
? floatingUi.filterComputedPlacements(flipPlacements, el)
|
114
|
+
: null;
|
115
|
+
};
|
116
|
+
this.updateTriggers = (event) => {
|
117
|
+
this.triggers = event.target.assignedElements({
|
118
|
+
flatten: true
|
119
|
+
});
|
120
|
+
this.reposition(true);
|
121
|
+
};
|
122
|
+
this.updateItems = () => {
|
123
|
+
this.items = this.groups
|
124
|
+
.map((group) => Array.from(group === null || group === void 0 ? void 0 : group.querySelectorAll("calcite-dropdown-item")))
|
125
|
+
.reduce((previousValue, currentValue) => [...previousValue, ...currentValue], []);
|
126
|
+
this.updateSelectedItems();
|
127
|
+
this.reposition(true);
|
128
|
+
};
|
129
|
+
this.updateGroups = (event) => {
|
130
|
+
const groups = event.target
|
131
|
+
.assignedElements({ flatten: true })
|
132
|
+
.filter((el) => el === null || el === void 0 ? void 0 : el.matches("calcite-dropdown-group"));
|
133
|
+
this.groups = groups;
|
134
|
+
this.updateItems();
|
135
|
+
};
|
136
|
+
this.resizeObserverCallback = (entries) => {
|
137
|
+
entries.forEach((entry) => {
|
138
|
+
const { target } = entry;
|
139
|
+
if (target === this.referenceEl) {
|
140
|
+
this.setDropdownWidth();
|
141
|
+
}
|
142
|
+
else if (target === this.scrollerEl) {
|
143
|
+
this.setMaxScrollerHeight();
|
144
|
+
}
|
145
|
+
});
|
146
|
+
};
|
147
|
+
this.setDropdownWidth = () => {
|
148
|
+
const { referenceEl, scrollerEl } = this;
|
149
|
+
const referenceElWidth = referenceEl === null || referenceEl === void 0 ? void 0 : referenceEl.clientWidth;
|
150
|
+
if (!referenceElWidth || !scrollerEl) {
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
scrollerEl.style.minWidth = `${referenceElWidth}px`;
|
154
|
+
};
|
155
|
+
this.setMaxScrollerHeight = () => {
|
156
|
+
const { scrollerEl } = this;
|
157
|
+
if (!scrollerEl) {
|
158
|
+
return;
|
159
|
+
}
|
160
|
+
this.reposition(true);
|
161
|
+
const maxScrollerHeight = this.getMaxScrollerHeight();
|
162
|
+
scrollerEl.style.maxHeight = maxScrollerHeight > 0 ? `${maxScrollerHeight}px` : "";
|
163
|
+
this.reposition(true);
|
164
|
+
};
|
165
|
+
this.setScrollerAndTransitionEl = (el) => {
|
166
|
+
this.resizeObserver.observe(el);
|
167
|
+
this.scrollerEl = el;
|
168
|
+
this.transitionEl = el;
|
169
|
+
openCloseComponent.connectOpenCloseComponent(this);
|
170
|
+
};
|
171
|
+
this.setReferenceEl = (el) => {
|
172
|
+
this.referenceEl = el;
|
173
|
+
floatingUi.connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
174
|
+
this.resizeObserver.observe(el);
|
175
|
+
};
|
176
|
+
this.setFloatingEl = (el) => {
|
177
|
+
this.floatingEl = el;
|
178
|
+
floatingUi.connectFloatingUI(this, this.referenceEl, this.floatingEl);
|
179
|
+
};
|
180
|
+
this.keyDownHandler = (event) => {
|
181
|
+
const target = event.target;
|
182
|
+
if (target !== this.referenceEl) {
|
183
|
+
return;
|
184
|
+
}
|
185
|
+
const { defaultPrevented, key: key$1 } = event;
|
186
|
+
if (defaultPrevented) {
|
187
|
+
return;
|
188
|
+
}
|
189
|
+
if (this.open) {
|
190
|
+
if (key$1 === "Escape") {
|
191
|
+
this.closeCalciteDropdown();
|
192
|
+
event.preventDefault();
|
193
|
+
return;
|
194
|
+
}
|
195
|
+
else if (event.shiftKey && key$1 === "Tab") {
|
196
|
+
this.closeCalciteDropdown();
|
197
|
+
event.preventDefault();
|
198
|
+
return;
|
199
|
+
}
|
200
|
+
}
|
201
|
+
if (key.isActivationKey(key$1)) {
|
202
|
+
this.openCalciteDropdown();
|
203
|
+
event.preventDefault();
|
204
|
+
}
|
205
|
+
else if (key$1 === "Escape") {
|
206
|
+
this.closeCalciteDropdown();
|
207
|
+
event.preventDefault();
|
208
|
+
}
|
209
|
+
};
|
210
|
+
this.focusOnFirstActiveOrFirstItem = () => {
|
211
|
+
this.getFocusableElement(this.items.find((item) => item.selected) || this.items[0]);
|
212
|
+
};
|
213
|
+
this.toggleOpenEnd = () => {
|
214
|
+
this.focusOnFirstActiveOrFirstItem();
|
215
|
+
this.el.removeEventListener("calciteDropdownOpen", this.toggleOpenEnd);
|
216
|
+
};
|
217
|
+
this.openCalciteDropdown = () => {
|
218
|
+
this.open = !this.open;
|
219
|
+
if (this.open) {
|
220
|
+
this.el.addEventListener("calciteDropdownOpen", this.toggleOpenEnd);
|
221
|
+
}
|
222
|
+
};
|
223
|
+
}
|
224
|
+
activeHandler(value) {
|
225
|
+
this.open = value;
|
226
|
+
}
|
227
|
+
openHandler(value) {
|
228
|
+
if (!this.disabled) {
|
229
|
+
if (value) {
|
230
|
+
this.reposition(true);
|
231
|
+
}
|
232
|
+
else {
|
233
|
+
floatingUi.updateAfterClose(this.floatingEl);
|
234
|
+
}
|
235
|
+
this.active = value;
|
236
|
+
return;
|
237
|
+
}
|
238
|
+
if (!value) {
|
239
|
+
floatingUi.updateAfterClose(this.floatingEl);
|
240
|
+
}
|
241
|
+
this.open = false;
|
242
|
+
}
|
243
|
+
handleDisabledChange(value) {
|
244
|
+
if (!value) {
|
245
|
+
this.open = false;
|
246
|
+
}
|
247
|
+
}
|
248
|
+
flipPlacementsHandler() {
|
249
|
+
this.setFilteredPlacements();
|
250
|
+
this.reposition(true);
|
251
|
+
}
|
252
|
+
maxItemsHandler() {
|
253
|
+
this.setMaxScrollerHeight();
|
254
|
+
}
|
255
|
+
overlayPositioningHandler() {
|
256
|
+
this.reposition(true);
|
257
|
+
}
|
258
|
+
placementHandler() {
|
259
|
+
this.reposition(true);
|
260
|
+
}
|
261
|
+
//--------------------------------------------------------------------------
|
262
|
+
//
|
263
|
+
// Lifecycle
|
264
|
+
//
|
265
|
+
//--------------------------------------------------------------------------
|
266
|
+
connectedCallback() {
|
267
|
+
var _a;
|
268
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true, subtree: true });
|
269
|
+
this.setFilteredPlacements();
|
270
|
+
this.reposition(true);
|
271
|
+
if (this.open) {
|
272
|
+
this.openHandler(this.open);
|
273
|
+
}
|
274
|
+
if (this.active) {
|
275
|
+
this.activeHandler(this.active);
|
276
|
+
}
|
277
|
+
openCloseComponent.connectOpenCloseComponent(this);
|
278
|
+
}
|
279
|
+
componentDidLoad() {
|
280
|
+
this.reposition(true);
|
281
|
+
}
|
282
|
+
componentDidRender() {
|
283
|
+
interactive.updateHostInteraction(this);
|
284
|
+
}
|
285
|
+
disconnectedCallback() {
|
286
|
+
var _a, _b;
|
287
|
+
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
288
|
+
floatingUi.disconnectFloatingUI(this, this.referenceEl, this.floatingEl);
|
289
|
+
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
290
|
+
openCloseComponent.disconnectOpenCloseComponent(this);
|
291
|
+
}
|
292
|
+
render() {
|
293
|
+
const { open, guid } = this;
|
294
|
+
return (index.h(index.Host, null, index.h("div", { class: "calcite-dropdown-trigger-container", id: `${guid}-menubutton`, onClick: this.openCalciteDropdown, onKeyDown: this.keyDownHandler, ref: this.setReferenceEl }, index.h("slot", { "aria-controls": `${guid}-menu`, "aria-expanded": dom.toAriaBoolean(open), "aria-haspopup": "menu", name: SLOTS.dropdownTrigger, onSlotchange: this.updateTriggers })), index.h("div", { "aria-hidden": dom.toAriaBoolean(!open), class: "calcite-dropdown-wrapper", ref: this.setFloatingEl }, index.h("div", { "aria-labelledby": `${guid}-menubutton`, class: {
|
295
|
+
["calcite-dropdown-content"]: true,
|
296
|
+
[floatingUi.FloatingCSS.animation]: true,
|
297
|
+
[floatingUi.FloatingCSS.animationActive]: open
|
298
|
+
}, id: `${guid}-menu`, ref: this.setScrollerAndTransitionEl, role: "menu" }, index.h("slot", { onSlotchange: this.updateGroups })))));
|
299
|
+
}
|
300
|
+
//--------------------------------------------------------------------------
|
301
|
+
//
|
302
|
+
// Public Methods
|
303
|
+
//
|
304
|
+
//--------------------------------------------------------------------------
|
305
|
+
/**
|
306
|
+
* Updates the position of the component.
|
307
|
+
*
|
308
|
+
* @param delayed
|
309
|
+
*/
|
310
|
+
async reposition(delayed = false) {
|
311
|
+
const { floatingEl, referenceEl, placement, overlayPositioning, filteredFlipPlacements } = this;
|
312
|
+
return floatingUi.reposition(this, {
|
313
|
+
floatingEl,
|
314
|
+
referenceEl,
|
315
|
+
overlayPositioning,
|
316
|
+
placement,
|
317
|
+
flipPlacements: filteredFlipPlacements,
|
318
|
+
type: "menu"
|
319
|
+
}, delayed);
|
320
|
+
}
|
321
|
+
closeCalciteDropdownOnClick(event) {
|
322
|
+
if (!dom.isPrimaryPointerButton(event) || !this.open || event.composedPath().includes(this.el)) {
|
323
|
+
return;
|
324
|
+
}
|
325
|
+
this.closeCalciteDropdown(false);
|
326
|
+
}
|
327
|
+
closeCalciteDropdownOnEvent(event) {
|
328
|
+
this.closeCalciteDropdown();
|
329
|
+
event.stopPropagation();
|
330
|
+
}
|
331
|
+
closeCalciteDropdownOnOpenEvent(event) {
|
332
|
+
if (event.composedPath().includes(this.el)) {
|
333
|
+
return;
|
334
|
+
}
|
335
|
+
this.open = false;
|
336
|
+
}
|
337
|
+
mouseEnterHandler() {
|
338
|
+
if (this.type === "hover") {
|
339
|
+
this.openCalciteDropdown();
|
340
|
+
}
|
341
|
+
}
|
342
|
+
mouseLeaveHandler() {
|
343
|
+
if (this.type === "hover") {
|
344
|
+
this.closeCalciteDropdown();
|
345
|
+
}
|
346
|
+
}
|
347
|
+
calciteInternalDropdownItemKeyEvent(event) {
|
348
|
+
const { keyboardEvent } = event.detail;
|
349
|
+
// handle edge
|
350
|
+
const target = keyboardEvent.target;
|
351
|
+
const itemToFocus = target.nodeName !== "A" ? target : target.parentNode;
|
352
|
+
const isFirstItem = this.itemIndex(itemToFocus) === 0;
|
353
|
+
const isLastItem = this.itemIndex(itemToFocus) === this.items.length - 1;
|
354
|
+
switch (keyboardEvent.key) {
|
355
|
+
case "Tab":
|
356
|
+
if (isLastItem && !keyboardEvent.shiftKey) {
|
357
|
+
this.closeCalciteDropdown();
|
358
|
+
}
|
359
|
+
else if (isFirstItem && keyboardEvent.shiftKey) {
|
360
|
+
this.closeCalciteDropdown();
|
361
|
+
}
|
362
|
+
else if (keyboardEvent.shiftKey) {
|
363
|
+
this.focusPrevItem(itemToFocus);
|
364
|
+
}
|
365
|
+
else {
|
366
|
+
this.focusNextItem(itemToFocus);
|
367
|
+
}
|
368
|
+
break;
|
369
|
+
case "ArrowDown":
|
370
|
+
this.focusNextItem(itemToFocus);
|
371
|
+
break;
|
372
|
+
case "ArrowUp":
|
373
|
+
this.focusPrevItem(itemToFocus);
|
374
|
+
break;
|
375
|
+
case "Home":
|
376
|
+
this.focusFirstItem();
|
377
|
+
break;
|
378
|
+
case "End":
|
379
|
+
this.focusLastItem();
|
380
|
+
break;
|
381
|
+
}
|
382
|
+
event.stopPropagation();
|
383
|
+
}
|
384
|
+
handleItemSelect(event) {
|
385
|
+
this.updateSelectedItems();
|
386
|
+
event.stopPropagation();
|
387
|
+
this.calciteDropdownSelect.emit({
|
388
|
+
item: event.detail.requestedDropdownItem
|
389
|
+
});
|
390
|
+
if (!this.disableCloseOnSelect ||
|
391
|
+
event.detail.requestedDropdownGroup.selectionMode === "none") {
|
392
|
+
this.closeCalciteDropdown();
|
393
|
+
}
|
394
|
+
event.stopPropagation();
|
395
|
+
}
|
396
|
+
onBeforeOpen() {
|
397
|
+
this.calciteDropdownBeforeOpen.emit();
|
398
|
+
}
|
399
|
+
onOpen() {
|
400
|
+
this.calciteDropdownOpen.emit();
|
401
|
+
}
|
402
|
+
onBeforeClose() {
|
403
|
+
this.calciteDropdownBeforeClose.emit();
|
404
|
+
}
|
405
|
+
onClose() {
|
406
|
+
this.calciteDropdownClose.emit();
|
407
|
+
}
|
408
|
+
updateSelectedItems() {
|
409
|
+
this.selectedItems = this.items.filter((item) => item.selected);
|
410
|
+
}
|
411
|
+
getMaxScrollerHeight() {
|
412
|
+
const { maxItems, items } = this;
|
413
|
+
let itemsToProcess = 0;
|
414
|
+
let maxScrollerHeight = 0;
|
415
|
+
let groupHeaderHeight;
|
416
|
+
this.groups.forEach((group) => {
|
417
|
+
if (maxItems > 0 && itemsToProcess < maxItems) {
|
418
|
+
Array.from(group.children).forEach((item, index) => {
|
419
|
+
if (index === 0) {
|
420
|
+
if (isNaN(groupHeaderHeight)) {
|
421
|
+
groupHeaderHeight = item.offsetTop;
|
422
|
+
}
|
423
|
+
maxScrollerHeight += groupHeaderHeight;
|
424
|
+
}
|
425
|
+
if (itemsToProcess < maxItems) {
|
426
|
+
maxScrollerHeight += item.offsetHeight;
|
427
|
+
itemsToProcess += 1;
|
428
|
+
}
|
429
|
+
});
|
430
|
+
}
|
431
|
+
});
|
432
|
+
return items.length > maxItems ? maxScrollerHeight : 0;
|
433
|
+
}
|
434
|
+
closeCalciteDropdown(focusTrigger = true) {
|
435
|
+
this.open = false;
|
436
|
+
if (focusTrigger) {
|
437
|
+
dom.focusElement(this.triggers[0]);
|
438
|
+
}
|
439
|
+
}
|
440
|
+
focusFirstItem() {
|
441
|
+
const firstItem = this.items[0];
|
442
|
+
this.getFocusableElement(firstItem);
|
443
|
+
}
|
444
|
+
focusLastItem() {
|
445
|
+
const lastItem = this.items[this.items.length - 1];
|
446
|
+
this.getFocusableElement(lastItem);
|
447
|
+
}
|
448
|
+
focusNextItem(el) {
|
449
|
+
const index = this.itemIndex(el);
|
450
|
+
const nextItem = this.items[index + 1] || this.items[0];
|
451
|
+
this.getFocusableElement(nextItem);
|
452
|
+
}
|
453
|
+
focusPrevItem(el) {
|
454
|
+
const index = this.itemIndex(el);
|
455
|
+
const prevItem = this.items[index - 1] || this.items[this.items.length - 1];
|
456
|
+
this.getFocusableElement(prevItem);
|
457
|
+
}
|
458
|
+
itemIndex(el) {
|
459
|
+
return this.items.indexOf(el);
|
460
|
+
}
|
461
|
+
getFocusableElement(item) {
|
462
|
+
if (!item) {
|
463
|
+
return;
|
464
|
+
}
|
465
|
+
const target = item.attributes.isLink
|
466
|
+
? item.shadowRoot.querySelector("a")
|
467
|
+
: item;
|
468
|
+
dom.focusElement(target);
|
469
|
+
}
|
470
|
+
get el() { return index.getElement(this); }
|
471
|
+
static get watchers() { return {
|
472
|
+
"active": ["activeHandler"],
|
473
|
+
"open": ["openHandler"],
|
474
|
+
"disabled": ["handleDisabledChange"],
|
475
|
+
"flipPlacements": ["flipPlacementsHandler"],
|
476
|
+
"maxItems": ["maxItemsHandler"],
|
477
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
478
|
+
"placement": ["placementHandler"]
|
479
|
+
}; }
|
480
|
+
};
|
481
|
+
Dropdown.style = dropdownCss;
|
482
|
+
|
18
483
|
/*!
|
19
484
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
20
485
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
@@ -457,6 +922,7 @@ const EditRecordModal = class {
|
|
457
922
|
};
|
458
923
|
EditRecordModal.style = editRecordModalCss;
|
459
924
|
|
925
|
+
exports.calcite_dropdown = Dropdown;
|
460
926
|
exports.calcite_dropdown_group = DropdownGroup;
|
461
927
|
exports.calcite_dropdown_item = DropdownItem;
|
462
928
|
exports.calcite_split_button = SplitButton;
|