@esri/solutions-components 0.7.30 → 0.7.32
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 +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} +286 -19
- package/dist/cjs/card-manager_3.cjs.entry.js +1 -1
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +248 -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 +50 -0
- package/dist/collection/components/create-feature/create-feature.js +444 -0
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.css +10 -1
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +287 -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/create-feature.html +90 -0
- 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 +278 -0
- package/dist/components/crowdsource-reporter.js +324 -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} +286 -20
- package/dist/esm/card-manager_3.entry.js +1 -1
- package/dist/esm/crowdsource-reporter.entry.js +249 -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/create-feature.html +90 -0
- 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-d5263cb9.entry.js +17 -0
- package/dist/solutions-components/p-ea17cefb.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 +125 -0
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +146 -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 +102 -0
- package/dist/types/preact.d.ts +7 -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
|
@@ -2859,7 +2859,7 @@ function _prepareAttributeValue(attributeValue, attributeType, attributeDomain,
|
|
|
2859
2859
|
if (attributeDomain && attributeDomain.type === "coded-value") {
|
|
2860
2860
|
// "coded-value" domain field
|
|
2861
2861
|
const value = attributeDomain.getName(attributeValue);
|
|
2862
|
-
return value.toString();
|
|
2862
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
|
2863
2863
|
}
|
|
2864
2864
|
else {
|
|
2865
2865
|
// Non-domain field or unsupported domain type
|
|
@@ -91,6 +91,7 @@ const FeatureList = /*@__PURE__*/ proxyCustomElement(class FeatureList extends H
|
|
|
91
91
|
//--------------------------------------------------------------------------
|
|
92
92
|
/**
|
|
93
93
|
* Initialize the features list using the selected layer
|
|
94
|
+
* @protected
|
|
94
95
|
*/
|
|
95
96
|
async initializeFeatureItems() {
|
|
96
97
|
if (this._selectedLayer) {
|
|
@@ -39,6 +39,23 @@ const LayerList = /*@__PURE__*/ proxyCustomElement(class LayerList extends HTMLE
|
|
|
39
39
|
}
|
|
40
40
|
//--------------------------------------------------------------------------
|
|
41
41
|
//
|
|
42
|
+
// Watch handlers
|
|
43
|
+
//
|
|
44
|
+
//--------------------------------------------------------------------------
|
|
45
|
+
//--------------------------------------------------------------------------
|
|
46
|
+
//
|
|
47
|
+
// Methods (public)
|
|
48
|
+
//
|
|
49
|
+
//--------------------------------------------------------------------------
|
|
50
|
+
/**
|
|
51
|
+
* Refresh the layer list which will fetch the latest layer count and update the list
|
|
52
|
+
* @returns Promise that resolves when the operation is complete
|
|
53
|
+
*/
|
|
54
|
+
async refresh() {
|
|
55
|
+
await this.setLayers();
|
|
56
|
+
}
|
|
57
|
+
//--------------------------------------------------------------------------
|
|
58
|
+
//
|
|
42
59
|
// Functions (lifecycle)
|
|
43
60
|
//
|
|
44
61
|
//--------------------------------------------------------------------------
|
|
@@ -63,7 +80,7 @@ const LayerList = /*@__PURE__*/ proxyCustomElement(class LayerList extends HTMLE
|
|
|
63
80
|
render() {
|
|
64
81
|
return (h(Fragment, null, this._isLoading && h("calcite-loader", { scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
|
|
65
82
|
h("calcite-notice", { class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, h("div", { slot: "title" }, this._translations.error), h("div", { slot: "message" }, this.noLayerErrorMsg ? this.noLayerErrorMsg : this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
|
|
66
|
-
h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single" }, this.renderLayerList())));
|
|
83
|
+
h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single-persist" }, this.renderLayerList())));
|
|
67
84
|
}
|
|
68
85
|
//--------------------------------------------------------------------------
|
|
69
86
|
//
|
|
@@ -90,21 +107,24 @@ const LayerList = /*@__PURE__*/ proxyCustomElement(class LayerList extends HTMLE
|
|
|
90
107
|
this._layerItemsHash = await getMapLayerHash(this.mapView, true);
|
|
91
108
|
const allMapLayers = await getAllLayers(this.mapView);
|
|
92
109
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
93
|
-
|
|
110
|
+
allMapLayers.forEach(async (eachLayer) => {
|
|
94
111
|
var _a, _b;
|
|
95
112
|
//TODO: checking editable condition could be configurable
|
|
96
|
-
if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
113
|
+
if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.supportsAdd)) {
|
|
114
|
+
this._layerItemsHash[eachLayer.id].supportsAdd = true;
|
|
115
|
+
if (this.showFeatureCount) {
|
|
116
|
+
const q = eachLayer.createQuery();
|
|
117
|
+
const result = eachLayer.queryFeatureCount(q);
|
|
118
|
+
def.push(result);
|
|
119
|
+
void result.then(async (resCount) => {
|
|
120
|
+
const formattedCount = !isNaN(resCount) ? await formatNumber(resCount, {
|
|
121
|
+
places: 0,
|
|
122
|
+
api: 4,
|
|
123
|
+
type: "decimal"
|
|
124
|
+
}) : "";
|
|
125
|
+
this._layerItemsHash[eachLayer.id].formattedFeatureCount = formattedCount;
|
|
126
|
+
});
|
|
127
|
+
}
|
|
108
128
|
}
|
|
109
129
|
});
|
|
110
130
|
await Promise.all(def).then(() => {
|
|
@@ -132,9 +152,9 @@ const LayerList = /*@__PURE__*/ proxyCustomElement(class LayerList extends HTMLE
|
|
|
132
152
|
var _a;
|
|
133
153
|
const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
|
|
134
154
|
return Object.keys(hash).reduce((prev, cur) => {
|
|
135
|
-
let showLayer = hash[cur].
|
|
155
|
+
let showLayer = hash[cur].supportsAdd;
|
|
136
156
|
if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
|
|
137
|
-
showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].
|
|
157
|
+
showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
|
|
138
158
|
}
|
|
139
159
|
if (showLayer) {
|
|
140
160
|
prev.push(cur);
|
|
@@ -193,7 +213,8 @@ const LayerList = /*@__PURE__*/ proxyCustomElement(class LayerList extends HTMLE
|
|
|
193
213
|
"_noLayersToDisplay": [32],
|
|
194
214
|
"_mapLayerIds": [32],
|
|
195
215
|
"_isLoading": [32],
|
|
196
|
-
"_translations": [32]
|
|
216
|
+
"_translations": [32],
|
|
217
|
+
"refresh": [64]
|
|
197
218
|
}]);
|
|
198
219
|
function defineCustomElement() {
|
|
199
220
|
if (typeof customElements === "undefined") {
|
|
@@ -11,16 +11,16 @@ import { c as connectInteractive, u as updateHostInteraction, d as disconnectInt
|
|
|
11
11
|
import { c as connectLocalized, d as disconnectLocalized } from './locale-6107ef11.js';
|
|
12
12
|
import { c as connectMessages, s as setUpMessages, d as disconnectMessages, u as updateMessages } from './t9n-f16911e7.js';
|
|
13
13
|
import { S as SLOTS$1 } from './resources-649a0f91.js';
|
|
14
|
+
import { l as loadModules, g as getLocaleComponentStrings, f as formatNumber } from './locale-731e75a8.js';
|
|
15
|
+
import { a as getAllLayers, g as getLayerOrTable, c as getFeatureLayerView, h as highlightFeatures, d as getMapLayerHash } from './mapViewUtils-cf05e880.js';
|
|
14
16
|
import { P as PopupUtils } from './popupUtils-d75edf93.js';
|
|
15
|
-
import { g as getLayerOrTable, c as getFeatureLayerView, h as highlightFeatures, d as getMapLayerHash, a as getAllLayers } from './mapViewUtils-cf05e880.js';
|
|
16
|
-
import { g as getLocaleComponentStrings, f as formatNumber } from './locale-731e75a8.js';
|
|
17
17
|
import './guid-36c6c6a5.js';
|
|
18
18
|
import './resources-cdc36705.js';
|
|
19
19
|
import './browser-b4c16201.js';
|
|
20
20
|
import './key-af303047.js';
|
|
21
|
-
import './interfaces-586e863c.js';
|
|
22
21
|
import './esri-loader-eda07632.js';
|
|
23
22
|
import './_commonjsHelpers-d5f9d613.js';
|
|
23
|
+
import './interfaces-586e863c.js';
|
|
24
24
|
|
|
25
25
|
/*!
|
|
26
26
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
@@ -335,6 +335,251 @@ const FlowItem = class {
|
|
|
335
335
|
};
|
|
336
336
|
FlowItem.style = flowItemCss;
|
|
337
337
|
|
|
338
|
+
const createFeatureCss = ":host{display:block}.esri-editor__panel-toolbar{display:none !important}.esri-editor__update-actions{display:none !important}.esri-editor__panel-content{padding-block:0px !important}.esri-editor .esri-item-list__group__header{display:none !important}.esri-editor__panel-content__section .esri-widget__heading{display:none !important}.esri-editor .esri-item-list__filter-container--sticky{padding-block:0px !important;padding-inline:10px !important}";
|
|
339
|
+
|
|
340
|
+
const CreateFeature = class {
|
|
341
|
+
constructor(hostRef) {
|
|
342
|
+
registerInstance(this, hostRef);
|
|
343
|
+
this.success = createEvent(this, "success", 7);
|
|
344
|
+
this.fail = createEvent(this, "fail", 7);
|
|
345
|
+
this.drawComplete = createEvent(this, "drawComplete", 7);
|
|
346
|
+
this.editingAttachment = createEvent(this, "editingAttachment", 7);
|
|
347
|
+
this.mapView = undefined;
|
|
348
|
+
this.selectedLayerId = undefined;
|
|
349
|
+
this.customizeSubmit = false;
|
|
350
|
+
}
|
|
351
|
+
//--------------------------------------------------------------------------
|
|
352
|
+
//
|
|
353
|
+
// Watch handlers
|
|
354
|
+
//
|
|
355
|
+
//--------------------------------------------------------------------------
|
|
356
|
+
/**
|
|
357
|
+
* Called each time the mapView prop is changed.
|
|
358
|
+
*/
|
|
359
|
+
async mapViewWatchHandler() {
|
|
360
|
+
await this.mapView.when(async () => {
|
|
361
|
+
await this.init();
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
//--------------------------------------------------------------------------
|
|
365
|
+
//
|
|
366
|
+
// Methods (public)
|
|
367
|
+
//
|
|
368
|
+
//--------------------------------------------------------------------------
|
|
369
|
+
/**
|
|
370
|
+
* Destroy the Editor widget instance
|
|
371
|
+
* @returns Promise that resolves when the operation is complete
|
|
372
|
+
*/
|
|
373
|
+
async close() {
|
|
374
|
+
if (this._editor) {
|
|
375
|
+
this._editor.destroy();
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Submit the created feature
|
|
380
|
+
* @returns Promise that resolves when the operation is complete
|
|
381
|
+
*/
|
|
382
|
+
async submit() {
|
|
383
|
+
if (this._editor) {
|
|
384
|
+
this._editor.viewModel.featureFormViewModel.submit();
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
//--------------------------------------------------------------------------
|
|
388
|
+
//
|
|
389
|
+
// Functions (lifecycle)
|
|
390
|
+
//
|
|
391
|
+
//--------------------------------------------------------------------------
|
|
392
|
+
/**
|
|
393
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
|
394
|
+
* @returns Promise when complete
|
|
395
|
+
*/
|
|
396
|
+
async componentWillLoad() {
|
|
397
|
+
await this.initModules();
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
|
401
|
+
*/
|
|
402
|
+
async componentDidLoad() {
|
|
403
|
+
await this.init();
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Renders the component.
|
|
407
|
+
*/
|
|
408
|
+
render() {
|
|
409
|
+
return (h(Host, { id: "feature-form" }));
|
|
410
|
+
}
|
|
411
|
+
//--------------------------------------------------------------------------
|
|
412
|
+
//
|
|
413
|
+
// Functions (protected)
|
|
414
|
+
//
|
|
415
|
+
//--------------------------------------------------------------------------
|
|
416
|
+
/**
|
|
417
|
+
* Init Editor widget and starts the create workflow
|
|
418
|
+
*/
|
|
419
|
+
async init() {
|
|
420
|
+
if (this.mapView && this.selectedLayerId) {
|
|
421
|
+
await this.createEditorWidget();
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Load esri javascript api modules
|
|
426
|
+
* @returns Promise resolving when function is done
|
|
427
|
+
* @protected
|
|
428
|
+
*/
|
|
429
|
+
async initModules() {
|
|
430
|
+
const [Editor, reactiveUtils] = await loadModules([
|
|
431
|
+
"esri/widgets/Editor",
|
|
432
|
+
"esri/core/reactiveUtils"
|
|
433
|
+
]);
|
|
434
|
+
this.Editor = Editor;
|
|
435
|
+
this.reactiveUtils = reactiveUtils;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Display editor widget to create the new feature
|
|
439
|
+
* @protected
|
|
440
|
+
*/
|
|
441
|
+
async createEditorWidget() {
|
|
442
|
+
if (this._editor) {
|
|
443
|
+
this._editor.destroy();
|
|
444
|
+
}
|
|
445
|
+
const layerInfos = [];
|
|
446
|
+
const container = document.createElement("div");
|
|
447
|
+
const allMapLayers = await getAllLayers(this.mapView);
|
|
448
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
449
|
+
allMapLayers.forEach(async (eachLayer) => {
|
|
450
|
+
layerInfos.push({
|
|
451
|
+
layer: eachLayer,
|
|
452
|
+
enabled: (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.id) === this.selectedLayerId,
|
|
453
|
+
addEnabled: true,
|
|
454
|
+
updateEnabled: false,
|
|
455
|
+
deleteEnabled: false // default is true, set to false to disable the ability to delete features
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
this._editor = new this.Editor({
|
|
459
|
+
allowedWorkflows: "create-features",
|
|
460
|
+
view: this.mapView,
|
|
461
|
+
layerInfos: layerInfos,
|
|
462
|
+
visibleElements: {
|
|
463
|
+
snappingControls: false
|
|
464
|
+
},
|
|
465
|
+
container
|
|
466
|
+
});
|
|
467
|
+
this.el.appendChild(container);
|
|
468
|
+
//Add handle to watch if attachments are added/edited
|
|
469
|
+
const attachmentHandle = this.reactiveUtils.watch(() => this._editor.viewModel.state, (state) => {
|
|
470
|
+
if (state === 'adding-attachment' || state === 'editing-attachment') {
|
|
471
|
+
this._addingAttachment = true;
|
|
472
|
+
this.editingAttachment.emit(true);
|
|
473
|
+
}
|
|
474
|
+
else {
|
|
475
|
+
if (this._addingAttachment) {
|
|
476
|
+
this.editingAttachment.emit(false);
|
|
477
|
+
this._addingAttachment = false;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
this._editor.viewModel.addHandles(attachmentHandle);
|
|
482
|
+
//Add handle to watch featureTemplatesViewModel ready state and then start the creation
|
|
483
|
+
const handle = this.reactiveUtils.watch(() => this._editor.viewModel.featureTemplatesViewModel.state, (state) => {
|
|
484
|
+
if (state === 'ready') {
|
|
485
|
+
void this.startCreate();
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
this._editor.viewModel.addHandles(handle);
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Start creating the feature
|
|
492
|
+
* @protected
|
|
493
|
+
*/
|
|
494
|
+
async startCreate() {
|
|
495
|
+
var _a;
|
|
496
|
+
if ((_a = this._editor.viewModel.featureTemplatesViewModel.items) === null || _a === void 0 ? void 0 : _a.length) {
|
|
497
|
+
const items = this._editor.viewModel.featureTemplatesViewModel.items[0].get("items");
|
|
498
|
+
//once the feature template is selected handle the event for formSubmit and sketch complete
|
|
499
|
+
//also, hide the headers and footer in the editor as we will be showing our own submit and cancel button
|
|
500
|
+
this._editor.viewModel.featureTemplatesViewModel.on('select', () => {
|
|
501
|
+
setTimeout(() => {
|
|
502
|
+
//on form submit
|
|
503
|
+
this._editor.viewModel.featureFormViewModel.on('submit', this.submitted.bind(this));
|
|
504
|
+
//on sketch complete emit the event
|
|
505
|
+
this._editor.viewModel.sketchViewModel.on("create", (evt) => {
|
|
506
|
+
if (evt.state === "complete") {
|
|
507
|
+
this.drawComplete.emit();
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
this.hideEditorsElements();
|
|
511
|
+
}, 700);
|
|
512
|
+
this.hideEditorsElements();
|
|
513
|
+
});
|
|
514
|
+
//if only one feature template then directly start geometry creation for that
|
|
515
|
+
//else allow feature template selection to user
|
|
516
|
+
if (items.length === 1) {
|
|
517
|
+
this._editor.viewModel.featureTemplatesViewModel.select(items[0]);
|
|
518
|
+
}
|
|
519
|
+
//hides the header and footer elements in editor widget
|
|
520
|
+
this.hideEditorsElements();
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* Hides the elements of editor widget
|
|
525
|
+
* @protected
|
|
526
|
+
*/
|
|
527
|
+
hideEditorsElements() {
|
|
528
|
+
if (!this.customizeSubmit) {
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
531
|
+
setTimeout(() => {
|
|
532
|
+
var _a;
|
|
533
|
+
//hides the header and footer on the featureForm
|
|
534
|
+
(_a = this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')) === null || _a === void 0 ? void 0 : _a.forEach((flowItem) => {
|
|
535
|
+
var _a, _b, _c, _d, _e;
|
|
536
|
+
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');
|
|
537
|
+
//hide the header
|
|
538
|
+
(_d = article === null || article === void 0 ? void 0 : article.querySelector('header')) === null || _d === void 0 ? void 0 : _d.setAttribute('style', 'display: none');
|
|
539
|
+
//hide the footer
|
|
540
|
+
(_e = article === null || article === void 0 ? void 0 : article.querySelector('footer')) === null || _e === void 0 ? void 0 : _e.setAttribute('style', 'display: none');
|
|
541
|
+
});
|
|
542
|
+
}, 700);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* On creation of feature emit the event that the feature is created
|
|
546
|
+
* @param evt feature submit event
|
|
547
|
+
* @protected
|
|
548
|
+
*/
|
|
549
|
+
async submitted(evt) {
|
|
550
|
+
var _a;
|
|
551
|
+
//return if any attribute is invalid , focus will be shifted to the invalid attribute in feature form
|
|
552
|
+
if (evt.invalid.length) {
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
//Submit only when valid attributes
|
|
556
|
+
//emit success or fail based on the result
|
|
557
|
+
if (evt.valid.length) {
|
|
558
|
+
try {
|
|
559
|
+
await this._editor.activeWorkflow.commit();
|
|
560
|
+
//throw errors if any failures
|
|
561
|
+
if ((_a = this._editor.viewModel.failures) === null || _a === void 0 ? void 0 : _a.length) {
|
|
562
|
+
this._editor.viewModel.failures.some((failure) => {
|
|
563
|
+
if (failure.error) {
|
|
564
|
+
throw (failure.error);
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
catch (e) {
|
|
570
|
+
this.fail.emit(e);
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
this.success.emit();
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
get el() { return getElement(this); }
|
|
577
|
+
static get watchers() { return {
|
|
578
|
+
"mapView": ["mapViewWatchHandler"]
|
|
579
|
+
}; }
|
|
580
|
+
};
|
|
581
|
+
CreateFeature.style = createFeatureCss;
|
|
582
|
+
|
|
338
583
|
const featureListCss = ":host{display:block}.width-full{width:100%}.pagination{display:flex;justify-content:center}.error-msg{padding:10px;width:calc(100% - 20px)}.popup-title{font-weight:500;padding:10px 12px}";
|
|
339
584
|
|
|
340
585
|
const FeatureList = class {
|
|
@@ -401,6 +646,7 @@ const FeatureList = class {
|
|
|
401
646
|
//--------------------------------------------------------------------------
|
|
402
647
|
/**
|
|
403
648
|
* Initialize the features list using the selected layer
|
|
649
|
+
* @protected
|
|
404
650
|
*/
|
|
405
651
|
async initializeFeatureItems() {
|
|
406
652
|
if (this._selectedLayer) {
|
|
@@ -534,6 +780,23 @@ const LayerList = class {
|
|
|
534
780
|
}
|
|
535
781
|
//--------------------------------------------------------------------------
|
|
536
782
|
//
|
|
783
|
+
// Watch handlers
|
|
784
|
+
//
|
|
785
|
+
//--------------------------------------------------------------------------
|
|
786
|
+
//--------------------------------------------------------------------------
|
|
787
|
+
//
|
|
788
|
+
// Methods (public)
|
|
789
|
+
//
|
|
790
|
+
//--------------------------------------------------------------------------
|
|
791
|
+
/**
|
|
792
|
+
* Refresh the layer list which will fetch the latest layer count and update the list
|
|
793
|
+
* @returns Promise that resolves when the operation is complete
|
|
794
|
+
*/
|
|
795
|
+
async refresh() {
|
|
796
|
+
await this.setLayers();
|
|
797
|
+
}
|
|
798
|
+
//--------------------------------------------------------------------------
|
|
799
|
+
//
|
|
537
800
|
// Functions (lifecycle)
|
|
538
801
|
//
|
|
539
802
|
//--------------------------------------------------------------------------
|
|
@@ -558,7 +821,7 @@ const LayerList = class {
|
|
|
558
821
|
render() {
|
|
559
822
|
return (h(Fragment, null, this._isLoading && h("calcite-loader", { scale: "m" }), !this._isLoading && this.mapView && this._noLayersToDisplay &&
|
|
560
823
|
h("calcite-notice", { class: "error-msg", icon: "layers-reference", kind: "danger", open: true }, h("div", { slot: "title" }, this._translations.error), h("div", { slot: "message" }, this.noLayerErrorMsg ? this.noLayerErrorMsg : this._translations.noLayerToDisplayErrorMsg)), !this._isLoading && this.mapView &&
|
|
561
|
-
h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single" }, this.renderLayerList())));
|
|
824
|
+
h("calcite-list", { "selection-appearance": "border", "selection-mode": this.showNextIcon ? "none" : "single-persist" }, this.renderLayerList())));
|
|
562
825
|
}
|
|
563
826
|
//--------------------------------------------------------------------------
|
|
564
827
|
//
|
|
@@ -585,21 +848,24 @@ const LayerList = class {
|
|
|
585
848
|
this._layerItemsHash = await getMapLayerHash(this.mapView, true);
|
|
586
849
|
const allMapLayers = await getAllLayers(this.mapView);
|
|
587
850
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
588
|
-
|
|
851
|
+
allMapLayers.forEach(async (eachLayer) => {
|
|
589
852
|
var _a, _b;
|
|
590
853
|
//TODO: checking editable condition could be configurable
|
|
591
|
-
if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
854
|
+
if ((eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.editingEnabled) && ((_b = (_a = eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.capabilities) === null || _a === void 0 ? void 0 : _a.operations) === null || _b === void 0 ? void 0 : _b.supportsAdd)) {
|
|
855
|
+
this._layerItemsHash[eachLayer.id].supportsAdd = true;
|
|
856
|
+
if (this.showFeatureCount) {
|
|
857
|
+
const q = eachLayer.createQuery();
|
|
858
|
+
const result = eachLayer.queryFeatureCount(q);
|
|
859
|
+
def.push(result);
|
|
860
|
+
void result.then(async (resCount) => {
|
|
861
|
+
const formattedCount = !isNaN(resCount) ? await formatNumber(resCount, {
|
|
862
|
+
places: 0,
|
|
863
|
+
api: 4,
|
|
864
|
+
type: "decimal"
|
|
865
|
+
}) : "";
|
|
866
|
+
this._layerItemsHash[eachLayer.id].formattedFeatureCount = formattedCount;
|
|
867
|
+
});
|
|
868
|
+
}
|
|
603
869
|
}
|
|
604
870
|
});
|
|
605
871
|
await Promise.all(def).then(() => {
|
|
@@ -627,9 +893,9 @@ const LayerList = class {
|
|
|
627
893
|
var _a;
|
|
628
894
|
const configuredLayers = ((_a = this.layers) === null || _a === void 0 ? void 0 : _a.length) > 0 ? this.layers : [];
|
|
629
895
|
return Object.keys(hash).reduce((prev, cur) => {
|
|
630
|
-
let showLayer = hash[cur].
|
|
896
|
+
let showLayer = hash[cur].supportsAdd;
|
|
631
897
|
if ((configuredLayers === null || configuredLayers === void 0 ? void 0 : configuredLayers.length) > 0) {
|
|
632
|
-
showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].
|
|
898
|
+
showLayer = configuredLayers.indexOf(cur) > -1 ? hash[cur].supportsAdd : false;
|
|
633
899
|
}
|
|
634
900
|
if (showLayer) {
|
|
635
901
|
prev.push(cur);
|
|
@@ -681,4 +947,4 @@ const LayerList = class {
|
|
|
681
947
|
};
|
|
682
948
|
LayerList.style = layerListCss;
|
|
683
949
|
|
|
684
|
-
export { Flow as calcite_flow, FlowItem as calcite_flow_item, FeatureList as feature_list, LayerList as layer_list };
|
|
950
|
+
export { Flow as calcite_flow, FlowItem as calcite_flow_item, CreateFeature as create_feature, FeatureList as feature_list, LayerList as layer_list };
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { r as registerInstance, h, H as Host, g as getElement, c as createEvent } from './index-7183ce4a.js';
|
|
7
7
|
import { g as getLocaleComponentStrings, l as loadModules } from './locale-731e75a8.js';
|
|
8
8
|
import { q as queryFeaturesByID, g as getLayerOrTable, b as goToSelection, e as queryAllIds, f as queryFeatureIds, i as queryFeaturesByGlobalID } from './mapViewUtils-cf05e880.js';
|
|
9
|
-
import { d as downloadCSV } from './downloadUtils-
|
|
9
|
+
import { d as downloadCSV } from './downloadUtils-d297078f.js';
|
|
10
10
|
import './esri-loader-eda07632.js';
|
|
11
11
|
import './_commonjsHelpers-d5f9d613.js';
|
|
12
12
|
import './interfaces-586e863c.js';
|