@esri/solutions-components 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/feature-comments/resources.json +3 -0
- package/dist/assets/t9n/feature-comments/resources_en.json +3 -0
- package/dist/assets/t9n/feature-form-flow-item/resources.json +3 -0
- package/dist/assets/t9n/feature-form-flow-item/resources_en.json +3 -0
- package/dist/assets/t9n/layer-table/resources.json +2 -1
- package/dist/assets/t9n/layer-table/resources_en.json +2 -1
- package/dist/assets/t9n/list-flow-item/resources.json +3 -0
- package/dist/assets/t9n/list-flow-item/resources_en.json +3 -0
- package/dist/assets/t9n/location-flow-item/resources.json +3 -0
- package/dist/assets/t9n/location-flow-item/resources_en.json +3 -0
- package/dist/assets/t9n/share-item/resources.json +3 -0
- package/dist/assets/t9n/share-item/resources_en.json +3 -0
- package/dist/cjs/{list-item.cjs.entry.js → arcgis-login.cjs.entry.js} +4 -19
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +13 -9
- package/dist/cjs/calcite-action_2.cjs.entry.js +61 -392
- package/dist/cjs/calcite-alert_3.cjs.entry.js +21 -3
- package/dist/cjs/calcite-combobox_6.cjs.entry.js +32 -8
- package/dist/cjs/calcite-popover.cjs.entry.js +418 -0
- package/dist/cjs/card-manager_3.cjs.entry.js +154 -18
- package/dist/cjs/crowdsource-manager.cjs.entry.js +24 -2
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +45 -6
- package/dist/cjs/{downloadUtils-e3e595e9.js → downloadUtils-9c4fde54.js} +2 -2
- package/dist/cjs/feature-comments.cjs.entry.js +60 -0
- package/dist/cjs/feature-form-flow-item.cjs.entry.js +60 -0
- package/dist/cjs/features-flow-item.cjs.entry.js +60 -0
- package/dist/cjs/{index.es-047537b5.js → index.es-d208a6d6.js} +2 -2
- package/dist/cjs/list-flow-item.cjs.entry.js +60 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/location-flow-item.cjs.entry.js +60 -0
- package/dist/cjs/map-select-tools_3.cjs.entry.js +2 -2
- package/dist/cjs/{mapViewUtils-f7bbc35b.js → mapViewUtils-bab83c90.js} +21 -0
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/refine-results-flow-item.cjs.entry.js +60 -0
- package/dist/cjs/share-item.cjs.entry.js +60 -0
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +8 -1
- package/dist/collection/components/{list-item/list-item.js → arcgis-login/arcgis-login.js} +4 -19
- package/dist/collection/components/arcgis-login/test/arcgis-login.e2e.js +29 -0
- package/dist/collection/components/arcgis-login/test/arcgis-login.spec.js +37 -0
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +118 -2
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +294 -6
- package/dist/collection/components/feature-comments/feature-comments.css +19 -0
- package/dist/collection/components/feature-comments/feature-comments.js +74 -0
- package/dist/collection/components/feature-comments/test/feature-comments.e2e.js +29 -0
- package/dist/collection/components/feature-comments/test/feature-comments.spec.js +37 -0
- package/dist/collection/components/feature-form-flow-item/feature-form-flow-item.css +19 -0
- package/dist/collection/components/feature-form-flow-item/feature-form-flow-item.js +74 -0
- package/dist/collection/components/feature-form-flow-item/test/feature-form-flow-item.e2e.js +29 -0
- package/dist/collection/components/feature-form-flow-item/test/feature-form-flow-item.spec.js +37 -0
- package/dist/collection/components/features-flow-item/features-flow-item.css +19 -0
- package/dist/collection/components/features-flow-item/features-flow-item.js +74 -0
- package/dist/collection/components/features-flow-item/test/features-flow-item.e2e.js +29 -0
- package/dist/collection/components/features-flow-item/test/features-flow-item.spec.js +37 -0
- package/dist/collection/components/info-card/info-card.js +21 -2
- package/dist/collection/components/layer-table/layer-table.js +199 -10
- package/dist/collection/components/list-flow-item/list-flow-item.css +19 -0
- package/dist/collection/components/list-flow-item/list-flow-item.js +74 -0
- package/dist/collection/components/list-flow-item/test/list-flow-item.e2e.js +29 -0
- package/dist/collection/components/list-flow-item/test/list-flow-item.spec.js +37 -0
- package/dist/collection/components/location-flow-item/location-flow-item.css +19 -0
- package/dist/collection/components/location-flow-item/location-flow-item.js +74 -0
- package/dist/collection/components/location-flow-item/test/location-flow-item.e2e.js +29 -0
- package/dist/collection/components/location-flow-item/test/location-flow-item.spec.js +37 -0
- package/dist/collection/components/map-card/map-card.js +38 -7
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +49 -7
- package/dist/collection/components/map-picker/map-picker.js +37 -9
- package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.css +19 -0
- package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.js +74 -0
- package/dist/collection/components/refine-results-flow-item/test/refine-results-flow-item.e2e.js +29 -0
- package/dist/collection/components/refine-results-flow-item/test/refine-results-flow-item.spec.js +37 -0
- package/dist/collection/components/share-item/share-item.css +19 -0
- package/dist/collection/components/share-item/share-item.js +74 -0
- package/dist/collection/components/share-item/test/share-item.e2e.js +29 -0
- package/dist/collection/components/share-item/test/share-item.spec.js +37 -0
- package/dist/collection/demos/crowdsource-reporter.html +56 -15
- package/dist/collection/utils/interfaces.ts +5 -0
- package/dist/collection/utils/queryUtils.js +20 -0
- package/dist/collection/utils/queryUtils.ts +26 -0
- package/dist/components/arcgis-login.d.ts +11 -0
- package/dist/components/arcgis-login.js +75 -0
- package/dist/components/calcite-list-item.js +1 -1
- package/dist/components/card-manager2.js +7 -1
- package/dist/components/crowdsource-manager.js +32 -3
- package/dist/components/crowdsource-reporter.js +61 -7
- package/dist/components/feature-comments.d.ts +11 -0
- package/dist/components/feature-comments.js +75 -0
- package/dist/components/feature-form-flow-item.d.ts +11 -0
- package/dist/components/feature-form-flow-item.js +75 -0
- package/dist/components/features-flow-item.d.ts +11 -0
- package/dist/components/features-flow-item.js +75 -0
- package/dist/components/info-card2.js +28 -3
- package/dist/components/layer-table2.js +138 -10
- package/dist/components/list-flow-item.d.ts +11 -0
- package/dist/components/list-flow-item.js +75 -0
- package/dist/components/list-item.js +425 -55
- package/dist/components/location-flow-item.d.ts +11 -0
- package/dist/components/location-flow-item.js +75 -0
- package/dist/components/map-card2.js +22 -8
- package/dist/components/map-layer-picker2.js +32 -7
- package/dist/components/map-picker2.js +16 -11
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/public-notification.js +1 -1
- package/dist/components/queryUtils.js +21 -1
- package/dist/components/refine-results-flow-item.d.ts +11 -0
- package/dist/components/refine-results-flow-item.js +75 -0
- package/dist/components/refine-selection2.js +2 -2
- package/dist/components/{list-item.d.ts → share-item.d.ts} +4 -4
- package/dist/components/share-item.js +75 -0
- package/dist/esm/{list-item.entry.js → arcgis-login.entry.js} +4 -19
- package/dist/esm/basemap-gallery_7.entry.js +13 -9
- package/dist/esm/calcite-action_2.entry.js +63 -394
- package/dist/esm/calcite-alert_3.entry.js +21 -3
- package/dist/esm/calcite-combobox_6.entry.js +32 -8
- package/dist/esm/calcite-popover.entry.js +414 -0
- package/dist/esm/card-manager_3.entry.js +154 -18
- package/dist/esm/crowdsource-manager.entry.js +24 -2
- package/dist/esm/crowdsource-reporter.entry.js +45 -6
- package/dist/esm/{downloadUtils-8fbd1347.js → downloadUtils-b84a6f55.js} +2 -2
- package/dist/esm/feature-comments.entry.js +56 -0
- package/dist/esm/feature-form-flow-item.entry.js +56 -0
- package/dist/esm/features-flow-item.entry.js +56 -0
- package/dist/esm/{index.es-b6705ce7.js → index.es-0d4698c7.js} +2 -2
- package/dist/esm/list-flow-item.entry.js +56 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/location-flow-item.entry.js +56 -0
- package/dist/esm/map-select-tools_3.entry.js +2 -2
- package/dist/esm/{mapViewUtils-1e2befd7.js → mapViewUtils-88f363b6.js} +21 -1
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/refine-results-flow-item.entry.js +56 -0
- package/dist/esm/share-item.entry.js +56 -0
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +56 -15
- package/dist/solutions-components/{p-072680a5.js → p-214d41c3.js} +2 -2
- package/dist/solutions-components/p-28657abb.entry.js +11 -0
- package/dist/solutions-components/p-31b66bc3.entry.js +6 -0
- package/dist/solutions-components/{p-0123207d.entry.js → p-34737944.entry.js} +1 -1
- package/dist/solutions-components/{p-13d0424a.entry.js → p-3ced939f.entry.js} +1 -1
- package/dist/solutions-components/p-3dfbf45e.entry.js +6 -0
- package/dist/solutions-components/{p-092fd5d9.js → p-3ee78186.js} +1 -1
- package/dist/solutions-components/{p-7f793144.entry.js → p-4327c361.entry.js} +1 -1
- package/dist/solutions-components/p-455f4ed8.entry.js +17 -0
- package/dist/solutions-components/p-478fc7cb.entry.js +6 -0
- package/dist/solutions-components/p-4aafb627.js +36 -0
- package/dist/solutions-components/p-58562dda.entry.js +6 -0
- package/dist/solutions-components/{p-f367db61.entry.js → p-81503752.entry.js} +1 -1
- package/dist/solutions-components/{p-c90671e1.entry.js → p-9d54d7a0.entry.js} +4 -4
- package/dist/solutions-components/p-a5d70d3a.entry.js +6 -0
- package/dist/solutions-components/p-bd62df52.entry.js +6 -0
- package/dist/solutions-components/{p-ca780ab8.entry.js → p-d6f51bea.entry.js} +2 -2
- package/dist/solutions-components/p-e6371690.entry.js +6 -0
- package/dist/solutions-components/p-e7aad23d.entry.js +6 -0
- package/dist/solutions-components/p-ed95f634.entry.js +6 -0
- package/dist/solutions-components/p-fd08afb5.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/interfaces.ts +5 -0
- package/dist/solutions-components/utils/queryUtils.ts +26 -0
- package/dist/types/components/{list-item/list-item.d.ts → arcgis-login/arcgis-login.d.ts} +2 -9
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +36 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +73 -0
- package/dist/types/components/feature-comments/feature-comments.d.ts +19 -0
- package/dist/types/components/feature-form-flow-item/feature-form-flow-item.d.ts +19 -0
- package/dist/types/components/features-flow-item/features-flow-item.d.ts +19 -0
- package/dist/types/components/info-card/info-card.d.ts +8 -0
- package/dist/types/components/layer-table/layer-table.d.ts +77 -2
- package/dist/types/components/list-flow-item/list-flow-item.d.ts +19 -0
- package/dist/types/components/location-flow-item/location-flow-item.d.ts +19 -0
- package/dist/types/components/map-card/map-card.d.ts +12 -0
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +15 -2
- package/dist/types/components/map-picker/map-picker.d.ts +1 -4
- package/dist/types/components/refine-results-flow-item/refine-results-flow-item.d.ts +19 -0
- package/dist/types/components/share-item/share-item.d.ts +19 -0
- package/dist/types/components.d.ts +301 -9
- package/dist/types/preact.d.ts +15 -1
- package/dist/types/utils/interfaces.d.ts +4 -0
- package/dist/types/utils/queryUtils.d.ts +9 -0
- package/package.json +1 -1
- package/dist/assets/t9n/config-buffer-tools/resources.json +0 -12
- package/dist/assets/t9n/config-buffer-tools/resources_en.json +0 -12
- package/dist/assets/t9n/config-draw-tools/resources.json +0 -10
- package/dist/assets/t9n/config-draw-tools/resources_en.json +0 -10
- package/dist/assets/t9n/config-layer-picker/resources.json +0 -3
- package/dist/assets/t9n/config-layer-picker/resources_en.json +0 -3
- package/dist/assets/t9n/config-pdf-download/resources.json +0 -6
- package/dist/assets/t9n/config-pdf-download/resources_en.json +0 -6
- package/dist/cjs/calcite-loader.cjs.entry.js +0 -80
- package/dist/components/list-item2.js +0 -460
- package/dist/esm/calcite-loader.entry.js +0 -76
- package/dist/solutions-components/p-11cb7b04.entry.js +0 -6
- package/dist/solutions-components/p-45cf4f67.entry.js +0 -6
- package/dist/solutions-components/p-4807b2a1.js +0 -36
- package/dist/solutions-components/p-557a1912.entry.js +0 -6
- package/dist/solutions-components/p-68735975.entry.js +0 -6
- package/dist/solutions-components/p-ec830ecb.entry.js +0 -23
- /package/dist/assets/t9n/{list-item → arcgis-login}/resources.json +0 -0
- /package/dist/assets/t9n/{list-item → arcgis-login}/resources_en.json +0 -0
- /package/dist/collection/components/{list-item/list-item.css → arcgis-login/arcgis-login.css} +0 -0
@@ -25,7 +25,7 @@ const debounce = require('./debounce-30afab47.js');
|
|
25
25
|
const conditionalSlot = require('./conditionalSlot-f577ba32.js');
|
26
26
|
const key = require('./key-29076628.js');
|
27
27
|
const locale$1 = require('./locale-ef06bf9e.js');
|
28
|
-
const mapViewUtils = require('./mapViewUtils-
|
28
|
+
const mapViewUtils = require('./mapViewUtils-bab83c90.js');
|
29
29
|
const publicNotificationStore = require('./publicNotificationStore-e1ae21f1.js');
|
30
30
|
require('./resources-d8917c46.js');
|
31
31
|
require('./browser-09760f9f.js');
|
@@ -1698,7 +1698,17 @@ const MapLayerPicker = class {
|
|
1698
1698
|
index.registerInstance(this, hostRef);
|
1699
1699
|
this.noLayersFound = index.createEvent(this, "noLayersFound", 7);
|
1700
1700
|
this.layerSelectionChange = index.createEvent(this, "layerSelectionChange", 7);
|
1701
|
+
//--------------------------------------------------------------------------
|
1702
|
+
//
|
1703
|
+
// Properties (protected)
|
1704
|
+
//
|
1705
|
+
//--------------------------------------------------------------------------
|
1706
|
+
/**
|
1707
|
+
* boolean: When true the default layer has been loaded once and should no longer be used
|
1708
|
+
*/
|
1709
|
+
this.defaultLayerHonored = false;
|
1701
1710
|
this.appearance = "transparent";
|
1711
|
+
this.defaultLayerId = "";
|
1702
1712
|
this.enabledLayerIds = [];
|
1703
1713
|
this.enabledTableIds = [];
|
1704
1714
|
this.mapView = undefined;
|
@@ -1720,7 +1730,6 @@ const MapLayerPicker = class {
|
|
1720
1730
|
//--------------------------------------------------------------------------
|
1721
1731
|
/**
|
1722
1732
|
* Called each time the mapView prop is changed.
|
1723
|
-
*
|
1724
1733
|
*/
|
1725
1734
|
async mapViewWatchHandler() {
|
1726
1735
|
await this._setLayers();
|
@@ -1842,21 +1851,36 @@ const MapLayerPicker = class {
|
|
1842
1851
|
const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
|
1843
1852
|
const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
|
1844
1853
|
const name = item.name;
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1854
|
+
const selected = this.selectedIds.indexOf(id) > -1;
|
1855
|
+
return this.type === "combobox" ? (index.h("calcite-combobox-item", { disabled: disabled, selected: selected, textLabel: name, value: id })) :
|
1856
|
+
this.type === "select" ? (index.h("calcite-option", { disabled: disabled, label: name, selected: selected, value: id })) : (index.h("calcite-dropdown-item", { disabled: disabled, onClick: disabled ? undefined : () => void this._setSelectedLayer(id), selected: selected }, name));
|
1848
1857
|
}
|
1849
1858
|
/**
|
1850
1859
|
* Store the layer name based on the user selection
|
1851
1860
|
*/
|
1852
1861
|
_setSelectedLayer(id) {
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1862
|
+
let item;
|
1863
|
+
const hasDefaultLayer = this.defaultLayerId && !this.defaultLayerHonored;
|
1864
|
+
if (hasDefaultLayer) {
|
1865
|
+
item = this._getLayerFromHash(this.defaultLayerId);
|
1866
|
+
this.defaultLayerHonored = item !== undefined;
|
1867
|
+
id = this.defaultLayerHonored ? this.defaultLayerId : id;
|
1868
|
+
}
|
1869
|
+
item = item ? item : this._getLayerFromHash(id);
|
1856
1870
|
this.selectedName = item === null || item === void 0 ? void 0 : item.name;
|
1857
1871
|
this.selectedIds = [id];
|
1858
1872
|
this.layerSelectionChange.emit(this.selectedIds);
|
1859
1873
|
}
|
1874
|
+
/**
|
1875
|
+
* Fetch layer hash info for the given id
|
1876
|
+
*
|
1877
|
+
* @returns ILayerHashInfo for the id
|
1878
|
+
*/
|
1879
|
+
_getLayerFromHash(id) {
|
1880
|
+
return Object.keys(this._layerNameHash).indexOf(id) > -1 ?
|
1881
|
+
this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
|
1882
|
+
this._tableNameHash[id] : undefined;
|
1883
|
+
}
|
1860
1884
|
/**
|
1861
1885
|
* Fetch the ids of the layers from the map
|
1862
1886
|
*
|
@@ -0,0 +1,418 @@
|
|
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
|
+
'use strict';
|
7
|
+
|
8
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
9
|
+
|
10
|
+
const index = require('./index-2d5760f2.js');
|
11
|
+
const floatingUi = require('./floating-ui-3625f253.js');
|
12
|
+
const focusTrapComponent = require('./focusTrapComponent-919e5636.js');
|
13
|
+
const dom = require('./dom-c585dfa7.js');
|
14
|
+
const guid = require('./guid-5ef151a6.js');
|
15
|
+
const openCloseComponent = require('./openCloseComponent-56419b32.js');
|
16
|
+
const Heading = require('./Heading-b0970391.js');
|
17
|
+
const locale = require('./locale-62c20bcc.js');
|
18
|
+
const t9n = require('./t9n-78efea01.js');
|
19
|
+
const key = require('./key-29076628.js');
|
20
|
+
const loadable = require('./loadable-53fa41ac.js');
|
21
|
+
const observers = require('./observers-ee7eadc4.js');
|
22
|
+
const FloatingArrow = require('./FloatingArrow-5aba7af1.js');
|
23
|
+
require('./debounce-30afab47.js');
|
24
|
+
require('./resources-d8917c46.js');
|
25
|
+
|
26
|
+
/*!
|
27
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
28
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
29
|
+
* v1.9.0
|
30
|
+
*/
|
31
|
+
const CSS = {
|
32
|
+
container: "container",
|
33
|
+
imageContainer: "image-container",
|
34
|
+
closeButtonContainer: "close-button-container",
|
35
|
+
closeButton: "close-button",
|
36
|
+
content: "content",
|
37
|
+
hasHeader: "has-header",
|
38
|
+
header: "header",
|
39
|
+
headerContent: "header-content",
|
40
|
+
heading: "heading",
|
41
|
+
};
|
42
|
+
const defaultPopoverPlacement = "auto";
|
43
|
+
const ARIA_CONTROLS = "aria-controls";
|
44
|
+
const ARIA_EXPANDED = "aria-expanded";
|
45
|
+
|
46
|
+
/*!
|
47
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
48
|
+
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
49
|
+
* v1.9.0
|
50
|
+
*/
|
51
|
+
class PopoverManager {
|
52
|
+
constructor() {
|
53
|
+
// --------------------------------------------------------------------------
|
54
|
+
//
|
55
|
+
// Private Properties
|
56
|
+
//
|
57
|
+
// --------------------------------------------------------------------------
|
58
|
+
this.registeredElements = new Map();
|
59
|
+
this.registeredElementCount = 0;
|
60
|
+
// --------------------------------------------------------------------------
|
61
|
+
//
|
62
|
+
// Private Methods
|
63
|
+
//
|
64
|
+
// --------------------------------------------------------------------------
|
65
|
+
this.queryPopover = (composedPath) => {
|
66
|
+
const { registeredElements } = this;
|
67
|
+
const registeredElement = composedPath.find((pathEl) => registeredElements.has(pathEl));
|
68
|
+
return registeredElements.get(registeredElement);
|
69
|
+
};
|
70
|
+
this.togglePopovers = (event) => {
|
71
|
+
const composedPath = event.composedPath();
|
72
|
+
const togglePopover = this.queryPopover(composedPath);
|
73
|
+
if (togglePopover && !togglePopover.triggerDisabled) {
|
74
|
+
togglePopover.open = !togglePopover.open;
|
75
|
+
}
|
76
|
+
Array.from(this.registeredElements.values())
|
77
|
+
.filter((popover) => popover !== togglePopover && popover.autoClose && popover.open && !composedPath.includes(popover))
|
78
|
+
.forEach((popover) => (popover.open = false));
|
79
|
+
};
|
80
|
+
this.keyHandler = (event) => {
|
81
|
+
if (event.defaultPrevented) {
|
82
|
+
return;
|
83
|
+
}
|
84
|
+
if (event.key === "Escape") {
|
85
|
+
this.closeAllPopovers();
|
86
|
+
}
|
87
|
+
else if (key.isActivationKey(event.key)) {
|
88
|
+
this.togglePopovers(event);
|
89
|
+
}
|
90
|
+
};
|
91
|
+
this.clickHandler = (event) => {
|
92
|
+
if (dom.isPrimaryPointerButton(event)) {
|
93
|
+
this.togglePopovers(event);
|
94
|
+
}
|
95
|
+
};
|
96
|
+
}
|
97
|
+
// --------------------------------------------------------------------------
|
98
|
+
//
|
99
|
+
// Public Methods
|
100
|
+
//
|
101
|
+
// --------------------------------------------------------------------------
|
102
|
+
registerElement(referenceEl, popover) {
|
103
|
+
this.registeredElementCount++;
|
104
|
+
this.registeredElements.set(referenceEl, popover);
|
105
|
+
if (this.registeredElementCount === 1) {
|
106
|
+
this.addListeners();
|
107
|
+
}
|
108
|
+
}
|
109
|
+
unregisterElement(referenceEl) {
|
110
|
+
if (this.registeredElements.delete(referenceEl)) {
|
111
|
+
this.registeredElementCount--;
|
112
|
+
}
|
113
|
+
if (this.registeredElementCount === 0) {
|
114
|
+
this.removeListeners();
|
115
|
+
}
|
116
|
+
}
|
117
|
+
closeAllPopovers() {
|
118
|
+
Array.from(this.registeredElements.values()).forEach((popover) => (popover.open = false));
|
119
|
+
}
|
120
|
+
addListeners() {
|
121
|
+
document.addEventListener("pointerdown", this.clickHandler, { capture: true });
|
122
|
+
document.addEventListener("keydown", this.keyHandler, { capture: true });
|
123
|
+
}
|
124
|
+
removeListeners() {
|
125
|
+
document.removeEventListener("pointerdown", this.clickHandler, { capture: true });
|
126
|
+
document.removeEventListener("keydown", this.keyHandler, { capture: true });
|
127
|
+
}
|
128
|
+
}
|
129
|
+
|
130
|
+
const popoverCss = ":host{--calcite-floating-ui-z-index:var(--calcite-popover-z-index, var(--calcite-app-z-index-popup));display:block;position:absolute;z-index:var(--calcite-floating-ui-z-index)}.calcite-floating-ui-anim{position:relative;transition:var(--calcite-floating-ui-transition);transition-property:transform, visibility, opacity;opacity:0;box-shadow:0 0 16px 0 rgba(0, 0, 0, 0.16);z-index:var(--calcite-app-z-index);border-radius:0.25rem}:host([data-placement^=bottom]) .calcite-floating-ui-anim{transform:translateY(-5px)}:host([data-placement^=top]) .calcite-floating-ui-anim{transform:translateY(5px)}:host([data-placement^=left]) .calcite-floating-ui-anim{transform:translateX(5px)}:host([data-placement^=right]) .calcite-floating-ui-anim{transform:translateX(-5px)}:host([data-placement]) .calcite-floating-ui-anim--active{opacity:1;transform:translate(0)}:host([calcite-hydrated-hidden]){visibility:hidden !important;pointer-events:none}.calcite-floating-ui-arrow{pointer-events:none;position:absolute;z-index:calc(var(--calcite-app-z-index) * -1);fill:var(--calcite-ui-foreground-1)}.calcite-floating-ui-arrow__stroke{stroke:var(--calcite-ui-border-3)}:host([scale=s]) .heading{padding-inline:0.75rem;padding-block:0.5rem;font-size:var(--calcite-font-size--1);line-height:1.375}:host([scale=m]) .heading{padding-inline:1rem;padding-block:0.75rem;font-size:var(--calcite-font-size-0);line-height:1.375}:host([scale=l]) .heading{padding-inline:1.25rem;padding-block:1rem;font-size:var(--calcite-font-size-1);line-height:1.375}:host{pointer-events:none}:host([open]){pointer-events:initial}.calcite-floating-ui-anim{border-radius:0.25rem;border-width:1px;border-style:solid;border-color:var(--calcite-ui-border-3);background-color:var(--calcite-ui-foreground-1)}.arrow::before{outline:1px solid var(--calcite-ui-border-3)}.header{display:flex;flex:1 1 auto;align-items:stretch;justify-content:flex-start;border-width:0px;border-block-end-width:1px;border-style:solid;border-block-end-color:var(--calcite-ui-border-3)}.heading{margin:0px;display:block;flex:1 1 auto;align-self:center;white-space:normal;font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);word-wrap:break-word;word-break:break-word}.container{position:relative;display:flex;block-size:100%;flex-direction:row;flex-wrap:nowrap;border-radius:0.25rem;color:var(--calcite-ui-text-1)}.container.has-header{flex-direction:column}.content{display:flex;block-size:100%;inline-size:100%;flex-direction:column;flex-wrap:nowrap;align-self:center;word-wrap:break-word;word-break:break-word}.close-button-container{display:flex;overflow:hidden;flex:0 0 auto;border-start-end-radius:0.25rem;border-end-end-radius:0.25rem}::slotted(calcite-panel),::slotted(calcite-flow){block-size:100%}:host([hidden]){display:none}[hidden]{display:none}";
|
131
|
+
|
132
|
+
const manager = new PopoverManager();
|
133
|
+
const Popover = class {
|
134
|
+
constructor(hostRef) {
|
135
|
+
index.registerInstance(this, hostRef);
|
136
|
+
this.calcitePopoverBeforeClose = index.createEvent(this, "calcitePopoverBeforeClose", 6);
|
137
|
+
this.calcitePopoverClose = index.createEvent(this, "calcitePopoverClose", 6);
|
138
|
+
this.calcitePopoverBeforeOpen = index.createEvent(this, "calcitePopoverBeforeOpen", 6);
|
139
|
+
this.calcitePopoverOpen = index.createEvent(this, "calcitePopoverOpen", 6);
|
140
|
+
this.mutationObserver = observers.createObserver("mutation", () => this.updateFocusTrapElements());
|
141
|
+
this.guid = `calcite-popover-${guid.guid()}`;
|
142
|
+
this.openTransitionProp = "opacity";
|
143
|
+
this.hasLoaded = false;
|
144
|
+
// --------------------------------------------------------------------------
|
145
|
+
//
|
146
|
+
// Private Methods
|
147
|
+
//
|
148
|
+
// --------------------------------------------------------------------------
|
149
|
+
this.setTransitionEl = (el) => {
|
150
|
+
this.transitionEl = el;
|
151
|
+
};
|
152
|
+
this.setFilteredPlacements = () => {
|
153
|
+
const { el, flipPlacements } = this;
|
154
|
+
this.filteredFlipPlacements = flipPlacements
|
155
|
+
? floatingUi.filterComputedPlacements(flipPlacements, el)
|
156
|
+
: null;
|
157
|
+
};
|
158
|
+
this.setUpReferenceElement = (warn = true) => {
|
159
|
+
this.removeReferences();
|
160
|
+
this.effectiveReferenceElement = this.getReferenceElement();
|
161
|
+
floatingUi.connectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
162
|
+
const { el, referenceElement, effectiveReferenceElement } = this;
|
163
|
+
if (warn && referenceElement && !effectiveReferenceElement) {
|
164
|
+
console.warn(`${el.tagName}: reference-element id "${referenceElement}" was not found.`, {
|
165
|
+
el,
|
166
|
+
});
|
167
|
+
}
|
168
|
+
this.addReferences();
|
169
|
+
};
|
170
|
+
this.getId = () => {
|
171
|
+
return this.el.id || this.guid;
|
172
|
+
};
|
173
|
+
this.setExpandedAttr = () => {
|
174
|
+
const { effectiveReferenceElement, open } = this;
|
175
|
+
if (!effectiveReferenceElement) {
|
176
|
+
return;
|
177
|
+
}
|
178
|
+
if ("setAttribute" in effectiveReferenceElement) {
|
179
|
+
effectiveReferenceElement.setAttribute(ARIA_EXPANDED, dom.toAriaBoolean(open));
|
180
|
+
}
|
181
|
+
};
|
182
|
+
this.addReferences = () => {
|
183
|
+
const { effectiveReferenceElement } = this;
|
184
|
+
if (!effectiveReferenceElement) {
|
185
|
+
return;
|
186
|
+
}
|
187
|
+
const id = this.getId();
|
188
|
+
if ("setAttribute" in effectiveReferenceElement) {
|
189
|
+
effectiveReferenceElement.setAttribute(ARIA_CONTROLS, id);
|
190
|
+
}
|
191
|
+
manager.registerElement(effectiveReferenceElement, this.el);
|
192
|
+
this.setExpandedAttr();
|
193
|
+
};
|
194
|
+
this.removeReferences = () => {
|
195
|
+
const { effectiveReferenceElement } = this;
|
196
|
+
if (!effectiveReferenceElement) {
|
197
|
+
return;
|
198
|
+
}
|
199
|
+
if ("removeAttribute" in effectiveReferenceElement) {
|
200
|
+
effectiveReferenceElement.removeAttribute(ARIA_CONTROLS);
|
201
|
+
effectiveReferenceElement.removeAttribute(ARIA_EXPANDED);
|
202
|
+
}
|
203
|
+
manager.unregisterElement(effectiveReferenceElement);
|
204
|
+
};
|
205
|
+
this.hide = () => {
|
206
|
+
this.open = false;
|
207
|
+
};
|
208
|
+
this.storeArrowEl = (el) => {
|
209
|
+
this.arrowEl = el;
|
210
|
+
this.reposition(true);
|
211
|
+
};
|
212
|
+
this.autoClose = false;
|
213
|
+
this.closable = false;
|
214
|
+
this.flipDisabled = false;
|
215
|
+
this.focusTrapDisabled = false;
|
216
|
+
this.pointerDisabled = false;
|
217
|
+
this.flipPlacements = undefined;
|
218
|
+
this.heading = undefined;
|
219
|
+
this.headingLevel = undefined;
|
220
|
+
this.label = undefined;
|
221
|
+
this.messageOverrides = undefined;
|
222
|
+
this.messages = undefined;
|
223
|
+
this.offsetDistance = floatingUi.defaultOffsetDistance;
|
224
|
+
this.offsetSkidding = 0;
|
225
|
+
this.open = false;
|
226
|
+
this.overlayPositioning = "absolute";
|
227
|
+
this.placement = defaultPopoverPlacement;
|
228
|
+
this.referenceElement = undefined;
|
229
|
+
this.scale = "m";
|
230
|
+
this.triggerDisabled = false;
|
231
|
+
this.effectiveLocale = "";
|
232
|
+
this.floatingLayout = "vertical";
|
233
|
+
this.effectiveReferenceElement = undefined;
|
234
|
+
this.defaultMessages = undefined;
|
235
|
+
}
|
236
|
+
handleFocusTrapDisabled(focusTrapDisabled) {
|
237
|
+
if (!this.open) {
|
238
|
+
return;
|
239
|
+
}
|
240
|
+
focusTrapDisabled ? focusTrapComponent.deactivateFocusTrap(this) : focusTrapComponent.activateFocusTrap(this);
|
241
|
+
}
|
242
|
+
flipPlacementsHandler() {
|
243
|
+
this.setFilteredPlacements();
|
244
|
+
this.reposition(true);
|
245
|
+
}
|
246
|
+
onMessagesChange() {
|
247
|
+
/* wired up by t9n util */
|
248
|
+
}
|
249
|
+
offsetDistanceOffsetHandler() {
|
250
|
+
this.reposition(true);
|
251
|
+
}
|
252
|
+
offsetSkiddingHandler() {
|
253
|
+
this.reposition(true);
|
254
|
+
}
|
255
|
+
openHandler(value) {
|
256
|
+
openCloseComponent.onToggleOpenCloseComponent(this);
|
257
|
+
if (value) {
|
258
|
+
this.reposition(true);
|
259
|
+
}
|
260
|
+
this.setExpandedAttr();
|
261
|
+
}
|
262
|
+
overlayPositioningHandler() {
|
263
|
+
this.reposition(true);
|
264
|
+
}
|
265
|
+
placementHandler() {
|
266
|
+
this.reposition(true);
|
267
|
+
}
|
268
|
+
referenceElementHandler() {
|
269
|
+
this.setUpReferenceElement();
|
270
|
+
this.reposition(true);
|
271
|
+
}
|
272
|
+
effectiveLocaleChange() {
|
273
|
+
t9n.updateMessages(this, this.effectiveLocale);
|
274
|
+
}
|
275
|
+
// --------------------------------------------------------------------------
|
276
|
+
//
|
277
|
+
// Lifecycle
|
278
|
+
//
|
279
|
+
// --------------------------------------------------------------------------
|
280
|
+
connectedCallback() {
|
281
|
+
this.setFilteredPlacements();
|
282
|
+
locale.connectLocalized(this);
|
283
|
+
t9n.connectMessages(this);
|
284
|
+
this.setUpReferenceElement(this.hasLoaded);
|
285
|
+
focusTrapComponent.connectFocusTrap(this);
|
286
|
+
if (this.open) {
|
287
|
+
openCloseComponent.onToggleOpenCloseComponent(this);
|
288
|
+
}
|
289
|
+
}
|
290
|
+
async componentWillLoad() {
|
291
|
+
await t9n.setUpMessages(this);
|
292
|
+
loadable.setUpLoadableComponent(this);
|
293
|
+
}
|
294
|
+
componentDidLoad() {
|
295
|
+
loadable.setComponentLoaded(this);
|
296
|
+
if (this.referenceElement && !this.effectiveReferenceElement) {
|
297
|
+
this.setUpReferenceElement();
|
298
|
+
}
|
299
|
+
this.reposition();
|
300
|
+
this.hasLoaded = true;
|
301
|
+
}
|
302
|
+
disconnectedCallback() {
|
303
|
+
this.removeReferences();
|
304
|
+
locale.disconnectLocalized(this);
|
305
|
+
t9n.disconnectMessages(this);
|
306
|
+
floatingUi.disconnectFloatingUI(this, this.effectiveReferenceElement, this.el);
|
307
|
+
focusTrapComponent.deactivateFocusTrap(this);
|
308
|
+
}
|
309
|
+
// --------------------------------------------------------------------------
|
310
|
+
//
|
311
|
+
// Public Methods
|
312
|
+
//
|
313
|
+
// --------------------------------------------------------------------------
|
314
|
+
/**
|
315
|
+
* Updates the position of the component.
|
316
|
+
*
|
317
|
+
* @param delayed
|
318
|
+
*/
|
319
|
+
async reposition(delayed = false) {
|
320
|
+
const { el, effectiveReferenceElement, placement, overlayPositioning, flipDisabled, filteredFlipPlacements, offsetDistance, offsetSkidding, arrowEl, } = this;
|
321
|
+
return floatingUi.reposition(this, {
|
322
|
+
floatingEl: el,
|
323
|
+
referenceEl: effectiveReferenceElement,
|
324
|
+
overlayPositioning,
|
325
|
+
placement,
|
326
|
+
flipDisabled,
|
327
|
+
flipPlacements: filteredFlipPlacements,
|
328
|
+
offsetDistance,
|
329
|
+
offsetSkidding,
|
330
|
+
arrowEl,
|
331
|
+
type: "popover",
|
332
|
+
}, delayed);
|
333
|
+
}
|
334
|
+
/**
|
335
|
+
* Sets focus on the component's first focusable element.
|
336
|
+
*/
|
337
|
+
async setFocus() {
|
338
|
+
await loadable.componentFocusable(this);
|
339
|
+
index.forceUpdate(this.el);
|
340
|
+
dom.focusFirstTabbable(this.el);
|
341
|
+
}
|
342
|
+
/**
|
343
|
+
* Updates the element(s) that are used within the focus-trap of the component.
|
344
|
+
*/
|
345
|
+
async updateFocusTrapElements() {
|
346
|
+
focusTrapComponent.updateFocusTrapElements(this);
|
347
|
+
}
|
348
|
+
getReferenceElement() {
|
349
|
+
const { referenceElement, el } = this;
|
350
|
+
return ((typeof referenceElement === "string"
|
351
|
+
? dom.queryElementRoots(el, { id: referenceElement })
|
352
|
+
: referenceElement) || null);
|
353
|
+
}
|
354
|
+
onBeforeOpen() {
|
355
|
+
this.calcitePopoverBeforeOpen.emit();
|
356
|
+
}
|
357
|
+
onOpen() {
|
358
|
+
this.calcitePopoverOpen.emit();
|
359
|
+
focusTrapComponent.activateFocusTrap(this);
|
360
|
+
}
|
361
|
+
onBeforeClose() {
|
362
|
+
this.calcitePopoverBeforeClose.emit();
|
363
|
+
}
|
364
|
+
onClose() {
|
365
|
+
this.calcitePopoverClose.emit();
|
366
|
+
focusTrapComponent.deactivateFocusTrap(this);
|
367
|
+
}
|
368
|
+
// --------------------------------------------------------------------------
|
369
|
+
//
|
370
|
+
// Render Methods
|
371
|
+
//
|
372
|
+
// --------------------------------------------------------------------------
|
373
|
+
renderCloseButton() {
|
374
|
+
const { messages, closable } = this;
|
375
|
+
return closable ? (index.h("div", { class: CSS.closeButtonContainer, key: CSS.closeButtonContainer }, index.h("calcite-action", { appearance: "transparent", class: CSS.closeButton, onClick: this.hide, scale: this.scale, text: messages.close,
|
376
|
+
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
|
377
|
+
ref: (closeButtonEl) => (this.closeButtonEl = closeButtonEl) }, index.h("calcite-icon", { icon: "x", scale: this.scale === "l" ? "m" : this.scale })))) : null;
|
378
|
+
}
|
379
|
+
renderHeader() {
|
380
|
+
const { heading, headingLevel } = this;
|
381
|
+
const headingNode = heading ? (index.h(Heading.Heading, { class: CSS.heading, level: headingLevel }, heading)) : null;
|
382
|
+
return headingNode ? (index.h("div", { class: CSS.header, key: CSS.header }, headingNode, this.renderCloseButton())) : null;
|
383
|
+
}
|
384
|
+
render() {
|
385
|
+
const { effectiveReferenceElement, heading, label, open, pointerDisabled, floatingLayout } = this;
|
386
|
+
const displayed = effectiveReferenceElement && open;
|
387
|
+
const hidden = !displayed;
|
388
|
+
const arrowNode = !pointerDisabled ? (index.h(FloatingArrow.FloatingArrow, { floatingLayout: floatingLayout, key: "floating-arrow",
|
389
|
+
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
|
390
|
+
ref: this.storeArrowEl })) : null;
|
391
|
+
return (index.h(index.Host, { "aria-hidden": dom.toAriaBoolean(hidden), "aria-label": label, "aria-live": "polite", "calcite-hydrated-hidden": hidden, id: this.getId(), role: "dialog" }, index.h("div", { class: {
|
392
|
+
[floatingUi.FloatingCSS.animation]: true,
|
393
|
+
[floatingUi.FloatingCSS.animationActive]: displayed,
|
394
|
+
},
|
395
|
+
// eslint-disable-next-line react/jsx-sort-props -- ref should be last so node attrs/props are in sync (see https://github.com/Esri/calcite-design-system/pull/6530)
|
396
|
+
ref: this.setTransitionEl }, arrowNode, index.h("div", { class: {
|
397
|
+
[CSS.hasHeader]: !!heading,
|
398
|
+
[CSS.container]: true,
|
399
|
+
} }, this.renderHeader(), index.h("div", { class: CSS.content }, index.h("slot", null)), !heading ? this.renderCloseButton() : null))));
|
400
|
+
}
|
401
|
+
static get assetsDirs() { return ["assets"]; }
|
402
|
+
get el() { return index.getElement(this); }
|
403
|
+
static get watchers() { return {
|
404
|
+
"focusTrapDisabled": ["handleFocusTrapDisabled"],
|
405
|
+
"flipPlacements": ["flipPlacementsHandler"],
|
406
|
+
"messageOverrides": ["onMessagesChange"],
|
407
|
+
"offsetDistance": ["offsetDistanceOffsetHandler"],
|
408
|
+
"offsetSkidding": ["offsetSkiddingHandler"],
|
409
|
+
"open": ["openHandler"],
|
410
|
+
"overlayPositioning": ["overlayPositioningHandler"],
|
411
|
+
"placement": ["placementHandler"],
|
412
|
+
"referenceElement": ["referenceElementHandler"],
|
413
|
+
"effectiveLocale": ["effectiveLocaleChange"]
|
414
|
+
}; }
|
415
|
+
};
|
416
|
+
Popover.style = popoverCss;
|
417
|
+
|
418
|
+
exports.calcite_popover = Popover;
|