@esri/solutions-components 0.6.37 → 0.6.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. package/dist/cjs/calcite-alert_3.cjs.entry.js +1 -1
  2. package/dist/cjs/calcite-combobox_6.cjs.entry.js +1 -1
  3. package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +2 -2
  4. package/dist/cjs/card-manager_3.cjs.entry.js +7 -4
  5. package/dist/cjs/crowdsource-manager.cjs.entry.js +1 -1
  6. package/dist/cjs/{downloadUtils-37d9aaf3.js → downloadUtils-d8e48fbd.js} +55 -12
  7. package/dist/cjs/{index.es-d1d9b140.js → index.es-6159eedc.js} +4 -3
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/map-select-tools_3.cjs.entry.js +4 -3
  10. package/dist/cjs/{mapViewUtils-96172223.js → mapViewUtils-f7bbc35b.js} +5 -2
  11. package/dist/cjs/public-notification.cjs.entry.js +5 -4
  12. package/dist/cjs/{clean-url-d5326abb.js → restHelpersGet-c94617cf.js} +398 -0
  13. package/dist/cjs/solution-configuration.cjs.entry.js +565 -565
  14. package/dist/cjs/solution-contents_3.cjs.entry.js +2 -2
  15. package/dist/cjs/{solution-store-714601a2.js → solution-store-b40c2f46.js} +19 -383
  16. package/dist/cjs/solutions-components.cjs.js +1 -1
  17. package/dist/collection/components/crowdsource-manager/crowdsource-manager.js +10 -4
  18. package/dist/collection/components/map-card/map-card.js +26 -1
  19. package/dist/collection/components/public-notification/public-notification.js +6 -5
  20. package/dist/collection/utils/downloadUtils.js +50 -8
  21. package/dist/collection/utils/downloadUtils.ts +62 -9
  22. package/dist/collection/utils/interfaces.ts +2 -0
  23. package/dist/collection/utils/queryUtils.js +5 -2
  24. package/dist/collection/utils/queryUtils.ts +4 -2
  25. package/dist/components/crowdsource-manager.js +1 -1
  26. package/dist/components/downloadUtils.js +51 -8
  27. package/dist/components/map-card2.js +4 -1
  28. package/dist/components/public-notification.js +2 -2
  29. package/dist/components/queryUtils.js +5 -2
  30. package/dist/components/{clean-url.js → restHelpersGet.js} +392 -1
  31. package/dist/components/solution-configuration.js +552 -552
  32. package/dist/components/solution-store.js +2 -365
  33. package/dist/esm/calcite-alert_3.entry.js +1 -1
  34. package/dist/esm/calcite-combobox_6.entry.js +1 -1
  35. package/dist/esm/calcite-shell-panel_14.entry.js +2 -2
  36. package/dist/esm/card-manager_3.entry.js +7 -4
  37. package/dist/esm/crowdsource-manager.entry.js +1 -1
  38. package/dist/esm/{downloadUtils-76379e4a.js → downloadUtils-d41ecba9.js} +53 -10
  39. package/dist/esm/{index.es-0d134a52.js → index.es-b226bf47.js} +4 -3
  40. package/dist/esm/loader.js +1 -1
  41. package/dist/esm/map-select-tools_3.entry.js +4 -3
  42. package/dist/esm/{mapViewUtils-08f6cfce.js → mapViewUtils-1e2befd7.js} +5 -2
  43. package/dist/esm/public-notification.entry.js +5 -4
  44. package/dist/esm/{clean-url-bce022e6.js → restHelpersGet-a5ec2192.js} +392 -1
  45. package/dist/esm/solution-configuration.entry.js +552 -552
  46. package/dist/esm/solution-contents_3.entry.js +2 -2
  47. package/dist/esm/{solution-store-3ee6c7a3.js → solution-store-17bb0a75.js} +2 -365
  48. package/dist/esm/solutions-components.js +1 -1
  49. package/dist/solutions-components/{p-9800e602.entry.js → p-091120c5.entry.js} +1 -1
  50. package/dist/solutions-components/p-1b14b687.entry.js +6 -0
  51. package/dist/solutions-components/{p-646e983f.entry.js → p-2d143359.entry.js} +1 -1
  52. package/dist/solutions-components/{p-ac7332b3.entry.js → p-40e95e2b.entry.js} +1 -1
  53. package/dist/solutions-components/p-420e1585.entry.js +36 -0
  54. package/dist/solutions-components/p-4807b2a1.js +36 -0
  55. package/dist/solutions-components/p-56a3b81e.entry.js +6 -0
  56. package/dist/solutions-components/p-5856dc4f.js +66 -0
  57. package/dist/solutions-components/p-89b4b401.js +145 -0
  58. package/dist/solutions-components/{p-4ecad91c.entry.js → p-973625f8.entry.js} +1 -1
  59. package/dist/solutions-components/p-99391a15.entry.js +6 -0
  60. package/dist/solutions-components/{p-03130804.js → p-9ecb5d66.js} +1 -1
  61. package/dist/solutions-components/{p-b02eb8f4.js → p-a8661f1f.js} +30 -30
  62. package/dist/solutions-components/p-ba064f24.entry.js +6 -0
  63. package/dist/solutions-components/solutions-components.esm.js +1 -1
  64. package/dist/solutions-components/utils/downloadUtils.ts +62 -9
  65. package/dist/solutions-components/utils/interfaces.ts +2 -0
  66. package/dist/solutions-components/utils/queryUtils.ts +4 -2
  67. package/dist/types/components/crowdsource-manager/crowdsource-manager.d.ts +3 -3
  68. package/dist/types/components/map-card/map-card.d.ts +5 -1
  69. package/dist/types/components/public-notification/public-notification.d.ts +1 -1
  70. package/dist/types/components.d.ts +16 -8
  71. package/dist/types/utils/interfaces.d.ts +1 -0
  72. package/package.json +1 -1
  73. package/dist/solutions-components/p-13b21d19.entry.js +0 -36
  74. package/dist/solutions-components/p-15070568.js +0 -36
  75. package/dist/solutions-components/p-63867402.entry.js +0 -6
  76. package/dist/solutions-components/p-81a0c88f.entry.js +0 -6
  77. package/dist/solutions-components/p-b7804687.entry.js +0 -6
  78. package/dist/solutions-components/p-d0544f24.js +0 -192
  79. package/dist/solutions-components/p-eba875d9.entry.js +0 -6
  80. package/dist/solutions-components/p-ecc95259.js +0 -20
@@ -1,192 +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{c as e}from"./p-482534a7.js";import{d as t}from"./p-2a58e378.js";import{E as r,j as i,S as n}from"./p-ff0d7712.js";import{c as s,r as o}from"./p-ecc95259.js";
7
- /*! *****************************************************************************
8
- Copyright (c) Microsoft Corporation.
9
-
10
- Permission to use, copy, modify, and/or distribute this software for any
11
- purpose with or without fee is hereby granted.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
14
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
15
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
16
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
17
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
18
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19
- PERFORMANCE OF THIS SOFTWARE.
20
- ***************************************************************************** */
21
- var a=function(){return a=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},a.apply(this,arguments)};function c(e){return void 0===e&&(e={}),e.portal?s(e.portal):e.authentication?e.authentication.portal:"https://www.arcgis.com/sharing/rest"}function u(e){return e.owner?Promise.resolve(e.owner):e.item&&e.item.owner?Promise.resolve(e.item.owner):e.authentication&&e.authentication.getUsername?e.authentication.getUsername():Promise.reject(new Error("Could not determine the owner of this item. Pass the `owner`, `item.owner`, or `authentication` option."))}
22
- /** @license
23
- * Copyright 2018 Esri
24
- *
25
- * Licensed under the Apache License, Version 2.0 (the "License");
26
- * you may not use this file except in compliance with the License.
27
- * You may obtain a copy of the License at
28
- *
29
- * http://www.apache.org/licenses/LICENSE-2.0
30
- *
31
- * Unless required by applicable law or agreed to in writing, software
32
- * distributed under the License is distributed on an "AS IS" BASIS,
33
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34
- * See the License for the specific language governing permissions and
35
- * limitations under the License.
36
- */
37
- function l(e){return new Promise((t=>{p(e).then((e=>{try{t(JSON.parse(e))}catch(e){t(null)}}),(()=>t(null)))}))}function f(e,t,r){return e?
38
- /** @license
39
- * Copyright 2020 Esri
40
- *
41
- * Licensed under the Apache License, Version 2.0 (the "License");
42
- * you may not use this file except in compliance with the License.
43
- * You may obtain a copy of the License at
44
- *
45
- * http://www.apache.org/licenses/LICENSE-2.0
46
- *
47
- * Unless required by applicable law or agreed to in writing, software
48
- * distributed under the License is distributed on an "AS IS" BASIS,
49
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
50
- * See the License for the specific language governing permissions and
51
- * limitations under the License.
52
- */
53
- function(e,t,r){let i;try{i=new File(e,t,r)}catch(n){i=function(){void 0===r&&(r={type:""});const i=new Blob(e,r);return i.lastModified=new Date,i.name=t,i}()}return i}([e],t||"",{type:r||e.type}):null}function p(e){return new Promise((t=>{const r=new FileReader;r.onload=function(e){t(e.target.result||"")},r.readAsText(e)}))}function m(e,t){return t.split(".").reduce((function(e,t){return e?e[t]:void 0}),e)}function d(e,t,r){const i=t.split(".");i.reduce(((e,t,n)=>n===i.length-1?(e[t]=r,r):(e[t]||(e[t]={}),e[t])),e)}
54
- /** @license
55
- * Copyright 2018 Esri
56
- *
57
- * Licensed under the Apache License, Version 2.0 (the "License");
58
- * you may not use this file except in compliance with the License.
59
- * You may obtain a copy of the License at
60
- *
61
- * http://www.apache.org/licenses/LICENSE-2.0
62
- *
63
- * Unless required by applicable law or agreed to in writing, software
64
- * distributed under the License is distributed on an "AS IS" BASIS,
65
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
66
- * See the License for the specific language governing permissions and
67
- * limitations under the License.
68
- */
69
- const h="PK";function w(e,t,r=[]){return new Promise(((i,n)=>{(function(e,t,r={}){if(!e)return Promise.reject("Url must be provided");const i={authentication:t,rawResponse:!0,...r};return o(e,i).then((e=>e.blob()))})(e,t).then((e=>{v(e).then((e=>{"application/json"===e.type?l(e).then((t=>{if(t?.error){const e=t.error.code;void 0!==e&&r.indexOf(e)>=0?i(null):n(t)}else i(e)})):i(e)}),n)}),n)}))}function v(e){return new Promise(((t,r)=>{e&&e.size>0&&(e.type.startsWith("text/plain")||e.type.startsWith("application/json"))?p(e).then((r=>{try{JSON.parse(r),t(new Blob([e],{type:"application/json"}))}catch(i){r.length>4&&r.substr(0,4)===h?t(new Blob([e],{type:"application/zip"})):r.startsWith("<")?t(new Blob([e],{type:"text/xml"})):t(e)}}),r):e?t(e):r()}))}
70
- /** @license
71
- * Copyright 2018 Esri
72
- *
73
- * Licensed under the Apache License, Version 2.0 (the "License");
74
- * you may not use this file except in compliance with the License.
75
- * You may obtain a copy of the License at
76
- *
77
- * http://www.apache.org/licenses/LICENSE-2.0
78
- *
79
- * Unless required by applicable law or agreed to in writing, software
80
- * distributed under the License is distributed on an "AS IS" BASIS,
81
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82
- * See the License for the specific language governing permissions and
83
- * limitations under the License.
84
- */
85
- /** @license
86
- * Copyright 2020 Esri
87
- *
88
- * Licensed under the Apache License, Version 2.0 (the "License");
89
- * you may not use this file except in compliance with the License.
90
- * You may obtain a copy of the License at
91
- *
92
- * http://www.apache.org/licenses/LICENSE-2.0
93
- *
94
- * Unless required by applicable law or agreed to in writing, software
95
- * distributed under the License is distributed on an "AS IS" BASIS,
96
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
97
- * See the License for the specific language governing permissions and
98
- * limitations under the License.
99
- */
100
- function b(e,t=0){const i=e.split("/");let n=i.pop(),s="";const o=i.shift();let a=r.Resource;if(o)if(o.endsWith("_info_thumbnail"))a=r.Thumbnail;else if(o.endsWith("_info_metadata"))a=r.Metadata,n="metadata.xml";else if(o.endsWith("_info_data"))a=r.Data;else if(o.endsWith("_info_dataz"))n=n.replace(/\.zip$/,""),a=r.Data;else if(t<1){const e=o.indexOf("_");e>0&&(s=o.substr(e+1))}else s=i.join("/");return{type:a,folder:s,filename:n}}
101
- /** @license
102
- * Copyright 2021 Esri
103
- *
104
- * Licensed under the Apache License, Version 2.0 (the "License");
105
- * you may not use this file except in compliance with the License.
106
- * You may obtain a copy of the License at
107
- *
108
- * http://www.apache.org/licenses/LICENSE-2.0
109
- *
110
- * Unless required by applicable law or agreed to in writing, software
111
- * distributed under the License is distributed on an "AS IS" BASIS,
112
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113
- * See the License for the specific language governing permissions and
114
- * limitations under the License.
115
- */function S(e,t,r){return{...e,fetchedFromSource:t,copiedToDestination:r}}
116
- /** @license
117
- * Copyright 2021 Esri
118
- *
119
- * Licensed under the Apache License, Version 2.0 (the "License");
120
- * you may not use this file except in compliance with the License.
121
- * You may obtain a copy of the License at
122
- *
123
- * http://www.apache.org/licenses/LICENSE-2.0
124
- *
125
- * Unless required by applicable law or agreed to in writing, software
126
- * distributed under the License is distributed on an "AS IS" BASIS,
127
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128
- * See the License for the specific language governing permissions and
129
- * limitations under the License.
130
- */
131
- /** @license
132
- * Copyright 2021 Esri
133
- *
134
- * Licensed under the Apache License, Version 2.0 (the "License");
135
- * you may not use this file except in compliance with the License.
136
- * You may obtain a copy of the License at
137
- *
138
- * http://www.apache.org/licenses/LICENSE-2.0
139
- *
140
- * Unless required by applicable law or agreed to in writing, software
141
- * distributed under the License is distributed on an "AS IS" BASIS,
142
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
143
- * See the License for the specific language governing permissions and
144
- * limitations under the License.
145
- */
146
- function _(e,t,r,n=40){return new Promise((s=>{let o=[];const a=[];e.length>0&&function(e,t){const r=[];let i=0;for(;i<e.length;)r.push(e.slice(i,i+t)),i+=t;return r}(e,n).forEach(((e,t)=>{const r={filename:`resources${t}.zip`,zip:new i,filelist:[]};o=o.concat(e.map((e=>function(e,t){return e.folder?t.zip.folder(e.folder).file(e.filename,e.file,{binary:!0}):t.zip.file(e.filename,e.file,{binary:!0}),t.filelist.push(e),S(e,!0)}
147
- /** @license
148
- * Copyright 2021 Esri
149
- *
150
- * Licensed under the Apache License, Version 2.0 (the "License");
151
- * you may not use this file except in compliance with the License.
152
- * You may obtain a copy of the License at
153
- *
154
- * http://www.apache.org/licenses/LICENSE-2.0
155
- *
156
- * Unless required by applicable law or agreed to in writing, software
157
- * distributed under the License is distributed on an "AS IS" BASIS,
158
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
159
- * See the License for the specific language governing permissions and
160
- * limitations under the License.
161
- */(e,r)))),a.push(r)})),o.length>0?Promise.all(o).then((e=>{e=e.filter((e=>!(e.fetchedFromSource&&void 0===e.copiedToDestination))),function(e,t,r){return new Promise((i=>{const n=e.filter((e=>Object.keys(e.zip.files).length>0));n.length>0?g(n,t,r).then((e=>{i(e)})):i([])}))}(a,t,r).then((t=>{s(e.concat(t))}))})):s([])}))}function g(e,t,r){return new Promise((i=>{let n=[];const s=e.pop();let l=Promise.resolve([]);e.length>0&&(l=g(e,t,r)),l.then((e=>(n=e,new Promise((e=>{setTimeout((()=>e()),1e3)}))))).then((()=>function(e,t,r){return new Promise((i=>{e.zip.generateAsync({type:"blob"}).then((t=>f(t,e.filename,"application/zip"))).then((e=>{return u(i={id:t,resource:e,authentication:r,params:{archive:!0}}).then((function(e){var t=c(i)+"/content/users/"+e+"/items/"+i.id+"/addResources";return i.params=a({file:i.resource,fileName:i.name,resourcesPrefix:i.prefix,text:i.content,access:i.private?"private":"inherit"},i.params),o(t,i)}));var i})).then((()=>i(S(e,!0,!0))),(()=>i(S(e,!0,!1))))}))}(s,t,r))).then((e=>{e.filelist.forEach((t=>{n.push(S(t,!0,e.copiedToDestination))})),i(n)}))}))}
162
- /** @license
163
- * Copyright 2018 Esri
164
- *
165
- * Licensed under the Apache License, Version 2.0 (the "License");
166
- * you may not use this file except in compliance with the License.
167
- * You may obtain a copy of the License at
168
- *
169
- * http://www.apache.org/licenses/LICENSE-2.0
170
- *
171
- * Unless required by applicable law or agreed to in writing, software
172
- * distributed under the License is distributed on an "AS IS" BASIS,
173
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
174
- * See the License for the specific language governing permissions and
175
- * limitations under the License.
176
- */
177
- /** @license
178
- * Copyright 2022 Esri
179
- *
180
- * Licensed under the Apache License, Version 2.0 (the "License");
181
- * you may not use this file except in compliance with the License.
182
- * You may obtain a copy of the License at
183
- *
184
- * http://www.apache.org/licenses/LICENSE-2.0
185
- *
186
- * Unless required by applicable law or agreed to in writing, software
187
- * distributed under the License is distributed on an "AS IS" BASIS,
188
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
- * See the License for the specific language governing permissions and
190
- * limitations under the License.
191
- */
192
- const P={solutionItemId:"",defaultWkid:void 0,solutionData:{metadata:{},templates:[]},templateEdits:{},featureServices:[],spatialReferenceInfo:{enabled:!1,services:{},spatialReference:void 0}},y=class{static get Store(){return this._instance||(this._instance=new this)}constructor(){this._hasChanges=!1,this._store=e(Object.assign({},P))}getItemInfo(e){let t;return this._store.get("solutionData").templates.some((r=>e==r.itemId&&(t=r,!0))),t}getStoreInfo(e){return this._store.get(e)}async loadSolution(e,t){this._authentication=t;const r=await function(e,t){return new Promise((r=>{(function(e,t){return new Promise((r=>{const i=function(e,t){return`${function(e){return m(e,"portal")||"https://www.arcgis.com/sharing/rest"}(t)}/content/items/${e}/data`}(e,t);w(i,t,[400,500]).then((e=>r(v(e))),(()=>r(null)))}))})(e,t).then((e=>r(l(e))),(()=>r(null)))}))}(e,t);if(r){const i=m(r,"params.wkid.default");await this._prepareSolutionItemsForEditing(e,r.templates,t);const n=this._getFeatureServices(r.templates),s=this._getSpatialReferenceInfo(n,i);this._store.set("solutionItemId",e),this._store.set("defaultWkid",i),this._store.set("solutionData",r),this._store.set("featureServices",n),this._store.set("spatialReferenceInfo",s)}this._flagStoreHasChanges(!1)}replaceItemThumbnail(e){e.resourceFilePaths.forEach((e=>{e.type===r.Thumbnail&&(e.updateType===t.None?e.updateType=t.Remove:e.updateType!==t.Add&&e.updateType!==t.Update||(e.updateType=t.Obsolete))})),e.resourceFilePaths=e.resourceFilePaths.filter((e=>e.updateType!=t.Obsolete)),e.resourceFilePaths.push({blob:e.thumbnail,filename:e.thumbnail.name,type:r.Thumbnail,updateType:t.Add}),this.setItemInfo(e)}async saveSolution(){const e=this._store.get("solutionItemId"),t=this._store.get("solutionData"),r=this._store.get("spatialReferenceInfo");await this._prepareSolutionItemsForStorage(e,t.templates,this._authentication);const i=this._setSpatialReferenceInfo(r,t.templates);d(t,"params.wkid",i?{label:"Spatial Reference",default:i,valueType:"spatialReference",attributes:{required:"true"}}:{});const n={id:e,text:t};await function(e,t){return new Promise(((r,i)=>{var n;(n={item:e,folderId:void 0,authentication:t,params:{}},u(n).then((function(e){var t,r,i,s=n.folderId?c(n)+"/content/users/"+e+"/"+n.folderId+"/items/"+n.item.id+"/update":c(n)+"/content/users/"+e+"/items/"+n.item.id+"/update";return n.params=a(a({},n.params),(t=n.item,(r=JSON.parse(JSON.stringify(t))).data&&("undefined"!=typeof Blob&&t.data instanceof Blob||"ReadStream"===t.data.constructor.name?r.file=t.data:r.text=t.data,delete r.data),r)),n.params.extent&&(i=n.params.extent,Array.isArray(i)&&Array.isArray(i[0])&&Array.isArray(i[1]))&&(n.params.extent=function(e){return e.join(",")}(n.params.extent)),o(s,n)}))).then((e=>e.success?r(e):i(e)),(e=>i(e)))}))}(n,this._authentication)}setItemInfo(e){const t=this._store.get("solutionData");t.templates.some((r=>e.itemId==r.itemId&&(r=e,this._store.set("solutionData",t),this._flagStoreHasChanges(!0),!0)))}setStoreInfo(e,t){this._store.set(e,t),this._flagStoreHasChanges(!0)}_testAccess(e,t,r,i){switch(e){case"_emptyTheStore":this._emptyTheStore();break;case"_getFeatureServices":return this._getFeatureServices(t);case"_getItemsSharedWithThisGroup":return this._getItemsSharedWithThisGroup(t,r);case"_getResourceFilePaths":return this._getResourceFilePaths(t,r,i);case"_getResourceStorageName":return this._getResourceStorageName(t,r);case"_getSpatialReferenceInfo":return this._getSpatialReferenceInfo(t,r);case"_prepareSolutionItemsForEditing":return this._prepareSolutionItemsForEditing(t,r,i);case"_prepareSolutionItemsForStorage":return this._prepareSolutionItemsForStorage(t,r,i);case"_setSpatialReferenceInfo":return this._setSpatialReferenceInfo(t,r);case"_splitFilename":return this._splitFilename(t)}return null}_emptyTheStore(){this._store.set("solutionItemId",P.solutionItemId),this._store.set("defaultWkid",P.defaultWkid),this._store.set("solutionData",P.solutionData),this._store.set("templateEdits",P.templateEdits),this._store.set("featureServices",P.featureServices),this._store.set("spatialReferenceInfo",P.spatialReferenceInfo)}_flagStoreHasChanges(e){this._hasChanges!==e&&window.dispatchEvent(new CustomEvent("solutionStoreHasChanges",{detail:e,bubbles:!0,cancelable:!1,composed:!0})),this._hasChanges=e}_getCustomizableFeatureServices(e){return e.reduce(((e,t)=>("Feature Service"===t.type&&t.item.typeKeywords.indexOf("View Service")<0&&e.push(t),e)),[])}_getFeatureServices(e){return this._getCustomizableFeatureServices(e).map((e=>({name:e.item.title||e.item.name,enabled:m(e,"properties.service.spatialReference.wkid").toString().startsWith("{{params.wkid||")})))}_getItemsSharedWithThisGroup(e,t){return t.reduce(((t,r)=>(r.itemId!==e.itemId&&"Group"!==r.type&&t.push({id:r.itemId,title:r.item.name||r.item.title,isShared:(r.groups||[]).indexOf(e.itemId)>-1,shareItem:(r.groups||[]).indexOf(e.itemId)>-1,type:r.type,typeKeywords:r.item.typeKeywords}),t)),[])}_getResourceFilePaths(e,r,i){return function(e,t,r=[],i=0){return r.map((r=>{return{url:(n=e,s=t,o=r,((a=n)?a.endsWith("/")?a:a+"/":a)+"content/items/"+s+"/resources/"+o),...b(r,i)};var n,s,o,a}))}(i,e,r.resources,n).map((e=>(e.updateType=t.None,e)))}_getResourceStorageName(e,t){let i=e;switch(t.type){case r.Data:i=`${i}_info_data`;break;case r.Info:i=`${i}_info`;break;case r.Metadata:i=`${i}_info_metadata`;break;case r.Resource:break;case r.Thumbnail:i=`${i}_info_thumbnail`}let n=t.filename;return t.type==r.Data&&n&&!function(e){const t=e.match(/\.([a-z]+)$/i);return!!t&&"|.json|.xml|.txt|.png|.pbf|.zip|.jpeg|.jpg|.gif|.bmp|.gz|.svg|.svgz|.geodatabase|".indexOf("|"+t[0]+"|")>=0}(n)&&(n+=".zip",i+="z"),i+"/"+(t.folder?t.folder+"/"+n:n)}_getSpatialReferenceInfo(e,t){const r={};return e.forEach((e=>{r[e.name]=e.enabled})),{enabled:void 0!==t,services:r,spatialReference:t||void 0}}async _prepareSolutionItemsForEditing(e,t,i){const n=[];t.forEach((s=>{s.resourceFilePaths=this._getResourceFilePaths(e,s,i.portal),n.push(s.resourceFilePaths.length>0?function(e,t){let i,n;return t.forEach((e=>{e.type===r.Thumbnail&&(i=e.url,n=e.filename)})),i?function(e,t,r){return new Promise((i=>{(function(e,t,r,i=[],n){return new Promise(((s,o)=>{w(e,r,i).then((e=>s(e?f(e,t,n):null)),o)}))})(e,t,r,[500]).then(i,(()=>i(null)))}))}(i,n,e):Promise.resolve(null)}(i,s.resourceFilePaths):Promise.resolve()),s.groupDetails="Group"===s.type?this._getItemsSharedWithThisGroup(s,t):[]}));const s=await Promise.all(n);return t.forEach(((e,t)=>{e.thumbnail=s[t]?s[t]:void 0})),Promise.resolve()}async _prepareSolutionItemsForStorage(e,r,i){const n=[],s=[];return r.forEach((r=>{r.resourceFilePaths.forEach((async l=>{const f=this._getResourceStorageName(r.itemId,l);switch(l.updateType){case t.Add:const{prefix:p,suffix:m}=this._splitFilename(f);r.resources.push(f),n.push({itemId:r.itemId,file:l.blob,folder:p,filename:m});break;case t.Update:s.push(new Promise((async t=>{try{await function(e,t,r,i){const n=t.split("/"),s=n.length>1?n.slice(0,n.length-1).join("/"):void 0;return u(l={id:e,prefix:s,name:n[n.length-1],resource:r,authentication:i}).then((function(e){var t=c(l)+"/content/users/"+e+"/items/"+l.id+"/updateResources";return l.params=a({file:l.resource,fileName:l.name,resourcesPrefix:l.prefix,text:l.content},l.params),void 0!==l.private&&(l.params.access=l.private?"private":"inherit"),o(t,l)}));var l}(e,f,l.blob,i)}catch(e){console.log("Unable to update "+f+" for item "+r.itemId+": "+JSON.stringify(e))}t()})));break;case t.Remove:s.push(new Promise((async t=>{try{await function(e,t,r){return u(i={id:e,resource:t,authentication:r}).then((function(e){var t=c(i)+"/content/users/"+e+"/items/"+i.id+"/removeResources";return i.params=a(a({},i.params),{resource:i.resource}),void 0!==i.deleteAll&&(i.params.deleteAll=i.deleteAll),o(t,i)}));var i}(e,f,i),r.resources=r.resources.filter((e=>e!==f))}catch(e){console.log("Unable to remove "+f+" for item "+r.itemId+": "+JSON.stringify(e))}t()})))}return Promise.resolve()})),delete r.resourceFilePaths,delete r.thumbnail,delete r.groupDetails})),Promise.all(s).then((async()=>{var t,r,s;return n.length>0&&await(t=n,r=e,s=i,new Promise((e=>{_(t,r,s).then((t=>{e(t.filter((e=>e.fetchedFromSource&&e.copiedToDestination)).map((e=>e.folder+"/"+e.filename)))}))}))),Promise.resolve()}))}_setSpatialReferenceInfo(e,t){const r="{{params.wkid||",i=this._getCustomizableFeatureServices(t);return e.enabled?(i.forEach((t=>{let i;e.services[t.item.title||t.item.name]?(i=`{{params.wkid||${e.spatialReference}}}`,d(t,"properties.service.spatialReference.wkid",i)):(i=m(t,"properties.service.spatialReference.wkid"),i.toString().startsWith(r)&&(i=i.toString().substring(15,i.length-2),d(t,"properties.service.spatialReference.wkid",i)))})),e.spatialReference):void i.forEach((e=>{const t=m(e,"properties.service.spatialReference.wkid");t.toString().startsWith(r)&&d(e,"properties.service.spatialReference.wkid",t.toString().substring(15,t.length-2))}))}_splitFilename(e){const t=e.split("/");return{prefix:t.length>1?t.slice(0,t.length-1).join("/"):void 0,suffix:t[t.length-1]}}}.Store;export{m as g,y as s}
@@ -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,h as i,H as s,g as e,c as a}from"./p-91c78d98.js";import{g as h}from"./p-99d8a839.js";import{q as o,a as l,g as n,b as d}from"./p-15070568.js";import{l as r}from"./p-05948b48.js";import{d as c}from"./p-b02eb8f4.js";import"./p-e1a4994d.js";import"./p-2a58e378.js";import"./p-ecc95259.js";const p=class{constructor(i){t(this,i),this.layer=void 0,this.mapView=void 0,this.zoomAndScrollToSelected=void 0,this._cardLoading=!1,this._graphics=void 0,this._translations=void 0}async featureSelectionChange(t){const i=t.detail;this._cardLoading=!0;const s=i.length>0?await o(i,this.layer,[],!1,this.mapView.spatialReference):[];this._graphics=s.sort(((t,s)=>i.indexOf(t.getObjectId())-i.indexOf(s.getObjectId()))),this._cardLoading=!1}async layerSelectionChange(t){const i=t.detail[0];this.layer=await l(this.mapView,i)}async componentWillLoad(){await this._getTranslations()}render(){var t,e;const a=(null===(t=this._graphics)||void 0===t?void 0:t.length)>0?"":"display-none",h=(null===(e=this._graphics)||void 0===e?void 0:e.length)>0?"display-none":"";return i(s,null,i("div",{class:"overflow-auto height-full"},i("calcite-shell",{class:"position-relative "+a},i("div",null,i("info-card",{graphics:this._graphics,isLoading:this._cardLoading,mapView:this.mapView,zoomAndScrollToSelected:this.zoomAndScrollToSelected}))),i("calcite-shell",{class:"position-relative "+h},i("div",{class:"padding-1"},i("calcite-notice",{icon:"table",open:!0},i("div",{slot:"message"},this._translations.selectFeaturesToStart))))))}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}};p.style=":host{display:block !important}.display-flex{display:flex}.display-none{display:none}.w-100{width:100%}.padding-bottom-1{padding-bottom:1rem}.padding-1{padding:1rem}.position-relative{position:relative}.focus-margin{margin:1px 1px 0px 1px}.overflow-auto{overflow:auto}.height-full{height:100%}card-manager{display:block}";const u=class{constructor(i){t(this,i),this.featureSelectionChange=a(this,"featureSelectionChange",7),this.openFilterOptions=a(this,"openFilterOptions",7),this._allIds=[],this._tableSorting=!1,this.onTableNodeCreate=t=>{this._tableNode=t},this.enableAutoRefresh=void 0,this.enableCSV=void 0,this.enableInlineEdit=void 0,this.enableZoom=void 0,this.mapInfo=void 0,this.mapView=void 0,this.onlyShowUpdatableLayers=void 0,this.showNewestFirst=void 0,this.zoomAndScrollToSelected=void 0,this._confirmDelete=!1,this._controlsThatFit=void 0,this._fetchingData=!1,this._isDeleting=!1,this._layer=void 0,this._selectedIndexes=[],this._showOnlySelected=!1,this._sortActive=!1,this._translations=void 0}enableZoomWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableCSVWatchHandler(){var t;(null===(t=this._toolInfos)||void 0===t?void 0:t.length)>0&&this._initToolInfos()}enableInlineEditWatchHandler(){this._table&&(this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit)}_controlsThatFitWatchHandler(){const t=this._controlsThatFit?this._controlsThatFit.reduce(((t,i)=>(t.push(i.id),t)),[]):[];this._toolInfos=this._toolInfos.map((i=>{if(i&&this._controlsThatFit){const s=this._getId(i.icon);return i.isOverflow=t.indexOf(s)<0,i}}))}async mapViewWatchHandler(){this._mapClickHandle&&this._mapClickHandle.remove(),this.mapView&&(this._mapClickHandle=this.reactiveUtils.on((()=>this.mapView),"click",(t=>{this._mapClicked(t)})))}async _layerWatchHandler(){this._fetchingData=!0,await this._resetTable(),this._fetchingData=!1}async _selectedIndexesWatchHandler(){this._validateEnabledActions()}async _sortActiveWatchHandler(){this._sortActive||await this._sortTable()}async selectionChanged(t){if(this.zoomAndScrollToSelected){const i=t.detail,s=i.getObjectId(),e=this._table.viewModel.getObjectIdIndex(s);this._table.scrollToIndex(e);const a=i.layer;let h;this.mapView.allLayerViews.toArray().some((t=>{if(t.layer.title===a.title&&"feature"===t.layer.type)return h=t,!0})),h&&await n([s],h,this.mapView,!0)}}async editsComplete(){await this._refresh()}noLayersFound(){this._layer=void 0,this._allIds=[],this._clearSelection()}async componentWillLoad(){await this._getTranslations(),await this._initModules(),this._initToolInfos(),this._resizeObserver=new ResizeObserver((()=>this._onResize()))}render(){const t=this._fetchingData?"display-none":"",e=this._fetchingData?"":"display-none",a=this._allIds.length.toString(),h=this._selectedIndexes.length.toString();return i(s,null,i("calcite-shell",null,this._getTableControlRow("header"),i("div",{class:"height-full-adjusted width-full"},i("calcite-panel",{class:"height-full width-full"},i("calcite-loader",{class:e,label:this._translations.fetchingData,scale:"l"}),i("div",{class:t,ref:this.onTableNodeCreate})),i("div",{class:"bottom-left text-color height-19"},this._translations.recordsSelected.replace("{{total}}",a).replace("{{selected}}",h)))),this._deleteMessage())}async componentDidLoad(){this._resizeObserver.observe(this._toolbar)}componentDidRender(){this._updateToolbar()}async _initModules(){const[t,i]=await r(["esri/widgets/FeatureTable","esri/core/reactiveUtils"]);this.FeatureTable=t,this.reactiveUtils=i}_onResize(){this._updateToolbar()}_getTableControlRow(t){const s="more-table-options";return i("div",{class:"display-flex border-bottom height-51",ref:t=>this._toolbar=t,slot:t},this._getActionBar(),this._getDropdown(s),this._getToolTip("","bottom",s,this._translations.moreOptions))}_getActionBar(){return i("calcite-action-bar",{expandDisabled:!0,expanded:!0,id:this._getId("bar"),layout:"horizontal"},i("div",{class:"border-end",id:"solutions-map-layer-picker-container"},i("map-layer-picker",{appearance:"transparent",mapView:this.mapView,onLayerSelectionChange:t=>this._layerSelectionChanged(t),onlyShowUpdatableLayers:this.onlyShowUpdatableLayers,placeholderIcon:"layers",scale:"l",showTables:!0,type:"dropdown"})),this._getActions())}_getActions(){return this._getActionItems().reduce(((t,i)=>(i&&!i.isOverflow&&t.push(i.isDanger?this._getDangerAction(i.icon,i.label,i.func,i.disabled):this._getAction(i.icon,i.label,i.func,i.disabled)),t)),[])}_validateEnabledActions(){const t=this._featuresSelected(),i=["zoom-to-object","trash","erase","selected-items-filter"];this._toolInfos.forEach((s=>{s&&i.indexOf(s.icon)>-1&&(s.disabled=!t)}))}_initToolInfos(){var t;const i=this._featuresSelected(),s=this._featuresEmpty();this._toolInfos=[this.enableZoom?{icon:"zoom-to-object",label:this._translations.zoom,func:()=>this._zoom(),disabled:!i,isOverflow:!1}:void 0,(null===(t=this.mapInfo)||void 0===t?void 0:t.filters)?{icon:"filter",label:this._translations.filters,func:()=>this._filter(),disabled:!1,isOverflow:!1}:void 0,this._deleteEnabled?{icon:"trash",label:this._translations.delete,func:()=>this._delete(),disabled:!i,isDanger:!0,isOverflow:!1}:void 0,{icon:"erase",label:this._translations.clearSelection,func:()=>this._clearSelection(),disabled:!i,isOverflow:!1},{icon:"selected-items-filter",label:this._showOnlySelected?this._translations.showAll:this._translations.showSelected,func:()=>this._toggleShowSelected(),disabled:!i,isOverflow:!1},{icon:"list-check-all",func:()=>this._selectAll(),label:this._translations.selectAll,disabled:s,isOverflow:!1},{icon:"compare",func:()=>this._switchSelected(),label:this._translations.switchSelected,disabled:s,isOverflow:!1},{icon:"refresh",func:()=>this._refresh(),label:this._translations.refresh,disabled:!1,isOverflow:!1},this.enableCSV?{icon:"export",func:()=>{this._exportToCSV()},label:this._translations.exportCSV,disabled:s,isOverflow:!1}:void 0],this._defaultVisibleToolSizeInfos=void 0}_featuresSelected(){return this._selectedIndexes.length>0}_featuresEmpty(){return 0===this._allIds.length}_updateToolbar(){this._timeout&&clearTimeout(this._timeout),this._timeout=setTimeout((()=>{clearTimeout(this._timeout),this._setToolbarSizeInfos();const t=this._toolbar.offsetWidth;let i=this._toolbarSizeInfos.reduce(((t,i)=>t+i.width),0);const s=["solutions-more","solutions-map-layer-picker-container"];if(i>t){if(this._toolbarSizeInfos.length>0){const e=[...this._toolbarSizeInfos].reverse().reduce(((e,a)=>(s.indexOf(a.id)<0&&(i>t?i-=a.width:e.push(a)),e)),[]).reverse();this._setControlsThatFit(e,s)}}else if(this._defaultVisibleToolSizeInfos){const e=this._toolbarSizeInfos.reduce(((t,i)=>(t.push(i.id),t)),[]);let a=!1;const h=[...this._defaultVisibleToolSizeInfos].reduce(((h,o)=>(!a&&s.indexOf(o.id)<0&&(e.indexOf(o.id)>-1||i+o.width<=t)?(e.indexOf(o.id)<0&&(i+=o.width),h.push(o)):s.indexOf(o.id)<0&&i+o.width>t&&(a=!0),h)),[]);this._setControlsThatFit(h,s)}}),5)}_setControlsThatFit(t,i){let s=JSON.stringify(t)!==JSON.stringify(this._controlsThatFit);document.getElementById("solutions-action-bar").childNodes.forEach((t=>{i.indexOf(t.id)<0&&!s&&(s=this._controlsThatFit.map((t=>t.id)).indexOf(t.id)<0)})),s&&(this._controlsThatFit=[...t])}_setToolbarSizeInfos(){let t=!1;this._toolbarSizeInfos=[],this._toolbar.childNodes.forEach(((i,s)=>{0===s?i.childNodes.forEach((i=>{this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0)})):i.referenceElement||(this._toolbarSizeInfos.push({id:i.id,width:i.offsetWidth}),t||(t=i.offsetWidth>0))})),t&&!this._defaultVisibleToolSizeInfos&&(this._defaultVisibleToolSizeInfos=[...this._toolbarSizeInfos])}_getActionItems(){return this._toolInfos.filter((t=>t&&!t.isOverflow))}_getDropdown(t){const s=this._getDropdownItems();return s.length>0?i("calcite-dropdown",{disabled:void 0===this._layer,id:"solutions-more"},i("calcite-action",{appearance:"solid",id:t,label:"",slot:"trigger",text:""},i("calcite-button",{appearance:"transparent",iconEnd:"chevron-down",kind:"neutral"},this._translations.more)),i("calcite-dropdown-group",{"selection-mode":"none"},s.map((t=>i("calcite-dropdown-item",{iconStart:t.icon,onClick:t.func},t.label))))):void 0}_getDropdownItems(){return this._toolInfos.filter((t=>t&&t.isOverflow))}_getAction(t,s,e,a){const h=void 0===this._layer||a;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:h,icon:t,id:t,label:s,onClick:e,text:s,textEnabled:!0}),this._getToolTip("","bottom",t,s))}_getToolTip(t,s,e,a){return i("calcite-tooltip",{label:t,placement:s,"reference-element":e},i("span",null,a))}_getId(t){return`solutions-action-${t}`}_getDangerAction(t,s,e,a){const h=void 0===this._layer||a;return i("div",{class:"display-flex",id:this._getId(t)},i("calcite-action",{appearance:"solid",disabled:h,id:t,onClick:e,text:""},i("calcite-button",{appearance:"transparent",iconStart:t,kind:"danger"},s)),this._getToolTip("","bottom",t,s))}async _getTable(t,i){this._layer&&(await this._layer.when((()=>{this._table=new this.FeatureTable({autoRefreshEnabled:this.enableAutoRefresh,layer:this._layer,view:this.mapView,editingEnabled:this._editEnabled&&this.enableInlineEdit,highlightEnabled:!0,multiSortEnabled:!1,visibleElements:{header:!1,menu:!1},tableTemplate:{columnTemplates:i},container:t})})),this._checkEditEnabled(),await this._table.when((()=>{this._table.highlightIds.on("change",(()=>{this._selectedIndexes=this._table.highlightIds.toArray().reverse(),this._showOnlySelected&&(this._featuresSelected()?this._table.filterBySelection():this._toggleShowSelected()),this.featureSelectionChange.emit(this._selectedIndexes)})),this.reactiveUtils.watch((()=>this._table.activeSortOrders),(t=>{var i,s,e,a;this._sortActive=!!this._layer&&(t.length>0&&"asc"===(null===(i=t[0])||void 0===i?void 0:i.direction)||"desc"===(null===(s=t[0])||void 0===s?void 0:s.direction)||null===(null===(e=t[0])||void 0===e?void 0:e.direction)&&(null===(a=t[0])||void 0===a?void 0:a.fieldName)===this._layer.objectIdField)}))})))}async _resetTable(){var t,i;this._clearSelection(),this._allIds=[],this.featureSelectionChange.emit(this._selectedIndexes);const s=this._getColumnTemplates(this._layer.id,null===(i=null===(t=this._layer)||void 0===t?void 0:t.popupTemplate)||void 0===i?void 0:i.fieldInfos);this._allIds=await d(this._layer),this._table?s&&(this._table.tableTemplate.columnTemplates=s):await this._getTable(this._tableNode,s),this._table.layer=this._layer,this._table.view=this.mapView,this._checkEditEnabled(),this._table.editingEnabled=this._editEnabled&&this.enableInlineEdit,this._initToolInfos(),await this._table.when((()=>{this._table.highlightIds.removeAll(),this._table.clearSelectionFilter()})),this._showOnlySelected=!1,this._sortActive=!1,await this._sortTable()}_checkEditEnabled(){this._editEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsUpdate,this._deleteEnabled=this._layer.editingEnabled&&this._layer.capabilities.operations.supportsDelete}async _sortTable(){this._table&&this._layer&&!this._sortActive&&!this._tableSorting&&this.showNewestFirst&&(this._tableSorting=!0,await this._table.when(),await this._layer.when((()=>{this._table.sortColumn(this._layer.objectIdField,"desc"),this._tableSorting=!1})))}_deleteMessage(){return i("calcite-modal",{"aria-labelledby":"modal-title",kind:"danger",onCalciteModalClose:()=>this._deleteClosed(),open:this._confirmDelete},i("div",{class:"display-flex align-center",id:"modal-title",slot:"header"},this._translations.deleteFeature),i("div",{slot:"content"},this._translations.confirm),i("calcite-button",{appearance:"outline",kind:"danger",onClick:()=>this._deleteClosed(),slot:"secondary",width:"full"},this._translations.cancel),i("calcite-button",{kind:"danger",loading:this._isDeleting,onClick:()=>{this._deleteFeatures()},slot:"primary",width:"full"},this._translations.delete))}async _deleteFeatures(){this._isDeleting=!0;const t=this._table.highlightIds.toArray().map((t=>({objectId:t})));await this._layer.applyEdits({deleteFeatures:t}),await this._table.refresh(),this._allIds=await d(this._layer),this._isDeleting=!1,this._deleteClosed()}async _mapClicked(t){const i={include:this._layer},s=await this.mapView.hitTest(t.screenPoint,i);s.results.length>0&&(s.results.forEach((t=>{this._clearSelection();const i=t.graphic.getObjectId(),s=this._table.highlightIds.indexOf(i);s>-1?this._table.highlightIds.removeAt(s):this._table.highlightIds.add(i)})),this._showOnlySelected&&this._table.filterBySelection())}_deleteClosed(){this._confirmDelete=!1}_selectAll(){const t=this._allIds;this._table.highlightIds.addMany(t),this._selectedIndexes=t}_toggleShowSelected(){this._showOnlySelected=!this._showOnlySelected,this._showOnlySelected?this._table.filterBySelection():this._table.clearSelectionFilter()}_clearSelection(){var t;this._selectedIndexes=[],null===(t=this._table)||void 0===t||t.highlightIds.removeAll()}_filter(){this.openFilterOptions.emit()}_switchSelected(){const t=[...this._selectedIndexes];this._table.highlightIds.removeAll();const i=this._allIds.reduce(((i,s)=>(t.indexOf(s)<0&&i.push(s),i)),[]).sort(((t,i)=>t-i));this._table.highlightIds.addMany(i),this._selectedIndexes=i}async _exportToCSV(){const t={},i=this._table.highlightIds.toArray();t[this._layer.id]={selectionSetNames:[this._layer.title],ids:i,layer:this._layer},c(null,t,!1,!1,!0)}async _refresh(){await this._table.refresh(),this.featureSelectionChange.emit(this._selectedIndexes)}_zoom(){this._table.zoomToSelection()}_delete(){this._confirmDelete=!0}async _layerSelectionChanged(t){var i;const s=t.detail[0];if(s!==(null===(i=this._layer)||void 0===i?void 0:i.id)||this._featuresEmpty()){this._fetchingData=!0;const t=await l(this.mapView,s);await t.when((()=>{this._layer=t}))}this._fetchingData=!1}_getColumnTemplates(t,i){var s;let e;null===(s=this.mapInfo.layerInfos)||void 0===s||s.some((i=>{if(i.id===t)return e=i,!0}));let a=null==e?void 0:e.columnTemplates;return i&&(a=a?a.map((t=>(i.some((i=>{if(i.fieldName===t.fieldName)return t.label=i.label,!0})),t))):i.map((t=>({type:"field",fieldName:t.fieldName,label:t.label})))),a}async _getTranslations(){const t=await h(this.el);this._translations=t[0]}get el(){return e(this)}static get watchers(){return{enableZoom:["enableZoomWatchHandler"],enableCSV:["enableCSVWatchHandler"],enableInlineEdit:["enableInlineEditWatchHandler"],_controlsThatFit:["_controlsThatFitWatchHandler"],mapView:["mapViewWatchHandler"],_layer:["_layerWatchHandler"],_selectedIndexes:["_selectedIndexesWatchHandler"],_sortActive:["_sortActiveWatchHandler"]}}};u.style=':host{display:block}.height-full{height:100%}.height-full-adjusted{height:calc(100% - 20px)}.width-full{width:100%}.display-flex{display:flex}.table-border{border:1px solid var(--calcite-ui-border-2)}.border-end{border-inline-end:1px solid var(--calcite-ui-border-2)}.border-bottom{border-bottom:1px solid var(--calcite-ui-border-2)}.padding-5{padding:5px}.padding-end-1{padding-inline-end:1rem}.height-51{height:51px}.bottom-left{position:absolute;left:0;bottom:0;padding-left:5px}html[dir="rtl"] .bottom-left{position:absolute;right:0;bottom:0;padding-right:5px}.height-19{height:19px}.background{background-color:var(--calcite-ui-background)}.text-color{color:var(--calcite-ui-text-1)}.align-center{align-items:center}.danger-color{color:var(--calcite-ui-danger)}.esri-feature-table vaadin-grid{border:none !important}vaadin-grid-cell-content{padding:var(--lumo-space-xs) var(--lumo-space-m) !important;font-size:14px !important}';const b=class{constructor(i){t(this,i),this.mapChanged=a(this,"mapChanged",7),this.beforeMapChanged=a(this,"beforeMapChanged",7),this._loadedId="",this.enableHome=void 0,this.enableLegend=void 0,this.enableFloorFilter=void 0,this.enableFullscreen=void 0,this.enableSearch=void 0,this.enableBasemap=void 0,this.basemapConfig=void 0,this.hidden=void 0,this.mapInfos=[],this.mapView=void 0,this._searchConfiguration=void 0,this._webMapInfo=void 0}enableHomeWatchHandler(){this._initHome()}async mapInfoChange(t){await this._loadMap(t.detail)}async componentWillLoad(){await this._initModules()}render(){const t=this.hidden?"visibility-hidden":"";return i(s,null,i("map-picker",{mapInfos:this.mapInfos}),i("div",{class:`map-height ${t}`,ref:t=>this._mapDiv=t}),i("map-tools",{basemapConfig:this.basemapConfig,class:"box-shadow",enableBasemap:this.enableBasemap,enableFloorFilter:this.enableFloorFilter,enableFullscreen:this.enableFullscreen,enableLegend:this.enableLegend,enableSearch:this.enableSearch,mapView:this.mapView,ref:t=>this._mapTools=t,searchConfiguration:this._searchConfiguration}))}async _initModules(){const[t,i,s]=await r(["esri/WebMap","esri/views/MapView","esri/widgets/Home"]);this.WebMap=t,this.MapView=i,this.Home=s}async _loadMap(t){let i=null==t?void 0:t.id;if(this._webMapInfo=(""===i||!i)&&this.mapInfos.length>0?this.mapInfos[0]:t,i=this._webMapInfo.id,this._loadedId!==i){const t=new this.WebMap({portalItem:{id:i}});this.mapView=new this.MapView({container:this._mapDiv,map:t,resizeAlign:"top-left"}),this._loadedId=i,this._searchConfiguration=this._webMapInfo.searchConfiguration,this.beforeMapChanged.emit(),await this.mapView.when((()=>{this._initHome(),this.mapView.ui.add(this._mapTools,{position:"top-right",index:0}),this.mapChanged.emit({id:i,mapView:this.mapView})}))}}_initHome(){this.enableHome?(this._homeWidget=new this.Home({view:this.mapView}),this.mapView.ui.add(this._homeWidget,{position:"top-left",index:3})):this._homeWidget&&this.mapView.ui.remove(this._homeWidget)}get el(){return e(this)}static get watchers(){return{enableHome:["enableHomeWatchHandler"]}}};b.style=":host{display:block;--calcite-label-margin-bottom:0;--calcite-block-padding:0}.map-height{height:calc(100% - 51px)}.box-shadow{box-shadow:none !important}.visibility-hidden{visibility:hidden}";export{p as card_manager,u as layer_table,b as map_card}
@@ -1,20 +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
- /*! *****************************************************************************
7
- Copyright (c) Microsoft Corporation.
8
-
9
- Permission to use, copy, modify, and/or distribute this software for any
10
- purpose with or without fee is hereby granted.
11
-
12
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
13
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
14
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
15
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
16
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
17
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
18
- PERFORMANCE OF THIS SOFTWARE.
19
- ***************************************************************************** */
20
- var e=function(r,t){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)r.hasOwnProperty(t)&&(e[t]=r[t])},e(r,t)},r=function(){return r=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e},r.apply(this,arguments)};function t(e){return Object.keys(e).some((function(r){var t=e[r];if(!t)return!1;switch(t&&t.toParam&&(t=t.toParam()),t.constructor.name){case"Array":case"Object":case"Date":case"Function":case"Boolean":case"String":case"Number":return!1;default:return!0}}))}function n(e){var r={};return Object.keys(e).forEach((function(t){var n,o,i=e[t];if(i&&i.toParam&&(i=i.toParam()),i||0===i||"boolean"==typeof i||"string"==typeof i){var a;switch(i.constructor.name){case"Array":var u=null===(o=null===(n=i[0])||void 0===n?void 0:n.constructor)||void 0===o?void 0:o.name;a="Array"===u?i:"Object"===u?JSON.stringify(i):i.join(",");break;case"Object":a=JSON.stringify(i);break;case"Date":a=i.valueOf();break;case"Function":a=null;break;case"Boolean":a=i+"";break;default:a=i}(a||0===a||"string"==typeof a||Array.isArray(a))&&(r[t]=a)}})),r}function o(e,r){return Array.isArray(r)&&r[0]&&Array.isArray(r[0])?r.map((function(r){return o(e,r)})).join("&"):encodeURIComponent(e)+"="+encodeURIComponent(r)}function i(e){var r=n(e);return Object.keys(r).map((function(e){return o(e,r[e])})).join("&")}var a=function(e,r,t,n,o){e=e||"UNKNOWN_ERROR",r=r||"UNKNOWN_ERROR_CODE",this.name="ArcGISRequestError",this.message="UNKNOWN_ERROR_CODE"===r?e:r+": "+e,this.originalMessage=e,this.code=r,this.response=t,this.url=n,this.options=o};(a.prototype=Object.create(Error.prototype)).constructor=a;var u="@esri/arcgis-rest-js",c={httpMethod:"POST",params:{f:"json"}},f=function(t){function n(e,r,n,o,i){void 0===e&&(e="AUTHENTICATION_ERROR"),void 0===r&&(r="AUTHENTICATION_ERROR_CODE");var a=t.call(this,e,r,n,o,i)||this;return a.name="ArcGISAuthError",a.message="AUTHENTICATION_ERROR_CODE"===r?e:r+": "+e,a}return function(r,t){function n(){this.constructor=r}e(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(n,t),n.prototype.retry=function(e,t){var n=this;void 0===t&&(t=3);var o=0,i=function(a,u){e(n.url,n.options).then((function(e){var t=r(r({},n.options),{authentication:e});return o+=1,s(n.url,t)})).then((function(e){a(e)})).catch((function(e){"ArcGISAuthError"===e.name&&o<t?i(a,u):u("ArcGISAuthError"===e.name&&o>=t?n:e)}))};return new Promise((function(e,r){i(e,r)}))},n}(a);function s(e,o){void 0===o&&(o={params:{f:"json"}});var s=r(r(r({httpMethod:"POST"},c),o),{params:r(r({},c.params),o.params),headers:r(r({},c.headers),o.headers)}),d=[],h=[];if(s.fetch||"undefined"==typeof fetch?(d.push("`fetch`"),h.push("`node-fetch`")):s.fetch=fetch.bind(Function("return this")()),"undefined"==typeof Promise&&(d.push("`Promise`"),h.push("`es6-promise`")),"undefined"==typeof FormData&&(d.push("`FormData`"),h.push("`isomorphic-form-data`")),!s.fetch||"undefined"==typeof Promise||"undefined"==typeof FormData)throw new Error("`arcgis-rest-request` requires a `fetch` implementation and global variables for `Promise` and `FormData` to be present in the global scope. You are missing "+d.join(", ")+". We recommend installing the "+h.join(", ")+" modules at the root of your application to add these to the global scope. See https://bit.ly/2KNwWaJ for more info.");var l=s.httpMethod,O=s.authentication,v=s.rawResponse,p=r({f:"json"},s.params),m=null,R={method:l,credentials:s.credentials||"same-origin"};return s.headers&&s.headers["X-Esri-Auth-Client-Id"]&&e.indexOf("/oauth2/platformSelf")>-1&&(R.credentials="include"),(O?O.getToken(e,{fetch:s.fetch}).catch((function(r){return r.url=e,r.options=s,m=r,Promise.resolve("")})):Promise.resolve("")).then((function(o){o.length&&(p.token=o),O&&O.getDomainCredentials&&(R.credentials=O.getDomainCredentials(e));var a={};if("GET"===R.method){p.token&&s.hideToken&&"undefined"==typeof window&&(a["X-Esri-Authorization"]="Bearer "+p.token,delete p.token);var c=""===i(p)?e:e+"?"+i(p);s.maxUrlLength&&c.length>s.maxUrlLength||p.token&&s.hideToken?(R.method="POST",o.length&&s.hideToken&&(p.token=o,delete a["X-Esri-Authorization"])):e=c}var f=new RegExp("/items/.+/updateResources").test(e);return"POST"===R.method&&(R.body=function(e,r){var o=t(e)||r,a=n(e);if(o){var u=new FormData;return Object.keys(a).forEach((function(e){"undefined"!=typeof Blob&&a[e]instanceof Blob?u.append(e,a[e],a.fileName||a[e].name||e):u.append(e,a[e])})),u}return i(e)}(p,f)),R.headers=r(r({},a),s.headers),"undefined"!=typeof window||R.headers.referer||(R.headers.referer=u),t(p)||f||(R.headers["Content-Type"]="application/x-www-form-urlencoded"),s.fetch(e,R)})).then((function(r){if(!r.ok)throw new a(r.statusText,"HTTP "+r.status,r,e,s);if(v)return r;switch(p.f){case"json":case"geojson":return r.json();case"html":case"text":return r.text();default:return r.blob()}})).then((function(r){if("json"!==p.f&&"geojson"!==p.f||v)return r;var t=function(e,r,t,n,o){if(e.code>=400)throw new a(u=e.message,c=e.code,e,r,n);if(e.error){var i=e.error,u=i.message,c=i.code,s=i.messageCode,d=s||c||"UNKNOWN_ERROR_CODE";if(498===c||499===c||"GWM_0003"===s||400===c&&"Unable to generate token."===u)throw o||new f(u,d,e,r,n);throw new a(u,d,e,r,n)}if("failed"===e.status||"failure"===e.status){u=void 0,c="UNKNOWN_ERROR_CODE";try{u=JSON.parse(e.statusMessage).message,c=JSON.parse(e.statusMessage).code}catch(r){u=e.statusMessage||e.message}throw new a(u,c,e,r,n)}return e}(r,e,0,s,m);if(m){var n=e.toLowerCase().split(/\/rest(\/admin)?\/services\//)[0];s.authentication.federatedServers[n]={token:[],expires:new Date(Date.now()+864e5)},m=null}return t}))}function d(e){return"string"!=typeof e||"/"===(e=e.trim())[e.length-1]&&(e=e.slice(0,-1)),e}export{f as A,u as N,r as _,d as c,i as e,s as r}