@arcgis/coding-components 4.29.0-beta.99 → 4.29.0
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/assets/arcade-language/api/arcade-api.t9n.ar.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bg.json +113 -113
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.bs.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ca.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.cs.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.da.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.de.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.el.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.en.json +19 -19
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.es.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.et.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fi.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.fr.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.he.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hr.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.hu.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.id.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.it.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ja.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ko.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lt.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.lv.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nb.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.nl.json +66 -66
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pl.json +66 -66
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-BR.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.pt-PT.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ro.json +66 -66
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.ru.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sk.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sl.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sr.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.sv.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.th.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.tr.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.uk.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.vi.json +111 -111
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-CN.json +66 -66
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-HK.json +66 -66
- package/dist/arcgis-coding-components/assets/arcade-language/api/arcade-api.t9n.zh-TW.json +66 -66
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ar.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bg.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.bs.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ca.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.cs.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.da.json +3 -3
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.de.json +3 -3
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.el.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.en.json +3 -3
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.es.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.et.json +3 -3
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fi.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.fr.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.he.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hr.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.hu.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.id.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.it.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ja.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ko.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lt.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.lv.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nb.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.nl.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pl.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-BR.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.pt-PT.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ro.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.ru.json +3 -3
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sk.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sl.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sr.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.sv.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.th.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.tr.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.uk.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.vi.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-CN.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-HK.json +4 -4
- package/dist/arcgis-coding-components/assets/arcade-language/profiles/arcade-profiles.t9n.zh-TW.json +4 -4
- package/dist/arcgis-coding-components/index.esm.js +2 -2
- package/dist/arcgis-coding-components/{p-e1cb02b3.js → p-0a2edf01.js} +2 -2
- package/dist/arcgis-coding-components/p-11e79992.js +6 -0
- package/dist/arcgis-coding-components/{p-f75beb80.js → p-36e2cbc2.js} +3 -3
- package/dist/arcgis-coding-components/{p-457e3916.js → p-4406b5a8.js} +2 -2
- package/dist/arcgis-coding-components/{p-87d7ad9e.js → p-4eb30e60.js} +1 -1
- package/dist/arcgis-coding-components/{p-7f9d3fdc.js → p-619ca372.js} +1 -1
- package/dist/arcgis-coding-components/{p-7e0e8ecc.js → p-71125c69.js} +2 -2
- package/dist/arcgis-coding-components/{p-0bab0228.js → p-8d7f0979.js} +2 -2
- package/dist/arcgis-coding-components/p-9b8091c1.entry.js +6 -0
- package/dist/arcgis-coding-components/{p-ad86a5f5.js → p-bd81fdff.js} +11 -11
- package/dist/arcgis-coding-components/{p-f23f7fee.js → p-ecc8dd8a.js} +2 -2
- package/dist/arcgis-coding-components/{p-4648782b.js → p-f9016c56.js} +2 -2
- package/dist/cjs/{arcade-defaults-5dd9ebb7.js → arcade-defaults-b30ccec8.js} +271 -236
- package/dist/cjs/{arcade-mode-0b4c53a1.js → arcade-mode-eb755260.js} +11 -14
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +160 -184
- package/dist/cjs/arcgis-coding-components.cjs.js +3 -3
- package/dist/cjs/{css-fe7f8980.js → css-9e907aa0.js} +1 -1
- package/dist/cjs/{cssMode-4c9b3a32.js → cssMode-e4189b13.js} +3 -3
- package/dist/cjs/{html-b044fbba.js → html-2582ae43.js} +3 -3
- package/dist/cjs/{htmlMode-956a6ffa.js → htmlMode-0edcf1ee.js} +3 -3
- package/dist/cjs/{index-aaceaf1f.js → index-54d6f9be.js} +1 -1
- package/dist/cjs/index.cjs.js +3 -3
- package/dist/cjs/{javascript-6c55ac8b.js → javascript-425c653a.js} +4 -4
- package/dist/cjs/{jsonMode-d83e322c.js → jsonMode-eea03515.js} +3 -3
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{tsMode-5c5ffa3e.js → tsMode-b92c9221.js} +3 -3
- package/dist/cjs/{typescript-6143656a.js → typescript-cfc1221c.js} +3 -3
- package/dist/components/arcade-api.js +20 -18
- package/dist/components/arcade-contribution.js +9 -8
- package/dist/components/arcade-defaults.js +188 -168
- package/dist/components/arcade-mode.js +10 -12
- package/dist/components/arcade-results.js +29 -83
- package/dist/components/arcade-suggestions.js +15 -12
- package/dist/components/arcade-variables.js +30 -21
- package/dist/components/arcgis-arcade-api.js +1 -1
- package/dist/components/arcgis-arcade-editor.js +61 -49
- 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-code-editor.js +1 -1
- package/dist/components/code-editor.js +1 -1
- package/dist/components/fields.js +37 -23
- package/dist/components/index.js +1 -1
- package/dist/components/index2.js +3 -3
- package/dist/components/markdown.js +10 -1
- package/dist/components/utilities.js +4 -4
- package/dist/esm/{arcade-defaults-2d7283d4.js → arcade-defaults-a5dc6132.js} +267 -233
- package/dist/esm/{arcade-mode-a8abe5af.js → arcade-mode-d06b6e4f.js} +11 -14
- package/dist/esm/arcgis-arcade-api_6.entry.js +160 -184
- package/dist/esm/arcgis-coding-components.js +4 -4
- package/dist/esm/{css-d31a02ca.js → css-59b4804d.js} +1 -1
- package/dist/esm/{cssMode-5ee45e91.js → cssMode-2bce7da7.js} +3 -3
- package/dist/esm/{html-5c2e488c.js → html-3ad47fc0.js} +3 -3
- package/dist/esm/{htmlMode-376cd5e8.js → htmlMode-6cb73c91.js} +3 -3
- package/dist/esm/{index-1b265749.js → index-ee54d182.js} +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/{javascript-13ddec2b.js → javascript-8917f926.js} +4 -4
- package/dist/esm/{jsonMode-674e89d6.js → jsonMode-9a1dbf00.js} +3 -3
- package/dist/esm/loader.js +4 -4
- package/dist/esm/{tsMode-4c4398d7.js → tsMode-2caf1509.js} +3 -3
- package/dist/esm/{typescript-b328b622.js → typescript-a3abccc0.js} +3 -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/components/arcade-editor/arcade-editor.d.ts +2 -7
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +0 -1
- package/dist/types/components.d.ts +2 -7
- package/dist/types/utils/arcade-monaco/arcade-contribution.d.ts +2 -2
- package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +2 -2
- package/dist/types/utils/fields.d.ts +1 -0
- package/dist/types/utils/markdown.d.ts +3 -0
- package/dist/types/utils/profile/editor-profile.d.ts +49 -63
- package/dist/types/utils/profile/types.d.ts +122 -1
- package/dist/types/utils/profile/utils.d.ts +22 -9
- package/package.json +8 -8
- package/dist/arcgis-coding-components/p-6d56a4b8.entry.js +0 -6
- package/dist/arcgis-coding-components/p-a75f5087.js +0 -6
- package/dist/components/functional-components.js +0 -15
- package/dist/types/utils/functional-components.d.ts +0 -7
- package/dist/types/utils/json-format.d.ts +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
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
|
|
4
|
+
* v4.29.0
|
|
5
5
|
*/
|
|
6
6
|
'use strict';
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
9
9
|
|
|
10
|
-
const index = require('./index-
|
|
11
|
-
const arcadeDefaults = require('./arcade-defaults-
|
|
10
|
+
const index = require('./index-54d6f9be.js');
|
|
11
|
+
const arcadeDefaults = require('./arcade-defaults-b30ccec8.js');
|
|
12
12
|
|
|
13
13
|
async function colorizeCode(code) {
|
|
14
14
|
return await arcadeDefaults.editor.colorize(code, "arcade", { tabSize: 2 });
|
|
@@ -24,24 +24,23 @@ async function colorizeCodeElement(e, text) {
|
|
|
24
24
|
if (!e || e.tagName !== "CODE") {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
+
// eslint-disable-next-line require-atomic-updates
|
|
27
28
|
e.innerHTML = await colorizeCode(text ?? "");
|
|
28
29
|
}
|
|
29
30
|
function generateColorizeStyles() {
|
|
31
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
|
|
30
32
|
const themeService = arcadeDefaults.StandaloneServices.get(arcadeDefaults.IStandaloneThemeService);
|
|
31
33
|
const theme = themeService.getColorTheme();
|
|
32
34
|
return arcadeDefaults.generateTokensCSSForColorMap(theme.tokenTheme.getColorMap());
|
|
35
|
+
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
|
|
33
36
|
}
|
|
34
37
|
function onColorizeThemeChanged(func) {
|
|
38
|
+
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
|
|
35
39
|
const themeService = arcadeDefaults.StandaloneServices.get(arcadeDefaults.IStandaloneThemeService);
|
|
36
40
|
return themeService.onDidColorThemeChange(() => func());
|
|
41
|
+
/* eslint-enable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
|
|
37
42
|
}
|
|
38
43
|
|
|
39
|
-
const StickyFilterInput = ({ filterValue, ...rest }) => (
|
|
40
|
-
// TODO: Remove when calcite-input bug with scale is fixed
|
|
41
|
-
// @ts-expect-error
|
|
42
|
-
index.h("div", { class: "sticky", scale: "m" },
|
|
43
|
-
index.h("calcite-input", { value: filterValue, icon: "magnifying-glass", clearable: true, ...rest })));
|
|
44
|
-
|
|
45
44
|
var marked_umd = arcadeDefaults.createCommonjsModule(function (module, exports) {
|
|
46
45
|
/**
|
|
47
46
|
* marked v5.1.2 - a markdown parser
|
|
@@ -2919,6 +2918,7 @@ var marked_umd = arcadeDefaults.createCommonjsModule(function (module, exports)
|
|
|
2919
2918
|
}));
|
|
2920
2919
|
});
|
|
2921
2920
|
|
|
2921
|
+
// Set up the marked library to use GitHub Flavored Markdown and to use the custom renderer for links.
|
|
2922
2922
|
marked_umd.marked.use({
|
|
2923
2923
|
gfm: true,
|
|
2924
2924
|
renderer: {
|
|
@@ -2927,6 +2927,9 @@ marked_umd.marked.use({
|
|
|
2927
2927
|
}
|
|
2928
2928
|
}
|
|
2929
2929
|
});
|
|
2930
|
+
/**
|
|
2931
|
+
* Converts a markdown string to HTML using the marked library.
|
|
2932
|
+
*/
|
|
2930
2933
|
function convertMarkdownString(value) {
|
|
2931
2934
|
value ?? (value = "");
|
|
2932
2935
|
const result = marked_umd.marked(typeof value === "string" ? value : value.value, {
|
|
@@ -2939,11 +2942,12 @@ function convertMarkdownString(value) {
|
|
|
2939
2942
|
}
|
|
2940
2943
|
|
|
2941
2944
|
function isMonacoEnvironmentSetup() {
|
|
2942
|
-
return !!
|
|
2945
|
+
return !!window.MonacoEnvironment?.getWorkerUrl;
|
|
2943
2946
|
}
|
|
2944
2947
|
const additionalLanguageWorkersMap = new Map();
|
|
2948
|
+
let _assetsPath = "";
|
|
2945
2949
|
function getAssetsPath() {
|
|
2946
|
-
return
|
|
2950
|
+
return _assetsPath;
|
|
2947
2951
|
}
|
|
2948
2952
|
function setupMonacoEnvironment(assetsPath) {
|
|
2949
2953
|
//
|
|
@@ -2951,10 +2955,10 @@ function setupMonacoEnvironment(assetsPath) {
|
|
|
2951
2955
|
if (isMonacoEnvironmentSetup()) {
|
|
2952
2956
|
return;
|
|
2953
2957
|
}
|
|
2958
|
+
_assetsPath = assetsPath;
|
|
2954
2959
|
// Since we are using workers, monaco needs to find them.
|
|
2955
2960
|
// Using the global MonacoEnvironment.
|
|
2956
|
-
|
|
2957
|
-
assetsPath,
|
|
2961
|
+
window.MonacoEnvironment = {
|
|
2958
2962
|
getWorker: async (_, languageId) => {
|
|
2959
2963
|
// Manufacture the url for the web worker
|
|
2960
2964
|
let url = additionalLanguageWorkersMap.get(languageId) ?? `${assetsPath}/code-editor/editor.worker.js`;
|
|
@@ -2977,7 +2981,7 @@ function setupMonacoEnvironment(assetsPath) {
|
|
|
2977
2981
|
break;
|
|
2978
2982
|
}
|
|
2979
2983
|
// If we have a relative path or we are on same orgin, we can use the default js implementation
|
|
2980
|
-
if (!arcadeDefaults.
|
|
2984
|
+
if (!arcadeDefaults.ie(url) || arcadeDefaults.se(url, globalThis.location.href, true)) {
|
|
2981
2985
|
return new Worker(url, { name: languageId });
|
|
2982
2986
|
}
|
|
2983
2987
|
// For cross orgin, we will load the worker code as a string and manufacture a blob
|
|
@@ -3024,7 +3028,7 @@ async function getArcadeWorker(uri) {
|
|
|
3024
3028
|
* @returns mode for arcade
|
|
3025
3029
|
*/
|
|
3026
3030
|
async function getMode() {
|
|
3027
|
-
return await Promise.resolve().then(function () { return require('./arcade-mode-
|
|
3031
|
+
return await Promise.resolve().then(function () { return require('./arcade-mode-eb755260.js'); });
|
|
3028
3032
|
}
|
|
3029
3033
|
// Register the language in Monaco
|
|
3030
3034
|
arcadeDefaults.languages.register({
|
|
@@ -3056,7 +3060,6 @@ const ArcgisArcadeApi = class {
|
|
|
3056
3060
|
this.close = index.createEvent(this, "close", 3);
|
|
3057
3061
|
this.itemSelected = index.createEvent(this, "itemSelected", 3);
|
|
3058
3062
|
this._emitItemSelected = (e) => {
|
|
3059
|
-
// @ts-expect-error
|
|
3060
3063
|
const item = e.target?.["data-item"];
|
|
3061
3064
|
if (!item) {
|
|
3062
3065
|
return;
|
|
@@ -3075,8 +3078,11 @@ const ArcgisArcadeApi = class {
|
|
|
3075
3078
|
const keyEvent = e;
|
|
3076
3079
|
if (!keyEvent.key || keyEvent.key === "Enter") {
|
|
3077
3080
|
e.preventDefault();
|
|
3078
|
-
|
|
3079
|
-
|
|
3081
|
+
const item = e.target?.["data-item"];
|
|
3082
|
+
if (!item) {
|
|
3083
|
+
return;
|
|
3084
|
+
}
|
|
3085
|
+
this.itemSelected.emit(item.completion.insertText);
|
|
3080
3086
|
}
|
|
3081
3087
|
};
|
|
3082
3088
|
this._selectItem = (e) => {
|
|
@@ -3084,14 +3090,14 @@ const ArcgisArcadeApi = class {
|
|
|
3084
3090
|
return;
|
|
3085
3091
|
}
|
|
3086
3092
|
e.stopPropagation();
|
|
3087
|
-
|
|
3088
|
-
this._selectedApiItem = e.target["data-item"];
|
|
3093
|
+
this._selectedApiItem = e.target?.["data-item"];
|
|
3089
3094
|
};
|
|
3090
3095
|
this._unselectItem = async () => {
|
|
3091
3096
|
this._selectedApiItem = undefined;
|
|
3092
3097
|
};
|
|
3093
|
-
|
|
3094
|
-
|
|
3098
|
+
this._updateFilterValue = (e) => {
|
|
3099
|
+
this._filterValue = e.target?.value ?? "";
|
|
3100
|
+
};
|
|
3095
3101
|
this._lang = "";
|
|
3096
3102
|
this._t9nLocale = "";
|
|
3097
3103
|
this._t9nStrings = undefined;
|
|
@@ -3113,12 +3119,12 @@ const ArcgisArcadeApi = class {
|
|
|
3113
3119
|
if (!this.modelId || key !== arcadeDefaults.Uri.parse(this.modelId).toString()) {
|
|
3114
3120
|
return;
|
|
3115
3121
|
}
|
|
3116
|
-
this._updateApiLibrary();
|
|
3122
|
+
this._updateApiLibrary().catch(console.error);
|
|
3117
3123
|
});
|
|
3118
|
-
this._updateApiLibrary();
|
|
3124
|
+
await this._updateApiLibrary();
|
|
3119
3125
|
}
|
|
3120
3126
|
disconnectedCallback() {
|
|
3121
|
-
arcadeDefaults.
|
|
3127
|
+
arcadeDefaults.q(this);
|
|
3122
3128
|
this._flowObserver?.disconnect();
|
|
3123
3129
|
this._themeChangedListner?.dispose();
|
|
3124
3130
|
}
|
|
@@ -3163,7 +3169,7 @@ const ArcgisArcadeApi = class {
|
|
|
3163
3169
|
// When switching between flow the same reference is reused
|
|
3164
3170
|
this._flowObserver = new MutationObserver(() => {
|
|
3165
3171
|
// Get the last panel and try to set focus on the input element
|
|
3166
|
-
arcadeDefaults.
|
|
3172
|
+
arcadeDefaults.W(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
3167
3173
|
});
|
|
3168
3174
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
3169
3175
|
}
|
|
@@ -3174,25 +3180,25 @@ const ArcgisArcadeApi = class {
|
|
|
3174
3180
|
if (!filteredApiItems.length) {
|
|
3175
3181
|
return null;
|
|
3176
3182
|
}
|
|
3177
|
-
return (index.h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (index.h("calcite-list-item", { label: arcadeDefaults.
|
|
3183
|
+
return (index.h("calcite-list-item-group", { heading: category.title }, filteredApiItems.map((apiItem) => (index.h("calcite-list-item", { label: arcadeDefaults.G(apiItem.completion.detail), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": apiItem }, index.h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "Expand", icon: "chevron-right", iconFlipRtl: true, scale: "s", onClick: this._selectItem, "data-item": apiItem }))))));
|
|
3178
3184
|
}
|
|
3179
3185
|
renderApiItemFlowItem() {
|
|
3180
3186
|
const apiItem = this._selectedApiItem;
|
|
3181
3187
|
if (!apiItem) {
|
|
3182
3188
|
return null;
|
|
3183
3189
|
}
|
|
3184
|
-
return (index.h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (index.h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", scale: "s", href: apiItem.link, target: "Arcade Help", "icon-start": "information" }, this._t9nStrings?.moreinformation)), index.h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelectedAndClose, "data-item": apiItem, ref: (e) => void e?.setFocus() }, this._t9nStrings?.insert ?? "Insert"), index.h("calcite-block", { open: true, heading: arcadeDefaults.
|
|
3190
|
+
return (index.h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, beforeBack: this._unselectItem, closable: true, onCalciteFlowItemClose: this._emitClose }, this.hideDocumentationActions ? null : (index.h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", scale: "s", href: apiItem.link, target: "Arcade Help", "icon-start": "information" }, this._t9nStrings?.moreinformation)), index.h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelectedAndClose, "data-item": apiItem, ref: (e) => void e?.setFocus() }, this._t9nStrings?.insert ?? "Insert"), index.h("calcite-block", { open: true, heading: arcadeDefaults.G(apiItem.completion.detail) }, index.h("div", { innerHTML: convertMarkdownString(apiItem.completion.documentation) }), apiItem.examples ? (index.h("div", { ref: (e) => {
|
|
3185
3191
|
if (!e) {
|
|
3186
3192
|
return;
|
|
3187
3193
|
}
|
|
3188
3194
|
e.innerHTML = convertMarkdownString(apiItem.examples);
|
|
3189
|
-
colorizedAllCodeElements(e);
|
|
3195
|
+
colorizedAllCodeElements(e).catch(console.error);
|
|
3190
3196
|
} })) : null)));
|
|
3191
3197
|
}
|
|
3192
3198
|
render() {
|
|
3193
3199
|
const categories = (this._apiLibrary ?? []).map((apiCategory) => this.renderApiCategory(apiCategory));
|
|
3194
3200
|
const empty = categories.every((g) => !g);
|
|
3195
|
-
return (index.h(index.Host, null, index.h("style", null, this._colorizeStyle), index.h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, index.h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, index.h(
|
|
3201
|
+
return (index.h(index.Host, null, index.h("style", null, this._colorizeStyle), index.h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, index.h("calcite-flow-item", { heading: this._t9nStrings?.constantsandfunctions, closable: true, onCalciteFlowItemClose: this._emitClose }, index.h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), this._preparingApi ? (index.h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (index.h("calcite-list", null, empty ? index.h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No items") : categories))), this.renderApiItemFlowItem())));
|
|
3196
3202
|
}
|
|
3197
3203
|
static get assetsDirs() { return ["assets"]; }
|
|
3198
3204
|
get _hostElement() { return index.getElement(this); }
|
|
@@ -3358,17 +3364,18 @@ function formatArcadeResultDateOnly(dateObject) {
|
|
|
3358
3364
|
function formatArcadeResultTimeOnly(dateObject) {
|
|
3359
3365
|
return dateObject.value.toString();
|
|
3360
3366
|
}
|
|
3361
|
-
async function
|
|
3362
|
-
|
|
3363
|
-
|
|
3367
|
+
async function convertScriptOutputToArcadeResult(scriptOutput, timeZone = "system") {
|
|
3368
|
+
const arcadeResult = valueToArcadeResult(scriptOutput);
|
|
3369
|
+
if (arcadeResult.type !== "featureSet") {
|
|
3370
|
+
return arcadeResult;
|
|
3364
3371
|
}
|
|
3365
3372
|
// Feature Set needs to be loaded
|
|
3366
|
-
await
|
|
3373
|
+
await arcadeResult.value.load();
|
|
3367
3374
|
// Create the first iterator
|
|
3368
|
-
|
|
3375
|
+
arcadeResult.iterator = arcadeResult.value.iterator({ aborted: false });
|
|
3369
3376
|
// Load the first batch of items
|
|
3370
|
-
|
|
3371
|
-
return
|
|
3377
|
+
arcadeResult.features = (await arcadeResult.iterator.nextBatchAsArcadeFeatures(BatchSize, timeZone)) ?? [];
|
|
3378
|
+
return arcadeResult;
|
|
3372
3379
|
}
|
|
3373
3380
|
async function executeScript(editorProfile, script, testContext, console) {
|
|
3374
3381
|
//
|
|
@@ -3396,12 +3403,12 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
3396
3403
|
// Execute the script
|
|
3397
3404
|
const scriptOutput = await executor.executeAsync(profileVariableInstances, executeContext);
|
|
3398
3405
|
// Convert script output to arcade result object and load data if necessary
|
|
3399
|
-
const
|
|
3406
|
+
const arcadeResult = await convertScriptOutputToArcadeResult(scriptOutput, timeZone);
|
|
3400
3407
|
// Timestamp and measure cost
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
return
|
|
3408
|
+
arcadeResult.timeStamp = timeStamp;
|
|
3409
|
+
arcadeResult.compilationTime = t1 - t0;
|
|
3410
|
+
arcadeResult.executionTime = performance.now() - t1;
|
|
3411
|
+
return arcadeResult;
|
|
3405
3412
|
//
|
|
3406
3413
|
}
|
|
3407
3414
|
catch (error) {
|
|
@@ -3461,7 +3468,8 @@ function setupArcadeTheme() {
|
|
|
3461
3468
|
});
|
|
3462
3469
|
});
|
|
3463
3470
|
}
|
|
3464
|
-
const
|
|
3471
|
+
const monacoThemeKeys = ["comment", "keyword", "identifier", "string", "number", "constant"];
|
|
3472
|
+
const colorRulesKeys = [...monacoThemeKeys, "date"];
|
|
3465
3473
|
function updateThemeColors(theme, colorRules) {
|
|
3466
3474
|
if (colorRules === undefined) {
|
|
3467
3475
|
setupArcadeTheme();
|
|
@@ -3469,14 +3477,7 @@ function updateThemeColors(theme, colorRules) {
|
|
|
3469
3477
|
}
|
|
3470
3478
|
const base = theme === "light" ? "vs" : "vs-dark";
|
|
3471
3479
|
const rules = [];
|
|
3472
|
-
|
|
3473
|
-
const foreground = colorRules[key];
|
|
3474
|
-
if (!foreground) {
|
|
3475
|
-
return;
|
|
3476
|
-
}
|
|
3477
|
-
rules.push({ token: `${key}.arc`, foreground });
|
|
3478
|
-
});
|
|
3479
|
-
validKeys.forEach((key) => {
|
|
3480
|
+
monacoThemeKeys.forEach((key) => {
|
|
3480
3481
|
const foreground = colorRules[key];
|
|
3481
3482
|
if (!foreground) {
|
|
3482
3483
|
return;
|
|
@@ -3511,15 +3512,19 @@ const ArcgisArcadeEditor = class {
|
|
|
3511
3512
|
this._showExecutionPanel = true;
|
|
3512
3513
|
this._executingScript = true;
|
|
3513
3514
|
this._consoleLogs = [];
|
|
3514
|
-
setTimeout(async () => {
|
|
3515
|
+
setTimeout(() => void (async () => {
|
|
3515
3516
|
const script = await this._codeEditorElt?.getValue();
|
|
3516
3517
|
this._executionResult = await executeScript(editorProfile.definition, script, testContext, (log) => setTimeout(() => (this._consoleLogs = [...this._consoleLogs, log]), 0));
|
|
3517
3518
|
this._executingScript = false;
|
|
3518
|
-
}, 0);
|
|
3519
|
+
})(), 0);
|
|
3520
|
+
};
|
|
3521
|
+
this._toggleShowExecutionPanel = () => {
|
|
3522
|
+
this._showExecutionPanel = !this._showExecutionPanel;
|
|
3519
3523
|
};
|
|
3520
|
-
this.
|
|
3521
|
-
|
|
3522
|
-
|
|
3524
|
+
this._toggleSideActionBarExpanded = () => {
|
|
3525
|
+
this.sideActionBarExpanded = !this.sideActionBarExpanded;
|
|
3526
|
+
};
|
|
3527
|
+
this._toggleSidePanel = (e) => {
|
|
3523
3528
|
if (!e.target) {
|
|
3524
3529
|
return;
|
|
3525
3530
|
}
|
|
@@ -3528,18 +3533,18 @@ const ArcgisArcadeEditor = class {
|
|
|
3528
3533
|
this.openedSidePanel = panelName === this.openedSidePanel ? "none" : panelName;
|
|
3529
3534
|
if (this.openedSidePanel === "none") {
|
|
3530
3535
|
// Reset focus on the code editor if no panel displayed
|
|
3531
|
-
|
|
3536
|
+
this._codeEditorElt?.setFocus().catch(console.error);
|
|
3532
3537
|
}
|
|
3533
3538
|
};
|
|
3534
|
-
this._openArcadeHelp = () => window.open(DevelopersWebSitePath, "Arcade Help");
|
|
3539
|
+
this._openArcadeHelp = () => void window.open(DevelopersWebSitePath, "Arcade Help");
|
|
3535
3540
|
this._emitScriptChange = (e) => {
|
|
3536
3541
|
e.stopPropagation();
|
|
3537
3542
|
this.scriptChange.emit(e.detail);
|
|
3538
3543
|
};
|
|
3539
|
-
this._insertAsSnippet =
|
|
3540
|
-
this._insertAsText =
|
|
3541
|
-
this._onResultPanelChange = (e) => (this._resultPanel = e.detail);
|
|
3542
|
-
this._onExecutionPanelClose = () => (this._showExecutionPanel = false);
|
|
3544
|
+
this._insertAsSnippet = (e) => void this._codeEditorElt?.insertSnippet(e.detail).catch(console.error);
|
|
3545
|
+
this._insertAsText = (e) => void this._codeEditorElt?.insertText(e.detail).catch(console.error);
|
|
3546
|
+
this._onResultPanelChange = (e) => void (this._resultPanel = e.detail);
|
|
3547
|
+
this._onExecutionPanelClose = () => void (this._showExecutionPanel = false);
|
|
3543
3548
|
this._lang = "";
|
|
3544
3549
|
this._t9nLocale = "";
|
|
3545
3550
|
this._t9nStrings = undefined;
|
|
@@ -3566,13 +3571,13 @@ const ArcgisArcadeEditor = class {
|
|
|
3566
3571
|
if (newValue === oldValue) {
|
|
3567
3572
|
return;
|
|
3568
3573
|
}
|
|
3569
|
-
this._updateEditorProfile();
|
|
3574
|
+
this._updateEditorProfile().catch(console.error);
|
|
3570
3575
|
}
|
|
3571
3576
|
_testDataChanged(newValue, oldValue) {
|
|
3572
3577
|
if (newValue === oldValue || !this._showExecutionPanel) {
|
|
3573
3578
|
return;
|
|
3574
3579
|
}
|
|
3575
|
-
this._executeScript();
|
|
3580
|
+
this._executeScript().catch(console.error);
|
|
3576
3581
|
}
|
|
3577
3582
|
_snippetChanged(newValue, oldValue) {
|
|
3578
3583
|
if (newValue === oldValue) {
|
|
@@ -3623,14 +3628,6 @@ const ArcgisArcadeEditor = class {
|
|
|
3623
3628
|
const script = await this._codeEditorElt?.getValue();
|
|
3624
3629
|
return await executeScript(editorProfile.definition, script, this.testData);
|
|
3625
3630
|
}
|
|
3626
|
-
/**
|
|
3627
|
-
* Returns the Arcade output type for the script.
|
|
3628
|
-
* @deprecated Use getTestResult
|
|
3629
|
-
* @internal
|
|
3630
|
-
*/
|
|
3631
|
-
async getOutputType() {
|
|
3632
|
-
return (await this.getTestResult()).type;
|
|
3633
|
-
}
|
|
3634
3631
|
/**
|
|
3635
3632
|
* Allows to change theme colors
|
|
3636
3633
|
* @internal
|
|
@@ -3639,13 +3636,12 @@ const ArcgisArcadeEditor = class {
|
|
|
3639
3636
|
const theme = arcadeDefaults.k(this._hostElement);
|
|
3640
3637
|
updateThemeColors(theme, colorRules);
|
|
3641
3638
|
if (colorRules === undefined) {
|
|
3642
|
-
|
|
3639
|
+
colorRulesKeys.forEach((key) => {
|
|
3643
3640
|
this._hostElement.style.removeProperty(`--arcgis-arcade-editor-${key}`);
|
|
3644
3641
|
});
|
|
3645
3642
|
return;
|
|
3646
3643
|
}
|
|
3647
|
-
|
|
3648
|
-
// @ts-expect-error
|
|
3644
|
+
colorRulesKeys.forEach((key) => {
|
|
3649
3645
|
const foreground = colorRules[key];
|
|
3650
3646
|
if (!foreground) {
|
|
3651
3647
|
return;
|
|
@@ -3686,14 +3682,14 @@ const ArcgisArcadeEditor = class {
|
|
|
3686
3682
|
contextMenuOrder: 1,
|
|
3687
3683
|
run: () => {
|
|
3688
3684
|
if (this.testData) {
|
|
3689
|
-
this._executeScript();
|
|
3685
|
+
this._executeScript().catch(console.error);
|
|
3690
3686
|
}
|
|
3691
3687
|
}
|
|
3692
3688
|
});
|
|
3693
3689
|
await this._codeEditorElt?.setFocus();
|
|
3694
3690
|
}
|
|
3695
3691
|
disconnectedCallback() {
|
|
3696
|
-
arcadeDefaults.
|
|
3692
|
+
arcadeDefaults.q(this);
|
|
3697
3693
|
arcadeDefaults.arcadeDefaults.disposeApiContextForModel(this._modelId);
|
|
3698
3694
|
arcadeDefaults.arcadeDefaults.disposeEditorProfileForModel(this._modelId);
|
|
3699
3695
|
while (this._disposables.length) {
|
|
@@ -3744,22 +3740,45 @@ const ArcgisArcadeEditor = class {
|
|
|
3744
3740
|
}
|
|
3745
3741
|
//#endregion
|
|
3746
3742
|
//#region Rendering the Action Bar
|
|
3743
|
+
renderAction({ id, label, icon, active, panelName, onClick = this._toggleSidePanel }) {
|
|
3744
|
+
return (index.h(index.Fragment, null, index.h("calcite-action", { id: id, text: label, icon: icon, active: active, onClick: onClick, "data-panel-name": panelName }), !this.sideActionBarExpanded && (index.h("calcite-tooltip", { label: label, "reference-element": id }, index.h("span", null, label)))));
|
|
3745
|
+
}
|
|
3747
3746
|
renderSideActionBar() {
|
|
3748
3747
|
if (this.hideSideBar) {
|
|
3749
3748
|
return null;
|
|
3750
3749
|
}
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3750
|
+
console.log("expanded", this.sideActionBarExpanded);
|
|
3751
|
+
return (index.h("calcite-action-bar", { class: "side-action-bar border-inline-start", expanded: !!this.sideActionBarExpanded, position: "end", onCalciteActionBarToggle: this._toggleSideActionBarExpanded }, index.h("calcite-action-group", null, this.renderAction({
|
|
3752
|
+
id: "profile-variables-action",
|
|
3753
|
+
label: this._t9nStrings?.profilevariables ?? "Profile variables",
|
|
3754
|
+
icon: "profile-variables",
|
|
3755
|
+
active: this.openedSidePanel === "variables",
|
|
3756
|
+
panelName: "variables"
|
|
3757
|
+
}), this.renderAction({
|
|
3758
|
+
id: "function-action",
|
|
3759
|
+
label: this._t9nStrings?.constantsandfunctions ?? "Constants and functions",
|
|
3760
|
+
icon: "function",
|
|
3761
|
+
active: this.openedSidePanel === "api",
|
|
3762
|
+
panelName: "api"
|
|
3763
|
+
}), this.suggestions?.length
|
|
3764
|
+
? this.renderAction({
|
|
3765
|
+
id: "suggestions-action",
|
|
3766
|
+
label: this._t9nStrings?.suggestions ?? "Suggestions",
|
|
3767
|
+
icon: "lightbulb",
|
|
3768
|
+
active: this.openedSidePanel === "suggestions",
|
|
3769
|
+
panelName: "suggestions"
|
|
3770
|
+
})
|
|
3771
|
+
: null, this.hideDocumentationActions
|
|
3772
|
+
? null
|
|
3773
|
+
: this.renderAction({
|
|
3774
|
+
id: "developer-website-action",
|
|
3775
|
+
label: this._t9nStrings?.help ?? "Help",
|
|
3776
|
+
icon: "question",
|
|
3777
|
+
active: false,
|
|
3778
|
+
panelName: "none",
|
|
3779
|
+
onClick: this._openArcadeHelp
|
|
3780
|
+
}))));
|
|
3781
|
+
}
|
|
3763
3782
|
//#endregion
|
|
3764
3783
|
//#region Render Side Panel
|
|
3765
3784
|
renderSidePanel() {
|
|
@@ -3800,62 +3819,7 @@ const ArcgisArcadeEditor = class {
|
|
|
3800
3819
|
};
|
|
3801
3820
|
ArcgisArcadeEditor.style = arcadeEditorCss;
|
|
3802
3821
|
|
|
3803
|
-
const
|
|
3804
|
-
const indentType = new Array(indentSpecs.size + 1).join(indentSpecs.char);
|
|
3805
|
-
function createPushFunc(p) {
|
|
3806
|
-
return (substring) => `\\${p.push(substring)}\\`;
|
|
3807
|
-
}
|
|
3808
|
-
function createPopFunc(p) {
|
|
3809
|
-
return (_, offset) => p[offset - 1] ?? "";
|
|
3810
|
-
}
|
|
3811
|
-
function indent(index, indentType) {
|
|
3812
|
-
return new Array(index + 1).join(indentType);
|
|
3813
|
-
}
|
|
3814
|
-
function jsonFormat(json) {
|
|
3815
|
-
// Convert to string and extract backslashes and strings
|
|
3816
|
-
const p = [];
|
|
3817
|
-
const pushFunc = createPushFunc(p);
|
|
3818
|
-
const jsonString = JSON.stringify(json)
|
|
3819
|
-
.replace(/\\./gu, pushFunc)
|
|
3820
|
-
.replace(/(".*?"|'.*?')/gu, pushFunc)
|
|
3821
|
-
.replace(/\s+/u, "");
|
|
3822
|
-
// Indent and insert newlines
|
|
3823
|
-
let indentIndex = 0;
|
|
3824
|
-
let out = "";
|
|
3825
|
-
for (let i = 0; i < jsonString.length; i++) {
|
|
3826
|
-
const c = jsonString.charAt(i);
|
|
3827
|
-
switch (c) {
|
|
3828
|
-
case "{":
|
|
3829
|
-
case "[":
|
|
3830
|
-
indentIndex += 1;
|
|
3831
|
-
out += `${c}\n${indent(indentIndex, indentType)}`;
|
|
3832
|
-
break;
|
|
3833
|
-
case "}":
|
|
3834
|
-
case "]":
|
|
3835
|
-
indentIndex -= 1;
|
|
3836
|
-
out += `\n${indent(indentIndex, indentType)}${c}`;
|
|
3837
|
-
break;
|
|
3838
|
-
case ",":
|
|
3839
|
-
out += `,\n${indent(indentIndex, indentType)}`;
|
|
3840
|
-
break;
|
|
3841
|
-
case ":":
|
|
3842
|
-
out += ": ";
|
|
3843
|
-
break;
|
|
3844
|
-
default:
|
|
3845
|
-
out += c;
|
|
3846
|
-
break;
|
|
3847
|
-
}
|
|
3848
|
-
}
|
|
3849
|
-
// Strip whitespace from numeric arrays and put backslashes
|
|
3850
|
-
// and strings back in
|
|
3851
|
-
const popFunc = createPopFunc(p);
|
|
3852
|
-
return out
|
|
3853
|
-
.replace(/\[[\d,\s]+?\]/gu, (m) => m.replace(/\s/gu, ""))
|
|
3854
|
-
.replace(/\\(\d+)\\/gu, popFunc) // strings
|
|
3855
|
-
.replace(/\\(\d+)\\/gu, popFunc); // backslashes in strings
|
|
3856
|
-
}
|
|
3857
|
-
|
|
3858
|
-
const arcadeResultsCss = ":host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2)}:host .flex-adjustable{flex:1 1 auto;overflow:hidden}:host .flex-row{display:flex;flex-direction:row;overflow:hidden}:host .flex-column{display:flex;flex-direction:column;overflow:hidden}:host .y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}:host header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}:host .ltr-container{direction:ltr}:host calcite-action-bar calcite-action-group{padding-inline-end:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group:last-child{border-inline-end-width:0px}:host calcite-action-bar calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-half)}:host .notice-container{margin:var(--calcite-spacing-quarter);padding:var(--calcite-spacing-half);background-color:var(--calcite-color-foreground-1)}:host .color-info{color:var(--calcite-color-info)}:host .color-error{color:var(--calcite-color-danger)}:host .color-success{color:var(--calcite-color-success)}:host [class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-three-quarter)}:host .console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-three-quarter);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}:host .result-value-table table{display:block;max-width:fit-content;overflow-x:auto;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap}:host .result-value-table table thead{background-color:var(--calcite-color-foreground-2)}:host .result-value-table table tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}:host .result-value-table table th,:host .result-value-table table td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-quarter)}:host .result-value-table table th .string-value,:host .result-value-table table td .string-value{white-space:pre}:host .result-value-table table th{font-weight:var(--calcite-font-weight-medium)}:host .tree-item-label,:host .number-value,:host .string-value,:host .boolean-value{font-family:var(--calcite-code-family)}:host .tree-item-label,:host .value-type{color:var(--calcite-text-2);font-weight:var(--calcite-font-weight-normal)}:host .dictionary-property{color:var(--arcgis-arcade-editor-identifier)}:host .number-value{color:var(--arcgis-arcade-editor-number)}:host .string-value{color:var(--arcgis-arcade-editor-string);white-space:pre-wrap}:host .constant-value{color:var(--arcgis-arcade-editor-constant)}:host .date-value{color:var(--arcgis-arcade-editor-date)}";
|
|
3822
|
+
const arcadeResultsCss = ":host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2)}:host .flex-adjustable{flex:1 1 auto;overflow:hidden}:host .flex-row{display:flex;flex-direction:row;overflow:hidden}:host .flex-column{display:flex;flex-direction:column;overflow:hidden}:host .y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}:host header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}:host .ltr-container{direction:ltr}:host calcite-action-bar calcite-action-group{padding-inline-end:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group:last-child{border-inline-end-width:0px}:host calcite-action-bar calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-half)}:host .notice-container{margin:var(--calcite-spacing-quarter);padding:var(--calcite-spacing-half);background-color:var(--calcite-color-foreground-1)}:host .color-info{color:var(--calcite-color-status-info)}:host .color-error{color:var(--calcite-color-status-danger)}:host .color-success{color:var(--calcite-color-status-success)}:host [class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-three-quarter)}:host .console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-three-quarter);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}:host .result-value-table table{display:block;max-width:fit-content;overflow-x:auto;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap}:host .result-value-table table thead{background-color:var(--calcite-color-foreground-2)}:host .result-value-table table tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}:host .result-value-table table th,:host .result-value-table table td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-quarter)}:host .result-value-table table th .string-value,:host .result-value-table table td .string-value{white-space:pre}:host .result-value-table table th{font-weight:var(--calcite-font-weight-medium)}:host .tree-item-label,:host .number-value,:host .string-value,:host .boolean-value{font-family:var(--calcite-code-family)}:host .tree-item-label,:host .value-type{color:var(--calcite-color-text-2);font-weight:var(--calcite-font-weight-normal)}:host .dictionary-property{color:var(--arcgis-arcade-editor-identifier)}:host .number-value{color:var(--arcgis-arcade-editor-number)}:host .string-value{color:var(--arcgis-arcade-editor-string);white-space:pre-wrap}:host .constant-value{color:var(--arcgis-arcade-editor-constant)}:host .date-value{color:var(--arcgis-arcade-editor-date)}";
|
|
3859
3823
|
|
|
3860
3824
|
//#region Specialized Constants
|
|
3861
3825
|
const treeProps = {
|
|
@@ -3876,10 +3840,10 @@ function renderDictionaryProperty(key) {
|
|
|
3876
3840
|
return (index.h(index.Fragment, null, index.h("span", { class: "dictionary-property" }, key), index.h("span", null, ":\u00A0")));
|
|
3877
3841
|
}
|
|
3878
3842
|
function renderDictionaryAsJsonTree(value, subtree = false) {
|
|
3879
|
-
return (index.h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, index.h("calcite-tree-item", { class: "string-value" },
|
|
3843
|
+
return (index.h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, index.h("calcite-tree-item", { class: "string-value" }, JSON.stringify(value.castAsJson(), undefined, 2))));
|
|
3880
3844
|
}
|
|
3881
3845
|
function renderGeometryTree(value, subtree = false) {
|
|
3882
|
-
return (index.h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, index.h("calcite-tree-item", null, index.h("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), index.h("calcite-tree-item", null, index.h("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), index.h("span", { class: "string-value" },
|
|
3846
|
+
return (index.h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, index.h("calcite-tree-item", null, index.h("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), index.h("calcite-tree-item", null, index.h("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), index.h("span", { class: "string-value" }, JSON.stringify(value, undefined, 2))))));
|
|
3883
3847
|
}
|
|
3884
3848
|
function renderSimpleValue(arcadeResult) {
|
|
3885
3849
|
switch (arcadeResult.type) {
|
|
@@ -3887,7 +3851,7 @@ function renderSimpleValue(arcadeResult) {
|
|
|
3887
3851
|
case "null":
|
|
3888
3852
|
return index.h("span", { class: "constant-value" }, arcadeResult.type);
|
|
3889
3853
|
case "text":
|
|
3890
|
-
return index.h("span", { class: "string-value" }, arcadeDefaults.
|
|
3854
|
+
return index.h("span", { class: "string-value" }, arcadeDefaults.D(arcadeResult.value));
|
|
3891
3855
|
case "number":
|
|
3892
3856
|
return index.h("span", { class: "number-value" }, arcadeResult.value.toString());
|
|
3893
3857
|
case "boolean":
|
|
@@ -3895,9 +3859,9 @@ function renderSimpleValue(arcadeResult) {
|
|
|
3895
3859
|
case "date":
|
|
3896
3860
|
return index.h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
|
|
3897
3861
|
case "dateOnly":
|
|
3898
|
-
return index.h("span", { class: "string-value" }, arcadeDefaults.
|
|
3862
|
+
return index.h("span", { class: "string-value" }, arcadeDefaults.D(formatArcadeResultDateOnly(arcadeResult)));
|
|
3899
3863
|
case "time":
|
|
3900
|
-
return index.h("span", { class: "string-value" }, arcadeDefaults.
|
|
3864
|
+
return index.h("span", { class: "string-value" }, arcadeDefaults.D(formatArcadeResultTimeOnly(arcadeResult)));
|
|
3901
3865
|
default:
|
|
3902
3866
|
return null;
|
|
3903
3867
|
}
|
|
@@ -3944,7 +3908,7 @@ const ArcgisArcadeResults = class {
|
|
|
3944
3908
|
await arcadeDefaults.B(this, index.getAssetPath("./assets"));
|
|
3945
3909
|
}
|
|
3946
3910
|
disconnectedCallback() {
|
|
3947
|
-
arcadeDefaults.
|
|
3911
|
+
arcadeDefaults.q(this);
|
|
3948
3912
|
}
|
|
3949
3913
|
// #endregion
|
|
3950
3914
|
//#region Private Methods
|
|
@@ -3971,18 +3935,18 @@ const ArcgisArcadeResults = class {
|
|
|
3971
3935
|
return index.h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
|
|
3972
3936
|
}
|
|
3973
3937
|
const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
|
|
3974
|
-
return (index.h("calcite-list", null, this.result ? (index.h(index.Fragment, null, index.h("calcite-list-item", { label: arcadeDefaults.
|
|
3938
|
+
return (index.h("calcite-list", null, this.result ? (index.h(index.Fragment, null, index.h("calcite-list-item", { label: arcadeDefaults.Z(this._t9nStrings?.lastexecutionformat, {
|
|
3975
3939
|
timeStamp: new Intl.DateTimeFormat(this._t9nLocale, {
|
|
3976
3940
|
dateStyle: "medium",
|
|
3977
3941
|
timeStyle: "medium"
|
|
3978
3942
|
}).format(this.result.timeStamp)
|
|
3979
|
-
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.
|
|
3943
|
+
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.Z(this._t9nStrings?.compilationtimeformat, {
|
|
3980
3944
|
time: new Intl.NumberFormat(this._t9nLocale, {
|
|
3981
3945
|
style: "unit",
|
|
3982
3946
|
unit: "millisecond",
|
|
3983
3947
|
maximumFractionDigits: 2
|
|
3984
3948
|
}).format(this.result.compilationTime ?? 0)
|
|
3985
|
-
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.
|
|
3949
|
+
}) }, index.h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), index.h("calcite-list-item", { label: arcadeDefaults.Z(this._t9nStrings?.executiontimeformat, {
|
|
3986
3950
|
time: new Intl.NumberFormat(this._t9nLocale, {
|
|
3987
3951
|
style: "unit",
|
|
3988
3952
|
unit: "millisecond",
|
|
@@ -3999,7 +3963,7 @@ const ArcgisArcadeResults = class {
|
|
|
3999
3963
|
}
|
|
4000
3964
|
switch (this.result?.type) {
|
|
4001
3965
|
case "error":
|
|
4002
|
-
return (index.h("div", { class: "result-value-simple flex-adjustable" }, arcadeDefaults.
|
|
3966
|
+
return (index.h("div", { class: "result-value-simple flex-adjustable" }, arcadeDefaults.Z(this._t9nStrings?.executionerrorformat, {
|
|
4003
3967
|
message: this.result.value
|
|
4004
3968
|
})));
|
|
4005
3969
|
case "null":
|
|
@@ -4036,7 +4000,7 @@ const ArcgisArcadeResults = class {
|
|
|
4036
4000
|
renderArrayHeader(arcadeResult) {
|
|
4037
4001
|
const items = arcadeResult.value ?? [];
|
|
4038
4002
|
const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
|
|
4039
|
-
return (index.h(index.Fragment, null, index.h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (index.h("span", null, "\u00A0", arcadeDefaults.
|
|
4003
|
+
return (index.h(index.Fragment, null, index.h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (index.h("span", null, "\u00A0", arcadeDefaults.Z(this._t9nStrings?.showingfirstitemsformat, {
|
|
4040
4004
|
count: MaxArrayItems.toString()
|
|
4041
4005
|
}))) : null));
|
|
4042
4006
|
}
|
|
@@ -4082,7 +4046,7 @@ const ArcgisArcadeResults = class {
|
|
|
4082
4046
|
}
|
|
4083
4047
|
}
|
|
4084
4048
|
renderFeatureSetLabel(arcadeResult) {
|
|
4085
|
-
return (index.h("div", { class: "value-type" }, index.h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (index.h("span", null, "\u00A0", arcadeDefaults.
|
|
4049
|
+
return (index.h("div", { class: "value-type" }, index.h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (index.h("span", null, "\u00A0", arcadeDefaults.Z(this._t9nStrings?.showingfirstitemsformat, {
|
|
4086
4050
|
count: BatchSize.toString()
|
|
4087
4051
|
}))) : null));
|
|
4088
4052
|
}
|
|
@@ -4111,10 +4075,10 @@ const ArcgisArcadeSuggestions = class {
|
|
|
4111
4075
|
index.registerInstance(this, hostRef);
|
|
4112
4076
|
this.close = index.createEvent(this, "close", 3);
|
|
4113
4077
|
this.itemSelected = index.createEvent(this, "itemSelected", 3);
|
|
4114
|
-
|
|
4115
|
-
|
|
4078
|
+
this._updateFilterValue = (e) => {
|
|
4079
|
+
this._filterValue = e.target?.value ?? "";
|
|
4080
|
+
};
|
|
4116
4081
|
this._emitItemSelected = (e) => {
|
|
4117
|
-
// @ts-expect-error
|
|
4118
4082
|
const item = e.target?.["data-item"];
|
|
4119
4083
|
if (!item) {
|
|
4120
4084
|
return;
|
|
@@ -4126,7 +4090,6 @@ const ArcgisArcadeSuggestions = class {
|
|
|
4126
4090
|
}
|
|
4127
4091
|
};
|
|
4128
4092
|
this._showSuggestionDetail = (e) => {
|
|
4129
|
-
// @ts-expect-error
|
|
4130
4093
|
const item = e.target?.["data-item"];
|
|
4131
4094
|
if (!item) {
|
|
4132
4095
|
return;
|
|
@@ -4134,8 +4097,12 @@ const ArcgisArcadeSuggestions = class {
|
|
|
4134
4097
|
e.stopPropagation();
|
|
4135
4098
|
this._selectedSuggestion = item;
|
|
4136
4099
|
};
|
|
4137
|
-
this._emitClose = () =>
|
|
4138
|
-
|
|
4100
|
+
this._emitClose = () => {
|
|
4101
|
+
this.close.emit();
|
|
4102
|
+
};
|
|
4103
|
+
this._beforeBack = async () => {
|
|
4104
|
+
this._selectedSuggestion = undefined;
|
|
4105
|
+
};
|
|
4139
4106
|
this._lang = "";
|
|
4140
4107
|
this._t9nLocale = "";
|
|
4141
4108
|
this._t9nStrings = undefined;
|
|
@@ -4157,7 +4124,7 @@ const ArcgisArcadeSuggestions = class {
|
|
|
4157
4124
|
disconnectedCallback() {
|
|
4158
4125
|
this._flowObserver?.disconnect();
|
|
4159
4126
|
this._themeChangedListner?.dispose();
|
|
4160
|
-
arcadeDefaults.
|
|
4127
|
+
arcadeDefaults.q(this);
|
|
4161
4128
|
}
|
|
4162
4129
|
// #endregion
|
|
4163
4130
|
//#region Private Methods
|
|
@@ -4175,7 +4142,7 @@ const ArcgisArcadeSuggestions = class {
|
|
|
4175
4142
|
// When switching between flow the same reference is reused
|
|
4176
4143
|
this._flowObserver = new MutationObserver(() => {
|
|
4177
4144
|
// Get the last panel and try to set focus on the input element
|
|
4178
|
-
arcadeDefaults.
|
|
4145
|
+
arcadeDefaults.W(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
4179
4146
|
});
|
|
4180
4147
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
4181
4148
|
}
|
|
@@ -4205,7 +4172,7 @@ const ArcgisArcadeSuggestions = class {
|
|
|
4205
4172
|
return (index.h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, index.h("calcite-button", { width: "half", slot: "footer", appearance: "outline", kind: "brand", "icon-start": "code", scale: "s", onClick: this._emitItemSelected, ref: (e) => void e?.setFocus(), "data-item": suggestion }, this._t9nStrings?.insert), index.h("calcite-block", { open: true, heading: suggestion.label, description: suggestion.description }, index.h("div", { innerHTML: convertMarkdownString(suggestion.documentation) }), index.h("pre", null, index.h("code", { ref: (e) => e === undefined ? undefined : void colorizeCodeElement(e, suggestion.code).catch(console.error) })))));
|
|
4206
4173
|
}
|
|
4207
4174
|
render() {
|
|
4208
|
-
return (index.h(index.Host, null, index.h("style", null, this._colorizeStyle), index.h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, index.h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, index.h(
|
|
4175
|
+
return (index.h(index.Host, null, index.h("style", null, this._colorizeStyle), index.h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, index.h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, index.h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), index.h("calcite-list", null, this.renderSuggestionGroups())), this.renderSuggestionFlowItem())));
|
|
4209
4176
|
}
|
|
4210
4177
|
static get assetsDirs() { return ["assets"]; }
|
|
4211
4178
|
get _hostElement() { return index.getElement(this); }
|
|
@@ -4217,21 +4184,30 @@ ArcgisArcadeSuggestions.style = arcadeSuggestionsCss;
|
|
|
4217
4184
|
|
|
4218
4185
|
const arcadeVariablesCss = ":host{background-color:var(--calcite-color-foreground-1)}:host .notice-container{margin:var(--calcite-spacing-quarter);padding:var(--calcite-spacing-half);background-color:var(--calcite-color-foreground-1)}:host .sticky{position:sticky;top:0px;z-index:10}:host calcite-flow{height:100%}";
|
|
4219
4186
|
|
|
4187
|
+
function stopEnterPropagation(e) {
|
|
4188
|
+
if (e.key === "Enter") {
|
|
4189
|
+
e.stopPropagation();
|
|
4190
|
+
}
|
|
4191
|
+
}
|
|
4220
4192
|
const ArcgisArcadeVariables = class {
|
|
4221
4193
|
constructor(hostRef) {
|
|
4222
4194
|
index.registerInstance(this, hostRef);
|
|
4223
4195
|
this.close = index.createEvent(this, "close", 3);
|
|
4224
4196
|
this.itemSelected = index.createEvent(this, "itemSelected", 3);
|
|
4225
|
-
|
|
4226
|
-
|
|
4197
|
+
this._updateFilterValue = (e) => {
|
|
4198
|
+
this._filterValue = e.target.value;
|
|
4199
|
+
};
|
|
4227
4200
|
this._beforeBack = async () => {
|
|
4228
4201
|
this.removeLastPanelRenderer();
|
|
4229
4202
|
this._filterValue = "";
|
|
4230
4203
|
};
|
|
4231
|
-
this._emitClose = () =>
|
|
4232
|
-
|
|
4204
|
+
this._emitClose = () => {
|
|
4205
|
+
this.close.emit();
|
|
4206
|
+
};
|
|
4207
|
+
this._backToTop = () => {
|
|
4208
|
+
this._flowItemRenderers = [];
|
|
4209
|
+
};
|
|
4233
4210
|
this._emitItemSelected = (e) => {
|
|
4234
|
-
// @ts-expect-error
|
|
4235
4211
|
const variable = e.target?.["data-item"];
|
|
4236
4212
|
if (!variable || variable.nonInteractive) {
|
|
4237
4213
|
return;
|
|
@@ -4242,13 +4218,7 @@ const ArcgisArcadeVariables = class {
|
|
|
4242
4218
|
this.itemSelected.emit(variable.snippet);
|
|
4243
4219
|
}
|
|
4244
4220
|
};
|
|
4245
|
-
this._stopEnterPropagation = (e) => {
|
|
4246
|
-
if (e.key === "Enter") {
|
|
4247
|
-
e.stopPropagation();
|
|
4248
|
-
}
|
|
4249
|
-
};
|
|
4250
4221
|
this._showCollectionPanel = (e) => {
|
|
4251
|
-
// @ts-expect-error
|
|
4252
4222
|
const collectionVariable = e.target?.["data-item"];
|
|
4253
4223
|
if (!collectionVariable) {
|
|
4254
4224
|
return;
|
|
@@ -4274,7 +4244,7 @@ const ArcgisArcadeVariables = class {
|
|
|
4274
4244
|
await arcadeDefaults.B(this, index.getAssetPath("./assets"));
|
|
4275
4245
|
}
|
|
4276
4246
|
disconnectedCallback() {
|
|
4277
|
-
arcadeDefaults.
|
|
4247
|
+
arcadeDefaults.q(this);
|
|
4278
4248
|
this._flowObserver?.disconnect();
|
|
4279
4249
|
}
|
|
4280
4250
|
// #endregion
|
|
@@ -4299,7 +4269,7 @@ const ArcgisArcadeVariables = class {
|
|
|
4299
4269
|
// When switching between flow the same reference is reused
|
|
4300
4270
|
this._flowObserver = new MutationObserver(() => {
|
|
4301
4271
|
// Get the last panel and try to set focus on the input element
|
|
4302
|
-
arcadeDefaults.
|
|
4272
|
+
arcadeDefaults.W(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
4303
4273
|
});
|
|
4304
4274
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
4305
4275
|
}
|
|
@@ -4317,17 +4287,23 @@ const ArcgisArcadeVariables = class {
|
|
|
4317
4287
|
let loading = this.loading;
|
|
4318
4288
|
if (!loading && !collection.loaded) {
|
|
4319
4289
|
// Request to load and update mutation counter when done
|
|
4320
|
-
collection
|
|
4290
|
+
collection
|
|
4291
|
+
.loadSource()
|
|
4292
|
+
.then(() => setTimeout(() => {
|
|
4321
4293
|
this._mutationCounter += 1;
|
|
4322
|
-
}))
|
|
4294
|
+
}))
|
|
4295
|
+
.catch(() => {
|
|
4296
|
+
console.error("Error loading collection");
|
|
4297
|
+
loading = false;
|
|
4298
|
+
});
|
|
4323
4299
|
loading = true;
|
|
4324
4300
|
}
|
|
4325
|
-
return (index.h("calcite-flow-item", { heading: this._t9nStrings?.profilevariables, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, index.h("calcite-action", { slot: "header-actions-end", text: this._t9nStrings?.backtotop ?? "Back to top", scale: "m", hidden: topPanel, icon: "chevrons-left", iconFlipRtl: true, onClick: this._backToTop }), index.h(
|
|
4301
|
+
return (index.h("calcite-flow-item", { heading: this._t9nStrings?.profilevariables, description: collection.breadcrumb, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, index.h("calcite-action", { slot: "header-actions-end", text: this._t9nStrings?.backtotop ?? "Back to top", scale: "m", hidden: topPanel, icon: "chevrons-left", iconFlipRtl: true, onClick: this._backToTop }), index.h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), loading ? (index.h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (index.h("calcite-list", null, this.renderEditorVariables(collection)))));
|
|
4326
4302
|
};
|
|
4327
4303
|
}
|
|
4328
4304
|
renderEditorVariables(collection) {
|
|
4329
4305
|
// Filter the variables. Skip group, we will filter the children later on.
|
|
4330
|
-
const filterExpression = arcadeDefaults.
|
|
4306
|
+
const filterExpression = arcadeDefaults.K(this._filterValue);
|
|
4331
4307
|
const filteredVariables = collection.variables.filter((variable) => variable.passFilter(filterExpression));
|
|
4332
4308
|
if (!filteredVariables.length) {
|
|
4333
4309
|
return index.h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No item");
|
|
@@ -4340,7 +4316,7 @@ const ArcgisArcadeVariables = class {
|
|
|
4340
4316
|
// Group is a collection but we represent it differently
|
|
4341
4317
|
return (index.h("calcite-list-item-group", { heading: variable.getLabel() }, this.renderEditorVariables(variable)));
|
|
4342
4318
|
default:
|
|
4343
|
-
return (index.h("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (index.h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showCollectionPanel, onKeyPress:
|
|
4319
|
+
return (index.h("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (index.h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showCollectionPanel, onKeyPress: stopEnterPropagation, "data-item": variable })) : null, variable.icon ? index.h("calcite-icon", { icon: variable.icon, scale: "s", slot: "content-start" }) : null));
|
|
4344
4320
|
}
|
|
4345
4321
|
}
|
|
4346
4322
|
render() {
|