@arcgis/coding-components 4.31.0-next.10 → 4.31.0-next.11
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/arcgis-coding-components/arcgis-coding-components.esm.js +2 -2
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-da9431ba.js → p-21306a37.js} +2 -2
- package/dist/arcgis-coding-components/{p-f452d4b8.entry.js → p-29b05690.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-2db85972.js +6 -0
- package/dist/arcgis-coding-components/{p-8196fa73.js → p-2f2288de.js} +2 -2
- package/dist/arcgis-coding-components/{p-923858b5.js → p-4050b5db.js} +2 -2
- package/dist/arcgis-coding-components/{p-960aa9dc.js → p-44052160.js} +2 -2
- package/dist/arcgis-coding-components/{p-767b17ee.entry.js → p-47bb2fdc.entry.js} +2 -2
- package/dist/arcgis-coding-components/p-4fcb5bf0.js +6 -0
- package/dist/arcgis-coding-components/{p-ad75160d.js → p-79e7d01c.js} +3 -3
- package/dist/arcgis-coding-components/{p-02cae55d.js → p-aedf8504.js} +3 -3
- package/dist/arcgis-coding-components/{p-790067b1.js → p-af7ed920.js} +12 -12
- package/dist/arcgis-coding-components/{p-6e28fd70.js → p-c28eef63.js} +2 -2
- package/dist/arcgis-coding-components/{p-22253750.js → p-ca85726f.js} +1 -1
- package/dist/arcgis-coding-components/{p-193ac44f.js → p-cdc11558.js} +1 -1
- package/dist/arcgis-coding-components/{p-8cf09bcc.js → p-decda64c.js} +1 -1
- package/dist/arcgis-coding-components/p-e6442988.js +6 -0
- package/dist/arcgis-coding-components/{p-4fc79a07.entry.js → p-eb99e7e7.entry.js} +2 -2
- package/dist/arcgis-coding-components/{p-ab78d6c4.js → p-ef0c4126.js} +3 -3
- package/dist/arcgis-coding-components/{p-025fda85.js → p-fa824326.js} +2 -2
- package/dist/cjs/{app-globals-bade840e.js → app-globals-d8d56a70.js} +1 -1
- package/dist/cjs/arcade-defaults-b1300c3f.js +349 -0
- package/dist/cjs/{arcade-language-features-747fb1da.js → arcade-language-features-5c4510c9.js} +2 -2
- package/dist/cjs/{arcade-mode-dce44622.js → arcade-mode-185370a7.js} +3 -4
- package/dist/cjs/arcgis-arcade-editor_6.cjs.entry.js +6 -6
- package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
- 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-077ba0c5.js → css-0d91050a.js} +1 -1
- package/dist/cjs/{cssMode-7f2030db.js → cssMode-e8786e83.js} +2 -3
- package/dist/cjs/{html-e3a243e9.js → html-adbae3fd.js} +2 -3
- package/dist/cjs/{htmlMode-c273d6dc.js → htmlMode-608f8da7.js} +2 -3
- package/dist/cjs/{index-37a86ff4.js → index-1cf75f2d.js} +1 -1
- package/dist/cjs/index.cjs.js +4 -4
- package/dist/cjs/{javascript-7a33cca7.js → javascript-c8733e40.js} +3 -4
- package/dist/cjs/{jsonMode-6b4e0850.js → jsonMode-98ec5315.js} +2 -3
- package/dist/cjs/{language-defaults-base-b32cb091.js → language-defaults-base-2b2f9d3e.js} +800 -1024
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{sql-expr-defaults-8a5834f3.js → sql-expr-defaults-a1d5380d.js} +55 -4
- package/dist/cjs/{sql-expr-mode-a72a1f92.js → sql-expr-mode-19618e11.js} +5 -5
- package/dist/cjs/{tsMode-c2edcd57.js → tsMode-ed34ec8f.js} +2 -3
- package/dist/cjs/{typescript-c50c5516.js → typescript-c3d83864.js} +2 -3
- package/dist/components/arcade-defaults.js +238 -4
- package/dist/components/arcade-language-features.js +1 -1
- package/dist/components/arcade-mode.js +1 -1
- package/dist/components/arcade-results.js +2 -2
- package/dist/components/arcade-suggestions.js +1 -1
- package/dist/components/arcade-variables.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +1 -1
- 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 +1 -1
- package/dist/components/arcgis-assets.js +1 -1
- 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 +1 -1
- package/dist/components/arcgis-sql-expression-fields.js +1 -1
- package/dist/components/chunk-3IUJHIAA.js +1 -1
- package/dist/components/code-editor.js +1 -1
- package/dist/components/fields.js +4 -4
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/language-api-panel.js +1 -1
- package/dist/components/language-defaults-base.js +47 -273
- package/dist/components/markdown.js +1 -1
- package/dist/components/sql-expr-defaults.js +55 -4
- package/dist/components/sql-expr-mode.js +1 -1
- package/dist/components/sql-expression-fields.js +1 -1
- package/dist/components/useT9n.js +1 -1
- package/dist/components/utilities.js +1 -1
- package/dist/esm/{app-globals-ed47e16d.js → app-globals-a48930ca.js} +1 -1
- package/dist/esm/arcade-defaults-3ea67051.js +344 -0
- package/dist/esm/{arcade-language-features-8edb3527.js → arcade-language-features-8274cdc7.js} +2 -2
- package/dist/esm/{arcade-mode-ad036f46.js → arcade-mode-c48c3fc6.js} +3 -4
- package/dist/esm/arcgis-arcade-editor_6.entry.js +6 -6
- package/dist/esm/arcgis-coding-components.js +4 -4
- 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-810518f1.js → css-4f85f426.js} +1 -1
- package/dist/esm/{cssMode-a7208024.js → cssMode-d655f1b9.js} +2 -3
- package/dist/esm/{html-e187d7d8.js → html-dd1552df.js} +2 -3
- package/dist/esm/{htmlMode-06b7bae2.js → htmlMode-0b7c2367.js} +2 -3
- package/dist/esm/{index-3743d31f.js → index-38d652b8.js} +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/{javascript-04a3f866.js → javascript-ef70f152.js} +3 -4
- package/dist/esm/{jsonMode-ee8bb2ea.js → jsonMode-a6ed58a5.js} +2 -3
- package/dist/esm/{language-defaults-base-52a397f5.js → language-defaults-base-77487def.js} +797 -1024
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{sql-expr-defaults-f7c2d5ef.js → sql-expr-defaults-54db53a8.js} +55 -4
- package/dist/esm/{sql-expr-mode-433b4a39.js → sql-expr-mode-5c1d43ea.js} +5 -5
- package/dist/esm/{tsMode-c80c462e.js → tsMode-fce6766b.js} +2 -3
- package/dist/esm/{typescript-a9b8caa7.js → typescript-aed3d402.js} +2 -3
- package/dist/loader/cdn.js +1 -1
- package/dist/loader/index.cjs.js +1 -1
- package/dist/loader/index.es2017.js +1 -1
- package/dist/loader/index.js +1 -1
- 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 +3 -0
- package/dist/types/utils/profile/utils.d.ts +4 -0
- package/dist/types/utils/sql-expr-monaco/sql-expression-profile-strategy.d.ts +9 -0
- package/package.json +10 -10
- package/dist/arcgis-coding-components/p-50484a4f.js +0 -6
- package/dist/arcgis-coding-components/p-7164c348.js +0 -6
- package/dist/arcgis-coding-components/p-9956a574.js +0 -6
- package/dist/cjs/arcade-defaults-8b8d6c07.js +0 -116
- package/dist/esm/arcade-defaults-562fe19b.js +0 -111
- package/dist/types/utils/profile/predefined-profile.d.ts +0 -4
- 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.11
|
|
5
5
|
*/
|
|
6
6
|
// src/array-utils.ts
|
|
7
7
|
|
|
@@ -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,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.11
|
|
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';
|
|
@@ -1,14 +1,13 @@
|
|
|
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.11
|
|
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
13
|
function isFeatureLayerLikeInstance(item) {
|
|
@@ -56,6 +55,15 @@ function isUrlDefinition(item) {
|
|
|
56
55
|
function isSupportedServiceUrlDefinition(item) {
|
|
57
56
|
return isUrlDefinition(item) && /\/(?:featureserver|mapserver)(?:\/|$)/iu.test(item.url);
|
|
58
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
|
+
}
|
|
59
67
|
function isSubtypeInstance(item) {
|
|
60
68
|
return (!!item &&
|
|
61
69
|
typeof item === "object" &&
|
|
@@ -229,81 +237,23 @@ function getMapPortalItem(map) {
|
|
|
229
237
|
}
|
|
230
238
|
return null;
|
|
231
239
|
}
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
case "dictionary":
|
|
238
|
-
return await dictionaryToLSDictionary(editorVariable, kind);
|
|
239
|
-
case "feature":
|
|
240
|
-
return await featureToLSFeature(editorVariable, kind);
|
|
241
|
-
default:
|
|
242
|
-
return variableToLSVariable(editorVariable, kind);
|
|
243
|
-
}
|
|
244
|
-
}));
|
|
245
|
-
}
|
|
246
|
-
function variableToLSVariable(editorVariable, kind) {
|
|
247
|
-
const { name, type } = editorVariable;
|
|
248
|
-
const description = editorVariable.getDescription();
|
|
249
|
-
return {
|
|
250
|
-
name,
|
|
251
|
-
description,
|
|
252
|
-
type,
|
|
253
|
-
completion: {
|
|
254
|
-
label: name,
|
|
255
|
-
detail: name,
|
|
256
|
-
insertText: name,
|
|
257
|
-
insertTextMode: InsertTextMode.asIs,
|
|
258
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
259
|
-
kind,
|
|
260
|
-
documentation: { kind: "markdown", value: description },
|
|
261
|
-
},
|
|
262
|
-
};
|
|
263
|
-
}
|
|
264
|
-
async function featureToLSFeature(editorFeature, kind) {
|
|
265
|
-
// Get the source for the definition
|
|
266
|
-
const source = await editorFeature.loadSource();
|
|
267
|
-
const { name } = editorFeature;
|
|
268
|
-
const description = editorFeature.getDescription();
|
|
269
|
-
const resultCompletion = {
|
|
270
|
-
label: name,
|
|
271
|
-
detail: name,
|
|
272
|
-
insertText: name,
|
|
273
|
-
insertTextMode: InsertTextMode.asIs,
|
|
274
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
275
|
-
kind,
|
|
276
|
-
};
|
|
277
|
-
const result = {
|
|
278
|
-
name,
|
|
279
|
-
description,
|
|
280
|
-
type: "dictionary",
|
|
281
|
-
properties: [],
|
|
282
|
-
completion: resultCompletion,
|
|
283
|
-
};
|
|
284
|
-
// No source definition, then it will be a feature without any known fields
|
|
285
|
-
if (!source) {
|
|
286
|
-
return result;
|
|
287
|
-
}
|
|
288
|
-
// Create properties for the fields and the aliases
|
|
289
|
-
// Also improve the feature completion documentation
|
|
290
|
-
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;
|
|
291
245
|
const fieldProfileValues = [];
|
|
292
246
|
const aliasProfileValues = [];
|
|
293
|
-
supportedFields(
|
|
294
|
-
let fieldCompletionDescription = `**${field.name}** \n${field.type}`;
|
|
295
|
-
if (field.description) {
|
|
296
|
-
fieldCompletionDescription += ` \n'${field.description}`;
|
|
297
|
-
}
|
|
247
|
+
supportedFields(fields).forEach((field) => {
|
|
298
248
|
if (featureCompletionDescription) {
|
|
299
249
|
featureCompletionDescription += " \n \n";
|
|
300
250
|
}
|
|
301
|
-
featureCompletionDescription += `**${field.name}** (${
|
|
251
|
+
featureCompletionDescription += `**${field.name}** (${field.alias}) \n${field.type}`;
|
|
302
252
|
if (field.description) {
|
|
303
253
|
featureCompletionDescription += ` \n'${field.description}`;
|
|
304
254
|
}
|
|
305
255
|
// The property for the field
|
|
306
|
-
const type =
|
|
256
|
+
const type = fieldTypeToApiValueVarType(field);
|
|
307
257
|
const insertText = getMemberExpressionProperty(field.name, false);
|
|
308
258
|
const description = fieldAlias(field);
|
|
309
259
|
fieldProfileValues.push({
|
|
@@ -317,65 +267,35 @@ async function featureToLSFeature(editorFeature, kind) {
|
|
|
317
267
|
insertTextMode: InsertTextMode.asIs,
|
|
318
268
|
insertTextFormat: InsertTextFormat.PlainText,
|
|
319
269
|
kind: CompletionItemKind.Field,
|
|
320
|
-
documentation: { kind: "markdown", value: fieldCompletionDescription },
|
|
321
270
|
},
|
|
322
271
|
});
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
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
|
+
});
|
|
330
295
|
}
|
|
331
|
-
aliasProfileValues.push({
|
|
332
|
-
name: field.alias,
|
|
333
|
-
description: field.name,
|
|
334
|
-
type,
|
|
335
|
-
completion: {
|
|
336
|
-
label: field.alias,
|
|
337
|
-
detail: field.name,
|
|
338
|
-
insertText,
|
|
339
|
-
insertTextMode: InsertTextMode.asIs,
|
|
340
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
341
|
-
kind: CompletionItemKind.Field,
|
|
342
|
-
documentation: { kind: "markdown", value: aliasCompletionDescription },
|
|
343
|
-
},
|
|
344
|
-
});
|
|
345
296
|
});
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
return result;
|
|
349
|
-
}
|
|
350
|
-
async function dictionaryToLSDictionary(editorDictionary, kind) {
|
|
351
|
-
const { name, dictionaryVariables: variables } = editorDictionary;
|
|
352
|
-
const description = editorDictionary.getDescription();
|
|
353
|
-
const completionDescription = variables.reduce((previous, p) => {
|
|
354
|
-
if (previous !== "") {
|
|
355
|
-
previous += " \n \n";
|
|
356
|
-
}
|
|
357
|
-
previous += `**${p.name}** \n${p.type}`;
|
|
358
|
-
const description = p.getDescription();
|
|
359
|
-
if (description) {
|
|
360
|
-
previous += ` \n${description}`;
|
|
361
|
-
}
|
|
362
|
-
return previous;
|
|
363
|
-
}, description);
|
|
364
|
-
return {
|
|
365
|
-
name,
|
|
366
|
-
description,
|
|
367
|
-
type: "dictionary",
|
|
368
|
-
properties: await variablesToLSVariable(variables, CompletionItemKind.Field),
|
|
369
|
-
completion: {
|
|
370
|
-
label: name,
|
|
371
|
-
detail: name,
|
|
372
|
-
insertText: name,
|
|
373
|
-
insertTextMode: InsertTextMode.asIs,
|
|
374
|
-
insertTextFormat: InsertTextFormat.PlainText,
|
|
375
|
-
kind,
|
|
376
|
-
documentation: { kind: "markdown", value: completionDescription },
|
|
377
|
-
},
|
|
378
|
-
};
|
|
297
|
+
const properties = [...fieldProfileValues, ...aliasProfileValues];
|
|
298
|
+
return [properties, featureCompletionDescription];
|
|
379
299
|
}
|
|
380
300
|
/**
|
|
381
301
|
* Represents a item in the EditorProfile. The profile is converted into an optimized way for
|
|
@@ -1287,14 +1207,6 @@ class EditorProfile extends DictionaryVariable {
|
|
|
1287
1207
|
get supportFeatureSetFunctions() {
|
|
1288
1208
|
return this.definition?.bundles?.includes("data-access") ?? false;
|
|
1289
1209
|
}
|
|
1290
|
-
/**
|
|
1291
|
-
* Returns the language service profile. It is different than the editor profile as it is optimized for Monaco.
|
|
1292
|
-
*/
|
|
1293
|
-
async toLSProfile() {
|
|
1294
|
-
const { apiVersion, bundles, hiddenApiItems } = this.definition ?? {};
|
|
1295
|
-
const variables = await variablesToLSVariable(this.dictionaryVariables);
|
|
1296
|
-
return { apiVersion, bundles, variables, hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()) };
|
|
1297
|
-
}
|
|
1298
1210
|
/**
|
|
1299
1211
|
* Returns the EditorProfile as a json. The EditorProfile may have been updated. This function allows to
|
|
1300
1212
|
* get the new json representing mutations.
|
|
@@ -1308,144 +1220,6 @@ class EditorProfile extends DictionaryVariable {
|
|
|
1308
1220
|
}
|
|
1309
1221
|
//#endregion
|
|
1310
1222
|
|
|
1311
|
-
function isFeatureDefinition(item) {
|
|
1312
|
-
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
1313
|
-
}
|
|
1314
|
-
function isFeatureSetDefinition(item) {
|
|
1315
|
-
return isUrlDefinition(item) || isFieldsDefinition(item) || isFeatureLayerItemDefinition(item);
|
|
1316
|
-
}
|
|
1317
|
-
function isFeatureSetCollectionDefinition(item) {
|
|
1318
|
-
return isPortalItemDefinition(item) || isMapInstance(item) || isSupportedServiceUrlDefinition(item);
|
|
1319
|
-
}
|
|
1320
|
-
/**
|
|
1321
|
-
* Get a PredefinedProfile for a locale. If not already loaded then fetch it.
|
|
1322
|
-
* If the locale doesn't exist or the locale profile file doesn't exist then returns
|
|
1323
|
-
* the english version of the profile.
|
|
1324
|
-
*/
|
|
1325
|
-
async function getSdkPredefinedProfiles(locale = "en") {
|
|
1326
|
-
const profiles = sdkPredefinedProfilesMap.get(locale);
|
|
1327
|
-
if (profiles) {
|
|
1328
|
-
return profiles;
|
|
1329
|
-
}
|
|
1330
|
-
if (!supportedLocales.has(locale)) {
|
|
1331
|
-
return await getSdkPredefinedProfiles("en");
|
|
1332
|
-
}
|
|
1333
|
-
try {
|
|
1334
|
-
const response = await fetch(getAssetPath(`./assets/arcade-language/profiles/arcade-profiles.t9n.${locale}.json`));
|
|
1335
|
-
if (response.ok) {
|
|
1336
|
-
return cacheSdkPredefinedProfiles(locale, (await response.json()));
|
|
1337
|
-
}
|
|
1338
|
-
if (locale === "en") {
|
|
1339
|
-
return null;
|
|
1340
|
-
}
|
|
1341
|
-
return await getSdkPredefinedProfiles("en");
|
|
1342
|
-
}
|
|
1343
|
-
catch {
|
|
1344
|
-
return null;
|
|
1345
|
-
}
|
|
1346
|
-
}
|
|
1347
|
-
const sdkPredefinedProfilesMap = new Map();
|
|
1348
|
-
/**
|
|
1349
|
-
* Convert a stored profile into a PredefinedProfile and add it to the in-memory
|
|
1350
|
-
* Map of profiles per locale.
|
|
1351
|
-
*/
|
|
1352
|
-
function cacheSdkPredefinedProfiles(locale, profiles) {
|
|
1353
|
-
const map = new Map();
|
|
1354
|
-
profiles.forEach((profile) => {
|
|
1355
|
-
map.set(profile.id, profile);
|
|
1356
|
-
});
|
|
1357
|
-
sdkPredefinedProfilesMap.set(locale, map);
|
|
1358
|
-
return map;
|
|
1359
|
-
}
|
|
1360
|
-
async function getSdkPredefinedProfile(id, locale = "en") {
|
|
1361
|
-
const profiles = await getSdkPredefinedProfiles(locale);
|
|
1362
|
-
return profiles?.get(id) ?? null;
|
|
1363
|
-
}
|
|
1364
|
-
function isExtendedPredefinedProfileDefinition(item) {
|
|
1365
|
-
return !!item && typeof item === "object" && "additionalVariables" in item && Array.isArray(item.additionalVariables);
|
|
1366
|
-
}
|
|
1367
|
-
function convertApiVariables(variables) {
|
|
1368
|
-
return variables?.map(convertApiVariable);
|
|
1369
|
-
}
|
|
1370
|
-
function convertApiVariable(variable) {
|
|
1371
|
-
switch (variable.type) {
|
|
1372
|
-
case "dictionary":
|
|
1373
|
-
return {
|
|
1374
|
-
...variable,
|
|
1375
|
-
type: variable.type,
|
|
1376
|
-
properties: convertApiVariables(variable.properties),
|
|
1377
|
-
};
|
|
1378
|
-
case "array": {
|
|
1379
|
-
return {
|
|
1380
|
-
...variable,
|
|
1381
|
-
type: variable.type,
|
|
1382
|
-
elementType: { type: "number", name: "number" },
|
|
1383
|
-
};
|
|
1384
|
-
}
|
|
1385
|
-
default:
|
|
1386
|
-
return { ...variable, type: variable.type };
|
|
1387
|
-
}
|
|
1388
|
-
}
|
|
1389
|
-
async function convertToEditorProfileDefinition(predefinedProfile, locale = "en") {
|
|
1390
|
-
if (!isPredefinedProfile(predefinedProfile)) {
|
|
1391
|
-
return undefined;
|
|
1392
|
-
}
|
|
1393
|
-
const sdkPredefinedProfile = await getSdkPredefinedProfile(predefinedProfile.id, locale);
|
|
1394
|
-
if (!sdkPredefinedProfile) {
|
|
1395
|
-
return undefined;
|
|
1396
|
-
}
|
|
1397
|
-
const editorProfile = {
|
|
1398
|
-
bundles: [...sdkPredefinedProfile.bundles],
|
|
1399
|
-
variables: [],
|
|
1400
|
-
hiddenApiItems: predefinedProfile.hiddenApiItems?.map((s) => s.toLowerCase()),
|
|
1401
|
-
};
|
|
1402
|
-
// Merge the SDK variables' definitions/properties with the predefined profile definitions.
|
|
1403
|
-
sdkPredefinedProfile.variables.forEach((predefinedVariable) => {
|
|
1404
|
-
// Don't include disabled variables
|
|
1405
|
-
if (predefinedProfile.disabledVariables?.includes(predefinedVariable.name)) {
|
|
1406
|
-
return;
|
|
1407
|
-
}
|
|
1408
|
-
// Try to get a definition from the predefined profile, for the variable that needs one.
|
|
1409
|
-
const definition = predefinedProfile.definitions[predefinedVariable.name];
|
|
1410
|
-
// Note: Something is weird with TS. The sdkVariables are being casted to the wrong type
|
|
1411
|
-
// despite the type checking from the switch statement.
|
|
1412
|
-
switch (predefinedVariable.type) {
|
|
1413
|
-
case "dictionary": {
|
|
1414
|
-
// For dictionary, we support properties overrride
|
|
1415
|
-
return editorProfile.variables.push(convertApiVariable({
|
|
1416
|
-
...predefinedVariable,
|
|
1417
|
-
type: predefinedVariable.type,
|
|
1418
|
-
properties: Array.isArray(definition) ? [...definition] : predefinedVariable.properties,
|
|
1419
|
-
}));
|
|
1420
|
-
}
|
|
1421
|
-
case "feature":
|
|
1422
|
-
// If the definition is not valid, then we don't include it.
|
|
1423
|
-
if (!isFeatureDefinition(definition)) {
|
|
1424
|
-
return;
|
|
1425
|
-
}
|
|
1426
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
1427
|
-
case "featureSet":
|
|
1428
|
-
// If the definition is not valid, then we don't include it.
|
|
1429
|
-
if (!isFeatureSetDefinition(definition)) {
|
|
1430
|
-
return;
|
|
1431
|
-
}
|
|
1432
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
1433
|
-
case "featureSetCollection":
|
|
1434
|
-
// If the definition is not valid, then we don't include it.
|
|
1435
|
-
if (!isFeatureSetCollectionDefinition(definition)) {
|
|
1436
|
-
return;
|
|
1437
|
-
}
|
|
1438
|
-
return editorProfile.variables.push({ ...predefinedVariable, type: predefinedVariable.type, definition });
|
|
1439
|
-
default:
|
|
1440
|
-
return editorProfile.variables.push(convertApiVariable(predefinedVariable));
|
|
1441
|
-
}
|
|
1442
|
-
});
|
|
1443
|
-
if (isExtendedPredefinedProfileDefinition(predefinedProfile)) {
|
|
1444
|
-
editorProfile.variables.push(...(predefinedProfile.additionalVariables ?? []));
|
|
1445
|
-
}
|
|
1446
|
-
return editorProfile;
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
1223
|
// this file contains the building blocks for a language default provider
|
|
1450
1224
|
const defaultContext = {
|
|
1451
1225
|
locale: "en",
|
|
@@ -1532,4 +1306,4 @@ class LanguageDefaultsBase {
|
|
|
1532
1306
|
}
|
|
1533
1307
|
}
|
|
1534
1308
|
|
|
1535
|
-
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.11
|
|
5
5
|
*/
|
|
6
6
|
import { editor } from 'monaco-editor';
|
|
7
7
|
import { StandaloneServices } from 'monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js';
|
|
@@ -1,14 +1,64 @@
|
|
|
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.11
|
|
5
5
|
*/
|
|
6
|
-
import { i as isPredefinedProfile,
|
|
6
|
+
import { f as fieldsToProfileValues, i as isPredefinedProfile, b as isFeatureSetDefinition, L as LanguageDefaultsBase, E as EditorProfile } from './language-defaults-base.js';
|
|
7
|
+
import { InsertTextMode, InsertTextFormat, CompletionItemKind, MarkupKind } from 'vscode-languageserver-types';
|
|
7
8
|
import { f as fetchT9nStringsBundle } from './index2.js';
|
|
8
9
|
import { Uri } from 'monaco-editor';
|
|
9
|
-
import { InsertTextMode, InsertTextFormat, CompletionItemKind, MarkupKind } from 'vscode-languageserver-types';
|
|
10
10
|
import { getArcgisAssetPath as getAssetPath } from "./arcgis-assets.js";
|
|
11
11
|
|
|
12
|
+
// #region convert editor profile to apiProfile
|
|
13
|
+
/**
|
|
14
|
+
* Converts an editor profile to an api profile.
|
|
15
|
+
* The api profile is an optimized version of the editor profile designed for minimal data transfer between the main thread and the worker.
|
|
16
|
+
*/
|
|
17
|
+
const sqlExprEditorToApiProfile = (editorProfile) => {
|
|
18
|
+
const { apiVersion, bundles, hiddenApiItems } = editorProfile.toEditorProfileDefinition();
|
|
19
|
+
const variable = editorProfile.variables[0];
|
|
20
|
+
if (!variable || !(variable.type === "featureSet")) {
|
|
21
|
+
throw Error("No variable found in the editor profile");
|
|
22
|
+
}
|
|
23
|
+
const hydratedVariable = variableToApiProfile(variable);
|
|
24
|
+
return {
|
|
25
|
+
apiVersion,
|
|
26
|
+
bundles,
|
|
27
|
+
variables: [hydratedVariable],
|
|
28
|
+
hiddenApiItems: hiddenApiItems?.map((s) => s.toLowerCase()),
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
function variableToApiProfile(variable) {
|
|
32
|
+
const { name } = variable;
|
|
33
|
+
const description = variable.getDescription();
|
|
34
|
+
const { definition } = variable.toProfileVariableDefinition();
|
|
35
|
+
const resultCompletion = {
|
|
36
|
+
label: name,
|
|
37
|
+
detail: name,
|
|
38
|
+
insertText: name,
|
|
39
|
+
insertTextMode: InsertTextMode.asIs,
|
|
40
|
+
insertTextFormat: InsertTextFormat.PlainText,
|
|
41
|
+
kind: CompletionItemKind.Field,
|
|
42
|
+
};
|
|
43
|
+
const result = {
|
|
44
|
+
name,
|
|
45
|
+
description,
|
|
46
|
+
type: "dictionary",
|
|
47
|
+
properties: [],
|
|
48
|
+
completion: resultCompletion,
|
|
49
|
+
};
|
|
50
|
+
// No fields or definition, then it will be a feature without any known fields
|
|
51
|
+
if (!definition || !("fields" in definition)) {
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
// Create properties for the fields
|
|
55
|
+
// Also improve the feature completion documentation
|
|
56
|
+
// TODO: should we add aliases to completion? what about domains?
|
|
57
|
+
const [properties, featureCompletionDescription] = fieldsToProfileValues(definition.fields, description);
|
|
58
|
+
result.properties = properties;
|
|
59
|
+
resultCompletion.documentation = { kind: "markdown", value: featureCompletionDescription };
|
|
60
|
+
return result;
|
|
61
|
+
}
|
|
12
62
|
const tempHardcodedProfile = {
|
|
13
63
|
en: {
|
|
14
64
|
id: "field-calculation",
|
|
@@ -57,6 +107,7 @@ async function convertToEditorProfileDefinition(predefinedProfile, locale = "en"
|
|
|
57
107
|
});
|
|
58
108
|
return editorProfile;
|
|
59
109
|
}
|
|
110
|
+
// #endregion
|
|
60
111
|
|
|
61
112
|
function x(i){return Array.isArray(i.testSdkCategories)}async function S(i,n){try{let e=await i,t=new Map,r=new Map,a=[],o=k(n);return e.forEach(p=>{let c=[];p.items.forEach(s=>V(c,r,t,o,s)),c.length&&a.push({...p,items:c});}),{categories:a,functionDefinitions:t,constantDefinitions:r}}catch{return {categories:[],functionDefinitions:new Map,constantDefinitions:new Map}}}var g=class{constructor(n){this._settings=n;this.sdkCategoriesCache=new Map;}async getApiDatabase(n){let{locale:e="en"}=n,t=this.sdkCategoriesCache.get(e);if(!t){let{assetsPath:r}=this._settings;if(!r)return {categories:[],functionDefinitions:new Map,constantDefinitions:new Map};t=this.loadSdkApiLibrary(e,r),this.sdkCategoriesCache.set(e,t);}return await S(t,n)}async getApiLibrary(n){let{categories:e}=await this.getApiDatabase(n);return e}async loadSdkApiLibrary(n="en",e=""){if(x(this._settings))return this._settings.testSdkCategories;if(e=e.replace(/\/$/u,""),!e)return [];try{let t=this._settings.apiPathTemplate.replace("${assetsPath}",e).replace("${locale}",n),r=await fetch(t);return r.ok?await r.json():n==="en"?[]:await this.loadSdkApiLibrary("en",e)}catch{return []}}};function k(i){let{profile:{apiVersion:n,bundles:e,hiddenApiItems:t=[]}={}}=i,r=A(n),a=Array.isArray(e)&&e.length>0?new Set(["core",...e]):void 0;return o=>h(r,o.sinceVersion)&&(!a||a.has(o.bundle))&&!t.includes(o.name)}function V(i,n,e,t,r){if(Array.isArray(r)){r.forEach(a=>m(i,e,t,a));return}r.type==="constant"?D(i,n,t,r):m(i,e,t,r);}function m(i,n,e,t){if(!e(t))return;t.disableDocumentation||i.push(t);let{completion:{label:r}}=t,a=r.toLowerCase(),o=n.get(a);o||(o={type:"functionDefinition",key:a,overloads:[]},n.set(a,o)),o.overloads.push(t);}function D(i,n,e,t){if(!e(t))return;i.push(t);let{completion:{label:r}}=t,a=r.toLowerCase();n.set(a,t);let[o,p]=t.completion.label.split(".");if(!p)return;let c=o.toLowerCase(),s=n.get(c);s||(s={type:"namespace",key:c,members:[],completion:{label:o,detail:o,insertText:o,insertTextMode:InsertTextMode.adjustIndentation,insertTextFormat:InsertTextFormat.PlainText,kind:CompletionItemKind.Enum}},n.set(c,s));let l=structuredClone(t);l.name=p,l.completion.label=p,l.completion.insertText=p,l.completion.kind=CompletionItemKind.Constant,s.members.push(l),s.completion.documentation=s.members.reduce((u,d)=>(u.value=`${u.value}${u.value?`
|
|
62
113
|
|
|
@@ -102,7 +153,7 @@ class SqlExprDefaults extends LanguageDefaultsBase {
|
|
|
102
153
|
const key = this._getApiKey(modelId);
|
|
103
154
|
const editorProfile = new EditorProfile(definition, intlStrings);
|
|
104
155
|
this._profileMap.set(key, editorProfile);
|
|
105
|
-
const apiProfile =
|
|
156
|
+
const apiProfile = sqlExprEditorToApiProfile(editorProfile);
|
|
106
157
|
this.updateApiContextForModel(modelId, {
|
|
107
158
|
locale: apiContext.locale,
|
|
108
159
|
profile: apiProfile,
|
|
@@ -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.11
|
|
5
5
|
*/
|
|
6
6
|
import * as monaco from 'monaco-editor';
|
|
7
7
|
import { editor, languages } from 'monaco-editor';
|
|
@@ -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.11
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, forceUpdate, h } from '@stencil/core/internal/client';
|
|
7
7
|
import { u as useControllerManager } from './chunk-3IUJHIAA.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.11
|
|
5
5
|
*/
|
|
6
6
|
import { m as makeController, w as watch } from './chunk-3IUJHIAA.js';
|
|
7
7
|
import { n as startLocaleObserver, p as getElementLocales } from './index2.js';
|