@arcgis/coding-components 5.1.0-next.76 → 5.1.0-next.77
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/{F54EMO37.js → 474PQNR6.js} +1 -1
- package/dist/cdn/{3K6GLWE5.js → 7LI4SETB.js} +1 -1
- package/dist/cdn/7PBV5KWE.js +4 -0
- package/dist/cdn/{SN5W5DD6.js → 7TDRT6M4.js} +1 -1
- package/dist/cdn/{JCPZT6NO.js → C5RMYCRU.js} +1 -1
- package/dist/cdn/{4ZT5R3ZT.js → H6WXEQHZ.js} +1 -1
- package/dist/cdn/{2SBA544Y.js → HMRBLCZZ.js} +1 -1
- package/dist/cdn/{XY4DTHPO.js → JEZMMDF7.js} +1 -1
- package/dist/cdn/{EAV4BEUB.js → KAHXBJP5.js} +1 -1
- package/dist/cdn/{GTQHR2W6.js → KU55SDV6.js} +1 -1
- package/dist/cdn/{5U42AMRW.js → N33ZR5F3.js} +1 -1
- package/dist/cdn/{QDGEKNA2.js → NZHNU3M4.js} +1 -1
- package/dist/cdn/{NMDEW7DJ.js → QFO7G2EK.js} +1 -1
- package/dist/cdn/RJDP3ZT3.js +3 -0
- package/dist/cdn/{BQFM22NK.js → TW7CCUZY.js} +1 -1
- package/dist/cdn/{QLVA2JT7.js → WHAQ2FZK.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/assets/sql-layer-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/utilities.js +29 -29
- package/dist/components/arcgis-sql-layer-editor/customElement.d.ts +18 -0
- package/dist/components/arcgis-sql-layer-editor/customElement.js +55 -37
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +3 -3
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/package.json +5 -5
- package/dist/cdn/BNZD6ISN.js +0 -2
- package/dist/cdn/ZJYULKEI.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import a from"./ZHZFKZA7.js";import{a as R,b as Se,c as k,d as b,e as g}from"./IFNCCZ7O.js";import{b as De}from"./
|
|
2
|
+
import a from"./ZHZFKZA7.js";import{a as R,b as Se,c as k,d as b,e as g}from"./IFNCCZ7O.js";import{b as De}from"./7PBV5KWE.js";import{a as ve}from"./ER2MKLVA.js";import{b as P,c as M,d as $,e as we}from"./OSG5CFY4.js";import{j as ae}from"./T4G2IY4F.js";import{K as se,r as re,t as A}from"./ABFGWEVR.js";import{a as c}from"./BCUUVBXH.js";import{Qk as G,Zk as W}from"./LLPQEURF.js";export default $arcgis.t(([Ee,Ae,Le,B,{getDeclaredVoxelMembers:Ue,getDeclaredPixelMembers:Ne},qe,Oe,{A:q,B:y,F:be,H:O,I:ge,a:L,b:ne,c:oe,d:le,e:pe,k:U,l:T,m:ce,o:u,p:he,q:ue,r:x,s:N,t:m,u:de,v:fe,w:_e,y:me,z:ye}])=>{var w=s=>s!==void 0,_=s=>s!==null;function Re(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Re(e.type),serverType:e.type,nullable:e.nullable}))}}function Ce(s){return typeof s?.query=="object"&&s.query?s.query:{}}var H=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new qe("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...Ce(this._requestOptions),...Ce(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var Ge={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Fe=new Map,We={ansi:async()=>await Promise.resolve(Ge),bigquery:async()=>(await import("./FLNLMLTL.js")).bigqueryDialect,postgres:async()=>(await import("./VPP77CFW.js")).postgresDialect,sqlServer:async()=>(await import("./DGFH2WPL.js")).sqlServerDialect};async function ze(s){let e=Fe.get(s);if(e)return await e;let t=We[s]();return Fe.set(s,t),await t}var Be=["SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","BETWEEN","NULL","TRUE","FALSE","ASC","DESC"],He=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],Ke=(s,e={})=>{let t=new Set(e.baseKeywords??Be);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??He);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},D={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery"},Ie=D.postgres,je={[D.sqlServer]:"sqlServer",[D.postgres]:"postgres",[D.bigquery]:"bigquery"};function Qe(s){return je[s]}async function Je(s){return Ke(await ze(Qe(s)))}var Ze=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Xe(s){return s==="esriDBMS_PostgreSQL"?Ie:s==="esriDBMS_SQLServer"?D.sqlServer:Ie}function It(s){return s.trim().toLowerCase()}function Ye(s){return s.specialChars.identifierQuote}function et(s,e){let t=s.trim();return t?Ze.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!et(t,e))return t;let i=Ye(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function tt(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Tt(s){return s.split(".").at(-1)??s}function it(s){return Je(Xe(s))}async function rt(s,e){let t=new B({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ee(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(m(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(x(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function Te(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var st=/^[a-z_$][a-z0-9_$]*$/giu;function te(s,e=!0){return s.match(st)?`${e?".":""}${s}`:`["${s}"]`}function Ve(s,e){return s?`${s}${te(e)}`:e}function xe(s){return fe(s)?s.portalItem:null}function xt(s,e,t=!1){let i=e,r=[],n=[];return b(s).forEach(a=>{i&&(i+=`
|
|
3
3
|
|
|
4
4
|
`),i+=`**${a.name}** (${a.alias})
|
|
5
5
|
${a.type}`,a.description&&(i+=`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./KU55SDV6.js";import a from"./ZHZFKZA7.js";import{b as y,c as h,d as b}from"./OSG5CFY4.js";import{h as u}from"./T4G2IY4F.js";import{K as f}from"./ABFGWEVR.js";export default $arcgis.t(([{i:m,n:d},{l:g,o:F,p:M}])=>{var A=o=>{let t=o.variables[0],i=t?.type==="featureSet"?w(t):void 0,{apiVersion:e,bundles:a,hiddenApiItems:r}=o.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:i?[i]:[],hiddenApiItems:r?.map(s=>s.toLowerCase())}};function w(o){let{name:t}=o,i=o.getDescription(),{definition:e}=o.toProfileVariableDefinition(),a={label:t,detail:t,insertText:t,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},r={name:t,description:i,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return r;let[s,l]=g(e.fields,i);return r.properties=s,a.documentation={kind:"markdown",value:l},r}var I={id:"field-calculation",variables:[{name:"$layer",type:"featureSet",description:"The layer being calculated."}]};function P(){return I}function T(o){if(!d(o))return;let t=P();if(!t)return;let i={variables:[],hiddenApiItems:o.hiddenApiItems?.map(e=>e.toLowerCase())};return t.variables.forEach(e=>{if(o.disabledVariables?.includes(e.name))return;let a=o.definitions[e.name];if(e.type==="featureSet")return m(a)?i.variables.push({...e,type:e.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}),i}var x="arcgis-sql-expression",p=class extends M{constructor(){super(x,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=x,this._layerMap=new Map}updateFeatureLayerForModel(t,i){let e=this._getApiKey(t);this._layerMap.set(e,i)}getFeatureLayerForModel(t){let i=this._getApiKey(t);return this._layerMap.get(i)}async setProfileForModel(t,i,e={locale:"en"}){d(i)&&(i=T(i));let a=await u(e.locale,f("./assets/editor-profile/t9n"),"messages.");if(!a)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(t);let r=this._getApiKey(t),s=new F(i,a);this._modelToProfileMap.set(r,s);let l=A(s);this.updateApiContextForModel(t,{locale:e.locale,profile:l});let c=i?.variables?.find(v=>v.name==="$layer");c&&this.updateFeatureLayerForModel(t,c.definition)}},n=new p,C={setProfileForModel:n.setProfileForModel.bind(n),getApiLibraryForModel:n.getApiLibraryForModel.bind(n)};async function S(){return await import("./474PQNR6.js").then(m=>m.default)}return{a:n,b:S}},a,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import f from"./2PRSVBDA.js";import e from"./XY4DTHPO.js";import d from"./4Y64BGY2.js";import{a as L}from"./WKV7HW5R.js";import"./DTQ4CBQV.js";import c from"./GTQHR2W6.js";import a from"./ZHZFKZA7.js";import"./IFNCCZ7O.js";import"./ZJYULKEI.js";import"./ER2MKLVA.js";import"./OSG5CFY4.js";import"./T4G2IY4F.js";import"./6C52UOYL.js";import{D as C,E as D,F as I,G as r,J as B,K as k,h as w,j as s,l as $,n as b,s as y}from"./ABFGWEVR.js";import{a as R,b as o}from"./BCUUVBXH.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Rk as M}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([N,,,{a:T,h:S},l,{a:U,b:F}])=>{var z=w`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}`,O="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",a=(i,e)=>R(i,"Arcade Assistant",e),H=i=>{let{aiAssistantsEnabled:e}=i;return e===void 0?(a("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},V=i=>!(!i||!("id"in i)),G=async i=>(await N.getCredential(i,{oAuthPopupConfirmation:!1})).token,q=async i=>{try{return!!await N.checkSignInStatus(i)}catch{return a("warn","User is not signed in."),!1}};async function Q({portalUrl:i,profile:e}){if(!V(e))return a("warn","Addon initialization failed. Reason: unsupported profile."),{shouldRender:!1};let t=i.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await q(t))return{shouldRender:!1};let n=await G(i),c=`${t}/sharing/rest/portals/self?f=json&token=${n}`,p=`${t}/sharing/rest/portals/self/settings?f=json&token=${n}`,u=`${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`,g=await Promise.allSettled([fetch(c,{credentials:"include"}).then(d=>d.json()),fetch(p,{credentials:"include"}).then(d=>d.json()),fetch(u,{credentials:"include"}).then(d=>d.json())]),[_,m,f]=g,h=_.status==="fulfilled"?_.value:(a("warn",`Failed to fetch selfUrl. Reason: ${_.reason}.`),{}),x=m.status==="fulfilled"?m.value:(a("warn",`Failed to fetch settingsUrl. Reason: ${m.reason}.`),{}),j=f.status==="fulfilled"?f.value:(a("warn",`Failed to fetch signinSettingsUrl. Reason: ${f.reason}.`),{});if(h.isPortal)return{shouldRender:!1};let v=h.helpBase||"";if(!x)return a("warn","Settings response is not available."),{shouldRender:!1};let A=H(x);j.blockBetaApps===!0&&(a("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),A=!1),h?.user?.privileges?.includes("portal:user:useAIAssistants")||(a("warn","User does not have the required privileges to use AI Assistants."),A=!1);let E=h?.helperServices?.aiAssistantServices?.url;return E?{shouldRender:!0,serviceUrl:E,helpBase:v,assistantsEnabled:A,feedbackServiceUrl:O}:{shouldRender:!0,assistantsEnabled:!1,helpBase:v,feedbackServiceUrl:O}}var P=class extends I{constructor(){super(...arguments),this._codeEditorElt=C(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this.messages=L(),this._modelId=y(),this._openArcadeHelp=()=>{window.open(T,"Arcade Help")},this._toggleSidePanel=e=>{if(!e.target)return;let t=e.target?.dataset.panelName??"none";this.openedSidePanel=t===this.openedSidePanel?"none":t,this.openedSidePanel==="none"&&this._codeEditorElt.value?.setFocus().catch(o(this))},this._consoleLogs=[],this._executingScript=!1,this._preparingArcade=!1,this._resultPanel="output",this._showExecutionPanel=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.arcgisDiagnosticsChange=b({bubbles:!1}),this.arcgisScriptChange=b({bubbles:!1})}static{this.properties={_apiLibrary:16,_consoleLogs:16,_editorProfile:16,_executingScript:16,_executionResult:16,_preparingArcade:16,_resultPanel:16,_showExecutionPanel:16,_arcadeAssistantRemoteState:16,editorInstance:32,editorOptions:0,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,arcadeAssistant:0}}static{this.styles=[z]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let t=this._codeEditorElt.value?.value;return await S(e.definition,t,this.testData)}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async load(){let e=k("./assets");U(e),await this._updateDataModelDeps(),await this._updateArcadeAssistantRemoteState()}willUpdate(e){(e.has("messages")||e.has("profile"))&&this.hasUpdated&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("snippets")&&l.updateApiContextForModel(this._modelId,{snippets:this.snippets}),e.has("arcadeAssistant")&&this._updateArcadeAssistantRemoteState()}async loaded(){this._componentReadyDefer.resolve(),await this._updateApiLibrary();let e=await F();this._disposables.push(e.onDiagnosticsChange(t=>!this._preparingArcade&&this.arcgisDiagnosticsChange.emit(t.diagnostics))),this.testData&&this._addExecuteScriptAction()}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._showExecutionPanel&&this._executeScript().catch(o(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await l.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=l.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await l.getApiLibraryForModel(this._modelId)}async _executeScript(){let e=this.testData;if(!this._codeEditorElt.value||!e)return;let t=await this._editorProfilePromise;if(!t){this._executionResult={type:"error",value:"Missing editor profile",error:null};return}this._showExecutionPanel=!0,this._executingScript=!0,this._consoleLogs=[],setTimeout(()=>{(async()=>{let n=this._codeEditorElt.value?.value;this._executionResult=await S(t.definition,n,e,c=>setTimeout(()=>this._consoleLogs=[...this._consoleLogs,c],0)),this._executingScript=!1})()},0)}_toggleShowExecutionPanel(){this._showExecutionPanel=!this._showExecutionPanel}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(o(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(o(this))}_onResultPanelChange(e){let t=e.currentTarget;this._resultPanel=t.openedResultPanel}_onExecutionPanelClose(){this._showExecutionPanel=!1}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[M.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript().catch(o(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_disposeSafely(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1),e.dispose()}async _updateArcadeAssistantRemoteState(){this.arcadeAssistant&&(this._arcadeAssistantRemoteState=await Q({...this.arcadeAssistant,profile:this.profile}))}renderMainActionBar(){return this.testData?s`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript().catch(o(this))}}></calcite-action>${this._executionResult?s`<calcite-action .text=${this.messages.lastresults??""} .active=${this._showExecutionPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`:null}renderMainPanel(){return s`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${l.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${D(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:t,icon:n,active:c,panelName:p,iconFlipRtl:u=!1,onClick:g=this._toggleSidePanel}){return s`<calcite-action id=${e??$} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${n} .active=${c} @click=${g} data-panel-name=${p??$} .iconFlipRtl=${u}></calcite-action>${!this.sideActionBarExpanded&&s`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:s`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e}=this;return s`<arcgis-language-api-panel slot=side-panel class=${r(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${r(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>${this.suggestions?.length&&s`<arcgis-arcade-suggestions slot=side-panel class=${r(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${this.arcadeAssistant&&this._arcadeAssistantRemoteState.shouldRender&&s`<arcgis-arcade-coding-assistant slot=side-panel class=${r(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl"in this._arcadeAssistantRemoteState?this._arcadeAssistantRemoteState.serviceUrl:void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant.disableQuestionAnswerLogging}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(t=>s`<calcite-flow slot=side-panel class=${r(e===t.id?"":"hidden")}>${t?.useFlows?t.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==t.id,editorRef:this.el}):s`<calcite-flow-item .heading=${t.name} heading-level=2 closable .closed=${e!==t.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${t.description}>${t.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==t.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){return this._showExecutionPanel?s`<arcgis-arcade-results slot=results-panel .openedResultPanel=${this._resultPanel} .loading=${this._executingScript} .result=${this._executionResult} .consoleLogs=${this._consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`:null}render(){return s`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};B("arcgis-arcade-editor",P);return P},"identity/IdentityManager",a,c,d,e,f)
|
|
2
|
+
import f from"./2PRSVBDA.js";import e from"./JEZMMDF7.js";import d from"./4Y64BGY2.js";import{a as L}from"./WKV7HW5R.js";import"./DTQ4CBQV.js";import c from"./KU55SDV6.js";import a from"./ZHZFKZA7.js";import"./IFNCCZ7O.js";import"./7PBV5KWE.js";import"./ER2MKLVA.js";import"./OSG5CFY4.js";import"./T4G2IY4F.js";import"./6C52UOYL.js";import{D as C,E as D,F as I,G as r,J as B,K as k,h as w,j as s,l as $,n as b,s as y}from"./ABFGWEVR.js";import{a as R,b as o}from"./BCUUVBXH.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import{Rk as M}from"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([N,,,{a:T,h:S},l,{a:U,b:F}])=>{var z=w`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}`,O="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",a=(i,e)=>R(i,"Arcade Assistant",e),H=i=>{let{aiAssistantsEnabled:e}=i;return e===void 0?(a("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},V=i=>!(!i||!("id"in i)),G=async i=>(await N.getCredential(i,{oAuthPopupConfirmation:!1})).token,q=async i=>{try{return!!await N.checkSignInStatus(i)}catch{return a("warn","User is not signed in."),!1}};async function Q({portalUrl:i,profile:e}){if(!V(e))return a("warn","Addon initialization failed. Reason: unsupported profile."),{shouldRender:!1};let t=i.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await q(t))return{shouldRender:!1};let n=await G(i),c=`${t}/sharing/rest/portals/self?f=json&token=${n}`,p=`${t}/sharing/rest/portals/self/settings?f=json&token=${n}`,u=`${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`,g=await Promise.allSettled([fetch(c,{credentials:"include"}).then(d=>d.json()),fetch(p,{credentials:"include"}).then(d=>d.json()),fetch(u,{credentials:"include"}).then(d=>d.json())]),[_,m,f]=g,h=_.status==="fulfilled"?_.value:(a("warn",`Failed to fetch selfUrl. Reason: ${_.reason}.`),{}),x=m.status==="fulfilled"?m.value:(a("warn",`Failed to fetch settingsUrl. Reason: ${m.reason}.`),{}),j=f.status==="fulfilled"?f.value:(a("warn",`Failed to fetch signinSettingsUrl. Reason: ${f.reason}.`),{});if(h.isPortal)return{shouldRender:!1};let v=h.helpBase||"";if(!x)return a("warn","Settings response is not available."),{shouldRender:!1};let A=H(x);j.blockBetaApps===!0&&(a("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),A=!1),h?.user?.privileges?.includes("portal:user:useAIAssistants")||(a("warn","User does not have the required privileges to use AI Assistants."),A=!1);let E=h?.helperServices?.aiAssistantServices?.url;return E?{shouldRender:!0,serviceUrl:E,helpBase:v,assistantsEnabled:A,feedbackServiceUrl:O}:{shouldRender:!0,assistantsEnabled:!1,helpBase:v,feedbackServiceUrl:O}}var P=class extends I{constructor(){super(...arguments),this._codeEditorElt=C(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this.messages=L(),this._modelId=y(),this._openArcadeHelp=()=>{window.open(T,"Arcade Help")},this._toggleSidePanel=e=>{if(!e.target)return;let t=e.target?.dataset.panelName??"none";this.openedSidePanel=t===this.openedSidePanel?"none":t,this.openedSidePanel==="none"&&this._codeEditorElt.value?.setFocus().catch(o(this))},this._consoleLogs=[],this._executingScript=!1,this._preparingArcade=!1,this._resultPanel="output",this._showExecutionPanel=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.arcgisDiagnosticsChange=b({bubbles:!1}),this.arcgisScriptChange=b({bubbles:!1})}static{this.properties={_apiLibrary:16,_consoleLogs:16,_editorProfile:16,_executingScript:16,_executionResult:16,_preparingArcade:16,_resultPanel:16,_showExecutionPanel:16,_arcadeAssistantRemoteState:16,editorInstance:32,editorOptions:0,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,arcadeAssistant:0}}static{this.styles=[z]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let t=this._codeEditorElt.value?.value;return await S(e.definition,t,this.testData)}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async load(){let e=k("./assets");U(e),await this._updateDataModelDeps(),await this._updateArcadeAssistantRemoteState()}willUpdate(e){(e.has("messages")||e.has("profile"))&&this.hasUpdated&&this._updateDataModelDeps(),e.has("testData")&&this._testDataChanged(),e.has("snippets")&&l.updateApiContextForModel(this._modelId,{snippets:this.snippets}),e.has("arcadeAssistant")&&this._updateArcadeAssistantRemoteState()}async loaded(){this._componentReadyDefer.resolve(),await this._updateApiLibrary();let e=await F();this._disposables.push(e.onDiagnosticsChange(t=>!this._preparingArcade&&this.arcgisDiagnosticsChange.emit(t.diagnostics))),this.testData&&this._addExecuteScriptAction()}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}_testDataChanged(){!this.testData&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this.testData&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._showExecutionPanel&&this._executeScript().catch(o(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await l.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=l.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await l.getApiLibraryForModel(this._modelId)}async _executeScript(){let e=this.testData;if(!this._codeEditorElt.value||!e)return;let t=await this._editorProfilePromise;if(!t){this._executionResult={type:"error",value:"Missing editor profile",error:null};return}this._showExecutionPanel=!0,this._executingScript=!0,this._consoleLogs=[],setTimeout(()=>{(async()=>{let n=this._codeEditorElt.value?.value;this._executionResult=await S(t.definition,n,e,c=>setTimeout(()=>this._consoleLogs=[...this._consoleLogs,c],0)),this._executingScript=!1})()},0)}_toggleShowExecutionPanel(){this._showExecutionPanel=!this._showExecutionPanel}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(o(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(o(this))}_onResultPanelChange(e){let t=e.currentTarget;this._resultPanel=t.openedResultPanel}_onExecutionPanelClose(){this._showExecutionPanel=!1}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[M.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this.testData&&this._executeScript().catch(o(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_disposeSafely(e){let t=this._disposables.indexOf(e);t!==-1&&this._disposables.splice(t,1),e.dispose()}async _updateArcadeAssistantRemoteState(){this.arcadeAssistant&&(this._arcadeAssistantRemoteState=await Q({...this.arcadeAssistant,profile:this.profile}))}renderMainActionBar(){return this.testData?s`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${()=>{this._executeScript().catch(o(this))}}></calcite-action>${this._executionResult?s`<calcite-action .text=${this.messages.lastresults??""} .active=${this._showExecutionPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`:null}renderMainPanel(){return s`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${l.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${D(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:t,icon:n,active:c,panelName:p,iconFlipRtl:u=!1,onClick:g=this._toggleSidePanel}){return s`<calcite-action id=${e??$} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${n} .active=${c} @click=${g} data-panel-name=${p??$} .iconFlipRtl=${u}></calcite-action>${!this.sideActionBarExpanded&&s`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:s`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e}=this;return s`<arcgis-language-api-panel slot=side-panel class=${r(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${r(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>${this.suggestions?.length&&s`<arcgis-arcade-suggestions slot=side-panel class=${r(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${this.arcadeAssistant&&this._arcadeAssistantRemoteState.shouldRender&&s`<arcgis-arcade-coding-assistant slot=side-panel class=${r(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl"in this._arcadeAssistantRemoteState?this._arcadeAssistantRemoteState.serviceUrl:void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant.disableQuestionAnswerLogging}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(t=>s`<calcite-flow slot=side-panel class=${r(e===t.id?"":"hidden")}>${t?.useFlows?t.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==t.id,editorRef:this.el}):s`<calcite-flow-item .heading=${t.name} heading-level=2 closable .closed=${e!==t.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${t.description}>${t.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==t.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){return this._showExecutionPanel?s`<arcgis-arcade-results slot=results-panel .openedResultPanel=${this._resultPanel} .loading=${this._executingScript} .result=${this._executionResult} .consoleLogs=${this._consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`:null}render(){return s`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};B("arcgis-arcade-editor",P);return P},"identity/IdentityManager",a,c,d,e,f)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{a as _}from"./WKV7HW5R.js";import"./DTQ4CBQV.js";import j from"./
|
|
2
|
+
import{a as _}from"./WKV7HW5R.js";import"./DTQ4CBQV.js";import j from"./7LI4SETB.js";import i from"./N33ZR5F3.js";import f from"./KU55SDV6.js";import b from"./ZHZFKZA7.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import"./7PBV5KWE.js";import"./ER2MKLVA.js";import"./OSG5CFY4.js";import"./T4G2IY4F.js";import"./6C52UOYL.js";import{D as l,E as h,F as p,G as r,J as g,h as c,j as e,n as o,s as d}from"./ABFGWEVR.js";import{b as a}from"./BCUUVBXH.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,{a:s},{b:m}])=>{var f=c`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends p{constructor(){super(...arguments),this._codeEditorElt=l(),this._disposables=[],this.messages=_(),this._modelId=d(),this._preparing=!1,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.arcgisDiagnosticsChange=o({bubbles:!1}),this.arcgisScriptChange=o({bubbles:!1})}static{this.properties={_activeAction:16,_apiLibrary:16,_editorProfile:16,_preparing:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0}}static{this.styles=[f]}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateEditorProfile().catch(a(this))}willUpdate(i){(i.has("messages")||i.has("profile"))&&this._updateDataModelDeps()}async loaded(){let i=await m();this._disposables.push(i.onDiagnosticsChange(t=>!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _updateEditorProfile(){this._preparing=!0;try{await s.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=s.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._preparing=!1}}_setActiveAction(i){if(this._activeAction===i){this._activeAction=void 0;return}this._activeAction=i}_handleActionClick(i){let t=i.target;this._setActiveAction(t.dataset.panelName)}_insertAsSnippet(i){this._codeEditorElt.value?.insertSnippet(i.detail).catch(a(this))}_insertAsText(i){this._codeEditorElt.value?.insertText(i.detail.replaceAll('"',"'")).catch(a(this))}async _updateApiLibrary(){this._apiLibrary=await s.getApiLibraryForModel(this._modelId)}_onCodeEditorValueChange(i){i.stopPropagation(),this.script=i.detail,this.arcgisScriptChange.emit(i.detail)}_getFeatureSetVariable(){let i,t=s.getEditorProfileForModel(this._modelId);return t?.variables?.length&&t?.variables?.[0]?.type!=="featureSet"?a(this)("Encountered unexpected editor profile"):i=t?.variables?.[0],i}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}render(){let i=this._getFeatureSetVariable();return e`<arcgis-code-editor-shell><arcgis-code-editor slot=editor language=arcgis-sql-expression .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} ${h(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&i&&e`<arcgis-editor-variables slot=side-panel .variable=${i} .closed=${this._activeAction!=="fields"} class=${r(this._activeAction==="fields"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} data-panel-name=none .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>`||""}${!this.hideSideBar&&e`<arcgis-language-api-panel slot=side-panel class=${r(this._activeAction==="functions"?"":"hidden")} .closed=${this._activeAction!=="functions"} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} .loading=${this._preparing} .apiLibrary=${this._apiLibrary} data-panel-name=none hide-documentation-actions .languageId=${s.languageId}></arcgis-language-api-panel>`||""}${!this.hideSideBar&&e`<calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}>${i&&e`<calcite-action id=fields-action .text=${this.messages.fields??"Fields"} icon=profile-variables .active=${this._activeAction==="fields"} data-panel-name=fields @click=${this._handleActionClick}></calcite-action>`||""}${i&&!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=fields-action><span>${this.messages.fields??"Fields"}</span></calcite-tooltip>`||""}<calcite-action id=functions-action .text=${this.messages.functions??"Functions"} icon=function .active=${this._activeAction==="functions"} data-panel-name=functions @click=${this._handleActionClick}></calcite-action>${!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=functions-action><span>${this.messages.functions??"Functions"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};g("arcgis-sql-expression-editor",n);return n},b,f,i,j)
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
+
import{b as I}from"./JHVMGSI2.js";import e from"./WHAQ2FZK.js";import{a as u}from"./WKV7HW5R.js";import"./DTQ4CBQV.js";import d from"./KU55SDV6.js";import c from"./ZHZFKZA7.js";import"./MP6Z45SA.js";import"./IFNCCZ7O.js";import{c as E}from"./7PBV5KWE.js";import"./ER2MKLVA.js";import"./OSG5CFY4.js";import"./T4G2IY4F.js";import"./6C52UOYL.js";import{D as g,E as m,F as _,G as b,J as f,h as p,j as o,n as r,s as h}from"./ABFGWEVR.js";import{b as a}from"./BCUUVBXH.js";import"./B3UMUBOI.js";import"./CF3TERM3.js";import"./Z5ZZ36DQ.js";import"./LLPQEURF.js";import"./3TTFCHAA.js";export default $arcgis.t(([,,,,,,,{E:l},{c:d},{a:S,b:v,c:$,d:y}])=>{var x=p`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends _{constructor(){super(...arguments),this._codeEditorElt=g(),this._disposables=[],this._modelId=h(),this.messages=u(),this._preparing=!1,this._resolvedLanguage=d,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=r({bubbles:!1}),this.arcgisScriptChange=r({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3,editorOptions:0,editorInstance:32}}static{this.styles=[x]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(a(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(a(this))}async loaded(){let e=I();this._disposables.push(e.onDiagnosticsChange(t=>{t.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();y().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await S(this.profile);e!==this._resolvedLanguage&&($(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let t=v(this._resolvedLanguage);await t.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=t.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=d}finally{this._preparing=!1}}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_toggleSidePanel(e){this.openedSidePanel=this.openedSidePanel===e?"none":e,this.openedSidePanel==="none"&&this._codeEditorElt.value?.setFocus().catch(a(this))}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}async _onItemSelected(e){e.stopPropagation();let t=this._getSelectedTableVariable(e.detail);if(!t){this._codeEditorElt.value?.insertText(e.detail).catch(a(this));return}await t.loadSource();let i,c=t.fieldInfos.filter(s=>s.type==="geometry"&&!i?(i=s.name,!0):s.type!=="geometry").map(s=>s.name).filter(Boolean),P=`select ${c.length?c.join(", "):"*"} from ${t.snippet};`;E(this._codeEditorElt.value?.editorInstance,P,"replace","")}_getTablesVariable(){return this._editorProfile?.variables.find(l)}_getSelectedTableVariable(e){let t=this._getTablesVariable();if(l(t))return t.tableVariables.find(i=>i.snippet===e)}render(){let e=this._getTablesVariable(),t=String(this.messages.placeholderexample??"Example: {sqlQueryExample}").replace("{sqlQueryExample}","select field1, field2 from db.dataset;"),i=`${this.messages.placeholder??"Start filtering data using SQL query syntax"}
|
|
3
|
+
${t}`;return o`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{placeholder:i,...this.editorOptions}} ${m(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&o`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables??"Tables"} .messageOverrides=${{profileempty:this.messages.profileempty}} .closed=${this.openedSidePanel!=="variables"} class=${b(this.openedSidePanel==="variables"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @arcgisInternalClosePanel=${()=>{this.openedSidePanel="none"}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables??"Tables"} icon=table .active=${this.openedSidePanel==="variables"} data-panel-name=variables @click=${()=>this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded&&o`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables??"Tables"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};f("arcgis-sql-layer-editor",n);return n},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",c,d,e)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import c from"./2PRSVBDA.js";import b from"./
|
|
2
|
+
import c from"./2PRSVBDA.js";import b from"./JEZMMDF7.js";import{a as m}from"./HPZZVB4X.js";import a from"./N33ZR5F3.js";import{a as t}from"./ER2MKLVA.js";import{Zk as d,al as n}from"./LLPQEURF.js";export default $arcgis.t(([{a:s,b:p},a,{c:c}])=>{var k=["arcade","arcgis-sql-expression","sql-layer-sql-server","sql-layer-postgres","sql-layer-bigquery"],i=new Set,u=new Map;function l(e){let r=u.get(e);return r||(r=Promise.withResolvers(),u.set(e,r)),r}function f(e){l(e).resolve()}function T(e){return k.includes(e)?l(e).promise:Promise.resolve()}function h(e,r){return()=>{i.has(e)||i.add(e),r()}}async function U(e){i.has(e)||(await t()).createModel("",e,d.parse("")).dispose()}n.register({id:a.languageId,aliases:["Arcade","arcade"],extensions:[".arc"],mimetypes:["application/arcade"]});n.onLanguage(a.languageId,h(a.languageId,()=>{c().then(e=>{e.setupMode(a),f(a.languageId)}).catch(e=>{throw e})}));n.register({id:s.languageId,aliases:["EsiSqlExpression","sql-expression"],extensions:[".sql-expression"],mimetypes:["application/sql-expression"]});n.onLanguage(s.languageId,h(s.languageId,()=>{p().then(e=>{e.setupMode(s),f(s.languageId)}).catch(e=>{throw e})}));q();function q(){t().then(e=>{["light","dark"].forEach(r=>{let g=r==="light"?"vs":"vs-dark",o=m[`${r}-theme`];e.defineTheme(g,{base:g,inherit:!0,rules:[{token:"comment.arcgis",foreground:o.comment},{token:"constant.arcgis",foreground:o.constant},{token:"keyword.arcgis",foreground:o.keyword},{token:"identifier.arcgis",foreground:o.identifier},{token:"number.arcgis",foreground:o.number},{token:"string.arcgis",foreground:o.string},{token:"operator.arcgis",foreground:o.operator},{token:"predefined.arcgis",foreground:o.predefined},{token:"date.arcgis",foreground:o.date}],colors:{}})})})}return{a:f,b:T,c:h,d:U}},a,b,c)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./KU55SDV6.js";import a from"./ZHZFKZA7.js";import{h as P}from"./T4G2IY4F.js";import{K as I}from"./ABFGWEVR.js";export default $arcgis.t(([N,{B:S},{a:q,d:F,e:T,f:g,g:h,h:C,i:$,j:x,n:L,o:_,p:D}])=>{function b(t){for(let e of t){if(e instanceof L)return e;if(e.isCollection&&"variables"in e){let n=b(e.variables.filter(a=>a.type!=="group"));if(n)return n}}}function A(t,e){return`${t}:${e}`}function V(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function B(t){let e=new N({url:t.portal.url});return await e.load(),new q({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function E(t){return S(t)?await B(t):t}function K(t,e,n){let a=`**${t}**`;return e.type&&(a+=`
|
|
3
3
|
${e.type}`),n&&(a+=`
|
|
4
4
|
Datastore: ${n}`),{value:a}}function z(t,e){let n=`**${t.name}**`;return t.serverType&&(n+=`
|
|
5
5
|
${t.serverType}`),n+=`
|
|
@@ -18248,7 +18248,7 @@ function se(t, e, r, n) {
|
|
|
18248
18248
|
const cr = { apiKey: void 0, apiKeys: { scopes: [] }, applicationName: "", applicationUrl: globalThis.location?.href, assetsPath: "", fontsUrl: "https://static.arcgis.com/fonts", geometryServiceUrl: "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer", geoRSSServiceUrl: "https://utility.arcgis.com/sharing/rss", kmlServiceUrl: "https://utility.arcgis.com/sharing/kml", userPrivilegesApplied: !0, portalUrl: "https://www.arcgis.com", respectPrefersReducedMotion: !0, routeServiceUrl: "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World", workers: { loaderConfig: { has: {}, paths: {}, map: {}, packages: [] } }, request: { crossOriginNoCorsDomains: null, httpsDomains: ["arcgis.com", "arcgisonline.com", "esrikr.com", "premiumservices.blackbridge.com", "esripremium.accuweather.com", "gbm.digitalglobe.com", "firstlook.digitalglobe.com", "msi.digitalglobe.com"], interceptors: [], internalInterceptors: [], maxUrlLength: 2e3, priority: "high", proxyRules: [], proxyUrl: null, timeout: 62e3, trustedServers: [], useIdentity: !0 }, log: { interceptors: [], level: null } };
|
|
18249
18249
|
if (globalThis.esriConfig && (H4(cr, globalThis.esriConfig, !0), delete cr.has), !cr.assetsPath) {
|
|
18250
18250
|
{
|
|
18251
|
-
const t = "5.1.0-next.
|
|
18251
|
+
const t = "5.1.0-next.73";
|
|
18252
18252
|
cr.assetsPath = `https://cdn.jsdelivr.net/npm/@arcgis/core@${t}/assets`;
|
|
18253
18253
|
}
|
|
18254
18254
|
cr.defaultAssetsPath = cr.assetsPath;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"loading":"Loading","profileempty":"No datastore tables available.","tables":"Tables"}
|
|
1
|
+
{"loading":"Loading","profileempty":"No datastore tables available.","tables":"Tables","placeholder":"Start filtering data using SQL query syntax","placeholderexample":"Example: {sqlQueryExample}"}
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{I as s,u as e}from"./ABFGWEVR.js";import"./BCUUVBXH.js";import"./3TTFCHAA.js";var i=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./
|
|
2
|
+
import{I as s,u as e}from"./ABFGWEVR.js";import"./BCUUVBXH.js";import"./3TTFCHAA.js";var i=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./HMRBLCZZ.js"),"appVersion,assistantsEnabled,closed,closePanel:,disableQuestionAnswerLogging,editorRef:,feedbackServiceUrl,helpBase,insertText:,portalUrl,serviceUrl;destroy"],"arcgis-arcade-editor":[()=>import("./NZHNU3M4.js"),"arcadeAssistant:,customPanels:,editorInstance:,editorOptions:,hideDocumentationActions,hideSideBar,messageOverrides:,messages:,openedSidePanel,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getTestResult,setFocus"],"arcgis-arcade-results":[()=>import("./KJLCPXUD.js"),"calciteModeDark,consoleLogs:,loading,openedResultPanel,result:"],"arcgis-arcade-suggestions":[()=>import("./7TDRT6M4.js"),"closed,suggestions:"],"arcgis-code-editor":[()=>import("./KAHXBJP5.js"),"editorInstance:,editorOptions:,language,modelId,value;insertSnippet,insertText,setFocus"],"arcgis-code-editor-shell":[()=>import("./M2TDIEV3.js")],"arcgis-code-viewer":[()=>import("./H6WXEQHZ.js"),"language,round"],"arcgis-editor-variables":[()=>import("./2BX4WBIK.js"),"closed,heading,loading,messageOverrides:,modelId,variable:"],"arcgis-language-api-panel":[()=>import("./C5RMYCRU.js"),"apiLibrary:,closed,hideDocumentationActions,languageId,loading"],"arcgis-sql-expression-editor":[()=>import("./QFO7G2EK.js"),"hideSideBar,messageOverrides:,messages:,profile:,script;setFocus"],"arcgis-sql-layer-editor":[()=>import("./RJDP3ZT3.js"),"editorInstance:,editorOptions:,hideSideBar,messageOverrides:,messages:,openedSidePanel,profile:,script;setFocus"]});i({resourcesUrl:import.meta.url});var r=new CSSStyleSheet;r.replaceSync("@layer{:not([hydrated]):is(arcgis-arcade-editor,arcgis-code-editor,arcgis-code-editor-shell,arcgis-code-viewer,arcgis-sql-expression-editor,arcgis-sql-layer-editor){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,r];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,s)
|
package/dist/chunks/utilities.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { createFilterExpression as d } from "@arcgis/toolkit/string";
|
|
3
3
|
import { format as f } from "@arcgis/arcade-languageservice";
|
|
4
|
-
function b(e,
|
|
5
|
-
if (!
|
|
4
|
+
function b(e, n, i, o) {
|
|
5
|
+
if (!n)
|
|
6
6
|
return [];
|
|
7
|
-
const t = Array.isArray(
|
|
7
|
+
const t = Array.isArray(n) ? n : [n];
|
|
8
8
|
if (!t.length)
|
|
9
9
|
return [];
|
|
10
|
-
const m = d(
|
|
11
|
-
return e.filter((
|
|
10
|
+
const m = d(i);
|
|
11
|
+
return e.filter((u) => t.some((a) => m.test(String(u[a] ?? ""))));
|
|
12
12
|
}
|
|
13
13
|
function L(e) {
|
|
14
14
|
return e ? `${e.portal.url}/home/item.html?id=${e.id}` : "";
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function N(e, n, i = "add", o) {
|
|
17
17
|
if (!e)
|
|
18
18
|
return;
|
|
19
19
|
const t = e.getSelection(), m = t && (t.startLineNumber !== t.endLineNumber || t.startColumn !== t.endColumn);
|
|
20
|
-
let
|
|
20
|
+
let u = [];
|
|
21
21
|
const a = e.getValue() ?? "";
|
|
22
|
-
if (
|
|
23
|
-
const l = `${
|
|
24
|
-
${
|
|
25
|
-
|
|
22
|
+
if (i === "replace") {
|
|
23
|
+
const l = o ? `${o}
|
|
24
|
+
${n}` : n, s = e.getModel(), r = s?.getLineCount() ?? 1, c = s?.getLineMaxColumn(r) ?? 1;
|
|
25
|
+
u = [
|
|
26
26
|
{
|
|
27
27
|
range: {
|
|
28
28
|
startLineNumber: 1,
|
|
29
29
|
startColumn: 1,
|
|
30
|
-
endLineNumber:
|
|
30
|
+
endLineNumber: r,
|
|
31
31
|
endColumn: c
|
|
32
32
|
},
|
|
33
33
|
text: l
|
|
@@ -40,40 +40,40 @@ ${r}`, i = e.getModel(), n = i?.getLineCount() ?? 1, c = i?.getLineMaxColumn(n)
|
|
|
40
40
|
endLineNumber: t.endLineNumber,
|
|
41
41
|
endColumn: t.endColumn
|
|
42
42
|
} : (() => {
|
|
43
|
-
const
|
|
43
|
+
const r = e.getPosition();
|
|
44
44
|
return {
|
|
45
|
-
startLineNumber:
|
|
46
|
-
startColumn:
|
|
47
|
-
endLineNumber:
|
|
48
|
-
endColumn:
|
|
45
|
+
startLineNumber: r?.lineNumber ?? 1,
|
|
46
|
+
startColumn: r?.column ?? 1,
|
|
47
|
+
endLineNumber: r?.lineNumber ?? 1,
|
|
48
|
+
endColumn: r?.column ?? 1
|
|
49
49
|
};
|
|
50
50
|
})();
|
|
51
|
-
let
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
|
|
51
|
+
let s = !1;
|
|
52
|
+
if (o) {
|
|
53
|
+
const r = o.replace(/[.*+?^${}()|[\]\\]/gu, "\\$&");
|
|
54
|
+
s = !new RegExp(`^\\s*${r}\\s*$`, "mu").test(a);
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
s && u.push({
|
|
57
57
|
range: {
|
|
58
58
|
startLineNumber: 1,
|
|
59
59
|
startColumn: 1,
|
|
60
60
|
endLineNumber: 1,
|
|
61
61
|
endColumn: 1
|
|
62
62
|
},
|
|
63
|
-
text: `${
|
|
63
|
+
text: `${o}
|
|
64
64
|
`
|
|
65
|
-
}),
|
|
65
|
+
}), u.push({
|
|
66
66
|
range: l,
|
|
67
|
-
text:
|
|
67
|
+
text: n
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
70
|
try {
|
|
71
|
-
e.pushUndoStop(), e.executeEdits("insertText",
|
|
71
|
+
e.pushUndoStop(), e.executeEdits("insertText", u), e.pushUndoStop(), e.focus();
|
|
72
72
|
} catch (l) {
|
|
73
73
|
console.error("Failed to edit model:", l);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function x(e) {
|
|
77
77
|
try {
|
|
78
78
|
return f(e);
|
|
79
79
|
} catch {
|
|
@@ -81,8 +81,8 @@ function N(e) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
export {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
x as a,
|
|
85
|
+
N as e,
|
|
86
86
|
b as f,
|
|
87
87
|
L as p
|
|
88
88
|
};
|
|
@@ -13,6 +13,18 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
15
15
|
export abstract class ArcgisSqlLayerEditor extends LitElement {
|
|
16
|
+
/**
|
|
17
|
+
* Options to update on the editor.
|
|
18
|
+
* For example:
|
|
19
|
+
* ```json
|
|
20
|
+
* {
|
|
21
|
+
* "fontSize": 18
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* To get the full list of available options, see the Monaco Editor options [documentation](https://microsoft.github.io/monaco-editor/docs.html#interfaces/editor_editor_api.editor.IEditorOptions.html) for more details.
|
|
26
|
+
*/
|
|
27
|
+
accessor editorOptions: editor.IEditorOptions & editor.IGlobalEditorOptions | undefined;
|
|
16
28
|
/** @default false */
|
|
17
29
|
accessor hideSideBar: boolean;
|
|
18
30
|
/**
|
|
@@ -24,16 +36,22 @@ export abstract class ArcgisSqlLayerEditor extends LitElement {
|
|
|
24
36
|
loading?: string | undefined;
|
|
25
37
|
profileempty?: string | undefined;
|
|
26
38
|
tables?: string | undefined;
|
|
39
|
+
placeholder?: string | undefined;
|
|
40
|
+
placeholderexample?: string | undefined;
|
|
27
41
|
};
|
|
28
42
|
/** @internal */
|
|
29
43
|
protected messages: Partial<{
|
|
30
44
|
loading: string;
|
|
31
45
|
profileempty: string;
|
|
32
46
|
tables: string;
|
|
47
|
+
placeholder: string;
|
|
48
|
+
placeholderexample: string;
|
|
33
49
|
}> & T9nMeta<{
|
|
34
50
|
loading: string;
|
|
35
51
|
profileempty: string;
|
|
36
52
|
tables: string;
|
|
53
|
+
placeholder: string;
|
|
54
|
+
placeholderexample: string;
|
|
37
55
|
}>;
|
|
38
56
|
/** @default "none" */
|
|
39
57
|
accessor openedSidePanel: SidePanelName;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import { LitElement as
|
|
5
|
-
import { generateGuid as
|
|
6
|
-
import { u as
|
|
7
|
-
import { createRef as
|
|
8
|
-
import { k as
|
|
9
|
-
import "
|
|
2
|
+
import { c as p } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as h, html as r } from "lit";
|
|
4
|
+
import { LitElement as g, createEvent as l, safeClassMap as m } from "@arcgis/lumina";
|
|
5
|
+
import { generateGuid as u } from "@arcgis/toolkit/string";
|
|
6
|
+
import { u as f } from "../../chunks/useT9n.js";
|
|
7
|
+
import { createRef as _, ref as b } from "lit/directives/ref.js";
|
|
8
|
+
import { k as d } from "../../chunks/utils.js";
|
|
9
|
+
import { e as E } from "../../chunks/utilities.js";
|
|
10
10
|
import "@arcgis/core/portal/PortalItem.js";
|
|
11
11
|
import "@arcgis/core/WebMap.js";
|
|
12
12
|
import "@arcgis/core/WebScene.js";
|
|
@@ -14,52 +14,55 @@ import "@arcgis/core/layers/FeatureLayer.js";
|
|
|
14
14
|
import "@arcgis/core/applications/Components/arcadeEditorUtils.js";
|
|
15
15
|
import "@arcgis/toolkit/predicate";
|
|
16
16
|
import "vscode-languageserver-types";
|
|
17
|
-
import { rethrowError as
|
|
17
|
+
import { rethrowError as o } from "@arcgis/toolkit/log";
|
|
18
18
|
import "@arcgis/core/core/Error.js";
|
|
19
|
-
import { d as
|
|
19
|
+
import { d as n } from "../../chunks/language-defaults-base.js";
|
|
20
20
|
import "@arcgis/core/portal/Portal.js";
|
|
21
|
-
import { g as
|
|
22
|
-
import { getSqlLayerDiagnosticService as
|
|
23
|
-
const
|
|
24
|
-
class
|
|
21
|
+
import { g as S, a as v, b as y, c as $ } from "../../chunks/sql-layer-defaults.js";
|
|
22
|
+
import { getSqlLayerDiagnosticService as x } from "../../chunks/sql-layer-mode.js";
|
|
23
|
+
const I = h`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`;
|
|
24
|
+
class L extends g {
|
|
25
25
|
constructor() {
|
|
26
|
-
super(...arguments), this._codeEditorElt =
|
|
26
|
+
super(...arguments), this._codeEditorElt = _(), this._disposables = [], this._modelId = u(), this.messages = f(), this._preparing = !1, this._resolvedLanguage = n, this.sideActionBarExpanded = !1, this.script = "", this.hideSideBar = !1, this.openedSidePanel = "none", this.arcgisDiagnosticsChange = l({ bubbles: !1 }), this.arcgisScriptChange = l({ bubbles: !1 });
|
|
27
27
|
}
|
|
28
28
|
static {
|
|
29
|
-
this.properties = { _editorProfile: 16, _preparing: 16, _resolvedLanguage: 16, sideActionBarExpanded: 16, profile: 0, script: 1, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3 };
|
|
29
|
+
this.properties = { _editorProfile: 16, _preparing: 16, _resolvedLanguage: 16, sideActionBarExpanded: 16, profile: 0, script: 1, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3, editorOptions: 0, editorInstance: 32 };
|
|
30
30
|
}
|
|
31
31
|
static {
|
|
32
|
-
this.styles = [
|
|
32
|
+
this.styles = [I];
|
|
33
|
+
}
|
|
34
|
+
get editorInstance() {
|
|
35
|
+
return this._codeEditorElt.value?.editorInstance;
|
|
33
36
|
}
|
|
34
37
|
async setFocus() {
|
|
35
38
|
await this._codeEditorElt.value?.setFocus();
|
|
36
39
|
}
|
|
37
40
|
async load() {
|
|
38
|
-
await this._updateDataModelDeps().catch(
|
|
41
|
+
await this._updateDataModelDeps().catch(o(this));
|
|
39
42
|
}
|
|
40
43
|
willUpdate(e) {
|
|
41
|
-
e.has("profile") && this._updateDataModelDeps().catch(
|
|
44
|
+
e.has("profile") && this._updateDataModelDeps().catch(o(this));
|
|
42
45
|
}
|
|
43
46
|
async loaded() {
|
|
44
|
-
const e =
|
|
45
|
-
this._disposables.push(e.onDiagnosticsChange((
|
|
46
|
-
|
|
47
|
+
const e = x();
|
|
48
|
+
this._disposables.push(e.onDiagnosticsChange((t) => {
|
|
49
|
+
t.uri.toString() === this._modelId && !this._preparing && this.arcgisDiagnosticsChange.emit(t.diagnostics);
|
|
47
50
|
}));
|
|
48
51
|
}
|
|
49
52
|
disconnectedCallback() {
|
|
50
53
|
for (super.disconnectedCallback(); this._disposables.length; )
|
|
51
54
|
this._disposables.pop()?.dispose();
|
|
52
|
-
|
|
55
|
+
S().forEach((e) => e.disposeForModel(this._modelId));
|
|
53
56
|
}
|
|
54
57
|
async _updateDataModelDeps() {
|
|
55
58
|
this._preparing = !0;
|
|
56
59
|
try {
|
|
57
|
-
const e = await
|
|
58
|
-
e !== this._resolvedLanguage && (
|
|
59
|
-
const
|
|
60
|
-
await
|
|
60
|
+
const e = await v(this.profile);
|
|
61
|
+
e !== this._resolvedLanguage && (y(this._resolvedLanguage)?.disposeForModel(this._modelId), this._resolvedLanguage = e);
|
|
62
|
+
const t = $(this._resolvedLanguage);
|
|
63
|
+
await t.setProfileForModel(this._modelId, this.profile, { locale: this.messages._t9nLocale }), this._editorProfile = t.getEditorProfileForModel(this._modelId);
|
|
61
64
|
} catch {
|
|
62
|
-
this._editorProfile = void 0, this._resolvedLanguage =
|
|
65
|
+
this._editorProfile = void 0, this._resolvedLanguage = n;
|
|
63
66
|
} finally {
|
|
64
67
|
this._preparing = !1;
|
|
65
68
|
}
|
|
@@ -68,25 +71,40 @@ class E extends d {
|
|
|
68
71
|
this.sideActionBarExpanded = !this.sideActionBarExpanded;
|
|
69
72
|
}
|
|
70
73
|
_toggleSidePanel(e) {
|
|
71
|
-
this.openedSidePanel = this.openedSidePanel === e ? "none" : e, this.openedSidePanel === "none" && this._codeEditorElt.value?.setFocus().catch(
|
|
74
|
+
this.openedSidePanel = this.openedSidePanel === e ? "none" : e, this.openedSidePanel === "none" && this._codeEditorElt.value?.setFocus().catch(o(this));
|
|
72
75
|
}
|
|
73
76
|
_onCodeEditorValueChange(e) {
|
|
74
77
|
e.stopPropagation(), this.script = e.detail, this.arcgisScriptChange.emit(e.detail);
|
|
75
78
|
}
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
async _onItemSelected(e) {
|
|
80
|
+
e.stopPropagation();
|
|
81
|
+
const t = this._getSelectedTableVariable(e.detail);
|
|
82
|
+
if (!t) {
|
|
83
|
+
this._codeEditorElt.value?.insertText(e.detail).catch(o(this));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await t.loadSource();
|
|
87
|
+
let i;
|
|
88
|
+
const s = t.fieldInfos.filter((a) => a.type === "geometry" && !i ? (i = a.name, !0) : a.type !== "geometry").map((a) => a.name).filter(Boolean), c = `select ${s.length ? s.join(", ") : "*"} from ${t.snippet};`;
|
|
89
|
+
E(this._codeEditorElt.value?.editorInstance, c, "replace", "");
|
|
78
90
|
}
|
|
79
91
|
_getTablesVariable() {
|
|
80
|
-
return this._editorProfile?.variables.find(
|
|
92
|
+
return this._editorProfile?.variables.find(d);
|
|
93
|
+
}
|
|
94
|
+
_getSelectedTableVariable(e) {
|
|
95
|
+
const t = this._getTablesVariable();
|
|
96
|
+
if (d(t))
|
|
97
|
+
return t.tableVariables.find((i) => i.snippet === e);
|
|
81
98
|
}
|
|
82
99
|
render() {
|
|
83
|
-
const e = this._getTablesVariable();
|
|
84
|
-
|
|
100
|
+
const e = this._getTablesVariable(), i = String(this.messages.placeholderexample ?? "Example: {sqlQueryExample}").replace("{sqlQueryExample}", "select field1, field2 from db.dataset;"), s = `${this.messages.placeholder ?? "Start filtering data using SQL query syntax"}
|
|
101
|
+
${i}`;
|
|
102
|
+
return r`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script ?? ""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{ placeholder: s, ...this.editorOptions }} ${b(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar && r`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables ?? "Tables"} .messageOverrides=${{ profileempty: this.messages.profileempty }} .closed=${this.openedSidePanel !== "variables"} class=${m(this.openedSidePanel === "variables" ? "" : "hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @arcgisInternalClosePanel=${() => {
|
|
85
103
|
this.openedSidePanel = "none";
|
|
86
|
-
}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables ?? "Tables"} icon=table .active=${this.openedSidePanel === "variables"} data-panel-name=variables @click=${() => this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded &&
|
|
104
|
+
}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables ?? "Tables"} icon=table .active=${this.openedSidePanel === "variables"} data-panel-name=variables @click=${() => this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded && r`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables ?? "Tables"}</span></calcite-tooltip>` || ""}</calcite-action-bar>` || ""}</arcgis-code-editor-shell>`;
|
|
87
105
|
}
|
|
88
106
|
}
|
|
89
|
-
|
|
107
|
+
p("arcgis-sql-layer-editor", L);
|
|
90
108
|
export {
|
|
91
|
-
|
|
109
|
+
L as ArcgisSqlLayerEditor
|
|
92
110
|
};
|