@esri/solutions-components 0.8.23 → 0.8.24

Sign up to get free protection for your applications and to get access to all the features.
Files changed (166) hide show
  1. package/dist/cjs/arcgis-login.cjs.entry.js +1 -1
  2. package/dist/cjs/basemap-gallery_7.cjs.entry.js +1 -1
  3. package/dist/cjs/buffer-tools_3.cjs.entry.js +1 -1
  4. package/dist/cjs/{calcite-avatar.cjs.entry.js → calcite-avatar_2.cjs.entry.js} +62 -0
  5. package/dist/cjs/calcite-block_5.cjs.entry.js +12 -3
  6. package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +419 -0
  7. package/dist/cjs/{calcite-dropdown_4.cjs.entry.js → calcite-dropdown_2.cjs.entry.js} +12 -435
  8. package/dist/cjs/calcite-flow_6.cjs.entry.js +23 -27
  9. package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
  10. package/dist/cjs/crowdsource-manager.cjs.entry.js +1 -1
  11. package/dist/cjs/crowdsource-reporter.cjs.entry.js +56 -36
  12. package/dist/cjs/feature-list.cjs.entry.js +4 -3
  13. package/dist/cjs/{helpers-9347ad83.js → helpers-618a3f7d.js} +2 -1
  14. package/dist/cjs/instant-apps-create.cjs.entry.js +266 -0
  15. package/dist/cjs/instant-apps-export.cjs.entry.js +31 -16
  16. package/dist/cjs/instant-apps-header.cjs.entry.js +3 -2
  17. package/dist/cjs/instant-apps-interactive-legend-classic.cjs.entry.js +11 -4
  18. package/dist/cjs/instant-apps-interactive-legend-count_2.cjs.entry.js +1 -1
  19. package/dist/cjs/instant-apps-interactive-legend-group-legend-element-caption.cjs.entry.js +1 -1
  20. package/dist/cjs/instant-apps-interactive-legend-group-legend-element_5.cjs.entry.js +2 -2
  21. package/dist/cjs/instant-apps-interactive-legend.cjs.entry.js +1 -1
  22. package/dist/cjs/instant-apps-landing-page.cjs.entry.js +45 -9
  23. package/dist/cjs/instant-apps-language-switcher.cjs.entry.js +1 -1
  24. package/dist/cjs/instant-apps-language-translator.cjs.entry.js +1 -1
  25. package/dist/cjs/instant-apps-sign-in.cjs.entry.js +168 -0
  26. package/dist/cjs/{languageSwitcher-395021d6.js → languageSwitcher-b9a1485c.js} +3 -1
  27. package/dist/cjs/loader.cjs.js +1 -1
  28. package/dist/cjs/public-notification.cjs.entry.js +3 -3
  29. package/dist/cjs/resources-fa37e40f.js +26 -0
  30. package/dist/cjs/solutions-components.cjs.js +1 -1
  31. package/dist/collection/collection-manifest.json +3 -1
  32. package/dist/collection/components/arcgis-login/arcgis-login.js +1 -1
  33. package/dist/collection/components/basemap-gallery/basemap-gallery.js +1 -1
  34. package/dist/collection/components/buffer-tools/buffer-tools.js +1 -1
  35. package/dist/collection/components/card-manager/card-manager.js +1 -1
  36. package/dist/collection/components/create-feature/create-feature.js +1 -1
  37. package/dist/collection/components/create-related-feature/create-related-feature.js +1 -1
  38. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +1 -1
  39. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +56 -45
  40. package/dist/collection/components/feature-details/feature-details.js +56 -13
  41. package/dist/collection/components/feature-list/feature-list.js +22 -3
  42. package/dist/collection/components/layer-list/layer-list.js +6 -13
  43. package/dist/collection/components/public-notification/public-notification.js +3 -3
  44. package/dist/collection/demos/crowdsource-reporter.html +22 -15
  45. package/dist/collection/utils/interfaces.ts +1 -0
  46. package/dist/components/arcgis-login.js +1 -1
  47. package/dist/components/basemap-gallery2.js +1 -1
  48. package/dist/components/buffer-tools2.js +1 -1
  49. package/dist/components/calcite-navigation-user.js +1 -99
  50. package/dist/components/card-manager2.js +1 -1
  51. package/dist/components/create-feature2.js +1 -1
  52. package/dist/components/create-related-feature2.js +1 -1
  53. package/dist/components/crowdsource-manager.js +1 -1
  54. package/dist/components/crowdsource-reporter.js +57 -37
  55. package/dist/components/feature-details2.js +16 -12
  56. package/dist/components/feature-list2.js +5 -3
  57. package/dist/components/helpers.js +3 -2
  58. package/dist/components/instant-apps-ckeditor-wrapper2.js +1 -1
  59. package/dist/components/instant-apps-create.js +317 -0
  60. package/dist/components/instant-apps-export.js +32 -16
  61. package/dist/components/instant-apps-filter-list2.js +6 -1
  62. package/dist/components/instant-apps-header2.js +3 -2
  63. package/dist/components/instant-apps-interactive-legend-classic2.js +12 -5
  64. package/dist/components/instant-apps-interactive-legend-legend-element-caption2.js +2 -2
  65. package/dist/components/instant-apps-landing-page.js +91 -16
  66. package/dist/components/instant-apps-language-translator2.js +3 -1
  67. package/dist/components/instant-apps-sign-in.js +11 -0
  68. package/dist/components/instant-apps-sign-in2.js +243 -0
  69. package/dist/components/instant-apps-social-share2.js +8 -2
  70. package/dist/components/layer-list2.js +6 -13
  71. package/dist/{esm/calcite-navigation-user.entry.js → components/navigation-user.js} +46 -9
  72. package/dist/components/public-notification.js +3 -3
  73. package/dist/esm/arcgis-login.entry.js +1 -1
  74. package/dist/esm/basemap-gallery_7.entry.js +1 -1
  75. package/dist/esm/buffer-tools_3.entry.js +1 -1
  76. package/dist/esm/{calcite-avatar.entry.js → calcite-avatar_2.entry.js} +64 -3
  77. package/dist/esm/calcite-block_5.entry.js +12 -3
  78. package/dist/esm/calcite-color-picker-hex-input_2.entry.js +1 -1
  79. package/dist/esm/calcite-color-picker.entry.js +1 -1
  80. package/dist/esm/calcite-dropdown-group_2.entry.js +414 -0
  81. package/dist/esm/{calcite-dropdown_4.entry.js → calcite-dropdown_2.entry.js} +2 -423
  82. package/dist/esm/calcite-flow_6.entry.js +23 -27
  83. package/dist/esm/card-manager_3.entry.js +1 -1
  84. package/dist/esm/crowdsource-manager.entry.js +1 -1
  85. package/dist/esm/crowdsource-reporter.entry.js +56 -36
  86. package/dist/esm/feature-list.entry.js +4 -3
  87. package/dist/esm/{helpers-a5a81b9d.js → helpers-61b05164.js} +3 -2
  88. package/dist/esm/instant-apps-create.entry.js +262 -0
  89. package/dist/esm/instant-apps-export.entry.js +31 -16
  90. package/dist/esm/instant-apps-header.entry.js +3 -2
  91. package/dist/esm/instant-apps-interactive-legend-classic.entry.js +11 -4
  92. package/dist/esm/instant-apps-interactive-legend-count_2.entry.js +1 -1
  93. package/dist/esm/instant-apps-interactive-legend-group-legend-element-caption.entry.js +1 -1
  94. package/dist/esm/instant-apps-interactive-legend-group-legend-element_5.entry.js +2 -2
  95. package/dist/esm/instant-apps-interactive-legend.entry.js +1 -1
  96. package/dist/esm/instant-apps-landing-page.entry.js +46 -10
  97. package/dist/esm/instant-apps-language-switcher.entry.js +1 -1
  98. package/dist/esm/instant-apps-language-translator.entry.js +1 -1
  99. package/dist/esm/instant-apps-sign-in.entry.js +164 -0
  100. package/dist/esm/{languageSwitcher-a4a615e4.js → languageSwitcher-d60f03b2.js} +3 -1
  101. package/dist/esm/loader.js +1 -1
  102. package/dist/esm/public-notification.entry.js +3 -3
  103. package/dist/esm/resources-16800cce.js +24 -0
  104. package/dist/esm/solutions-components.js +1 -1
  105. package/dist/esm/{utils-6419e941.js → utils-251cb6de.js} +1 -1
  106. package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-create/instant-apps-create.css +150 -0
  107. package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-header/instant-apps-header.css +16 -9
  108. package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-landing-page/instant-apps-landing-page.css +19 -0
  109. package/dist/node_modules/@esri/instant-apps-components/dist/collection/components/instant-apps-sign-in/instant-apps-sign-in.css +98 -0
  110. package/dist/solutions-components/demos/crowdsource-reporter.html +22 -15
  111. package/dist/solutions-components/p-1251dcc6.entry.js +6 -0
  112. package/dist/solutions-components/{p-88495699.entry.js → p-16730f05.entry.js} +1 -1
  113. package/dist/solutions-components/p-1ae3b886.entry.js +17 -0
  114. package/dist/solutions-components/{p-63460d51.entry.js → p-1ff9eb95.entry.js} +1 -1
  115. package/dist/solutions-components/{p-8f6e0ae5.entry.js → p-26eb1225.entry.js} +1 -1
  116. package/dist/solutions-components/{p-3a2e0188.entry.js → p-2c044250.entry.js} +2 -2
  117. package/dist/solutions-components/p-314dc933.entry.js +6 -0
  118. package/dist/solutions-components/p-50741707.entry.js +6 -0
  119. package/dist/solutions-components/p-614ebce7.js +6 -0
  120. package/dist/solutions-components/{p-df73649e.entry.js → p-77cd573b.entry.js} +1 -1
  121. package/dist/solutions-components/{p-c95dcdf7.entry.js → p-7883b885.entry.js} +3 -3
  122. package/dist/solutions-components/p-79e2e203.entry.js +6 -0
  123. package/dist/solutions-components/{p-968a6fd8.entry.js → p-7b17e929.entry.js} +1 -1
  124. package/dist/solutions-components/p-80b3eb6b.entry.js +6 -0
  125. package/dist/solutions-components/p-84913712.js +6 -0
  126. package/dist/solutions-components/p-8c500fd7.entry.js +6 -0
  127. package/dist/solutions-components/{p-fe9d6d06.js → p-9f56c02c.js} +1 -1
  128. package/dist/solutions-components/{p-667c022f.entry.js → p-af4be4ce.entry.js} +1 -1
  129. package/dist/solutions-components/p-bb2e669d.entry.js +6 -0
  130. package/dist/solutions-components/p-c41997d5.js +11 -0
  131. package/dist/solutions-components/p-c512fcfb.entry.js +6 -0
  132. package/dist/solutions-components/{p-21d6360a.entry.js → p-c7f0e7a8.entry.js} +1 -1
  133. package/dist/solutions-components/{p-64da5bb8.entry.js → p-cbf0dada.entry.js} +3 -3
  134. package/dist/solutions-components/{p-9c7d4343.entry.js → p-cd91c3e7.entry.js} +1 -1
  135. package/dist/solutions-components/p-ceba37d3.entry.js +11 -0
  136. package/dist/solutions-components/{p-09b769b7.entry.js → p-d8a15e32.entry.js} +1 -1
  137. package/dist/solutions-components/p-d8da6406.entry.js +6 -0
  138. package/dist/solutions-components/p-da6b3c8a.entry.js +6 -0
  139. package/dist/solutions-components/{p-60f1055e.entry.js → p-e2400b0d.entry.js} +1 -1
  140. package/dist/solutions-components/p-e78be59a.entry.js +6 -0
  141. package/dist/solutions-components/p-f35cc7ae.entry.js +6 -0
  142. package/dist/solutions-components/solutions-components.esm.js +1 -1
  143. package/dist/solutions-components/utils/interfaces.ts +1 -0
  144. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +18 -7
  145. package/dist/types/components/feature-details/feature-details.d.ts +13 -1
  146. package/dist/types/components/feature-list/feature-list.d.ts +4 -0
  147. package/dist/types/components/layer-list/layer-list.d.ts +1 -1
  148. package/dist/types/components.d.ts +25 -2
  149. package/dist/types/preact.d.ts +7 -2
  150. package/dist/types/utils/interfaces.d.ts +1 -0
  151. package/package.json +2 -2
  152. package/dist/cjs/calcite-navigation-user.cjs.entry.js +0 -73
  153. package/dist/solutions-components/p-08a1e120.js +0 -6
  154. package/dist/solutions-components/p-3283660c.entry.js +0 -6
  155. package/dist/solutions-components/p-33647277.entry.js +0 -6
  156. package/dist/solutions-components/p-3af0764f.entry.js +0 -6
  157. package/dist/solutions-components/p-41d288c0.entry.js +0 -6
  158. package/dist/solutions-components/p-599dcc29.js +0 -6
  159. package/dist/solutions-components/p-64b4b579.entry.js +0 -11
  160. package/dist/solutions-components/p-ab96dd27.entry.js +0 -6
  161. package/dist/solutions-components/p-bb0c7be3.entry.js +0 -17
  162. package/dist/solutions-components/p-bb8e3add.entry.js +0 -11
  163. package/dist/solutions-components/p-c36bb8ca.entry.js +0 -6
  164. package/dist/solutions-components/p-cbe166fc.entry.js +0 -6
  165. package/dist/solutions-components/p-eab95aa4.entry.js +0 -6
  166. package/dist/solutions-components/p-f6a1673c.entry.js +0 -6
@@ -0,0 +1,414 @@
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-ba5da2b0.js';
7
+ import { c as createObserver } from './observers-19e5cb73.js';
8
+ import { C as CSS } from './resources-16800cce.js';
9
+ import { g as getLocaleComponentStrings } from './locale-a490c4f6.js';
10
+ import { d as getMapLayerHash, p as getMapTableHash } from './mapViewUtils-4618ddb8.js';
11
+ import { s as state } from './publicNotificationStore-74c7e9f4.js';
12
+ import './esri-loader-2bf735ed.js';
13
+ import './interfaces-586e863c.js';
14
+ import './index-c06194fa.js';
15
+
16
+ const dropdownGroupCss = ":host{position:relative;display:block}.container{text-align:start}.container--s{font-size:var(--calcite-font-size--2);line-height:1rem}.container--s .dropdown-title{padding:0.5rem}.container--m{font-size:var(--calcite-font-size--1);line-height:1rem}.container--m .dropdown-title{padding:0.75rem}.container--l{font-size:var(--calcite-font-size-0);line-height:1.25rem}.container--l .dropdown-title{padding:1rem}.dropdown-title{margin-block-end:-1px;display:block;cursor:default;overflow-wrap:break-word;border-width:0px;border-block-end-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);font-weight:var(--calcite-font-weight-bold);color:var(--calcite-color-text-2)}.dropdown-separator{display:block;block-size:1px;background-color:var(--calcite-color-border-3)}:host([hidden]){display:none}[hidden]{display:none}";
17
+ const CalciteDropdownGroupStyle0 = dropdownGroupCss;
18
+
19
+ const DropdownGroup = class {
20
+ constructor(hostRef) {
21
+ registerInstance(this, hostRef);
22
+ this.calciteInternalDropdownItemChange = createEvent(this, "calciteInternalDropdownItemChange", 6);
23
+ this.updateItems = () => {
24
+ Array.from(this.el.querySelectorAll("calcite-dropdown-item")).forEach((item) => (item.selectionMode = this.selectionMode));
25
+ };
26
+ this.mutationObserver = createObserver("mutation", () => this.updateItems());
27
+ this.groupTitle = undefined;
28
+ this.scale = "m";
29
+ this.selectionMode = "single";
30
+ }
31
+ handlePropsChange() {
32
+ this.updateItems();
33
+ }
34
+ //--------------------------------------------------------------------------
35
+ //
36
+ // Lifecycle
37
+ //
38
+ //--------------------------------------------------------------------------
39
+ connectedCallback() {
40
+ var _a;
41
+ this.updateItems();
42
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, { childList: true });
43
+ }
44
+ componentWillLoad() {
45
+ this.groupPosition = this.getGroupPosition();
46
+ }
47
+ disconnectedCallback() {
48
+ var _a;
49
+ (_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
50
+ }
51
+ render() {
52
+ const groupTitle = this.groupTitle ? (h("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
53
+ const dropdownSeparator = this.groupPosition > 0 ? h("div", { class: "dropdown-separator", role: "separator" }) : null;
54
+ return (h(Host, { key: 'c1b662afcbb612d775cea66edb949d71f5f63167', "aria-label": this.groupTitle, role: "group" }, h("div", { key: 'cdfdb0919b1b6006f69f7fbcda0c16c2beefec5e', class: {
55
+ [CSS.container]: true,
56
+ [`${CSS.container}--${this.scale}`]: true,
57
+ } }, dropdownSeparator, groupTitle, h("slot", { key: '166c8236f3315d2f038f61b0619270d2bd9b344a' }))));
58
+ }
59
+ //--------------------------------------------------------------------------
60
+ //
61
+ // Event Listeners
62
+ //
63
+ //--------------------------------------------------------------------------
64
+ updateActiveItemOnChange(event) {
65
+ this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
66
+ this.requestedDropdownItem = event.detail.requestedDropdownItem;
67
+ this.calciteInternalDropdownItemChange.emit({
68
+ requestedDropdownGroup: this.requestedDropdownGroup,
69
+ requestedDropdownItem: this.requestedDropdownItem,
70
+ });
71
+ }
72
+ //--------------------------------------------------------------------------
73
+ //
74
+ // Private Methods
75
+ //
76
+ //--------------------------------------------------------------------------
77
+ getGroupPosition() {
78
+ return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
79
+ }
80
+ static get delegatesFocus() { return true; }
81
+ get el() { return getElement(this); }
82
+ static get watchers() { return {
83
+ "selectionMode": ["handlePropsChange"]
84
+ }; }
85
+ };
86
+ DropdownGroup.style = CalciteDropdownGroupStyle0;
87
+
88
+ const mapLayerPickerCss = ":host{display:block}.map-layer-picker-container{width:100%;align-items:center}.map-layer-picker{position:relative;width:100%;display:inline-block}.padding-bottom-1{padding-bottom:1rem}.layer-picker-dropdown{height:100%;width:100%}.max-width-350{max-width:350px}.height-100{height:100%}.disabled{cursor:default !important;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled);pointer-events:none}.no-bottom-margin{--calcite-label-margin-bottom:0px}.layer-picker-label-container{align-items:center;display:inline-flex;height:100%;padding-inline-start:1rem;padding-inline-end:1rem}.padding-start-1{padding-inline-start:1rem}.cursor-default{cursor:default}";
89
+ const MapLayerPickerStyle0 = mapLayerPickerCss;
90
+
91
+ const MapLayerPicker = class {
92
+ constructor(hostRef) {
93
+ registerInstance(this, hostRef);
94
+ this.idsFound = createEvent(this, "idsFound", 7);
95
+ this.noLayersFound = createEvent(this, "noLayersFound", 7);
96
+ this.layerSelectionChange = createEvent(this, "layerSelectionChange", 7);
97
+ //--------------------------------------------------------------------------
98
+ //
99
+ // Properties (protected)
100
+ //
101
+ //--------------------------------------------------------------------------
102
+ /**
103
+ * boolean: When true the default layer has been loaded once and should no longer be used
104
+ */
105
+ this.defaultLayerHonored = false;
106
+ this.appearance = "transparent";
107
+ this.defaultLayerId = "";
108
+ this.display = "inline-block";
109
+ this.enabledLayerIds = [];
110
+ this.enabledTableIds = [];
111
+ this.height = undefined;
112
+ this.isMobile = undefined;
113
+ this.mapView = undefined;
114
+ this.onlyShowUpdatableLayers = undefined;
115
+ this.placeholderIcon = "";
116
+ this.selectedIds = [];
117
+ this.scale = "m";
118
+ this.showTables = undefined;
119
+ this.showSingleLayerAsLabel = false;
120
+ this.type = "select";
121
+ this._hasMultipleLayers = true;
122
+ this._hasValidLayers = true;
123
+ this._isDropdownOpen = undefined;
124
+ this.ids = [];
125
+ this.selectedName = "";
126
+ this._translations = undefined;
127
+ }
128
+ //--------------------------------------------------------------------------
129
+ //
130
+ // Watch handlers
131
+ //
132
+ //--------------------------------------------------------------------------
133
+ /**
134
+ * Called each time the mapView prop is changed.
135
+ */
136
+ async mapViewWatchHandler() {
137
+ await this._setLayers();
138
+ if (this.ids.length > 0) {
139
+ this._hasValidLayers = true;
140
+ this._hasMultipleLayers = this.ids.length > 1;
141
+ this._setSelectedLayer(this.ids[0]);
142
+ }
143
+ else {
144
+ this._hasValidLayers = false;
145
+ this.noLayersFound.emit();
146
+ }
147
+ }
148
+ //--------------------------------------------------------------------------
149
+ //
150
+ // Functions (lifecycle)
151
+ //
152
+ //--------------------------------------------------------------------------
153
+ /**
154
+ * StencilJS: Called once just after the component is first connected to the DOM.
155
+ */
156
+ async componentWillLoad() {
157
+ await this._getTranslations();
158
+ await this._setLayers();
159
+ if (this.ids.length > 0 || this.selectedIds.length === 1) {
160
+ this.layerSelectionChange.emit(this.selectedIds.length === 1 ? [this.selectedIds[0]] : [this.ids[0]]);
161
+ }
162
+ }
163
+ /**
164
+ * Renders the component.
165
+ */
166
+ render() {
167
+ const id = "map-layer-picker";
168
+ let style = this.height > 0 ? { "height": `${this.height.toString()}px` } : {};
169
+ style = Object.assign(Object.assign({}, style), { "display": this.display });
170
+ return (h(Host, { key: 'ccb8c7d12a2e631938308380cd4ecd0a1d73c963' }, h("div", { key: 'aa0992de9bab1c5a555d51542c093cc7cb948200', class: "map-layer-picker-container", style: style }, h("div", { key: 'a03bca67eb822b492d34abe53db7d05e6fd7ebdf', class: "map-layer-picker", style: style }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
171
+ !this._hasMultipleLayers && this.showSingleLayerAsLabel ? this._getSingleLayerPlaceholder() :
172
+ this.type === "combobox" ? this._getCombobox(id) :
173
+ this.type === "select" ? this._getSelect(id) : this._getDropdown(id)))));
174
+ }
175
+ /**
176
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
177
+ */
178
+ async componentDidLoad() {
179
+ if (this.ids.length > 0 || this.selectedIds.length === 1) {
180
+ const id = this.selectedIds.length === 1 ? this.selectedIds[0] : this.ids[0];
181
+ if (this.type === "select") {
182
+ this._layerElement.value = id;
183
+ }
184
+ else if (this.type === "dropdown") {
185
+ this.selectedName = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
186
+ this._layerNameHash[id].name : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
187
+ this._tableNameHash[id].name : "";
188
+ }
189
+ }
190
+ }
191
+ //--------------------------------------------------------------------------
192
+ //
193
+ // Functions (protected)
194
+ //
195
+ //--------------------------------------------------------------------------
196
+ /**
197
+ * Create a notice to inform the user that no layers were found
198
+ *
199
+ * @returns Calcite Notice component with the message
200
+ */
201
+ _getInvalidPlaceholder() {
202
+ return (h("div", null, h("calcite-notice", { class: "height-100", icon: "exclamation-mark-triangle", id: "no-valid-layers", kind: "danger", open: true }, h("div", { slot: "message" }, this._translations.noLayersFound)), h("calcite-tooltip", { label: this._translations.enableEditUpdate, placement: "bottom", "reference-element": "no-valid-layers" }, h("span", null, this._translations.enableEditUpdate))));
203
+ }
204
+ /**
205
+ * Show layer name as a label with icon
206
+ *
207
+ * @returns Calcite label with the layer name and icon
208
+ */
209
+ _getSingleLayerPlaceholder() {
210
+ return (h("div", { class: "layer-picker-label-container cursor-default" }, h("calcite-icon", { icon: "layers", scale: "s" }), h("calcite-label", { class: "no-bottom-margin padding-start-1" }, this.selectedName)));
211
+ }
212
+ /**
213
+ * Create a list of layers from the map
214
+ * Used for selecting a single layer.
215
+ *
216
+ * @param id the id for the select component used to support the tooltip
217
+ *
218
+ * @returns Calcite Select component with the ids of the layers from the map
219
+ */
220
+ _getSelect(id) {
221
+ return (h("calcite-select", { id: id, label: "", onCalciteSelectChange: () => this._layerSelectionChange(), ref: (el) => { this._layerElement = el; }, scale: this.scale }, this._getMapLayerOptions()));
222
+ }
223
+ /**
224
+ * Create a list of layer ids from the map
225
+ * Used for selecting multiple layers
226
+ *
227
+ * @param id the id for the combobox component used to support the tooltip
228
+ *
229
+ * @returns Calcite ComboBox component with the ids of the layers from the map
230
+ */
231
+ _getCombobox(id) {
232
+ return (h("calcite-combobox", { clearDisabled: true, id: id, label: "", onCalciteComboboxChange: () => this._layerSelectionChange(), "placeholder-icon": this.placeholderIcon, ref: (el) => { this._layerElement = el; }, scale: this.scale, "selection-mode": "single" }, this._getMapLayerOptions()));
233
+ }
234
+ /**
235
+ * Hydrate a dropdown component with items to display the layer names
236
+ *
237
+ * @param id the id for the dropdown component used to support the tooltip
238
+ *
239
+ * @returns Array of Dropdown items with layer names
240
+ */
241
+ _getDropdown(id) {
242
+ return (h("calcite-dropdown", { class: "layer-picker-dropdown", onCalciteDropdownBeforeClose: () => this._isDropdownOpen = false, onCalciteDropdownBeforeOpen: () => this._isDropdownOpen = true }, this.isMobile ? this._getDropdownButton() : this._getActionDropdownButton(id), h("calcite-dropdown-group", { "selection-mode": "single" }, this._getMapLayerOptions())));
243
+ }
244
+ /**
245
+ * Get the button that will open the dropdown list wrapped in an action
246
+ *
247
+ * @returns the node for the action and button
248
+ */
249
+ _getActionDropdownButton(id) {
250
+ return (h("calcite-action", { id: id, slot: "trigger", text: "" }, this._getDropdownButton()));
251
+ }
252
+ /**
253
+ * Get the button that will open the dropdown list
254
+ *
255
+ * @returns the node for the button
256
+ */
257
+ _getDropdownButton() {
258
+ const buttonClass = this.isMobile ? "" : "max-width-350";
259
+ const buttonSlot = this.isMobile ? "trigger" : "";
260
+ const buttonIcon = this._isDropdownOpen ? "chevron-up" : "chevron-down";
261
+ return (h("calcite-button", { alignment: "icon-end-space-between", appearance: this.appearance, class: buttonClass, iconEnd: buttonIcon, iconStart: "layers", kind: "neutral", slot: buttonSlot, width: "full" }, h("div", null, this.selectedName)));
262
+ }
263
+ /**
264
+ * Get the appropriate type of dom nodes for each valid layer or table
265
+ *
266
+ * @returns Array of dom nodes with the names of the layers and optionally of the tables
267
+ */
268
+ _getMapLayerOptions() {
269
+ return this.ids.reduce((prev, cur) => {
270
+ if (this._validLayer(cur)) {
271
+ prev.push(this._getItem(cur, "layer"));
272
+ }
273
+ else if (this._validTable(cur)) {
274
+ prev.push(this._getItem(cur, "table"));
275
+ }
276
+ return prev;
277
+ }, []);
278
+ }
279
+ /**
280
+ * Get the appropriate type of dom node for the current layer or table id
281
+ *
282
+ * @returns A dom node with the name of the layer or table
283
+ */
284
+ _getItem(id, itemType) {
285
+ const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
286
+ const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
287
+ const name = item.name;
288
+ const selected = this.selectedIds.indexOf(id) > -1;
289
+ return this.type === "combobox" ? (h("calcite-combobox-item", { disabled: disabled, selected: selected, textLabel: name, value: id })) :
290
+ this.type === "select" ? (h("calcite-option", { disabled: disabled, label: name, selected: selected, value: id })) : (h("calcite-dropdown-group", { class: disabled ? "disabled" : "", selectionMode: disabled ? "none" : "single" }, h("calcite-dropdown-item", { onClick: disabled ? undefined : () => void this._setSelectedLayer(id), selected: selected }, name)));
291
+ }
292
+ /**
293
+ * Store the layer name based on the user selection
294
+ */
295
+ _setSelectedLayer(id) {
296
+ let item;
297
+ const hasDefaultLayer = this.defaultLayerId && !this.defaultLayerHonored;
298
+ if (hasDefaultLayer) {
299
+ item = this._getLayerFromHash(this.defaultLayerId);
300
+ this.defaultLayerHonored = item !== undefined;
301
+ id = this.defaultLayerHonored ? this.defaultLayerId : id;
302
+ }
303
+ item = item ? item : this._getLayerFromHash(id);
304
+ this.selectedName = item === null || item === void 0 ? void 0 : item.name;
305
+ this.selectedIds = [id];
306
+ this.layerSelectionChange.emit(this.selectedIds);
307
+ }
308
+ /**
309
+ * Fetch layer hash info for the given id
310
+ *
311
+ * @returns ILayerHashInfo for the id
312
+ */
313
+ _getLayerFromHash(id) {
314
+ return Object.keys(this._layerNameHash).indexOf(id) > -1 ?
315
+ this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
316
+ this._tableNameHash[id] : undefined;
317
+ }
318
+ /**
319
+ * Fetch the ids of the layers from the map
320
+ *
321
+ * @returns Promise when the operation has completed
322
+ */
323
+ async _setLayers() {
324
+ if (this.mapView) {
325
+ await this._initLayerTableHash();
326
+ const layerIds = this.onlyShowUpdatableLayers ?
327
+ this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
328
+ const tableIds = this.showTables ? this.onlyShowUpdatableLayers ?
329
+ this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
330
+ this.ids = [
331
+ ...layerIds.reverse().filter(n => { var _a; return ((_a = this.enabledLayerIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledLayerIds.reverse().indexOf(n) > -1 : true; }),
332
+ ...tableIds.reverse().filter(n => { var _a; return ((_a = this.enabledTableIds) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.enabledTableIds.reverse().indexOf(n) > -1 : true; }),
333
+ ];
334
+ this.idsFound.emit({
335
+ layerIds,
336
+ tableIds
337
+ });
338
+ }
339
+ }
340
+ /**
341
+ * Fetch the ids of all layers that support edits with the update capability
342
+ *
343
+ * @returns array of layer ids
344
+ */
345
+ _getEditableIds(hash) {
346
+ return Object.keys(hash).reduce((prev, cur) => {
347
+ if (hash[cur].supportsUpdate) {
348
+ prev.push(cur);
349
+ }
350
+ return prev;
351
+ }, []);
352
+ }
353
+ /**
354
+ * Create a layer id:title hash for layer name display
355
+ *
356
+ * @returns Promise when the operation has completed
357
+ */
358
+ async _initLayerTableHash() {
359
+ this._layerNameHash = await getMapLayerHash(this.mapView, this.onlyShowUpdatableLayers);
360
+ this._tableNameHash = this.showTables ? await getMapTableHash(this.mapView, this.onlyShowUpdatableLayers) : {};
361
+ }
362
+ /**
363
+ * Evaluate if the id exists in the current hash and verify if it should be excluded
364
+ *
365
+ * @returns boolean when true the layer will be used in the current layer picker type
366
+ */
367
+ _validLayer(id) {
368
+ var _a;
369
+ const name = (_a = this._layerNameHash[id]) === null || _a === void 0 ? void 0 : _a.name;
370
+ return name && Object.keys(state.managedLayers).indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
371
+ this.enabledLayerIds.indexOf(id) > -1 : true);
372
+ }
373
+ /**
374
+ * Evaluate if the id exists in the current hash and verify if it should be excluded
375
+ *
376
+ * @returns boolean when true the table will be used in the current layer picker type
377
+ */
378
+ _validTable(id) {
379
+ var _a;
380
+ const name = (_a = this._tableNameHash[id]) === null || _a === void 0 ? void 0 : _a.name;
381
+ const validName = name && this.showTables;
382
+ return validName ? state.managedTables.indexOf(name) < 0 &&
383
+ (this.enabledTableIds.length > 0 ? this.enabledTableIds.indexOf(id) > -1 : true) : validName;
384
+ }
385
+ /**
386
+ * Fetch the ids of the layers from the map
387
+ *
388
+ * @returns Promise when the operation has completed
389
+ */
390
+ _layerSelectionChange() {
391
+ const ids = Array.isArray(this._layerElement.value) ? this._layerElement.value : [this._layerElement.value];
392
+ if (JSON.stringify(ids) !== JSON.stringify([""])) {
393
+ this.selectedIds = ids;
394
+ this.layerSelectionChange.emit(this.selectedIds);
395
+ }
396
+ }
397
+ /**
398
+ * Fetches the component's translations
399
+ *
400
+ * @returns Promise when complete
401
+ * @protected
402
+ */
403
+ async _getTranslations() {
404
+ const messages = await getLocaleComponentStrings(this.el);
405
+ this._translations = messages[0];
406
+ }
407
+ get el() { return getElement(this); }
408
+ static get watchers() { return {
409
+ "mapView": ["mapViewWatchHandler"]
410
+ }; }
411
+ };
412
+ MapLayerPicker.style = MapLayerPickerStyle0;
413
+
414
+ export { DropdownGroup as calcite_dropdown_group, MapLayerPicker as map_layer_picker };