@esri/solutions-components 0.7.31 → 0.7.32
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-flow_5.cjs.entry.js +94 -43
- package/dist/cjs/crowdsource-reporter.cjs.entry.js +35 -8
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/solutions-components.cjs.js +1 -1
- package/dist/collection/components/create-feature/create-feature.css +27 -0
- package/dist/collection/components/create-feature/create-feature.js +126 -43
- package/dist/collection/components/crowdsource-reporter/crowdsource-reporter.js +35 -8
- package/dist/collection/demos/create-feature.html +90 -0
- package/dist/components/create-feature2.js +96 -44
- package/dist/components/crowdsource-reporter.js +35 -8
- package/dist/esm/calcite-flow_5.entry.js +95 -44
- package/dist/esm/crowdsource-reporter.entry.js +35 -8
- package/dist/esm/loader.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/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/types/components/create-feature/create-feature.d.ts +21 -3
- package/dist/types/components/crowdsource-reporter/crowdsource-reporter.d.ts +18 -4
- package/dist/types/components.d.ts +13 -0
- package/dist/types/preact.d.ts +2 -1
- package/package.json +1 -1
- package/dist/solutions-components/p-b4e2cac4.entry.js +0 -17
- package/dist/solutions-components/p-bb6562ab.entry.js +0 -6
@@ -25,6 +25,11 @@ export declare class CreateFeature {
|
|
25
25
|
* string: Layer id of the feature layer in which the new feature is to be created
|
26
26
|
*/
|
27
27
|
selectedLayerId: string;
|
28
|
+
/**
|
29
|
+
* boolean: Set this to true when have a custom submit button in the app.
|
30
|
+
* This will hide the header and footer elements of the editor and user needs to execute the submit method manually.
|
31
|
+
*/
|
32
|
+
customizeSubmit?: boolean;
|
28
33
|
/**
|
29
34
|
* esri/widgets/Editor: https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Editor.html
|
30
35
|
* The Editor constructor
|
@@ -36,9 +41,13 @@ export declare class CreateFeature {
|
|
36
41
|
*/
|
37
42
|
protected _editor: __esri.Editor;
|
38
43
|
/**
|
39
|
-
*
|
40
|
-
|
41
|
-
protected
|
44
|
+
* esri/core/reactiveUtils: https://developers.arcgis.com/javascript/latest/api-reference/esri-core-reactiveUtils.html
|
45
|
+
*/
|
46
|
+
protected reactiveUtils: typeof import("esri/core/reactiveUtils");
|
47
|
+
/**
|
48
|
+
* boolean: Flag to maintain the add attachment
|
49
|
+
*/
|
50
|
+
protected _addingAttachment: boolean;
|
42
51
|
/**
|
43
52
|
* Called each time the mapView prop is changed.
|
44
53
|
*/
|
@@ -65,6 +74,10 @@ export declare class CreateFeature {
|
|
65
74
|
* Emitted on demand when drawing is completed
|
66
75
|
*/
|
67
76
|
drawComplete: EventEmitter<void>;
|
77
|
+
/**
|
78
|
+
* Emitted on demand when editing attachments
|
79
|
+
*/
|
80
|
+
editingAttachment: EventEmitter<boolean>;
|
68
81
|
/**
|
69
82
|
* StencilJS: Called once just after the component is first connected to the DOM.
|
70
83
|
* @returns Promise when complete
|
@@ -98,6 +111,11 @@ export declare class CreateFeature {
|
|
98
111
|
* @protected
|
99
112
|
*/
|
100
113
|
protected startCreate(): Promise<void>;
|
114
|
+
/**
|
115
|
+
* Hides the elements of editor widget
|
116
|
+
* @protected
|
117
|
+
*/
|
118
|
+
protected hideEditorsElements(): void;
|
101
119
|
/**
|
102
120
|
* On creation of feature emit the event that the feature is created
|
103
121
|
* @param evt feature submit event
|
@@ -196,6 +196,10 @@ export declare class CrowdsourceReporter {
|
|
196
196
|
* ObjectId of the feature currently shown in the details
|
197
197
|
*/
|
198
198
|
protected _currentFeatureId: string;
|
199
|
+
/**
|
200
|
+
* boolean: Maintains a flag to know if urls params are loaded or not
|
201
|
+
*/
|
202
|
+
protected _urlParamsLoaded: boolean;
|
199
203
|
/**
|
200
204
|
* Called each time the mapView prop is changed.
|
201
205
|
*/
|
@@ -259,7 +263,12 @@ export declare class CrowdsourceReporter {
|
|
259
263
|
* When drawing of incident location completed on map show the submit and cancel button
|
260
264
|
* @protected
|
261
265
|
*/
|
262
|
-
protected
|
266
|
+
protected onDrawComplete(): void;
|
267
|
+
/**
|
268
|
+
* When Add attachment panel is enabled hide the submit and cancel button
|
269
|
+
* @protected
|
270
|
+
*/
|
271
|
+
protected showSubmitCancelButton(evt: CustomEvent): void;
|
263
272
|
/**
|
264
273
|
* On back from create feature, call submit editor to destroy the Editor widget instance
|
265
274
|
* @protected
|
@@ -280,7 +289,12 @@ export declare class CrowdsourceReporter {
|
|
280
289
|
* On submit report navigate to the layer list home page and refresh the layer list
|
281
290
|
* @protected
|
282
291
|
*/
|
283
|
-
protected
|
292
|
+
protected onReportSubmitted(): void;
|
293
|
+
/**
|
294
|
+
* Navigates to layer-list
|
295
|
+
* @protected
|
296
|
+
*/
|
297
|
+
protected navigateToHomePage(): void;
|
284
298
|
/**
|
285
299
|
* Update the selected layer id and name
|
286
300
|
* @param evt Event which has details of selected layerId and layerName
|
@@ -383,12 +397,12 @@ export declare class CrowdsourceReporter {
|
|
383
397
|
protected _getTranslations(): Promise<void>;
|
384
398
|
/**
|
385
399
|
* Updates the share url for current selected feature
|
386
|
-
* @returns
|
387
400
|
* @protected
|
388
401
|
*/
|
389
|
-
protected _updateShareURL():
|
402
|
+
protected _updateShareURL(): void;
|
390
403
|
/**
|
391
404
|
* Navigates to selected features detail based on the URL params
|
405
|
+
* @protected
|
392
406
|
*/
|
393
407
|
protected loadFeatureFromURLParams(): Promise<void>;
|
394
408
|
}
|
@@ -92,6 +92,10 @@ export namespace Components {
|
|
92
92
|
* @returns Promise that resolves when the operation is complete
|
93
93
|
*/
|
94
94
|
"close": () => Promise<void>;
|
95
|
+
/**
|
96
|
+
* boolean: Set this to true when have a custom submit button in the app. This will hide the header and footer elements of the editor and user needs to execute the submit method manually.
|
97
|
+
*/
|
98
|
+
"customizeSubmit"?: boolean;
|
95
99
|
/**
|
96
100
|
* esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
|
97
101
|
*/
|
@@ -1443,6 +1447,7 @@ declare global {
|
|
1443
1447
|
"success": void;
|
1444
1448
|
"fail": Error;
|
1445
1449
|
"drawComplete": void;
|
1450
|
+
"editingAttachment": boolean;
|
1446
1451
|
}
|
1447
1452
|
interface HTMLCreateFeatureElement extends Components.CreateFeature, HTMLStencilElement {
|
1448
1453
|
addEventListener<K extends keyof HTMLCreateFeatureElementEventMap>(type: K, listener: (this: HTMLCreateFeatureElement, ev: CreateFeatureCustomEvent<HTMLCreateFeatureElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
|
@@ -2140,6 +2145,10 @@ declare namespace LocalJSX {
|
|
2140
2145
|
"zoomAndScrollToSelected"?: boolean;
|
2141
2146
|
}
|
2142
2147
|
interface CreateFeature {
|
2148
|
+
/**
|
2149
|
+
* boolean: Set this to true when have a custom submit button in the app. This will hide the header and footer elements of the editor and user needs to execute the submit method manually.
|
2150
|
+
*/
|
2151
|
+
"customizeSubmit"?: boolean;
|
2143
2152
|
/**
|
2144
2153
|
* esri/views/MapView: https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html
|
2145
2154
|
*/
|
@@ -2148,6 +2157,10 @@ declare namespace LocalJSX {
|
|
2148
2157
|
* Emitted on demand when drawing is completed
|
2149
2158
|
*/
|
2150
2159
|
"onDrawComplete"?: (event: CreateFeatureCustomEvent<void>) => void;
|
2160
|
+
/**
|
2161
|
+
* Emitted on demand when editing attachments
|
2162
|
+
*/
|
2163
|
+
"onEditingAttachment"?: (event: CreateFeatureCustomEvent<boolean>) => void;
|
2151
2164
|
/**
|
2152
2165
|
* Emitted on demand when the feature creation is failed
|
2153
2166
|
*/
|
package/dist/types/preact.d.ts
CHANGED
@@ -502,10 +502,11 @@ declare module "preact/src/jsx" {
|
|
502
502
|
|
503
503
|
"card-manager": JSX.SolutionsCardManager & JSXInternal.HTMLAttributes<HTMLSolutionsCardManagerElement>
|
504
504
|
|
505
|
-
"create-feature": Omit<JSX.SolutionsCreateFeature, "onSuccess" | "onFail" | "onDrawComplete"> & JSXInternal.HTMLAttributes<HTMLSolutionsCreateFeatureElement> & {
|
505
|
+
"create-feature": Omit<JSX.SolutionsCreateFeature, "onSuccess" | "onFail" | "onDrawComplete" | "onEditingAttachment"> & JSXInternal.HTMLAttributes<HTMLSolutionsCreateFeatureElement> & {
|
506
506
|
"onsuccess"?: (event: CustomEvent<any>) => void;
|
507
507
|
"onfail"?: (event: CustomEvent<any>) => void;
|
508
508
|
"ondrawComplete"?: (event: CustomEvent<any>) => void;
|
509
|
+
"oneditingAttachment"?: (event: CustomEvent<any>) => void;
|
509
510
|
}
|
510
511
|
|
511
512
|
"crowdsource-manager": JSX.SolutionsCrowdsourceManager & JSXInternal.HTMLAttributes<HTMLSolutionsCrowdsourceManagerElement>
|
package/package.json
CHANGED
@@ -1,17 +0,0 @@
|
|
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{r as t,h as i,g as s,c as e,H as a,F as o}from"./p-78780f63.js";import{c as n}from"./p-5b566d55.js";import{c as l,s as c,a as r}from"./p-f10944e6.js";import{a as h}from"./p-83fd31d5.js";import{c as d,u as p,d as m}from"./p-0c97de08.js";import{c as u,d as f}from"./p-de281b08.js";import{c as g,s as v,d as y,u as w}from"./p-981e9549.js";import{S as b}from"./p-35c58364.js";import{l as x,g as k,f as L}from"./p-e902ba19.js";import{g as C,c as j,h as I,d as z,a as D}from"./p-2c382841.js";import{P as F}from"./p-515a319e.js";import"./p-fcefdfff.js";import"./p-29d68474.js";import"./p-c92fff33.js";import"./p-1e2ffee3.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";import"./p-c1cf3ebc.js";
|
7
|
-
/*!
|
8
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
9
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
10
|
-
* v2.0.0
|
11
|
-
*/const S=class{constructor(i){t(this,i),this.itemMutationObserver=n("mutation",(()=>this.updateFlowProps())),this.getFlowDirection=(t,i)=>t&&i>1||t>1?i<t?"retreating":"advancing":null,this.updateFlowProps=()=>{const{customItemSelectors:t,el:i,items:s}=this,e=Array.from(i.querySelectorAll("calcite-flow-item"+(t?`,${t}`:""))).filter((t=>t.closest("calcite-flow")===i)),a=s.length,o=e.length,n=e[o-1],l=e[o-2];if(o&&n&&e.forEach((t=>{t.showBackButton=t===n&&o>1,t.hidden=t!==n})),l&&(l.menuOpen=!1),this.items=e,a!==o){const t=this.getFlowDirection(a,o);this.itemCount=o,this.flowDirection=t}},this.customItemSelectors=void 0,this.flowDirection=null,this.itemCount=0,this.items=[]}async back(){const{items:t}=this,i=t[t.length-1];if(!i)return;const s=i.beforeBack?i.beforeBack:()=>Promise.resolve();try{await s.call(i)}catch(t){return}return i.remove(),i}async setFocus(){await l(this);const{items:t}=this,i=t[t.length-1];return null==i?void 0:i.setFocus()}connectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.observe(this.el,{childList:!0,subtree:!0}),this.updateFlowProps()}async componentWillLoad(){c(this)}componentDidLoad(){r(this)}disconnectedCallback(){var t;null===(t=this.itemMutationObserver)||void 0===t||t.disconnect()}async handleItemBackClick(t){if(!t.defaultPrevented)return await this.back(),this.setFocus()}render(){const{flowDirection:t}=this;return i("div",{class:{frame:!0,"frame--advancing":"advancing"===t,"frame--retreating":"retreating"===t}},i("slot",null))}get el(){return s(this)}};S.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto;align-items:stretch;overflow:hidden;background-color:transparent}:host .frame{position:relative;margin:0px;display:flex;inline-size:100%;flex:1 1 auto;flex-direction:column;align-items:stretch;padding:0px}:host ::slotted(calcite-flow-item),:host ::slotted(calcite-panel){block-size:100%}:host ::slotted(.calcite-match-height:last-child){display:flex;flex:1 1 auto;overflow:hidden}:host .frame--advancing{animation:calcite-frame-advance var(--calcite-animation-timing)}:host .frame--retreating{animation:calcite-frame-retreat var(--calcite-animation-timing)}@keyframes calcite-frame-advance{0%{--tw-bg-opacity:0.5;transform:translate3d(50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}@keyframes calcite-frame-retreat{0%{--tw-bg-opacity:0.5;transform:translate3d(-50px, 0, 0)}100%{--tw-bg-opacity:1;transform:translate3d(0, 0, 0)}}:host([hidden]){display:none}[hidden]{display:none}";
|
12
|
-
/*!
|
13
|
-
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
14
|
-
* See https://github.com/Esri/calcite-design-system/blob/main/LICENSE.md for details.
|
15
|
-
* v2.0.0
|
16
|
-
*/
|
17
|
-
const W=class{constructor(i){t(this,i),this.calciteFlowItemBack=e(this,"calciteFlowItemBack",7),this.calciteFlowItemScroll=e(this,"calciteFlowItemScroll",6),this.calciteFlowItemClose=e(this,"calciteFlowItemClose",6),this.calciteFlowItemToggle=e(this,"calciteFlowItemToggle",6),this.handlePanelScroll=t=>{t.stopPropagation(),this.calciteFlowItemScroll.emit()},this.handlePanelClose=t=>{t.stopPropagation(),this.calciteFlowItemClose.emit()},this.handlePanelToggle=t=>{t.stopPropagation(),this.collapsed=t.target.collapsed,this.calciteFlowItemToggle.emit()},this.backButtonClick=()=>{this.calciteFlowItemBack.emit()},this.setBackRef=t=>{this.backButtonEl=t},this.setContainerRef=t=>{this.containerEl=t},this.closable=!1,this.closed=!1,this.collapsed=!1,this.collapseDirection="down",this.collapsible=!1,this.beforeBack=void 0,this.description=void 0,this.disabled=!1,this.heading=void 0,this.headingLevel=void 0,this.loading=!1,this.menuOpen=!1,this.messageOverrides=void 0,this.messages=void 0,this.showBackButton=!1,this.defaultMessages=void 0,this.effectiveLocale=""}onMessagesChange(){}connectedCallback(){d(this),u(this),g(this)}async componentWillLoad(){await v(this),c(this)}componentDidRender(){p(this)}disconnectedCallback(){m(this),f(this),y(this)}componentDidLoad(){r(this)}effectiveLocaleChange(){w(this,this.effectiveLocale)}async setFocus(){await l(this);const{backButtonEl:t,containerEl:i}=this;return t?t.setFocus():i?i.setFocus():void 0}async scrollContentTo(t){var i;await(null===(i=this.containerEl)||void 0===i?void 0:i.scrollContentTo(t))}renderBackButton(){const{el:t}=this,s="rtl"===h(t),{showBackButton:e,backButtonClick:a,messages:o}=this,n=o.back;return e?i("calcite-action",{"aria-label":n,class:"back-button",icon:s?"chevron-right":"chevron-left",key:"flow-back-button",onClick:a,scale:"s",slot:"header-actions-start",text:n,title:n,ref:this.setBackRef}):null}render(){const{collapsed:t,collapseDirection:s,collapsible:e,closable:o,closed:n,description:l,disabled:c,heading:r,headingLevel:h,loading:d,menuOpen:p,messages:m}=this;return i(a,null,i("calcite-panel",{closable:o,closed:n,collapseDirection:s,collapsed:t,collapsible:e,description:l,disabled:c,heading:r,headingLevel:h,loading:d,menuOpen:p,messageOverrides:m,onCalcitePanelClose:this.handlePanelClose,onCalcitePanelScroll:this.handlePanelScroll,onCalcitePanelToggle:this.handlePanelToggle,ref:this.setContainerRef},this.renderBackButton(),i("slot",{name:"action-bar",slot:b.actionBar}),i("slot",{name:"header-actions-start",slot:b.headerActionsStart}),i("slot",{name:"header-actions-end",slot:b.headerActionsEnd}),i("slot",{name:"header-content",slot:b.headerContent}),i("slot",{name:"header-menu-actions",slot:b.headerMenuActions}),i("slot",{name:"fab",slot:b.fab}),i("slot",{name:"footer-actions",slot:b.footerActions}),i("slot",{name:"footer",slot:b.footer}),i("slot",null)))}static get assetsDirs(){return["assets"]}get el(){return s(this)}static get watchers(){return{messageOverrides:["onMessagesChange"],effectiveLocale:["effectiveLocaleChange"]}}};W.style=":host{box-sizing:border-box;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);font-size:var(--calcite-font-size--1)}:host *{box-sizing:border-box}:host([disabled]){cursor:default;-webkit-user-select:none;-moz-user-select:none;user-select:none;opacity:var(--calcite-opacity-disabled)}:host([disabled]) *,:host([disabled]) ::slotted(*){pointer-events:none}:host{position:relative;display:flex;inline-size:100%;flex:1 1 auto}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.back-button{border-width:0px;border-style:solid;border-color:var(--calcite-color-border-3);border-inline-end-width:1px}calcite-panel{--calcite-panel-footer-padding:var(--calcite-flow-item-footer-padding);--calcite-panel-header-border-block-end:var(--calcite-flow-item-header-border-block-end)}:host([hidden]){display:none}[hidden]{display:none}";const _=class{constructor(i){t(this,i),this.success=e(this,"success",7),this.fail=e(this,"fail",7),this.drawComplete=e(this,"drawComplete",7),this.mapView=void 0,this.selectedLayerId=void 0}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.init()}))}async close(){this._editor&&this._editor.destroy()}async submit(){this._editor&&this._editor.viewModel.featureFormViewModel.submit()}async componentWillLoad(){await this.initModules()}async componentDidLoad(){await this.init()}render(){return i(a,{id:"feature-form"})}async init(){this.mapView&&this.mapView&&this.selectedLayerId&&(await C(this.mapView,this.selectedLayerId),await this.createEditorWidget(),await this.startCreate(),this._editor.viewModel.featureFormViewModel.on("submit",this.submitted.bind(this)),setTimeout((()=>{var t,i;this.el.querySelector(".esri-editor").querySelectorAll("calcite-flow-item")[1].shadowRoot.querySelector("calcite-panel").shadowRoot.querySelector("article").querySelector("header").setAttribute("style","display: none"),null===(i=null===(t=this.el.querySelector(".esri-editor").querySelectorAll("calcite-flow-item")[1].shadowRoot.querySelector("calcite-panel").shadowRoot.querySelector("article"))||void 0===t?void 0:t.querySelector("footer"))||void 0===i||i.setAttribute("style","display: none")}),700))}async initModules(){const[t]=await x(["esri/widgets/Editor"]);this.Editor=t}async createEditorWidget(){this._editor&&this._editor.destroy();const t=document.createElement("div"),i=await C(this.mapView,this.selectedLayerId);this._editor=new this.Editor({allowedWorkflows:"create-features",view:this.mapView,layerInfos:[{layer:i}],visibleElements:{snappingControls:!1,snappingControlsElements:{featureEnabledToggle:!1,layerList:!1,enabledToggle:!1}},container:t}),this.el.appendChild(t)}async startCreate(){var t,i;const s=await C(this.mapView,this.selectedLayerId);if(s){let e=s.templates&&s.templates.length?s.templates[0]:{};(null===(t=s.sourceJSON)||void 0===t?void 0:t.types.length)&&(null===(i=s.sourceJSON.types[0].templates)||void 0===i?void 0:i.length)&&(e=s.sourceJSON.types[0].templates[0]);const a={layer:s,template:e};await this._editor.startCreateFeaturesWorkflowAtFeatureCreation(a),this._editor.viewModel.sketchViewModel.on("create",(t=>{"complete"===t.state&&this.drawComplete.emit()}))}}async submitted(t){var i;if(!t.invalid.length&&t.valid.length){try{await this._editor.activeWorkflow.commit(),(null===(i=this._editor.viewModel.failures)||void 0===i?void 0:i.length)&&this._editor.viewModel.failures.some((t=>{if(t.error)throw t.error}))}catch(t){return void this.fail.emit(t)}this.success.emit()}}get el(){return s(this)}static get watchers(){return{mapView:["mapViewWatchHandler"]}}};_.style=":host{display:block}.esri-editor__panel-toolbar{display:none !important}";const E=class{constructor(i){t(this,i),this.featureSelect=e(this,"featureSelect",7),this.selectedLayerId=void 0,this.mapView=void 0,this.noFeaturesFoundMsg=void 0,this.pageSize=100,this.highlightOnMap=!1,this._featureItems=[],this._featuresCount=0,this._isLoading=!1,this._translations=void 0}async selectedLayerWatchHandler(){this._selectedLayer=await C(this.mapView,this.selectedLayerId),await this.initializeFeatureItems()}async componentWillLoad(){await this._getTranslations(),this._isLoading=!0,this._popupUtils=new F,this.mapView&&this.selectedLayerId&&(this._selectedLayer=await C(this.mapView,this.selectedLayerId))}async componentDidLoad(){await this.initializeFeatureItems()}render(){return i("calcite-panel",{"full-height":!0,"full-width":!0},this._isLoading&&i("calcite-loader",{scale:"m"}),0===this._featureItems.length&&!this._isLoading&&i("calcite-notice",{class:"error-msg",icon:"feature-details",kind:"info",open:!0},i("div",{slot:"message"},this.noFeaturesFoundMsg?this.noFeaturesFoundMsg:this._translations.featureErrorMsg)),i("calcite-list",{"selection-appearance":"border","selection-mode":"single"},!this._isLoading&&this._featureItems.length>0&&this._featureItems),this._featuresCount>this.pageSize&&i("div",{class:"width-full",slot:"footer"},i("calcite-pagination",{class:"pagination","full-width":!0,onCalcitePaginationChange:this.pageChanged.bind(this),"page-size":this.pageSize,"start-item":"1","total-items":this._featuresCount})))}async initializeFeatureItems(){this._selectedLayer&&(this._isLoading=!0,this._featureItems=await this.queryPage(0),this._featuresCount=await this._selectedLayer.queryFeatureCount(),this._isLoading=!1)}async pageChanged(t){this._isLoading=!0,this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null);const i=t.target.startItem-1;this._featureItems=await this.queryPage(i),this._isLoading=!1}async featureClicked(t,i){if(this.highlightOnMap&&this._highlightHandle&&(this._highlightHandle.remove(),this._highlightHandle=null),t.target.selected){if(this.highlightOnMap){const i=Number(t.target.value),s=await j(this.mapView,this.selectedLayerId);this._highlightHandle=await I([i],s,this.mapView,!0)}this.featureSelect.emit(i)}}async queryPage(t){const i=this._selectedLayer,s=i.objectIdField,e={start:t,num:this.pageSize,outFields:["*"],returnGeometry:!0,where:i.definitionExpression,outSpatialReference:this.mapView.spatialReference.toJSON()};s&&(e.orderByFields=[s.toString()+" DESC"]);const a=await i.queryFeatures(e);return await this.createFeatureItem(a)}async createFeatureItem(t){const i=(null==t?void 0:t.features).map((async t=>{const i=await this._popupUtils.getPopupTitle(t,this.mapView.map);return this.getFeatureItem(t,i)}));return Promise.all(i)}getFeatureItem(t,s){const e=t.attributes[this._selectedLayer.objectIdField].toString();return i("calcite-list-item",{onCalciteListItemSelect:i=>{this.featureClicked(i,t)},value:e},i("div",{class:"popup-title",slot:"content-start"},s=null!=s?s:e),i("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}async _getTranslations(){const t=await k(this.el);this._translations=t[0]}get el(){return s(this)}static get watchers(){return{selectedLayerId:["selectedLayerWatchHandler"]}}};E.style=":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}";const P=class{constructor(i){t(this,i),this.layerSelect=e(this,"layerSelect",7),this.layersListLoaded=e(this,"layersListLoaded",7),this.mapView=void 0,this.layers=void 0,this.noLayerErrorMsg=void 0,this.showFeatureCount=!0,this.showNextIcon=!1,this._noLayersToDisplay=!1,this._mapLayerIds=[],this._isLoading=!1,this._translations=void 0}async refresh(){await this.setLayers()}async componentWillLoad(){await this._getTranslations(),this._isLoading=!0}async componentDidLoad(){await this.setLayers(),this._isLoading=!1}render(){return i(o,null,this._isLoading&&i("calcite-loader",{scale:"m"}),!this._isLoading&&this.mapView&&this._noLayersToDisplay&&i("calcite-notice",{class:"error-msg",icon:"layers-reference",kind:"danger",open:!0},i("div",{slot:"title"},this._translations.error),i("div",{slot:"message"},this.noLayerErrorMsg?this.noLayerErrorMsg:this._translations.noLayerToDisplayErrorMsg)),!this._isLoading&&this.mapView&&i("calcite-list",{"selection-appearance":"border","selection-mode":this.showNextIcon?"none":"single-persist"},this.renderLayerList()))}async setLayers(){this.mapView&&await this.initLayerHash()}async initLayerHash(){const t=[];this._layerItemsHash=await z(this.mapView,!0),(await D(this.mapView)).forEach((async i=>{var s,e;if("feature"===(null==i?void 0:i.type)&&(null==i?void 0:i.editingEnabled)&&(null===(e=null===(s=null==i?void 0:i.capabilities)||void 0===s?void 0:s.operations)||void 0===e?void 0:e.supportsAdd)&&(this._layerItemsHash[i.id].supportsAdd=!0,this.showFeatureCount)){const s=i.createQuery(),e=i.queryFeatureCount(s);t.push(e),e.then((async t=>{const s=isNaN(t)?"":await L(t,{places:0,api:4,type:"decimal"});this._layerItemsHash[i.id].formattedFeatureCount=s}))}})),await Promise.all(t).then((()=>{const t=this.getEditableIds(this._layerItemsHash);this._mapLayerIds=t.reverse(),this.handleNoLayersToDisplay()}),(()=>{this._mapLayerIds=[],this.handleNoLayersToDisplay()}))}handleNoLayersToDisplay(){this._noLayersToDisplay=!(this._mapLayerIds.length>0),this.layersListLoaded.emit(this._mapLayerIds)}getEditableIds(t){var i;const s=(null===(i=this.layers)||void 0===i?void 0:i.length)>0?this.layers:[];return Object.keys(t).reduce(((i,e)=>{let a=t[e].supportsAdd;return(null==s?void 0:s.length)>0&&(a=s.indexOf(e)>-1&&t[e].supportsAdd),a&&i.push(e),i}),[])}renderLayerList(){return this._mapLayerIds.length>0&&this._mapLayerIds.reduce(((t,i)=>(this._layerItemsHash[i]&&t.push(this.getLayerListItem(i)),t)),[])}getLayerListItem(t){const s=this._layerItemsHash[t].formattedFeatureCount;return i("calcite-list-item",{onCalciteListItemSelect:()=>{this.onLayerItemSelected(t)}},i("div",{class:"layer-name",slot:"content-start"},this._layerItemsHash[t].name),this.showFeatureCount&&void 0!==s&&""!==s&&i("div",{class:this.showNextIcon?"":"feature-count",slot:"content-end"},"("+s+")"),this.showNextIcon&&i("calcite-icon",{icon:"chevron-right",scale:"s",slot:"content-end"}))}onLayerItemSelected(t){this.layerSelect.emit({layerId:t,layerName:this._layerItemsHash[t].name})}async _getTranslations(){const t=await k(this.el);this._translations=t[0]}get el(){return s(this)}};P.style=":host{display:block}.error-msg{padding:10px}.layer-name{font-weight:500;padding:10px 12px}.feature-count{padding-right:12px}";export{S as calcite_flow,W as calcite_flow_item,_ as create_feature,E as feature_list,P as layer_list}
|
@@ -1,6 +0,0 @@
|
|
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{r as t,c as i,h as s,H as e,g as a}from"./p-78780f63.js";import{l as h,g as o}from"./p-e902ba19.js";import{a as l,g as c,q as n}from"./p-2c382841.js";import"./p-d918ec36.js";import"./p-e1a4994d.js";import"./p-c1cf3ebc.js";const r=class{constructor(s){t(this,s),this.togglePanel=i(this,"togglePanel",7),this.description=void 0,this.isMobile=void 0,this.enableAnonymousAccess=void 0,this.enableAnonymousComments=void 0,this.enableComments=void 0,this.enableLogin=void 0,this.enableNewReports=void 0,this.layers=void 0,this.loginTitle=void 0,this.mapView=void 0,this.layerId=void 0,this.objectId=void 0,this.reportButtonText=void 0,this.reportsHeader=void 0,this.reportSubmittedMessage=void 0,this.searchConfiguration=void 0,this.showComments=void 0,this.defaultWebmap="",this.enableSearch=!0,this.enableHome=!0,this.mapInfos=[],this.theme="light",this.enableZoom=!0,this._mapInfo=void 0,this._flowItems=["layer-list"],this._sidePanelCollapsed=!1,this._translations=void 0,this._hasValidLayers=!1,this._selectedLayerName=void 0,this._reportSubmitted=!1,this._showSubmitCancelButton=!1,this._featureCreationFailedErrorMsg=void 0}async isMobileWatchHandler(){this._sidePanelCollapsed=!1}async mapViewWatchHandler(){await this.mapView.when((async()=>{await this.setMapView()}))}async componentWillLoad(){await this._initModules(),await this._getTranslations()}render(){const t="dark"===this.theme?"calcite-mode-dark":"calcite-mode-light";return s(e,null,this._reportSubmitted&&s("calcite-alert",{"auto-close":!0,class:t,closable:!0,icon:"check-circle",kind:"success",onCalciteAlertClose:()=>{this._reportSubmitted=!1},open:!0,placement:"top"},s("div",{slot:"title"},this._translations.reportSubmit),s("div",{slot:"message"},this._translations.submitMsg)),this._featureCreationFailedErrorMsg&&s("calcite-alert",{"auto-close":!0,class:t,closable:!0,icon:"x-octagon",kind:"danger",onCalciteAlertClose:()=>{this._featureCreationFailedErrorMsg=""},open:!0,placement:"top"},s("div",{slot:"title"},this._translations.error),s("div",{slot:"message"},this._featureCreationFailedErrorMsg)),s("div",null,s("calcite-shell",{"content-behind":!0},this._getReporter())))}async _initModules(){const[t]=await h(["esri/core/reactiveUtils"]);this.reactiveUtils=t}setSelectedLayer(t,i){this._selectedLayerId=t,this._selectedLayerName=i}_getReporter(){const t=[];return this._flowItems.forEach((i=>{switch(i){case"layer-list":t.push(this.getLayerListFlowItem());break;case"feature-list":t.push(this.getFeatureListFlowItem(this._selectedLayerId,this._selectedLayerName));break;case"feature-details":t.push(this.getFeatureDetailsFlowItem());break;case"reporting-layer-list":t.push(this.getChooseCategoryFlowItem());break;case"feature-create":t.push(this.getFeatureCreateFlowItem())}})),s("calcite-panel",{class:"width-full "+("dark"===this.theme?"calcite-mode-dark":"calcite-mode-light")},this.mapView?s("calcite-flow",null,(null==t?void 0:t.length)>0&&t):s("calcite-loader",{scale:"m"}))}getLayerListFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this.reportsHeader},this._hasValidLayers&&s("calcite-action",{icon:"sort-ascending-arrow",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.sort,"text-enabled":this.isMobile}),this._hasValidLayers&&s("calcite-action",{icon:"filter",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.filter,"text-enabled":this.isMobile}),this.isMobile&&this.getActionToExpandCollapsePanel(),this._hasValidLayers&&this.enableNewReports&&s("calcite-button",{appearance:"secondary",onClick:this.navigateToChooseCategory.bind(this),slot:"footer",width:"full"},this.reportButtonText),s("calcite-panel",{"full-height":!0,"full-width":!0},s("layer-list",{class:"height-full",layers:this.layers,mapView:this.mapView,noLayerErrorMsg:this._translations.noLayerToDisplayErrorMsg,onLayerSelect:this.displayFeaturesList.bind(this),onLayersListLoaded:this.layerListLoaded.bind(this),ref:t=>this._layerList=t,showFeatureCount:!0,showNextIcon:!0})))}getChooseCategoryFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._translations.createReportHeader,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"secondary",class:"footer-top-button footer-button",disabled:!this._selectedLayerId,onClick:this.navigateToCreateFeature.bind(this),width:"full"},this._translations.next),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromSelectedPanel.bind(this),width:"full"},this._translations.cancel)),s("calcite-panel",{"full-height":!0,"full-width":!0},s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.chooseCategoryMsg)),s("layer-list",{class:"height-full",layers:this.layers,mapView:this.mapView,noLayerErrorMsg:this._translations.noLayerToDisplayErrorMsg,onLayerSelect:this.highlightSelectedLayer.bind(this),showFeatureCount:!1,showNextIcon:!1})))}getFeatureCreateFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromCreateFeaturePanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),this._showSubmitCancelButton&&s("div",{class:"width-full",slot:"footer"},s("calcite-button",{appearance:"secondary",class:"footer-top-button footer-button",onClick:this.onSubmitButtonClick.bind(this),width:"full"},this._translations.submit),s("calcite-button",{appearance:"outline",class:"footer-button",onClick:this.backFromCreateFeaturePanel.bind(this),width:"full"},this._translations.cancel)),s("calcite-panel",{"full-height":!0,"full-width":!0},s("calcite-notice",{class:"notice-msg",icon:"lightbulb",kind:"success",open:!0},s("div",{slot:"message"},this._translations.featureEditFormInfoMsg)),s("create-feature",{mapView:this.mapView,onDrawComplete:this.showSubmitCancelButton.bind(this),onFail:this.createFeatureFailed.bind(this),onSuccess:this.navigateHomePage.bind(this),ref:t=>this._createFeature=t,selectedLayerId:this._selectedLayerId})))}showSubmitCancelButton(){this._showSubmitCancelButton=!0}onSubmitButtonClick(){this._createFeature&&this._createFeature.submit()}backFromCreateFeaturePanel(){this._createFeature&&this._createFeature.close(),this.backFromSelectedPanel()}createFeatureFailed(t){console.error(t.detail),this._featureCreationFailedErrorMsg=t.detail.message}navigateHomePage(){this._reportSubmitted=!0,this._layerList&&this._layerList.refresh(),this._flowItems=["layer-list"]}highlightSelectedLayer(t){this.setSelectedLayer(t.detail.layerId,t.detail.layerName)}async navigateToCreateFeature(){this._showSubmitCancelButton=!1,this._flowItems=[...this._flowItems,"feature-create"]}navigateToChooseCategory(){this._flowItems=[...this._flowItems,"reporting-layer-list"]}async layerListLoaded(t){const i=t.detail,s=await l(this.mapView);this._validLayers=[],s.forEach((t=>{i.includes(t.id)&&this._validLayers.push(t)})),this.handleMapClick(),this._hasValidLayers=i.length>0,await this.loadFeatureFromURLParams()}displayFeaturesList(t){this.setSelectedLayer(t.detail.layerId,t.detail.layerName),this._flowItems=[...this._flowItems,"feature-list"]}backFromSelectedPanel(){const t=[...this._flowItems];t.pop(),1===t.length&&(this.setSelectedLayer("",""),this.setSelectedFeatures([])),this._flowItems=[...t]}toggleSidePanel(){this._sidePanelCollapsed=!this._sidePanelCollapsed,this.togglePanel.emit(this._sidePanelCollapsed)}async onFeatureSelectFromList(t){this.setSelectedFeatures([t.detail]),this._flowItems=[...this._flowItems,"feature-details"]}getFeatureListFlowItem(t,i){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:i,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},s("calcite-action",{icon:"sort-ascending-arrow",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.sort,"text-enabled":this.isMobile}),s("calcite-action",{icon:"filter",slot:this.isMobile?"header-menu-actions":"header-actions-end",text:this._translations.filter,"text-enabled":this.isMobile}),this.isMobile&&this.getActionToExpandCollapsePanel(),this.enableNewReports&&s("calcite-button",{appearance:"secondary",onClick:this.navigateToCreateFeature.bind(this),slot:"footer",width:"full"},this.reportButtonText),s("calcite-panel",{"full-height":!0},s("feature-list",{class:"height-full",highlightOnMap:!0,mapView:this.mapView,noFeaturesFoundMsg:this._translations.featureErrorMsg,onFeatureSelect:this.onFeatureSelectFromList.bind(this),pageSize:30,selectedLayerId:t})))}getFeatureDetailsFlowItem(){return s("calcite-flow-item",{collapsed:this.isMobile&&this._sidePanelCollapsed,heading:this._selectedLayerName,onCalciteFlowItemBack:this.backFromSelectedPanel.bind(this)},this.isMobile&&this.getActionToExpandCollapsePanel(),s("instant-apps-social-share",{autoUpdateShareUrl:!1,embed:!1,popoverButtonIconScale:"s",ref:t=>this._shareNode=t,scale:"m",shareButtonColor:"neutral",shareButtonType:"action",slot:"header-actions-end",socialMedia:!0,view:this.mapView}),s("calcite-panel",{"full-height":!0},s("info-card",{allowEditing:!1,graphics:this._selectedFeature,isLoading:!1,isMobile:!1,mapView:this.mapView,onSelectionChanged:this.featureDetailsChanged.bind(this),zoomAndScrollToSelected:!0})))}setSelectedFeatures(t){this._selectedFeature=t,this.setCurrentFeature(this._selectedFeature.length?this._selectedFeature[0]:null)}setCurrentFeature(t){if(t&&t.layer){const i=t.layer;this.setSelectedLayer(i.id,i.title),this._currentFeatureId=t.attributes[i.objectIdField]}else this.setSelectedLayer("",""),this._currentFeatureId="";this._updateShareURL()}featureDetailsChanged(t){this.setCurrentFeature(t.detail[0])}getActionToExpandCollapsePanel(){return s("calcite-action",{icon:this._sidePanelCollapsed?"chevrons-up":"chevrons-down",onClick:this.toggleSidePanel.bind(this),slot:"header-actions-end",text:this._sidePanelCollapsed?this._translations.expand:this._translations.collapse})}async setMapView(){this.mapView.popupEnabled=!1,this._defaultCenter&&this._defaultLevel&&(await this.mapView.goTo({center:this._defaultCenter,zoom:this._defaultLevel}),this._defaultCenter=void 0,this._defaultLevel=void 0)}handleMapClick(){this._mapClickHandle&&this._mapClickHandle.remove(),this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",this.onMapClick.bind(this))}async onMapClick(t){this.mapView.popupEnabled=!1;const i={include:this._validLayers},s=await this.mapView.hitTest(t,i);if(s.results.length>0){const t=[];s.results.forEach((function(i){"graphic"===i.type&&t.push(i.graphic)})),this.setSelectedFeatures(t),this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems]}}async _getTranslations(){const t=await o(this.el);this._translations=t[0]}_updateShareURL(){var t,i;const s=null===(t=this._shareNode)||void 0===t?void 0:t.shareUrl;if(!s)return;const e=new URL(s);this._selectedLayerId?e.searchParams.set("layerid",this._selectedLayerId):e.searchParams.delete("layerid"),(null===(i=this._selectedFeature)||void 0===i?void 0:i.length)?e.searchParams.set("oid",this._currentFeatureId):e.searchParams.delete("oid"),this._shareNode.shareUrl=e.href}async loadFeatureFromURLParams(){if(this.layerId&&this.objectId){const t=await c(this.mapView,this.layerId);if(t){const i=await n([Number(this.objectId)],t,[],!1,this.mapView.spatialReference);i.length&&(this._selectedFeature=i,this._flowItems=this._flowItems.length&&"feature-details"!==this._flowItems[this._flowItems.length-1]?[...this._flowItems,"feature-details"]:[...this._flowItems])}}}get el(){return a(this)}static get watchers(){return{isMobile:["isMobileWatchHandler"],mapView:["mapViewWatchHandler"]}}};r.style=":host{display:block;--calcite-label-margin-bottom:0px;--solutions-theme-foreground-color:var(--calcite-color-foreground-1)}.width-full{width:100% !important}.width-0{width:0}.height-full{height:100% !important}.height-0{height:0}.overflow-hidden{overflow:hidden}.border{border:1px solid var(--calcite-color-border-3)}.notice-msg{padding:10px;width:calc(100% - 20px)}.footer-top-button{padding-bottom:7px}.footer-button{height:35px}";export{r as crowdsource_reporter}
|