@esri/solutions-components 0.7.30 → 0.7.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/assets/t9n/crowdsource-reporter/resources.json +7 -5
- package/dist/assets/t9n/crowdsource-reporter/resources_en.json +7 -5
- package/dist/assets/t9n/feature-list/resources.json +1 -1
- package/dist/assets/t9n/feature-list/resources_en.json +1 -1
- package/dist/assets/t9n/layer-list/resources.json +1 -1
- package/dist/assets/t9n/layer-list/resources_en.json +1 -1
- package/dist/cjs/{calcite-flow_4.cjs.entry.js → calcite-flow_5.cjs.entry.js} +235 -19
- package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +221 -32
- package/dist/cjs/{downloadUtils-83c6d3c3.js → downloadUtils-10e0de31.js} +2 -2
- package/dist/cjs/{index.es-bd1a93b2.js → index.es-72dc7ab9.js} +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/map-select-tools_3.cjs.entry.js +1 -1
- package/dist/cjs/public-notification.cjs.entry.js +1 -1
- 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.css +23 -0
- package/dist/collection/components/create-feature/create-feature.js +361 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +260 -33
- package/dist/collection/components/feature-list/feature-list.js +1 -0
- package/dist/collection/components/layer-list/layer-list.js +60 -16
- package/dist/collection/demos/crowdsource-reporter.html +26 -11
- package/dist/collection/utils/downloadUtils.js +1 -1
- package/dist/collection/utils/downloadUtils.ts +1 -1
- package/dist/components/create-feature.d.ts +11 -0
- package/dist/components/create-feature.js +11 -0
- package/dist/components/create-feature2.js +226 -0
- package/dist/components/crowdsource-reporter.js +297 -90
- package/dist/components/downloadUtils.js +1 -1
- package/dist/components/feature-list2.js +1 -0
- package/dist/components/layer-list2.js +38 -17
- package/dist/esm/{calcite-flow_4.entry.js → calcite-flow_5.entry.js} +235 -20
- package/dist/esm/card-manager_3.entry.js +1 -1
- package/dist/esm/crowdsource-reporter.entry.js +222 -33
- package/dist/esm/{downloadUtils-d070a467.js → downloadUtils-d297078f.js} +2 -2
- package/dist/esm/{index.es-d48535a2.js → index.es-3b4fa9d0.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/map-select-tools_3.entry.js +1 -1
- package/dist/esm/public-notification.entry.js +1 -1
- package/dist/esm/solutions-components.js +1 -1
- package/dist/solutions-components/demos/crowdsource-reporter.html +26 -11
- package/dist/solutions-components/{p-f120ff40.entry.js → p-09ec8c8f.entry.js} +1 -1
- package/dist/solutions-components/{p-55b835a1.js → p-103c5318.js} +2 -2
- package/dist/solutions-components/{p-309cdea1.entry.js → p-57d49d15.entry.js} +1 -1
- package/dist/solutions-components/{p-b913a4fd.js → p-8ec25bf4.js} +1 -1
- package/dist/solutions-components/{p-f22ff57e.entry.js → p-921f21d5.entry.js} +1 -1
- package/dist/solutions-components/p-b4e2cac4.entry.js +17 -0
- package/dist/solutions-components/p-bb6562ab.entry.js +6 -0
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/downloadUtils.ts +1 -1
- package/dist/types/components/create-feature/create-feature.d.ts +107 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +132 -12
- package/dist/types/components/feature-list/feature-list.d.ts +1 -0
- package/dist/types/components/layer-list/layer-list.d.ts +6 -0
- package/dist/types/components.d.ts +89 -0
- package/dist/types/preact.d.ts +6 -0
- package/package.json +1 -1
- package/dist/solutions-components/p-2f162664.entry.js +0 -6
- 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,23 @@
|
|
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
|
+
.esri-editor__panel-toolbar {
|
22
|
+
display: none !important;
|
23
|
+
}
|
@@ -0,0 +1,361 @@
|
|
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 { getLayerOrTable } from "../../utils/mapViewUtils";
|
24
|
+
export class CreateFeature {
|
25
|
+
constructor() {
|
26
|
+
this.mapView = undefined;
|
27
|
+
this.selectedLayerId = undefined;
|
28
|
+
}
|
29
|
+
//--------------------------------------------------------------------------
|
30
|
+
//
|
31
|
+
// Watch handlers
|
32
|
+
//
|
33
|
+
//--------------------------------------------------------------------------
|
34
|
+
/**
|
35
|
+
* Called each time the mapView prop is changed.
|
36
|
+
*/
|
37
|
+
async mapViewWatchHandler() {
|
38
|
+
await this.mapView.when(async () => {
|
39
|
+
await this.init();
|
40
|
+
});
|
41
|
+
}
|
42
|
+
//--------------------------------------------------------------------------
|
43
|
+
//
|
44
|
+
// Methods (public)
|
45
|
+
//
|
46
|
+
//--------------------------------------------------------------------------
|
47
|
+
/**
|
48
|
+
* Destroy the Editor widget instance
|
49
|
+
* @returns Promise that resolves when the operation is complete
|
50
|
+
*/
|
51
|
+
async close() {
|
52
|
+
if (this._editor) {
|
53
|
+
this._editor.destroy();
|
54
|
+
}
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Submit the created feature
|
58
|
+
* @returns Promise that resolves when the operation is complete
|
59
|
+
*/
|
60
|
+
async submit() {
|
61
|
+
if (this._editor) {
|
62
|
+
this._editor.viewModel.featureFormViewModel.submit();
|
63
|
+
}
|
64
|
+
}
|
65
|
+
//--------------------------------------------------------------------------
|
66
|
+
//
|
67
|
+
// Functions (lifecycle)
|
68
|
+
//
|
69
|
+
//--------------------------------------------------------------------------
|
70
|
+
/**
|
71
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
72
|
+
* @returns Promise when complete
|
73
|
+
*/
|
74
|
+
async componentWillLoad() {
|
75
|
+
await this.initModules();
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
79
|
+
*/
|
80
|
+
async componentDidLoad() {
|
81
|
+
await this.init();
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* Renders the component.
|
85
|
+
*/
|
86
|
+
render() {
|
87
|
+
return (h(Host, { id: "feature-form" }));
|
88
|
+
}
|
89
|
+
//--------------------------------------------------------------------------
|
90
|
+
//
|
91
|
+
// Functions (protected)
|
92
|
+
//
|
93
|
+
//--------------------------------------------------------------------------
|
94
|
+
/**
|
95
|
+
* Init Editor widget and starts the create workflow
|
96
|
+
*/
|
97
|
+
async init() {
|
98
|
+
if (this.mapView) {
|
99
|
+
if (this.mapView && this.selectedLayerId) {
|
100
|
+
await getLayerOrTable(this.mapView, this.selectedLayerId);
|
101
|
+
await this.createEditorWidget();
|
102
|
+
await this.startCreate();
|
103
|
+
this._editor.viewModel.featureFormViewModel.on('submit', this.submitted.bind(this));
|
104
|
+
setTimeout(() => {
|
105
|
+
var _a, _b;
|
106
|
+
this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')[1].shadowRoot.querySelector('calcite-panel').shadowRoot.querySelector('article').querySelector('header').setAttribute('style', 'display: none');
|
107
|
+
(_b = (_a = this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')[1].shadowRoot.querySelector('calcite-panel').shadowRoot.querySelector('article')) === null || _a === void 0 ? void 0 : _a.querySelector('footer')) === null || _b === void 0 ? void 0 : _b.setAttribute('style', 'display: none');
|
108
|
+
}, 700);
|
109
|
+
}
|
110
|
+
}
|
111
|
+
}
|
112
|
+
/**
|
113
|
+
* Load esri javascript api modules
|
114
|
+
* @returns Promise resolving when function is done
|
115
|
+
* @protected
|
116
|
+
*/
|
117
|
+
async initModules() {
|
118
|
+
const [Editor] = await loadModules([
|
119
|
+
"esri/widgets/Editor"
|
120
|
+
]);
|
121
|
+
this.Editor = Editor;
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* Display editor widget to create the new feature
|
125
|
+
* @protected
|
126
|
+
*/
|
127
|
+
async createEditorWidget() {
|
128
|
+
if (this._editor) {
|
129
|
+
this._editor.destroy();
|
130
|
+
}
|
131
|
+
const container = document.createElement("div");
|
132
|
+
const layer = await getLayerOrTable(this.mapView, this.selectedLayerId);
|
133
|
+
const selectedLayer = {
|
134
|
+
layer: layer
|
135
|
+
};
|
136
|
+
this._editor = new this.Editor({
|
137
|
+
allowedWorkflows: "create-features",
|
138
|
+
view: this.mapView,
|
139
|
+
layerInfos: [selectedLayer],
|
140
|
+
visibleElements: {
|
141
|
+
snappingControls: false,
|
142
|
+
snappingControlsElements: {
|
143
|
+
featureEnabledToggle: false,
|
144
|
+
layerList: false,
|
145
|
+
enabledToggle: false
|
146
|
+
}
|
147
|
+
},
|
148
|
+
container,
|
149
|
+
});
|
150
|
+
this.el.appendChild(container);
|
151
|
+
}
|
152
|
+
/**
|
153
|
+
* Start creating the feature
|
154
|
+
* @protected
|
155
|
+
*/
|
156
|
+
async startCreate() {
|
157
|
+
var _a, _b;
|
158
|
+
const layer = await getLayerOrTable(this.mapView, this.selectedLayerId);
|
159
|
+
if (layer) {
|
160
|
+
let template = layer.templates && layer.templates.length ? layer.templates[0] : {};
|
161
|
+
if (((_a = layer.sourceJSON) === null || _a === void 0 ? void 0 : _a.types.length) && ((_b = layer.sourceJSON.types[0].templates) === null || _b === void 0 ? void 0 : _b.length)) {
|
162
|
+
template = layer.sourceJSON.types[0].templates[0];
|
163
|
+
}
|
164
|
+
const creationInfo = {
|
165
|
+
layer: layer,
|
166
|
+
template: template
|
167
|
+
};
|
168
|
+
await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(creationInfo);
|
169
|
+
this._editor.viewModel.sketchViewModel.on("create", (evt) => {
|
170
|
+
if (evt.state === "complete") {
|
171
|
+
this.drawComplete.emit();
|
172
|
+
}
|
173
|
+
});
|
174
|
+
}
|
175
|
+
}
|
176
|
+
/**
|
177
|
+
* On creation of feature emit the event that the feature is created
|
178
|
+
* @param evt feature submit event
|
179
|
+
* @protected
|
180
|
+
*/
|
181
|
+
async submitted(evt) {
|
182
|
+
var _a;
|
183
|
+
if (evt.invalid.length) {
|
184
|
+
return;
|
185
|
+
}
|
186
|
+
if (evt.valid.length) {
|
187
|
+
try {
|
188
|
+
await this._editor.activeWorkflow.commit();
|
189
|
+
//throw errors if any failures
|
190
|
+
if ((_a = this._editor.viewModel.failures) === null || _a === void 0 ? void 0 : _a.length) {
|
191
|
+
this._editor.viewModel.failures.some((failure) => {
|
192
|
+
if (failure.error) {
|
193
|
+
throw (failure.error);
|
194
|
+
}
|
195
|
+
});
|
196
|
+
}
|
197
|
+
}
|
198
|
+
catch (e) {
|
199
|
+
this.fail.emit(e);
|
200
|
+
return;
|
201
|
+
}
|
202
|
+
this.success.emit();
|
203
|
+
}
|
204
|
+
}
|
205
|
+
static get is() { return "create-feature"; }
|
206
|
+
static get originalStyleUrls() {
|
207
|
+
return {
|
208
|
+
"$": ["create-feature.css"]
|
209
|
+
};
|
210
|
+
}
|
211
|
+
static get styleUrls() {
|
212
|
+
return {
|
213
|
+
"$": ["create-feature.css"]
|
214
|
+
};
|
215
|
+
}
|
216
|
+
static get properties() {
|
217
|
+
return {
|
218
|
+
"mapView": {
|
219
|
+
"type": "unknown",
|
220
|
+
"mutable": false,
|
221
|
+
"complexType": {
|
222
|
+
"original": "__esri.MapView",
|
223
|
+
"resolved": "MapView",
|
224
|
+
"references": {
|
225
|
+
"___esri": {
|
226
|
+
"location": "global",
|
227
|
+
"id": "global::___esri"
|
228
|
+
}
|
229
|
+
}
|
230
|
+
},
|
231
|
+
"required": false,
|
232
|
+
"optional": false,
|
233
|
+
"docs": {
|
234
|
+
"tags": [],
|
235
|
+
"text": "esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html"
|
236
|
+
}
|
237
|
+
},
|
238
|
+
"selectedLayerId": {
|
239
|
+
"type": "string",
|
240
|
+
"mutable": false,
|
241
|
+
"complexType": {
|
242
|
+
"original": "string",
|
243
|
+
"resolved": "string",
|
244
|
+
"references": {}
|
245
|
+
},
|
246
|
+
"required": false,
|
247
|
+
"optional": false,
|
248
|
+
"docs": {
|
249
|
+
"tags": [],
|
250
|
+
"text": "string: Layer id of the feature layer in which the new feature is to be created"
|
251
|
+
},
|
252
|
+
"attribute": "selected-layer-id",
|
253
|
+
"reflect": false
|
254
|
+
}
|
255
|
+
};
|
256
|
+
}
|
257
|
+
static get events() {
|
258
|
+
return [{
|
259
|
+
"method": "success",
|
260
|
+
"name": "success",
|
261
|
+
"bubbles": true,
|
262
|
+
"cancelable": true,
|
263
|
+
"composed": true,
|
264
|
+
"docs": {
|
265
|
+
"tags": [],
|
266
|
+
"text": "Emitted on demand when the feature is created successfully"
|
267
|
+
},
|
268
|
+
"complexType": {
|
269
|
+
"original": "void",
|
270
|
+
"resolved": "void",
|
271
|
+
"references": {}
|
272
|
+
}
|
273
|
+
}, {
|
274
|
+
"method": "fail",
|
275
|
+
"name": "fail",
|
276
|
+
"bubbles": true,
|
277
|
+
"cancelable": true,
|
278
|
+
"composed": true,
|
279
|
+
"docs": {
|
280
|
+
"tags": [],
|
281
|
+
"text": "Emitted on demand when the feature creation is failed"
|
282
|
+
},
|
283
|
+
"complexType": {
|
284
|
+
"original": "Error",
|
285
|
+
"resolved": "Error",
|
286
|
+
"references": {
|
287
|
+
"Error": {
|
288
|
+
"location": "global",
|
289
|
+
"id": "global::Error"
|
290
|
+
}
|
291
|
+
}
|
292
|
+
}
|
293
|
+
}, {
|
294
|
+
"method": "drawComplete",
|
295
|
+
"name": "drawComplete",
|
296
|
+
"bubbles": true,
|
297
|
+
"cancelable": true,
|
298
|
+
"composed": true,
|
299
|
+
"docs": {
|
300
|
+
"tags": [],
|
301
|
+
"text": "Emitted on demand when drawing is completed"
|
302
|
+
},
|
303
|
+
"complexType": {
|
304
|
+
"original": "void",
|
305
|
+
"resolved": "void",
|
306
|
+
"references": {}
|
307
|
+
}
|
308
|
+
}];
|
309
|
+
}
|
310
|
+
static get methods() {
|
311
|
+
return {
|
312
|
+
"close": {
|
313
|
+
"complexType": {
|
314
|
+
"signature": "() => Promise<void>",
|
315
|
+
"parameters": [],
|
316
|
+
"references": {
|
317
|
+
"Promise": {
|
318
|
+
"location": "global",
|
319
|
+
"id": "global::Promise"
|
320
|
+
}
|
321
|
+
},
|
322
|
+
"return": "Promise<void>"
|
323
|
+
},
|
324
|
+
"docs": {
|
325
|
+
"text": "Destroy the Editor widget instance",
|
326
|
+
"tags": [{
|
327
|
+
"name": "returns",
|
328
|
+
"text": "Promise that resolves when the operation is complete"
|
329
|
+
}]
|
330
|
+
}
|
331
|
+
},
|
332
|
+
"submit": {
|
333
|
+
"complexType": {
|
334
|
+
"signature": "() => Promise<void>",
|
335
|
+
"parameters": [],
|
336
|
+
"references": {
|
337
|
+
"Promise": {
|
338
|
+
"location": "global",
|
339
|
+
"id": "global::Promise"
|
340
|
+
}
|
341
|
+
},
|
342
|
+
"return": "Promise<void>"
|
343
|
+
},
|
344
|
+
"docs": {
|
345
|
+
"text": "Submit the created feature",
|
346
|
+
"tags": [{
|
347
|
+
"name": "returns",
|
348
|
+
"text": "Promise that resolves when the operation is complete"
|
349
|
+
}]
|
350
|
+
}
|
351
|
+
}
|
352
|
+
};
|
353
|
+
}
|
354
|
+
static get elementRef() { return "el"; }
|
355
|
+
static get watchers() {
|
356
|
+
return [{
|
357
|
+
"propName": "mapView",
|
358
|
+
"methodName": "mapViewWatchHandler"
|
359
|
+
}];
|
360
|
+
}
|
361
|
+
}
|