@esri/solutions-components 0.7.30 → 0.7.32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. package/dist/assets/t9n/crowdsource-reporter/resources.json +7 -5
  2. package/dist/assets/t9n/crowdsource-reporter/resources_en.json +7 -5
  3. package/dist/assets/t9n/feature-list/resources.json +1 -1
  4. package/dist/assets/t9n/feature-list/resources_en.json +1 -1
  5. package/dist/assets/t9n/layer-list/resources.json +1 -1
  6. package/dist/assets/t9n/layer-list/resources_en.json +1 -1
  7. package/dist/cjs/{calcite-flow_4.cjs.entry.js → calcite-flow_5.cjs.entry.js} +286 -19
  8. package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
  9. package/dist/cjs/crowdsource-reporter.cjs.entry.js +248 -32
  10. package/dist/cjs/{downloadUtils-83c6d3c3.js → downloadUtils-10e0de31.js} +2 -2
  11. package/dist/cjs/{index.es-bd1a93b2.js → index.es-72dc7ab9.js} +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
  14. package/dist/cjs/public-notification.cjs.entry.js +1 -1
  15. package/dist/cjs/solutions-components.cjs.js +1 -1
  16. package/dist/collection/collection-manifest.json +1 -0
  17. package/dist/collection/components/create-feature/create-feature.css +50 -0
  18. package/dist/collection/components/create-feature/create-feature.js +444 -0
  19. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
  20. package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +287 -33
  21. package/dist/collection/components/feature-list/feature-list.js +1 -0
  22. package/dist/collection/components/layer-list/layer-list.js +60 -16
  23. package/dist/collection/demos/create-feature.html +90 -0
  24. package/dist/collection/demos/crowdsource-reporter.html +26 -11
  25. package/dist/collection/utils/downloadUtils.js +1 -1
  26. package/dist/collection/utils/downloadUtils.ts +1 -1
  27. package/dist/components/create-feature.d.ts +11 -0
  28. package/dist/components/create-feature.js +11 -0
  29. package/dist/components/create-feature2.js +278 -0
  30. package/dist/components/crowdsource-reporter.js +324 -90
  31. package/dist/components/downloadUtils.js +1 -1
  32. package/dist/components/feature-list2.js +1 -0
  33. package/dist/components/layer-list2.js +38 -17
  34. package/dist/esm/{calcite-flow_4.entry.js → calcite-flow_5.entry.js} +286 -20
  35. package/dist/esm/card-manager_3.entry.js +1 -1
  36. package/dist/esm/crowdsource-reporter.entry.js +249 -33
  37. package/dist/esm/{downloadUtils-d070a467.js → downloadUtils-d297078f.js} +2 -2
  38. package/dist/esm/{index.es-d48535a2.js → index.es-3b4fa9d0.js} +1 -1
  39. package/dist/esm/loader.js +1 -1
  40. package/dist/esm/map-select-tools_3.entry.js +1 -1
  41. package/dist/esm/public-notification.entry.js +1 -1
  42. package/dist/esm/solutions-components.js +1 -1
  43. package/dist/solutions-components/demos/create-feature.html +90 -0
  44. package/dist/solutions-components/demos/crowdsource-reporter.html +26 -11
  45. package/dist/solutions-components/{p-f120ff40.entry.js → p-09ec8c8f.entry.js} +1 -1
  46. package/dist/solutions-components/{p-55b835a1.js → p-103c5318.js} +2 -2
  47. package/dist/solutions-components/{p-309cdea1.entry.js → p-57d49d15.entry.js} +1 -1
  48. package/dist/solutions-components/{p-b913a4fd.js → p-8ec25bf4.js} +1 -1
  49. package/dist/solutions-components/{p-f22ff57e.entry.js → p-921f21d5.entry.js} +1 -1
  50. package/dist/solutions-components/p-d5263cb9.entry.js +17 -0
  51. package/dist/solutions-components/p-ea17cefb.entry.js +6 -0
  52. package/dist/solutions-components/solutions-components.esm.js +1 -1
  53. package/dist/solutions-components/utils/downloadUtils.ts +1 -1
  54. package/dist/types/components/create-feature/create-feature.d.ts +125 -0
  55. package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +146 -12
  56. package/dist/types/components/feature-list/feature-list.d.ts +1 -0
  57. package/dist/types/components/layer-list/layer-list.d.ts +6 -0
  58. package/dist/types/components.d.ts +102 -0
  59. package/dist/types/preact.d.ts +7 -0
  60. package/package.json +1 -1
  61. package/dist/solutions-components/p-2f162664.entry.js +0 -6
  62. package/dist/solutions-components/p-94ee3ef7.entry.js +0 -17
@@ -4,6 +4,7 @@
4
4
  "components/basemap-gallery/basemap-gallery.js",
5
5
  "components/buffer-tools/buffer-tools.js",
6
6
  "components/card-manager/card-manager.js",
7
+ "components/create-feature/create-feature.js",
7
8
  "components/crowdsource-manager/crowdsource-manager.js",
8
9
  "components/crowdsource-reporter/crowdsource-reporter.js",
9
10
  "components/deduct-calculator/deduct-calculator.js",
@@ -0,0 +1,50 @@
1
+ /** @license
2
+ * Copyright 2022 Esri
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ :host {
18
+ display: block;
19
+ }
20
+
21
+ /* Override to hide Editor settings panel collapsible */
22
+ .esri-editor__panel-toolbar {
23
+ display: none !important;
24
+ }
25
+
26
+ /* Override to hide the Select section from Editor template */
27
+ .esri-editor__update-actions {
28
+ display: none !important;
29
+ }
30
+
31
+ /* Override to reduce the padding of panel content*/
32
+ .esri-editor__panel-content {
33
+ padding-block: 0px !important;
34
+ }
35
+
36
+ /* Override to hide header */
37
+ .esri-editor .esri-item-list__group__header {
38
+ display: none !important;
39
+ }
40
+
41
+ /* Override to hide the create feature heading title */
42
+ .esri-editor__panel-content__section .esri-widget__heading {
43
+ display: none !important;
44
+ }
45
+
46
+ /* Override to reduce padding for the template filter*/
47
+ .esri-editor .esri-item-list__filter-container--sticky {
48
+ padding-block: 0px !important;
49
+ padding-inline: 10px !important;
50
+ }
@@ -0,0 +1,444 @@
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
+ /** @license
7
+ * Copyright 2022 Esri
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * http://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+ import { Host, h } from "@stencil/core";
22
+ import { loadModules } from "../../utils/loadModules";
23
+ import { getAllLayers } from "../../utils/mapViewUtils";
24
+ export class CreateFeature {
25
+ constructor() {
26
+ this.mapView = undefined;
27
+ this.selectedLayerId = undefined;
28
+ this.customizeSubmit = false;
29
+ }
30
+ //--------------------------------------------------------------------------
31
+ //
32
+ // Watch handlers
33
+ //
34
+ //--------------------------------------------------------------------------
35
+ /**
36
+ * Called each time the mapView prop is changed.
37
+ */
38
+ async mapViewWatchHandler() {
39
+ await this.mapView.when(async () => {
40
+ await this.init();
41
+ });
42
+ }
43
+ //--------------------------------------------------------------------------
44
+ //
45
+ // Methods (public)
46
+ //
47
+ //--------------------------------------------------------------------------
48
+ /**
49
+ * Destroy the Editor widget instance
50
+ * @returns Promise that resolves when the operation is complete
51
+ */
52
+ async close() {
53
+ if (this._editor) {
54
+ this._editor.destroy();
55
+ }
56
+ }
57
+ /**
58
+ * Submit the created feature
59
+ * @returns Promise that resolves when the operation is complete
60
+ */
61
+ async submit() {
62
+ if (this._editor) {
63
+ this._editor.viewModel.featureFormViewModel.submit();
64
+ }
65
+ }
66
+ //--------------------------------------------------------------------------
67
+ //
68
+ // Functions (lifecycle)
69
+ //
70
+ //--------------------------------------------------------------------------
71
+ /**
72
+ * StencilJS: Called once just after the component is first connected to the DOM.
73
+ * @returns Promise when complete
74
+ */
75
+ async componentWillLoad() {
76
+ await this.initModules();
77
+ }
78
+ /**
79
+ * StencilJS: Called once just after the component is fully loaded and the first render() occurs.
80
+ */
81
+ async componentDidLoad() {
82
+ await this.init();
83
+ }
84
+ /**
85
+ * Renders the component.
86
+ */
87
+ render() {
88
+ return (h(Host, { id: "feature-form" }));
89
+ }
90
+ //--------------------------------------------------------------------------
91
+ //
92
+ // Functions (protected)
93
+ //
94
+ //--------------------------------------------------------------------------
95
+ /**
96
+ * Init Editor widget and starts the create workflow
97
+ */
98
+ async init() {
99
+ if (this.mapView && this.selectedLayerId) {
100
+ await this.createEditorWidget();
101
+ }
102
+ }
103
+ /**
104
+ * Load esri javascript api modules
105
+ * @returns Promise resolving when function is done
106
+ * @protected
107
+ */
108
+ async initModules() {
109
+ const [Editor, reactiveUtils] = await loadModules([
110
+ "esri/widgets/Editor",
111
+ "esri/core/reactiveUtils"
112
+ ]);
113
+ this.Editor = Editor;
114
+ this.reactiveUtils = reactiveUtils;
115
+ }
116
+ /**
117
+ * Display editor widget to create the new feature
118
+ * @protected
119
+ */
120
+ async createEditorWidget() {
121
+ if (this._editor) {
122
+ this._editor.destroy();
123
+ }
124
+ const layerInfos = [];
125
+ const container = document.createElement("div");
126
+ const allMapLayers = await getAllLayers(this.mapView);
127
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
128
+ allMapLayers.forEach(async (eachLayer) => {
129
+ layerInfos.push({
130
+ layer: eachLayer,
131
+ enabled: (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.id) === this.selectedLayerId,
132
+ addEnabled: true,
133
+ updateEnabled: false,
134
+ deleteEnabled: false // default is true, set to false to disable the ability to delete features
135
+ });
136
+ });
137
+ this._editor = new this.Editor({
138
+ allowedWorkflows: "create-features",
139
+ view: this.mapView,
140
+ layerInfos: layerInfos,
141
+ visibleElements: {
142
+ snappingControls: false
143
+ },
144
+ container
145
+ });
146
+ this.el.appendChild(container);
147
+ //Add handle to watch if attachments are added/edited
148
+ const attachmentHandle = this.reactiveUtils.watch(() => this._editor.viewModel.state, (state) => {
149
+ if (state === 'adding-attachment' || state === 'editing-attachment') {
150
+ this._addingAttachment = true;
151
+ this.editingAttachment.emit(true);
152
+ }
153
+ else {
154
+ if (this._addingAttachment) {
155
+ this.editingAttachment.emit(false);
156
+ this._addingAttachment = false;
157
+ }
158
+ }
159
+ });
160
+ this._editor.viewModel.addHandles(attachmentHandle);
161
+ //Add handle to watch featureTemplatesViewModel ready state and then start the creation
162
+ const handle = this.reactiveUtils.watch(() => this._editor.viewModel.featureTemplatesViewModel.state, (state) => {
163
+ if (state === 'ready') {
164
+ void this.startCreate();
165
+ }
166
+ });
167
+ this._editor.viewModel.addHandles(handle);
168
+ }
169
+ /**
170
+ * Start creating the feature
171
+ * @protected
172
+ */
173
+ async startCreate() {
174
+ var _a;
175
+ if ((_a = this._editor.viewModel.featureTemplatesViewModel.items) === null || _a === void 0 ? void 0 : _a.length) {
176
+ const items = this._editor.viewModel.featureTemplatesViewModel.items[0].get("items");
177
+ //once the feature template is selected handle the event for formSubmit and sketch complete
178
+ //also, hide the headers and footer in the editor as we will be showing our own submit and cancel button
179
+ this._editor.viewModel.featureTemplatesViewModel.on('select', () => {
180
+ setTimeout(() => {
181
+ //on form submit
182
+ this._editor.viewModel.featureFormViewModel.on('submit', this.submitted.bind(this));
183
+ //on sketch complete emit the event
184
+ this._editor.viewModel.sketchViewModel.on("create", (evt) => {
185
+ if (evt.state === "complete") {
186
+ this.drawComplete.emit();
187
+ }
188
+ });
189
+ this.hideEditorsElements();
190
+ }, 700);
191
+ this.hideEditorsElements();
192
+ });
193
+ //if only one feature template then directly start geometry creation for that
194
+ //else allow feature template selection to user
195
+ if (items.length === 1) {
196
+ this._editor.viewModel.featureTemplatesViewModel.select(items[0]);
197
+ }
198
+ //hides the header and footer elements in editor widget
199
+ this.hideEditorsElements();
200
+ }
201
+ }
202
+ /**
203
+ * Hides the elements of editor widget
204
+ * @protected
205
+ */
206
+ hideEditorsElements() {
207
+ if (!this.customizeSubmit) {
208
+ return;
209
+ }
210
+ setTimeout(() => {
211
+ var _a;
212
+ //hides the header and footer on the featureForm
213
+ (_a = this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')) === null || _a === void 0 ? void 0 : _a.forEach((flowItem) => {
214
+ var _a, _b, _c, _d, _e;
215
+ const article = (_c = (_b = (_a = flowItem.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('calcite-panel')) === null || _b === void 0 ? void 0 : _b.shadowRoot) === null || _c === void 0 ? void 0 : _c.querySelector('article');
216
+ //hide the header
217
+ (_d = article === null || article === void 0 ? void 0 : article.querySelector('header')) === null || _d === void 0 ? void 0 : _d.setAttribute('style', 'display: none');
218
+ //hide the footer
219
+ (_e = article === null || article === void 0 ? void 0 : article.querySelector('footer')) === null || _e === void 0 ? void 0 : _e.setAttribute('style', 'display: none');
220
+ });
221
+ }, 700);
222
+ }
223
+ /**
224
+ * On creation of feature emit the event that the feature is created
225
+ * @param evt feature submit event
226
+ * @protected
227
+ */
228
+ async submitted(evt) {
229
+ var _a;
230
+ //return if any attribute is invalid , focus will be shifted to the invalid attribute in feature form
231
+ if (evt.invalid.length) {
232
+ return;
233
+ }
234
+ //Submit only when valid attributes
235
+ //emit success or fail based on the result
236
+ if (evt.valid.length) {
237
+ try {
238
+ await this._editor.activeWorkflow.commit();
239
+ //throw errors if any failures
240
+ if ((_a = this._editor.viewModel.failures) === null || _a === void 0 ? void 0 : _a.length) {
241
+ this._editor.viewModel.failures.some((failure) => {
242
+ if (failure.error) {
243
+ throw (failure.error);
244
+ }
245
+ });
246
+ }
247
+ }
248
+ catch (e) {
249
+ this.fail.emit(e);
250
+ return;
251
+ }
252
+ this.success.emit();
253
+ }
254
+ }
255
+ static get is() { return "create-feature"; }
256
+ static get originalStyleUrls() {
257
+ return {
258
+ "$": ["create-feature.css"]
259
+ };
260
+ }
261
+ static get styleUrls() {
262
+ return {
263
+ "$": ["create-feature.css"]
264
+ };
265
+ }
266
+ static get properties() {
267
+ return {
268
+ "mapView": {
269
+ "type": "unknown",
270
+ "mutable": false,
271
+ "complexType": {
272
+ "original": "__esri.MapView",
273
+ "resolved": "MapView",
274
+ "references": {
275
+ "___esri": {
276
+ "location": "global",
277
+ "id": "global::___esri"
278
+ }
279
+ }
280
+ },
281
+ "required": false,
282
+ "optional": false,
283
+ "docs": {
284
+ "tags": [],
285
+ "text": "esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
286
+ }
287
+ },
288
+ "selectedLayerId": {
289
+ "type": "string",
290
+ "mutable": false,
291
+ "complexType": {
292
+ "original": "string",
293
+ "resolved": "string",
294
+ "references": {}
295
+ },
296
+ "required": false,
297
+ "optional": false,
298
+ "docs": {
299
+ "tags": [],
300
+ "text": "string: Layer id of the feature layer in which the new feature is to be created"
301
+ },
302
+ "attribute": "selected-layer-id",
303
+ "reflect": false
304
+ },
305
+ "customizeSubmit": {
306
+ "type": "boolean",
307
+ "mutable": false,
308
+ "complexType": {
309
+ "original": "boolean",
310
+ "resolved": "boolean",
311
+ "references": {}
312
+ },
313
+ "required": false,
314
+ "optional": true,
315
+ "docs": {
316
+ "tags": [],
317
+ "text": "boolean: Set this to true when have a custom submit button in the app.\r\nThis will hide the header and footer elements of the editor and user needs to execute the submit method manually."
318
+ },
319
+ "attribute": "customize-submit",
320
+ "reflect": false,
321
+ "defaultValue": "false"
322
+ }
323
+ };
324
+ }
325
+ static get events() {
326
+ return [{
327
+ "method": "success",
328
+ "name": "success",
329
+ "bubbles": true,
330
+ "cancelable": true,
331
+ "composed": true,
332
+ "docs": {
333
+ "tags": [],
334
+ "text": "Emitted on demand when the feature is created successfully"
335
+ },
336
+ "complexType": {
337
+ "original": "void",
338
+ "resolved": "void",
339
+ "references": {}
340
+ }
341
+ }, {
342
+ "method": "fail",
343
+ "name": "fail",
344
+ "bubbles": true,
345
+ "cancelable": true,
346
+ "composed": true,
347
+ "docs": {
348
+ "tags": [],
349
+ "text": "Emitted on demand when the feature creation is failed"
350
+ },
351
+ "complexType": {
352
+ "original": "Error",
353
+ "resolved": "Error",
354
+ "references": {
355
+ "Error": {
356
+ "location": "global",
357
+ "id": "global::Error"
358
+ }
359
+ }
360
+ }
361
+ }, {
362
+ "method": "drawComplete",
363
+ "name": "drawComplete",
364
+ "bubbles": true,
365
+ "cancelable": true,
366
+ "composed": true,
367
+ "docs": {
368
+ "tags": [],
369
+ "text": "Emitted on demand when drawing is completed"
370
+ },
371
+ "complexType": {
372
+ "original": "void",
373
+ "resolved": "void",
374
+ "references": {}
375
+ }
376
+ }, {
377
+ "method": "editingAttachment",
378
+ "name": "editingAttachment",
379
+ "bubbles": true,
380
+ "cancelable": true,
381
+ "composed": true,
382
+ "docs": {
383
+ "tags": [],
384
+ "text": "Emitted on demand when editing attachments"
385
+ },
386
+ "complexType": {
387
+ "original": "boolean",
388
+ "resolved": "boolean",
389
+ "references": {}
390
+ }
391
+ }];
392
+ }
393
+ static get methods() {
394
+ return {
395
+ "close": {
396
+ "complexType": {
397
+ "signature": "() => Promise<void>",
398
+ "parameters": [],
399
+ "references": {
400
+ "Promise": {
401
+ "location": "global",
402
+ "id": "global::Promise"
403
+ }
404
+ },
405
+ "return": "Promise<void>"
406
+ },
407
+ "docs": {
408
+ "text": "Destroy the Editor widget instance",
409
+ "tags": [{
410
+ "name": "returns",
411
+ "text": "Promise that resolves when the operation is complete"
412
+ }]
413
+ }
414
+ },
415
+ "submit": {
416
+ "complexType": {
417
+ "signature": "() => Promise<void>",
418
+ "parameters": [],
419
+ "references": {
420
+ "Promise": {
421
+ "location": "global",
422
+ "id": "global::Promise"
423
+ }
424
+ },
425
+ "return": "Promise<void>"
426
+ },
427
+ "docs": {
428
+ "text": "Submit the created feature",
429
+ "tags": [{
430
+ "name": "returns",
431
+ "text": "Promise that resolves when the operation is complete"
432
+ }]
433
+ }
434
+ }
435
+ };
436
+ }
437
+ static get elementRef() { return "el"; }
438
+ static get watchers() {
439
+ return [{
440
+ "propName": "mapView",
441
+ "methodName": "mapViewWatchHandler"
442
+ }];
443
+ }
444
+ }
@@ -44,6 +44,15 @@
44
44
  border: 1px solid var(--calcite-color-border-3);
45
45
  }
46
46
 
47
- .error-msg{
47
+ .notice-msg{
48
48
  padding: 10px;
49
+ width: calc(100% - 20px);
50
+ }
51
+
52
+ .footer-top-button {
53
+ padding-bottom: 7px;
54
+ }
55
+
56
+ .footer-button {
57
+ height: 35px;
49
58
  }