@arcgis/coding-components 4.29.0-beta.107 → 4.29.0-beta.109

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.
Files changed (77) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
  2. package/dist/arcgis-coding-components/index.esm.js +2 -2
  3. package/dist/arcgis-coding-components/{p-2c94e34e.js → p-09a0ee03.js} +2 -2
  4. package/dist/arcgis-coding-components/{p-94436a35.js → p-09dd5d6c.js} +1 -1
  5. package/dist/arcgis-coding-components/{p-599777f8.js → p-174178e7.js} +2 -2
  6. package/dist/arcgis-coding-components/{p-1f288af6.js → p-1cd316bf.js} +2 -2
  7. package/dist/arcgis-coding-components/p-690b6627.entry.js +6 -0
  8. package/dist/arcgis-coding-components/{p-ee0405a5.js → p-adf98d20.js} +2 -2
  9. package/dist/arcgis-coding-components/{p-54956a0b.js → p-b14ac5b8.js} +10 -10
  10. package/dist/arcgis-coding-components/{p-91bbadd0.js → p-c089ef80.js} +3 -3
  11. package/dist/arcgis-coding-components/{p-a2dcc80b.js → p-c441923b.js} +1 -1
  12. package/dist/arcgis-coding-components/{p-4ab89e7d.js → p-dd629a57.js} +2 -2
  13. package/dist/arcgis-coding-components/{p-4990e8c6.js → p-ec85d134.js} +2 -2
  14. package/dist/arcgis-coding-components/{p-1e9a909a.js → p-ffc1ca6e.js} +2 -2
  15. package/dist/cjs/{arcade-defaults-da037f39.js → arcade-defaults-243f1d0c.js} +218 -193
  16. package/dist/cjs/{arcade-mode-84768b0f.js → arcade-mode-713ce2c3.js} +3 -3
  17. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +35 -47
  18. package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
  19. package/dist/cjs/{css-373c87ad.js → css-d9452f0e.js} +1 -1
  20. package/dist/cjs/{cssMode-174c6a14.js → cssMode-4ba5410f.js} +3 -3
  21. package/dist/cjs/{html-34d84912.js → html-fc5c516e.js} +3 -3
  22. package/dist/cjs/{htmlMode-560580bc.js → htmlMode-8437fe37.js} +3 -3
  23. package/dist/cjs/{index-a28e8c4d.js → index-1b175662.js} +1 -1
  24. package/dist/cjs/index.cjs.js +3 -3
  25. package/dist/cjs/{javascript-0e9272ba.js → javascript-94bf8806.js} +4 -4
  26. package/dist/cjs/{jsonMode-f03296f5.js → jsonMode-3528dffd.js} +3 -3
  27. package/dist/cjs/loader.cjs.js +3 -3
  28. package/dist/cjs/{tsMode-61a0f476.js → tsMode-fe693a2d.js} +3 -3
  29. package/dist/cjs/{typescript-3bc44ecc.js → typescript-2f8ed118.js} +3 -3
  30. package/dist/components/arcade-api.js +1 -1
  31. package/dist/components/arcade-contribution.js +2 -2
  32. package/dist/components/arcade-defaults.js +169 -152
  33. package/dist/components/arcade-mode.js +1 -1
  34. package/dist/components/arcade-results.js +2 -2
  35. package/dist/components/arcade-suggestions.js +1 -1
  36. package/dist/components/arcade-variables.js +19 -16
  37. package/dist/components/arcgis-arcade-api.js +1 -1
  38. package/dist/components/arcgis-arcade-editor.js +13 -29
  39. package/dist/components/arcgis-arcade-results.js +1 -1
  40. package/dist/components/arcgis-arcade-suggestions.js +1 -1
  41. package/dist/components/arcgis-arcade-variables.js +1 -1
  42. package/dist/components/arcgis-code-editor.js +1 -1
  43. package/dist/components/code-editor.js +1 -1
  44. package/dist/components/fields.js +10 -2
  45. package/dist/components/functional-components.js +1 -1
  46. package/dist/components/index.js +1 -1
  47. package/dist/components/index2.js +1 -1
  48. package/dist/components/markdown.js +1 -1
  49. package/dist/components/utilities.js +1 -1
  50. package/dist/esm/{arcade-defaults-b0a0d60e.js → arcade-defaults-2be262c3.js} +218 -193
  51. package/dist/esm/{arcade-mode-886ad2c6.js → arcade-mode-9b5533a2.js} +3 -3
  52. package/dist/esm/arcgis-arcade-api_6.entry.js +35 -47
  53. package/dist/esm/arcgis-coding-components.js +4 -4
  54. package/dist/esm/{css-97e0bca1.js → css-09aa6c3a.js} +1 -1
  55. package/dist/esm/{cssMode-af0b0322.js → cssMode-f90a1e62.js} +3 -3
  56. package/dist/esm/{html-5b306e7f.js → html-2dae6cf1.js} +3 -3
  57. package/dist/esm/{htmlMode-ade22305.js → htmlMode-7e3483f9.js} +3 -3
  58. package/dist/esm/{index-318ffb0c.js → index-23b528c2.js} +1 -1
  59. package/dist/esm/index.js +3 -3
  60. package/dist/esm/{javascript-e24d6f51.js → javascript-84611956.js} +4 -4
  61. package/dist/esm/{jsonMode-dcc1e54f.js → jsonMode-cdf283a8.js} +3 -3
  62. package/dist/esm/loader.js +4 -4
  63. package/dist/esm/{tsMode-3c62ab70.js → tsMode-0c3bded5.js} +3 -3
  64. package/dist/esm/{typescript-b5ee74fa.js → typescript-6fb8a4c2.js} +3 -3
  65. package/dist/loader/cdn.js +1 -1
  66. package/dist/loader/index.cjs.js +1 -1
  67. package/dist/loader/index.es2017.js +1 -1
  68. package/dist/loader/index.js +1 -1
  69. package/dist/types/components/arcade-editor/arcade-editor.d.ts +1 -7
  70. package/dist/types/components/arcade-variables/arcade-variables.d.ts +0 -1
  71. package/dist/types/components.d.ts +2 -7
  72. package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +1 -0
  73. package/dist/types/utils/profile/editor-profile.d.ts +49 -63
  74. package/dist/types/utils/profile/types.d.ts +122 -1
  75. package/dist/types/utils/profile/utils.d.ts +22 -9
  76. package/package.json +8 -8
  77. package/dist/arcgis-coding-components/p-0afd6c41.entry.js +0 -6
@@ -1,9 +1,9 @@
1
1
  /*!
2
2
  * All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  * See https://js.arcgis.com/4.29/esri/copyright.txt for details.
4
- * v4.29.0-beta.107
4
+ * v4.29.0-beta.109
5
5
  */
6
- import { g as getAssetPath } from './index-318ffb0c.js';
6
+ import { g as getAssetPath } from './index-23b528c2.js';
7
7
 
8
8
  /**
9
9
  * Returns the last element of an array.
@@ -120522,7 +120522,7 @@ registerLanguage({
120522
120522
  mimetypes: ["text/css"],
120523
120523
  loader: () => {
120524
120524
  {
120525
- return import('./css-97e0bca1.js');
120525
+ return import('./css-09aa6c3a.js');
120526
120526
  }
120527
120527
  }
120528
120528
  });
@@ -120540,7 +120540,7 @@ registerLanguage({
120540
120540
  mimetypes: ["text/html", "text/x-jshtm", "text/template", "text/ng-template"],
120541
120541
  loader: () => {
120542
120542
  {
120543
- return import('./html-5b306e7f.js');
120543
+ return import('./html-2dae6cf1.js');
120544
120544
  }
120545
120545
  }
120546
120546
  });
@@ -120560,7 +120560,7 @@ registerLanguage({
120560
120560
  mimetypes: ["text/javascript"],
120561
120561
  loader: () => {
120562
120562
  {
120563
- return import('./javascript-e24d6f51.js');
120563
+ return import('./javascript-84611956.js');
120564
120564
  }
120565
120565
  }
120566
120566
  });
@@ -120578,7 +120578,7 @@ registerLanguage({
120578
120578
  mimetypes: ["text/typescript"],
120579
120579
  loader: () => {
120580
120580
  {
120581
- return import('./typescript-b5ee74fa.js');
120581
+ return import('./typescript-6fb8a4c2.js');
120582
120582
  }
120583
120583
  }
120584
120584
  });
@@ -120699,7 +120699,7 @@ var lessDefaults = new LanguageServiceDefaultsImpl$3("less", optionsDefault$1, m
120699
120699
  monaco_editor_core_exports$3.languages.css = { cssDefaults, lessDefaults, scssDefaults };
120700
120700
  function getMode$3() {
120701
120701
  {
120702
- return import('./cssMode-af0b0322.js');
120702
+ return import('./cssMode-f90a1e62.js');
120703
120703
  }
120704
120704
  }
120705
120705
  monaco_editor_core_exports$3.languages.onLanguage("less", () => {
@@ -120824,7 +120824,7 @@ monaco_editor_core_exports$2.languages.html = {
120824
120824
  };
120825
120825
  function getMode$2() {
120826
120826
  {
120827
- return import('./htmlMode-ade22305.js');
120827
+ return import('./htmlMode-7e3483f9.js');
120828
120828
  }
120829
120829
  }
120830
120830
  function registerHTMLLanguageService(languageId, options = optionsDefault, modeConfiguration = getConfigurationDefault(languageId)) {
@@ -120926,7 +120926,7 @@ var jsonDefaults = new LanguageServiceDefaultsImpl$1("json", diagnosticDefault,
120926
120926
  monaco_editor_core_exports$1.languages.json = { jsonDefaults };
120927
120927
  function getMode$1() {
120928
120928
  {
120929
- return import('./jsonMode-dcc1e54f.js');
120929
+ return import('./jsonMode-cdf283a8.js');
120930
120930
  }
120931
120931
  }
120932
120932
  monaco_editor_core_exports$1.languages.register({
@@ -121195,7 +121195,7 @@ monaco_editor_core_exports.languages.typescript = {
121195
121195
  };
121196
121196
  function getMode() {
121197
121197
  {
121198
- return import('./tsMode-3c62ab70.js');
121198
+ return import('./tsMode-0c3bded5.js');
121199
121199
  }
121200
121200
  }
121201
121201
  monaco_editor_core_exports.languages.onLanguage("typescript", () => {
@@ -168945,6 +168945,10 @@ async function importPortalPortalItem() {
168945
168945
  const module = await import('@arcgis/core/portal/PortalItem.js');
168946
168946
  return module.default;
168947
168947
  }
168948
+ async function newPortalPortalItem(properties) {
168949
+ const ModConstructor = await importPortalPortalItem();
168950
+ return new ModConstructor(properties);
168951
+ }
168948
168952
  async function importWebMap() {
168949
168953
  if (amd) {
168950
168954
  return requireModule("esri/WebMap");
@@ -168952,6 +168956,10 @@ async function importWebMap() {
168952
168956
  const module = await import('@arcgis/core/WebMap.js');
168953
168957
  return module.default;
168954
168958
  }
168959
+ async function newWebMap(properties) {
168960
+ const ModConstructor = await importWebMap();
168961
+ return new ModConstructor(properties);
168962
+ }
168955
168963
  async function importWebScene() {
168956
168964
  if (amd) {
168957
168965
  return requireModule("esri/WebScene");
@@ -168978,19 +168986,14 @@ async function importRequest() {
168978
168986
  return module.default;
168979
168987
  }
168980
168988
 
168981
- async function newPortalItem(definition) {
168982
- const PortalItem = await importPortalPortalItem();
168983
- return new PortalItem(definition);
168984
- }
168989
+ //#region core adapter fix
168985
168990
  async function newFeatureLayer(definition) {
168986
168991
  const FeatureLayer = await importLayersFeatureLayer();
168987
168992
  // Fix title for the layer. Instead of defaulting to the map viewer style.
168988
168993
  return new FeatureLayer({ ...definition, sublayerTitleMode: "service-name" });
168989
168994
  }
168990
- async function newWebMap(definition) {
168991
- const WebMap = await importWebMap();
168992
- return new WebMap(definition);
168993
- }
168995
+ //#endregion
168996
+ //#region Type Guards
168994
168997
  function isSupportedLayerInstance(item) {
168995
168998
  return (!!item &&
168996
168999
  typeof item === "object" &&
@@ -169075,6 +169078,86 @@ function isPredefinedProfile(item) {
169075
169078
  typeof item.definitions === "object" &&
169076
169079
  !Array.isArray(item.definitions));
169077
169080
  }
169081
+ function isTitleCapableSource(item) {
169082
+ return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
169083
+ }
169084
+ function isUrlCapableSource(item) {
169085
+ return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
169086
+ }
169087
+ function isLayerIdCapableSource(item) {
169088
+ return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
169089
+ }
169090
+ function isFeatureTypesCapableLayer(item) {
169091
+ return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
169092
+ }
169093
+ function isDomainsCapableLayer(item) {
169094
+ return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
169095
+ }
169096
+ function isSubtypeFieldCapableLayer(item) {
169097
+ return !!item && typeof item === "object" && "subtypeField" in item;
169098
+ }
169099
+ function isSubtypesCapableLayer(item) {
169100
+ return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
169101
+ }
169102
+ function isRelationshipsCapableLayer(item) {
169103
+ return (isLayerIdCapableSource(item) &&
169104
+ "relationships" in item &&
169105
+ "url" in item &&
169106
+ Array.isArray(item.relationships) &&
169107
+ typeof item.url === "string");
169108
+ }
169109
+ function isTableCapableLayer(item) {
169110
+ return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
169111
+ }
169112
+ function isLoadableSource(item) {
169113
+ return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
169114
+ }
169115
+ //#endregion
169116
+ //#region Service Metadata
169117
+ async function supportedSourceFromDefinition(definition) {
169118
+ if (!definition) {
169119
+ return null;
169120
+ }
169121
+ let source = null;
169122
+ if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
169123
+ source = definition;
169124
+ }
169125
+ else {
169126
+ source = await newFeatureLayer(definition);
169127
+ }
169128
+ if (isLoadableSource(source)) {
169129
+ await source.load();
169130
+ }
169131
+ return source;
169132
+ }
169133
+ async function serviceMetaData(url) {
169134
+ url += "/layers";
169135
+ const request = await importRequest();
169136
+ const response = await request(url, { responseType: "json", query: { f: "json" } });
169137
+ const data = {
169138
+ layers: response.data?.layers ?? [],
169139
+ tables: response.data?.tables ?? []
169140
+ };
169141
+ const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
169142
+ const layers = filterFeatureLayerInfos(data.layers, queryCapability);
169143
+ const tables = filterFeatureLayerInfos(data.tables, queryCapability);
169144
+ return { layers, tables };
169145
+ }
169146
+ function filterFeatureLayerInfos(layers, queryCapability) {
169147
+ return layers.filter((layer) => {
169148
+ if (layer.type !== "Feature Layer" && layer.type !== "Table") {
169149
+ return false;
169150
+ }
169151
+ const capabilities = layer.capabilities
169152
+ ? layer.capabilities
169153
+ .toLowerCase()
169154
+ .split(",")
169155
+ .map((value) => value.trim())
169156
+ : [];
169157
+ return capabilities.includes(queryCapability);
169158
+ });
169159
+ }
169160
+ //#endregion
169078
169161
 
169079
169162
  var h=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n;});}};function S(e,t){let n=e;for(;n;){if(n===t)return !0;if(!n.parentNode)return !1;n.parentNode instanceof ShadowRoot?n=n.parentNode.host:n=n.parentNode;}return !1}function x(e,t,n=()=>{}){if(!t||t.length<=0)return;let r=new MutationObserver(o=>{for(let s of o)S(e,s.target)&&n();});return r.observe(document.documentElement,{attributes:!0,attributeFilter:t,subtree:!0}),r}function T(e,t){let n=e;for(;n;){let r=n.closest(t);if(r)return r;let o=n.getRootNode();if(o===document)return null;n=o.host;}return null}function k(e){let t=T(e,":is(.calcite-mode-light, .calcite-mode-dark)");return t&&t.classList.contains("calcite-mode-dark")?"dark":"light"}function f(e,t,n){return T(e,`[${t}]`)?.getAttribute(t)??n}function M(e){return e.nodeType===Node.ELEMENT_NODE}function d(e,t=""){if(!M(e))return !1;if(e.matches(t))return setTimeout(()=>e?.setFocus(),0),!0;for(let r=0;r<e.children.length;r++)if(d(e.children[r],t))return !0;let n=e.shadowRoot;if(n){for(let r=0;r<n.children.length;r++)if(d(n.children[r],t))return !0}return !1}function F(e,t){if(!e?.shadowRoot)return;if(e.hasAttribute("hydrated")||e.hasAttribute("calcite-hydrated")){d(e,t);return}let n=new MutationObserver(()=>{n.disconnect(),d(e,t);});n.observe(e,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]});}function c(e){let t="";for(let n=0;n<e;n++)t+=((1+Math.random())*65536|0).toString(16).substring(1);return t}function U(){return [c(2),c(1),c(1),c(1),c(3)].join("-")}var E=new Set(["ar","bg","bs","ca","cs","da","de","el","en","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nl","nb","pl","pt-BR","pt-PT","ro","ru","sk","sl","sr","sv","th","tr","uk","vi","zh-CN","zh-HK","zh-TW"]),a=new Map;async function N(e,t,n=""){let r=`${t}/${n}${e}.json`;if(a.has(r))return a.get(r);try{let o=await fetch(r);if(o.ok){let i=await o.json();return a.set(r,i),i}if(e==="en"){a.set(r,void 0);return}let s=await N("en",t,n);return a.set(r,s),s}catch{a.set(r,void 0);return}}function R(e){let t=f(e,"lang",navigator.language||"en");if(E.has(t))return {lang:t,t9nLocale:t};let n=t.slice(0,2);return {lang:t,t9nLocale:E.has(n)?n:"en"}}var p=new WeakMap,m=new WeakMap,C=new WeakMap;async function B(e,t,n){m.set(e,t),p.set(e,x(e._hostElement,["lang"],()=>{b(e,n);})),await b(e,n);}function H(e){p.get(e)?.disconnect(),p.delete(e),m.delete(e);}async function b(e,t){let{lang:n,t9nLocale:r}=R(e._hostElement);if(n===e._lang&&r===e._t9nLocale||(n!==e._lang&&(e._lang=n),r===e._t9nLocale))return;let o=C.get(e);if(!o){let s=m.get(e)??"",i=e._hostElement.tagName.toLowerCase().replace("arcgis-",""),l=`${s}/${i}/t9n`,u=`${i}.t9n.`;o=await N(r,l,u);}e._t9nLocale=r,e._t9nStrings=o,await t?.call(e);}var v='"',w="'";function L(e,t){return new Array(t+1).join(e)}function Q(e){let t=v,n=w;e.includes(t)&&!e.includes(n)&&(n=v,t=w);let o=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${n})+)`,"gu");e=e.replace(o,(i,l,u,g)=>l+u+L(n,g.length/2));let s=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${t}+)`,"gu");return e=e.replace(s,(i,l,u,g)=>l+u+L(`\\${t}`,g.length)),t+e+t}function D(e){let t=e?e.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu,"\\$&"):"^.*$";return new RegExp(t,"i")}function K(e,t={}){return (e??"").replace(/\{(.*?)\}/gu,(n,r)=>t[r]??n)}function Z(e){return `\u200E${e??""}\u200E`}function Y(e){return e!==null}function ee(e){return e!==void 0}function oe(e,t,n=!1){if(!e||!t)return !1;let r=new URL(e),o=new URL(t);return !n&&r.protocol!==o.protocol||r.host==null||o.host==null?!1:r.host.toLowerCase()===o.host.toLowerCase()&&r.port===o.port}function se(e){try{return new URL(e),!0}catch{return !1}}
169080
169163
 
@@ -169193,42 +169276,8 @@ function supportedFields(fields) {
169193
169276
  });
169194
169277
  }
169195
169278
 
169196
- function isTitleCapableSource(item) {
169197
- return !!item && typeof item === "object" && "title" in item && typeof item.title === "string";
169198
- }
169199
- function isUrlCapableSource(item) {
169200
- return !!item && typeof item === "object" && "url" in item && typeof item.url === "string";
169201
- }
169202
- function isLayerIdCapableSource(item) {
169203
- return !!item && typeof item === "object" && "layerId" in item && typeof item.layerId === "number";
169204
- }
169205
- function isFeatureTypesCapableLayer(item) {
169206
- return !!item && typeof item === "object" && "typeIdField" in item && "types" in item;
169207
- }
169208
- function isDomainsCapableLayer(item) {
169209
- return !!item && typeof item === "object" && "getFieldDomain" in item && typeof item.getFieldDomain === "function";
169210
- }
169211
- function isSubtypeFieldCapableLayer(item) {
169212
- return !!item && typeof item === "object" && "subtypeField" in item;
169213
- }
169214
- function isSubtypesCapableLayer(item) {
169215
- return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
169216
- }
169217
- function isRelationshipsCapableLayer(item) {
169218
- return (isLayerIdCapableSource(item) &&
169219
- "relationships" in item &&
169220
- "url" in item &&
169221
- Array.isArray(item.relationships) &&
169222
- typeof item.url === "string");
169223
- }
169224
- function isTableCapableLayer(item) {
169225
- return !!item && typeof item === "object" && "isTable" in item && typeof item.isTable === "boolean";
169226
- }
169227
- function isLoadableSource(item) {
169228
- return !!item && typeof item === "object" && "load" in item && typeof item.load === "function";
169229
- }
169230
169279
  //#endregion
169231
- //#region Support Functions
169280
+ //#region Support functions
169232
169281
  async function getRelatedFeatureLayer(layer, relationship) {
169233
169282
  const relatedFeatureLayer = await newFeatureLayer({ url: `${layer.url}/${relationship.relatedTableId}` });
169234
169283
  await relatedFeatureLayer.load();
@@ -169269,64 +169318,6 @@ function sortFields(layer) {
169269
169318
  return firstField.name.localeCompare(secondField.name, "en", { sensitivity: "base" });
169270
169319
  };
169271
169320
  }
169272
- function getTypeOrSubtypeDomainGroup(profile, types, field) {
169273
- // Try the coded domain first
169274
- if (isCodedValueDomainInstance(field.domain)) {
169275
- return getCodedValueDomainGroup(profile, field.domain, { code: "subtypes" });
169276
- }
169277
- // No coded domain, we will manufacture it
169278
- const values = types?.map((t) => {
169279
- const label = isSubtypeInstance(t) ? t.code : t.id;
169280
- return new ValueVariable({ profile, label: `${label}`, description: t.name, snippet: `"${label}"` });
169281
- }) ?? [];
169282
- return new GroupOfVariables(profile, { code: "subtypes" }, values);
169283
- }
169284
- function getCodedValueDomainGroup(profile, domain, label) {
169285
- const values = domain.codedValues.map((v) => new ValueVariable({
169286
- profile,
169287
- label: `${v.code}`,
169288
- description: v.name,
169289
- snippet: `"${v.code}"`,
169290
- filterDescription: true
169291
- }));
169292
- return new GroupOfVariables(profile, label, values);
169293
- }
169294
- function getDomainValuesGroup(profile, types, field) {
169295
- const variables = [];
169296
- if (!types || types.length === 0) {
169297
- return null;
169298
- }
169299
- types.forEach((type) => {
169300
- let domain = type.domains[field.name];
169301
- if (!domain) {
169302
- return;
169303
- }
169304
- if (isInheritedDomainInstance(domain)) {
169305
- domain = field.domain;
169306
- return;
169307
- }
169308
- if (!isCodedValueDomainInstance(domain)) {
169309
- return;
169310
- }
169311
- const domainValuesGroup = getCodedValueDomainGroup(profile, domain, {
169312
- code: "domainvaluesfortypeformat",
169313
- formatValues: {
169314
- fieldName: field.alias ?? field.name,
169315
- typeName: type.name
169316
- }
169317
- });
169318
- const id = isSubtypeInstance(type) ? type.code : type.id;
169319
- const label = `${id}`;
169320
- const snippet = `"${id}""`;
169321
- const subtypeDictionary = new DictionaryVariable({ profile, label, snippet });
169322
- subtypeDictionary.variables = [domainValuesGroup];
169323
- variables.push(subtypeDictionary);
169324
- });
169325
- if (!variables.length) {
169326
- return null;
169327
- }
169328
- return new GroupOfVariables(profile, { code: "domainvaluesbysubtypes" }, variables);
169329
- }
169330
169321
  function areAllDomainsInherited(types, field) {
169331
169322
  return types?.every((type) => type.domains[field.name]?.type === "inherited") ?? false;
169332
169323
  }
@@ -169345,52 +169336,7 @@ function assembleMemberExpression(obj, prop) {
169345
169336
  return `${obj}${getMemberExpressionProperty(prop)}`;
169346
169337
  }
169347
169338
  //#endregion
169348
- //#region Sources
169349
- async function supportedSourceFromDefinition(definition) {
169350
- if (!definition) {
169351
- return null;
169352
- }
169353
- let source = null;
169354
- if (isSupportedLayerInstance(definition) || isFeatureSetInstance(definition) || isFieldsDefinition(definition)) {
169355
- source = definition;
169356
- }
169357
- else {
169358
- source = await newFeatureLayer(definition);
169359
- }
169360
- if (isLoadableSource(source)) {
169361
- await source.load();
169362
- }
169363
- return source;
169364
- }
169365
- async function serviceMetaData(url) {
169366
- url += "/layers";
169367
- const request = await importRequest();
169368
- const response = await request(url, { responseType: "json", query: { f: "json" } });
169369
- const data = {
169370
- layers: response.data?.layers ?? [],
169371
- tables: response.data?.tables ?? []
169372
- };
169373
- const queryCapability = url.endsWith("MapServer/layers") ? "data" : "query";
169374
- const layers = filterFeatureLayerInfos(data.layers, queryCapability);
169375
- const tables = filterFeatureLayerInfos(data.tables, queryCapability);
169376
- return { layers, tables };
169377
- }
169378
- function filterFeatureLayerInfos(layers, queryCapability) {
169379
- return layers.filter((layer) => {
169380
- if (layer.type !== "Feature Layer" && layer.type !== "Table") {
169381
- return false;
169382
- }
169383
- const capabilities = layer.capabilities
169384
- ? layer.capabilities
169385
- .toLowerCase()
169386
- .split(",")
169387
- .map((value) => value.trim())
169388
- : [];
169389
- return capabilities.includes(queryCapability);
169390
- });
169391
- }
169392
- //#endregion
169393
- //#region Functions to Editor Variables to a language service variables
169339
+ //#region Editor Profile to Language Service Profile functions
169394
169340
  async function variablesToLSVariable(editorVariables, kind = main.CompletionItemKind.Variable) {
169395
169341
  return await Promise.all(editorVariables.map(async (editorVariable) => {
169396
169342
  switch (editorVariable.type) {
@@ -169651,8 +169597,9 @@ class ArrayVariable extends VariableBase {
169651
169597
  * collection is ready or not.
169652
169598
  */
169653
169599
  class CollectionBasedVariable extends VariableBase {
169654
- constructor() {
169655
- super(...arguments);
169600
+ constructor(owner, props) {
169601
+ super(props);
169602
+ this.owner = owner;
169656
169603
  this.isCollection = true;
169657
169604
  this._loaded = true;
169658
169605
  /**
@@ -169662,19 +169609,21 @@ class CollectionBasedVariable extends VariableBase {
169662
169609
  */
169663
169610
  this.variables = [];
169664
169611
  }
169612
+ get breadcrumb() {
169613
+ // If there's an owner, prepend its breadcrumb and append the current name
169614
+ if (this.owner) {
169615
+ const ownerBreadcrumb = this.owner.breadcrumb;
169616
+ return ownerBreadcrumb ? `${ownerBreadcrumb} / ${this.name}` : this.name;
169617
+ }
169618
+ // If there's no owner, this is the root element, so just return its name
169619
+ return this.name;
169620
+ }
169665
169621
  /**
169666
169622
  * Returns true if the collection has been loaded
169667
169623
  */
169668
169624
  get loaded() {
169669
169625
  return this._loaded;
169670
169626
  }
169671
- /**
169672
- * Loads the items if the collection is asynchronous.
169673
- * If the colleciton is synchronous then the function is a no-op.
169674
- */
169675
- async loadSource() {
169676
- return;
169677
- }
169678
169627
  /**
169679
169628
  * Returns an url to the associated information
169680
169629
  */
@@ -169697,8 +169646,8 @@ class GroupOfVariables extends ProfileItemBase {
169697
169646
  }
169698
169647
  }
169699
169648
  class DictionaryVariable extends CollectionBasedVariable {
169700
- constructor(props) {
169701
- super(props);
169649
+ constructor(owner, props) {
169650
+ super(owner, props);
169702
169651
  this.type = "dictionary";
169703
169652
  /**
169704
169653
  * The variables that the dictionary holds. It is different than the variables.
@@ -169712,6 +169661,9 @@ class DictionaryVariable extends CollectionBasedVariable {
169712
169661
  this.variables = [new GroupOfVariables(this._profile, this.snippet, this.dictionaryVariables)];
169713
169662
  }
169714
169663
  }
169664
+ async loadSource() {
169665
+ // No-op
169666
+ }
169715
169667
  loadPropertyDeclarations(declarations) {
169716
169668
  this.dictionaryVariables = this.createVariableInstances(declarations);
169717
169669
  this.variables = this.dictionaryVariables;
@@ -169736,23 +169688,26 @@ class DictionaryVariable extends CollectionBasedVariable {
169736
169688
  case "text":
169737
169689
  case "boolean":
169738
169690
  case "date":
169691
+ case "dateOnly":
169692
+ case "time":
169739
169693
  case "geometry":
169694
+ case "knowledgeGraph":
169740
169695
  return new ValueVariable({ profile: this._profile, declaration, label: snippet, snippet });
169741
169696
  case "feature":
169742
- return new FeatureVariable({ profile: this._profile, declaration, label: snippet, snippet });
169697
+ return new FeatureVariable(this, { profile: this._profile, declaration, label: snippet, snippet });
169743
169698
  case "featureSet":
169744
- return new FeatureSetVariable({ profile: this._profile, declaration, label: snippet, snippet }, [
169699
+ return new FeatureSetVariable(this, { profile: this._profile, declaration, label: snippet, snippet }, [
169745
169700
  new ValueVariable({ profile: this._profile, label: snippet, description: "", snippet })
169746
169701
  ]);
169747
169702
  case "featureSetCollection":
169748
- return new FeatureSetCollectionVariable({
169703
+ return new FeatureSetCollectionVariable(this, {
169749
169704
  profile: this._profile,
169750
169705
  declaration,
169751
169706
  label: snippet,
169752
169707
  snippet
169753
169708
  });
169754
169709
  case "dictionary":
169755
- return new DictionaryVariable({
169710
+ return new DictionaryVariable(this, {
169756
169711
  profile: this._profile,
169757
169712
  declaration,
169758
169713
  label: snippet,
@@ -169766,7 +169721,7 @@ class DictionaryVariable extends CollectionBasedVariable {
169766
169721
  snippet
169767
169722
  });
169768
169723
  default:
169769
- console.error("Invalid profile variable", declaration);
169724
+ console.error("Editor profile: Invalid profile variable", declaration);
169770
169725
  return null;
169771
169726
  }
169772
169727
  }
@@ -169780,8 +169735,8 @@ class DictionaryVariable extends CollectionBasedVariable {
169780
169735
  }
169781
169736
  }
169782
169737
  class SourceBasedVariable extends CollectionBasedVariable {
169783
- constructor(props, relationshipsProperties) {
169784
- super(props);
169738
+ constructor(owner, props, relationshipsProperties) {
169739
+ super(owner, props);
169785
169740
  this.relationshipsProperties = relationshipsProperties;
169786
169741
  this._source = null;
169787
169742
  this._loaded = false;
@@ -169880,7 +169835,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
169880
169835
  // Sepcial case for the subtype field
169881
169836
  if (field.name === this._source.subtypeField) {
169882
169837
  const domainDictionary = this._createDomainDictionary(field);
169883
- domainDictionary.variables.push(getTypeOrSubtypeDomainGroup(this._profile, this._source.subtypes, field));
169838
+ domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes, field));
169884
169839
  return domainDictionary;
169885
169840
  }
169886
169841
  // Check if all the domains for the field in the types are inherited.
@@ -169890,7 +169845,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
169890
169845
  }
169891
169846
  // We have domains per subtype
169892
169847
  // We need to go thru each types and create a dictionary.
169893
- const domainValuesBySubtypeGroup = getDomainValuesGroup(this._profile, this._source.subtypes, field);
169848
+ const domainValuesBySubtypeGroup = this._getDomainValuesGroup(this._source.subtypes, field);
169894
169849
  if (!domainValuesBySubtypeGroup) {
169895
169850
  return null;
169896
169851
  }
@@ -169906,7 +169861,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
169906
169861
  // Special case for the type id field
169907
169862
  if (field.name === this._source.typeIdField) {
169908
169863
  const domainDictionary = this._createDomainDictionary(field);
169909
- domainDictionary.variables.push(getTypeOrSubtypeDomainGroup(this._profile, this._source.types, field));
169864
+ domainDictionary.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types, field));
169910
169865
  return domainDictionary;
169911
169866
  }
169912
169867
  // Check if all the domains for the field in the types are inherited.
@@ -169916,7 +169871,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
169916
169871
  }
169917
169872
  // We have domains per feature type
169918
169873
  // We need to go thru each types and create a dictionary.
169919
- const domainValuesByFeatureTypeGroup = getDomainValuesGroup(this._profile, this._source.types, field);
169874
+ const domainValuesByFeatureTypeGroup = this._getDomainValuesGroup(this._source.types, field);
169920
169875
  if (!domainValuesByFeatureTypeGroup) {
169921
169876
  return null;
169922
169877
  }
@@ -169933,24 +169888,94 @@ class SourceBasedVariable extends CollectionBasedVariable {
169933
169888
  if (!isCodedValueDomainInstance(fieldDomain)) {
169934
169889
  return null;
169935
169890
  }
169936
- const domainValuesGroup = getCodedValueDomainGroup(this._profile, fieldDomain, {
169891
+ const domainValuesGroup = this._getCodedValueDomainGroup(fieldDomain, {
169937
169892
  code: "domainvalues"
169938
169893
  });
169939
169894
  const domainDictionary = this._createDomainDictionary(field);
169940
169895
  domainDictionary.variables.push(domainValuesGroup);
169941
169896
  return domainDictionary;
169942
169897
  }
169898
+ _getTypeOrSubtypeDomainGroup(types, field) {
169899
+ // Try the coded domain first
169900
+ if (isCodedValueDomainInstance(field.domain)) {
169901
+ return this._getCodedValueDomainGroup(field.domain, { code: "subtypes" });
169902
+ }
169903
+ // No coded domain, we will manufacture it
169904
+ const values = types?.map((t) => {
169905
+ const label = isSubtypeInstance(t) ? t.code : t.id;
169906
+ return new ValueVariable({
169907
+ profile: this._profile,
169908
+ label: `${label}`,
169909
+ description: t.name,
169910
+ snippet: `"${label}"`
169911
+ });
169912
+ }) ?? [];
169913
+ return new GroupOfVariables(this._profile, { code: "subtypes" }, values);
169914
+ }
169915
+ _getCodedValueDomainGroup(domain, label) {
169916
+ const values = domain.codedValues.map((v) => new ValueVariable({
169917
+ profile: this._profile,
169918
+ label: `${v.code}`,
169919
+ description: v.name,
169920
+ snippet: `"${v.code}"`,
169921
+ filterDescription: true
169922
+ }));
169923
+ return new GroupOfVariables(this._profile, label, values);
169924
+ }
169925
+ _getDomainValuesGroup(types, field) {
169926
+ const variables = [];
169927
+ if (!types || types.length === 0) {
169928
+ return null;
169929
+ }
169930
+ types.forEach((type) => {
169931
+ let domain = type.domains[field.name];
169932
+ if (!domain) {
169933
+ return;
169934
+ }
169935
+ if (isInheritedDomainInstance(domain)) {
169936
+ domain = field.domain;
169937
+ return;
169938
+ }
169939
+ if (!isCodedValueDomainInstance(domain)) {
169940
+ return;
169941
+ }
169942
+ const domainValuesGroup = this._getCodedValueDomainGroup(domain, {
169943
+ code: "domainvaluesfortypeformat",
169944
+ formatValues: {
169945
+ fieldName: field.alias ?? field.name,
169946
+ typeName: type.name
169947
+ }
169948
+ });
169949
+ const id = isSubtypeInstance(type) ? type.code : type.id;
169950
+ const label = `${id}`;
169951
+ const snippet = `"${id}""`;
169952
+ const subtypeDictionary = new DictionaryVariable(this, {
169953
+ profile: this._profile,
169954
+ label,
169955
+ snippet,
169956
+ description: type.name,
169957
+ declaration: { name: field.alias ?? field.name }
169958
+ });
169959
+ subtypeDictionary.variables = [domainValuesGroup];
169960
+ variables.push(subtypeDictionary);
169961
+ });
169962
+ if (!variables.length) {
169963
+ return null;
169964
+ }
169965
+ return new GroupOfVariables(this._profile, { code: "domainvaluesbysubtypes" }, variables);
169966
+ }
169943
169967
  _createDomainDictionary(field) {
169944
169968
  // Create the domain dictionary.
169945
169969
  // The dictionary will have a header group and a value group.
169946
169970
  // At this point we are only creating the header group in the dictionary.
169947
169971
  const valueSnippet = this._getValueSnippet(field);
169948
- const domainDictionary = new DictionaryVariable({
169972
+ const domainDictionary = new DictionaryVariable(this, {
169949
169973
  profile: this._profile,
169950
169974
  label: valueSnippet,
169951
169975
  description: field.alias ?? field.name,
169952
169976
  snippet: valueSnippet,
169953
- icon: "form-dropdown"
169977
+ icon: "form-dropdown",
169978
+ declaration: { name: field.alias ?? field.name }
169954
169979
  });
169955
169980
  // Add the header group
169956
169981
  const headerGroup = new GroupOfVariables(this._profile, field.alias ?? field.name, [
@@ -169994,7 +170019,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
169994
170019
  return null;
169995
170020
  }
169996
170021
  const snippet = `FeatureSetByRelationshipName(${this.snippet}, "${relationship.name}")`;
169997
- return new FeatureSetVariable({
170022
+ return new FeatureSetVariable(this, {
169998
170023
  profile: this._profile,
169999
170024
  declaration: { definition: relatedLayer },
170000
170025
  label: relatedLayer.title,
@@ -170010,8 +170035,8 @@ class SourceBasedVariable extends CollectionBasedVariable {
170010
170035
  }
170011
170036
  }
170012
170037
  class FeatureVariable extends SourceBasedVariable {
170013
- constructor(props) {
170014
- super(props, { exposeRelationships: true });
170038
+ constructor(owner, props) {
170039
+ super(owner, props, { exposeRelationships: true });
170015
170040
  this.type = "feature";
170016
170041
  }
170017
170042
  get title() {
@@ -170079,11 +170104,11 @@ class FeatureVariable extends SourceBasedVariable {
170079
170104
  }
170080
170105
  }
170081
170106
  class FeatureSetVariable extends SourceBasedVariable {
170082
- constructor(props, featureSetSnippets = [],
170107
+ constructor(owner, props, featureSetSnippets = [],
170083
170108
  // Relationships for feature set if only supported if the feature set is actually
170084
170109
  // representing a relationsip feature layer for a feature source.
170085
170110
  relationshipProps) {
170086
- super(props, relationshipProps);
170111
+ super(owner, props, relationshipProps);
170087
170112
  this.featureSetSnippets = featureSetSnippets;
170088
170113
  this.type = "featureSet";
170089
170114
  }
@@ -170130,8 +170155,8 @@ class FeatureSetVariable extends SourceBasedVariable {
170130
170155
  }
170131
170156
  }
170132
170157
  class FeatureSetCollectionVariable extends CollectionBasedVariable {
170133
- constructor(props) {
170134
- super(props);
170158
+ constructor(owner, props) {
170159
+ super(owner, props);
170135
170160
  this.type = "featureSetCollection";
170136
170161
  this._featureSetCollections = null;
170137
170162
  this._loaded = false;
@@ -170239,7 +170264,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170239
170264
  };
170240
170265
  }
170241
170266
  async _featureSetCollectionFromPortalItem(definition) {
170242
- const portalItem = await newPortalItem(definition);
170267
+ const portalItem = await newPortalPortalItem(definition);
170243
170268
  await portalItem.load();
170244
170269
  switch (portalItem.type) {
170245
170270
  case "Web Map": {
@@ -170298,9 +170323,9 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170298
170323
  return layerVariables;
170299
170324
  }
170300
170325
  _createFeatureSetVariable(featureLayer, isFromWebMap = false) {
170301
- return new FeatureSetVariable({
170326
+ return new FeatureSetVariable(this, {
170302
170327
  profile: this._profile,
170303
- declaration: { definition: featureLayer },
170328
+ declaration: { name: featureLayer.title, definition: featureLayer },
170304
170329
  label: featureLayer.title,
170305
170330
  description: "",
170306
170331
  nonInteractive: true
@@ -170338,7 +170363,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
170338
170363
  class EditorProfile extends DictionaryVariable {
170339
170364
  constructor(definition, intlStrings, locale = "en") {
170340
170365
  // Delay the load of the variable declarations so we have a `this`
170341
- super({
170366
+ super(undefined, {
170342
170367
  profile: null,
170343
170368
  declaration: { properties: [] }
170344
170369
  });