@arcgis/portal-components 5.2.0-next.128 → 5.2.0-next.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{VYSXZV3P.js → 34DIIWGC.js} +1 -1
- package/dist/cdn/{GY2UDPPY.js → 3NA4M2MH.js} +1 -1
- package/dist/cdn/{2OLIWJSK.js → 3YCGEFQP.js} +76 -76
- package/dist/cdn/{GTJVWTBP.js → 3YS4G5QE.js} +1 -1
- package/dist/cdn/{Z2U2FCOG.js → 426RS2JW.js} +1 -1
- package/dist/cdn/4FQWB6HA.js +2 -0
- package/dist/cdn/4LMVMZGG.js +2 -0
- package/dist/cdn/{LF7XRDJV.js → 5D75JDVE.js} +1 -1
- package/dist/cdn/{L7I6ICK3.js → 6NRVGSZJ.js} +1 -1
- package/dist/cdn/{BNB52PQ5.js → 74OADAQ6.js} +1 -1
- package/dist/cdn/{X4QIAIVV.js → 7TN5Q3I2.js} +1 -1
- package/dist/cdn/{QVO5OJEF.js → BJ6YM6ZC.js} +1 -1
- package/dist/cdn/{7CYER4HF.js → BV6XVVX2.js} +1 -1
- package/dist/cdn/{AMTGDRMF.js → BYEIB47T.js} +1 -1
- package/dist/cdn/{WT3GFMPD.js → C2WQAFUM.js} +1 -1
- package/dist/cdn/{AXZFLIWM.js → CGBXIK2L.js} +1 -1
- package/dist/cdn/{VRWK3ZLB.js → CVTQ3A4T.js} +1 -1
- package/dist/cdn/{YPNVFSI3.js → DPNKUVXU.js} +1 -1
- package/dist/cdn/{TXVCTVOE.js → E2AHTEKS.js} +1 -1
- package/dist/cdn/{JZVWY2TG.js → EBUPCIL6.js} +1 -1
- package/dist/cdn/{JDBUB3NR.js → EJXMHOYA.js} +1 -1
- package/dist/cdn/{T66AWQWW.js → EOQHBWKK.js} +1 -1
- package/dist/cdn/{DFVPLU2O.js → FED2DOMO.js} +1 -1
- package/dist/cdn/{DMXZ5HWB.js → FNHI7NZ4.js} +1 -1
- package/dist/cdn/{O5EM6RKT.js → FOHZXQNV.js} +1 -1
- package/dist/cdn/{JU2JSB4L.js → GOHJT66O.js} +1 -1
- package/dist/cdn/{DBDJDVIT.js → H5RBBOBZ.js} +1 -1
- package/dist/cdn/HKD2GF4M.js +2 -0
- package/dist/cdn/JIBKSQBE.js +2 -0
- package/dist/cdn/{XBQKBQOE.js → JJUCB3OG.js} +1 -1
- package/dist/cdn/JZ7SSPKB.js +2 -0
- package/dist/cdn/KCLCOBT2.js +2 -0
- package/dist/cdn/{N7CAM7T2.js → KOZMWZTT.js} +1 -1
- package/dist/cdn/{YY2STFDC.js → KS2JQYWA.js} +1 -1
- package/dist/cdn/{EDFSTMEO.js → KWEVRR34.js} +1 -1
- package/dist/cdn/{YUM4ZQCQ.js → L33CMX4M.js} +1 -1
- package/dist/cdn/{LIQFO7UT.js → LL5AA56F.js} +1 -1
- package/dist/cdn/LM6H2RMV.js +2 -0
- package/dist/cdn/{LP7YP7VN.js → M33TAW7V.js} +1 -1
- package/dist/cdn/{WXUJPI4X.js → MDGR5FJS.js} +1 -1
- package/dist/cdn/{VS2Q33NS.js → OLXC7CE4.js} +1 -1
- package/dist/cdn/{EHVKHBQJ.js → PEO5PFZF.js} +1 -1
- package/dist/cdn/{R7BTC6EA.js → Q5GFMD4E.js} +1 -1
- package/dist/cdn/{6IQGJNQQ.js → QFHL5APV.js} +1 -1
- package/dist/cdn/QT52U3JO.js +2 -0
- package/dist/cdn/SABP5QOL.js +2 -0
- package/dist/cdn/{FGHPX3EG.js → UDDG7VVX.js} +1 -1
- package/dist/cdn/UFNGJCCT.js +2 -0
- package/dist/cdn/{GGFGMVLK.js → UZMFRVR5.js} +1 -1
- package/dist/cdn/{FFNDPSGG.js → V4UI5WTN.js} +1 -1
- package/dist/cdn/{SJB4FDD5.js → VX6EE6FY.js} +1 -1
- package/dist/cdn/{SPOJMJ2R.js → WGM3TQIL.js} +1 -1
- package/dist/cdn/{IDPYNEOM.js → WKJEITKD.js} +1 -1
- package/dist/cdn/{NGSHCI4P.js → WOOCTQS3.js} +1 -1
- package/dist/cdn/{4JPFPWGG.js → XD3TUJLE.js} +1 -1
- package/dist/cdn/{6FBCPZGR.js → XZF5RW4B.js} +1 -1
- package/dist/cdn/{7JNCIWV3.js → YARGA5LY.js} +1 -1
- package/dist/cdn/{DYKYNLID.js → ZIIB5RYY.js} +1 -1
- package/dist/cdn/{NDJGGH7G.js → ZP4Q36AO.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-portal-navigation/index.js +5 -5
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +7 -7
- package/dist/cdn/2HGVOH6F.js +0 -2
- package/dist/cdn/BGEZZVIM.js +0 -2
- package/dist/cdn/ILBZ5YM3.js +0 -2
- package/dist/cdn/NVV4P7LD.js +0 -2
- package/dist/cdn/OT6EWATP.js +0 -2
- package/dist/cdn/QRON2UPY.js +0 -2
- package/dist/cdn/XCSDUQMC.js +0 -2
- package/dist/cdn/ZIAV77I3.js +0 -2
- package/dist/cdn/ZKHEUOSC.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as P}from"./YVKSTDL6.js";import c from"./RBGARTND.js";import b from"./F3ODJVJC.js";import{a as T}from"./MFT5NBI5.js";import{a as B}from"./KYNL256E.js";import{a as K}from"./NBB7R2RE.js";import a from"./OUFIJDIW.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import{b as M}from"./2GBRZSEC.js";import{a as J}from"./XBQKBQOE.js";import"./6IQGJNQQ.js";import"./KCYIOVJQ.js";import"./4JPFPWGG.js";import{b as x}from"./WMT55UQD.js";import{L as O,N as _,P as L,j as d,k as I,w as $}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([m,{substitute:f},,,{f:N,g:E,h:H,i:W}])=>{var b=1260*1e3,j=2500;function R(o,t="_blank",i=582,e=670){let s=window.screenLeft??0,n=window.screenTop??0,a=window.innerWidth||document.documentElement.clientWidth||window.screen.width,r=window.innerHeight||document.documentElement.clientHeight||window.screen.height,c=a/2-i/2+s,l=r/2-e/2+n,u=window.open(o,t,`scrollbars=no, width=${i}, height=${e}, top=${l}, left=${c}`);return u?.focus(),u}function q(o){let t=m.findOAuthInfo(o.url),{locale:i="en",expiration:e=b}=t??{},s=new URLSearchParams({locale:i,client_id:"arcgisonline",response_type:"token",expiration:`${e}`,linkUserRequest:"true",showSocialLogins:"true",hideEnterpriseLogins:"false",force_login:"true",parent:window.location.origin,redirect_uri:`https://${o.portalHostname}/home/link_account_callback.html`,state:JSON.stringify({useMessage:!0})}),n=`https://${o.portalHostname}/sharing/oauth2/authorize?${s.toString()}`;R(n)}function y(o){let{config:t,token:i,clientId:e="arcgisonline",redirectToClientUri:s=!1,displaySignoutComplete:n=!1}=o,a=new URLSearchParams({display:"iframe",client_id:e,...i&&{token:i},parent:window.location.origin,redirect_uri:`${t.baseUrl}/check_sign_in_status.html`,state:JSON.stringify({signout:!0,origin:window.location.origin,redirectToClientUri:s,displaySignoutComplete:n})}),r=`${t.restBaseUrl}oauth2/signout?${a.toString()}`,c=document.createElement("iframe");c.src=r,c.style.display="none",document.body.appendChild(c)}function z(o,t,i){let e=h(o.orgUrlKey,t),s=m.findOAuthInfo(e),{appId:n,locale:a="en",expiration:r=b}=s??{},c=C(o.provider),l=new URLSearchParams({locale:a,client_id:i??n??"arcgisonline",response_type:"token",expiration:`${r}`,parent:window.location.origin,...c==="social"&&{socialLoginProviderName:o.provider},...c==="default"&&{prepopulatedusername:o.username},force_login:"true",redirect_uri:`${e}/home/sign_in_callback.html`,state:JSON.stringify({user:o.username,server:e,portalUrl:e,origin:window.location.origin})}),u=`${v(o,t)}?${l.toString()}`;R(u)}function F({accounts:o,clientId:t="arcgisonline",usersToFilter:i=[],accountsToFilter:e=""}){let s={};return o.reduce((n,a)=>{let r={disabled:a.disabled??!1,allowed:a.clientAppAccessAllowed??!0};return n[a.username]=r,(i.includes(a.username)||i.includes(a.username.toLowerCase())||e==="org"&&a.orgUrlKey||t==="esriapps"&&a.userType!=="both")&&(r.allowed=!1),n},s),s}function G({account:o,credential:t,clientId:i,portal:e,redirectUri:s}){let n=C(o.provider),a=v(o,e),r=s||D(o,e),c=new URLSearchParams({client_id:i,redirect_uri:r,parent:window.location.origin,response_type:"token",force_login:"false",...t.userId&&{prepopulatedusername:t.userId},...n==="social"&&{socialLoginProviderName:o.provider},expiration:`${(t?.expires??Date.now()+b)-Date.now()}`});return`${a}?${c.toString()}`}function C(o){return Q(o)?"social":o==="enterprise"?"enterprise":o.includes("oidc")?"oidc":"default"}function Q(o){return["apple","facebook","github","google"].includes(o)}function v(o,t){let i=h(o.orgUrlKey,t).toLowerCase(),e=C(o.provider),s="";switch(e){case"social":s="social/";break;case"enterprise":s="saml/";break;case"oidc":s=`oidc/${o.provider.split("_")[1]}/`;break}return`${i}/sharing/rest/oauth2/${s}authorize`}function h(o,t){return o?.startsWith("https://")?o:o&&t.customBaseUrl?`https://${o}.${t.customBaseUrl}`:`https://${t.portalHostname}`}function D(o,t){return`${h(o.orgUrlKey,t)}/home/accountswitcher-callback.html`}function V(o,t){return m.findCredential(h(o.orgUrlKey,t),o.username)}function X(o,t){let i=V(o,t);if(i)return i;let e=h(o.orgUrlKey,t),s=`${e}/home/check_sign_in_status.html#state=${JSON.stringify({origin:window.location.origin,server:e,orgKey:e})}`;Y(s,`iframe__for-${e}`)}function Y(o,t){let i=document.createElement("iframe");i.src=o,i.id=t,i.style.display="none",document.body.appendChild(i)}var U=100,S=class extends O{constructor(){super(),this.messages=J({blocking:!0}),this.targetUser="",this.targetToken="",this.accountAccess={},this.remainingSignouts=0,this.signoutHandle=0,this.linkedAccounts=[],this.loading=!1,this.signedInStatus={},this.showAssociatedAccountsWarning=!1,this.signedInAccounts=[],this.clientId="arcgisonline",this.signout=!1,this.signoutOptions={redirectToClientUri:!1,displaySignoutComplete:!1},this.arcgisAccountSwitch=$(),this.arcgisClose=$(),this.arcgisSignoutComplete=$(),this.listenOn(window,"message",this.handleMessageEvent)}static{this.properties={linkedAccounts:16,userAccounts:16,user:16,credential:16,alertOptions:16,loading:16,signedInStatus:16,showAssociatedAccountsWarning:16,signedInAccounts:16,portal:0,clientId:1,redirectUri:1,signout:5,signoutOptions:0}}static{this.styles=K}willUpdate(t){if(t.has("portal")&&(this.user=this.portal?.user),(t.has("portal")||t.has("user"))&&this.portal&&this.user){this.findLinkedUsers();return}if(t.has("linkedAccounts")||t.has("signedInStatus")){if(this.signout){let{signedInStatus:i,linkedAccounts:e,portal:s,signoutOptions:n,clientId:a,user:r}=this,c=Object.keys(i).filter(k=>i[k]!==null).map(k=>e.find(A=>A.username===k));this.remainingSignouts=c.length+1;let l=h(s.urlKey??"",s),u=`${l}/sharing/rest`,{displaySignoutComplete:g=!0,redirectToClientUri:p=!0}=n;c.length>0&&(g=!1,p=!1),this.loading=!0;let w=m.findCredential(l,r?.id||r?.username);y({displaySignoutComplete:g,redirectToClientUri:p,clientId:a,config:{baseUrl:l,restBaseUrl:u},token:w?.token}),this.signoutHandle=window.setTimeout(()=>{this.remainingSignouts-=1,this.finishSignout({accountOrigin:l,redirectToClientUri:p,displaySignoutComplete:g})},j)}return}}handleMessageEvent(t){if(new URL(t.origin).hostname!=="localhost"&&(t.origin.endsWith(".arcgis.com")||t.origin===window.location.origin)){if(typeof t.data=="string"){JSON.parse(t.data).type==="token_exchange"&&this.handleExchangeTokenMessage(t);return}if("type"in t.data)switch(t.data.type){case"signin":this.handleSigninMessage(t);return;case"signout":this.handleSignoutMessage(t);return;case"linkUser":this.handleLinkUserMessage(t);return;case"token_exchange":this.handleExchangeTokenMessage(t);return}if("credential"in t.data){this.handleSigninMessage(t);return}this.handleCheckSignInStatusMessage(t)}}handleSignoutMessage(t){let{error:i,signout:e,accountOrigin:s,redirectToClientUri:n,displaySignoutComplete:a}=t.data;if(this.remainingSignouts-=1,i&&i!=="unknown"){console.error(i),this.showAlert("danger",this.messages.errors.signout);return}e&&(this.user=void 0,this.credential=void 0,this.finishSignout({accountOrigin:s,redirectToClientUri:n,displaySignoutComplete:a}))}handleSigninMessage(t){let{messages:i,clientId:e}=this,{error:s,status:n,state:a,access_token:r,ssl:c}=t.data;if(s){console.error(s),this.showAlert("danger",i.errors.signin);return}if(n==="success"){let{portal:l,user:u,redirectUri:g}=this,p=this.linkedAccounts.find(A=>A.username===a.user);p?.orgUrlKey===this.portal.urlKey&&m.findCredential(`https://${l.portalHostname}`,u?.username)?.destroy();let w={server:a.portalUrl,userId:a.user,token:r,expires:Number(t.data.expires_in)+Date.now(),ssl:c===void 0||c!=="false"};m.registerToken(w);let k=G({account:p,credential:w,clientId:e,portal:l,redirectUri:g});window.self!==window.top?window.top?.postMessage({type:"navigate",url:k}):window.location.href=k}}handleCheckSignInStatusMessage(t){let{success:i,orgKey:e,server:s,userId:n,token:a,expires:r,ssl:c}=t.data;e&&s&&i&&n&&a&&r&&c!==void 0&&(this.signedInStatus[n]={token:a,expires:r,ssl:c})}async handleLinkUserMessage(t){let{error:i,username:e,access_token:s}=t.data,{portal:n,user:a,linkedAccounts:r,messages:c}=this;if(i){if(i.toString().toLowerCase().includes("user denied your request"))return;this.showAlert("danger",c.errors.accessAccount);return}if(e===a?.username){this.showAlert("danger",c.errors.selfLink);return}if(r.find(u=>u.username===e)){this.showAlert("danger",f(c.errors.alreadyLinked,{username:e}));return}let l=await E(n,e,s);if(l?.length){this.userAccounts=l,this.targetUser=e??"",this.targetToken=s??"",this.showAssociatedAccountsWarning=!0;return}this.linkAccount(e,s)}handleExchangeTokenMessage(t){let i=typeof t.data=="string"?JSON.parse(t.data):t.data;if(!(i.type&&i.type!=="token_exchange")){if(i.error)console.error(i);else if(i.status==="success"&&this.targetUser){let{portal:e,linkedAccounts:s,targetUser:n,clientId:a}=this,r=s.find(p=>p.username===n);if(!r)return;let c=D(r,e),l=h(r.orgUrlKey,e),u=new URLSearchParams({response_type:"token",client_id:a,redirect_uri:c,state:JSON.stringify({user:r.username,portalUrl:l})}),g=`${v(r,e)}?${u.toString()}`;window.opener?(window.opener.location.href=g,window.close()):window.location.href=g}}}finishSignout({accountOrigin:t,redirectToClientUri:i,displaySignoutComplete:e}){this.signoutHandle&&window.clearTimeout(this.signoutHandle),t===window.location.origin&&m.destroyCredentials(),console.info("Signout complete",t,i,e),this.remainingSignouts<=0&&this.arcgisSignoutComplete.emit({accountOrigin:t,redirectToClientUri:i,displaySignoutComplete:e})}async findLinkedUsers(){if(this.loading=!0,!this.portal||!this.user){this.linkedAccounts=[],this.loading=!1;return}this.linkedAccounts=await N(this.portal,this.user),this.linkedAccounts.length&&(this.signedInStatus=this.linkedAccounts.filter(t=>t.orgUrlKey!==this.portal.urlKey).reduce((t,i)=>(t[i.username]=X(i,this.portal)??null,t),{}),this.accountAccess=F({accounts:this.linkedAccounts,clientId:this.clientId})),this.loading=!1}async linkAccount(t,i){let{portal:e,user:s}=this;if(!e||!s)return;let n=await H({portal:e,user:s,targetUser:t,targetToken:i}),{messages:a}=this;if(n.error){this.showAlert("danger",f(a.errors.linkAccount,{username:t})),this.targetUser="",this.userAccounts=[];return}let r=this.userAccounts?.length?a.success.linkAccountMultiple:a.success.linkAccount;this.showAlert("success",f(r,{username:t})),this.targetUser="",this.userAccounts=[],await M(350),this.findLinkedUsers()}async unlinkAccount(t){if(!this.portal||!this.user)return;let{messages:i,portal:e,user:s}=this,{success:n}=await W({portal:e,user:s,linkedUsername:t.username});n?this.showAlert("success",f(i.success.unlinkAccount,{username:t.username})):this.showAlert("danger",f(i.errors.unlinkAccount,{username:t.username})),await this.findLinkedUsers()}startAccountLink(){q(this.portal)}switchAccount(t){let{portal:i,user:e,clientId:s}=this;if(!i||!e||!t)return;let n=h(e.sourceJSON.orgUrlKey??"",i),a=m.findCredential(n,e.id||e.username);a&&y({config:{baseUrl:n,restBaseUrl:`${n}/sharing/rest`},token:a?.token,clientId:s}),z(t,i,s)}signoutAll(t){let{portal:i,signedInStatus:e,clientId:s}=this;t.forEach(n=>{let a=h(n.orgUrlKey,i),r=`${a}/sharing/rest`,c=e[n.username];y({config:{baseUrl:a,restBaseUrl:r},token:c?.token,clientId:s})})}showAlert(t,i,e){this.alertOptions={kind:t,title:e,message:i}}showUnlinkConfirmation(t){let{messages:i}=this;this.alertOptions={kind:"danger",icon:"exclamation-mark-triangle-f",title:i.unlinkAccount,message:i.unlinkWarning,actions:[{text:i.unlink,kind:"danger",clickHandler:()=>{this.alertOptions=void 0,this.unlinkAccount(t)}}]}}render(){let{linkedAccounts:t,accountAccess:i,user:e,portal:s,messages:n,signout:a}=this;if(!s||!e)return null;if(a){let{signedInAccounts:r}=this;return r.length===0?d`<calcite-loader .label=${n.signingOut} .text=${n.signingOut}></calcite-loader>`:d`<arcgis-portal-account-switcher-signout .portal=${s} .signedInAccounts=${r} @arcgisSwitchAccount=${c=>{this.switchAccount(c.detail.account)}} @arcgisSignOutAll=${()=>{this.signoutAll(r)}}></arcgis-portal-account-switcher-signout>`}return d`<calcite-dialog .heading=${n.switchAccounts} heading-level=2 scale=m width=s open modal .loading=${this.loading} outside-close-disabled @calciteDialogClose=${()=>{this.arcgisClose.emit()}}><calcite-block .heading=${n.currentAccount} heading-level=3 .description=${n.signedInAs} expanded class="current-account-block" tabindex=-1>${T(e.id??e.username,d`<calcite-block class="current-account" .label=${s.urlKey?`${e.username}, ${s.name}`:e.username} heading-level=4 .heading=${e.username} .description=${s.urlKey?`${e.fullName??e.username}, ${s.name}`:e.fullName??e.username}><calcite-avatar slot=content-start inert .fullName=${e.fullName??void 0} .username=${e.username} .userId=${e.id} .thumbnail=${B(e,s)??void 0}></calcite-avatar></calcite-block>`)}</calcite-block>${t.length>0?d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 .description=${n.linkedAccountActions} expanded class="linked-accounts-block"><calcite-button slot=content-end icon-start=plus class="link-account-button" @click=${()=>this.startAccountLink()} .disabled=${t.length>=U}>${n.addAccount}</calcite-button><arcgis-portal-account-switcher-list .portal=${s} .linkedAccounts=${t} .accountAccess=${i} .signedInUsers=${Object.keys(this.signedInStatus).filter(r=>this.signedInStatus[r]!==null)} interactive @arcgisAccountSwitch=${r=>{this.switchAccount(r.detail.account)}} @arcgisAccountUnlink=${r=>{this.showUnlinkConfirmation(r.detail.account)}}></arcgis-portal-account-switcher-list></calcite-block>`:d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 expanded class="empty-accounts-block"><div class="empty-accounts-info"><svg class="empty-accounts-icon" width=48 height=48 viewBox="0 0 48 48" fill=none xmlns=http://www.w3.org/2000/svg>${I`<path d=${P.couple??L} fill=currentColor />`}</svg><h4>${n.emptyListTitle}</h4><p>${n.emptyList}</p><calcite-button icon-start=plus class="link-account-button" @click=${()=>this.startAccountLink()} .disabled=${t.length>=U}>${n.linkAccount}</calcite-button></div></calcite-block>`}<calcite-notice kind=info .open=${t.length>=U}><div slot=message>${n.maxAccounts}</div></calcite-notice><calcite-alert .label=${n.alertLabel} slot=alerts .autoClose=${this.alertOptions?.kind!=="danger"} auto-close-duration=fast placement=bottom .kind=${this.alertOptions?.kind} .icon=${this.alertOptions?.icon} .open=${!!this.alertOptions} @calciteAlertClose=${()=>{this.alertOptions=void 0}}>${this.alertOptions?.title&&d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>`||""}${this.alertOptions?.message&&d`<p slot=message class=${_({"alert-message":!0,"short-message":!!this.alertOptions?.actions?.length})}>${this.alertOptions.message}</p>`||""}${this.alertOptions?.actions?.map(r=>d`<calcite-button slot=actions-end .kind=${r.kind} .appearance=${r.appearance} @click=${r.clickHandler}>${r.text}</calcite-button>`)}</calcite-alert></calcite-dialog>${this.showAssociatedAccountsWarning&&d`<arcgis-portal-account-switcher-accounts .portal=${s} .targetUser=${this.targetUser} .accounts=${this.userAccounts??[]} @arcgisLinkAll=${()=>{this.linkAccount(this.targetUser,this.targetToken)}} @arcgisCloseDialog=${()=>{this.showAssociatedAccountsWarning=!1}}></arcgis-portal-account-switcher-accounts>`||""}`}};x("arcgis-portal-account-switcher",S);return S},"identity/IdentityManager","intl",a,b,c)
|
|
2
|
+
import{a as P}from"./YVKSTDL6.js";import c from"./RBGARTND.js";import b from"./F3ODJVJC.js";import{a as T}from"./MFT5NBI5.js";import{a as B}from"./KYNL256E.js";import{a as K}from"./NBB7R2RE.js";import a from"./OUFIJDIW.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import{b as M}from"./2GBRZSEC.js";import{a as J}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as x}from"./WMT55UQD.js";import{L as O,N as _,P as L,j as d,k as I,w as $}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([m,{substitute:f},,,{f:N,g:E,h:H,i:W}])=>{var b=1260*1e3,j=2500;function R(o,t="_blank",i=582,e=670){let s=window.screenLeft??0,n=window.screenTop??0,a=window.innerWidth||document.documentElement.clientWidth||window.screen.width,r=window.innerHeight||document.documentElement.clientHeight||window.screen.height,c=a/2-i/2+s,l=r/2-e/2+n,u=window.open(o,t,`scrollbars=no, width=${i}, height=${e}, top=${l}, left=${c}`);return u?.focus(),u}function q(o){let t=m.findOAuthInfo(o.url),{locale:i="en",expiration:e=b}=t??{},s=new URLSearchParams({locale:i,client_id:"arcgisonline",response_type:"token",expiration:`${e}`,linkUserRequest:"true",showSocialLogins:"true",hideEnterpriseLogins:"false",force_login:"true",parent:window.location.origin,redirect_uri:`https://${o.portalHostname}/home/link_account_callback.html`,state:JSON.stringify({useMessage:!0})}),n=`https://${o.portalHostname}/sharing/oauth2/authorize?${s.toString()}`;R(n)}function y(o){let{config:t,token:i,clientId:e="arcgisonline",redirectToClientUri:s=!1,displaySignoutComplete:n=!1}=o,a=new URLSearchParams({display:"iframe",client_id:e,...i&&{token:i},parent:window.location.origin,redirect_uri:`${t.baseUrl}/check_sign_in_status.html`,state:JSON.stringify({signout:!0,origin:window.location.origin,redirectToClientUri:s,displaySignoutComplete:n})}),r=`${t.restBaseUrl}oauth2/signout?${a.toString()}`,c=document.createElement("iframe");c.src=r,c.style.display="none",document.body.appendChild(c)}function z(o,t,i){let e=h(o.orgUrlKey,t),s=m.findOAuthInfo(e),{appId:n,locale:a="en",expiration:r=b}=s??{},c=C(o.provider),l=new URLSearchParams({locale:a,client_id:i??n??"arcgisonline",response_type:"token",expiration:`${r}`,parent:window.location.origin,...c==="social"&&{socialLoginProviderName:o.provider},...c==="default"&&{prepopulatedusername:o.username},force_login:"true",redirect_uri:`${e}/home/sign_in_callback.html`,state:JSON.stringify({user:o.username,server:e,portalUrl:e,origin:window.location.origin})}),u=`${v(o,t)}?${l.toString()}`;R(u)}function F({accounts:o,clientId:t="arcgisonline",usersToFilter:i=[],accountsToFilter:e=""}){let s={};return o.reduce((n,a)=>{let r={disabled:a.disabled??!1,allowed:a.clientAppAccessAllowed??!0};return n[a.username]=r,(i.includes(a.username)||i.includes(a.username.toLowerCase())||e==="org"&&a.orgUrlKey||t==="esriapps"&&a.userType!=="both")&&(r.allowed=!1),n},s),s}function G({account:o,credential:t,clientId:i,portal:e,redirectUri:s}){let n=C(o.provider),a=v(o,e),r=s||D(o,e),c=new URLSearchParams({client_id:i,redirect_uri:r,parent:window.location.origin,response_type:"token",force_login:"false",...t.userId&&{prepopulatedusername:t.userId},...n==="social"&&{socialLoginProviderName:o.provider},expiration:`${(t?.expires??Date.now()+b)-Date.now()}`});return`${a}?${c.toString()}`}function C(o){return Q(o)?"social":o==="enterprise"?"enterprise":o.includes("oidc")?"oidc":"default"}function Q(o){return["apple","facebook","github","google"].includes(o)}function v(o,t){let i=h(o.orgUrlKey,t).toLowerCase(),e=C(o.provider),s="";switch(e){case"social":s="social/";break;case"enterprise":s="saml/";break;case"oidc":s=`oidc/${o.provider.split("_")[1]}/`;break}return`${i}/sharing/rest/oauth2/${s}authorize`}function h(o,t){return o?.startsWith("https://")?o:o&&t.customBaseUrl?`https://${o}.${t.customBaseUrl}`:`https://${t.portalHostname}`}function D(o,t){return`${h(o.orgUrlKey,t)}/home/accountswitcher-callback.html`}function V(o,t){return m.findCredential(h(o.orgUrlKey,t),o.username)}function X(o,t){let i=V(o,t);if(i)return i;let e=h(o.orgUrlKey,t),s=`${e}/home/check_sign_in_status.html#state=${JSON.stringify({origin:window.location.origin,server:e,orgKey:e})}`;Y(s,`iframe__for-${e}`)}function Y(o,t){let i=document.createElement("iframe");i.src=o,i.id=t,i.style.display="none",document.body.appendChild(i)}var U=100,S=class extends O{constructor(){super(),this.messages=J({blocking:!0}),this.targetUser="",this.targetToken="",this.accountAccess={},this.remainingSignouts=0,this.signoutHandle=0,this.linkedAccounts=[],this.loading=!1,this.signedInStatus={},this.showAssociatedAccountsWarning=!1,this.signedInAccounts=[],this.clientId="arcgisonline",this.signout=!1,this.signoutOptions={redirectToClientUri:!1,displaySignoutComplete:!1},this.arcgisAccountSwitch=$(),this.arcgisClose=$(),this.arcgisSignoutComplete=$(),this.listenOn(window,"message",this.handleMessageEvent)}static{this.properties={linkedAccounts:16,userAccounts:16,user:16,credential:16,alertOptions:16,loading:16,signedInStatus:16,showAssociatedAccountsWarning:16,signedInAccounts:16,portal:0,clientId:1,redirectUri:1,signout:5,signoutOptions:0}}static{this.styles=K}willUpdate(t){if(t.has("portal")&&(this.user=this.portal?.user),(t.has("portal")||t.has("user"))&&this.portal&&this.user){this.findLinkedUsers();return}if(t.has("linkedAccounts")||t.has("signedInStatus")){if(this.signout){let{signedInStatus:i,linkedAccounts:e,portal:s,signoutOptions:n,clientId:a,user:r}=this,c=Object.keys(i).filter(k=>i[k]!==null).map(k=>e.find(A=>A.username===k));this.remainingSignouts=c.length+1;let l=h(s.urlKey??"",s),u=`${l}/sharing/rest`,{displaySignoutComplete:g=!0,redirectToClientUri:p=!0}=n;c.length>0&&(g=!1,p=!1),this.loading=!0;let w=m.findCredential(l,r?.id||r?.username);y({displaySignoutComplete:g,redirectToClientUri:p,clientId:a,config:{baseUrl:l,restBaseUrl:u},token:w?.token}),this.signoutHandle=window.setTimeout(()=>{this.remainingSignouts-=1,this.finishSignout({accountOrigin:l,redirectToClientUri:p,displaySignoutComplete:g})},j)}return}}handleMessageEvent(t){if(new URL(t.origin).hostname!=="localhost"&&(t.origin.endsWith(".arcgis.com")||t.origin===window.location.origin)){if(typeof t.data=="string"){JSON.parse(t.data).type==="token_exchange"&&this.handleExchangeTokenMessage(t);return}if("type"in t.data)switch(t.data.type){case"signin":this.handleSigninMessage(t);return;case"signout":this.handleSignoutMessage(t);return;case"linkUser":this.handleLinkUserMessage(t);return;case"token_exchange":this.handleExchangeTokenMessage(t);return}if("credential"in t.data){this.handleSigninMessage(t);return}this.handleCheckSignInStatusMessage(t)}}handleSignoutMessage(t){let{error:i,signout:e,accountOrigin:s,redirectToClientUri:n,displaySignoutComplete:a}=t.data;if(this.remainingSignouts-=1,i&&i!=="unknown"){console.error(i),this.showAlert("danger",this.messages.errors.signout);return}e&&(this.user=void 0,this.credential=void 0,this.finishSignout({accountOrigin:s,redirectToClientUri:n,displaySignoutComplete:a}))}handleSigninMessage(t){let{messages:i,clientId:e}=this,{error:s,status:n,state:a,access_token:r,ssl:c}=t.data;if(s){console.error(s),this.showAlert("danger",i.errors.signin);return}if(n==="success"){let{portal:l,user:u,redirectUri:g}=this,p=this.linkedAccounts.find(A=>A.username===a.user);p?.orgUrlKey===this.portal.urlKey&&m.findCredential(`https://${l.portalHostname}`,u?.username)?.destroy();let w={server:a.portalUrl,userId:a.user,token:r,expires:Number(t.data.expires_in)+Date.now(),ssl:c===void 0||c!=="false"};m.registerToken(w);let k=G({account:p,credential:w,clientId:e,portal:l,redirectUri:g});window.self!==window.top?window.top?.postMessage({type:"navigate",url:k}):window.location.href=k}}handleCheckSignInStatusMessage(t){let{success:i,orgKey:e,server:s,userId:n,token:a,expires:r,ssl:c}=t.data;e&&s&&i&&n&&a&&r&&c!==void 0&&(this.signedInStatus[n]={token:a,expires:r,ssl:c})}async handleLinkUserMessage(t){let{error:i,username:e,access_token:s}=t.data,{portal:n,user:a,linkedAccounts:r,messages:c}=this;if(i){if(i.toString().toLowerCase().includes("user denied your request"))return;this.showAlert("danger",c.errors.accessAccount);return}if(e===a?.username){this.showAlert("danger",c.errors.selfLink);return}if(r.find(u=>u.username===e)){this.showAlert("danger",f(c.errors.alreadyLinked,{username:e}));return}let l=await E(n,e,s);if(l?.length){this.userAccounts=l,this.targetUser=e??"",this.targetToken=s??"",this.showAssociatedAccountsWarning=!0;return}this.linkAccount(e,s)}handleExchangeTokenMessage(t){let i=typeof t.data=="string"?JSON.parse(t.data):t.data;if(!(i.type&&i.type!=="token_exchange")){if(i.error)console.error(i);else if(i.status==="success"&&this.targetUser){let{portal:e,linkedAccounts:s,targetUser:n,clientId:a}=this,r=s.find(p=>p.username===n);if(!r)return;let c=D(r,e),l=h(r.orgUrlKey,e),u=new URLSearchParams({response_type:"token",client_id:a,redirect_uri:c,state:JSON.stringify({user:r.username,portalUrl:l})}),g=`${v(r,e)}?${u.toString()}`;window.opener?(window.opener.location.href=g,window.close()):window.location.href=g}}}finishSignout({accountOrigin:t,redirectToClientUri:i,displaySignoutComplete:e}){this.signoutHandle&&window.clearTimeout(this.signoutHandle),t===window.location.origin&&m.destroyCredentials(),console.info("Signout complete",t,i,e),this.remainingSignouts<=0&&this.arcgisSignoutComplete.emit({accountOrigin:t,redirectToClientUri:i,displaySignoutComplete:e})}async findLinkedUsers(){if(this.loading=!0,!this.portal||!this.user){this.linkedAccounts=[],this.loading=!1;return}this.linkedAccounts=await N(this.portal,this.user),this.linkedAccounts.length&&(this.signedInStatus=this.linkedAccounts.filter(t=>t.orgUrlKey!==this.portal.urlKey).reduce((t,i)=>(t[i.username]=X(i,this.portal)??null,t),{}),this.accountAccess=F({accounts:this.linkedAccounts,clientId:this.clientId})),this.loading=!1}async linkAccount(t,i){let{portal:e,user:s}=this;if(!e||!s)return;let n=await H({portal:e,user:s,targetUser:t,targetToken:i}),{messages:a}=this;if(n.error){this.showAlert("danger",f(a.errors.linkAccount,{username:t})),this.targetUser="",this.userAccounts=[];return}let r=this.userAccounts?.length?a.success.linkAccountMultiple:a.success.linkAccount;this.showAlert("success",f(r,{username:t})),this.targetUser="",this.userAccounts=[],await M(350),this.findLinkedUsers()}async unlinkAccount(t){if(!this.portal||!this.user)return;let{messages:i,portal:e,user:s}=this,{success:n}=await W({portal:e,user:s,linkedUsername:t.username});n?this.showAlert("success",f(i.success.unlinkAccount,{username:t.username})):this.showAlert("danger",f(i.errors.unlinkAccount,{username:t.username})),await this.findLinkedUsers()}startAccountLink(){q(this.portal)}switchAccount(t){let{portal:i,user:e,clientId:s}=this;if(!i||!e||!t)return;let n=h(e.sourceJSON.orgUrlKey??"",i),a=m.findCredential(n,e.id||e.username);a&&y({config:{baseUrl:n,restBaseUrl:`${n}/sharing/rest`},token:a?.token,clientId:s}),z(t,i,s)}signoutAll(t){let{portal:i,signedInStatus:e,clientId:s}=this;t.forEach(n=>{let a=h(n.orgUrlKey,i),r=`${a}/sharing/rest`,c=e[n.username];y({config:{baseUrl:a,restBaseUrl:r},token:c?.token,clientId:s})})}showAlert(t,i,e){this.alertOptions={kind:t,title:e,message:i}}showUnlinkConfirmation(t){let{messages:i}=this;this.alertOptions={kind:"danger",icon:"exclamation-mark-triangle-f",title:i.unlinkAccount,message:i.unlinkWarning,actions:[{text:i.unlink,kind:"danger",clickHandler:()=>{this.alertOptions=void 0,this.unlinkAccount(t)}}]}}render(){let{linkedAccounts:t,accountAccess:i,user:e,portal:s,messages:n,signout:a}=this;if(!s||!e)return null;if(a){let{signedInAccounts:r}=this;return r.length===0?d`<calcite-loader .label=${n.signingOut} .text=${n.signingOut}></calcite-loader>`:d`<arcgis-portal-account-switcher-signout .portal=${s} .signedInAccounts=${r} @arcgisSwitchAccount=${c=>{this.switchAccount(c.detail.account)}} @arcgisSignOutAll=${()=>{this.signoutAll(r)}}></arcgis-portal-account-switcher-signout>`}return d`<calcite-dialog .heading=${n.switchAccounts} heading-level=2 scale=m width=s open modal .loading=${this.loading} outside-close-disabled @calciteDialogClose=${()=>{this.arcgisClose.emit()}}><calcite-block .heading=${n.currentAccount} heading-level=3 .description=${n.signedInAs} expanded class="current-account-block" tabindex=-1>${T(e.id??e.username,d`<calcite-block class="current-account" .label=${s.urlKey?`${e.username}, ${s.name}`:e.username} heading-level=4 .heading=${e.username} .description=${s.urlKey?`${e.fullName??e.username}, ${s.name}`:e.fullName??e.username}><calcite-avatar slot=content-start inert .fullName=${e.fullName??void 0} .username=${e.username} .userId=${e.id} .thumbnail=${B(e,s)??void 0}></calcite-avatar></calcite-block>`)}</calcite-block>${t.length>0?d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 .description=${n.linkedAccountActions} expanded class="linked-accounts-block"><calcite-button slot=content-end icon-start=plus class="link-account-button" @click=${()=>this.startAccountLink()} .disabled=${t.length>=U}>${n.addAccount}</calcite-button><arcgis-portal-account-switcher-list .portal=${s} .linkedAccounts=${t} .accountAccess=${i} .signedInUsers=${Object.keys(this.signedInStatus).filter(r=>this.signedInStatus[r]!==null)} interactive @arcgisAccountSwitch=${r=>{this.switchAccount(r.detail.account)}} @arcgisAccountUnlink=${r=>{this.showUnlinkConfirmation(r.detail.account)}}></arcgis-portal-account-switcher-list></calcite-block>`:d`<calcite-block .heading=${n.linkedAccounts} heading-level=3 expanded class="empty-accounts-block"><div class="empty-accounts-info"><svg class="empty-accounts-icon" width=48 height=48 viewBox="0 0 48 48" fill=none xmlns=http://www.w3.org/2000/svg>${I`<path d=${P.couple??L} fill=currentColor />`}</svg><h4>${n.emptyListTitle}</h4><p>${n.emptyList}</p><calcite-button icon-start=plus class="link-account-button" @click=${()=>this.startAccountLink()} .disabled=${t.length>=U}>${n.linkAccount}</calcite-button></div></calcite-block>`}<calcite-notice kind=info .open=${t.length>=U}><div slot=message>${n.maxAccounts}</div></calcite-notice><calcite-alert .label=${n.alertLabel} slot=alerts .autoClose=${this.alertOptions?.kind!=="danger"} auto-close-duration=fast placement=bottom .kind=${this.alertOptions?.kind} .icon=${this.alertOptions?.icon} .open=${!!this.alertOptions} @calciteAlertClose=${()=>{this.alertOptions=void 0}}>${this.alertOptions?.title&&d`<h4 slot=title class="alert-title">${this.alertOptions.title}</h4>`||""}${this.alertOptions?.message&&d`<p slot=message class=${_({"alert-message":!0,"short-message":!!this.alertOptions?.actions?.length})}>${this.alertOptions.message}</p>`||""}${this.alertOptions?.actions?.map(r=>d`<calcite-button slot=actions-end .kind=${r.kind} .appearance=${r.appearance} @click=${r.clickHandler}>${r.text}</calcite-button>`)}</calcite-alert></calcite-dialog>${this.showAssociatedAccountsWarning&&d`<arcgis-portal-account-switcher-accounts .portal=${s} .targetUser=${this.targetUser} .accounts=${this.userAccounts??[]} @arcgisLinkAll=${()=>{this.linkAccount(this.targetUser,this.targetToken)}} @arcgisCloseDialog=${()=>{this.showAssociatedAccountsWarning=!1}}></arcgis-portal-account-switcher-accounts>`||""}`}};x("arcgis-portal-account-switcher",S);return S},"identity/IdentityManager","intl",a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as m}from"./TYPCOTRW.js";import{a as h}from"./
|
|
2
|
+
import{a as m}from"./TYPCOTRW.js";import{a as h}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as d}from"./WMT55UQD.js";import{L as b,P as a,h as c,j as i,w as u}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var g=c`.spacing-y{margin:var(--calcite-spacing-md) 0}.portal-classification-form-element-tooltip{display:flex;justify-content:space-between;align-items:center}`;function s(o,e){return o.uiElement===e}var n=class extends b{constructor(){super(...arguments),this.messages=h(),this.isRequiredErrors=new Set,this.arcgisAttributeValueChange=u()}static{this.properties={validationMsg:16,attributeKey:1,attribute:0,value:0,renderingInfo:0,isRequiredErrors:0}}static{this.styles=g}willUpdate(e){(e.has("renderingInfo")||e.has("isRequiredErrors"))&&(this.validationMsg=this._getValidationMessage())}_getValidationMessage(){if(this.renderingInfo?.attributeValidationResult)return this.renderingInfo.attributeValidationResult;if(this.isRequiredErrors.has(this.attributeKey))return this.messages.requiredfield??"This is a required field."}renderCheckbox(){return s(this.attribute,"checkbox")?i`<calcite-label class="spacing-y" .for=${this.attributeKey} layout=inline><calcite-checkbox .checked=${this.value} id=${this.attributeKey??a} @calciteCheckboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.checked})} .required=${this.attribute.isRequired??!1} .status=${this.validationMsg?"invalid":"valid"}></calcite-checkbox>${this.attribute.label}</calcite-label>`:null}renderDateInput(){return s(this.attribute,"date")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-input-date-picker id=${this.attributeKey??a} .name=${this.attribute.label} @calciteInputDatePickerChange=${e=>this.isConnected&&this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} overlay-positioning=fixed .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-date-picker></calcite-label>`:null}renderTextInput(){if(!s(this.attribute,"text"))return null;let e=this.attribute.label,t=this.attribute.description;return i`<calcite-label .for=${this.attributeKey}><div class="portal-classification-form-element-tooltip">${e}${this.attribute.labelTooltip&&i`<div><calcite-icon scale=s icon=information .id=${`tooltip-button-${this.attribute.bannerLabel}`} text-label=${this.messages.information??"Information"??a}></calcite-icon><calcite-tooltip .referenceElement=${`tooltip-button-${this.attribute.bannerLabel}`} placement=right>${this.attribute.labelTooltip}</calcite-tooltip></div>`||""}</div><calcite-input-text id=${this.attributeKey??a} .label=${e} .name=${this.attributeKey} @calciteInputTextChange=${r=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:r.target.value})} .placeholder=${t} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}></calcite-input-text></calcite-label>`}renderSingleSelect(){return s(this.attribute,"single-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox selection-mode=single id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>this.arcgisAttributeValueChange.emit({[this.attributeKey]:e.target.value})} .placeholder=${this.attribute.description??this.messages.selectanoption} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} overlay-positioning=fixed validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value} data-testid=${`single-select-${this.attributeKey}`}>${this._renderSingleSelectComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderSingleSelectComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return m(this.renderingInfo?.valueExpressionResult,t=>t.label,t=>i`<calcite-combobox-item .selected=${e===t.value} .heading=${t.label} .value=${t.value} data-testid=${`single-combobox-item-${t.value}`}></calcite-combobox-item>`)}_renderComboboxOptions(){if(!Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return this.renderingInfo?.valueExpressionResult.map(t=>i`<calcite-combobox-item .selected=${e?.includes(t.value)} .heading=${t.label} .value=${t.value} data-testid=${`combobox-item-${t.value}`}></calcite-combobox-item>`)}renderMultiSelect(){return s(this.attribute,"multi-select")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderComboboxOptions()}</calcite-combobox></calcite-label>`:null}_renderGroupedComboboxOptions(){if(!this.renderingInfo?.valueExpressionResult||Array.isArray(this.renderingInfo?.valueExpressionResult))return;let e=this.value;return Object.entries(this.renderingInfo?.valueExpressionResult).map(([t,r])=>i`<calcite-combobox-item .selected=${e?.includes(t)} .heading=${t} .value=${t}>${r.map(l=>i`<calcite-combobox-item .selected=${e?.includes(l.value)} .heading=${l.label} .value=${l.value} data-testid=${`grouped-combobox-item-${l.value}`}></calcite-combobox-item>`)}</calcite-combobox-item>`)}renderMultiGroupedSelectNested(){return s(this.attribute,"multi-grouped-select-nested")?i`<calcite-label .for=${this.attributeKey}>${this.attribute.label}<calcite-combobox id=${this.attributeKey??a} .label=${this.attribute.label} .name=${this.attributeKey} @calciteComboboxChange=${e=>{let t=e.target.value;this.arcgisAttributeValueChange.emit({[this.attributeKey]:t?Array.isArray(t)?t:[t]:void 0})}} .placeholder=${this.attribute.description??this.messages.selectoptions} .required=${this.attribute.isRequired} .status=${this.validationMsg?"invalid":"valid"} validation-icon=exclamation-mark-triangle .validationMessage=${this.validationMsg} .value=${this.value}>${this._renderGroupedComboboxOptions()}</calcite-combobox></calcite-label>`:null}render(){switch(this.attribute.uiElement){case"checkbox":return this.renderCheckbox();case"date":return this.renderDateInput();case"multi-select":return this.renderMultiSelect();case"multi-grouped-select-nested":return this.renderMultiGroupedSelectNested();case"single-select":return this.renderSingleSelect();case"text":return this.renderTextInput();default:return i`<div>Not Implemented Yet.</div>`}}};d("arcgis-portal-classification-form-element",n);export{n as ArcgisPortalClassificationFormElement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a,b}from"./
|
|
2
|
+
import{a,b}from"./UZMFRVR5.js";import"./XD3TUJLE.js";import"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export{a as getLocaleFromConfig,b as getStrings};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import f from"./
|
|
2
|
+
import f from"./WOOCTQS3.js";import e from"./CVOWIH4J.js";import d from"./XCJJESRE.js";import"./EBPLUTN5.js";import"./ILDTKRON.js";import"./CFBSBZSS.js";import"./UZCHLKLO.js";import"./25XJ66JO.js";import"./5YDITHQA.js";import c from"./RBGARTND.js";import b from"./F3ODJVJC.js";import"./MFT5NBI5.js";import"./TYPCOTRW.js";import a from"./OUFIJDIW.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import"./2GBRZSEC.js";import"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import"./WMT55UQD.js";import"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,{g:a}])=>{return a},a,b,c,d,e,f)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./5ITAQNJ6.js";import{a as g}from"./
|
|
2
|
+
import a from"./5ITAQNJ6.js";import{a as g}from"./JJUCB3OG.js";import{b}from"./WMT55UQD.js";import{I as d,J as p,K as u,L as m,N as o,P as s,h,j as r,w as n}from"./EXBWPG5Y.js";export default $arcgis.t(([{c:w}])=>{var f=h`:host{position:relative;display:block}.search{position:absolute;z-index:10;margin-top:1rem;color:var(--calcite-color-text-1);pointer-events:none;inset-inline-start:1.5rem}.search--panel{inset-inline-start:.75rem}.x{position:absolute;z-index:10;top:0;margin-top:.5rem;margin-inline:.25rem;padding:.25rem;border:none;cursor:pointer;color:var(--calcite-color-text-1);outline:none;inset-inline-end:.25rem;background:transparent}.x--icon{display:block}.input{display:block;width:100%;box-sizing:border-box;padding-block:1rem;padding-inline-start:3rem;height:3rem;border:none;position:relative;z-index:0;color:var(--calcite-color-text-1);font-size:var(--calcite-font-size--1);background-color:transparent;border-bottom:2px solid transparent;font-family:inherit}.input::-webkit-search-cancel-button{display:none}.input::-ms-clear{display:none}.input:focus{outline:none;border-bottom-color:var(--calcite-color-brand)}.input--panel{padding-inline-start:2.5rem;padding-inline-end:1rem}.input--with-clear{padding-inline-end:3rem}.alert:not([calcite-hydrated]){display:none}`,c=class extends m{constructor(){super(...arguments),this.searchInput=p(),this._messages=g({name:"portal-browser",blocking:!0}),this.showClear=!1,this.containsWildcard=!1,this.term="",this.placeholder="",this.allowClear=!0,this.store=w(),this.arcgisBrowserSearch=n(),this.arcgisBrowserSearchInput=n()}static{this.properties={showClear:16,containsWildcard:16,term:1,placeholder:1,allowClear:5,store:0}}static{this.styles=f}async setFocus(){this.searchInput.value?.focus()}connectedCallback(){super.connectedCallback(),this.showClear=!!this.term,this.containsWildcard=this.term.includes("*")}willUpdate(e){e.get("term")!==void 0&&((this.searchInput.value?.value??"")!==this.term&&(this.showClear=!!this.term,this.emitUpdate(this.term)),this.containsWildcard=this.term.includes("*"))}disconnectedCallback(){this.debounceId&&(window.clearTimeout(this.debounceId),this.debounceId=void 0),super.disconnectedCallback()}emitUpdate(e){this.store.searchTerm=e,this.arcgisBrowserSearch.emit(e)}debouncedInput(e){this.debounceId&&window.clearTimeout(this.debounceId),this.debounceId=window.setTimeout(()=>{let t=e.includes("*");this.showClear=!!e,this.containsWildcard=t,t||this.emitUpdate(e)},400)}render(){let e=!!this.store.panel,t=this.placeholder||this._messages.search.search,l=this._messages.search.wildcard,v=this._messages.search.clear;return r`<div><calcite-icon icon=search scale=s class=${o({search:!0,"search--panel":e})}></calcite-icon><input class=${o({input:!0,"input--with-clear":this.allowClear&&this.showClear,"input--panel":e})} .value=${d(this.term??"")} placeholder=${t??s} aria-label=${t??s} @input=${i=>{let a=i.currentTarget.value;a.includes("*")||(this.containsWildcard=!1),this.arcgisBrowserSearchInput.emit(a),this.debouncedInput(a)}} ${u(this.searchInput)}><calcite-alert .open=${this.containsWildcard} scale=m kind=danger class="alert" icon=exclamation-mark-triangle .label=${l} @calciteAlertClose=${()=>{this.containsWildcard=!1}}><div slot=message>${l}</div></calcite-alert>${this.allowClear&&this.showClear&&r`<button class="x" aria-label=${v??s} @click=${()=>{this.arcgisBrowserSearchInput.emit(""),this.emitUpdate(""),this.showClear=!1,this.searchInput.value&&(this.searchInput.value.value="",this.searchInput.value.focus())}} @keydown=${i=>{i.key==="Enter"&&i.stopPropagation()}} tabindex=0><calcite-icon icon=x scale=m class="x--icon"></calcite-icon></button>`||""}</div>`}};b("arcgis-portal-browser-search",c);return c},a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as v}from"./2GBRZSEC.js";import{a as w}from"./
|
|
2
|
+
import{b as v}from"./2GBRZSEC.js";import{a as w}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as m}from"./WMT55UQD.js";import{J as r,K as a,L as u,P as p,h as d,j as s}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var b=d`:host{display:flex;justify-content:flex-end;margin-inline:1rem;position:relative}.wrapper{padding-inline-start:.25rem;display:flex;border-inline-start:1px solid var(--calcite-color-border-1);border-inline-end:1px solid var(--calcite-color-border-1)}.tooltip-container{width:9rem}.button{margin-inline-end:.25rem}.measure-container{position:absolute;width:100%;height:0;overflow:hidden}.measure-text{visibility:hidden;height:0;width:auto;overflow:hidden;font-size:var(--calcite-font-size--1)}`,c=class extends u{constructor(){super(...arguments),this.measureText=r(),this.overflowButton=r(),this.resizeObserver=null,this.actionWidths=[],this._messages=w({name:"portal-browser",blocking:!0}),this.buttonPadding=88,this.moreWidth=0,this.elementWidth=0,this.visibleActions=[],this.overflowActions=[],this.calculating=!1,this.actions=[]}static{this.properties={visibleActions:16,overflowActions:16,calculating:16,actions:0,selection:0}}static{this.styles=b}async restoreFocus(){this.lastExecutedAction?.setFocus()}willUpdate(t){t.has("actions")&&(this.measureAndCacheWidths(this.actions),this.calculateOverflow()),t.has("selection")&&(this.hasSelection()?v(100).then(()=>{this.calculating=!1}):this.calculating=!0)}firstUpdated(){this.measureAndCacheWidths(this.actions),this.calculateOverflow(),!(typeof ResizeObserver>"u")&&(this.resizeObserver=new ResizeObserver(t=>{for(let e of t)e.contentRect.width>0&&(this.elementWidth=e.contentRect.width,this.calculateOverflow())}),this.resizeObserver.observe(this.el))}disconnectedCallback(){this.resizeObserver?.disconnect(),this.resizeObserver=null,super.disconnectedCallback()}measureAndCacheWidths(t){let e=this.measureText.value;if(!e)return;this.actionWidths=t.map(o=>(e.textContent=o.text,{action:o,width:e.offsetWidth+this.buttonPadding}));let i=this._messages.actions.more;e.textContent=i,this.moreWidth=e.scrollWidth+this.buttonPadding}calculateOverflow(){let t=this.moreWidth,e=this.actionWidths.reduce(({width:i,visible:o,overflow:l},{action:h,width:f})=>{let n=i+f;return n>=this.elementWidth?{width:n,visible:o,overflow:[...l,h]}:{width:n,visible:[...o,h],overflow:l}},{visible:[],overflow:[],width:t});this.visibleActions=e.visible,this.overflowActions=e.overflow}hasSelection(){return!!this.selection?.length}renderButton(t){let e=t.id||`${t.text}-${t.icon||"none"}`;return s`<div><calcite-button class="button" .iconStart=${t.icon} @click=${i=>{this.lastExecutedAction=i.currentTarget,t.onClick()}} appearance=transparent kind=neutral id=${e??p}>${t.text}</calcite-button>${t.tooltip&&s`<calcite-tooltip .referenceElement=${e}><span class="tooltip-container">${t.tooltip}</span></calcite-tooltip>`||""}</div>`}render(){let t=this.overflowActions.length>0,e=this._messages.actions.more;return s`<div><span class="measure-container"><span class="measure-text" aria-hidden ${a(this.measureText)}></span></span>${this.hasSelection()&&(this.visibleActions.length>0||t)&&!this.calculating&&s`<nav class="wrapper">${this.visibleActions.map(i=>this.renderButton(i))}${t&&s`<calcite-dropdown width=m placement=bottom-end><calcite-button slot=trigger kind=neutral icon-end=chevron-down appearance=transparent ${a(this.overflowButton)}>${e}</calcite-button><calcite-dropdown-group selection-mode=none>${this.overflowActions.map(i=>s`<calcite-dropdown-item .iconStart=${i.icon||"blank"} @calciteDropdownItemSelect=${()=>{this.lastExecutedAction=this.overflowButton.value||void 0,i.onClick()}}>${i.text}</calcite-dropdown-item>`)}</calcite-dropdown-group></calcite-dropdown>`||""}</nav>`||""}</div>`}};m("arcgis-portal-browser-actions",c);export{c as ArcgisPortalBrowserActions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./TJYPEMON.js";import{b as z}from"./ZEP2GDDJ.js";import{a as E}from"./VMQIDO4Z.js";import"./QS3GXAIH.js";import"./2GBRZSEC.js";import{a as B}from"./XBQKBQOE.js";import"./6IQGJNQQ.js";import"./KCYIOVJQ.js";import"./4JPFPWGG.js";import{b as J}from"./WMT55UQD.js";import{J as S,K as C,L as j,Q as D,h as M,j as _,p as N,r as A,s as R,w as F}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([le,ve,we,Ie,$,de,v,pe,fe,P,X,T,ee,{h:W,j:q,k:G,l:U,m:V,n:H,o:Q,p:K,q:Y,r:Z}])=>{var k=(i=>(i.expression="expression/",i))(k||{});function I(i){return i!=null}function se(i,e,s){let t=e.fieldName;if(t.includes(k.expression)){let r=s.get(t);return r?.title?r.title:t}else return ee.supportsFieldConfiguration(i)&&i.getFieldConfiguration(t)?i.getFieldAlias(t)||t:e.label||t}function te(i,e,s){let t="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))t="number";else if(e.has(i)){let r=e.get(i);t=r.type?r.type.toLowerCase():""}else if(s.has(i)){let r=s.get(i);t=r.returnType?r.returnType.toLowerCase():""}else t="number";return t}async function ie(i){return new Map((await me(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function re(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(s=>{let t=`${k.expression}${s.name}`;e.set(t,s)}),e}async function me(i){return await new Promise((e,s)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let t=i,r=t?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let n=new Map(t.fields.map(o=>[o.name,o])),c=a.thematicGroup.fieldNames,p=[];c.forEach(o=>{n.has(o)&&p.push(n.get(o))}),e(p)}else e(t.fields)}).catch(a=>{s(new Error(a))}):e(t.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function ae(i,e,s,t){if(!s)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=t?.item??e.portalItem,n=e.sourceJSON;if(!r||!a||!a.portal.user||!U(a)||G(a)||V(a)||H(n)||a.portal.isPortal&&q(a)||["oid","global-id","geometry"].includes(s.type)||await ue(e,s.name,t))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,o=c?.shapeAreaFieldName;if(d(p,s.name)||d(o,s.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,s.name)||d(l.creatorField,s.name)||d(l.editDateField,s.name)||d(l.editorField,s.name))||d(e.objectIdField,s.name)||d(e.displayField,s.name)||d(e.typeIdField,s.name)||d(e.subtypeField,s.name)||e.timeInfo&&(d(e.timeInfo.startField,s.name)||d(e.timeInfo.endField,s.name)||d(e.timeInfo.trackIdField,s.name)))return!1;if(!t?.ignoreLayerRenderer&&e.featureReduction){let f=new Set;if(await v.collectFeatureReductionFields(f,e,e.featureReduction),Array.from(f).some(y=>d(y,s.name)))return!1}if(!t?.ignoreLayerRenderer&&(await v.getRendererFields(e.renderer,e.fieldsIndex)).some(f=>d(f,s.name)))return!1;if(!t?.ignoreLayerLabelingInfo){let f=e.labelingInfo?.map(y=>y.labelExpressionInfo?.expression);if(f&&((await v.getExpressionFields(e,f)).some(y=>d(y,s.name))||await ne(e,s,"layer")))return!1}if(!t?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await T.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(f=>d(f,s.name))||await he(e,s,t)||await _e(e,s))return!1;if(await ye(e,s))return await Promise.resolve(!1);if(await be(e,s))return await Promise.resolve(!1);if(ge(i,e,s)||e.relationships?.map(f=>f.keyField)?.some(f=>d(f,s.name)))return!1;let u=W(a,a.portal.user),w=t?.userItemInfo?.userGroups??await Q(e)??[],h=t?.userItemInfo?.itemGroups??await K(e)??[],b=Z(w,h);if(!u&&!b)return!1;let m=t?.userItemInfo?.relatedItems??await Y(a.id,a.portal,{relationshipType:"Service2Service"});return!(m?.data?.relatedItems&&m.data.relatedItems.some(f=>["WMTS","Map Service","Vector Tile Service"].includes(f.type)))}async function ue(i,e,s){let t=`${i.url}/${i.layerId}/fieldGroups`;try{let r=s?.userItemInfo&&"fieldGroups"in s.userItemInfo?s.userItemInfo.fieldGroups:(await X(t,{query:{f:"json"},responseType:"json"}))?.data?.fieldGroups;return r?r.some(a=>a.fields.some(n=>d(n,e))):!1}catch{return!1}}function ge(i,e,s){if(!i)return!1;let t=i.map?.applicationProperties?.viewing?.search;if(t){let r=t.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,s.name)}}return!1}async function ne(i,e,s){let t=s==="layer"?i.labelingInfo?.filter(n=>I(n.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(n=>I(n.where));if(!t?.length)return!1;let r=[...await Promise.all(t.map(async n=>await T.parseWhereClause(n.where,i.fieldsIndex)))],a=!1;for(let n=0;n<r.length;n++){let c=r[n].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function he(i,e,s){let t=i.portalItem;if(!t)return!1;let r=`${E(t.portal)}content/items/${t.id}/data`,a=(s?.userItemInfo?.itemData??await X(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let n=a.layers.find(l=>l.id===i.layerId),c=n?.layerDefinition?.drawingInfo?.renderer,p=n?.layerDefinition?.featureReduction,o=n?.layerDefinition?.definitionExpression;if(!c&&!p&&!o)return!1;if(!s?.ignoreItemRenderer&&c){let l=P.fromJSON(c);if((await v.getRendererFields(l,i.fieldsIndex)).some(u=>d(u,e.name)))return!0}if(!s?.ignoreItemFeatureReduction&&p&&await oe(i,e,p)||o&&(await T.parseWhereClause(o,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function _e(i,e){let s=i.sourceJSON,t=s?.drawingInfo?.renderer,r=s?.featureReduction;if(!t&&!r)return!1;if(t){let a=P.fromJSON(t);if((await v.getRendererFields(a,i.fieldsIndex)).some(n=>d(n,e.name)))return!0}return!!(r&&await oe(i,e,r))}async function ye(i,e){let s=i.sourceJSON?.drawingInfo?.labelingInfo;if(!s)return await Promise.resolve(!1);let t=s?.map(r=>r.labelExpressionInfo?.expression);if(t){if((await v.getExpressionFields(i,t)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await ne(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function be(i,e){let s=i.sourceJSON?.definitionQuery;return s?(await T.parseWhereClause(s,i.fieldsIndex)).fieldNames.some(t=>d(t,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function oe(i,e,s){let t=s.type==="binning"?pe.fromJSON(s):fe.fromJSON(s),r=new Set;return await v.collectFeatureReductionFields(r,i,t),!!Array.from(r).some(a=>d(a,e.name))}var g=new Map;g.set("oid","key");g.set("guid","key");g.set("global-id","key");g.set("blob","binary");g.set("integer","integer");g.set("small-integer","integer");g.set("big-integer","integer");g.set("single","number");g.set("double","number");g.set("long","number");g.set("number","number");g.set("date","date-time");g.set("date-only","calendar");g.set("time-only","clock");g.set("timestamp-offset","time-zone");g.set("string","string");var Ne=({fieldType:i})=>_`<calcite-icon scale=s .icon=${g.get(i)}></calcite-icon>`,Fe=["esrignss_speed","esrignss_direction","esrisnsr_azimuth","esrignss_positionsourcetype","esrignss_receiver","esrignss_h_rms","esrignss_v_rms","esrignss_latitude","esrignss_longitude","esrignss_altitude","esrignss_pdop","esrignss_hdop","esrignss_vdop","esrignss_fixtype","esrignss_correctionage","esrignss_stationid","esrignss_numsats","esrignss_fixdatetime","esrignss_avg_h_rms","esrignss_avg_v_rms","esrignss_avg_positions","esrignss_h_stddev","esrignss_correction_source_name","esrignss_correction_source_type","esrignss_custom_attributes","esrignss_h_95_status","esrignss_ntrip_mount_point","esrignss_antenna_height","esrignss_orthometric_height","esrignss_profile_has_hor_xform","esrignss_profile_hor_xform","esrignss_receiver_gcs","esrignss_receiver_gcs_wkid","esrignss_receiver_geoid","esrignss_receiver_ref_epoch","esrisnsr_tilt_azimuth_accuracy","esrisnsr_tilt_azimuth","esrisnsr_tilt_angle_accuracy","esrisnsr_tilt_angle","esrignss_tilt_compensated","esrignss_cp1_latitude","esrignss_cp1_longitude","esrignss_cp1_altitude","esrignss_cp1_h_rms","esrignss_cp1_v_rms","esrignss_cp1_fixdatetime","esrignss_cp1_fixtype","esrignss_cp1_corr_age","esrignss_cp1_stationid","esrignss_cp1_numsats","esrignss_cp1_pdop","esrignss_cp1_hdop","esrignss_cp1_vdop","esrignss_cp1_avg_h_rms","esrignss_cp1_avg_v_rms","esrignss_cp1_avg_positions","esrignss_cp1_h_stddev","esrisnsr_cp1_slope_dist","esrisnsr_cp1_inclination","esrisnsr_cp1_azimuth","esrignss_cp2_latitude","esrignss_cp2_longitude","esrignss_cp2_altitude","esrignss_cp2_h_rms","esrignss_cp2_v_rms","esrignss_cp2_fixdatetime","esrignss_cp2_fixtype","esrignss_cp2_corr_age","esrignss_cp2_stationid","esrignss_cp2_numsats","esrignss_cp2_pdop","esrignss_cp2_hdop","esrignss_cp2_vdop","esrignss_cp2_avg_h_rms","esrignss_cp2_avg_v_rms","esrignss_cp2_avg_positions","esrignss_cp2_h_stddev","esrisnsr_cp2_slope_dist","esrisnsr_cp2_inclination","esrisnsr_cp2_azimuth","esrisnsr_offset_method","esrisnsr_offset_device","esrisnsr_offset_laser_height","esrisnsr_offset_laser_target_ht","esrisnsr_offset_mag_var","esrignss_worst_h_rms","esrignss_worst_v_rms","esrignss_worst_fixtype","esrignss_manual_locations"],Ee=M`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,L=class extends j{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=S(),this.dialogNode=S(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=B({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new z(this,{task:async([e,s])=>{let t=I(e)&&I(s);if(I(e)||N("error",this,A("layer")),I(s)||N("error",this,A("fieldNames")),!t)throw new Error("Required properties are missing");this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=F(),this.arcgisClose=F(),this.arcgisBeforeDelete=F(),this.arcgisFieldsDeleted=F()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=Ee}async processProps(){let{layer:e,mapView:s,fieldNames:t}=this;if(!e||!t){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>t.includes(a.name));let r=t.some(a=>!e.fields.find(n=>n.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async n=>await ae(s,e,n,this.options)));if(this.fieldsAreDeletable=a.every(n=>n),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await ie(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=re(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await Ie.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:s,arcadeExpMap:t}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(s.popupTemplate??s.createPopupTemplate()).fieldInfos?.find(a=>a.fieldName===e);return r?se(s,r,t):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let{layer:s}=this,t=this.layerFieldsMap.get(e);return de.supportsFieldConfiguration(s)?s.getFieldAlias(e):t.alias??t.name}async deleteFields(){let{layer:e,fieldNames:s}=this,t=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:s.map(n=>({name:n}))},a={deleteFromDefinition:JSON.stringify(r)};await $(t,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async n=>{if(n.data?.success){let c=`${e.url}/${e.layerId}`;s.forEach(o=>{e.type==="feature"&&e.floorInfo?.floorField===o&&(e.floorInfo=null)});let p=await $(c,{query:{f:"json"},responseType:"json"});if(p){let o=p.data;this.currentLayerInfo=p.data,o&&(this.updateTypesAndTemplatesOnLayer(),s.forEach(l=>{o.templates?.length?o.templates.forEach(u=>delete u.prototype.attributes[l]):o.types?.forEach(u=>{u.templates.forEach(w=>delete w.prototype.attributes[l])})}),this.updateFeatureService(o))}else this.handleError()}else this.handleError()},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,s=e;if(s.templates?.length){let t=this.updateTemplatesList(s.templates);s.templates=t}else if(s.types){let t=s.types;s.types=[],t.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(s,r)})}}updateTemplatesList(e){let{currentLayerInfo:s,messages:t}=this,r=[];return(e??[]).forEach(a=>{let n=new ve;n.description=a.description??"",n.name=a.name||t.newFeature,n.drawingTool=a.drawingTool||"point";let c={};s.fields.forEach(o=>{let l=!1;for(let u=0;u<a.prototype.attributes.length;u++)if(a.prototype.attributes[u]===o.name){l=!0,c[o.name]=a.prototype.attributes[o.name];break}!l&&o.editable&&!Fe.includes(o.name)&&(c[o.name]=o.defaultValue||null)});let p=new we({attributes:c});n.prototype=p,r.push(n)}),r}addType(e,s){e.types?e.types.some(t=>t.id===s.id)||e.types.push(s):e.types=[s]}async updateFeatureService(e){let{layer:s,fieldNames:t}=this,r={templates:e.templates,types:e.types},a=`${s.url.replace("/rest/services","/rest/admin/services")}/${s.layerId}/updateDefinition`,n={f:"json",updateDefinition:JSON.stringify(r)};await $(a,{query:{...n,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${E(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||t.forEach(o=>{s.popupTemplate?.fieldInfos&&(s.popupTemplate.fieldInfos=s.popupTemplate.fieldInfos.filter(l=>l.fieldName!==o)),s.popupTemplate?.content?.forEach((l,u)=>{l.type==="fields"&&l.fieldInfos&&((s.popupTemplate?.content)[u].fieldInfos=(s.popupTemplate?.content)[u].fieldInfos?.filter(w=>w.fieldName!==o))})}),s.attributeTableTemplate){let o=s.attributeTableTemplate.clone();o.elements=o.elements.filter(l=>!(l.type==="field"&&t.includes(l.fieldName))),o.orderByFields=o.orderByFields.filter(l=>!t.includes(l.field)),s.attributeTableTemplate=o}if(s.fieldConfigurations?.length){let o=le.clone(s.fieldConfigurations).filter(l=>!t.includes(l.name));s.fieldConfigurations=o}await $(p,{query:{f:"json"},responseType:"json"}).then(async o=>{let l=o.data;if(l?.layers||l?.tables){let u=s.isTable,w=u?l.tables:l.layers,h=w?.find(b=>b.id===s.layerId);if(t.forEach(b=>{h?.attributeTableInfo?.attributeTableElements&&(h.attributeTableInfo.attributeTableElements=h.attributeTableInfo.attributeTableElements.map(m=>{if(m.type==="field")return m.fieldName===b?void 0:m;if(m.type==="group"&&Array.isArray(m.attributeTableElements)){let f=m.attributeTableElements.filter(y=>!(y.type==="field"&&y.fieldName===b));return f.length?{...m,attributeTableElements:f}:void 0}return m}).filter(Boolean),h.attributeTableInfo.orderByFields=h.attributeTableInfo.orderByFields.filter(m=>m.field!==b))}),h?.layerDefinition?.fieldConfigurations&&(h.layerDefinition.fieldConfigurations=h.layerDefinition.fieldConfigurations.filter(b=>!t.includes(b.name))),h?.popupInfo){t.forEach(y=>{h.popupInfo.fieldInfos=h.popupInfo.fieldInfos.filter(x=>x.fieldName!==y),h.popupInfo.popupElements?.forEach((x,O)=>{x.type==="fields"&&x.fieldInfos&&(h.popupInfo.popupElements[O].fieldInfos=h.popupInfo.popupElements[O].fieldInfos.filter(ce=>ce.fieldName!==y))})});let b=`${E(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,m={};u?(m.tables=w,l.layers&&(m.layers=l.layers)):(m.layers=w,l.tables&&(m.tables=l.tables));let f={f:"json",text:JSON.stringify(m)};await $(b,{query:{...f},method:"post",responseType:"json"}).then(y=>{y.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else o.httpStatus===200&&(!o.data||JSON.stringify(o.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:s}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=D(_`<calcite-alert .label=${s.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${s.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(_`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:s}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(_`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${s.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!s.isPortal&&_`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:s,fieldNames:t,deleteInProgress:r}=this;return this._propWatcherTask.render({complete:()=>(s||(t?.length?t?.length===1?N("error",this,"Field cannot be deleted"):N("error",this,"One or more fields cannot be deleted"):N("error",this,R("fieldNames"))),_`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${t?.length===1?e.deleteField:e.deleteFields} ${C(this.dialogNode)}>${s?_`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${t.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:this.renderError()}</calcite-dialog>`)})}renderError(){let{messages:e}=this;return _`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:s,deleteInProgress:t}=this;return _`<div class=${`loader-container ${t?"active":""}`}><calcite-loader class="loader" .label=${s.length===1?e.deletingField:e.deletingFields} .hidden=${!t}></calcite-loader><div class="loader-text">${s.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:s,layerFieldsMap:t,arcadeExpMap:r,messages:a}=this;return _`<calcite-list .label=${a.fields}>${e.map(n=>{let c=s.find(p=>p.name===n);return _`<calcite-list-item .label=${this.getFieldLabel(n)} .description=${`{${n}}`} .value=${n} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ne({fieldType:te(n,t,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return _`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${C(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:s}=this;return _`<calcite-button kind=danger slot=footer-end @click=${async t=>{let{portal:r}=this;t.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),this.arcgisBeforeDelete.emit(),await this.deleteFields())}}>${s.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${s.length}`)}</calcite-button>`}};J("arcgis-portal-field-delete",L);return L},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","applications/PortalApp/layerUtils","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql","applications/PortalApp/layerUtils",a)
|
|
2
|
+
import a from"./TJYPEMON.js";import{b as z}from"./ZEP2GDDJ.js";import{a as E}from"./VMQIDO4Z.js";import"./QS3GXAIH.js";import"./2GBRZSEC.js";import{a as B}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as J}from"./WMT55UQD.js";import{J as S,K as C,L as j,Q as D,h as M,j as _,p as N,r as A,s as R,w as F}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([le,ve,we,Ie,$,de,v,pe,fe,P,X,T,ee,{h:W,j:q,k:G,l:U,m:V,n:H,o:Q,p:K,q:Y,r:Z}])=>{var k=(i=>(i.expression="expression/",i))(k||{});function I(i){return i!=null}function se(i,e,s){let t=e.fieldName;if(t.includes(k.expression)){let r=s.get(t);return r?.title?r.title:t}else return ee.supportsFieldConfiguration(i)&&i.getFieldConfiguration(t)?i.getFieldAlias(t)||t:e.label||t}function te(i,e,s){let t="";if(/^raster.(?:item|service)pixelvalue/iu.test(i))t="number";else if(e.has(i)){let r=e.get(i);t=r.type?r.type.toLowerCase():""}else if(s.has(i)){let r=s.get(i);t=r.returnType?r.returnType.toLowerCase():""}else t="number";return t}async function ie(i){return new Map((await me(i)).filter(e=>e.visible).map(e=>[e.name,e]))}function re(i){let e=new Map;return i?.expressionInfos&&i.expressionInfos.forEach(s=>{let t=`${k.expression}${s.name}`;e.set(t,s)}),e}async function me(i){return await new Promise((e,s)=>{switch(i.type){case"feature":case"ogc-feature":case"stream":e(i.fields);break;case"sublayer":{let t=i,r=t?.layer;r?.portalItem&&r.url.includes("https://demographics")&&r.url.includes(".arcgis.com")?r.portalItem?.fetchData().then(a=>{if(a?.thematicGroup){let n=new Map(t.fields.map(o=>[o.name,o])),c=a.thematicGroup.fieldNames,p=[];c.forEach(o=>{n.has(o)&&p.push(n.get(o))}),e(p)}else e(t.fields)}).catch(a=>{s(new Error(a))}):e(t.fields);break}case"imagery":case"imagery-tile":case"wcs":e(i.rasterFields);break;default:e("fields"in i?i.fields??[]:[])}})}function d(i,e){return!i||!e?!1:i.toLocaleLowerCase()===e.toLocaleLowerCase()}async function ae(i,e,s,t){if(!s)return!1;let r=["feature","oriented-imagery"].includes(e.type),a=t?.item??e.portalItem,n=e.sourceJSON;if(!r||!a||!a.portal.user||!U(a)||G(a)||V(a)||H(n)||a.portal.isPortal&&q(a)||["oid","global-id","geometry"].includes(s.type)||await ue(e,s.name,t))return!1;let c=e.sourceJSON.geometryProperties,p=c?.shapeLengthFieldName,o=c?.shapeAreaFieldName;if(d(p,s.name)||d(o,s.name))return!1;let l=e.editFieldsInfo;if(l&&(d(l.creationDateField,s.name)||d(l.creatorField,s.name)||d(l.editDateField,s.name)||d(l.editorField,s.name))||d(e.objectIdField,s.name)||d(e.displayField,s.name)||d(e.typeIdField,s.name)||d(e.subtypeField,s.name)||e.timeInfo&&(d(e.timeInfo.startField,s.name)||d(e.timeInfo.endField,s.name)||d(e.timeInfo.trackIdField,s.name)))return!1;if(!t?.ignoreLayerRenderer&&e.featureReduction){let f=new Set;if(await v.collectFeatureReductionFields(f,e,e.featureReduction),Array.from(f).some(y=>d(y,s.name)))return!1}if(!t?.ignoreLayerRenderer&&(await v.getRendererFields(e.renderer,e.fieldsIndex)).some(f=>d(f,s.name)))return!1;if(!t?.ignoreLayerLabelingInfo){let f=e.labelingInfo?.map(y=>y.labelExpressionInfo?.expression);if(f&&((await v.getExpressionFields(e,f)).some(y=>d(y,s.name))||await ne(e,s,"layer")))return!1}if(!t?.ignoreLayerDefinitionExpression&&e.definitionExpression&&(await T.parseWhereClause(e.definitionExpression,e.fieldsIndex)).fieldNames.some(f=>d(f,s.name))||await he(e,s,t)||await _e(e,s))return!1;if(await ye(e,s))return await Promise.resolve(!1);if(await be(e,s))return await Promise.resolve(!1);if(ge(i,e,s)||e.relationships?.map(f=>f.keyField)?.some(f=>d(f,s.name)))return!1;let u=W(a,a.portal.user),w=t?.userItemInfo?.userGroups??await Q(e)??[],h=t?.userItemInfo?.itemGroups??await K(e)??[],b=Z(w,h);if(!u&&!b)return!1;let m=t?.userItemInfo?.relatedItems??await Y(a.id,a.portal,{relationshipType:"Service2Service"});return!(m?.data?.relatedItems&&m.data.relatedItems.some(f=>["WMTS","Map Service","Vector Tile Service"].includes(f.type)))}async function ue(i,e,s){let t=`${i.url}/${i.layerId}/fieldGroups`;try{let r=s?.userItemInfo&&"fieldGroups"in s.userItemInfo?s.userItemInfo.fieldGroups:(await X(t,{query:{f:"json"},responseType:"json"}))?.data?.fieldGroups;return r?r.some(a=>a.fields.some(n=>d(n,e))):!1}catch{return!1}}function ge(i,e,s){if(!i)return!1;let t=i.map?.applicationProperties?.viewing?.search;if(t){let r=t.layers?.find(a=>a.id===e.id);if(r){let a=r?.field?.name;if(a)return d(a,s.name)}}return!1}async function ne(i,e,s){let t=s==="layer"?i.labelingInfo?.filter(n=>I(n.where)):i.sourceJSON?.drawingInfo?.labelingInfo?.filter(n=>I(n.where));if(!t?.length)return!1;let r=[...await Promise.all(t.map(async n=>await T.parseWhereClause(n.where,i.fieldsIndex)))],a=!1;for(let n=0;n<r.length;n++){let c=r[n].fieldNames?.some(p=>d(p,e.name));if(!a&&c){a=!0;break}}return await Promise.resolve(a)}async function he(i,e,s){let t=i.portalItem;if(!t)return!1;let r=`${E(t.portal)}content/items/${t.id}/data`,a=(s?.userItemInfo?.itemData??await X(r,{query:{f:"json"},responseType:"json"}))?.data;if(!a)return!1;if(a?.layers){let n=a.layers.find(l=>l.id===i.layerId),c=n?.layerDefinition?.drawingInfo?.renderer,p=n?.layerDefinition?.featureReduction,o=n?.layerDefinition?.definitionExpression;if(!c&&!p&&!o)return!1;if(!s?.ignoreItemRenderer&&c){let l=P.fromJSON(c);if((await v.getRendererFields(l,i.fieldsIndex)).some(u=>d(u,e.name)))return!0}if(!s?.ignoreItemFeatureReduction&&p&&await oe(i,e,p)||o&&(await T.parseWhereClause(o,i.fieldsIndex)).fieldNames.some(l=>d(l,e.name)))return!0}return!1}async function _e(i,e){let s=i.sourceJSON,t=s?.drawingInfo?.renderer,r=s?.featureReduction;if(!t&&!r)return!1;if(t){let a=P.fromJSON(t);if((await v.getRendererFields(a,i.fieldsIndex)).some(n=>d(n,e.name)))return!0}return!!(r&&await oe(i,e,r))}async function ye(i,e){let s=i.sourceJSON?.drawingInfo?.labelingInfo;if(!s)return await Promise.resolve(!1);let t=s?.map(r=>r.labelExpressionInfo?.expression);if(t){if((await v.getExpressionFields(i,t)).some(r=>d(r,e.name)))return await Promise.resolve(!0);if(await ne(i,e,"service"))return await Promise.resolve(!0)}return await Promise.resolve(!1)}async function be(i,e){let s=i.sourceJSON?.definitionQuery;return s?(await T.parseWhereClause(s,i.fieldsIndex)).fieldNames.some(t=>d(t,e.name))?await Promise.resolve(!0):await Promise.resolve(!1):await Promise.resolve(!1)}async function oe(i,e,s){let t=s.type==="binning"?pe.fromJSON(s):fe.fromJSON(s),r=new Set;return await v.collectFeatureReductionFields(r,i,t),!!Array.from(r).some(a=>d(a,e.name))}var g=new Map;g.set("oid","key");g.set("guid","key");g.set("global-id","key");g.set("blob","binary");g.set("integer","integer");g.set("small-integer","integer");g.set("big-integer","integer");g.set("single","number");g.set("double","number");g.set("long","number");g.set("number","number");g.set("date","date-time");g.set("date-only","calendar");g.set("time-only","clock");g.set("timestamp-offset","time-zone");g.set("string","string");var Ne=({fieldType:i})=>_`<calcite-icon scale=s .icon=${g.get(i)}></calcite-icon>`,Fe=["esrignss_speed","esrignss_direction","esrisnsr_azimuth","esrignss_positionsourcetype","esrignss_receiver","esrignss_h_rms","esrignss_v_rms","esrignss_latitude","esrignss_longitude","esrignss_altitude","esrignss_pdop","esrignss_hdop","esrignss_vdop","esrignss_fixtype","esrignss_correctionage","esrignss_stationid","esrignss_numsats","esrignss_fixdatetime","esrignss_avg_h_rms","esrignss_avg_v_rms","esrignss_avg_positions","esrignss_h_stddev","esrignss_correction_source_name","esrignss_correction_source_type","esrignss_custom_attributes","esrignss_h_95_status","esrignss_ntrip_mount_point","esrignss_antenna_height","esrignss_orthometric_height","esrignss_profile_has_hor_xform","esrignss_profile_hor_xform","esrignss_receiver_gcs","esrignss_receiver_gcs_wkid","esrignss_receiver_geoid","esrignss_receiver_ref_epoch","esrisnsr_tilt_azimuth_accuracy","esrisnsr_tilt_azimuth","esrisnsr_tilt_angle_accuracy","esrisnsr_tilt_angle","esrignss_tilt_compensated","esrignss_cp1_latitude","esrignss_cp1_longitude","esrignss_cp1_altitude","esrignss_cp1_h_rms","esrignss_cp1_v_rms","esrignss_cp1_fixdatetime","esrignss_cp1_fixtype","esrignss_cp1_corr_age","esrignss_cp1_stationid","esrignss_cp1_numsats","esrignss_cp1_pdop","esrignss_cp1_hdop","esrignss_cp1_vdop","esrignss_cp1_avg_h_rms","esrignss_cp1_avg_v_rms","esrignss_cp1_avg_positions","esrignss_cp1_h_stddev","esrisnsr_cp1_slope_dist","esrisnsr_cp1_inclination","esrisnsr_cp1_azimuth","esrignss_cp2_latitude","esrignss_cp2_longitude","esrignss_cp2_altitude","esrignss_cp2_h_rms","esrignss_cp2_v_rms","esrignss_cp2_fixdatetime","esrignss_cp2_fixtype","esrignss_cp2_corr_age","esrignss_cp2_stationid","esrignss_cp2_numsats","esrignss_cp2_pdop","esrignss_cp2_hdop","esrignss_cp2_vdop","esrignss_cp2_avg_h_rms","esrignss_cp2_avg_v_rms","esrignss_cp2_avg_positions","esrignss_cp2_h_stddev","esrisnsr_cp2_slope_dist","esrisnsr_cp2_inclination","esrisnsr_cp2_azimuth","esrisnsr_offset_method","esrisnsr_offset_device","esrisnsr_offset_laser_height","esrisnsr_offset_laser_target_ht","esrisnsr_offset_mag_var","esrignss_worst_h_rms","esrignss_worst_v_rms","esrignss_worst_fixtype","esrignss_manual_locations"],Ee=M`.dialog{--calcite-dialog-max-size-y: 60%}.dialog-content-wrapper{position:relative;min-height:100px}.hide-overflow{overflow:hidden}.field-icons{padding:0 var(--calcite-spacing-lg);display:flex;align-items:center}.warning{border-bottom:var(--calcite-border-width-sm) solid var(--calcite-color-border-3);margin-bottom:var(--calcite-spacing-md)}.warning-message{font-size:var(--calcite-font-size--1);font-weight:var(--calcite-font-weight-bold)}.loader-container{position:absolute;height:100%;width:100%;top:0;right:0;display:none;z-index:40;overflow:hidden;background:#fffffff2;padding:0}.active{display:flex;flex-direction:column;align-items:center;justify-content:center}.loader{padding:0}.loader-text{font-weight:var(--calcite-font-weight-medium);text-align:center;margin-right:6.25rem;margin-left:6.25rem}`,L=class extends j{constructor(){super(...arguments),this.arcadeExpMap=new Map,this.cancelNode=S(),this.dialogNode=S(),this.layerFields=[],this.layerFieldsMap=new Map,this.messages=B({blocking:!0}),this.deleteInProgress=!1,this.fieldsAreDeletable=!1,this._propWatcherTask=new z(this,{task:async([e,s])=>{let t=I(e)&&I(s);if(I(e)||N("error",this,A("layer")),I(s)||N("error",this,A("fieldNames")),!t)throw new Error("Required properties are missing");this._propWatcherTask.autoRun=!1,await this.processProps()},args:()=>[this.layer,this.fieldNames]}),this.arcgisBeforeModalClose=F(),this.arcgisClose=F(),this.arcgisBeforeDelete=F(),this.arcgisFieldsDeleted=F()}static{this.properties={config:0,fieldNames:0,layer:0,mapView:0,options:0}}static{this.styles=Ee}async processProps(){let{layer:e,mapView:s,fieldNames:t}=this;if(!e||!t){this.fieldsAreDeletable=!1;return}e.loaded||await e.load(),this.layerFields=e.fields.filter(a=>t.includes(a.name));let r=t.some(a=>!e.fields.find(n=>n.name===a));if(!this.layerFields?.length||r)this.fieldsAreDeletable=!1;else{let a=await Promise.all(this.layerFields.map(async n=>await ae(s,e,n,this.options)));if(this.fieldsAreDeletable=a.every(n=>n),!this.fieldsAreDeletable)return}if(this.layerFieldsMap=await ie(e),this.options?.ignorePopupTemplate||(this.arcadeExpMap=re(e.popupTemplate)),this.portal=e.portalItem?.portal??this.options?.portal,this.item=e.portalItem??this.options?.item,!this.item){this.fieldsAreDeletable=!1;return}await Ie.getCredential(this.item.url.replace("rest/services","rest/admin/services"))}getFieldLabel(e){let{layer:s,arcadeExpMap:t}=this;if(this.options?.ignorePopupTemplate)return this.getFieldDisplayNameFromLayerFields(e);{let r=(s.popupTemplate??s.createPopupTemplate()).fieldInfos?.find(a=>a.fieldName===e);return r?se(s,r,t):this.getFieldDisplayNameFromLayerFields(e)}}getFieldDisplayNameFromLayerFields(e){let{layer:s}=this,t=this.layerFieldsMap.get(e);return de.supportsFieldConfiguration(s)?s.getFieldAlias(e):t.alias??t.name}async deleteFields(){let{layer:e,fieldNames:s}=this,t=`${e.url.replace("/rest/services","/rest/admin/services")}/${e.layerId}/deleteFromDefinition`,r={fields:s.map(n=>({name:n}))},a={deleteFromDefinition:JSON.stringify(r)};await $(t,{query:{...a,f:"json",async:!1},method:"post",responseType:"json"}).then(async n=>{if(n.data?.success){let c=`${e.url}/${e.layerId}`;s.forEach(o=>{e.type==="feature"&&e.floorInfo?.floorField===o&&(e.floorInfo=null)});let p=await $(c,{query:{f:"json"},responseType:"json"});if(p){let o=p.data;this.currentLayerInfo=p.data,o&&(this.updateTypesAndTemplatesOnLayer(),s.forEach(l=>{o.templates?.length?o.templates.forEach(u=>delete u.prototype.attributes[l]):o.types?.forEach(u=>{u.templates.forEach(w=>delete w.prototype.attributes[l])})}),this.updateFeatureService(o))}else this.handleError()}else this.handleError()},()=>this.handleError())}updateTypesAndTemplatesOnLayer(){let{currentLayerInfo:e}=this,s=e;if(s.templates?.length){let t=this.updateTemplatesList(s.templates);s.templates=t}else if(s.types){let t=s.types;s.types=[],t.forEach(r=>{r.templates=this.updateTemplatesList(r.templates),this.addType(s,r)})}}updateTemplatesList(e){let{currentLayerInfo:s,messages:t}=this,r=[];return(e??[]).forEach(a=>{let n=new ve;n.description=a.description??"",n.name=a.name||t.newFeature,n.drawingTool=a.drawingTool||"point";let c={};s.fields.forEach(o=>{let l=!1;for(let u=0;u<a.prototype.attributes.length;u++)if(a.prototype.attributes[u]===o.name){l=!0,c[o.name]=a.prototype.attributes[o.name];break}!l&&o.editable&&!Fe.includes(o.name)&&(c[o.name]=o.defaultValue||null)});let p=new we({attributes:c});n.prototype=p,r.push(n)}),r}addType(e,s){e.types?e.types.some(t=>t.id===s.id)||e.types.push(s):e.types=[s]}async updateFeatureService(e){let{layer:s,fieldNames:t}=this,r={templates:e.templates,types:e.types},a=`${s.url.replace("/rest/services","/rest/admin/services")}/${s.layerId}/updateDefinition`,n={f:"json",updateDefinition:JSON.stringify(r)};await $(a,{query:{...n,f:"json"},method:"post",responseType:"json"}).then(async c=>{if(c.data?.success){let p=`${E(this.portal)}content/items/${this.item.id}/data`;if(this.options?.ignorePopupTemplate||t.forEach(o=>{s.popupTemplate?.fieldInfos&&(s.popupTemplate.fieldInfos=s.popupTemplate.fieldInfos.filter(l=>l.fieldName!==o)),s.popupTemplate?.content?.forEach((l,u)=>{l.type==="fields"&&l.fieldInfos&&((s.popupTemplate?.content)[u].fieldInfos=(s.popupTemplate?.content)[u].fieldInfos?.filter(w=>w.fieldName!==o))})}),s.attributeTableTemplate){let o=s.attributeTableTemplate.clone();o.elements=o.elements.filter(l=>!(l.type==="field"&&t.includes(l.fieldName))),o.orderByFields=o.orderByFields.filter(l=>!t.includes(l.field)),s.attributeTableTemplate=o}if(s.fieldConfigurations?.length){let o=le.clone(s.fieldConfigurations).filter(l=>!t.includes(l.name));s.fieldConfigurations=o}await $(p,{query:{f:"json"},responseType:"json"}).then(async o=>{let l=o.data;if(l?.layers||l?.tables){let u=s.isTable,w=u?l.tables:l.layers,h=w?.find(b=>b.id===s.layerId);if(t.forEach(b=>{h?.attributeTableInfo?.attributeTableElements&&(h.attributeTableInfo.attributeTableElements=h.attributeTableInfo.attributeTableElements.map(m=>{if(m.type==="field")return m.fieldName===b?void 0:m;if(m.type==="group"&&Array.isArray(m.attributeTableElements)){let f=m.attributeTableElements.filter(y=>!(y.type==="field"&&y.fieldName===b));return f.length?{...m,attributeTableElements:f}:void 0}return m}).filter(Boolean),h.attributeTableInfo.orderByFields=h.attributeTableInfo.orderByFields.filter(m=>m.field!==b))}),h?.layerDefinition?.fieldConfigurations&&(h.layerDefinition.fieldConfigurations=h.layerDefinition.fieldConfigurations.filter(b=>!t.includes(b.name))),h?.popupInfo){t.forEach(y=>{h.popupInfo.fieldInfos=h.popupInfo.fieldInfos.filter(x=>x.fieldName!==y),h.popupInfo.popupElements?.forEach((x,O)=>{x.type==="fields"&&x.fieldInfos&&(h.popupInfo.popupElements[O].fieldInfos=h.popupInfo.popupElements[O].fieldInfos.filter(ce=>ce.fieldName!==y))})});let b=`${E(this.portal)}content/users/${this.item.owner}/items/${this.item.id}/update`,m={};u?(m.tables=w,l.layers&&(m.layers=l.layers)):(m.layers=w,l.tables&&(m.tables=l.tables));let f={f:"json",text:JSON.stringify(m)};await $(b,{query:{...f},method:"post",responseType:"json"}).then(y=>{y.data?.success?this.handleSuccess():this.handleError()},()=>this.handleError())}else this.handleSuccess()}else o.httpStatus===200&&(!o.data||JSON.stringify(o.data)==="{}")?this.handleSuccess():this.handleError()},()=>this.handleError())}},()=>this.handleError())}handleSuccess(){this.arcgisFieldsDeleted.emit(),this.dialogNode?.value&&(this.dialogNode.value.open=!1),this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("success"):this.displaySuccessAlert()}handleError(e){this.dialogNode?.value&&(this.dialogNode.value.open=!1),e?this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("read-only-error"):this.displayReadOnlyErrorAlert():this.options?.handleCloseOnConsumer?this.arcgisBeforeModalClose.emit("error"):this.displayErrorAlert()}displaySuccessAlert(){let{messages:e,fieldNames:s}=this;this.successAlertNode&&(this.successAlertNode.parentElement?.removeChild(this.successAlertNode),this.successAlertNode=void 0),this.successAlertNode=D(_`<calcite-alert .label=${s.length===1?e.fieldDeleted:e.fieldsDeleted} kind=success icon=check-circle auto-close open><div slot=message>${s.length===1?e.fieldDeleted:e.fieldsDeleted}</div></calcite-alert>`),document.body.append(this.successAlertNode)}displayErrorAlert(){let{messages:e}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(_`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close open><div slot=message>${e.fieldDeletionUnsuccessful}</div></calcite-alert>`),document.body.append(this.errorAlertNode)}displayReadOnlyErrorAlert(){let{messages:e,portal:s}=this;this.errorAlertNode&&(this.errorAlertNode.parentElement?.removeChild(this.errorAlertNode),this.errorAlertNode=void 0),this.errorAlertNode=D(_`<calcite-alert .label=${e.fieldDeletionUnsuccessful} kind=danger icon=exclamation-mark-triangle auto-close auto-close-duration=slow open><div slot=title>${e.error}</div><div slot=message>${s.isPortal?e.readOnlyErrorMessageEnterprise:e.readOnlyErrorMessage}</div>${!s.isPortal&&_`<calcite-link slot=link target=_blank href=https://status.arcgis.com>${e.healthDashboard}</calcite-link>`||""}</calcite-alert>`),document.body.append(this.errorAlertNode)}render(){let{messages:e,fieldsAreDeletable:s,fieldNames:t,deleteInProgress:r}=this;return this._propWatcherTask.render({complete:()=>(s||(t?.length?t?.length===1?N("error",this,"Field cannot be deleted"):N("error",this,"One or more fields cannot be deleted"):N("error",this,R("fieldNames"))),_`<calcite-dialog class="dialog" width=s open modal outside-close-disabled escape-disabled @calciteDialogClose=${()=>this.arcgisClose.emit()} .heading=${t?.length===1?e.deleteField:e.deleteFields} ${C(this.dialogNode)}>${s?_`<div class=${`dialog-content-wrapper ${r?"hide-overflow":""}`}>${this.renderDeleteLoader()}<calcite-label>${t.length===1?e.deletePrompt:e.deleteMultiplePrompt}</calcite-label>${this.renderFieldsPreview()}</div>${this.renderCancelButton()}${this.renderDeleteButton()}`:this.renderError()}</calcite-dialog>`)})}renderError(){let{messages:e}=this;return _`<div class="loader-container active"><div class="loader-text">${e.errorOccurred}</div></div>`}renderDeleteLoader(){let{messages:e,fieldNames:s,deleteInProgress:t}=this;return _`<div class=${`loader-container ${t?"active":""}`}><calcite-loader class="loader" .label=${s.length===1?e.deletingField:e.deletingFields} .hidden=${!t}></calcite-loader><div class="loader-text">${s.length===1?e.deletingField:e.deletingFields}</div></div>`}renderFieldsPreview(){let{fieldNames:e,layerFields:s,layerFieldsMap:t,arcadeExpMap:r,messages:a}=this;return _`<calcite-list .label=${a.fields}>${e.map(n=>{let c=s.find(p=>p.name===n);return _`<calcite-list-item .label=${this.getFieldLabel(n)} .description=${`{${n}}`} .value=${n} .disabled=${!c.editable}><div slot=actions-end class="field-icons">${Ne({fieldType:te(n,t,r)})}</div></calcite-list-item>`})}</calcite-list>`}renderCancelButton(){let{messages:e}=this;return _`<calcite-button @click=${()=>this.dialogNode.value.open=!1} slot=footer-end appearance=outline ${C(this.cancelNode)}>${e.cancel}</calcite-button>`}renderDeleteButton(){let{messages:e,fieldNames:s}=this;return _`<calcite-button kind=danger slot=footer-end @click=${async t=>{let{portal:r}=this;t.currentTarget.disabled=!0,this.cancelNode.value.disabled=!0,this.dialogNode.value.closeDisabled=!0,r.sourceJSON?.isReadOnly?this.handleError(!0):(this.deleteInProgress=!0,this.requestUpdate(),this.arcgisBeforeDelete.emit(),await this.deleteFields())}}>${s.length===1?e.deleteField:e.deleteFieldsWithNumber.replace("${number}",`${s.length}`)}</calcite-button>`}};J("arcgis-portal-field-delete",L);return L},"core/lang","layers/support/FeatureTemplate","Graphic","identity/IdentityManager","request","applications/PortalApp/layerUtils","layers/support/fieldUtils","layers/support/FeatureReductionBinning","layers/support/FeatureReductionCluster","renderers/support/jsonUtils","request","core/sql","applications/PortalApp/layerUtils",a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import f from"./7NNSALJQ.js";import{a as w,b as P}from"./ZEP2GDDJ.js";import e from"./Q75EBGI2.js";import c from"./B2YUF4DX.js";import a from"./F3ODJVJC.js";import{a as S}from"./XBQKBQOE.js";import{d as I}from"./6IQGJNQQ.js";import"./KCYIOVJQ.js";import{b as E}from"./4JPFPWGG.js";import{b as y}from"./WMT55UQD.js";import{J as d,K as m,L as b,P as C,h as g,j as n}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{createArcadeExecutor:F},{watch:q},{c:v},,{a:f,b:c,c:p,d:R,e:V,f:_},{a:x,b:$}])=>{async function k({portalClassificationSchema:r,itemClassification:t}){let i=Object.entries(r.attributes).map(async([e])=>{let s=await T(e,r,t);return{[e]:{enabled:s}}}),a=await Promise.all(i);return Object.assign({},...a)}async function T(r,t,i){let a=t?.attributes?.[r];if(!a)return!1;let{isAttributeEnabled:e}=a;return e?await h(e,JSON.stringify(t),i):!0}async function j({portalClassificationSchema:r,itemClassification:t}){let i=Object.entries(r.attributes).map(async([e])=>{let s=await M(e,r,t);return{[e]:{valueExpressionResult:s}}}),a=await Promise.all(i);return Object.assign({},...a)}async function M(r,t,i){let a=t.attributes[r];if(!a)throw Error(`Attribute ${r} not found in schema`);let e=a.valueExpression,s=a.validValues,o=a.validValuesMap;return s?.length?s:o&&Object.keys(o)?.length?o:e?await h(e,t,i,r):null}async function N({portalClassificationSchema:r,itemClassification:t}){let i=Object.entries(r.attributes).map(async([e])=>{let s=await H(e,r,t);return{[e]:{attributeValidationResult:s}}}),a=await Promise.all(i);return Object.assign({},...a)}async function H(r,t,i){let a=t?.attributes?.[r];if(!a)return null;let e=a?.attributeValidation;return e?await h(e,JSON.stringify(t),i,r):null}var O=async(r,t)=>{let i=r?.bannerExpression;return i?.length?await h(i,r,t):W(r,t)},W=(r,t)=>{let i=Object.entries(r.attributes).sort(([,s],[,o])=>(s?.bannerOrder??0)-(o?.bannerOrder??0)),a=[],e=[];return i.forEach(([s,o])=>{let l=t?.[s];l&&o.bannerOrder&&(a.push(U({elementType:o.uiElement??"",selectionDisplayLabel:o.bannerLabel??"",labelDelimiter:o.labelDelimiter??"",classificationProp:l,valueDelimiter:o.valueDelimiter??""})),e.push(o.attributeDelimiter??""))}),a.length>0?a.reduce((s,o,l)=>l===0?o:`${s}${e[l-1]}${o}`,""):""},U=({elementType:r,selectionDisplayLabel:t,labelDelimiter:i,classificationProp:a,valueDelimiter:e})=>{let s=r.includes("multi")&&a?a.split("").join(e):a;return`${t}${i}${s}`};async function h(r,t,i,a=""){let e={schemaJsonString:typeof t=="string"?t:JSON.stringify(t),valueJsonString:JSON.stringify(i),attributeId:a};return(await J(r)).execute(e)}async function J(r){return await F(r,{variables:[{name:"schemaJsonString",type:"text"},{name:"valueJsonString",type:"text"},{name:"attributeId",type:"text"}]})}var L=g`:host{height:100%;box-sizing:border-box;display:flex;flex-direction:column}.header-section{padding:var(--calcite-spacing-sm)}.header-section__title-container{display:flex;align-items:center;justify-content:space-between}.header-section__title-text{margin:unset;font-weight:unset;font-size:var(--calcite-font-size)}.header-section__title-popover{padding:var(--calcite-spacing-md)}.form-section{display:flex;border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);padding:var(--calcite-spacing-sm);height:100%;overflow:hidden}.form-section__sidebar{flex:1;padding:var(--calcite-spacing-sm)}.form-section__main-content{flex:3;padding:var(--calcite-spacing-sm);overflow:auto}.danger{color:var(--calcite-color-status-danger)}.spacing-y{margin:var(--calcite-spacing-md) 0}`,u=class extends b{constructor(){super(),this.classificationModel=x(this),this.messages=S(),this.formMainContentRef=d(),this.bannerRef=d(),this._classificationDataTask=$(this),this._formCreationTask=new P(this,{task:async()=>{if(await this._classificationDataTask.taskComplete,!this.portalClassificationSchema||!this.portalItem)throw new Error("Portal item and classification schema are required to render the form");let t=this.portalItem.clone();if(await t.load(),!this.primaryAttribute)throw new Error("primaryAttribute is required but was undefined.");this.existingClassification=!!t.classification,t.classification=f(t.classification,this.primaryAttribute,this.portalClassificationSchema),t.classification&&(t.classification.banner=await O(this.portalClassificationSchema,t.classification)),this.pendingPortalItem=t,this.cleanupItemClassificationWatchHandle(),this._itemClassificationWatchHandle=q(()=>this.portalItem.classification,i=>{if(this.pendingPortalItem){let a=this.pendingPortalItem.clone();a.load().then(()=>{a.classification=i,this.pendingPortalItem=a}).catch(e=>{console.error(e)})}}),this._itemClassificationWatchPortalItem=this.portalItem,this._itemClassificationWatchPortalItem.addHandles(this._itemClassificationWatchHandle,"arcgis-classification-config"),await this.evaluateAttributeExpressions(this.portalClassificationSchema,this.pendingPortalItem),this.pendingPortalItem.classification=c(this.pendingPortalItem.classification,this.attributeExpressionResults),this.pendingPortalItem=this.pendingPortalItem.clone(),this.existingClassification&&this.validateForm()},args:()=>[this.portalItem,this.portalClassificationSchema]}),this.getFormDisplayOrder=t=>this.portalClassificationSchema?.layouts.default.layoutElements[t].formDisplayOrder??0,this.addEditInfoAttributes=()=>{if(!this.pendingPortalItem?.classification)return{};let t=structuredClone(this.pendingPortalItem.classification),i=_(this.pendingPortalItem,t);return{...t,...i}},this.updateFavoriteClassification=t=>{this.favoriteClassifications=t},this.updateClassificationData=async t=>{let i=t.classification;if(this.selectedFavoriteClassificationName=t.name,this.pendingPortalItem){let a=this.pendingPortalItem.clone();if(await a.load(),a.classification=p(this.portalClassificationSchema,i),!this.portalClassificationSchema)return;await this.evaluateAttributeExpressions(this.portalClassificationSchema,a),a.classification=c(a.classification,this.attributeExpressionResults),this.pendingPortalItem=a}},this.existingClassification=!1,this.portalClassificationSchema=this.classificationModel.portalClassificationSchema,this.primaryAttribute=this.classificationModel.primaryAttribute,this.attributeExpressionResults=new Map,this.formValidationErrors=[],this.formValidationErrorsSource="other",this.remoteValidationErrors="",this.canUserConfigureClassification=!0,this.favoriteClassifications=[],this.isRequiredErrors=new Set,this.status=this.classificationModel.status,this.values={},this.valid=!1,this.autoDestroyDisabled=!1,this.arcgisPropertyChange=I()("status","values","valid")}static{this.properties={existingClassification:16,portalClassificationSchema:16,primaryAttribute:16,attributeExpressionResults:16,formValidationErrors:16,formValidationErrorsSource:16,itemClassification:16,pendingPortalItem:16,selectedCategory:16,remoteValidationErrors:16,canUserConfigureClassification:16,favoriteClassifications:16,selectedFavoriteClassificationName:16,isRequiredErrors:16,portalItem:0,status:35,values:[1,{type:Object}],valid:7,autoDestroyDisabled:5}}static{this.styles=L}async destroy(){this.cleanupItemClassificationWatchHandle(),await this.destroyManagedChildren(),await this.manager.destroy()}async resetForm(){if(this.existingClassification)this.pendingPortalItem=this.portalItem?.clone(),this.portalClassificationSchema&&this.pendingPortalItem&&(await this.evaluateAttributeExpressions(this.portalClassificationSchema,this.pendingPortalItem),this.pendingPortalItem.classification=c(this.pendingPortalItem.classification,this.attributeExpressionResults),this.validateForm());else if(this.portalItem&&this.primaryAttribute&&this.portalClassificationSchema){let t=this.portalItem.clone();await t.load(),this.pendingPortalItem=this.portalItem?.clone(),this.pendingPortalItem.classification=f(t.classification,this.primaryAttribute,this.portalClassificationSchema),this.portalClassificationSchema&&this.pendingPortalItem&&(await this.evaluateAttributeExpressions(this.portalClassificationSchema,this.pendingPortalItem),this.pendingPortalItem.classification=c(this.pendingPortalItem.classification,this.attributeExpressionResults))}}async validateForm(){this.updateFormValidationErrors(),await this.updateRemoteValidationErrors()}async load(){try{await V(this.portalItem)||(this.canUserConfigureClassification=!1);let t=await v(this.portalItem);if(t){let{result:i,error:a}=t;if(a&&a.details.raw.messageCode!=="COM_1177"){console.error(a);return}i&&(this.favoriteClassifications=i.favorites)}}catch(t){console.error("Error occured while loading arcgis-classification-config:",t)}}willUpdate(t){if(t.has("pendingPortalItem")){let i=this.addEditInfoAttributes();this.values=i}(t.has("formValidationErrors")||t.has("remoteValidationErrors"))&&(this.valid=!this.formValidationErrors.length&&!this.remoteValidationErrors)}loaded(){let t=E(this.el,"form");t&&(this.listenOn(t,"formdata",this.updateFormData),this.listenOn(t,"submit",this.handleFormSubmit)),this.listen("submit",this.handleFormSubmit)}async updateClassificationProperty(t){if(!this.pendingPortalItem||!this.portalClassificationSchema)return;let i=this.pendingPortalItem.clone();await i.load(),Object.entries(t??{}).forEach(([a,e])=>{if(a===this.primaryAttribute){let s=R(e,i.classification,this.primaryAttribute);s=p(this.portalClassificationSchema,s),i.classification=s}else{let s=new Map(Object.entries(i.classification??{}));if(e===void 0||e===""||Array.isArray(e)&&e.length===0)s.delete(a);else if(s.set(a,e),a==="fgi"&&!s.has("fgiOptions")){let o=this.portalClassificationSchema?.attributes?.fgiOptions?.defaultValue??[];s.set("fgiOptions",Array.isArray(o)?o:[o])}i.classification=Object.fromEntries(s)}}),i.classification&&!i.classification.fgi&&delete i.classification.fgiOptions,await this.evaluateAttributeExpressions(this.portalClassificationSchema,i),i.classification=c(i.classification,this.attributeExpressionResults),i.classification&&(i.classification.banner=await O(this.portalClassificationSchema,i.classification)),this.pendingPortalItem=i,this.existingClassification&&this.validateForm(),t&&"classification"in t&&this.updateIsRequiredErrors()}handleCategorySelectChange(t){this.selectedCategory=t.target.selectedItems[0].value}async evaluateAttributeExpressions(t,i){let a=await k({portalClassificationSchema:t,itemClassification:i.classification}),e=await j({portalClassificationSchema:t,itemClassification:i.classification}),s=await N({portalClassificationSchema:t,itemClassification:i.classification});Object.keys(t.attributes).forEach(o=>{let l=a[o]?.enabled??!0,D=e[o]?.valueExpressionResult,A=s[o]?.attributeValidationResult;this.attributeExpressionResults.set(o,{enabled:l,valueExpressionResult:D,attributeValidationResult:A})})}updateIsRequiredErrors(){let t=new Set;Object.entries(this.portalClassificationSchema?.attributes??{})?.forEach(([i,a])=>{a.isRequired&&!this.pendingPortalItem?.classification?.[i]&&this.pendingPortalItem?.classification?.[i]!==0&&t.add(i)}),this.isRequiredErrors=t}updateFormValidationErrors(t=!1,i="other"){let a=[];Object.entries(this.portalClassificationSchema?.attributes??{})?.forEach(([e,s])=>{s.isRequired&&!this.pendingPortalItem?.classification?.[e]&&this.pendingPortalItem?.classification?.[e]!==0&&(!t||this.isRequiredErrors.has(e))&&a.push({attribute:s.label,reason:this.messages.isrequired??"is required",category:s.attributeCategory}),this.attributeExpressionResults.get(e)?.attributeValidationResult&&a.push({attribute:s.label,reason:this.attributeExpressionResults.get(e)?.attributeValidationResult??"",category:s.attributeCategory})}),this.formValidationErrors=a,this.formValidationErrorsSource=i}async updateRemoteValidationErrors(){if(!this.pendingPortalItem?.classification)return;let t=await this.classificationModel.validateClassification(void 0,this.pendingPortalItem?.classification,this.pendingPortalItem.portal.restUrl);this.remoteValidationErrors=t}cleanupItemClassificationWatchHandle(){this._itemClassificationWatchHandle?.remove(),this._itemClassificationWatchHandle=void 0,this._itemClassificationWatchPortalItem?.removeHandles("arcgis-classification-config"),this._itemClassificationWatchPortalItem=void 0}async destroyManagedChildren(){let t=this.bannerRef.value;!t?.autoDestroyDisabled||t.manager?.destroyed||await t.destroy()}async handleFormSubmit(t){this.validateForm(),this.updateIsRequiredErrors(),this.formMainContentRef.value?.scrollIntoView()}updateFormData(t){let i=t.formData,a=this.addEditInfoAttributes();a=c(a,this.attributeExpressionResults),Object.entries(a??{}).forEach(([e,s])=>{i.set(e,s)})}renderCategoryTabs(){return this._classificationDataTask.render({complete:()=>{if(this.portalClassificationSchema?.attributeCategories?.length)return this.selectedCategory||(this.selectedCategory=this.portalClassificationSchema?.attributeCategories[0]),n`<calcite-list .label=${this.messages.selectcategory??"select category"} selection-appearance=border selection-mode=single-persist @calciteListChange=${this.handleCategorySelectChange}>${this.portalClassificationSchema.attributeCategories.map(t=>{let i=this.formValidationErrors.filter(a=>a.category===t).length;return n`<calcite-list-item .label=${t} .value=${t} .selected=${this.selectedCategory===t} .description=${i?`${i} ${i>1?this.messages.errors:this.messages.error}`:void 0}>${i&&n`<div slot=content-end class="danger"><calcite-icon icon=exclamation-mark-triangle scale=s></calcite-icon></div>`||""}</calcite-list-item>`})}</calcite-list>`}})}renderValidationErrors(){return this.formValidationErrors.length&&(!this.selectedCategory||this.formValidationErrors.some(t=>this.selectedCategory===t.category)||this.formValidationErrorsSource==="favorite")?n`<calcite-notice open icon=exclamation-mark-triangle class="spacing-y" kind=danger><div slot=message>${this.messages.bannererror??"Some fields are incomplete or contain errors. Check the highlighted fields for details."}</div></calcite-notice>`:null}renderFavoriteClassification(){let t=this.portalClassificationSchema?.attributeCategories?.[0]??"Default";return this.selectedCategory=this.portalClassificationSchema?.attributeCategories?.length?this.selectedCategory:"Default",this.selectedCategory===t?n`<arcgis-portal-classification-favorite .portalItem=${this.pendingPortalItem??this.portalItem} .classificationValue=${this.pendingPortalItem?.classification} .favoriteClassifications=${this.favoriteClassifications} .selectedFavoriteClassificationName=${this.selectedFavoriteClassificationName} .attributeExpressionResults=${this.attributeExpressionResults} .resetFavoriteClassification=${i=>this.updateFavoriteClassification(i)} .updateClassificationData=${async i=>{await this.updateClassificationData(i),this.updateFormValidationErrors(!1,"favorite"),this.updateIsRequiredErrors()}}></arcgis-portal-classification-favorite>`:null}renderForm(){return this._formCreationTask.render({pending:()=>n`<calcite-loader .label=${this.messages.loading??"loading"}></calcite-loader>`,complete:()=>{if(!this.pendingPortalItem||!this.portalClassificationSchema)return;let t=Object.entries(this.portalClassificationSchema.attributes).sort(([i],[a])=>this.getFormDisplayOrder(i)-this.getFormDisplayOrder(a));return n`${this.renderValidationErrors()}${this.renderFavoriteClassification()}${t.filter(([,{attributeCategory:i}])=>this.selectedCategory===i||!i).map(([i,a])=>{if(this.attributeExpressionResults.get(i)?.enabled===!1)return null;let e=this.pendingPortalItem?.classification?.[i];return n`<arcgis-portal-classification-form-element .attributeKey=${i} .attribute=${a} .value=${e} @arcgisAttributeValueChange=${async s=>{await this.updateClassificationProperty(s.detail),a.isRequired&&!s.detail[i]?this.isRequiredErrors.add(i):this.isRequiredErrors=new Set(Array.from(this.isRequiredErrors).filter(o=>o!==i)),this.updateFormValidationErrors(!0)}} .renderingInfo=${this.attributeExpressionResults.get(i)} .isRequiredErrors=${this.isRequiredErrors}></arcgis-portal-classification-form-element>`})}`}})}renderNotice(t,i="warning"){return n`<calcite-notice icon=exclamation-mark-triangle open class="spacing-y" .kind=${i}><div slot=message>${t}</div></calcite-notice>`}renderHelpTooltip(){return this.portalClassificationSchema?.helpTooltip?n`<calcite-action id=portal-classification-config-tooltip-button .text=${this.portalClassificationSchema?.helpTooltip} icon=information></calcite-action><calcite-popover .label=${this.portalClassificationSchema?.helpTooltip} reference-element=portal-classification-config-tooltip-button placement=bottom-end overlay-positioning=fixed auto-close><div class="header-section__title-popover"><calcite-link .href=${this.portalClassificationSchema?.helpUrl} target=_blank id=portal-classification-config-tooltip-button>${this.portalClassificationSchema?.helpTooltip}</calcite-link></div></calcite-popover>`:null}render(){return this.portalItem?this._classificationDataTask.render({pending:()=>n`<calcite-loader .label=${this.messages.loading??"loading"}></calcite-loader>`,error:()=>this.renderNotice(this.messages.anerroroccurred??"An error has occurred.","danger"),complete:()=>this.portalItem?this.canUserConfigureClassification?this.portalItem.portal.hasClassificationSchema?n`<div class="header-section" role=region aria-label=${this.messages.documentbannerpreview??"documentbannerpreview"??C}><div class="header-section__title-container"><h2 class="header-section__title-text">${this.messages.documentbannerpreview??"documentbannerpreview"}</h2>${this.renderHelpTooltip()}</div>${this._formCreationTask.status===w.COMPLETE&&n`<arcgis-portal-classification-banner .portalItem=${this.pendingPortalItem??this.portalItem} variant=preview .missingExistingClassification=${!this.existingClassification} .autoDestroyDisabled=${this.autoDestroyDisabled} ${m(this.bannerRef)}></arcgis-portal-classification-banner>`||""}</div><div class="form-section">${this.portalClassificationSchema?.attributeCategories?.length&&n`<div class="form-section__sidebar">${this.renderCategoryTabs()}</div>`||""}<div class="form-section__main-content" ${m(this.formMainContentRef)}>${this.renderForm()}</div></div>`:this.renderNotice(this.messages.missingclassificationschema??"Portal is missing classification schema."):this.renderNotice(this.messages.userconfigurepermissionrequired??"User configuration permission is required."):this.renderNotice(this.messages.portalitemrequired??"Portal item is required.")}):this.renderNotice(this.messages.portalitemrequired??"Portal item is required.")}};y("arcgis-portal-classification-config",u);return u},"arcade","core/reactiveUtils",a,c,e,f)
|
|
2
|
+
import f from"./7NNSALJQ.js";import{a as w,b as P}from"./ZEP2GDDJ.js";import e from"./Q75EBGI2.js";import c from"./B2YUF4DX.js";import a from"./F3ODJVJC.js";import{a as S}from"./JJUCB3OG.js";import{d as I}from"./QFHL5APV.js";import"./KCYIOVJQ.js";import{b as E}from"./XD3TUJLE.js";import{b as y}from"./WMT55UQD.js";import{J as d,K as m,L as b,P as C,h as g,j as n}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([{createArcadeExecutor:F},{watch:q},{c:v},,{a:f,b:c,c:p,d:R,e:V,f:_},{a:x,b:$}])=>{async function k({portalClassificationSchema:r,itemClassification:t}){let i=Object.entries(r.attributes).map(async([e])=>{let s=await T(e,r,t);return{[e]:{enabled:s}}}),a=await Promise.all(i);return Object.assign({},...a)}async function T(r,t,i){let a=t?.attributes?.[r];if(!a)return!1;let{isAttributeEnabled:e}=a;return e?await h(e,JSON.stringify(t),i):!0}async function j({portalClassificationSchema:r,itemClassification:t}){let i=Object.entries(r.attributes).map(async([e])=>{let s=await M(e,r,t);return{[e]:{valueExpressionResult:s}}}),a=await Promise.all(i);return Object.assign({},...a)}async function M(r,t,i){let a=t.attributes[r];if(!a)throw Error(`Attribute ${r} not found in schema`);let e=a.valueExpression,s=a.validValues,o=a.validValuesMap;return s?.length?s:o&&Object.keys(o)?.length?o:e?await h(e,t,i,r):null}async function N({portalClassificationSchema:r,itemClassification:t}){let i=Object.entries(r.attributes).map(async([e])=>{let s=await H(e,r,t);return{[e]:{attributeValidationResult:s}}}),a=await Promise.all(i);return Object.assign({},...a)}async function H(r,t,i){let a=t?.attributes?.[r];if(!a)return null;let e=a?.attributeValidation;return e?await h(e,JSON.stringify(t),i,r):null}var O=async(r,t)=>{let i=r?.bannerExpression;return i?.length?await h(i,r,t):W(r,t)},W=(r,t)=>{let i=Object.entries(r.attributes).sort(([,s],[,o])=>(s?.bannerOrder??0)-(o?.bannerOrder??0)),a=[],e=[];return i.forEach(([s,o])=>{let l=t?.[s];l&&o.bannerOrder&&(a.push(U({elementType:o.uiElement??"",selectionDisplayLabel:o.bannerLabel??"",labelDelimiter:o.labelDelimiter??"",classificationProp:l,valueDelimiter:o.valueDelimiter??""})),e.push(o.attributeDelimiter??""))}),a.length>0?a.reduce((s,o,l)=>l===0?o:`${s}${e[l-1]}${o}`,""):""},U=({elementType:r,selectionDisplayLabel:t,labelDelimiter:i,classificationProp:a,valueDelimiter:e})=>{let s=r.includes("multi")&&a?a.split("").join(e):a;return`${t}${i}${s}`};async function h(r,t,i,a=""){let e={schemaJsonString:typeof t=="string"?t:JSON.stringify(t),valueJsonString:JSON.stringify(i),attributeId:a};return(await J(r)).execute(e)}async function J(r){return await F(r,{variables:[{name:"schemaJsonString",type:"text"},{name:"valueJsonString",type:"text"},{name:"attributeId",type:"text"}]})}var L=g`:host{height:100%;box-sizing:border-box;display:flex;flex-direction:column}.header-section{padding:var(--calcite-spacing-sm)}.header-section__title-container{display:flex;align-items:center;justify-content:space-between}.header-section__title-text{margin:unset;font-weight:unset;font-size:var(--calcite-font-size)}.header-section__title-popover{padding:var(--calcite-spacing-md)}.form-section{display:flex;border-top:var(--calcite-border-width-sm) solid var(--calcite-color-border-1);padding:var(--calcite-spacing-sm);height:100%;overflow:hidden}.form-section__sidebar{flex:1;padding:var(--calcite-spacing-sm)}.form-section__main-content{flex:3;padding:var(--calcite-spacing-sm);overflow:auto}.danger{color:var(--calcite-color-status-danger)}.spacing-y{margin:var(--calcite-spacing-md) 0}`,u=class extends b{constructor(){super(),this.classificationModel=x(this),this.messages=S(),this.formMainContentRef=d(),this.bannerRef=d(),this._classificationDataTask=$(this),this._formCreationTask=new P(this,{task:async()=>{if(await this._classificationDataTask.taskComplete,!this.portalClassificationSchema||!this.portalItem)throw new Error("Portal item and classification schema are required to render the form");let t=this.portalItem.clone();if(await t.load(),!this.primaryAttribute)throw new Error("primaryAttribute is required but was undefined.");this.existingClassification=!!t.classification,t.classification=f(t.classification,this.primaryAttribute,this.portalClassificationSchema),t.classification&&(t.classification.banner=await O(this.portalClassificationSchema,t.classification)),this.pendingPortalItem=t,this.cleanupItemClassificationWatchHandle(),this._itemClassificationWatchHandle=q(()=>this.portalItem.classification,i=>{if(this.pendingPortalItem){let a=this.pendingPortalItem.clone();a.load().then(()=>{a.classification=i,this.pendingPortalItem=a}).catch(e=>{console.error(e)})}}),this._itemClassificationWatchPortalItem=this.portalItem,this._itemClassificationWatchPortalItem.addHandles(this._itemClassificationWatchHandle,"arcgis-classification-config"),await this.evaluateAttributeExpressions(this.portalClassificationSchema,this.pendingPortalItem),this.pendingPortalItem.classification=c(this.pendingPortalItem.classification,this.attributeExpressionResults),this.pendingPortalItem=this.pendingPortalItem.clone(),this.existingClassification&&this.validateForm()},args:()=>[this.portalItem,this.portalClassificationSchema]}),this.getFormDisplayOrder=t=>this.portalClassificationSchema?.layouts.default.layoutElements[t].formDisplayOrder??0,this.addEditInfoAttributes=()=>{if(!this.pendingPortalItem?.classification)return{};let t=structuredClone(this.pendingPortalItem.classification),i=_(this.pendingPortalItem,t);return{...t,...i}},this.updateFavoriteClassification=t=>{this.favoriteClassifications=t},this.updateClassificationData=async t=>{let i=t.classification;if(this.selectedFavoriteClassificationName=t.name,this.pendingPortalItem){let a=this.pendingPortalItem.clone();if(await a.load(),a.classification=p(this.portalClassificationSchema,i),!this.portalClassificationSchema)return;await this.evaluateAttributeExpressions(this.portalClassificationSchema,a),a.classification=c(a.classification,this.attributeExpressionResults),this.pendingPortalItem=a}},this.existingClassification=!1,this.portalClassificationSchema=this.classificationModel.portalClassificationSchema,this.primaryAttribute=this.classificationModel.primaryAttribute,this.attributeExpressionResults=new Map,this.formValidationErrors=[],this.formValidationErrorsSource="other",this.remoteValidationErrors="",this.canUserConfigureClassification=!0,this.favoriteClassifications=[],this.isRequiredErrors=new Set,this.status=this.classificationModel.status,this.values={},this.valid=!1,this.autoDestroyDisabled=!1,this.arcgisPropertyChange=I()("status","values","valid")}static{this.properties={existingClassification:16,portalClassificationSchema:16,primaryAttribute:16,attributeExpressionResults:16,formValidationErrors:16,formValidationErrorsSource:16,itemClassification:16,pendingPortalItem:16,selectedCategory:16,remoteValidationErrors:16,canUserConfigureClassification:16,favoriteClassifications:16,selectedFavoriteClassificationName:16,isRequiredErrors:16,portalItem:0,status:35,values:[1,{type:Object}],valid:7,autoDestroyDisabled:5}}static{this.styles=L}async destroy(){this.cleanupItemClassificationWatchHandle(),await this.destroyManagedChildren(),await this.manager.destroy()}async resetForm(){if(this.existingClassification)this.pendingPortalItem=this.portalItem?.clone(),this.portalClassificationSchema&&this.pendingPortalItem&&(await this.evaluateAttributeExpressions(this.portalClassificationSchema,this.pendingPortalItem),this.pendingPortalItem.classification=c(this.pendingPortalItem.classification,this.attributeExpressionResults),this.validateForm());else if(this.portalItem&&this.primaryAttribute&&this.portalClassificationSchema){let t=this.portalItem.clone();await t.load(),this.pendingPortalItem=this.portalItem?.clone(),this.pendingPortalItem.classification=f(t.classification,this.primaryAttribute,this.portalClassificationSchema),this.portalClassificationSchema&&this.pendingPortalItem&&(await this.evaluateAttributeExpressions(this.portalClassificationSchema,this.pendingPortalItem),this.pendingPortalItem.classification=c(this.pendingPortalItem.classification,this.attributeExpressionResults))}}async validateForm(){this.updateFormValidationErrors(),await this.updateRemoteValidationErrors()}async load(){try{await V(this.portalItem)||(this.canUserConfigureClassification=!1);let t=await v(this.portalItem);if(t){let{result:i,error:a}=t;if(a&&a.details.raw.messageCode!=="COM_1177"){console.error(a);return}i&&(this.favoriteClassifications=i.favorites)}}catch(t){console.error("Error occured while loading arcgis-classification-config:",t)}}willUpdate(t){if(t.has("pendingPortalItem")){let i=this.addEditInfoAttributes();this.values=i}(t.has("formValidationErrors")||t.has("remoteValidationErrors"))&&(this.valid=!this.formValidationErrors.length&&!this.remoteValidationErrors)}loaded(){let t=E(this.el,"form");t&&(this.listenOn(t,"formdata",this.updateFormData),this.listenOn(t,"submit",this.handleFormSubmit)),this.listen("submit",this.handleFormSubmit)}async updateClassificationProperty(t){if(!this.pendingPortalItem||!this.portalClassificationSchema)return;let i=this.pendingPortalItem.clone();await i.load(),Object.entries(t??{}).forEach(([a,e])=>{if(a===this.primaryAttribute){let s=R(e,i.classification,this.primaryAttribute);s=p(this.portalClassificationSchema,s),i.classification=s}else{let s=new Map(Object.entries(i.classification??{}));if(e===void 0||e===""||Array.isArray(e)&&e.length===0)s.delete(a);else if(s.set(a,e),a==="fgi"&&!s.has("fgiOptions")){let o=this.portalClassificationSchema?.attributes?.fgiOptions?.defaultValue??[];s.set("fgiOptions",Array.isArray(o)?o:[o])}i.classification=Object.fromEntries(s)}}),i.classification&&!i.classification.fgi&&delete i.classification.fgiOptions,await this.evaluateAttributeExpressions(this.portalClassificationSchema,i),i.classification=c(i.classification,this.attributeExpressionResults),i.classification&&(i.classification.banner=await O(this.portalClassificationSchema,i.classification)),this.pendingPortalItem=i,this.existingClassification&&this.validateForm(),t&&"classification"in t&&this.updateIsRequiredErrors()}handleCategorySelectChange(t){this.selectedCategory=t.target.selectedItems[0].value}async evaluateAttributeExpressions(t,i){let a=await k({portalClassificationSchema:t,itemClassification:i.classification}),e=await j({portalClassificationSchema:t,itemClassification:i.classification}),s=await N({portalClassificationSchema:t,itemClassification:i.classification});Object.keys(t.attributes).forEach(o=>{let l=a[o]?.enabled??!0,D=e[o]?.valueExpressionResult,A=s[o]?.attributeValidationResult;this.attributeExpressionResults.set(o,{enabled:l,valueExpressionResult:D,attributeValidationResult:A})})}updateIsRequiredErrors(){let t=new Set;Object.entries(this.portalClassificationSchema?.attributes??{})?.forEach(([i,a])=>{a.isRequired&&!this.pendingPortalItem?.classification?.[i]&&this.pendingPortalItem?.classification?.[i]!==0&&t.add(i)}),this.isRequiredErrors=t}updateFormValidationErrors(t=!1,i="other"){let a=[];Object.entries(this.portalClassificationSchema?.attributes??{})?.forEach(([e,s])=>{s.isRequired&&!this.pendingPortalItem?.classification?.[e]&&this.pendingPortalItem?.classification?.[e]!==0&&(!t||this.isRequiredErrors.has(e))&&a.push({attribute:s.label,reason:this.messages.isrequired??"is required",category:s.attributeCategory}),this.attributeExpressionResults.get(e)?.attributeValidationResult&&a.push({attribute:s.label,reason:this.attributeExpressionResults.get(e)?.attributeValidationResult??"",category:s.attributeCategory})}),this.formValidationErrors=a,this.formValidationErrorsSource=i}async updateRemoteValidationErrors(){if(!this.pendingPortalItem?.classification)return;let t=await this.classificationModel.validateClassification(void 0,this.pendingPortalItem?.classification,this.pendingPortalItem.portal.restUrl);this.remoteValidationErrors=t}cleanupItemClassificationWatchHandle(){this._itemClassificationWatchHandle?.remove(),this._itemClassificationWatchHandle=void 0,this._itemClassificationWatchPortalItem?.removeHandles("arcgis-classification-config"),this._itemClassificationWatchPortalItem=void 0}async destroyManagedChildren(){let t=this.bannerRef.value;!t?.autoDestroyDisabled||t.manager?.destroyed||await t.destroy()}async handleFormSubmit(t){this.validateForm(),this.updateIsRequiredErrors(),this.formMainContentRef.value?.scrollIntoView()}updateFormData(t){let i=t.formData,a=this.addEditInfoAttributes();a=c(a,this.attributeExpressionResults),Object.entries(a??{}).forEach(([e,s])=>{i.set(e,s)})}renderCategoryTabs(){return this._classificationDataTask.render({complete:()=>{if(this.portalClassificationSchema?.attributeCategories?.length)return this.selectedCategory||(this.selectedCategory=this.portalClassificationSchema?.attributeCategories[0]),n`<calcite-list .label=${this.messages.selectcategory??"select category"} selection-appearance=border selection-mode=single-persist @calciteListChange=${this.handleCategorySelectChange}>${this.portalClassificationSchema.attributeCategories.map(t=>{let i=this.formValidationErrors.filter(a=>a.category===t).length;return n`<calcite-list-item .label=${t} .value=${t} .selected=${this.selectedCategory===t} .description=${i?`${i} ${i>1?this.messages.errors:this.messages.error}`:void 0}>${i&&n`<div slot=content-end class="danger"><calcite-icon icon=exclamation-mark-triangle scale=s></calcite-icon></div>`||""}</calcite-list-item>`})}</calcite-list>`}})}renderValidationErrors(){return this.formValidationErrors.length&&(!this.selectedCategory||this.formValidationErrors.some(t=>this.selectedCategory===t.category)||this.formValidationErrorsSource==="favorite")?n`<calcite-notice open icon=exclamation-mark-triangle class="spacing-y" kind=danger><div slot=message>${this.messages.bannererror??"Some fields are incomplete or contain errors. Check the highlighted fields for details."}</div></calcite-notice>`:null}renderFavoriteClassification(){let t=this.portalClassificationSchema?.attributeCategories?.[0]??"Default";return this.selectedCategory=this.portalClassificationSchema?.attributeCategories?.length?this.selectedCategory:"Default",this.selectedCategory===t?n`<arcgis-portal-classification-favorite .portalItem=${this.pendingPortalItem??this.portalItem} .classificationValue=${this.pendingPortalItem?.classification} .favoriteClassifications=${this.favoriteClassifications} .selectedFavoriteClassificationName=${this.selectedFavoriteClassificationName} .attributeExpressionResults=${this.attributeExpressionResults} .resetFavoriteClassification=${i=>this.updateFavoriteClassification(i)} .updateClassificationData=${async i=>{await this.updateClassificationData(i),this.updateFormValidationErrors(!1,"favorite"),this.updateIsRequiredErrors()}}></arcgis-portal-classification-favorite>`:null}renderForm(){return this._formCreationTask.render({pending:()=>n`<calcite-loader .label=${this.messages.loading??"loading"}></calcite-loader>`,complete:()=>{if(!this.pendingPortalItem||!this.portalClassificationSchema)return;let t=Object.entries(this.portalClassificationSchema.attributes).sort(([i],[a])=>this.getFormDisplayOrder(i)-this.getFormDisplayOrder(a));return n`${this.renderValidationErrors()}${this.renderFavoriteClassification()}${t.filter(([,{attributeCategory:i}])=>this.selectedCategory===i||!i).map(([i,a])=>{if(this.attributeExpressionResults.get(i)?.enabled===!1)return null;let e=this.pendingPortalItem?.classification?.[i];return n`<arcgis-portal-classification-form-element .attributeKey=${i} .attribute=${a} .value=${e} @arcgisAttributeValueChange=${async s=>{await this.updateClassificationProperty(s.detail),a.isRequired&&!s.detail[i]?this.isRequiredErrors.add(i):this.isRequiredErrors=new Set(Array.from(this.isRequiredErrors).filter(o=>o!==i)),this.updateFormValidationErrors(!0)}} .renderingInfo=${this.attributeExpressionResults.get(i)} .isRequiredErrors=${this.isRequiredErrors}></arcgis-portal-classification-form-element>`})}`}})}renderNotice(t,i="warning"){return n`<calcite-notice icon=exclamation-mark-triangle open class="spacing-y" .kind=${i}><div slot=message>${t}</div></calcite-notice>`}renderHelpTooltip(){return this.portalClassificationSchema?.helpTooltip?n`<calcite-action id=portal-classification-config-tooltip-button .text=${this.portalClassificationSchema?.helpTooltip} icon=information></calcite-action><calcite-popover .label=${this.portalClassificationSchema?.helpTooltip} reference-element=portal-classification-config-tooltip-button placement=bottom-end overlay-positioning=fixed auto-close><div class="header-section__title-popover"><calcite-link .href=${this.portalClassificationSchema?.helpUrl} target=_blank id=portal-classification-config-tooltip-button>${this.portalClassificationSchema?.helpTooltip}</calcite-link></div></calcite-popover>`:null}render(){return this.portalItem?this._classificationDataTask.render({pending:()=>n`<calcite-loader .label=${this.messages.loading??"loading"}></calcite-loader>`,error:()=>this.renderNotice(this.messages.anerroroccurred??"An error has occurred.","danger"),complete:()=>this.portalItem?this.canUserConfigureClassification?this.portalItem.portal.hasClassificationSchema?n`<div class="header-section" role=region aria-label=${this.messages.documentbannerpreview??"documentbannerpreview"??C}><div class="header-section__title-container"><h2 class="header-section__title-text">${this.messages.documentbannerpreview??"documentbannerpreview"}</h2>${this.renderHelpTooltip()}</div>${this._formCreationTask.status===w.COMPLETE&&n`<arcgis-portal-classification-banner .portalItem=${this.pendingPortalItem??this.portalItem} variant=preview .missingExistingClassification=${!this.existingClassification} .autoDestroyDisabled=${this.autoDestroyDisabled} ${m(this.bannerRef)}></arcgis-portal-classification-banner>`||""}</div><div class="form-section">${this.portalClassificationSchema?.attributeCategories?.length&&n`<div class="form-section__sidebar">${this.renderCategoryTabs()}</div>`||""}<div class="form-section__main-content" ${m(this.formMainContentRef)}>${this.renderForm()}</div></div>`:this.renderNotice(this.messages.missingclassificationschema??"Portal is missing classification schema."):this.renderNotice(this.messages.userconfigurepermissionrequired??"User configuration permission is required."):this.renderNotice(this.messages.portalitemrequired??"Portal item is required.")}):this.renderNotice(this.messages.portalitemrequired??"Portal item is required.")}};y("arcgis-portal-classification-config",u);return u},"arcade","core/reactiveUtils",a,c,e,f)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import l from"./CVOWIH4J.js";import{a as
|
|
2
|
+
import l from"./CVOWIH4J.js";import{a as C,c as U}from"./EBPLUTN5.js";import{a as k,b as D,c as _}from"./6TO2BYXU.js";import"./ILDTKRON.js";import{a as T}from"./CFBSBZSS.js";import j from"./TJYPEMON.js";import{a as w}from"./RL2H7TI6.js";import i from"./RBGARTND.js";import e from"./F3ODJVJC.js";import a from"./OUFIJDIW.js";import{f as b}from"./VMQIDO4Z.js";import{b as f}from"./QS3GXAIH.js";import"./2GBRZSEC.js";import{a as v}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as g}from"./WMT55UQD.js";import{J as d,K as I,L as u,P as R,h as p,j as c,w as h}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([P,,,{a:$},{q:A},{f:y}])=>{var H=p`.thumbnail{object-fit:cover;max-height:8rem}.replacement-container{margin:.5rem}.replacement-message{margin-bottom:.5rem}.replacement-card__title{margin-bottom:.25rem}`,B=5e3,m=class extends u{constructor(){super(...arguments),this.replacementId=null,this.itemOwnerName="",this.replacementItemInRecycleBin=!1,this.hasInaccessibleReplacementItem=!1,this.replacementItemSupportsOpenActions=!1,this.thumbnailUrl=null,this.timer=void 0,this.messages=v({blocking:!0}),this.primaryActionRef=d(),this.getItemDetailsUrl=({portal:e,itemId:t,redirect:i})=>{let s=f({portal:e,usePortalHostname:!this.user});return s?`${`${s}/home`}/item.html?id=${t}${i?"&performRedirectAction=true":""}`:""},this.performRedirectAction=()=>{window.open(this.getItemDetailsUrl({portal:this.portal,itemId:this.replacementId,redirect:!0}),"_self")},this.viewItemDetailsPage=()=>{window.open(this.getItemDetailsUrl({portal:this.portal,itemId:this.replacementId??this.itemId}),this.supportsReplacement?"_self":"_blank")},this.canRedirect=!1,this.item=null,this.replacementItem=null,this.redirectAction=null,this.supportsReplacement=!1,this.redirectCancelled=!1,this.open=!1,this.redirectTimeRemaining=B/1e3,this.arcgisPortalReplacementItemFetch=h()}static{this.properties={item:16,replacementItem:16,redirectAction:16,supportsReplacement:16,redirectCancelled:16,open:16,redirectTimeRemaining:16,itemId:1,portal:0,user:0}}static{this.styles=H}async setFocus(){this.primaryActionRef.value?.setFocus()}willUpdate(e){(e.has("itemId")||e.has("portal")||e.has("user"))&&(this.user??=this.portal?.user??null,this.initItem())}setupTimer({onComplete:e}){typeof this.timer=="number"&&clearInterval(this.timer),this.redirectTimeRemaining=B/1e3,this.timer=setInterval(()=>{if(this.redirectTimeRemaining<=0){clearInterval(this.timer),this.timer=void 0,e();return}this.redirectTimeRemaining-=1},1e3)}cancelTimer({onCancel:e}={}){e?.(),clearInterval(this.timer)}handleClose(){this.cancelTimer(),this.itemId="",this.item=null,this.open=!1}cancelRedirect(){this.cancelTimer(),this.redirectCancelled=!0}isItemRetired(e){return k(e)||D(e)}async initItem(){if(!this.itemId)return;let{itemId:e,portal:t,performRedirectAction:i}=this,s=new P({id:e,portal:t});this.item=await s?.load();let n=await A(e,t,{relationshipType:"ReplacementItem2Item",direction:"reverse"},!0),r=n.data?.relatedItems?.[0];this.replacementItemInRecycleBin=r?.inRecycleBin;let l=r?.id,a=!this.replacementItemInRecycleBin&&l?new P({id:l,portal:t}):null;await a?.load(),this.replacementItem=a,this.hasInaccessibleReplacementItem=this.replacementItemInRecycleBin||!a&&n.data?.aggregations?.total?.count>0&&n.data?.relatedItems?.length===0,this.arcgisPortalReplacementItemFetch.emit({replacementItem:this.hasInaccessibleReplacementItem?{}:a||null}),this.replacementItem=a;let o=this.replacementItem?.owner??(s?.owner||null);this.itemOwnerName=o?T(await $(o,t),this.messages?._t9nLocale||"en"):"",this.replacementItemSupportsOpenActions=_(a),this.thumbnailUrl=U(t,a??this.item),this.supportsReplacement=!!a&&this.isItemRetired(s);let O=b(this.replacementItem,await y(this.portal),this.portal?.isPortal??!1);this.canRedirect=this.supportsReplacement&&this.replacementItemSupportsOpenActions&&!O,this.replacementId=a?.id||null,this.canRedirect&&this.setupTimer({onComplete:()=>i()}),this.open=!0}getReplacementHeading(){let{messages:e,hasInaccessibleReplacementItem:t,canRedirect:i}=this;return t?e.replacementUnavailable:i?e.redirectToReplacement:this.isItemRetired(this.item)&&!this.replacementItem?e.replacementUnavailable:e.replacementAvailable}getReplacementMessage(){let{messages:e,hasInaccessibleReplacementItem:t,supportsReplacement:i}=this;return t?e.retiredReplacementUnavailable:i?e.deprecatedHasReplacement:this.isItemRetired(this.item)&&!this.replacementItem?e.retired:e.deprecatedHasReplacement}getRedirectActionMessage(){let{messages:e,canRedirect:t,redirectTimeRemaining:i,redirectCancelled:s}=this;return s?e.redirectToReplacement:t?e.redirect.replace("${seconds}",`${i}`):e.moreDetails}renderCard(e){let{canRedirect:t,messages:i}=this;return c`<calcite-card thumbnail-position=inline-start><img slot=thumbnail class="thumbnail" src=${(this.thumbnailUrl||void 0)??R} @error=${async()=>this.thumbnailUrl=C(e)}><span slot=heading class="replacement-card__title">${e.title}</span><span slot=description>${i.ownedBy?.replace("${owner}",this.itemOwnerName)}</span>${t&&c`<calcite-link slot=footer-start icon-end=launch .href=${this.getItemDetailsUrl({portal:this.portal,itemId:this.replacementId})} target=_blank>${i.moreDetails}</calcite-link>`||""}</calcite-card>`}render(){let{open:e,messages:t,item:i,replacementItem:s,supportsReplacement:n,canRedirect:r,redirectCancelled:l}=this;if(!(!i||!this.isItemRetired(i)))return c`<calcite-dialog modal .open=${e} width=s kind=info outside-close-disabled escape-disabled close-disabled .heading=${this.getReplacementHeading()} @calciteDialogClose=${()=>this.handleClose()}><div class="replacement-container"><div class="replacement-message">${w(this.getReplacementMessage()?.replace("${itemTitle}",this.item?.title||""))}</div>${this.renderCard(n?s:i)}</div>${r&&!l&&c`<calcite-button slot=footer-end appearance=outline-fill kind=neutral @click=${()=>{this.cancelRedirect()}}>${t.cancelRedirection}</calcite-button>`||""}<calcite-button slot=footer-end @click=${()=>{this.cancelTimer(),r?this.performRedirectAction():this.viewItemDetailsPage()}} .iconEnd=${r?void 0:"launch"} ${I(this.primaryActionRef)}>${this.getRedirectActionMessage()}</calcite-button></calcite-dialog>`}};g("arcgis-portal-replacement-item-redirect",m);return m},"portal/PortalItem",a,e,i,j,l)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./
|
|
2
|
+
import e from"./UDDG7VVX.js";import d from"./MQISQ7P3.js";import"./6TO2BYXU.js";import"./6KVA4AKM.js";import"./ILDTKRON.js";import"./CFBSBZSS.js";import"./25XJ66JO.js";import"./5YDITHQA.js";import c from"./RBGARTND.js";import b from"./F3ODJVJC.js";import a from"./OUFIJDIW.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import"./2GBRZSEC.js";import"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import"./WMT55UQD.js";import"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,{b:r}])=>{return r},a,b,c,d,e)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./ZZ44GQ4I.js";import b from"./TJYPEMON.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import"./2GBRZSEC.js";import{a as f}from"./
|
|
2
|
+
import c from"./ZZ44GQ4I.js";import b from"./TJYPEMON.js";import"./VMQIDO4Z.js";import"./QS3GXAIH.js";import"./2GBRZSEC.js";import{a as f}from"./JJUCB3OG.js";import"./QFHL5APV.js";import"./KCYIOVJQ.js";import"./XD3TUJLE.js";import{b as g,c as y}from"./WMT55UQD.js";import{L as d,N as h,P as p,h as m,j as a}from"./EXBWPG5Y.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";export default $arcgis.t(([,{b:x}])=>{var $=m`:host{display:inline-flex;align-items:center}:host([scale="s"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size--2);--arcgis-portal-item-type-spacing: 1rem}:host([scale="m"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size--1);--arcgis-portal-item-type-spacing: 1rem}:host([scale="l"]){--arcgis-portal-item-type-font-size: var(--calcite-font-size-0);--arcgis-portal-item-type-spacing: 1rem}.icon{display:block;flex-grow:0;flex-shrink:0;width:var(--arcgis-portal-item-type-spacing);height:var(--arcgis-portal-item-type-spacing)}.text{color:var(--calcite-text-color-2);font-size:var(--arcgis-portal-item-type-font-size);line-height:1.25rem}.text--ellipsis{text-overflow:ellipsis;overflow:hidden;white-space:nowrap}.text--spaced{margin-inline-start:calc(var(--arcgis-portal-item-type-spacing) / 2);word-wrap:break-word;word-break:break-word}`,n=class extends d{constructor(){super(...arguments),this.messages=f({blocking:!0}),this.icon=null,this.displayName="",this.displayNameHosted="",this.scale="s"}static{this.properties={icon:16,displayName:16,displayNameHosted:16,item:0,serviceInfo:0,portal:0,user:0,scale:3,hideText:5,hideIcon:5,ellipsis:5,showHosted:5}}static{this.styles=$}async load(){this.item&&await this.getItemDisplayInformation()}async getItemDisplayInformation(){let{messages:o,user:r,serviceInfo:l,portal:e,item:t}=this,{displayName:i,displayNameHosted:c,icon:s}=await x({item:t,messages:o,serviceInfo:l,user:r,portal:e||t.portal});this.displayName=i,this.displayNameHosted=c,this.icon=s}render(){let{showHosted:o,displayNameHosted:r,scale:l,icon:e,hideText:t,hideIcon:i,ellipsis:c}=this;if(!e)return null;let s=o?r:this.displayName,v=s?.includes("(")?"":"‭",w=y(`./assets/portal-item-type/icons/${e}16.svg`),u=this.hideText?s:void 0;return a`${!i&&a`<span class="icon"><img src=${w??p} alt=${(u||"")??p} class=${`icon icon--${l}`}></span>`||""}${!t&&a`<span class=${h({text:!0,"text--spaced":!i,"text--ellipsis":c})} .innerHTML=${`${v}${s}`}></span>`||""}`}};g("arcgis-portal-item-type",n);return n},b,c)
|