@esri/solutions-components 0.8.8 → 0.8.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/t9n/crowdsource-reporter/resources.json +3 -1
- package/dist/assets/t9n/crowdsource-reporter/resources_en.json +3 -1
- package/dist/cjs/{calcite-action-menu_2.cjs.entry.js → calcite-action-menu_3.cjs.entry.js} +114 -7
- package/dist/cjs/calcite-alert_4.cjs.entry.js +46 -5
- package/dist/cjs/{calcite-input-date-picker_3.cjs.entry.js → calcite-block_5.cjs.entry.js} +691 -13
- package/dist/cjs/{calcite-combobox_5.cjs.entry.js → calcite-combobox_3.cjs.entry.js} +876 -844
- package/dist/cjs/calcite-dropdown_4.cjs.entry.js +1023 -0
- package/dist/cjs/{calcite-flow_5.cjs.entry.js → calcite-flow_6.cjs.entry.js} +327 -2
- package/dist/cjs/card-manager_3.cjs.entry.js +5 -5
- package/dist/cjs/crowdsource-manager.cjs.entry.js +1 -1
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +122 -21
- package/dist/cjs/{downloadUtils-8b05d7cc.js → downloadUtils-dc349b1a.js} +2 -2
- package/dist/cjs/{index.es-e7587227.js → index.es-1830a1e6.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +8 -8
- package/dist/cjs/{mapViewUtils-3e0fa457.js → mapViewUtils-9dc05308.js} +11 -5
- package/dist/cjs/public-notification.cjs.entry.js +2 -2
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/create-feature/create-feature.js +18 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +16 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +155 -35
- package/dist/collection/components/feature-details/feature-details.css +18 -0
- package/dist/collection/components/feature-details/feature-details.js +500 -0
- package/dist/collection/components/feature-details/test/feature-details.e2e.js +14 -0
- package/dist/collection/components/feature-details/test/feature-details.spec.js +22 -0
- package/dist/collection/components/feature-list/feature-list.js +14 -1
- package/dist/collection/components/info-card/info-card.css +15 -5
- package/dist/collection/components/info-card/info-card.js +178 -5
- package/dist/collection/components/layer-table/layer-table.js +2 -2
- package/dist/collection/components/map-card/map-card.js +1 -1
- package/dist/collection/components/map-select-tools/map-select-tools.js +5 -5
- package/dist/collection/components/refine-selection/refine-selection.js +1 -1
- package/dist/collection/demos/crowdsource-reporter.html +115 -1
- package/dist/collection/utils/mapViewUtils.js +11 -5
- package/dist/collection/utils/mapViewUtils.ts +13 -5
- package/dist/components/create-feature2.js +4 -0
- package/dist/components/crowdsource-reporter.js +270 -81
- package/dist/components/feature-details.d.ts +11 -0
- package/dist/components/feature-details.js +11 -0
- package/dist/components/feature-details2.js +449 -0
- package/dist/components/feature-list2.js +14 -1
- package/dist/components/info-card2.js +53 -5
- package/dist/components/layer-table2.js +2 -2
- package/dist/components/map-card2.js +1 -1
- package/dist/components/map-select-tools2.js +5 -5
- package/dist/components/mapViewUtils.js +11 -5
- package/dist/components/refine-selection2.js +1 -1
- package/dist/esm/{calcite-action-menu_2.entry.js → calcite-action-menu_3.entry.js} +118 -12
- package/dist/esm/calcite-alert_4.entry.js +46 -5
- package/dist/esm/{calcite-input-date-picker_3.entry.js → calcite-block_5.entry.js} +688 -12
- package/dist/esm/{calcite-combobox_5.entry.js → calcite-combobox_3.entry.js} +878 -844
- package/dist/esm/calcite-date-picker-day_3.entry.js +1 -1
- package/dist/esm/calcite-dropdown_4.entry.js +1016 -0
- package/dist/esm/{calcite-flow_5.entry.js → calcite-flow_6.entry.js} +327 -3
- package/dist/esm/card-manager_3.entry.js +5 -5
- package/dist/esm/crowdsource-manager.entry.js +1 -1
- package/dist/esm/crowdsource-reporter.entry.js +122 -21
- package/dist/esm/{date-5630530d.js → date-0c026a8b.js} +1 -1
- package/dist/esm/{downloadUtils-0c1e4d7b.js → downloadUtils-df4f21f6.js} +2 -2
- package/dist/esm/{index.es-286e3cfa.js → index.es-904fb846.js} +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +8 -8
- package/dist/esm/{mapViewUtils-253178f1.js → mapViewUtils-2ec19fb0.js} +11 -5
- package/dist/esm/public-notification.entry.js +2 -2
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +115 -1
- package/dist/solutions-components/{p-813fd8a4.entry.js → p-29f518fd.entry.js} +2 -2
- package/dist/solutions-components/{p-13ca3b00.entry.js → p-452fd697.entry.js} +1 -1
- package/dist/solutions-components/p-511b1c91.entry.js +23 -0
- package/dist/solutions-components/p-577efb16.js +36 -0
- package/dist/solutions-components/{p-94de9279.js → p-5817d78c.js} +1 -1
- package/dist/solutions-components/p-602cd811.entry.js +17 -0
- package/dist/solutions-components/{p-15f9624a.entry.js → p-6557b703.entry.js} +1 -1
- package/dist/solutions-components/p-7269c49b.entry.js +6 -0
- package/dist/solutions-components/p-760bd17e.entry.js +6 -0
- package/dist/solutions-components/p-95fea07a.entry.js +17 -0
- package/dist/solutions-components/{p-212b02e7.js → p-ae4d86e8.js} +1 -1
- package/dist/solutions-components/{p-038fcd93.entry.js → p-c273ab7a.entry.js} +1 -1
- package/dist/solutions-components/p-d742b915.entry.js +29 -0
- package/dist/solutions-components/p-dfad61a8.entry.js +24 -0
- package/dist/solutions-components/{p-331b5d1e.js → p-fca434c8.js} +2 -2
- package/dist/solutions-components/p-fd82a00f.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/mapViewUtils.ts +13 -5
- package/dist/types/components/create-feature/create-feature.d.ts +4 -4
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +91 -10
- package/dist/types/components/feature-details/feature-details.d.ts +151 -0
- package/dist/types/components/feature-list/feature-list.d.ts +6 -0
- package/dist/types/components/info-card/info-card.d.ts +33 -1
- package/dist/types/components.d.ts +129 -12
- package/dist/types/preact.d.ts +6 -1
- package/dist/types/utils/mapViewUtils.d.ts +5 -3
- package/package.json +1 -1
- package/dist/cjs/calcite-block_2.cjs.entry.js +0 -652
- package/dist/cjs/calcite-graph_2.cjs.entry.js +0 -1055
- package/dist/cjs/calcite-scrim.cjs.entry.js +0 -125
- package/dist/cjs/utils-7bc7f595.js +0 -64
- package/dist/esm/calcite-block_2.entry.js +0 -647
- package/dist/esm/calcite-graph_2.entry.js +0 -1050
- package/dist/esm/calcite-scrim.entry.js +0 -121
- package/dist/esm/utils-9fb4104a.js +0 -61
- package/dist/solutions-components/p-04c37d69.entry.js +0 -17
- package/dist/solutions-components/p-0b92e4b1.entry.js +0 -11
- package/dist/solutions-components/p-238d3b5f.entry.js +0 -6
- package/dist/solutions-components/p-3af79063.js +0 -36
- package/dist/solutions-components/p-80b11ec1.entry.js +0 -17
- package/dist/solutions-components/p-a3a11749.entry.js +0 -6
- package/dist/solutions-components/p-aec06ce4.entry.js +0 -18
- package/dist/solutions-components/p-bfdf89c2.js +0 -11
- package/dist/solutions-components/p-c4ff3b52.entry.js +0 -17
- package/dist/solutions-components/p-ced067bd.entry.js +0 -17
- package/dist/solutions-components/p-d136eab0.entry.js +0 -23
- package/dist/solutions-components/p-e0446d5b.entry.js +0 -6
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface FeatureDetails extends Components.FeatureDetails, HTMLElement {}
|
4
|
+
export const FeatureDetails: {
|
5
|
+
prototype: FeatureDetails;
|
6
|
+
new (): FeatureDetails;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* Used to define this component and all nested components recursively.
|
10
|
+
*/
|
11
|
+
export const defineCustomElement: () => void;
|
@@ -0,0 +1,11 @@
|
|
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 { F as FeatureDetails$1, d as defineCustomElement$1 } from './feature-details2.js';
|
7
|
+
|
8
|
+
const FeatureDetails = FeatureDetails$1;
|
9
|
+
const defineCustomElement = defineCustomElement$1;
|
10
|
+
|
11
|
+
export { FeatureDetails, defineCustomElement };
|
@@ -0,0 +1,449 @@
|
|
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 { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
7
|
+
import { l as loadModules } from './loadModules.js';
|
8
|
+
import { d as defineCustomElement$h } from './action.js';
|
9
|
+
import { d as defineCustomElement$g } from './action-menu.js';
|
10
|
+
import { d as defineCustomElement$f } from './alert.js';
|
11
|
+
import { d as defineCustomElement$e } from './button.js';
|
12
|
+
import { d as defineCustomElement$d } from './chip.js';
|
13
|
+
import { d as defineCustomElement$c } from './icon.js';
|
14
|
+
import { d as defineCustomElement$b } from './loader.js';
|
15
|
+
import { d as defineCustomElement$a } from './modal.js';
|
16
|
+
import { d as defineCustomElement$9 } from './notice.js';
|
17
|
+
import { d as defineCustomElement$8 } from './panel.js';
|
18
|
+
import { d as defineCustomElement$7 } from './popover.js';
|
19
|
+
import { d as defineCustomElement$6 } from './scrim.js';
|
20
|
+
import { d as defineCustomElement$5 } from './shell.js';
|
21
|
+
import { d as defineCustomElement$4 } from './tooltip.js';
|
22
|
+
import { d as defineCustomElement$3 } from './delete-button2.js';
|
23
|
+
import { d as defineCustomElement$2 } from './edit-card2.js';
|
24
|
+
import { d as defineCustomElement$1 } from './info-card2.js';
|
25
|
+
|
26
|
+
const featureDetailsCss = ":host{display:block}.buttons{align-items:center;background-color:white;display:flex;padding:10px 0 10px 15px;border-block-start:1px solid var(--calcite-color-border-3);border-block-end:1px solid var(--calcite-color-border-3)}.comment-btn{display:flex;gap:5px;width:35px}";
|
27
|
+
|
28
|
+
const FeatureDetails = /*@__PURE__*/ proxyCustomElement(class FeatureDetails extends HTMLElement {
|
29
|
+
constructor() {
|
30
|
+
super();
|
31
|
+
this.__registerHost();
|
32
|
+
this.loadingStatus = createEvent(this, "loadingStatus", 7);
|
33
|
+
/**
|
34
|
+
* string[]: Valid field types for like and dislike
|
35
|
+
*/
|
36
|
+
this._validFieldTypes = ["small-integer", "integer", "big-integer", "single", "long"];
|
37
|
+
this.mapView = undefined;
|
38
|
+
this.graphics = undefined;
|
39
|
+
this.reportingOptions = undefined;
|
40
|
+
this._likeFieldAvailable = false;
|
41
|
+
this._likeCount = 0;
|
42
|
+
this._disLikeCount = 0;
|
43
|
+
this._dislikeFieldAvailable = false;
|
44
|
+
this._isLikeBtnClicked = false;
|
45
|
+
this._isDislikeBtnClicked = false;
|
46
|
+
}
|
47
|
+
//--------------------------------------------------------------------------
|
48
|
+
//
|
49
|
+
// Watch handlers
|
50
|
+
//
|
51
|
+
//--------------------------------------------------------------------------
|
52
|
+
/**
|
53
|
+
* Called each time the graphics prop is changed
|
54
|
+
*/
|
55
|
+
async graphicsWatchHandler() {
|
56
|
+
await this.getCompleteGraphic(this.graphics[0]);
|
57
|
+
this.checkLikeDislikeFields();
|
58
|
+
}
|
59
|
+
//--------------------------------------------------------------------------
|
60
|
+
//
|
61
|
+
// Methods (public)
|
62
|
+
/**
|
63
|
+
* Refresh the features comments which will fetch like, dislike and update the component
|
64
|
+
* @returns Promise that resolves when the operation is complete
|
65
|
+
*/
|
66
|
+
async refresh(graphic) {
|
67
|
+
if (this.isLikeDislikeConfigured(graphic.layer)) {
|
68
|
+
// in case of multiple features selected fetch complete feature and update like dislike for current feature
|
69
|
+
if (graphic && this.graphics.length > 1) {
|
70
|
+
await this.getCompleteGraphic(graphic);
|
71
|
+
this.checkLikeDislikeFields();
|
72
|
+
}
|
73
|
+
}
|
74
|
+
else {
|
75
|
+
this._likeFieldAvailable = false;
|
76
|
+
this._dislikeFieldAvailable = false;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
/**
|
80
|
+
* Go to the previous feature in the features widget
|
81
|
+
*/
|
82
|
+
async back() {
|
83
|
+
void this._infoCard.back();
|
84
|
+
}
|
85
|
+
/**
|
86
|
+
* Go to the next feature in the features widget
|
87
|
+
*/
|
88
|
+
async next() {
|
89
|
+
void this._infoCard.next();
|
90
|
+
}
|
91
|
+
/**
|
92
|
+
* Toggle the visibility of the features list view
|
93
|
+
*/
|
94
|
+
async toggleListView() {
|
95
|
+
void this._infoCard.toggleListView();
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
99
|
+
*
|
100
|
+
* @returns Promise when complete
|
101
|
+
*/
|
102
|
+
async componentWillLoad() {
|
103
|
+
await this._initModules();
|
104
|
+
await this.getCompleteGraphic(this.graphics[0]);
|
105
|
+
this.checkLikeDislikeFields();
|
106
|
+
}
|
107
|
+
render() {
|
108
|
+
var _a, _b, _c, _d;
|
109
|
+
return (h("calcite-panel", { "full-height": true }, h("info-card", { allowEditing: false, graphics: this.graphics, highlightEnabled: false, isLoading: false, isMobile: false, mapView: this.mapView, paginationEnabled: false, position: "relative", ref: el => this._infoCard = el, zoomAndScrollToSelected: true }), (this._likeFieldAvailable || this._dislikeFieldAvailable) &&
|
110
|
+
h("div", { class: 'buttons' }, this._likeFieldAvailable &&
|
111
|
+
h("calcite-button", { appearance: "transparent", iconEnd: "thumbs-up", kind: this._isLikeBtnClicked ? "brand" : "neutral", onClick: this.onLikeButtonClick.bind(this), scale: 's' }, (_b = (_a = this._likeCount) !== null && _a !== void 0 ? _a : this._selectedGraphic.attributes[this._likeField]) !== null && _b !== void 0 ? _b : 0), this._dislikeFieldAvailable &&
|
112
|
+
h("calcite-button", { appearance: "transparent", iconEnd: "thumbs-down", kind: this._isDislikeBtnClicked ? "brand" : "neutral", onClick: this.onDislikeButtonClick.bind(this), scale: 's' }, (_d = (_c = this._disLikeCount) !== null && _c !== void 0 ? _c : this._selectedGraphic.attributes[this._dislikeField]) !== null && _d !== void 0 ? _d : 0))));
|
113
|
+
}
|
114
|
+
/**
|
115
|
+
* Load esri javascript api modules
|
116
|
+
*
|
117
|
+
* @returns Promise resolving when function is done
|
118
|
+
*
|
119
|
+
* @protected
|
120
|
+
*/
|
121
|
+
async _initModules() {
|
122
|
+
const [Graphic] = await loadModules([
|
123
|
+
"esri/Graphic"
|
124
|
+
]);
|
125
|
+
this.Graphic = Graphic;
|
126
|
+
}
|
127
|
+
/**
|
128
|
+
* Get complete graphic with complete attributes
|
129
|
+
* @param graphic selected feature graphic
|
130
|
+
* @protected
|
131
|
+
*/
|
132
|
+
async getCompleteGraphic(graphic) {
|
133
|
+
const layer = graphic.layer;
|
134
|
+
const query = layer.createQuery();
|
135
|
+
query.objectIds = [graphic.getObjectId()];
|
136
|
+
const completeGraphic = await layer.queryFeatures(query);
|
137
|
+
this._selectedGraphic = completeGraphic.features[0];
|
138
|
+
}
|
139
|
+
/**
|
140
|
+
* Checks if the layers is configured for like dislike or not
|
141
|
+
* @param selectedLayer Feature layer
|
142
|
+
* @returns boolean
|
143
|
+
* @protected
|
144
|
+
*/
|
145
|
+
isLikeDislikeConfigured(selectedLayer) {
|
146
|
+
let likeFieldAvailable = false;
|
147
|
+
let dislikeFieldAvailable = false;
|
148
|
+
// check if reporting options are configured for the current selected feature's layer
|
149
|
+
if (this.reportingOptions && this.reportingOptions[selectedLayer.id]) {
|
150
|
+
//return false if both like and dislike are disabled for the layer
|
151
|
+
if (!this.reportingOptions[selectedLayer.id].like && !this.reportingOptions[selectedLayer.id].dislike) {
|
152
|
+
return false;
|
153
|
+
}
|
154
|
+
const likeField = this.reportingOptions[selectedLayer.id].likeField;
|
155
|
+
const dislikeField = this.reportingOptions[selectedLayer.id].dislikeField;
|
156
|
+
//if both fields are not configured return false
|
157
|
+
if (!likeField && !dislikeField) {
|
158
|
+
return false;
|
159
|
+
}
|
160
|
+
selectedLayer.fields.forEach((eachField) => {
|
161
|
+
if (this._validFieldTypes.indexOf(eachField.type) > -1) {
|
162
|
+
if (eachField.name === likeField && this.reportingOptions[selectedLayer.id].like) {
|
163
|
+
likeFieldAvailable = true;
|
164
|
+
}
|
165
|
+
else if (eachField.name === dislikeField && this.reportingOptions[selectedLayer.id].dislike) {
|
166
|
+
dislikeFieldAvailable = true;
|
167
|
+
}
|
168
|
+
}
|
169
|
+
});
|
170
|
+
}
|
171
|
+
return likeFieldAvailable || dislikeFieldAvailable;
|
172
|
+
}
|
173
|
+
/**
|
174
|
+
* Check if configured like or dislike fields are available in the selected layer
|
175
|
+
* @protected
|
176
|
+
*/
|
177
|
+
checkLikeDislikeFields() {
|
178
|
+
this._likeFieldAvailable = false;
|
179
|
+
this._dislikeFieldAvailable = false;
|
180
|
+
this._isLikeBtnClicked = false;
|
181
|
+
this._isDislikeBtnClicked = false;
|
182
|
+
this._likeCount = 0;
|
183
|
+
this._disLikeCount = 0;
|
184
|
+
const selectedLayer = this._selectedGraphic.layer;
|
185
|
+
// check if reporting options are configured for the current selected feature's layer
|
186
|
+
if (this.reportingOptions && this.reportingOptions[selectedLayer.id]) {
|
187
|
+
this._likeField = this.reportingOptions[selectedLayer.id].likeField;
|
188
|
+
this._dislikeField = this.reportingOptions[selectedLayer.id].dislikeField;
|
189
|
+
//if both fields are not found return
|
190
|
+
if (!this._likeField && !this._dislikeField) {
|
191
|
+
return;
|
192
|
+
}
|
193
|
+
//Check if selected layer have the configured like and dislike fields
|
194
|
+
//also, get the current value for like and dislike field from the attributes
|
195
|
+
selectedLayer.fields.forEach((eachField) => {
|
196
|
+
if (this._validFieldTypes.indexOf(eachField.type) > -1) {
|
197
|
+
if (eachField.name === this._likeField && this.reportingOptions[this._selectedGraphic.layer.id].like) {
|
198
|
+
this._likeFieldAvailable = true;
|
199
|
+
this._likeCount = this._selectedGraphic.attributes[eachField.name];
|
200
|
+
}
|
201
|
+
else if (eachField.name === this._dislikeField && this.reportingOptions[this._selectedGraphic.layer.id].dislike) {
|
202
|
+
this._dislikeFieldAvailable = true;
|
203
|
+
this._disLikeCount = this._selectedGraphic.attributes[eachField.name];
|
204
|
+
}
|
205
|
+
}
|
206
|
+
});
|
207
|
+
this.getFromLocalStorage();
|
208
|
+
}
|
209
|
+
}
|
210
|
+
/**
|
211
|
+
* On like button click highlight the like button and update the feature
|
212
|
+
* @protected
|
213
|
+
*/
|
214
|
+
onLikeButtonClick() {
|
215
|
+
this.loadingStatus.emit(true);
|
216
|
+
if (this._isDislikeBtnClicked && this.reportingOptions[this._selectedGraphic.layer.id].dislike) {
|
217
|
+
this.onDislikeButtonClick();
|
218
|
+
}
|
219
|
+
this._isLikeBtnClicked = !this._isLikeBtnClicked;
|
220
|
+
if (this._isLikeBtnClicked) {
|
221
|
+
this._likeCount++;
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
this._likeCount--;
|
225
|
+
}
|
226
|
+
void this.updateFeaturesLikeDislikeField(this._likeField, this._isLikeBtnClicked);
|
227
|
+
}
|
228
|
+
/**
|
229
|
+
* On dislike button click highlight the dislike button and update the feature
|
230
|
+
* @protected
|
231
|
+
*/
|
232
|
+
onDislikeButtonClick() {
|
233
|
+
this.loadingStatus.emit(true);
|
234
|
+
if (this._isLikeBtnClicked && this.reportingOptions[this._selectedGraphic.layer.id].like) {
|
235
|
+
this.onLikeButtonClick();
|
236
|
+
}
|
237
|
+
this._isDislikeBtnClicked = !this._isDislikeBtnClicked;
|
238
|
+
if (this._isDislikeBtnClicked) {
|
239
|
+
this._disLikeCount++;
|
240
|
+
}
|
241
|
+
else {
|
242
|
+
this._disLikeCount--;
|
243
|
+
}
|
244
|
+
void this.updateFeaturesLikeDislikeField(this._dislikeField, this._isDislikeBtnClicked);
|
245
|
+
}
|
246
|
+
/**
|
247
|
+
* Update the feature if user click on like or dislike button
|
248
|
+
* @param fieldName field name of the feature for like or dislike attribute
|
249
|
+
* @param buttonClicked is like or dislike button clicked
|
250
|
+
* @protected
|
251
|
+
*/
|
252
|
+
async updateFeaturesLikeDislikeField(fieldName, buttonClicked) {
|
253
|
+
const attributesToUpdate = {};
|
254
|
+
const selectedLayer = this._selectedGraphic.layer;
|
255
|
+
//Increment the value if button is clicked or else decrement it
|
256
|
+
const selectFeatureAttr = this._selectedGraphic;
|
257
|
+
if (buttonClicked) {
|
258
|
+
selectFeatureAttr.attributes[fieldName] = Number(selectFeatureAttr.attributes[fieldName]) + 1;
|
259
|
+
}
|
260
|
+
else {
|
261
|
+
selectFeatureAttr.attributes[fieldName] = Number(selectFeatureAttr.attributes[fieldName]) - 1;
|
262
|
+
}
|
263
|
+
//use the oid and like/dislike field value to update
|
264
|
+
attributesToUpdate[selectedLayer.objectIdField] = selectFeatureAttr.attributes[selectedLayer.objectIdField];
|
265
|
+
attributesToUpdate[fieldName] = selectFeatureAttr.attributes[fieldName];
|
266
|
+
const newGraphicInstance = new this.Graphic();
|
267
|
+
newGraphicInstance.attributes = attributesToUpdate;
|
268
|
+
// Update the feature attribute in the feature layer
|
269
|
+
const param = { updateFeatures: [newGraphicInstance] };
|
270
|
+
await selectedLayer.applyEdits(param).then(() => {
|
271
|
+
this._selectedGraphic = selectFeatureAttr;
|
272
|
+
//update the current graphics in info card so that, the updated values are reflected in popup content
|
273
|
+
if (this._infoCard) {
|
274
|
+
void this._infoCard.updateCurrentGraphic(this._selectedGraphic);
|
275
|
+
}
|
276
|
+
//store the like dislike value for the current selected graphic in local storage
|
277
|
+
this.setInLocalStorage();
|
278
|
+
this.loadingStatus.emit(false);
|
279
|
+
}, (err) => {
|
280
|
+
this.loadingStatus.emit(false);
|
281
|
+
console.log(err);
|
282
|
+
});
|
283
|
+
}
|
284
|
+
/**
|
285
|
+
* Gets the like/dislike information form local storage and updates the like and dislike button states
|
286
|
+
* @protected
|
287
|
+
*/
|
288
|
+
getFromLocalStorage() {
|
289
|
+
const uniqueLayerId = this._selectedGraphic.layer.id;
|
290
|
+
//get the data from local storage and check current feature is liked or disliked
|
291
|
+
const localStorageUser = localStorage[uniqueLayerId];
|
292
|
+
if (localStorageUser) {
|
293
|
+
const parseArr = JSON.parse(localStorageUser);
|
294
|
+
const res = parseArr.filter((arr) => arr.id === this._selectedGraphic.getObjectId());
|
295
|
+
if (res.length > 0) {
|
296
|
+
this._isLikeBtnClicked = res[0].like;
|
297
|
+
this._isDislikeBtnClicked = res[0].dislike;
|
298
|
+
}
|
299
|
+
}
|
300
|
+
}
|
301
|
+
/**
|
302
|
+
* Sets the like/dislike information for the current selected graphic in local storage
|
303
|
+
* @protected
|
304
|
+
*/
|
305
|
+
setInLocalStorage() {
|
306
|
+
const uniqueLayerId = this._selectedGraphic.layer.id;
|
307
|
+
const localStorageInfo = localStorage[uniqueLayerId];
|
308
|
+
let information = [];
|
309
|
+
//if information for the current layer found in local storage update it
|
310
|
+
//else add new information for the current layer in the local storage
|
311
|
+
if (localStorageInfo) {
|
312
|
+
information = JSON.parse(localStorageInfo);
|
313
|
+
const index = information.findIndex((arr) => arr.id === this._selectedGraphic.getObjectId());
|
314
|
+
//if information for current objectid found delete it, so that we always have info for each oid in a layer only once
|
315
|
+
if (index >= 0) {
|
316
|
+
information.splice(index, 1);
|
317
|
+
}
|
318
|
+
}
|
319
|
+
//add the information for current selected graphic
|
320
|
+
information.push({
|
321
|
+
id: this._selectedGraphic.getObjectId(),
|
322
|
+
like: this._isLikeBtnClicked && this._likeCount !== 0,
|
323
|
+
dislike: this._isDislikeBtnClicked && this._disLikeCount !== 0
|
324
|
+
});
|
325
|
+
localStorage.setItem(uniqueLayerId, JSON.stringify(information));
|
326
|
+
}
|
327
|
+
get el() { return this; }
|
328
|
+
static get watchers() { return {
|
329
|
+
"graphics": ["graphicsWatchHandler"]
|
330
|
+
}; }
|
331
|
+
static get style() { return featureDetailsCss; }
|
332
|
+
}, [0, "feature-details", {
|
333
|
+
"mapView": [16],
|
334
|
+
"graphics": [16],
|
335
|
+
"reportingOptions": [16],
|
336
|
+
"_likeFieldAvailable": [32],
|
337
|
+
"_likeCount": [32],
|
338
|
+
"_disLikeCount": [32],
|
339
|
+
"_dislikeFieldAvailable": [32],
|
340
|
+
"_isLikeBtnClicked": [32],
|
341
|
+
"_isDislikeBtnClicked": [32],
|
342
|
+
"refresh": [64],
|
343
|
+
"back": [64],
|
344
|
+
"next": [64],
|
345
|
+
"toggleListView": [64]
|
346
|
+
}, undefined, {
|
347
|
+
"graphics": ["graphicsWatchHandler"]
|
348
|
+
}]);
|
349
|
+
function defineCustomElement() {
|
350
|
+
if (typeof customElements === "undefined") {
|
351
|
+
return;
|
352
|
+
}
|
353
|
+
const components = ["feature-details", "calcite-action", "calcite-action-menu", "calcite-alert", "calcite-button", "calcite-chip", "calcite-icon", "calcite-loader", "calcite-modal", "calcite-notice", "calcite-panel", "calcite-popover", "calcite-scrim", "calcite-shell", "calcite-tooltip", "delete-button", "edit-card", "info-card"];
|
354
|
+
components.forEach(tagName => { switch (tagName) {
|
355
|
+
case "feature-details":
|
356
|
+
if (!customElements.get(tagName)) {
|
357
|
+
customElements.define(tagName, FeatureDetails);
|
358
|
+
}
|
359
|
+
break;
|
360
|
+
case "calcite-action":
|
361
|
+
if (!customElements.get(tagName)) {
|
362
|
+
defineCustomElement$h();
|
363
|
+
}
|
364
|
+
break;
|
365
|
+
case "calcite-action-menu":
|
366
|
+
if (!customElements.get(tagName)) {
|
367
|
+
defineCustomElement$g();
|
368
|
+
}
|
369
|
+
break;
|
370
|
+
case "calcite-alert":
|
371
|
+
if (!customElements.get(tagName)) {
|
372
|
+
defineCustomElement$f();
|
373
|
+
}
|
374
|
+
break;
|
375
|
+
case "calcite-button":
|
376
|
+
if (!customElements.get(tagName)) {
|
377
|
+
defineCustomElement$e();
|
378
|
+
}
|
379
|
+
break;
|
380
|
+
case "calcite-chip":
|
381
|
+
if (!customElements.get(tagName)) {
|
382
|
+
defineCustomElement$d();
|
383
|
+
}
|
384
|
+
break;
|
385
|
+
case "calcite-icon":
|
386
|
+
if (!customElements.get(tagName)) {
|
387
|
+
defineCustomElement$c();
|
388
|
+
}
|
389
|
+
break;
|
390
|
+
case "calcite-loader":
|
391
|
+
if (!customElements.get(tagName)) {
|
392
|
+
defineCustomElement$b();
|
393
|
+
}
|
394
|
+
break;
|
395
|
+
case "calcite-modal":
|
396
|
+
if (!customElements.get(tagName)) {
|
397
|
+
defineCustomElement$a();
|
398
|
+
}
|
399
|
+
break;
|
400
|
+
case "calcite-notice":
|
401
|
+
if (!customElements.get(tagName)) {
|
402
|
+
defineCustomElement$9();
|
403
|
+
}
|
404
|
+
break;
|
405
|
+
case "calcite-panel":
|
406
|
+
if (!customElements.get(tagName)) {
|
407
|
+
defineCustomElement$8();
|
408
|
+
}
|
409
|
+
break;
|
410
|
+
case "calcite-popover":
|
411
|
+
if (!customElements.get(tagName)) {
|
412
|
+
defineCustomElement$7();
|
413
|
+
}
|
414
|
+
break;
|
415
|
+
case "calcite-scrim":
|
416
|
+
if (!customElements.get(tagName)) {
|
417
|
+
defineCustomElement$6();
|
418
|
+
}
|
419
|
+
break;
|
420
|
+
case "calcite-shell":
|
421
|
+
if (!customElements.get(tagName)) {
|
422
|
+
defineCustomElement$5();
|
423
|
+
}
|
424
|
+
break;
|
425
|
+
case "calcite-tooltip":
|
426
|
+
if (!customElements.get(tagName)) {
|
427
|
+
defineCustomElement$4();
|
428
|
+
}
|
429
|
+
break;
|
430
|
+
case "delete-button":
|
431
|
+
if (!customElements.get(tagName)) {
|
432
|
+
defineCustomElement$3();
|
433
|
+
}
|
434
|
+
break;
|
435
|
+
case "edit-card":
|
436
|
+
if (!customElements.get(tagName)) {
|
437
|
+
defineCustomElement$2();
|
438
|
+
}
|
439
|
+
break;
|
440
|
+
case "info-card":
|
441
|
+
if (!customElements.get(tagName)) {
|
442
|
+
defineCustomElement$1();
|
443
|
+
}
|
444
|
+
break;
|
445
|
+
} });
|
446
|
+
}
|
447
|
+
defineCustomElement();
|
448
|
+
|
449
|
+
export { FeatureDetails as F, defineCustomElement as d };
|
@@ -155,7 +155,20 @@ const FeatureList = /*@__PURE__*/ proxyCustomElement(class FeatureList extends H
|
|
155
155
|
const selectedLayerView = await getFeatureLayerView(this.mapView, this.selectedLayerId);
|
156
156
|
this._highlightHandle = await highlightFeatures([selectedFeatureObjectId], selectedLayerView, this.mapView, true);
|
157
157
|
}
|
158
|
-
this.
|
158
|
+
await this.emitSelectedFeature(selectedFeature);
|
159
|
+
}
|
160
|
+
/**
|
161
|
+
* Emit selected feature with its complete graphics and attributes
|
162
|
+
* @param graphic selected feature graphic
|
163
|
+
* @protected
|
164
|
+
*/
|
165
|
+
async emitSelectedFeature(graphic) {
|
166
|
+
const layer = graphic.layer;
|
167
|
+
const query = layer.createQuery();
|
168
|
+
query.returnGeometry = true;
|
169
|
+
query.objectIds = [graphic.getObjectId()];
|
170
|
+
const completeGraphic = await layer.queryFeatures(query);
|
171
|
+
this.featureSelect.emit(completeGraphic.features[0]);
|
159
172
|
}
|
160
173
|
/**
|
161
174
|
* On feature hover in feature list highlight the feature on the map
|
@@ -24,7 +24,7 @@ import { d as defineCustomElement$3 } from './tooltip.js';
|
|
24
24
|
import { d as defineCustomElement$2 } from './delete-button2.js';
|
25
25
|
import { d as defineCustomElement$1 } from './edit-card2.js';
|
26
26
|
|
27
|
-
const infoCardCss = ":host{display:block;--calcite-label-margin-bottom:0}.padding-1-2{padding:0.5rem}.display-none{display:none !important}.display-flex{display:flex}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}.feature-node .esri-features__footer{display:none !important}.button-container{justify-content:
|
27
|
+
const infoCardCss = ":host{display:block;--calcite-label-margin-bottom:0}.padding-1-2{padding:0.5rem}.display-none{display:none !important}.display-flex{display:flex}.position-absolute{position:absolute;top:0;right:0;bottom:0;left:0;overflow:auto}.feature-node{position:relative !important}.feature-node .esri-features__footer{display:none !important}.button-container{justify-content:center;align-items:center}.top-border{border-top:1px solid var(--calcite-color-border-1)}.width-100{width:100%}.esri-features__container{padding:0.5rem !important;background-color:var(--calcite-color-foreground-1) !important;height:100% !important}.overflow-hidden{overflow:hidden}.height-40{height:40px}.end-border{border-inline-end:1px solid var(--calcite-color-border-1)}.font-bold{font-weight:bold}.visibility-hidden{visibility:hidden;height:0px}.padding-inline-start-1{padding-inline-start:1rem}.border-width-0{border-width:0px}.pagination-action{position:relative;left:3px}.pagination-count{color:var(--calcite-color-brand);border-bottom:1px solid var(--calcite-color-brand)}";
|
28
28
|
|
29
29
|
const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLElement {
|
30
30
|
constructor() {
|
@@ -39,6 +39,8 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
|
|
39
39
|
this.zoomAndScrollToSelected = undefined;
|
40
40
|
this.allowEditing = true;
|
41
41
|
this.highlightEnabled = true;
|
42
|
+
this.paginationEnabled = true;
|
43
|
+
this.position = 'absolute';
|
42
44
|
this._alertOpen = false;
|
43
45
|
this._count = "";
|
44
46
|
this._editRecordOpen = false;
|
@@ -84,6 +86,45 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
|
|
84
86
|
async getSelectedFeature() {
|
85
87
|
return this._features.selectedFeature;
|
86
88
|
}
|
89
|
+
/**
|
90
|
+
* Get the current selected feature from the Features widget
|
91
|
+
* @returns Promise resolving with the current feature
|
92
|
+
*/
|
93
|
+
async refresh() {
|
94
|
+
await this.setGraphics();
|
95
|
+
}
|
96
|
+
/**
|
97
|
+
* Go to the previous feature in the features widget
|
98
|
+
*/
|
99
|
+
async back() {
|
100
|
+
this._features.previous();
|
101
|
+
this._count = this._getCount();
|
102
|
+
}
|
103
|
+
/**
|
104
|
+
* Go to the next feature in the features widget
|
105
|
+
*/
|
106
|
+
async next() {
|
107
|
+
this._features.next();
|
108
|
+
this._count = this._getCount();
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* Toggle the visibility of the features list view
|
112
|
+
*/
|
113
|
+
async toggleListView() {
|
114
|
+
this._showListView = !this._showListView;
|
115
|
+
const i = this._features.selectedFeatureIndex;
|
116
|
+
this._features.open({
|
117
|
+
features: this.graphics,
|
118
|
+
featureMenuOpen: this._showListView
|
119
|
+
});
|
120
|
+
this._features.selectedFeatureIndex = i;
|
121
|
+
}
|
122
|
+
/**
|
123
|
+
* update the current graphics to the features widget
|
124
|
+
*/
|
125
|
+
async updateCurrentGraphic(selectedGraphic) {
|
126
|
+
this._features.selectedFeatureWidget.graphic = selectedGraphic;
|
127
|
+
}
|
87
128
|
/**
|
88
129
|
* Respond to and close the edit record display
|
89
130
|
*
|
@@ -148,8 +189,8 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
|
|
148
189
|
const id = (_d = (_c = this._features) === null || _c === void 0 ? void 0 : _c.selectedFeature) === null || _d === void 0 ? void 0 : _d.getObjectId();
|
149
190
|
const ids = parseInt(id === null || id === void 0 ? void 0 : id.toString(), 10) > -1 ? [id] : [];
|
150
191
|
const deleteEnabled = ((_e = this._layer) === null || _e === void 0 ? void 0 : _e.editingEnabled) && ((_h = (_g = (_f = this._layer) === null || _f === void 0 ? void 0 : _f.capabilities) === null || _g === void 0 ? void 0 : _g.operations) === null || _h === void 0 ? void 0 : _h.supportsDelete);
|
151
|
-
return (h(Host, null, h("calcite-shell",
|
152
|
-
h("div", { class: "display-flex top-border padding-1-2" }, h("calcite-button", { appearance: "solid", id: "solutions-edit", onClick: () => this._openEditRecord(), width: "full" }, this._translations.edit), this.isMobile && deleteEnabled ? (h("delete-button", { class: "padding-inline-start-1 width-100", id: "solutions-delete", ids: ids, layer: this._layer, onEditsComplete: () => this._closePopup() })) : undefined, h("calcite-tooltip", {
|
192
|
+
return (h(Host, null, h("calcite-shell", { style: { position: this.position } }, this._getHeader(), h("calcite-loader", { class: loadingClass, label: this._translations.fetchingData }), h("div", { class: "esri-widget feature-node " + featureNodeClass, id: "features-node" }), h("div", { class: `${editButtonClass} width-100`, slot: "footer" }, this.allowEditing &&
|
193
|
+
h("div", { class: "display-flex top-border padding-1-2" }, h("calcite-button", { appearance: "solid", id: "solutions-edit", onClick: () => this._openEditRecord(), width: "full" }, this._translations.edit), this.isMobile && deleteEnabled ? (h("delete-button", { class: "padding-inline-start-1 width-100", id: "solutions-delete", ids: ids, layer: this._layer, onEditsComplete: () => this._closePopup() })) : undefined, h("calcite-tooltip", { placement: "bottom", "reference-element": "solutions-edit" }, h("span", null, this._translations.edit)), this.isMobile ? (h("calcite-tooltip", { placement: "bottom", "reference-element": "solutions-delete" }, h("span", null, this._translations.delete))) : undefined), this.paginationEnabled && !nextBackDisabled && h("div", { class: `display-flex padding-1-2 button-container top-border ${nextBackClass}` }, h("div", null, h("calcite-button", { appearance: 'transparent', disabled: nextBackDisabled, iconStart: "chevron-left", id: "solutions-back", onClick: () => this._back(), width: "full" }), h("calcite-tooltip", { placement: "top", "reference-element": "solutions-back" }, h("span", null, this._translations.back))), h("calcite-action", { class: 'pagination-action', onClick: () => this._toggleListView(), scale: "s", text: "", textEnabled: true }, h("span", { class: "pagination-count" }, this._count)), h("div", null, h("calcite-button", { appearance: "transparent", disabled: nextBackDisabled, iconStart: "chevron-right", id: "solutions-next", onClick: () => this._next(), width: "full" }), h("calcite-tooltip", { placement: "top", "reference-element": "solutions-next" }, h("span", null, this._translations.next))))), h("edit-card", { class: editClass, graphicIndex: (_j = this._features) === null || _j === void 0 ? void 0 : _j.selectedFeatureIndex, graphics: this.graphics, mapView: this.mapView, open: this._editRecordOpen }), h("calcite-alert", { icon: "layer-broken", kind: "warning", label: "", onCalciteAlertClose: () => this._alertClosed(), open: this._alertOpen, placement: "top" }, h("div", { slot: "title" }, this._translations.editDisabled), h("div", { slot: "message" }, this._translations.enableEditing)))));
|
153
194
|
}
|
154
195
|
//--------------------------------------------------------------------------
|
155
196
|
//
|
@@ -224,7 +265,7 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
|
|
224
265
|
if (this.zoomAndScrollToSelected) {
|
225
266
|
this.reactiveUtils.watch(() => this._features.selectedFeatureIndex, (i) => {
|
226
267
|
if (i > -1) {
|
227
|
-
this.selectionChanged.emit([this._features.selectedFeature]);
|
268
|
+
this.selectionChanged.emit({ selectedFeature: [this._features.selectedFeature], selectedFeatureIndex: this._features.selectedFeatureIndex });
|
228
269
|
}
|
229
270
|
});
|
230
271
|
}
|
@@ -334,13 +375,20 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
|
|
334
375
|
"zoomAndScrollToSelected": [4, "zoom-and-scroll-to-selected"],
|
335
376
|
"allowEditing": [4, "allow-editing"],
|
336
377
|
"highlightEnabled": [4, "highlight-enabled"],
|
378
|
+
"paginationEnabled": [4, "pagination-enabled"],
|
379
|
+
"position": [1],
|
337
380
|
"_alertOpen": [32],
|
338
381
|
"_count": [32],
|
339
382
|
"_editRecordOpen": [32],
|
340
383
|
"_mobileTitle": [32],
|
341
384
|
"_showListView": [32],
|
342
385
|
"_translations": [32],
|
343
|
-
"getSelectedFeature": [64]
|
386
|
+
"getSelectedFeature": [64],
|
387
|
+
"refresh": [64],
|
388
|
+
"back": [64],
|
389
|
+
"next": [64],
|
390
|
+
"toggleListView": [64],
|
391
|
+
"updateCurrentGraphic": [64]
|
344
392
|
}, [[8, "closeEdit", "closeEdit"], [8, "layerSelectionChange", "layerSelectionChange"], [8, "refreshGraphics", "refreshGraphics"]], {
|
345
393
|
"graphics": ["graphicsWatchHandler"],
|
346
394
|
"isMobile": ["isMobileWatchHandler"],
|
@@ -249,7 +249,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
249
249
|
* @param evt CustomEvent the graphic for the current selection
|
250
250
|
*/
|
251
251
|
async selectionChanged(evt) {
|
252
|
-
const g = evt.detail[0];
|
252
|
+
const g = evt.detail.selectedFeature[0];
|
253
253
|
const oid = g.getObjectId();
|
254
254
|
if (this.zoomAndScrollToSelected) {
|
255
255
|
const i = this._table.viewModel.getObjectIdIndex(oid);
|
@@ -406,7 +406,7 @@ const LayerTable = /*@__PURE__*/ proxyCustomElement(class LayerTable extends HTM
|
|
406
406
|
_getActionBar() {
|
407
407
|
const containerClass = this.isMobile ? "width-full" : "";
|
408
408
|
const mobileClass = this.isMobile ? "border-top" : "";
|
409
|
-
return (h("calcite-action-bar", { class: containerClass, expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, h("div", { class: `border-end ${containerClass} ${mobileClass}`, id: "solutions-map-layer-picker-container" }, h("map-layer-picker", { appearance: "transparent", defaultLayerId: this.defaultLayerId, display: "inline-flex", height: 50, isMobile: this.isMobile, mapView: this.mapView, onLayerSelectionChange: (evt) => this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", showSingleLayerAsLabel: true, showTables: true, type: "dropdown" })), !this.isMobile ? this._getActions() : undefined));
|
409
|
+
return (h("calcite-action-bar", { class: containerClass, expandDisabled: true, expanded: true, id: this._getId("bar"), layout: "horizontal" }, h("div", { class: `border-end ${containerClass} ${mobileClass}`, id: "solutions-map-layer-picker-container" }, h("map-layer-picker", { appearance: "transparent", defaultLayerId: this.defaultLayerId, display: "inline-flex", height: 50, isMobile: this.isMobile, mapView: this.mapView, onLayerSelectionChange: (evt) => void this._layerSelectionChanged(evt), onlyShowUpdatableLayers: this.onlyShowUpdatableLayers, placeholderIcon: "layers", scale: "l", showSingleLayerAsLabel: true, showTables: true, type: "dropdown" })), !this.isMobile ? this._getActions() : undefined));
|
410
410
|
}
|
411
411
|
/**
|
412
412
|
* Get the actions that are used for various interactions with the table
|
@@ -209,7 +209,7 @@ const MapCard = /*@__PURE__*/ proxyCustomElement(class MapCard extends HTMLEleme
|
|
209
209
|
}
|
210
210
|
else if (loadDefaultMap) {
|
211
211
|
this._defaultWebmapHonored = true;
|
212
|
-
this._mapPicker.setMapByID(id);
|
212
|
+
void this._mapPicker.setMapByID(id);
|
213
213
|
}
|
214
214
|
else if (mapConfigChanged) {
|
215
215
|
// Map is the same so no need to reload but we need to update for any changes from the config
|