@esri/solutions-components 0.8.8 → 0.8.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +11 -2
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +11 -2
  3. package/dist/cjs/{calcite-action-menu_2.cjs.entry.js → calcite-action-menu_3.cjs.entry.js} +114 -7
  4. package/dist/cjs/calcite-alert_4.cjs.entry.js +47 -5
  5. package/dist/cjs/{calcite-input-date-picker_3.cjs.entry.js → calcite-block_5.cjs.entry.js} +691 -13
  6. package/dist/cjs/{calcite-combobox_5.cjs.entry.js → calcite-combobox_3.cjs.entry.js} +876 -844
  7. package/dist/cjs/calcite-dropdown_4.cjs.entry.js +1023 -0
  8. package/dist/cjs/{calcite-flow_5.cjs.entry.js → calcite-flow_6.cjs.entry.js} +327 -2
  9. package/dist/cjs/card-manager_3.cjs.entry.js +5 -5
  10. package/dist/cjs/crowdsource-manager.cjs.entry.js +25 -17
  11. package/dist/cjs/crowdsource-reporter.cjs.entry.js +122 -21
  12. package/dist/cjs/{downloadUtils-8b05d7cc.js → downloadUtils-dd787ddf.js} +2 -2
  13. package/dist/cjs/{index.es-e7587227.js → index.es-29fa176d.js} +2 -2
  14. package/dist/cjs/loader.cjs.js +1 -1
  15. package/dist/cjs/map-select-tools_3.cjs.entry.js +8 -8
  16. package/dist/cjs/{mapViewUtils-3e0fa457.js → mapViewUtils-82018df6.js} +12 -6
  17. package/dist/cjs/public-notification.cjs.entry.js +2 -2
  18. package/dist/cjs/solutions-components.cjs.js +1 -1
  19. package/dist/collection/collection-manifest.json +1 -0
  20. package/dist/collection/components/create-feature/create-feature.js +18 -0
  21. package/dist/collection/components/crowdsource-manager/crowdsource-manager.css +15 -0
  22. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +48 -16
  23. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +16 -0
  24. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +155 -35
  25. package/dist/collection/components/feature-details/feature-details.css +18 -0
  26. package/dist/collection/components/feature-details/feature-details.js +500 -0
  27. package/dist/collection/components/feature-details/test/feature-details.e2e.js +14 -0
  28. package/dist/collection/components/feature-details/test/feature-details.spec.js +22 -0
  29. package/dist/collection/components/feature-list/feature-list.js +14 -1
  30. package/dist/collection/components/info-card/info-card.css +15 -5
  31. package/dist/collection/components/info-card/info-card.js +179 -5
  32. package/dist/collection/components/layer-table/layer-table.js +2 -2
  33. package/dist/collection/components/map-card/map-card.js +1 -1
  34. package/dist/collection/components/map-select-tools/map-select-tools.js +5 -5
  35. package/dist/collection/components/refine-selection/refine-selection.js +1 -1
  36. package/dist/collection/demos/crowdsource-manager.html +7 -2
  37. package/dist/collection/demos/crowdsource-reporter.html +115 -1
  38. package/dist/collection/utils/mapViewUtils.js +12 -6
  39. package/dist/collection/utils/mapViewUtils.ts +14 -6
  40. package/dist/components/create-feature2.js +4 -0
  41. package/dist/components/crowdsource-manager.js +26 -18
  42. package/dist/components/crowdsource-reporter.js +270 -81
  43. package/dist/components/feature-details.d.ts +11 -0
  44. package/dist/components/feature-details.js +11 -0
  45. package/dist/components/feature-details2.js +449 -0
  46. package/dist/components/feature-list2.js +14 -1
  47. package/dist/components/info-card2.js +54 -5
  48. package/dist/components/layer-table2.js +2 -2
  49. package/dist/components/map-card2.js +1 -1
  50. package/dist/components/map-select-tools2.js +5 -5
  51. package/dist/components/mapViewUtils.js +12 -6
  52. package/dist/components/refine-selection2.js +1 -1
  53. package/dist/esm/{calcite-action-menu_2.entry.js → calcite-action-menu_3.entry.js} +118 -12
  54. package/dist/esm/calcite-alert_4.entry.js +47 -5
  55. package/dist/esm/{calcite-input-date-picker_3.entry.js → calcite-block_5.entry.js} +688 -12
  56. package/dist/esm/{calcite-combobox_5.entry.js → calcite-combobox_3.entry.js} +878 -844
  57. package/dist/esm/calcite-date-picker-day_3.entry.js +1 -1
  58. package/dist/esm/calcite-dropdown_4.entry.js +1016 -0
  59. package/dist/esm/{calcite-flow_5.entry.js → calcite-flow_6.entry.js} +327 -3
  60. package/dist/esm/card-manager_3.entry.js +5 -5
  61. package/dist/esm/crowdsource-manager.entry.js +26 -18
  62. package/dist/esm/crowdsource-reporter.entry.js +122 -21
  63. package/dist/esm/{date-5630530d.js → date-0c026a8b.js} +1 -1
  64. package/dist/esm/{downloadUtils-0c1e4d7b.js → downloadUtils-25aa808f.js} +2 -2
  65. package/dist/esm/{index.es-286e3cfa.js → index.es-a16c9db4.js} +2 -2
  66. package/dist/esm/loader.js +1 -1
  67. package/dist/esm/map-select-tools_3.entry.js +8 -8
  68. package/dist/esm/{mapViewUtils-253178f1.js → mapViewUtils-c83c03a4.js} +12 -6
  69. package/dist/esm/public-notification.entry.js +2 -2
  70. package/dist/esm/solutions-components.js +1 -1
  71. package/dist/solutions-components/demos/crowdsource-manager.html +7 -2
  72. package/dist/solutions-components/demos/crowdsource-reporter.html +115 -1
  73. package/dist/solutions-components/p-2f687975.entry.js +17 -0
  74. package/dist/solutions-components/{p-813fd8a4.entry.js → p-3e5085ae.entry.js} +2 -2
  75. package/dist/solutions-components/p-40039b84.entry.js +6 -0
  76. package/dist/solutions-components/p-511b1c91.entry.js +23 -0
  77. package/dist/solutions-components/{p-94de9279.js → p-5817d78c.js} +1 -1
  78. package/dist/solutions-components/{p-15f9624a.entry.js → p-58997cc1.entry.js} +1 -1
  79. package/dist/solutions-components/p-82e398cb.entry.js +17 -0
  80. package/dist/solutions-components/p-ae75d7d7.entry.js +6 -0
  81. package/dist/solutions-components/{p-331b5d1e.js → p-b1376c75.js} +2 -2
  82. package/dist/solutions-components/p-b5acfcd8.entry.js +6 -0
  83. package/dist/solutions-components/{p-212b02e7.js → p-bdd77f17.js} +1 -1
  84. package/dist/solutions-components/{p-038fcd93.entry.js → p-c273ab7a.entry.js} +1 -1
  85. package/dist/solutions-components/p-d742b915.entry.js +29 -0
  86. package/dist/solutions-components/p-d9c89479.js +36 -0
  87. package/dist/solutions-components/p-dfad61a8.entry.js +24 -0
  88. package/dist/solutions-components/p-fffc9e08.entry.js +6 -0
  89. package/dist/solutions-components/solutions-components.esm.js +1 -1
  90. package/dist/solutions-components/utils/mapViewUtils.ts +14 -6
  91. package/dist/types/components/create-feature/create-feature.d.ts +4 -4
  92. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +13 -1
  93. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +91 -10
  94. package/dist/types/components/feature-details/feature-details.d.ts +151 -0
  95. package/dist/types/components/feature-list/feature-list.d.ts +6 -0
  96. package/dist/types/components/info-card/info-card.d.ts +33 -1
  97. package/dist/types/components.d.ts +148 -12
  98. package/dist/types/preact.d.ts +9 -2
  99. package/dist/types/utils/mapViewUtils.d.ts +5 -3
  100. package/package.json +1 -1
  101. package/dist/cjs/calcite-block_2.cjs.entry.js +0 -652
  102. package/dist/cjs/calcite-graph_2.cjs.entry.js +0 -1055
  103. package/dist/cjs/calcite-scrim.cjs.entry.js +0 -125
  104. package/dist/cjs/utils-7bc7f595.js +0 -64
  105. package/dist/esm/calcite-block_2.entry.js +0 -647
  106. package/dist/esm/calcite-graph_2.entry.js +0 -1050
  107. package/dist/esm/calcite-scrim.entry.js +0 -121
  108. package/dist/esm/utils-9fb4104a.js +0 -61
  109. package/dist/solutions-components/p-04c37d69.entry.js +0 -17
  110. package/dist/solutions-components/p-0b92e4b1.entry.js +0 -11
  111. package/dist/solutions-components/p-13ca3b00.entry.js +0 -6
  112. package/dist/solutions-components/p-238d3b5f.entry.js +0 -6
  113. package/dist/solutions-components/p-3af79063.js +0 -36
  114. package/dist/solutions-components/p-80b11ec1.entry.js +0 -17
  115. package/dist/solutions-components/p-a3a11749.entry.js +0 -6
  116. package/dist/solutions-components/p-aec06ce4.entry.js +0 -18
  117. package/dist/solutions-components/p-bfdf89c2.js +0 -11
  118. package/dist/solutions-components/p-c4ff3b52.entry.js +0 -17
  119. package/dist/solutions-components/p-ced067bd.entry.js +0 -17
  120. package/dist/solutions-components/p-d136eab0.entry.js +0 -23
  121. 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.featureSelect.emit(selectedFeature);
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:space-between;align-items:center}.top-border{border-top:1px solid var(--calcite-color-border-1)}.min-width-100{min-width:100px}.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}";
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", null, 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 &&
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", { label: "", placement: "bottom", "reference-element": "solutions-edit" }, h("span", null, this._translations.edit)), this.isMobile ? (h("calcite-tooltip", { label: "", placement: "bottom", "reference-element": "solutions-delete" }, h("span", null, this._translations.delete))) : undefined), !nextBackDisabled && h("div", { class: `display-flex padding-1-2 button-container top-border ${nextBackClass}` }, h("div", { class: "min-width-100" }, h("calcite-button", { appearance: "outline", disabled: nextBackDisabled, id: "solutions-back", onClick: () => this._back(), width: "full" }, this._translations.back), h("calcite-tooltip", { label: "", placement: "top", "reference-element": "solutions-back" }, h("span", null, this._translations.back))), h("div", null, h("calcite-action", { icon: "list", onClick: () => this._toggleListView(), scale: "s", text: this._count, textEnabled: true })), h("div", { class: "min-width-100" }, h("calcite-button", { appearance: "outline", disabled: nextBackDisabled, id: "solutions-next", onClick: () => this._next(), width: "full" }, this._translations.next), h("calcite-tooltip", { label: "", 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)))));
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
  //
@@ -217,6 +258,7 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
217
258
  });
218
259
  this._features.viewModel.highlightEnabled = this.highlightEnabled;
219
260
  this.reactiveUtils.watch(() => this._features.viewModel.featureMenuOpen, (isOpen) => {
261
+ this._count = this._getCount();
220
262
  if (!isOpen) {
221
263
  this._showListView = isOpen;
222
264
  }
@@ -224,7 +266,7 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
224
266
  if (this.zoomAndScrollToSelected) {
225
267
  this.reactiveUtils.watch(() => this._features.selectedFeatureIndex, (i) => {
226
268
  if (i > -1) {
227
- this.selectionChanged.emit([this._features.selectedFeature]);
269
+ this.selectionChanged.emit({ selectedFeature: [this._features.selectedFeature], selectedFeatureIndex: this._features.selectedFeatureIndex });
228
270
  }
229
271
  });
230
272
  }
@@ -334,13 +376,20 @@ const InfoCard = /*@__PURE__*/ proxyCustomElement(class InfoCard extends HTMLEle
334
376
  "zoomAndScrollToSelected": [4, "zoom-and-scroll-to-selected"],
335
377
  "allowEditing": [4, "allow-editing"],
336
378
  "highlightEnabled": [4, "highlight-enabled"],
379
+ "paginationEnabled": [4, "pagination-enabled"],
380
+ "position": [1],
337
381
  "_alertOpen": [32],
338
382
  "_count": [32],
339
383
  "_editRecordOpen": [32],
340
384
  "_mobileTitle": [32],
341
385
  "_showListView": [32],
342
386
  "_translations": [32],
343
- "getSelectedFeature": [64]
387
+ "getSelectedFeature": [64],
388
+ "refresh": [64],
389
+ "back": [64],
390
+ "next": [64],
391
+ "toggleListView": [64],
392
+ "updateCurrentGraphic": [64]
344
393
  }, [[8, "closeEdit", "closeEdit"], [8, "layerSelectionChange", "layerSelectionChange"], [8, "refreshGraphics", "refreshGraphics"]], {
345
394
  "graphics": ["graphicsWatchHandler"],
346
395
  "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