@arcgis/coding-components 4.31.0-next.5 → 4.31.0-next.51
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/README.md +22 -3
- package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ar.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bg.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.bs.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ca.json +6 -6
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.cs.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.da.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.de.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.el.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.es.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.et.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fi.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.fr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.he.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.hr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.id.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.it.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ko.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nb.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.nl.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pl.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-BR.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.pt-PT.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.ru.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sk.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sl.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.sv.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.th.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.tr.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.uk.json +5 -5
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.vi.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-CN.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-HK.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-language/t9n/profile.t9n.zh-TW.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.ca.json +2 -2
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.de.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-results/t9n/arcade-results.t9n.he.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.ca.json +1 -1
- package/dist/arcgis-coding-components/assets/arcade-variables/t9n/arcade-variables.t9n.it.json +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/sql-expr.worker.js +460 -7
- package/dist/arcgis-coding-components/assets/language-api-panel/t9n/language-api-panel.t9n.ca.json +1 -1
- package/dist/arcgis-coding-components/assets/sql-expression-editor/api/sql-expression-api.t9n.en.json +30 -30
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-ae6af9eb.js → p-01da9b87.js} +2 -2
- package/dist/arcgis-coding-components/p-0e466656.js +6 -0
- package/dist/arcgis-coding-components/{p-3d5b8c4b.js → p-1e2c061f.js} +12 -12
- package/dist/arcgis-coding-components/{p-2c85c4b2.js → p-1f4dd8ea.js} +2 -2
- package/dist/arcgis-coding-components/{p-2d32fb1b.js → p-2d187b80.js} +3 -3
- package/dist/arcgis-coding-components/p-38b10ccb.js +6 -0
- package/dist/arcgis-coding-components/p-3e54590d.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-e31be2c5.js → p-65b4b095.js} +1 -1
- package/dist/arcgis-coding-components/{p-c41f6d7c.js → p-6787dd4c.js} +3 -3
- package/dist/arcgis-coding-components/{p-7f776266.js → p-833ae4ee.js} +2 -2
- package/dist/arcgis-coding-components/p-8b045366.js +6 -0
- package/dist/arcgis-coding-components/{p-7bd74de6.entry.js → p-9218ae01.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-de85c014.js → p-96bba7f5.js} +1 -1
- package/dist/arcgis-coding-components/p-cccd46d5.js +7 -0
- package/dist/arcgis-coding-components/p-d2287ce9.js +6 -0
- package/dist/arcgis-coding-components/{p-28d34a6e.entry.js → p-d3f04192.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-60739af5.js → p-d67469e8.js} +2 -2
- package/dist/arcgis-coding-components/{p-aa9d06e6.js → p-e16c05ff.js} +3 -3
- package/dist/cjs/{app-globals-886c7ef0.js → app-globals-b5d3bda0.js} +1 -1
- package/dist/cjs/arcade-defaults-a59b98c8.js +350 -0
- package/dist/cjs/{arcade-mode-2175ca7d.js → arcade-mode-bbcc64c9.js} +4 -4
- package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +60 -27
- package/dist/cjs/arcgis-coding-components.cjs.js +5 -5
- package/dist/cjs/arcgis-sql-expression-editor.cjs.entry.js +4 -4
- package/dist/cjs/arcgis-sql-expression-fields.cjs.entry.js +4 -4
- package/dist/cjs/{css-b5a232da.js → css-50ab4ba4.js} +1 -1
- package/dist/cjs/{cssMode-f67c30d4.js → cssMode-cde87050.js} +2 -3
- package/dist/cjs/{html-d57fda6b.js → html-88890272.js} +2 -3
- package/dist/cjs/{htmlMode-c1513225.js → htmlMode-61827280.js} +2 -3
- package/dist/cjs/{index-6563aa26.js → index-1662a35f.js} +43 -15
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-d7362563.js → javascript-2c62b4fe.js} +3 -4
- package/dist/cjs/{jsonMode-1ea2f163.js → jsonMode-46c758c3.js} +2 -3
- package/dist/cjs/{language-defaults-base-66e1921b.js → language-defaults-base-1351cde9.js} +822 -1062
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/{sql-expr-defaults-e30d7627.js → sql-expr-defaults-c1878109.js} +119 -95
- package/dist/cjs/sql-expr-mode-4e83413c.js +467 -0
- package/dist/cjs/{tsMode-9db1a5aa.js → tsMode-187fbff9.js} +2 -3
- package/dist/cjs/{typescript-f6d1b2b4.js → typescript-ed13744f.js} +2 -3
- package/dist/components/arcade-defaults.js +239 -4
- package/dist/components/arcade-mode.js +3 -2
- package/dist/components/arcade-results.js +3 -3
- package/dist/components/arcade-suggestions.js +2 -2
- package/dist/components/arcade-variables.js +2 -2
- package/dist/components/arcgis-arcade-editor.js +7 -6
- package/dist/components/arcgis-arcade-results.js +1 -1
- package/dist/components/arcgis-arcade-suggestions.js +1 -1
- package/dist/components/arcgis-arcade-variables.js +1 -1
- package/dist/components/arcgis-assets.d.ts +26 -26
- package/dist/components/arcgis-assets.js +2 -2
- package/dist/components/arcgis-code-editor.js +1 -1
- package/dist/components/arcgis-language-api-panel.js +1 -1
- package/dist/components/arcgis-sql-expression-editor.js +2 -2
- package/dist/components/arcgis-sql-expression-fields.js +1 -1
- package/dist/components/{chunk-6TARY3NN.js → chunk-BMBYH3VH.js} +42 -74
- package/dist/components/code-editor.js +16 -23
- package/dist/components/fields.js +4 -4
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +4 -4
- package/dist/components/language-api-panel.js +2 -2
- package/dist/components/language-defaults-base.js +81 -323
- package/dist/components/markdown.js +1 -1
- package/dist/components/sql-expr-defaults.js +77 -24
- package/dist/components/sql-expr-mode.js +282 -24951
- package/dist/components/sql-expression-fields.js +2 -2
- package/dist/components/useT9n.js +41 -2
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{app-globals-4531df03.js → app-globals-f291bf24.js} +1 -1
- package/dist/esm/arcade-defaults-5377abc7.js +345 -0
- package/dist/esm/{arcade-mode-121c8f8b.js → arcade-mode-b416088e.js} +4 -4
- package/dist/esm/arcgis-arcade-editor_6.entry.js +60 -27
- package/dist/esm/arcgis-coding-components.js +6 -6
- package/dist/esm/arcgis-sql-expression-editor.entry.js +4 -4
- package/dist/esm/arcgis-sql-expression-fields.entry.js +4 -4
- package/dist/esm/{css-f03ce15d.js → css-7dfaa788.js} +1 -1
- package/dist/esm/{cssMode-9350af4a.js → cssMode-d241d003.js} +2 -3
- package/dist/esm/{html-8a5ee186.js → html-7ffb87f8.js} +2 -3
- package/dist/esm/{htmlMode-dbcde814.js → htmlMode-ffeaf752.js} +2 -3
- package/dist/esm/{index-71c8a762.js → index-2b9dd0f5.js} +43 -15
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-b11dc132.js → javascript-347f3916.js} +3 -4
- package/dist/esm/{jsonMode-7afef1a4.js → jsonMode-25ecfd73.js} +2 -3
- package/dist/esm/{language-defaults-base-47e8d77c.js → language-defaults-base-4fef2327.js} +819 -1062
- package/dist/esm/loader.js +5 -5
- package/dist/esm/{sql-expr-defaults-fa9b2d75.js → sql-expr-defaults-e9b958fc.js} +116 -95
- package/dist/esm/sql-expr-mode-a8f41e49.js +463 -0
- package/dist/esm/{tsMode-76190ec2.js → tsMode-05c939be.js} +2 -3
- package/dist/esm/{typescript-346e9d47.js → typescript-dfb2a986.js} +2 -3
- package/dist/loader/cdn.js +2 -3
- package/dist/loader/index.cjs.js +2 -3
- package/dist/loader/index.es2017.js +2 -3
- package/dist/loader/index.js +2 -3
- package/dist/types/components/arcade-editor/arcade-editor.d.ts +13 -3
- package/dist/types/components/arcade-results/arcade-results.d.ts +1 -1
- package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +1 -1
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +1 -1
- package/dist/types/components/code-editor/code-editor.d.ts +14 -4
- package/dist/types/components/language-api-panel/language-api-panel.d.ts +1 -1
- package/dist/types/components.d.ts +13 -13
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/arcade-editor.stories.d.ts +8 -1
- package/dist/types/data/actions-runner-1/_work/arcgis-web-components/arcgis-web-components/packages/coding-packages/coding-components/.stencil/stories/internal/arcade-editor/editorContext.d.ts +5 -1
- package/dist/types/stencil-public-runtime.d.ts +3 -8
- package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +1 -0
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +1 -0
- package/dist/types/utils/arcade-monaco/arcade-profile-strategy.d.ts +9 -0
- package/dist/types/utils/fields.d.ts +2 -2
- package/dist/types/utils/profile/editor-profile.d.ts +7 -6
- package/dist/types/utils/profile/types.d.ts +53 -65
- package/dist/types/utils/profile/utils.d.ts +9 -8
- package/dist/types/utils/sql-expr-monaco/sql-expr-completion.d.ts +56 -5
- package/dist/types/utils/sql-expr-monaco/sql-expr-constants.d.ts +61 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-contribution.d.ts +1 -11
- package/dist/types/utils/sql-expr-monaco/sql-expr-defaults.d.ts +0 -1
- package/dist/types/utils/sql-expr-monaco/sql-expr-language-features.d.ts +18 -534
- package/dist/types/utils/sql-expr-monaco/sql-expr-mode.d.ts +34 -1
- package/dist/types/utils/sql-expr-monaco/sql-expr-parser-utils.d.ts +30 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-service-accessors.d.ts +19 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-diagnostic-adapter.d.ts +0 -7
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-utils.d.ts +73 -77
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation.d.ts +5 -6
- package/dist/types/utils/sql-expr-monaco/sql-expr-worker-manager.d.ts +2 -0
- package/dist/types/utils/sql-expr-monaco/sql-expr.worker.d.ts +11 -8
- package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +13 -0
- package/dist/types/utils/sql-expr-monaco/types.d.ts +30 -28
- package/package.json +19 -19
- package/dist/arcgis-coding-components/p-43da2244.js +0 -6
- package/dist/arcgis-coding-components/p-5b62a1ac.entry.js +0 -6
- package/dist/arcgis-coding-components/p-65bb8c77.js +0 -6
- package/dist/arcgis-coding-components/p-88b5d206.js +0 -6
- package/dist/arcgis-coding-components/p-cbf4fec2.js +0 -6
- package/dist/arcgis-coding-components/p-e89166f0.js +0 -7
- package/dist/cjs/arcade-defaults-56b6742a.js +0 -116
- package/dist/cjs/sql-expr-mode-74c5c2c2.js +0 -25135
- package/dist/esm/arcade-defaults-d85fe608.js +0 -111
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/sql-expr-mode-931857be.js +0 -25132
- package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
- package/dist/types/utils/sql-expr-monaco/DependentFiles/DateOnly.d.ts +0 -41
- package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlInterval.d.ts +0 -16
- package/dist/types/utils/sql-expr-monaco/DependentFiles/SqlTimestampOffset.d.ts +0 -26
- package/dist/types/utils/sql-expr-monaco/DependentFiles/TimeOnly.d.ts +0 -37
- package/dist/types/utils/sql-expr-monaco/DependentFiles/UnknownTimeZone.d.ts +0 -11
- package/dist/types/utils/sql-expr-monaco/DependentFiles/WhereGrammar.d.ts +0 -122
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlCompareUtils.d.ts +0 -5
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlDateParsingUtils.d.ts +0 -18
- package/dist/types/utils/sql-expr-monaco/DependentFiles/sqlUtils.d.ts +0 -6
- package/dist/types/utils/sql-expr-monaco/DependentFiles/standardizedFunctions.d.ts +0 -156
- package/dist/types/utils/sql-expr-monaco/DependentFiles/support.d.ts +0 -150
- package/dist/types/utils/sql-expr-monaco/PeggyGrammar/sql92grammar.d.ts +0 -1397
- package/dist/types/utils/sql-expr-monaco/libraries/date/properties/index.d.ts +0 -59
- package/dist/types/utils/sql-expr-monaco/libraries/numeric/properties/index.d.ts +0 -295
- package/dist/types/utils/sql-expr-monaco/libraries/string/properties/index.d.ts +0 -135
- package/dist/types/utils/sql-expr-monaco/sql-expr-validation-adapter.d.ts +0 -3
- package/dist/types/utils/sql-expr-profile/predefined-profile.d.ts +0 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.51
|
|
5
5
|
*/
|
|
6
6
|
// src/index.ts
|
|
7
7
|
var isAMD = typeof window !== "undefined" && "$arcgis" in window && typeof window.$arcgis === "object" && "import" in window.$arcgis && !("forceESM" in window.$arcgis);
|
|
@@ -99,9 +99,9 @@ function fieldTypeToIconName(field) {
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
|
-
* Returns the
|
|
102
|
+
* Returns the ApiValueVariable type for the given field.
|
|
103
103
|
*/
|
|
104
|
-
function
|
|
104
|
+
function fieldTypeToApiValueVarType(field) {
|
|
105
105
|
switch (field.type) {
|
|
106
106
|
case "small-integer":
|
|
107
107
|
case "integer":
|
|
@@ -152,4 +152,4 @@ function fieldAlias(field) {
|
|
|
152
152
|
return field.alias || field.name;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
export { newPortalPortalItem as a, newWebScene as b, newWebMap as c, fieldTypeToIconName as d,
|
|
155
|
+
export { newPortalPortalItem as a, newWebScene as b, newWebMap as c, fieldTypeToIconName as d, fieldTypeToApiValueVarType as e, fieldAlias as f, importArcade as g, importRequest as i, newLayersFeatureLayer as n, supportedFields as s };
|
package/dist/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.51
|
|
5
5
|
*/
|
|
6
6
|
export { setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
7
7
|
export { a as arcade } from './arcade-defaults.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.51
|
|
5
5
|
*/
|
|
6
6
|
// src/array-utils.ts
|
|
7
7
|
|
|
@@ -285,7 +285,7 @@ function langToLocale(lang) {
|
|
|
285
285
|
}
|
|
286
286
|
function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
|
|
287
287
|
let result = void 0;
|
|
288
|
-
const callback = () => void
|
|
288
|
+
const callback = () => void updateComponentLocaleState(element, assetsPath, assetName).then((newResult) => {
|
|
289
289
|
if (result?.lang !== newResult.lang || result.t9nLocale !== newResult.t9nLocale || result.t9nStrings !== newResult.t9nStrings) {
|
|
290
290
|
onUpdated(newResult);
|
|
291
291
|
}
|
|
@@ -294,7 +294,7 @@ function startLocaleObserver(element, assetsPath, onUpdated, assetName) {
|
|
|
294
294
|
callback();
|
|
295
295
|
return observeAncestorsMutation(element, ["lang"], callback);
|
|
296
296
|
}
|
|
297
|
-
async function
|
|
297
|
+
async function updateComponentLocaleState(element, assetsPath, assetName = element.tagName.toLowerCase().split("-").slice(1).join("-")) {
|
|
298
298
|
const { lang, t9nLocale } = getElementLocales(element);
|
|
299
299
|
const t9nAssetsPath = `${assetsPath}/${assetName}/t9n`;
|
|
300
300
|
const prefix = `${assetName}.t9n.`;
|
|
@@ -404,4 +404,4 @@ function isURL(url) {
|
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
|
|
407
|
-
export { Deferred as D, isNotUndefined as a, addLTRMark as b,
|
|
407
|
+
export { Deferred as D, isNotUndefined as a, addLTRMark as b, setValuesInString as c, createFilterExpression as d, getElementTheme as e, fetchT9nStringsBundle as f, generateGuid as g, isURL as h, isNotNull as i, hasSameOrigin as j, safeAsyncCall as k, devToolsAwareTimeout as l, safeCall as m, startLocaleObserver as n, observeAncestorsMutation as o, getElementLocales as p, quoteString as q, setFocusOnElement as r, supportedLocales as s, debounce as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.51
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h, Host } from '@stencil/core/internal/client';
|
|
7
7
|
import { g as generateColorizeStyles, o as onColorizeThemeChanged, c as convertMarkdownString, b as colorizedAllCodeElements } from './markdown.js';
|
|
8
8
|
import { f as filterCollection } from './utilities.js';
|
|
9
|
-
import { u as useControllerManager } from './chunk-
|
|
9
|
+
import { u as useControllerManager } from './chunk-BMBYH3VH.js';
|
|
10
10
|
import { r as setFocusOnElement, b as addLTRMark } from './index2.js';
|
|
11
11
|
import { u as useT9n } from './useT9n.js';
|
|
12
12
|
import "@esri/calcite-components/dist/components/calcite-list-item-group.js";
|
|
@@ -1,39 +1,32 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.51
|
|
5
5
|
*/
|
|
6
|
-
import {
|
|
6
|
+
import { n as newLayersFeatureLayer, i as importRequest, s as supportedFields, a as newPortalPortalItem, b as newWebScene, c as newWebMap, f as fieldAlias, d as fieldTypeToIconName, e as fieldTypeToApiValueVarType } from './fields.js';
|
|
7
7
|
import { p as portalItemPageUrl } from './utilities.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { i as isNotNull, a as isNotUndefined, b as addLTRMark, c as setValuesInString } from './index2.js';
|
|
9
|
+
import { InsertTextMode, InsertTextFormat, CompletionItemKind } from 'vscode-languageserver-types';
|
|
10
10
|
import { Emitter, Uri } from 'monaco-editor';
|
|
11
|
-
import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
|
|
12
11
|
|
|
13
12
|
//#region Type Guards
|
|
14
|
-
function
|
|
13
|
+
function isFeatureLayerLikeInstance(item) {
|
|
15
14
|
return (!!item &&
|
|
16
15
|
typeof item === "object" &&
|
|
17
16
|
"declaredClass" in item &&
|
|
18
17
|
typeof item.declaredClass === "string" &&
|
|
19
18
|
item.declaredClass.startsWith("esri.layers.") &&
|
|
20
|
-
|
|
19
|
+
isFieldsDefinition(item) &&
|
|
21
20
|
"queryFeatures" in item &&
|
|
22
21
|
typeof item.queryFeatures === "function");
|
|
23
22
|
}
|
|
24
|
-
function
|
|
23
|
+
function isGroupLayerCapable(item) {
|
|
25
24
|
return (!!item &&
|
|
26
25
|
typeof item === "object" &&
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
item.
|
|
30
|
-
|
|
31
|
-
function isGroupLayerInstance(item) {
|
|
32
|
-
return (!!item &&
|
|
33
|
-
typeof item === "object" &&
|
|
34
|
-
"declaredClass" in item &&
|
|
35
|
-
typeof item.declaredClass === "string" &&
|
|
36
|
-
item.declaredClass === "esri.layers.GroupLayer");
|
|
26
|
+
"allLayers" in item &&
|
|
27
|
+
"allTables" in item &&
|
|
28
|
+
typeof item.allLayers === "object" &&
|
|
29
|
+
typeof item.allTables === "object");
|
|
37
30
|
}
|
|
38
31
|
function isMapInstance(item) {
|
|
39
32
|
return (!!item &&
|
|
@@ -44,14 +37,8 @@ function isMapInstance(item) {
|
|
|
44
37
|
item.declaredClass === "esri.WebMap" ||
|
|
45
38
|
item.declaredClass === "esri.WebScene"));
|
|
46
39
|
}
|
|
47
|
-
function
|
|
48
|
-
return item
|
|
49
|
-
}
|
|
50
|
-
function isWebSceneInstance(item) {
|
|
51
|
-
return item.declaredClass === "esri.WebScene";
|
|
52
|
-
}
|
|
53
|
-
function isLoadableMapInstance(item) {
|
|
54
|
-
return item.declaredClass === "esri.WebMap" || item.declaredClass === "esri.WebScene";
|
|
40
|
+
function isLoadAllCapable(item) {
|
|
41
|
+
return !!item && typeof item === "object" && "loadAll" in item && typeof item.loadAll === "function";
|
|
55
42
|
}
|
|
56
43
|
function isPortalItemDefinition(item) {
|
|
57
44
|
return !!item && typeof item === "object" && "portalItem" in item && item.portalItem != null;
|
|
@@ -68,6 +55,15 @@ function isUrlDefinition(item) {
|
|
|
68
55
|
function isSupportedServiceUrlDefinition(item) {
|
|
69
56
|
return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
|
|
70
57
|
}
|
|
58
|
+
function isFeatureDefinition(item) {
|
|
59
|
+
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
60
|
+
}
|
|
61
|
+
function isFeatureSetDefinition(item) {
|
|
62
|
+
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
63
|
+
}
|
|
64
|
+
function isFeatureSetCollectionDefinition(item) {
|
|
65
|
+
return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
|
|
66
|
+
}
|
|
71
67
|
function isSubtypeInstance(item) {
|
|
72
68
|
return (!!item &&
|
|
73
69
|
typeof item === "object" &&
|
|
@@ -116,6 +112,9 @@ function isSubtypeFieldCapableLayer(item) {
|
|
|
116
112
|
function isSubtypesCapableLayer(item) {
|
|
117
113
|
return isSubtypeFieldCapableLayer(item) && "subtypes" in item;
|
|
118
114
|
}
|
|
115
|
+
function isPortalItemCapable(item) {
|
|
116
|
+
return !!item && typeof item === "object" && "portalItem" in item;
|
|
117
|
+
}
|
|
119
118
|
function isRelationshipsCapableLayer(item) {
|
|
120
119
|
return (isLayerIdCapableSource(item) &&
|
|
121
120
|
"relationships" in item &&
|
|
@@ -196,14 +195,6 @@ function sortFields(layer) {
|
|
|
196
195
|
if (secondField.type === "oid") {
|
|
197
196
|
return 1;
|
|
198
197
|
}
|
|
199
|
-
if (isSubtypeSublayerInstance(layer)) {
|
|
200
|
-
if (firstField.name === layer.parent.subtypeField) {
|
|
201
|
-
return -1;
|
|
202
|
-
}
|
|
203
|
-
if (secondField.name === layer.parent.subtypeField) {
|
|
204
|
-
return 1;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
198
|
if (isSubtypeFieldCapableLayer(layer)) {
|
|
208
199
|
if (firstField.name === layer.subtypeField) {
|
|
209
200
|
return -1;
|
|
@@ -241,86 +232,28 @@ function assembleMemberExpression(obj, prop) {
|
|
|
241
232
|
return `${obj}${getMemberExpressionProperty(prop)}`;
|
|
242
233
|
}
|
|
243
234
|
function getMapPortalItem(map) {
|
|
244
|
-
if (
|
|
235
|
+
if (isPortalItemCapable(map)) {
|
|
245
236
|
return map.portalItem;
|
|
246
237
|
}
|
|
247
238
|
return null;
|
|
248
239
|
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
case "dictionary":
|
|
255
|
-
return await dictionaryToLSDictionary(editorVariable, kind);
|
|
256
|
-
case "feature":
|
|
257
|
-
return await featureToLSFeature(editorVariable, kind);
|
|
258
|
-
default:
|
|
259
|
-
return variableToLSVariable(editorVariable, kind);
|
|
260
|
-
}
|
|
261
|
-
}));
|
|
262
|
-
}
|
|
263
|
-
function variableToLSVariable(editorVariable, kind) {
|
|
264
|
-
const { name, type } = editorVariable;
|
|
265
|
-
const description = editorVariable.getDescription();
|
|
266
|
-
return {
|
|
267
|
-
name,
|
|
268
|
-
description,
|
|
269
|
-
type,
|
|
270
|
-
completion: {
|
|
271
|
-
label: name,
|
|
272
|
-
detail: name,
|
|
273
|
-
insertText: name,
|
|
274
|
-
insertTextMode: InsertTextMode.asIs,
|
|
275
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
276
|
-
kind,
|
|
277
|
-
documentation: { kind: "markdown", value: description },
|
|
278
|
-
},
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
async function featureToLSFeature(editorFeature, kind) {
|
|
282
|
-
// Get the source for the definition
|
|
283
|
-
const source = await editorFeature.loadSource();
|
|
284
|
-
const { name } = editorFeature;
|
|
285
|
-
const description = editorFeature.getDescription();
|
|
286
|
-
const resultCompletion = {
|
|
287
|
-
label: name,
|
|
288
|
-
detail: name,
|
|
289
|
-
insertText: name,
|
|
290
|
-
insertTextMode: InsertTextMode.asIs,
|
|
291
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
292
|
-
kind,
|
|
293
|
-
};
|
|
294
|
-
const result = {
|
|
295
|
-
name,
|
|
296
|
-
description,
|
|
297
|
-
type: "dictionary",
|
|
298
|
-
properties: [],
|
|
299
|
-
completion: resultCompletion,
|
|
300
|
-
};
|
|
301
|
-
// No source definition, then it will be a feature without any known fields
|
|
302
|
-
if (!source) {
|
|
303
|
-
return result;
|
|
304
|
-
}
|
|
305
|
-
// Create properties for the fields and the aliases
|
|
306
|
-
// Also improve the feature completion documentation
|
|
307
|
-
let featureCompletionDescription = description;
|
|
240
|
+
/**
|
|
241
|
+
* converts fields to profile values and calculates the feature completion description all in one iteration
|
|
242
|
+
*/
|
|
243
|
+
function fieldsToProfileValues(fields, initialFeatureCompletionDescription, includeAliases = false) {
|
|
244
|
+
let featureCompletionDescription = initialFeatureCompletionDescription;
|
|
308
245
|
const fieldProfileValues = [];
|
|
309
246
|
const aliasProfileValues = [];
|
|
310
|
-
supportedFields(
|
|
311
|
-
let fieldCompletionDescription = `**${field.name}** \n${field.type}`;
|
|
312
|
-
if (field.description) {
|
|
313
|
-
fieldCompletionDescription += ` \n'${field.description}`;
|
|
314
|
-
}
|
|
247
|
+
supportedFields(fields).forEach((field) => {
|
|
315
248
|
if (featureCompletionDescription) {
|
|
316
249
|
featureCompletionDescription += " \n \n";
|
|
317
250
|
}
|
|
318
|
-
featureCompletionDescription += `**${field.name}** (${
|
|
251
|
+
featureCompletionDescription += `**${field.name}** (${field.alias}) \n${field.type}`;
|
|
319
252
|
if (field.description) {
|
|
320
253
|
featureCompletionDescription += ` \n'${field.description}`;
|
|
321
254
|
}
|
|
322
255
|
// The property for the field
|
|
323
|
-
const type =
|
|
256
|
+
const type = fieldTypeToApiValueVarType(field);
|
|
324
257
|
const insertText = getMemberExpressionProperty(field.name, false);
|
|
325
258
|
const description = fieldAlias(field);
|
|
326
259
|
fieldProfileValues.push({
|
|
@@ -334,65 +267,35 @@ async function featureToLSFeature(editorFeature, kind) {
|
|
|
334
267
|
insertTextMode: InsertTextMode.asIs,
|
|
335
268
|
insertTextFormat: InsertTextFormat.PlainText,
|
|
336
269
|
kind: CompletionItemKind.Field,
|
|
337
|
-
documentation: { kind: "markdown", value: fieldCompletionDescription },
|
|
338
270
|
},
|
|
339
271
|
});
|
|
340
|
-
if (
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
272
|
+
if (includeAliases) {
|
|
273
|
+
if (!field.alias || field.alias.toLowerCase() === field.name.toLowerCase()) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// The property for the alias if different than the field name
|
|
277
|
+
let aliasCompletionDescription = `**${field.alias}** \n${field.type}`;
|
|
278
|
+
if (field.description) {
|
|
279
|
+
aliasCompletionDescription += ` \n'${field.description}`;
|
|
280
|
+
}
|
|
281
|
+
aliasProfileValues.push({
|
|
282
|
+
name: field.alias,
|
|
283
|
+
description: field.name,
|
|
284
|
+
type,
|
|
285
|
+
completion: {
|
|
286
|
+
label: field.alias,
|
|
287
|
+
detail: field.name,
|
|
288
|
+
insertText,
|
|
289
|
+
insertTextMode: InsertTextMode.asIs,
|
|
290
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
291
|
+
kind: CompletionItemKind.Field,
|
|
292
|
+
documentation: { kind: "markdown", value: aliasCompletionDescription },
|
|
293
|
+
},
|
|
294
|
+
});
|
|
347
295
|
}
|
|
348
|
-
aliasProfileValues.push({
|
|
349
|
-
name: field.alias,
|
|
350
|
-
description: field.name,
|
|
351
|
-
type,
|
|
352
|
-
completion: {
|
|
353
|
-
label: field.alias,
|
|
354
|
-
detail: field.name,
|
|
355
|
-
insertText,
|
|
356
|
-
insertTextMode: InsertTextMode.asIs,
|
|
357
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
358
|
-
kind: CompletionItemKind.Field,
|
|
359
|
-
documentation: { kind: "markdown", value: aliasCompletionDescription },
|
|
360
|
-
},
|
|
361
|
-
});
|
|
362
296
|
});
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
return result;
|
|
366
|
-
}
|
|
367
|
-
async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
368
|
-
const { name, dictionaryVariables: variables } = editorDictionary;
|
|
369
|
-
const description = editorDictionary.getDescription();
|
|
370
|
-
const completionDescription = variables.reduce((previous, p) => {
|
|
371
|
-
if (previous !== "") {
|
|
372
|
-
previous += " \n \n";
|
|
373
|
-
}
|
|
374
|
-
previous += `**${p.name}** \n${p.type}`;
|
|
375
|
-
const description = p.getDescription();
|
|
376
|
-
if (description) {
|
|
377
|
-
previous += ` \n${description}`;
|
|
378
|
-
}
|
|
379
|
-
return previous;
|
|
380
|
-
}, description);
|
|
381
|
-
return {
|
|
382
|
-
name,
|
|
383
|
-
description,
|
|
384
|
-
type: "dictionary",
|
|
385
|
-
properties: await variablesToLSVariable(variables, CompletionItemKind.Field),
|
|
386
|
-
completion: {
|
|
387
|
-
label: name,
|
|
388
|
-
detail: name,
|
|
389
|
-
insertText: name,
|
|
390
|
-
insertTextMode: InsertTextMode.asIs,
|
|
391
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
392
|
-
kind,
|
|
393
|
-
documentation: { kind: "markdown", value: completionDescription },
|
|
394
|
-
},
|
|
395
|
-
};
|
|
297
|
+
const properties = [...fieldProfileValues, ...aliasProfileValues];
|
|
298
|
+
return [properties, featureCompletionDescription];
|
|
396
299
|
}
|
|
397
300
|
/**
|
|
398
301
|
* Represents a item in the EditorProfile. The profile is converted into an optimized way for
|
|
@@ -926,7 +829,7 @@ class SourceBasedVariable extends CollectionBasedVariable {
|
|
|
926
829
|
const relationshipsGroup = new GroupOfVariables(this._profile, { code: "relationships" });
|
|
927
830
|
const relationshipItems = await Promise.all(source.relationships.map(async (relationship) => {
|
|
928
831
|
const relatedLayer = await getRelatedFeatureLayer(source, relationship);
|
|
929
|
-
if (!
|
|
832
|
+
if (!isFeatureLayerLikeInstance(relatedLayer)) {
|
|
930
833
|
return null;
|
|
931
834
|
}
|
|
932
835
|
if (relationship.relatedTableId === this.relationshipsProperties?.sourceTableId) {
|
|
@@ -970,7 +873,7 @@ class FeatureVariable extends SourceBasedVariable {
|
|
|
970
873
|
throw new Error("Invalid definition");
|
|
971
874
|
}
|
|
972
875
|
// The title group and snippet
|
|
973
|
-
const title = isTitleCapableSource(this._source) ? this._source.title ?? "" : "";
|
|
876
|
+
const title = isTitleCapableSource(this._source) ? (this._source.title ?? "") : "";
|
|
974
877
|
this.variables.push(new GroupOfVariables(this._profile, title, [
|
|
975
878
|
new ValueVariable({
|
|
976
879
|
profile: this._profile,
|
|
@@ -1097,13 +1000,14 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
|
|
|
1097
1000
|
if (typeof this._featureSetCollections.source === "string") {
|
|
1098
1001
|
return this._profile?.intlStrings.featureservice ?? "featureservice";
|
|
1099
1002
|
}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1003
|
+
switch (this._featureSetCollections.source.declaredClass) {
|
|
1004
|
+
case "esri.WebMap":
|
|
1005
|
+
return this._profile?.intlStrings.webmap ?? "webmap";
|
|
1006
|
+
case "esri.WebScene":
|
|
1007
|
+
return this._profile?.intlStrings.webscene ?? "webscene";
|
|
1008
|
+
default:
|
|
1009
|
+
return this._profile?.intlStrings.map ?? "map";
|
|
1105
1010
|
}
|
|
1106
|
-
return this._profile?.intlStrings.map ?? "map";
|
|
1107
1011
|
}
|
|
1108
1012
|
async loadSource() {
|
|
1109
1013
|
if (isNotNull(this._loadPromise) && isNotUndefined(this._loadPromise)) {
|
|
@@ -1170,7 +1074,7 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
|
|
|
1170
1074
|
return null;
|
|
1171
1075
|
}
|
|
1172
1076
|
async _featureSetCollectionFromMap(map) {
|
|
1173
|
-
if (
|
|
1077
|
+
if (isLoadAllCapable(map)) {
|
|
1174
1078
|
// Make sure the map is loaded
|
|
1175
1079
|
await map.loadAll();
|
|
1176
1080
|
}
|
|
@@ -1228,11 +1132,11 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
|
|
|
1228
1132
|
.toArray()
|
|
1229
1133
|
.reverse()
|
|
1230
1134
|
.forEach((layer) => {
|
|
1231
|
-
if (
|
|
1135
|
+
if (isFeatureLayerLikeInstance(layer)) {
|
|
1232
1136
|
layerVariables.push(this._createFeatureSetVariable(layer, true));
|
|
1233
1137
|
return;
|
|
1234
1138
|
}
|
|
1235
|
-
if (
|
|
1139
|
+
if (isGroupLayerCapable(layer)) {
|
|
1236
1140
|
const groupLayerVariables = filteringTables
|
|
1237
1141
|
? this._convertWebMapLayersToVariables(layer.allTables, true)
|
|
1238
1142
|
: this._convertWebMapLayersToVariables(layer.allLayers);
|
|
@@ -1241,31 +1145,31 @@ class FeatureSetCollectionVariable extends CollectionBasedVariable {
|
|
|
1241
1145
|
});
|
|
1242
1146
|
return layerVariables;
|
|
1243
1147
|
}
|
|
1244
|
-
_createFeatureSetVariable(
|
|
1148
|
+
_createFeatureSetVariable(featureLayerLike, isFromWebMap = false) {
|
|
1245
1149
|
return new FeatureSetVariable(this, {
|
|
1246
1150
|
profile: this._profile,
|
|
1247
|
-
declaration: { name:
|
|
1151
|
+
declaration: { name: featureLayerLike.title, definition: featureLayerLike },
|
|
1248
1152
|
label: isFromWebMap
|
|
1249
|
-
?
|
|
1250
|
-
:
|
|
1153
|
+
? featureLayerLike.title
|
|
1154
|
+
: (featureLayerLike.sourceJSON.name ?? featureLayerLike.title),
|
|
1251
1155
|
description: "",
|
|
1252
1156
|
nonInteractive: true,
|
|
1253
|
-
}, this._makeFeatureSetSnippets(
|
|
1157
|
+
}, this._makeFeatureSetSnippets(featureLayerLike, isFromWebMap));
|
|
1254
1158
|
}
|
|
1255
|
-
_makeFeatureSetSnippets(
|
|
1159
|
+
_makeFeatureSetSnippets(featureLayerLike, isFromWebMap = false) {
|
|
1256
1160
|
if (!this._profile?.supportFeatureSetFunctions) {
|
|
1257
1161
|
return [];
|
|
1258
1162
|
}
|
|
1259
1163
|
if (isFromWebMap) {
|
|
1260
|
-
const snippetById = `FeatureSetById(${this.snippet}, "${
|
|
1261
|
-
const snippetByName = `FeatureSetByName(${this.snippet}, "${
|
|
1164
|
+
const snippetById = `FeatureSetById(${this.snippet}, "${featureLayerLike.id}")`;
|
|
1165
|
+
const snippetByName = `FeatureSetByName(${this.snippet}, "${featureLayerLike.title}")`;
|
|
1262
1166
|
return [
|
|
1263
1167
|
new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById }),
|
|
1264
1168
|
new ValueVariable({ profile: this._profile, label: snippetByName, description: "", snippet: snippetByName }),
|
|
1265
1169
|
];
|
|
1266
1170
|
}
|
|
1267
1171
|
else {
|
|
1268
|
-
const snippetById = `FeatureSetById(${this.snippet}, "${
|
|
1172
|
+
const snippetById = `FeatureSetById(${this.snippet}, "${featureLayerLike.layerId}")`;
|
|
1269
1173
|
return [new ValueVariable({ profile: this._profile, label: snippetById, description: "", snippet: snippetById })];
|
|
1270
1174
|
}
|
|
1271
1175
|
}
|
|
@@ -1303,14 +1207,6 @@ class EditorProfile extends DictionaryVariable {
|
|
|
1303
1207
|
get supportFeatureSetFunctions() {
|
|
1304
1208
|
return this.definition?.bundles?.includes("data-access") ?? false;
|
|
1305
1209
|
}
|
|
1306
|
-
/**
|
|
1307
|
-
* Returns the language service profile. It is different than the editor profile as it is optimized for Monaco.
|
|
1308
|
-
*/
|
|
1309
|
-
async toLSProfile() {
|
|
1310
|
-
const { apiVersion, bundles, hiddenApiItems } = this.definition ?? {};
|
|
1311
|
-
const variables = await variablesToLSVariable(this.dictionaryVariables);
|
|
1312
|
-
return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
|
|
1313
|
-
}
|
|
1314
1210
|
/**
|
|
1315
1211
|
* Returns the EditorProfile as a json. The EditorProfile may have been updated. This function allows to
|
|
1316
1212
|
* get the new json representing mutations.
|
|
@@ -1324,144 +1220,6 @@ class EditorProfile extends DictionaryVariable {
|
|
|
1324
1220
|
}
|
|
1325
1221
|
//#endregion
|
|
1326
1222
|
|
|
1327
|
-
function isFeatureDefinition(item) {
|
|
1328
|
-
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
1329
|
-
}
|
|
1330
|
-
function isFeatureSetDefinition(item) {
|
|
1331
|
-
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
1332
|
-
}
|
|
1333
|
-
function isFeatureSetCollectionDefinition(item) {
|
|
1334
|
-
return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
|
|
1335
|
-
}
|
|
1336
|
-
/**
|
|
1337
|
-
* Get a PredefinedProfile for a locale. If not already loaded then fetch it.
|
|
1338
|
-
* If the locale doesn't exist or the locale profile file doesn't exist then returns
|
|
1339
|
-
* the english version of the profile.
|
|
1340
|
-
*/
|
|
1341
|
-
async function getSdkPredefinedProfiles(locale = "en") {
|
|
1342
|
-
const profiles = sdkPredefinedProfilesMap.get(locale);
|
|
1343
|
-
if (profiles) {
|
|
1344
|
-
return profiles;
|
|
1345
|
-
}
|
|
1346
|
-
if (!supportedLocales.has(locale)) {
|
|
1347
|
-
return await getSdkPredefinedProfiles("en");
|
|
1348
|
-
}
|
|
1349
|
-
try {
|
|
1350
|
-
const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
|
|
1351
|
-
if (response.ok) {
|
|
1352
|
-
return cacheSdkPredefinedProfiles(locale, (await response.json()));
|
|
1353
|
-
}
|
|
1354
|
-
if (locale === "en") {
|
|
1355
|
-
return null;
|
|
1356
|
-
}
|
|
1357
|
-
return await getSdkPredefinedProfiles("en");
|
|
1358
|
-
}
|
|
1359
|
-
catch {
|
|
1360
|
-
return null;
|
|
1361
|
-
}
|
|
1362
|
-
}
|
|
1363
|
-
const sdkPredefinedProfilesMap = new Map();
|
|
1364
|
-
/**
|
|
1365
|
-
* Convert a stored profile into a PredefinedProfile and add it to the in-memory
|
|
1366
|
-
* Map of profiles per locale.
|
|
1367
|
-
*/
|
|
1368
|
-
function cacheSdkPredefinedProfiles(locale, profiles) {
|
|
1369
|
-
const map = new Map();
|
|
1370
|
-
profiles.forEach((profile) => {
|
|
1371
|
-
map.set(profile.id, profile);
|
|
1372
|
-
});
|
|
1373
|
-
sdkPredefinedProfilesMap.set(locale, map);
|
|
1374
|
-
return map;
|
|
1375
|
-
}
|
|
1376
|
-
async function getSdkPredefinedProfile(id, locale = "en") {
|
|
1377
|
-
const profiles = await getSdkPredefinedProfiles(locale);
|
|
1378
|
-
return profiles?.get(id) ?? null;
|
|
1379
|
-
}
|
|
1380
|
-
function isExtendedPredefinedProfileDefinition(item) {
|
|
1381
|
-
return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
|
|
1382
|
-
}
|
|
1383
|
-
function convertApiVariables(variables) {
|
|
1384
|
-
return variables?.map(convertApiVariable);
|
|
1385
|
-
}
|
|
1386
|
-
function convertApiVariable(variable) {
|
|
1387
|
-
switch (variable.type) {
|
|
1388
|
-
case "dictionary":
|
|
1389
|
-
return {
|
|
1390
|
-
...variable,
|
|
1391
|
-
type: variable.type,
|
|
1392
|
-
properties: convertApiVariables(variable.properties),
|
|
1393
|
-
};
|
|
1394
|
-
case "array": {
|
|
1395
|
-
return {
|
|
1396
|
-
...variable,
|
|
1397
|
-
type: variable.type,
|
|
1398
|
-
elementType: { type: "number", name: "number" },
|
|
1399
|
-
};
|
|
1400
|
-
}
|
|
1401
|
-
default:
|
|
1402
|
-
return { ...variable, type: variable.type };
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
|
|
1406
|
-
if (!isPredefinedProfile(predefinedProfile)) {
|
|
1407
|
-
return undefined;
|
|
1408
|
-
}
|
|
1409
|
-
const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
|
|
1410
|
-
if (!sdkPredefinedProfile) {
|
|
1411
|
-
return undefined;
|
|
1412
|
-
}
|
|
1413
|
-
const editorProfile = {
|
|
1414
|
-
bundles: [...sdkPredefinedProfile.bundles],
|
|
1415
|
-
variables: [],
|
|
1416
|
-
hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
|
|
1417
|
-
};
|
|
1418
|
-
// Merge the SDK variables' definitions/properties with the predefined profile definitions.
|
|
1419
|
-
sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
|
|
1420
|
-
// Don't include disabled variables
|
|
1421
|
-
if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
|
|
1422
|
-
return;
|
|
1423
|
-
}
|
|
1424
|
-
// Try to get a definition from the predefined profile, for the variable that needs one.
|
|
1425
|
-
const definition = predefinedProfile.definitions[predefinedVariable.name];
|
|
1426
|
-
// Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
|
|
1427
|
-
// despite the type checking from the switch statement.
|
|
1428
|
-
switch (predefinedVariable.type) {
|
|
1429
|
-
case "dictionary": {
|
|
1430
|
-
// For dictionary, we support properties overrride
|
|
1431
|
-
return editorProfile.variables.push(convertApiVariable({
|
|
1432
|
-
...predefinedVariable,
|
|
1433
|
-
type: predefinedVariable.type,
|
|
1434
|
-
properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
|
|
1435
|
-
}));
|
|
1436
|
-
}
|
|
1437
|
-
case "feature":
|
|
1438
|
-
// If the definition is not valid, then we don't include it.
|
|
1439
|
-
if (!isFeatureDefinition(definition)) {
|
|
1440
|
-
return;
|
|
1441
|
-
}
|
|
1442
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
1443
|
-
case "featureSet":
|
|
1444
|
-
// If the definition is not valid, then we don't include it.
|
|
1445
|
-
if (!isFeatureSetDefinition(definition)) {
|
|
1446
|
-
return;
|
|
1447
|
-
}
|
|
1448
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
1449
|
-
case "featureSetCollection":
|
|
1450
|
-
// If the definition is not valid, then we don't include it.
|
|
1451
|
-
if (!isFeatureSetCollectionDefinition(definition)) {
|
|
1452
|
-
return;
|
|
1453
|
-
}
|
|
1454
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
1455
|
-
default:
|
|
1456
|
-
return editorProfile.variables.push(convertApiVariable(predefinedVariable));
|
|
1457
|
-
}
|
|
1458
|
-
});
|
|
1459
|
-
if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
|
|
1460
|
-
editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
|
|
1461
|
-
}
|
|
1462
|
-
return editorProfile;
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
1223
|
// this file contains the building blocks for a language default provider
|
|
1466
1224
|
const defaultContext = {
|
|
1467
1225
|
locale: "en",
|
|
@@ -1548,4 +1306,4 @@ class LanguageDefaultsBase {
|
|
|
1548
1306
|
}
|
|
1549
1307
|
}
|
|
1550
1308
|
|
|
1551
|
-
export { EditorProfile as E, LanguageDefaultsBase as L,
|
|
1309
|
+
export { EditorProfile as E, LanguageDefaultsBase as L, isFeatureSetCollectionDefinition as a, isFeatureSetDefinition as b, isFeatureDefinition as c, fieldsToProfileValues as f, isPredefinedProfile as i };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
-
* v4.31.0-next.
|
|
4
|
+
* v4.31.0-next.51
|
|
5
5
|
*/
|
|
6
6
|
import { editor } from 'monaco-editor';
|
|
7
7
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|