@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.
- 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
@@ -0,0 +1,90 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<meta charset="utf-8" />
|
4
|
+
<meta
|
5
|
+
name="viewport"
|
6
|
+
content="initial-scale=1,maximum-scale=1,user-scalable=no"
|
7
|
+
/>
|
8
|
+
<title>Create Feature</title>
|
9
|
+
<!--
|
10
|
+
| Copyright 2022 Esri
|
11
|
+
|
|
12
|
+
| Licensed under the Apache License, Version 2.0 (the "License");
|
13
|
+
| you may not use this file except in compliance with the License.
|
14
|
+
| You may obtain a copy of the License at
|
15
|
+
|
|
16
|
+
| http://www.apache.org/licenses/LICENSE-2.0
|
17
|
+
|
|
18
|
+
| Unless required by applicable law or agreed to in writing, software
|
19
|
+
| distributed under the License is distributed on an "AS IS" BASIS,
|
20
|
+
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
21
|
+
| See the License for the specific language governing permissions and
|
22
|
+
| limitations under the License.
|
23
|
+
-->
|
24
|
+
<style>
|
25
|
+
#viewDiv {
|
26
|
+
padding: 0;
|
27
|
+
margin: 0;
|
28
|
+
height: 100%;
|
29
|
+
width: calc(100% - 402px);
|
30
|
+
}
|
31
|
+
|
32
|
+
.over-map {
|
33
|
+
position: absolute;
|
34
|
+
top: 0;
|
35
|
+
right: 0px;
|
36
|
+
background-color: var(--calcite-color-foreground-1);
|
37
|
+
}
|
38
|
+
|
39
|
+
.column {
|
40
|
+
width: 400px;
|
41
|
+
height: 100%;
|
42
|
+
border: 1px solid var(--calcite-color-border-2);
|
43
|
+
}
|
44
|
+
|
45
|
+
.column[dir="rtl"] {
|
46
|
+
float: left;
|
47
|
+
}
|
48
|
+
|
49
|
+
.full-height {
|
50
|
+
height: 100%;
|
51
|
+
}
|
52
|
+
</style>
|
53
|
+
|
54
|
+
<link rel="stylesheet" href="https://jsdev.arcgis.com/4.29/esri/themes/light/main.css" />
|
55
|
+
<link rel="stylesheet" href="https://webapps-cdn.esri.com/CDN/fonts/v1.4.1/fonts.css" />
|
56
|
+
<link rel="stylesheet" href="../solutions-components.css" type="text/css">
|
57
|
+
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/2.0.0/calcite.css" />
|
58
|
+
|
59
|
+
<script src="https://jsdev.arcgis.com/4.29/"></script>
|
60
|
+
<script type="module" src="../solutions-components.esm.js"></script>
|
61
|
+
|
62
|
+
<script>
|
63
|
+
require(["esri/WebMap", "esri/views/MapView"], (
|
64
|
+
WebMap,
|
65
|
+
MapView
|
66
|
+
) => {
|
67
|
+
var webMap = new WebMap({
|
68
|
+
portalItem: {
|
69
|
+
id: "024e8a5e73a34c5aade9632d651c5750"
|
70
|
+
}
|
71
|
+
});
|
72
|
+
var view = new MapView({
|
73
|
+
container: "viewDiv",
|
74
|
+
map: webMap
|
75
|
+
});
|
76
|
+
|
77
|
+
view.when(function () {
|
78
|
+
const demo = document.getElementById("demo");
|
79
|
+
demo.mapView = view;
|
80
|
+
demo.selectedLayerId = 'SE_attch_7327';
|
81
|
+
})
|
82
|
+
});
|
83
|
+
</script>
|
84
|
+
</head>
|
85
|
+
|
86
|
+
<body>
|
87
|
+
<div id="viewDiv"></div>
|
88
|
+
<create-feature id="demo" class="over-map column full-height"></create-feature>
|
89
|
+
</body>
|
90
|
+
</html>
|
@@ -93,23 +93,38 @@
|
|
93
93
|
const demo = document.getElementById("demo");
|
94
94
|
let custom = null;
|
95
95
|
let portal;
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
switch (
|
96
|
+
let locale = 'en'
|
97
|
+
//Support webmap, portal and locale URL parameter
|
98
|
+
//Also, set search params to reporter component - layerId, objectId, center, level etc.
|
99
|
+
let urlObj = new URL(window.location)
|
100
|
+
for (const [key, value] of urlObj.searchParams.entries()) {
|
101
|
+
switch (key) {
|
102
102
|
case "webmap":
|
103
103
|
custom = {
|
104
|
-
id:
|
104
|
+
id: value
|
105
105
|
};
|
106
106
|
break;
|
107
107
|
case "portal":
|
108
|
-
portal =
|
109
|
-
|
108
|
+
portal = value;
|
109
|
+
break;
|
110
|
+
case "locale":
|
111
|
+
locale = value;
|
112
|
+
break;
|
113
|
+
case 'layerid':
|
114
|
+
demo.layerId = value;
|
115
|
+
break;
|
116
|
+
case 'oid':
|
117
|
+
demo.objectId = value;
|
118
|
+
case 'center' || 'level':
|
119
|
+
demo[key] = value;
|
110
120
|
break;
|
111
121
|
}
|
112
|
-
}
|
122
|
+
}
|
123
|
+
|
124
|
+
// Set the locale before the JSAPI loads
|
125
|
+
esriConfig.locale = locale;
|
126
|
+
demo.lang = locale;
|
127
|
+
|
113
128
|
//update the portalUrl if found in urlParams
|
114
129
|
//esriConfig.portalUrl = "https://solutions.mapsdevext.arcgis.com";
|
115
130
|
if (portal) {
|
@@ -117,7 +132,6 @@
|
|
117
132
|
}
|
118
133
|
|
119
134
|
let portalItem = {
|
120
|
-
//id: "b5bdcb1e5d684dd3b21a2d44b8e4f928"
|
121
135
|
//id: "f8c4d99deb3c483cac296cc261e18a25", //blank no layers
|
122
136
|
//id: "a7e880f7afbb471991d43c8c4f1438ac" // Se mapping
|
123
137
|
//id: "c720e337ff814fe4a83bc244c46f8e43" //15 Layers
|
@@ -125,6 +139,7 @@
|
|
125
139
|
//id: "dda88d905a6748a5ab46bea5be795f33" // screening layers
|
126
140
|
id: "b5bdcb1e5d684dd3b21a2d44b8e4f928" //Popup content
|
127
141
|
//id: "d399ec39959a4aac8617ae4f05dd6785" //Arcade
|
142
|
+
//id: "024e8a5e73a34c5aade9632d651c5750" //Attachments
|
128
143
|
}
|
129
144
|
const webMap = new WebMap({
|
130
145
|
portalItem: custom ?? portalItem
|
@@ -540,7 +540,7 @@ export function _prepareAttributeValue(attributeValue, attributeType, attributeD
|
|
540
540
|
if (attributeDomain && attributeDomain.type === "coded-value") {
|
541
541
|
// "coded-value" domain field
|
542
542
|
const value = attributeDomain.getName(attributeValue);
|
543
|
-
return value.toString();
|
543
|
+
return value === null || value === void 0 ? void 0 : value.toString();
|
544
544
|
}
|
545
545
|
else {
|
546
546
|
// Non-domain field or unsupported domain type
|
@@ -769,7 +769,7 @@ export function _prepareAttributeValue(
|
|
769
769
|
if (attributeDomain && (attributeDomain as __esri.CodedValueDomain).type === "coded-value") {
|
770
770
|
// "coded-value" domain field
|
771
771
|
const value = (attributeDomain as __esri.CodedValueDomain).getName(attributeValue);
|
772
|
-
return value
|
772
|
+
return value?.toString();
|
773
773
|
} else {
|
774
774
|
// Non-domain field or unsupported domain type
|
775
775
|
let value = attributeValue;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
2
|
+
|
3
|
+
interface CreateFeature extends Components.CreateFeature, HTMLElement {}
|
4
|
+
export const CreateFeature: {
|
5
|
+
prototype: CreateFeature;
|
6
|
+
new (): CreateFeature;
|
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 { C as CreateFeature$1, d as defineCustomElement$1 } from './create-feature2.js';
|
7
|
+
|
8
|
+
const CreateFeature = CreateFeature$1;
|
9
|
+
const defineCustomElement = defineCustomElement$1;
|
10
|
+
|
11
|
+
export { CreateFeature, defineCustomElement };
|
@@ -0,0 +1,278 @@
|
|
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, Host } from '@stencil/core/internal/client';
|
7
|
+
import { l as loadModules } from './loadModules.js';
|
8
|
+
import { a as getAllLayers } from './mapViewUtils.js';
|
9
|
+
|
10
|
+
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}";
|
11
|
+
|
12
|
+
const CreateFeature = /*@__PURE__*/ proxyCustomElement(class CreateFeature extends HTMLElement {
|
13
|
+
constructor() {
|
14
|
+
super();
|
15
|
+
this.__registerHost();
|
16
|
+
this.success = createEvent(this, "success", 7);
|
17
|
+
this.fail = createEvent(this, "fail", 7);
|
18
|
+
this.drawComplete = createEvent(this, "drawComplete", 7);
|
19
|
+
this.editingAttachment = createEvent(this, "editingAttachment", 7);
|
20
|
+
this.mapView = undefined;
|
21
|
+
this.selectedLayerId = undefined;
|
22
|
+
this.customizeSubmit = false;
|
23
|
+
}
|
24
|
+
//--------------------------------------------------------------------------
|
25
|
+
//
|
26
|
+
// Watch handlers
|
27
|
+
//
|
28
|
+
//--------------------------------------------------------------------------
|
29
|
+
/**
|
30
|
+
* Called each time the mapView prop is changed.
|
31
|
+
*/
|
32
|
+
async mapViewWatchHandler() {
|
33
|
+
await this.mapView.when(async () => {
|
34
|
+
await this.init();
|
35
|
+
});
|
36
|
+
}
|
37
|
+
//--------------------------------------------------------------------------
|
38
|
+
//
|
39
|
+
// Methods (public)
|
40
|
+
//
|
41
|
+
//--------------------------------------------------------------------------
|
42
|
+
/**
|
43
|
+
* Destroy the Editor widget instance
|
44
|
+
* @returns Promise that resolves when the operation is complete
|
45
|
+
*/
|
46
|
+
async close() {
|
47
|
+
if (this._editor) {
|
48
|
+
this._editor.destroy();
|
49
|
+
}
|
50
|
+
}
|
51
|
+
/**
|
52
|
+
* Submit the created feature
|
53
|
+
* @returns Promise that resolves when the operation is complete
|
54
|
+
*/
|
55
|
+
async submit() {
|
56
|
+
if (this._editor) {
|
57
|
+
this._editor.viewModel.featureFormViewModel.submit();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
//--------------------------------------------------------------------------
|
61
|
+
//
|
62
|
+
// Functions (lifecycle)
|
63
|
+
//
|
64
|
+
//--------------------------------------------------------------------------
|
65
|
+
/**
|
66
|
+
* StencilJS: Called once just after the component is first connected to the DOM.
|
67
|
+
* @returns Promise when complete
|
68
|
+
*/
|
69
|
+
async componentWillLoad() {
|
70
|
+
await this.initModules();
|
71
|
+
}
|
72
|
+
/**
|
73
|
+
* StencilJS: Called once just after the component is fully loaded and the first render() occurs.
|
74
|
+
*/
|
75
|
+
async componentDidLoad() {
|
76
|
+
await this.init();
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Renders the component.
|
80
|
+
*/
|
81
|
+
render() {
|
82
|
+
return (h(Host, { id: "feature-form" }));
|
83
|
+
}
|
84
|
+
//--------------------------------------------------------------------------
|
85
|
+
//
|
86
|
+
// Functions (protected)
|
87
|
+
//
|
88
|
+
//--------------------------------------------------------------------------
|
89
|
+
/**
|
90
|
+
* Init Editor widget and starts the create workflow
|
91
|
+
*/
|
92
|
+
async init() {
|
93
|
+
if (this.mapView && this.selectedLayerId) {
|
94
|
+
await this.createEditorWidget();
|
95
|
+
}
|
96
|
+
}
|
97
|
+
/**
|
98
|
+
* Load esri javascript api modules
|
99
|
+
* @returns Promise resolving when function is done
|
100
|
+
* @protected
|
101
|
+
*/
|
102
|
+
async initModules() {
|
103
|
+
const [Editor, reactiveUtils] = await loadModules([
|
104
|
+
"esri/widgets/Editor",
|
105
|
+
"esri/core/reactiveUtils"
|
106
|
+
]);
|
107
|
+
this.Editor = Editor;
|
108
|
+
this.reactiveUtils = reactiveUtils;
|
109
|
+
}
|
110
|
+
/**
|
111
|
+
* Display editor widget to create the new feature
|
112
|
+
* @protected
|
113
|
+
*/
|
114
|
+
async createEditorWidget() {
|
115
|
+
if (this._editor) {
|
116
|
+
this._editor.destroy();
|
117
|
+
}
|
118
|
+
const layerInfos = [];
|
119
|
+
const container = document.createElement("div");
|
120
|
+
const allMapLayers = await getAllLayers(this.mapView);
|
121
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
122
|
+
allMapLayers.forEach(async (eachLayer) => {
|
123
|
+
layerInfos.push({
|
124
|
+
layer: eachLayer,
|
125
|
+
enabled: (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.type) === "feature" && (eachLayer === null || eachLayer === void 0 ? void 0 : eachLayer.id) === this.selectedLayerId,
|
126
|
+
addEnabled: true,
|
127
|
+
updateEnabled: false,
|
128
|
+
deleteEnabled: false // default is true, set to false to disable the ability to delete features
|
129
|
+
});
|
130
|
+
});
|
131
|
+
this._editor = new this.Editor({
|
132
|
+
allowedWorkflows: "create-features",
|
133
|
+
view: this.mapView,
|
134
|
+
layerInfos: layerInfos,
|
135
|
+
visibleElements: {
|
136
|
+
snappingControls: false
|
137
|
+
},
|
138
|
+
container
|
139
|
+
});
|
140
|
+
this.el.appendChild(container);
|
141
|
+
//Add handle to watch if attachments are added/edited
|
142
|
+
const attachmentHandle = this.reactiveUtils.watch(() => this._editor.viewModel.state, (state) => {
|
143
|
+
if (state === 'adding-attachment' || state === 'editing-attachment') {
|
144
|
+
this._addingAttachment = true;
|
145
|
+
this.editingAttachment.emit(true);
|
146
|
+
}
|
147
|
+
else {
|
148
|
+
if (this._addingAttachment) {
|
149
|
+
this.editingAttachment.emit(false);
|
150
|
+
this._addingAttachment = false;
|
151
|
+
}
|
152
|
+
}
|
153
|
+
});
|
154
|
+
this._editor.viewModel.addHandles(attachmentHandle);
|
155
|
+
//Add handle to watch featureTemplatesViewModel ready state and then start the creation
|
156
|
+
const handle = this.reactiveUtils.watch(() => this._editor.viewModel.featureTemplatesViewModel.state, (state) => {
|
157
|
+
if (state === 'ready') {
|
158
|
+
void this.startCreate();
|
159
|
+
}
|
160
|
+
});
|
161
|
+
this._editor.viewModel.addHandles(handle);
|
162
|
+
}
|
163
|
+
/**
|
164
|
+
* Start creating the feature
|
165
|
+
* @protected
|
166
|
+
*/
|
167
|
+
async startCreate() {
|
168
|
+
var _a;
|
169
|
+
if ((_a = this._editor.viewModel.featureTemplatesViewModel.items) === null || _a === void 0 ? void 0 : _a.length) {
|
170
|
+
const items = this._editor.viewModel.featureTemplatesViewModel.items[0].get("items");
|
171
|
+
//once the feature template is selected handle the event for formSubmit and sketch complete
|
172
|
+
//also, hide the headers and footer in the editor as we will be showing our own submit and cancel button
|
173
|
+
this._editor.viewModel.featureTemplatesViewModel.on('select', () => {
|
174
|
+
setTimeout(() => {
|
175
|
+
//on form submit
|
176
|
+
this._editor.viewModel.featureFormViewModel.on('submit', this.submitted.bind(this));
|
177
|
+
//on sketch complete emit the event
|
178
|
+
this._editor.viewModel.sketchViewModel.on("create", (evt) => {
|
179
|
+
if (evt.state === "complete") {
|
180
|
+
this.drawComplete.emit();
|
181
|
+
}
|
182
|
+
});
|
183
|
+
this.hideEditorsElements();
|
184
|
+
}, 700);
|
185
|
+
this.hideEditorsElements();
|
186
|
+
});
|
187
|
+
//if only one feature template then directly start geometry creation for that
|
188
|
+
//else allow feature template selection to user
|
189
|
+
if (items.length === 1) {
|
190
|
+
this._editor.viewModel.featureTemplatesViewModel.select(items[0]);
|
191
|
+
}
|
192
|
+
//hides the header and footer elements in editor widget
|
193
|
+
this.hideEditorsElements();
|
194
|
+
}
|
195
|
+
}
|
196
|
+
/**
|
197
|
+
* Hides the elements of editor widget
|
198
|
+
* @protected
|
199
|
+
*/
|
200
|
+
hideEditorsElements() {
|
201
|
+
if (!this.customizeSubmit) {
|
202
|
+
return;
|
203
|
+
}
|
204
|
+
setTimeout(() => {
|
205
|
+
var _a;
|
206
|
+
//hides the header and footer on the featureForm
|
207
|
+
(_a = this.el.querySelector('.esri-editor').querySelectorAll('calcite-flow-item')) === null || _a === void 0 ? void 0 : _a.forEach((flowItem) => {
|
208
|
+
var _a, _b, _c, _d, _e;
|
209
|
+
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');
|
210
|
+
//hide the header
|
211
|
+
(_d = article === null || article === void 0 ? void 0 : article.querySelector('header')) === null || _d === void 0 ? void 0 : _d.setAttribute('style', 'display: none');
|
212
|
+
//hide the footer
|
213
|
+
(_e = article === null || article === void 0 ? void 0 : article.querySelector('footer')) === null || _e === void 0 ? void 0 : _e.setAttribute('style', 'display: none');
|
214
|
+
});
|
215
|
+
}, 700);
|
216
|
+
}
|
217
|
+
/**
|
218
|
+
* On creation of feature emit the event that the feature is created
|
219
|
+
* @param evt feature submit event
|
220
|
+
* @protected
|
221
|
+
*/
|
222
|
+
async submitted(evt) {
|
223
|
+
var _a;
|
224
|
+
//return if any attribute is invalid , focus will be shifted to the invalid attribute in feature form
|
225
|
+
if (evt.invalid.length) {
|
226
|
+
return;
|
227
|
+
}
|
228
|
+
//Submit only when valid attributes
|
229
|
+
//emit success or fail based on the result
|
230
|
+
if (evt.valid.length) {
|
231
|
+
try {
|
232
|
+
await this._editor.activeWorkflow.commit();
|
233
|
+
//throw errors if any failures
|
234
|
+
if ((_a = this._editor.viewModel.failures) === null || _a === void 0 ? void 0 : _a.length) {
|
235
|
+
this._editor.viewModel.failures.some((failure) => {
|
236
|
+
if (failure.error) {
|
237
|
+
throw (failure.error);
|
238
|
+
}
|
239
|
+
});
|
240
|
+
}
|
241
|
+
}
|
242
|
+
catch (e) {
|
243
|
+
this.fail.emit(e);
|
244
|
+
return;
|
245
|
+
}
|
246
|
+
this.success.emit();
|
247
|
+
}
|
248
|
+
}
|
249
|
+
get el() { return this; }
|
250
|
+
static get watchers() { return {
|
251
|
+
"mapView": ["mapViewWatchHandler"]
|
252
|
+
}; }
|
253
|
+
static get style() { return createFeatureCss; }
|
254
|
+
}, [0, "create-feature", {
|
255
|
+
"mapView": [16],
|
256
|
+
"selectedLayerId": [1, "selected-layer-id"],
|
257
|
+
"customizeSubmit": [4, "customize-submit"],
|
258
|
+
"close": [64],
|
259
|
+
"submit": [64]
|
260
|
+
}, undefined, {
|
261
|
+
"mapView": ["mapViewWatchHandler"]
|
262
|
+
}]);
|
263
|
+
function defineCustomElement() {
|
264
|
+
if (typeof customElements === "undefined") {
|
265
|
+
return;
|
266
|
+
}
|
267
|
+
const components = ["create-feature"];
|
268
|
+
components.forEach(tagName => { switch (tagName) {
|
269
|
+
case "create-feature":
|
270
|
+
if (!customElements.get(tagName)) {
|
271
|
+
customElements.define(tagName, CreateFeature);
|
272
|
+
}
|
273
|
+
break;
|
274
|
+
} });
|
275
|
+
}
|
276
|
+
defineCustomElement();
|
277
|
+
|
278
|
+
export { CreateFeature as C, defineCustomElement as d };
|