@esri/solutions-components 0.10.7 → 0.10.8
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/basemap-gallery_7.cjs.entry.js +24 -8
- package/dist/cjs/buffer-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +354 -967
- package/dist/cjs/calcite-graph_2.cjs.entry.js +1082 -0
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +6 -6
- package/dist/cjs/calcite-tree_3.cjs.entry.js +1 -1
- package/dist/cjs/card-manager_3.cjs.entry.js +246 -18
- package/dist/cjs/crowdsource-manager.cjs.entry.js +169 -49
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +3 -3
- package/dist/cjs/pci-calculator.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- package/dist/cjs/refine-results-flow-item.cjs.entry.js +1 -1
- package/dist/cjs/share-item.cjs.entry.js +1 -1
- package/dist/cjs/solution-configuration.cjs.entry.js +3 -3
- package/dist/cjs/solution-contents_3.cjs.entry.js +3 -3
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/cjs/spatial-ref.cjs.entry.js +1 -1
- package/dist/collection/assets/t9n/crowdsource-manager/resources.json +5 -1
- package/dist/collection/assets/t9n/crowdsource-manager/resources_en.json +5 -1
- package/dist/collection/assets/t9n/layer-table/resources.json +1 -0
- package/dist/collection/assets/t9n/layer-table/resources_en.json +1 -0
- package/dist/collection/assets/t9n/map-card/resources.json +6 -1
- package/dist/collection/assets/t9n/map-card/resources_en.json +6 -1
- package/dist/collection/components/card-manager/card-manager.js +34 -8
- package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +173 -65
- package/dist/collection/components/layer-table/layer-table.js +175 -8
- package/dist/collection/components/map-card/map-card.css +4 -0
- package/dist/collection/components/map-card/map-card.js +368 -3
- package/dist/collection/components/map-draw-tools/map-draw-tools.js +1 -1
- package/dist/collection/components/map-fullscreen/map-fullscreen.js +1 -1
- package/dist/collection/components/map-layer-picker/map-layer-picker.js +9 -3
- package/dist/collection/components/map-legend/map-legend.js +1 -1
- package/dist/collection/components/map-picker/map-picker.css +8 -0
- package/dist/collection/components/map-picker/map-picker.js +74 -3
- package/dist/collection/components/map-search/map-search.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +1 -1
- package/dist/collection/components/map-tools/map-tools.js +1 -1
- package/dist/collection/components/pci-calculator/pci-calculator.js +1 -1
- package/dist/collection/components/pdf-download/pdf-download.js +1 -1
- package/dist/collection/components/public-notification/public-notification.js +1 -1
- package/dist/collection/components/refine-results-flow-item/refine-results-flow-item.js +1 -1
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/components/share-item/share-item.js +1 -1
- package/dist/collection/components/solution-configuration/solution-configuration.js +3 -3
- package/dist/collection/components/solution-contents/solution-contents.js +1 -1
- package/dist/collection/components/solution-item/solution-item.js +1 -1
- package/dist/collection/components/solution-item-details/solution-item-details.js +1 -1
- package/dist/collection/components/solution-item-icon/solution-item-icon.js +1 -1
- package/dist/collection/components/solution-item-sharing/solution-item-sharing.js +1 -1
- package/dist/collection/components/solution-organization-variables/solution-organization-variables.js +1 -1
- package/dist/collection/components/solution-resource-item/solution-resource-item.js +1 -1
- package/dist/collection/components/solution-spatial-ref/solution-spatial-ref.js +1 -1
- package/dist/collection/components/solution-template-data/solution-template-data.js +1 -1
- package/dist/collection/components/solution-variables/solution-variables.js +1 -1
- package/dist/collection/components/spatial-ref/spatial-ref.js +1 -1
- package/dist/collection/demos/crowdsource-manager.html +1 -0
- package/dist/components/card-manager2.js +20 -8
- package/dist/components/crowdsource-manager.js +172 -53
- package/dist/components/layer-table2.js +72 -10
- package/dist/components/map-card2.js +288 -47
- package/dist/components/map-draw-tools2.js +1 -1
- package/dist/components/map-fullscreen2.js +1 -1
- package/dist/components/map-layer-picker2.js +9 -3
- package/dist/components/map-legend2.js +1 -1
- package/dist/components/map-picker2.js +24 -5
- package/dist/components/map-search2.js +1 -1
- package/dist/components/map-select-tools2.js +1 -1
- package/dist/components/map-tools2.js +1 -1
- package/dist/components/pci-calculator.js +1 -1
- package/dist/components/pdf-download2.js +1 -1
- package/dist/components/public-notification.js +1 -1
- package/dist/components/refine-results-flow-item.js +1 -1
- package/dist/components/refine-selection2.js +1 -1
- package/dist/components/share-item.js +1 -1
- package/dist/components/solution-configuration.js +3 -3
- package/dist/components/solution-contents2.js +1 -1
- package/dist/components/solution-item-details2.js +1 -1
- package/dist/components/solution-item-icon2.js +1 -1
- package/dist/components/solution-item-sharing2.js +1 -1
- package/dist/components/solution-item2.js +1 -1
- package/dist/components/solution-organization-variables2.js +1 -1
- package/dist/components/solution-resource-item2.js +1 -1
- package/dist/components/solution-spatial-ref2.js +1 -1
- package/dist/components/solution-template-data2.js +1 -1
- package/dist/components/solution-variables2.js +1 -1
- package/dist/components/spatial-ref.js +1 -1
- package/dist/esm/basemap-gallery_7.entry.js +24 -8
- package/dist/esm/buffer-tools_3.entry.js +1 -1
- package/dist/esm/calcite-combobox_3.entry.js +369 -982
- package/dist/esm/calcite-graph_2.entry.js +1077 -0
- package/dist/esm/calcite-shell-panel_14.entry.js +6 -6
- package/dist/esm/calcite-tree_3.entry.js +1 -1
- package/dist/esm/card-manager_3.entry.js +248 -20
- package/dist/esm/crowdsource-manager.entry.js +170 -50
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +3 -3
- package/dist/esm/pci-calculator.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/esm/refine-results-flow-item.entry.js +1 -1
- package/dist/esm/share-item.entry.js +1 -1
- package/dist/esm/solution-configuration.entry.js +3 -3
- package/dist/esm/solution-contents_3.entry.js +3 -3
- package/dist/esm/solutions-components.js +1 -1
- package/dist/esm/spatial-ref.entry.js +1 -1
- package/dist/solutions-components/assets/t9n/crowdsource-manager/resources.json +5 -1
- package/dist/solutions-components/assets/t9n/crowdsource-manager/resources_en.json +5 -1
- package/dist/solutions-components/assets/t9n/layer-table/resources.json +1 -0
- package/dist/solutions-components/assets/t9n/layer-table/resources_en.json +1 -0
- package/dist/solutions-components/assets/t9n/map-card/resources.json +6 -1
- package/dist/solutions-components/assets/t9n/map-card/resources_en.json +6 -1
- package/dist/solutions-components/demos/crowdsource-manager.html +1 -0
- package/dist/solutions-components/p-0abc1354.entry.js +6 -0
- package/dist/solutions-components/p-0f7b5d36.entry.js +6 -0
- package/dist/solutions-components/{p-a9818be2.entry.js → p-20c465e9.entry.js} +1 -1
- package/dist/solutions-components/{p-db18bce8.entry.js → p-36b50b5b.entry.js} +1 -1
- package/dist/solutions-components/{p-85512ae3.entry.js → p-445213cf.entry.js} +1 -1
- package/dist/solutions-components/{p-d49f895d.entry.js → p-4a5f0a97.entry.js} +1 -1
- package/dist/solutions-components/{p-002c97df.entry.js → p-5d201016.entry.js} +1 -1
- package/dist/solutions-components/{p-b7cec3bd.entry.js → p-618bafec.entry.js} +1 -1
- package/dist/solutions-components/p-6a66d5a9.entry.js +6 -0
- package/dist/solutions-components/p-71a2d5b8.entry.js +6 -0
- package/dist/solutions-components/p-7a64b026.entry.js +17 -0
- package/dist/solutions-components/p-85c25564.entry.js +6 -0
- package/dist/solutions-components/{p-235bf02e.entry.js → p-913413c3.entry.js} +1 -1
- package/dist/solutions-components/p-9af1cb14.entry.js +6 -0
- package/dist/solutions-components/{p-49aa2929.entry.js → p-bebd4646.entry.js} +1 -1
- package/dist/solutions-components/p-ce454f5a.entry.js +11 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/types/components/card-manager/card-manager.d.ts +11 -0
- package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +86 -20
- package/dist/types/components/layer-table/layer-table.d.ts +30 -0
- package/dist/types/components/map-card/map-card.d.ts +124 -0
- package/dist/types/components/map-layer-picker/map-layer-picker.d.ts +4 -0
- package/dist/types/components/map-picker/map-picker.d.ts +12 -0
- package/dist/types/components.d.ts +130 -0
- package/dist/types/preact.d.ts +4 -2
- package/package.json +1 -1
- package/dist/cjs/calcite-dropdown-group_2.cjs.entry.js +0 -453
- package/dist/esm/calcite-dropdown-group_2.entry.js +0 -448
- package/dist/solutions-components/p-129fd80e.entry.js +0 -6
- package/dist/solutions-components/p-3b426576.entry.js +0 -6
- package/dist/solutions-components/p-72b217f2.entry.js +0 -6
- package/dist/solutions-components/p-8b999a2b.entry.js +0 -6
- package/dist/solutions-components/p-973ff7b2.entry.js +0 -23
- package/dist/solutions-components/p-a001f9c9.entry.js +0 -6
- package/dist/solutions-components/p-c683b3fe.entry.js +0 -6
- package/dist/solutions-components/p-e9d049bd.entry.js +0 -6
@@ -1,453 +0,0 @@
|
|
1
|
-
/*!
|
2
|
-
* Copyright 2022 Esri
|
3
|
-
* Licensed under the Apache License, Version 2.0
|
4
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
5
|
-
*/
|
6
|
-
'use strict';
|
7
|
-
|
8
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
9
|
-
|
10
|
-
const index = require('./index-696e53e6.js');
|
11
|
-
const observers = require('./observers-3440c668.js');
|
12
|
-
const resources = require('./resources-ea500edf.js');
|
13
|
-
const locale = require('./locale-4e7fe921.js');
|
14
|
-
const mapViewUtils = require('./mapViewUtils-8d4da732.js');
|
15
|
-
const publicNotificationStore = require('./publicNotificationStore-8d2558c6.js');
|
16
|
-
require('./browser-02cbd1d9.js');
|
17
|
-
require('./esri-loader-08dc41bd.js');
|
18
|
-
require('./_commonjsHelpers-baf43783.js');
|
19
|
-
require('./interfaces-09c4c40e.js');
|
20
|
-
require('./index-a0cca96e.js');
|
21
|
-
|
22
|
-
const dropdownGroupCss = ":host{position:relative;display:block}.container{text-align:start}.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([scale=s]){font-size:var(--calcite-font-size--2);line-height:1rem}:host([scale=s]) .dropdown-title{padding:0.5rem}:host([scale=m]){font-size:var(--calcite-font-size--1);line-height:1rem}:host([scale=m]) .dropdown-title{padding:0.75rem}:host([scale=l]){font-size:var(--calcite-font-size-0);line-height:1.25rem}:host([scale=l]) .dropdown-title{padding:1rem}:host([hidden]){display:none}[hidden]{display:none}";
|
23
|
-
const CalciteDropdownGroupStyle0 = dropdownGroupCss;
|
24
|
-
|
25
|
-
const DropdownGroup = class {
|
26
|
-
constructor(hostRef) {
|
27
|
-
index.registerInstance(this, hostRef);
|
28
|
-
this.calciteInternalDropdownItemChange = index.createEvent(this, "calciteInternalDropdownItemChange", 6);
|
29
|
-
this.updateItems = () => {
|
30
|
-
Array.from(this.el.querySelectorAll("calcite-dropdown-item")).forEach((item) => (item.selectionMode = this.selectionMode));
|
31
|
-
};
|
32
|
-
this.mutationObserver = observers.createObserver("mutation", () => this.updateItems());
|
33
|
-
this.groupTitle = undefined;
|
34
|
-
this.scale = "m";
|
35
|
-
this.selectionMode = "single";
|
36
|
-
}
|
37
|
-
handlePropsChange() {
|
38
|
-
this.updateItems();
|
39
|
-
}
|
40
|
-
//--------------------------------------------------------------------------
|
41
|
-
//
|
42
|
-
// Lifecycle
|
43
|
-
//
|
44
|
-
//--------------------------------------------------------------------------
|
45
|
-
connectedCallback() {
|
46
|
-
this.updateItems();
|
47
|
-
this.mutationObserver?.observe(this.el, { childList: true });
|
48
|
-
}
|
49
|
-
componentWillLoad() {
|
50
|
-
this.groupPosition = this.getGroupPosition();
|
51
|
-
}
|
52
|
-
disconnectedCallback() {
|
53
|
-
this.mutationObserver?.disconnect();
|
54
|
-
}
|
55
|
-
render() {
|
56
|
-
const groupTitle = this.groupTitle ? (index.h("span", { "aria-hidden": "true", class: "dropdown-title" }, this.groupTitle)) : null;
|
57
|
-
const dropdownSeparator = this.groupPosition > 0 ? index.h("div", { class: "dropdown-separator", role: "separator" }) : null;
|
58
|
-
return (index.h(index.Host, { key: '1c189e8ff87a118d296781b729c889307c2b4a5b', "aria-label": this.groupTitle, role: "group" }, index.h("div", { key: '2afc3aee9c68b26af882168ce24cb2937a17c9e8', class: {
|
59
|
-
[resources.CSS.container]: true,
|
60
|
-
} }, dropdownSeparator, groupTitle, index.h("slot", { key: '3fdcfab750b0541a4a24764f1a1875c867db06e8' }))));
|
61
|
-
}
|
62
|
-
//--------------------------------------------------------------------------
|
63
|
-
//
|
64
|
-
// Event Listeners
|
65
|
-
//
|
66
|
-
//--------------------------------------------------------------------------
|
67
|
-
updateActiveItemOnChange(event) {
|
68
|
-
this.requestedDropdownGroup = event.detail.requestedDropdownGroup;
|
69
|
-
this.requestedDropdownItem = event.detail.requestedDropdownItem;
|
70
|
-
this.calciteInternalDropdownItemChange.emit({
|
71
|
-
requestedDropdownGroup: this.requestedDropdownGroup,
|
72
|
-
requestedDropdownItem: this.requestedDropdownItem,
|
73
|
-
});
|
74
|
-
}
|
75
|
-
//--------------------------------------------------------------------------
|
76
|
-
//
|
77
|
-
// Private Methods
|
78
|
-
//
|
79
|
-
//--------------------------------------------------------------------------
|
80
|
-
getGroupPosition() {
|
81
|
-
return Array.prototype.indexOf.call(this.el.parentElement.querySelectorAll("calcite-dropdown-group"), this.el);
|
82
|
-
}
|
83
|
-
static get delegatesFocus() { return true; }
|
84
|
-
get el() { return index.getElement(this); }
|
85
|
-
static get watchers() { return {
|
86
|
-
"selectionMode": ["handlePropsChange"]
|
87
|
-
}; }
|
88
|
-
};
|
89
|
-
DropdownGroup.style = CalciteDropdownGroupStyle0;
|
90
|
-
|
91
|
-
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}";
|
92
|
-
const MapLayerPickerStyle0 = mapLayerPickerCss;
|
93
|
-
|
94
|
-
const MapLayerPicker = class {
|
95
|
-
constructor(hostRef) {
|
96
|
-
index.registerInstance(this, hostRef);
|
97
|
-
this.idsFound = index.createEvent(this, "idsFound", 7);
|
98
|
-
this.noLayersFound = index.createEvent(this, "noLayersFound", 7);
|
99
|
-
this.layerSelectionChange = index.createEvent(this, "layerSelectionChange", 7);
|
100
|
-
this.appearance = "transparent";
|
101
|
-
this.defaultLayerId = "";
|
102
|
-
this.display = "inline-block";
|
103
|
-
this.enabledLayerIds = [];
|
104
|
-
this.enabledTableIds = [];
|
105
|
-
this.height = undefined;
|
106
|
-
this.isMobile = undefined;
|
107
|
-
this.mapView = undefined;
|
108
|
-
this.onlyShowUpdatableLayers = undefined;
|
109
|
-
this.placeholderIcon = "";
|
110
|
-
this.selectedIds = [];
|
111
|
-
this.scale = "m";
|
112
|
-
this.showTables = undefined;
|
113
|
-
this.showSingleLayerAsLabel = false;
|
114
|
-
this.type = "select";
|
115
|
-
this._hasMultipleLayers = true;
|
116
|
-
this._hasValidLayers = true;
|
117
|
-
this._isDropdownOpen = undefined;
|
118
|
-
this.ids = [];
|
119
|
-
this.selectedName = "";
|
120
|
-
this._translations = undefined;
|
121
|
-
}
|
122
|
-
get el() { return index.getElement(this); }
|
123
|
-
//--------------------------------------------------------------------------
|
124
|
-
//
|
125
|
-
// Properties (protected)
|
126
|
-
//
|
127
|
-
//--------------------------------------------------------------------------
|
128
|
-
/**
|
129
|
-
* boolean: When true the default layer has been loaded once and should no longer be used
|
130
|
-
*/
|
131
|
-
defaultLayerHonored = false;
|
132
|
-
/**
|
133
|
-
* HTMLCalciteSelectElement: The html element for selecting layers
|
134
|
-
*/
|
135
|
-
_layerElement;
|
136
|
-
/**
|
137
|
-
* IMapItemHash: id/name lookup
|
138
|
-
*/
|
139
|
-
_layerNameHash;
|
140
|
-
/**
|
141
|
-
* IMapItemHash: id/name lookup
|
142
|
-
*/
|
143
|
-
_tableNameHash;
|
144
|
-
//--------------------------------------------------------------------------
|
145
|
-
//
|
146
|
-
// Watch handlers
|
147
|
-
//
|
148
|
-
//--------------------------------------------------------------------------
|
149
|
-
/**
|
150
|
-
* Called each time the mapView prop is changed.
|
151
|
-
*/
|
152
|
-
async mapViewWatchHandler() {
|
153
|
-
await this._setLayers();
|
154
|
-
if (this.ids.length > 0) {
|
155
|
-
this._hasValidLayers = true;
|
156
|
-
this._hasMultipleLayers = this.ids.length > 1;
|
157
|
-
this._setSelectedLayer(this.ids[0]);
|
158
|
-
}
|
159
|
-
else {
|
160
|
-
this._hasValidLayers = false;
|
161
|
-
this.noLayersFound.emit();
|
162
|
-
}
|
163
|
-
}
|
164
|
-
//--------------------------------------------------------------------------
|
165
|
-
//
|
166
|
-
// Methods (public)
|
167
|
-
//
|
168
|
-
//--------------------------------------------------------------------------
|
169
|
-
//--------------------------------------------------------------------------
|
170
|
-
//
|
171
|
-
// Events (public)
|
172
|
-
//
|
173
|
-
//--------------------------------------------------------------------------
|
174
|
-
/**
|
175
|
-
* Emitted on demand when no valid layers are found
|
176
|
-
*
|
177
|
-
*/
|
178
|
-
idsFound;
|
179
|
-
/**
|
180
|
-
* Emitted on demand when no valid layers are found
|
181
|
-
*
|
182
|
-
*/
|
183
|
-
noLayersFound;
|
184
|
-
/**
|
185
|
-
* Emitted on demand when a layer is selected
|
186
|
-
*
|
187
|
-
*/
|
188
|
-
layerSelectionChange;
|
189
|
-
//--------------------------------------------------------------------------
|
190
|
-
//
|
191
|
-
// Functions (lifecycle)
|
192
|
-
//
|
193
|
-
//--------------------------------------------------------------------------
|
194
|
-
/**
|
195
|
-
* StencilJS: Called once just after the component is first connected to the DOM.
|
196
|
-
*/
|
197
|
-
async componentWillLoad() {
|
198
|
-
await this._getTranslations();
|
199
|
-
await this._setLayers();
|
200
|
-
if (this.ids.length > 0 || this.selectedIds.length === 1) {
|
201
|
-
this.layerSelectionChange.emit(this.selectedIds.length === 1 ? [this.selectedIds[0]] : [this.ids[0]]);
|
202
|
-
}
|
203
|
-
}
|
204
|
-
/**
|
205
|
-
* Renders the component.
|
206
|
-
*/
|
207
|
-
render() {
|
208
|
-
const id = "map-layer-picker";
|
209
|
-
let style = this.height > 0 ? { "height": `${this.height.toString()}px` } : {};
|
210
|
-
style = { ...style, "display": this.display };
|
211
|
-
return (index.h(index.Host, { key: 'a96e93924530d926c5e10dd2f7212f3f8c1cbe3c' }, index.h("div", { key: '4b96a73e43e86c31291e4ac60eb15976b01de6a2', class: "map-layer-picker-container", style: style }, index.h("div", { key: 'e75c61d8ce0853814dd3903b9e1952cc613b6fbb', class: "map-layer-picker", style: style }, !this._hasValidLayers ? this._getInvalidPlaceholder() :
|
212
|
-
!this._hasMultipleLayers && this.showSingleLayerAsLabel ? this._getSingleLayerPlaceholder() :
|
213
|
-
this.type === "combobox" ? this._getCombobox(id) :
|
214
|
-
this.type === "select" ? this._getSelect(id) : this._getDropdown(id)))));
|
215
|
-
}
|
216
|
-
/**
|
217
|
-
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
218
|
-
*/
|
219
|
-
async componentDidLoad() {
|
220
|
-
if (this.ids.length > 0 || this.selectedIds.length === 1) {
|
221
|
-
const id = this.selectedIds.length === 1 ? this.selectedIds[0] : this.ids[0];
|
222
|
-
if (this.type === "select") {
|
223
|
-
this._layerElement.value = id;
|
224
|
-
}
|
225
|
-
else if (this.type === "dropdown") {
|
226
|
-
this.selectedName = Object.keys(this._layerNameHash).indexOf(id) > -1 ?
|
227
|
-
this._layerNameHash[id].name : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
|
228
|
-
this._tableNameHash[id].name : "";
|
229
|
-
}
|
230
|
-
}
|
231
|
-
}
|
232
|
-
//--------------------------------------------------------------------------
|
233
|
-
//
|
234
|
-
// Functions (protected)
|
235
|
-
//
|
236
|
-
//--------------------------------------------------------------------------
|
237
|
-
/**
|
238
|
-
* Create a notice to inform the user that no layers were found
|
239
|
-
*
|
240
|
-
* @returns Calcite Notice component with the message
|
241
|
-
*/
|
242
|
-
_getInvalidPlaceholder() {
|
243
|
-
return (index.h("div", null, index.h("calcite-notice", { class: "height-100", icon: "exclamation-mark-triangle", id: "no-valid-layers", kind: "danger", open: true }, index.h("div", { slot: "message" }, this._translations.noLayersFound)), index.h("calcite-tooltip", { label: this._translations.enableEditUpdate, placement: "bottom", "reference-element": "no-valid-layers" }, index.h("span", null, this._translations.enableEditUpdate))));
|
244
|
-
}
|
245
|
-
/**
|
246
|
-
* Show layer name as a label with icon
|
247
|
-
*
|
248
|
-
* @returns Calcite label with the layer name and icon
|
249
|
-
*/
|
250
|
-
_getSingleLayerPlaceholder() {
|
251
|
-
return (index.h("div", { class: "layer-picker-label-container cursor-default" }, index.h("calcite-icon", { icon: "layers", scale: "s" }), index.h("calcite-label", { class: "no-bottom-margin padding-start-1" }, this.selectedName)));
|
252
|
-
}
|
253
|
-
/**
|
254
|
-
* Create a list of layers from the map
|
255
|
-
* Used for selecting a single layer.
|
256
|
-
*
|
257
|
-
* @param id the id for the select component used to support the tooltip
|
258
|
-
*
|
259
|
-
* @returns Calcite Select component with the ids of the layers from the map
|
260
|
-
*/
|
261
|
-
_getSelect(id) {
|
262
|
-
return (index.h("calcite-select", { id: id, label: "", onCalciteSelectChange: () => this._layerSelectionChange(), ref: (el) => { this._layerElement = el; }, scale: this.scale }, this._getMapLayerOptions()));
|
263
|
-
}
|
264
|
-
/**
|
265
|
-
* Create a list of layer ids from the map
|
266
|
-
* Used for selecting multiple layers
|
267
|
-
*
|
268
|
-
* @param id the id for the combobox component used to support the tooltip
|
269
|
-
*
|
270
|
-
* @returns Calcite ComboBox component with the ids of the layers from the map
|
271
|
-
*/
|
272
|
-
_getCombobox(id) {
|
273
|
-
return (index.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()));
|
274
|
-
}
|
275
|
-
/**
|
276
|
-
* Hydrate a dropdown component with items to display the layer names
|
277
|
-
*
|
278
|
-
* @param id the id for the dropdown component used to support the tooltip
|
279
|
-
*
|
280
|
-
* @returns Array of Dropdown items with layer names
|
281
|
-
*/
|
282
|
-
_getDropdown(id) {
|
283
|
-
return (index.h("calcite-dropdown", { class: "layer-picker-dropdown", onCalciteDropdownBeforeClose: () => this._isDropdownOpen = false, onCalciteDropdownBeforeOpen: () => this._isDropdownOpen = true }, this.isMobile ? this._getDropdownButton() : this._getActionDropdownButton(id), index.h("calcite-dropdown-group", { "selection-mode": "single" }, this._getMapLayerOptions())));
|
284
|
-
}
|
285
|
-
/**
|
286
|
-
* Get the button that will open the dropdown list wrapped in an action
|
287
|
-
*
|
288
|
-
* @returns the node for the action and button
|
289
|
-
*/
|
290
|
-
_getActionDropdownButton(id) {
|
291
|
-
return (index.h("calcite-action", { id: id, slot: "trigger", text: "" }, this._getDropdownButton()));
|
292
|
-
}
|
293
|
-
/**
|
294
|
-
* Get the button that will open the dropdown list
|
295
|
-
*
|
296
|
-
* @returns the node for the button
|
297
|
-
*/
|
298
|
-
_getDropdownButton() {
|
299
|
-
const buttonClass = this.isMobile ? "" : "max-width-350";
|
300
|
-
const buttonSlot = this.isMobile ? "trigger" : "";
|
301
|
-
const buttonIcon = this._isDropdownOpen ? "chevron-up" : "chevron-down";
|
302
|
-
return (index.h("calcite-button", { alignment: "icon-end-space-between", appearance: this.appearance, class: buttonClass, iconEnd: buttonIcon, iconStart: "layers", kind: "neutral", slot: buttonSlot, width: "full" }, index.h("div", null, this.selectedName)));
|
303
|
-
}
|
304
|
-
/**
|
305
|
-
* Get the appropriate type of dom nodes for each valid layer or table
|
306
|
-
*
|
307
|
-
* @returns Array of dom nodes with the names of the layers and optionally of the tables
|
308
|
-
*/
|
309
|
-
_getMapLayerOptions() {
|
310
|
-
return this.ids.reduce((prev, cur) => {
|
311
|
-
if (this._validLayer(cur)) {
|
312
|
-
prev.push(this._getItem(cur, "layer"));
|
313
|
-
}
|
314
|
-
else if (this._validTable(cur)) {
|
315
|
-
prev.push(this._getItem(cur, "table"));
|
316
|
-
}
|
317
|
-
return prev;
|
318
|
-
}, []);
|
319
|
-
}
|
320
|
-
/**
|
321
|
-
* Get the appropriate type of dom node for the current layer or table id
|
322
|
-
*
|
323
|
-
* @returns A dom node with the name of the layer or table
|
324
|
-
*/
|
325
|
-
_getItem(id, itemType) {
|
326
|
-
const item = itemType === "layer" ? this._layerNameHash[id] : this._tableNameHash[id];
|
327
|
-
const disabled = this.onlyShowUpdatableLayers ? !item.supportsUpdate : false;
|
328
|
-
const name = item.name;
|
329
|
-
const selected = this.selectedIds.indexOf(id) > -1;
|
330
|
-
return this.type === "combobox" ? (index.h("calcite-combobox-item", { disabled: disabled, selected: selected, textLabel: name, value: id })) :
|
331
|
-
this.type === "select" ? (index.h("calcite-option", { disabled: disabled, label: name, selected: selected, value: id })) : (index.h("calcite-dropdown-group", { class: disabled ? "disabled" : "", selectionMode: disabled ? "none" : "single" }, index.h("calcite-dropdown-item", { onClick: disabled ? undefined : () => void this._setSelectedLayer(id), selected: selected }, name)));
|
332
|
-
}
|
333
|
-
/**
|
334
|
-
* Store the layer name based on the user selection
|
335
|
-
*/
|
336
|
-
_setSelectedLayer(id) {
|
337
|
-
let item;
|
338
|
-
const hasDefaultLayer = this.defaultLayerId && !this.defaultLayerHonored;
|
339
|
-
if (hasDefaultLayer) {
|
340
|
-
item = this._getLayerFromHash(this.defaultLayerId);
|
341
|
-
this.defaultLayerHonored = item !== undefined;
|
342
|
-
id = this.defaultLayerHonored ? this.defaultLayerId : id;
|
343
|
-
}
|
344
|
-
item = item ? item : this._getLayerFromHash(id);
|
345
|
-
this.selectedName = item?.name;
|
346
|
-
this.selectedIds = [id];
|
347
|
-
this.layerSelectionChange.emit(this.selectedIds);
|
348
|
-
}
|
349
|
-
/**
|
350
|
-
* Fetch layer hash info for the given id
|
351
|
-
*
|
352
|
-
* @returns ILayerHashInfo for the id
|
353
|
-
*/
|
354
|
-
_getLayerFromHash(id) {
|
355
|
-
return Object.keys(this._layerNameHash).indexOf(id) > -1 ?
|
356
|
-
this._layerNameHash[id] : Object.keys(this._tableNameHash).indexOf(id) > -1 ?
|
357
|
-
this._tableNameHash[id] : undefined;
|
358
|
-
}
|
359
|
-
/**
|
360
|
-
* Fetch the ids of the layers from the map
|
361
|
-
*
|
362
|
-
* @returns Promise when the operation has completed
|
363
|
-
*/
|
364
|
-
async _setLayers() {
|
365
|
-
if (this.mapView) {
|
366
|
-
await this._initLayerTableHash();
|
367
|
-
const layerIds = this.onlyShowUpdatableLayers ?
|
368
|
-
this._getEditableIds(this._layerNameHash) : Object.keys(this._layerNameHash);
|
369
|
-
const tableIds = this.showTables ? this.onlyShowUpdatableLayers ?
|
370
|
-
this._getEditableIds(this._tableNameHash) : Object.keys(this._tableNameHash) : [];
|
371
|
-
this.ids = [
|
372
|
-
...layerIds.reverse().filter(n => this.enabledLayerIds?.length > 0 ? this.enabledLayerIds.reverse().indexOf(n) > -1 : true),
|
373
|
-
...tableIds.reverse().filter(n => this.enabledTableIds?.length > 0 ? this.enabledTableIds.reverse().indexOf(n) > -1 : true),
|
374
|
-
];
|
375
|
-
this.idsFound.emit({
|
376
|
-
layerIds,
|
377
|
-
tableIds
|
378
|
-
});
|
379
|
-
}
|
380
|
-
}
|
381
|
-
/**
|
382
|
-
* Fetch the ids of all layers that support edits with the update capability
|
383
|
-
*
|
384
|
-
* @returns array of layer ids
|
385
|
-
*/
|
386
|
-
_getEditableIds(hash) {
|
387
|
-
return Object.keys(hash).reduce((prev, cur) => {
|
388
|
-
if (hash[cur].supportsUpdate) {
|
389
|
-
prev.push(cur);
|
390
|
-
}
|
391
|
-
return prev;
|
392
|
-
}, []);
|
393
|
-
}
|
394
|
-
/**
|
395
|
-
* Create a layer id:title hash for layer name display
|
396
|
-
*
|
397
|
-
* @returns Promise when the operation has completed
|
398
|
-
*/
|
399
|
-
async _initLayerTableHash() {
|
400
|
-
this._layerNameHash = await mapViewUtils.getMapLayerHash(this.mapView, this.onlyShowUpdatableLayers);
|
401
|
-
this._tableNameHash = this.showTables ? await mapViewUtils.getMapTableHash(this.mapView, this.onlyShowUpdatableLayers) : {};
|
402
|
-
}
|
403
|
-
/**
|
404
|
-
* Evaluate if the id exists in the current hash and verify if it should be excluded
|
405
|
-
*
|
406
|
-
* @returns boolean when true the layer will be used in the current layer picker type
|
407
|
-
*/
|
408
|
-
_validLayer(id) {
|
409
|
-
const name = this._layerNameHash[id]?.name;
|
410
|
-
return name && Object.keys(publicNotificationStore.state.managedLayers).indexOf(name) < 0 && (this.enabledLayerIds.length > 0 ?
|
411
|
-
this.enabledLayerIds.indexOf(id) > -1 : true);
|
412
|
-
}
|
413
|
-
/**
|
414
|
-
* Evaluate if the id exists in the current hash and verify if it should be excluded
|
415
|
-
*
|
416
|
-
* @returns boolean when true the table will be used in the current layer picker type
|
417
|
-
*/
|
418
|
-
_validTable(id) {
|
419
|
-
const name = this._tableNameHash[id]?.name;
|
420
|
-
const validName = name && this.showTables;
|
421
|
-
return validName ? publicNotificationStore.state.managedTables.indexOf(name) < 0 &&
|
422
|
-
(this.enabledTableIds.length > 0 ? this.enabledTableIds.indexOf(id) > -1 : true) : validName;
|
423
|
-
}
|
424
|
-
/**
|
425
|
-
* Fetch the ids of the layers from the map
|
426
|
-
*
|
427
|
-
* @returns Promise when the operation has completed
|
428
|
-
*/
|
429
|
-
_layerSelectionChange() {
|
430
|
-
const ids = Array.isArray(this._layerElement.value) ? this._layerElement.value : [this._layerElement.value];
|
431
|
-
if (JSON.stringify(ids) !== JSON.stringify([""])) {
|
432
|
-
this.selectedIds = ids;
|
433
|
-
this.layerSelectionChange.emit(this.selectedIds);
|
434
|
-
}
|
435
|
-
}
|
436
|
-
/**
|
437
|
-
* Fetches the component's translations
|
438
|
-
*
|
439
|
-
* @returns Promise when complete
|
440
|
-
* @protected
|
441
|
-
*/
|
442
|
-
async _getTranslations() {
|
443
|
-
const messages = await locale.getLocaleComponentStrings(this.el);
|
444
|
-
this._translations = messages[0];
|
445
|
-
}
|
446
|
-
static get watchers() { return {
|
447
|
-
"mapView": ["mapViewWatchHandler"]
|
448
|
-
}; }
|
449
|
-
};
|
450
|
-
MapLayerPicker.style = MapLayerPickerStyle0;
|
451
|
-
|
452
|
-
exports.calcite_dropdown_group = DropdownGroup;
|
453
|
-
exports.map_layer_picker = MapLayerPicker;
|