@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,10 +1,11 @@
|
|
|
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
|
import { editor, MarkerSeverity, Range, languages, Emitter } from 'monaco-editor';
|
|
7
7
|
import { CompletionItemKind, DiagnosticSeverity, InsertTextFormat } from 'vscode-languageserver-types';
|
|
8
|
+
import { r as re } from './index2.js';
|
|
8
9
|
|
|
9
10
|
var j={False:"false",Null:"null",True:"true"},f={Break:"break",Continue:"continue",Else:"else",For:"for",From:"from",Function:"function",If:"if",Import:"import",Export:"export",In:"in",Return:"return",Var:"var",While:"while"},Fe=["++","--"],Qe=["-","+","!","~"],Ze=["=","/=","*=","%=","+=","-="],Xe=["||","&&"],Lt=["|","&",">>","<<",">>>","^","==","!=","<","<=",">",">=","+","-","*","/","%"];var U=[[],[],[]];Fe.forEach(t=>U[t.length-1]?.push(t));Qe.forEach(t=>U[t.length-1]?.push(t));Xe.forEach(t=>U[t.length-1]?.push(t));Ze.forEach(t=>U[t.length-1]?.push(t));Lt.forEach(t=>U[t.length-1]?.push(t));var ht=Object.values(f),dt=Object.values(j);dt.map(t=>({label:t,kind:CompletionItemKind.Constant}));ht.map(t=>({label:t,kind:CompletionItemKind.Keyword}));
|
|
10
11
|
|
|
@@ -230,16 +231,13 @@ class DiagnosticsAdapter {
|
|
|
230
231
|
if (languageId !== this._languageId) {
|
|
231
232
|
return;
|
|
232
233
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}, 500);
|
|
241
|
-
}));
|
|
242
|
-
this._doValidate(model, languageId);
|
|
234
|
+
const debouncedValidate = re(() => {
|
|
235
|
+
this._doValidate(model, languageId).catch((err) => {
|
|
236
|
+
throw err;
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
this._listener.set(model.uri.toString(), model.onDidChangeContent(debouncedValidate));
|
|
240
|
+
this._doValidate(model, languageId).catch(console.error);
|
|
243
241
|
};
|
|
244
242
|
const onModelRemoved = (model) => {
|
|
245
243
|
const uriStr = model.uri.toString();
|
|
@@ -269,7 +267,7 @@ class DiagnosticsAdapter {
|
|
|
269
267
|
this._disposables.push(defaults.onModelContextDidChange((key) => {
|
|
270
268
|
editor.getModels().forEach((model) => {
|
|
271
269
|
if (model.getLanguageId() === this._languageId && model.uri.toString() === key) {
|
|
272
|
-
this._doValidate(model, this._languageId);
|
|
270
|
+
this._doValidate(model, this._languageId).catch(console.error);
|
|
273
271
|
}
|
|
274
272
|
});
|
|
275
273
|
}));
|
|
@@ -1,11 +1,11 @@
|
|
|
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
|
import { proxyCustomElement, HTMLElement, createEvent, getAssetPath, h, Fragment, Host } from '@stencil/core/internal/client';
|
|
7
|
-
import {
|
|
8
|
-
import { B,
|
|
7
|
+
import { g as importArcade, s as supportedFields } from './fields.js';
|
|
8
|
+
import { B, q, Z, D } from './index2.js';
|
|
9
9
|
import '@esri/calcite-components/dist/components/calcite-tree.js';
|
|
10
10
|
import '@esri/calcite-components/dist/components/calcite-tree-item.js';
|
|
11
11
|
import '@esri/calcite-components/dist/components/calcite-loader.js';
|
|
@@ -175,17 +175,18 @@ function formatArcadeResultDateOnly(dateObject) {
|
|
|
175
175
|
function formatArcadeResultTimeOnly(dateObject) {
|
|
176
176
|
return dateObject.value.toString();
|
|
177
177
|
}
|
|
178
|
-
async function
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
async function convertScriptOutputToArcadeResult(scriptOutput, timeZone = "system") {
|
|
179
|
+
const arcadeResult = valueToArcadeResult(scriptOutput);
|
|
180
|
+
if (arcadeResult.type !== "featureSet") {
|
|
181
|
+
return arcadeResult;
|
|
181
182
|
}
|
|
182
183
|
// Feature Set needs to be loaded
|
|
183
|
-
await
|
|
184
|
+
await arcadeResult.value.load();
|
|
184
185
|
// Create the first iterator
|
|
185
|
-
|
|
186
|
+
arcadeResult.iterator = arcadeResult.value.iterator({ aborted: false });
|
|
186
187
|
// Load the first batch of items
|
|
187
|
-
|
|
188
|
-
return
|
|
188
|
+
arcadeResult.features = (await arcadeResult.iterator.nextBatchAsArcadeFeatures(BatchSize, timeZone)) ?? [];
|
|
189
|
+
return arcadeResult;
|
|
189
190
|
}
|
|
190
191
|
async function executeScript(editorProfile, script, testContext, console) {
|
|
191
192
|
//
|
|
@@ -213,12 +214,12 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
213
214
|
// Execute the script
|
|
214
215
|
const scriptOutput = await executor.executeAsync(profileVariableInstances, executeContext);
|
|
215
216
|
// Convert script output to arcade result object and load data if necessary
|
|
216
|
-
const
|
|
217
|
+
const arcadeResult = await convertScriptOutputToArcadeResult(scriptOutput, timeZone);
|
|
217
218
|
// Timestamp and measure cost
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
return
|
|
219
|
+
arcadeResult.timeStamp = timeStamp;
|
|
220
|
+
arcadeResult.compilationTime = t1 - t0;
|
|
221
|
+
arcadeResult.executionTime = performance.now() - t1;
|
|
222
|
+
return arcadeResult;
|
|
222
223
|
//
|
|
223
224
|
}
|
|
224
225
|
catch (error) {
|
|
@@ -237,62 +238,7 @@ async function executeScript(editorProfile, script, testContext, console) {
|
|
|
237
238
|
}
|
|
238
239
|
}
|
|
239
240
|
|
|
240
|
-
const
|
|
241
|
-
const indentType = new Array(indentSpecs.size + 1).join(indentSpecs.char);
|
|
242
|
-
function createPushFunc(p) {
|
|
243
|
-
return (substring) => `\\${p.push(substring)}\\`;
|
|
244
|
-
}
|
|
245
|
-
function createPopFunc(p) {
|
|
246
|
-
return (_, offset) => p[offset - 1] ?? "";
|
|
247
|
-
}
|
|
248
|
-
function indent(index, indentType) {
|
|
249
|
-
return new Array(index + 1).join(indentType);
|
|
250
|
-
}
|
|
251
|
-
function jsonFormat(json) {
|
|
252
|
-
// Convert to string and extract backslashes and strings
|
|
253
|
-
const p = [];
|
|
254
|
-
const pushFunc = createPushFunc(p);
|
|
255
|
-
const jsonString = JSON.stringify(json)
|
|
256
|
-
.replace(/\\./gu, pushFunc)
|
|
257
|
-
.replace(/(".*?"|'.*?')/gu, pushFunc)
|
|
258
|
-
.replace(/\s+/u, "");
|
|
259
|
-
// Indent and insert newlines
|
|
260
|
-
let indentIndex = 0;
|
|
261
|
-
let out = "";
|
|
262
|
-
for (let i = 0; i < jsonString.length; i++) {
|
|
263
|
-
const c = jsonString.charAt(i);
|
|
264
|
-
switch (c) {
|
|
265
|
-
case "{":
|
|
266
|
-
case "[":
|
|
267
|
-
indentIndex += 1;
|
|
268
|
-
out += `${c}\n${indent(indentIndex, indentType)}`;
|
|
269
|
-
break;
|
|
270
|
-
case "}":
|
|
271
|
-
case "]":
|
|
272
|
-
indentIndex -= 1;
|
|
273
|
-
out += `\n${indent(indentIndex, indentType)}${c}`;
|
|
274
|
-
break;
|
|
275
|
-
case ",":
|
|
276
|
-
out += `,\n${indent(indentIndex, indentType)}`;
|
|
277
|
-
break;
|
|
278
|
-
case ":":
|
|
279
|
-
out += ": ";
|
|
280
|
-
break;
|
|
281
|
-
default:
|
|
282
|
-
out += c;
|
|
283
|
-
break;
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
// Strip whitespace from numeric arrays and put backslashes
|
|
287
|
-
// and strings back in
|
|
288
|
-
const popFunc = createPopFunc(p);
|
|
289
|
-
return out
|
|
290
|
-
.replace(/\[[\d,\s]+?\]/gu, (m) => m.replace(/\s/gu, ""))
|
|
291
|
-
.replace(/\\(\d+)\\/gu, popFunc) // strings
|
|
292
|
-
.replace(/\\(\d+)\\/gu, popFunc); // backslashes in strings
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
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)}";
|
|
241
|
+
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)}";
|
|
296
242
|
|
|
297
243
|
//#region Specialized Constants
|
|
298
244
|
const treeProps = {
|
|
@@ -313,10 +259,10 @@ function renderDictionaryProperty(key) {
|
|
|
313
259
|
return (h(Fragment, null, h("span", { class: "dictionary-property" }, key), h("span", null, ":\u00A0")));
|
|
314
260
|
}
|
|
315
261
|
function renderDictionaryAsJsonTree(value, subtree = false) {
|
|
316
|
-
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", { class: "string-value" },
|
|
262
|
+
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", { class: "string-value" }, JSON.stringify(value.castAsJson(), undefined, 2))));
|
|
317
263
|
}
|
|
318
264
|
function renderGeometryTree(value, subtree = false) {
|
|
319
|
-
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), h("span", { class: "string-value" },
|
|
265
|
+
return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("type"), value.type)), h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, renderDictionaryProperty("value"), h("span", { class: "string-value" }, JSON.stringify(value, undefined, 2))))));
|
|
320
266
|
}
|
|
321
267
|
function renderSimpleValue(arcadeResult) {
|
|
322
268
|
switch (arcadeResult.type) {
|
|
@@ -324,7 +270,7 @@ function renderSimpleValue(arcadeResult) {
|
|
|
324
270
|
case "null":
|
|
325
271
|
return h("span", { class: "constant-value" }, arcadeResult.type);
|
|
326
272
|
case "text":
|
|
327
|
-
return h("span", { class: "string-value" },
|
|
273
|
+
return h("span", { class: "string-value" }, D(arcadeResult.value));
|
|
328
274
|
case "number":
|
|
329
275
|
return h("span", { class: "number-value" }, arcadeResult.value.toString());
|
|
330
276
|
case "boolean":
|
|
@@ -332,9 +278,9 @@ function renderSimpleValue(arcadeResult) {
|
|
|
332
278
|
case "date":
|
|
333
279
|
return h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
|
|
334
280
|
case "dateOnly":
|
|
335
|
-
return h("span", { class: "string-value" },
|
|
281
|
+
return h("span", { class: "string-value" }, D(formatArcadeResultDateOnly(arcadeResult)));
|
|
336
282
|
case "time":
|
|
337
|
-
return h("span", { class: "string-value" },
|
|
283
|
+
return h("span", { class: "string-value" }, D(formatArcadeResultTimeOnly(arcadeResult)));
|
|
338
284
|
default:
|
|
339
285
|
return null;
|
|
340
286
|
}
|
|
@@ -383,7 +329,7 @@ const ArcgisArcadeResults = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeR
|
|
|
383
329
|
await B(this, getAssetPath("./assets"));
|
|
384
330
|
}
|
|
385
331
|
disconnectedCallback() {
|
|
386
|
-
|
|
332
|
+
q(this);
|
|
387
333
|
}
|
|
388
334
|
// #endregion
|
|
389
335
|
//#region Private Methods
|
|
@@ -410,18 +356,18 @@ const ArcgisArcadeResults = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeR
|
|
|
410
356
|
return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
|
|
411
357
|
}
|
|
412
358
|
const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
|
|
413
|
-
return (h("calcite-list", null, this.result ? (h(Fragment, null, h("calcite-list-item", { label:
|
|
359
|
+
return (h("calcite-list", null, this.result ? (h(Fragment, null, h("calcite-list-item", { label: Z(this._t9nStrings?.lastexecutionformat, {
|
|
414
360
|
timeStamp: new Intl.DateTimeFormat(this._t9nLocale, {
|
|
415
361
|
dateStyle: "medium",
|
|
416
362
|
timeStyle: "medium"
|
|
417
363
|
}).format(this.result.timeStamp)
|
|
418
|
-
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label:
|
|
364
|
+
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: Z(this._t9nStrings?.compilationtimeformat, {
|
|
419
365
|
time: new Intl.NumberFormat(this._t9nLocale, {
|
|
420
366
|
style: "unit",
|
|
421
367
|
unit: "millisecond",
|
|
422
368
|
maximumFractionDigits: 2
|
|
423
369
|
}).format(this.result.compilationTime ?? 0)
|
|
424
|
-
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label:
|
|
370
|
+
}) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: Z(this._t9nStrings?.executiontimeformat, {
|
|
425
371
|
time: new Intl.NumberFormat(this._t9nLocale, {
|
|
426
372
|
style: "unit",
|
|
427
373
|
unit: "millisecond",
|
|
@@ -438,7 +384,7 @@ const ArcgisArcadeResults = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeR
|
|
|
438
384
|
}
|
|
439
385
|
switch (this.result?.type) {
|
|
440
386
|
case "error":
|
|
441
|
-
return (h("div", { class: "result-value-simple flex-adjustable" },
|
|
387
|
+
return (h("div", { class: "result-value-simple flex-adjustable" }, Z(this._t9nStrings?.executionerrorformat, {
|
|
442
388
|
message: this.result.value
|
|
443
389
|
})));
|
|
444
390
|
case "null":
|
|
@@ -475,7 +421,7 @@ const ArcgisArcadeResults = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeR
|
|
|
475
421
|
renderArrayHeader(arcadeResult) {
|
|
476
422
|
const items = arcadeResult.value ?? [];
|
|
477
423
|
const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
|
|
478
|
-
return (h(Fragment, null, h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h("span", null, "\u00A0",
|
|
424
|
+
return (h(Fragment, null, h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h("span", null, "\u00A0", Z(this._t9nStrings?.showingfirstitemsformat, {
|
|
479
425
|
count: MaxArrayItems.toString()
|
|
480
426
|
}))) : null));
|
|
481
427
|
}
|
|
@@ -521,7 +467,7 @@ const ArcgisArcadeResults = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeR
|
|
|
521
467
|
}
|
|
522
468
|
}
|
|
523
469
|
renderFeatureSetLabel(arcadeResult) {
|
|
524
|
-
return (h("div", { class: "value-type" }, h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h("span", null, "\u00A0",
|
|
470
|
+
return (h("div", { class: "value-type" }, h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h("span", null, "\u00A0", Z(this._t9nStrings?.showingfirstitemsformat, {
|
|
525
471
|
count: BatchSize.toString()
|
|
526
472
|
}))) : null));
|
|
527
473
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
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
|
import { proxyCustomElement, HTMLElement, createEvent, getAssetPath, h, Host } from '@stencil/core/internal/client';
|
|
7
7
|
import { g as generateColorizeStyles, o as onColorizeThemeChanged, c as convertMarkdownString, b as colorizeCodeElement } from './markdown.js';
|
|
8
|
-
import { S as StickyFilterInput } from './functional-components.js';
|
|
9
8
|
import { f as filterCollection } from './utilities.js';
|
|
10
|
-
import { B,
|
|
9
|
+
import { B, q, W } from './index2.js';
|
|
11
10
|
import '@esri/calcite-components/dist/components/calcite-list-item-group.js';
|
|
12
11
|
import '@esri/calcite-components/dist/components/calcite-list-item.js';
|
|
13
12
|
import '@esri/calcite-components/dist/components/calcite-action.js';
|
|
@@ -15,6 +14,7 @@ import '@esri/calcite-components/dist/components/calcite-flow-item.js';
|
|
|
15
14
|
import '@esri/calcite-components/dist/components/calcite-button.js';
|
|
16
15
|
import '@esri/calcite-components/dist/components/calcite-block.js';
|
|
17
16
|
import '@esri/calcite-components/dist/components/calcite-flow.js';
|
|
17
|
+
import '@esri/calcite-components/dist/components/calcite-input.js';
|
|
18
18
|
import '@esri/calcite-components/dist/components/calcite-list.js';
|
|
19
19
|
|
|
20
20
|
function isSuggestionGroups(item) {
|
|
@@ -36,10 +36,10 @@ const ArcgisArcadeSuggestions = /*@__PURE__*/ proxyCustomElement(class ArcgisArc
|
|
|
36
36
|
this.__attachShadow();
|
|
37
37
|
this.close = createEvent(this, "close", 3);
|
|
38
38
|
this.itemSelected = createEvent(this, "itemSelected", 3);
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
this._updateFilterValue = (e) => {
|
|
40
|
+
this._filterValue = e.target?.value ?? "";
|
|
41
|
+
};
|
|
41
42
|
this._emitItemSelected = (e) => {
|
|
42
|
-
// @ts-expect-error
|
|
43
43
|
const item = e.target?.["data-item"];
|
|
44
44
|
if (!item) {
|
|
45
45
|
return;
|
|
@@ -51,7 +51,6 @@ const ArcgisArcadeSuggestions = /*@__PURE__*/ proxyCustomElement(class ArcgisArc
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
this._showSuggestionDetail = (e) => {
|
|
54
|
-
// @ts-expect-error
|
|
55
54
|
const item = e.target?.["data-item"];
|
|
56
55
|
if (!item) {
|
|
57
56
|
return;
|
|
@@ -59,8 +58,12 @@ const ArcgisArcadeSuggestions = /*@__PURE__*/ proxyCustomElement(class ArcgisArc
|
|
|
59
58
|
e.stopPropagation();
|
|
60
59
|
this._selectedSuggestion = item;
|
|
61
60
|
};
|
|
62
|
-
this._emitClose = () =>
|
|
63
|
-
|
|
61
|
+
this._emitClose = () => {
|
|
62
|
+
this.close.emit();
|
|
63
|
+
};
|
|
64
|
+
this._beforeBack = async () => {
|
|
65
|
+
this._selectedSuggestion = undefined;
|
|
66
|
+
};
|
|
64
67
|
this._lang = "";
|
|
65
68
|
this._t9nLocale = "";
|
|
66
69
|
this._t9nStrings = undefined;
|
|
@@ -82,7 +85,7 @@ const ArcgisArcadeSuggestions = /*@__PURE__*/ proxyCustomElement(class ArcgisArc
|
|
|
82
85
|
disconnectedCallback() {
|
|
83
86
|
this._flowObserver?.disconnect();
|
|
84
87
|
this._themeChangedListner?.dispose();
|
|
85
|
-
|
|
88
|
+
q(this);
|
|
86
89
|
}
|
|
87
90
|
// #endregion
|
|
88
91
|
//#region Private Methods
|
|
@@ -100,7 +103,7 @@ const ArcgisArcadeSuggestions = /*@__PURE__*/ proxyCustomElement(class ArcgisArc
|
|
|
100
103
|
// When switching between flow the same reference is reused
|
|
101
104
|
this._flowObserver = new MutationObserver(() => {
|
|
102
105
|
// Get the last panel and try to set focus on the input element
|
|
103
|
-
|
|
106
|
+
W(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
104
107
|
});
|
|
105
108
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
106
109
|
}
|
|
@@ -130,7 +133,7 @@ const ArcgisArcadeSuggestions = /*@__PURE__*/ proxyCustomElement(class ArcgisArc
|
|
|
130
133
|
return (h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose, beforeBack: this._beforeBack }, 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), h("calcite-block", { open: true, heading: suggestion.label, description: suggestion.description }, h("div", { innerHTML: convertMarkdownString(suggestion.documentation) }), h("pre", null, h("code", { ref: (e) => e === undefined ? undefined : void colorizeCodeElement(e, suggestion.code).catch(console.error) })))));
|
|
131
134
|
}
|
|
132
135
|
render() {
|
|
133
|
-
return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, h(
|
|
136
|
+
return (h(Host, null, h("style", null, this._colorizeStyle), h("calcite-flow", { ref: (ref) => this.flowFocusHandler(ref) }, h("calcite-flow-item", { heading: this._t9nStrings?.suggestions, closable: true, onCalciteFlowItemClose: this._emitClose }, h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), h("calcite-list", null, this.renderSuggestionGroups())), this.renderSuggestionFlowItem())));
|
|
134
137
|
}
|
|
135
138
|
static get assetsDirs() { return ["assets"]; }
|
|
136
139
|
get _hostElement() { return this; }
|
|
@@ -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
|
import { proxyCustomElement, HTMLElement, createEvent, getAssetPath, h } from '@stencil/core/internal/client';
|
|
7
|
-
import {
|
|
8
|
-
import { B, H, F, D } from './index2.js';
|
|
7
|
+
import { B, q, W, K } from './index2.js';
|
|
9
8
|
import { b as arcadeDefaults } from './arcade-defaults.js';
|
|
10
9
|
import '@esri/calcite-components/dist/components/calcite-flow-item.js';
|
|
11
10
|
import '@esri/calcite-components/dist/components/calcite-action.js';
|
|
11
|
+
import '@esri/calcite-components/dist/components/calcite-input.js';
|
|
12
12
|
import '@esri/calcite-components/dist/components/calcite-loader.js';
|
|
13
13
|
import '@esri/calcite-components/dist/components/calcite-list.js';
|
|
14
14
|
import '@esri/calcite-components/dist/components/calcite-list-item-group.js';
|
|
@@ -18,6 +18,11 @@ import '@esri/calcite-components/dist/components/calcite-flow.js';
|
|
|
18
18
|
|
|
19
19
|
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%}";
|
|
20
20
|
|
|
21
|
+
function stopEnterPropagation(e) {
|
|
22
|
+
if (e.key === "Enter") {
|
|
23
|
+
e.stopPropagation();
|
|
24
|
+
}
|
|
25
|
+
}
|
|
21
26
|
const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeVariables extends HTMLElement {
|
|
22
27
|
constructor() {
|
|
23
28
|
super();
|
|
@@ -25,16 +30,20 @@ const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcad
|
|
|
25
30
|
this.__attachShadow();
|
|
26
31
|
this.close = createEvent(this, "close", 3);
|
|
27
32
|
this.itemSelected = createEvent(this, "itemSelected", 3);
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
this._updateFilterValue = (e) => {
|
|
34
|
+
this._filterValue = e.target.value;
|
|
35
|
+
};
|
|
30
36
|
this._beforeBack = async () => {
|
|
31
37
|
this.removeLastPanelRenderer();
|
|
32
38
|
this._filterValue = "";
|
|
33
39
|
};
|
|
34
|
-
this._emitClose = () =>
|
|
35
|
-
|
|
40
|
+
this._emitClose = () => {
|
|
41
|
+
this.close.emit();
|
|
42
|
+
};
|
|
43
|
+
this._backToTop = () => {
|
|
44
|
+
this._flowItemRenderers = [];
|
|
45
|
+
};
|
|
36
46
|
this._emitItemSelected = (e) => {
|
|
37
|
-
// @ts-expect-error
|
|
38
47
|
const variable = e.target?.["data-item"];
|
|
39
48
|
if (!variable || variable.nonInteractive) {
|
|
40
49
|
return;
|
|
@@ -45,13 +54,7 @@ const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcad
|
|
|
45
54
|
this.itemSelected.emit(variable.snippet);
|
|
46
55
|
}
|
|
47
56
|
};
|
|
48
|
-
this._stopEnterPropagation = (e) => {
|
|
49
|
-
if (e.key === "Enter") {
|
|
50
|
-
e.stopPropagation();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
57
|
this._showCollectionPanel = (e) => {
|
|
54
|
-
// @ts-expect-error
|
|
55
58
|
const collectionVariable = e.target?.["data-item"];
|
|
56
59
|
if (!collectionVariable) {
|
|
57
60
|
return;
|
|
@@ -77,7 +80,7 @@ const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcad
|
|
|
77
80
|
await B(this, getAssetPath("./assets"));
|
|
78
81
|
}
|
|
79
82
|
disconnectedCallback() {
|
|
80
|
-
|
|
83
|
+
q(this);
|
|
81
84
|
this._flowObserver?.disconnect();
|
|
82
85
|
}
|
|
83
86
|
// #endregion
|
|
@@ -102,7 +105,7 @@ const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcad
|
|
|
102
105
|
// When switching between flow the same reference is reused
|
|
103
106
|
this._flowObserver = new MutationObserver(() => {
|
|
104
107
|
// Get the last panel and try to set focus on the input element
|
|
105
|
-
|
|
108
|
+
W(ref.querySelector("calcite-flow-item:last-child"), "calcite-input");
|
|
106
109
|
});
|
|
107
110
|
this._flowObserver.observe(ref, { attributes: true, attributeFilter: ["id"], childList: true });
|
|
108
111
|
}
|
|
@@ -120,17 +123,23 @@ const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcad
|
|
|
120
123
|
let loading = this.loading;
|
|
121
124
|
if (!loading && !collection.loaded) {
|
|
122
125
|
// Request to load and update mutation counter when done
|
|
123
|
-
collection
|
|
126
|
+
collection
|
|
127
|
+
.loadSource()
|
|
128
|
+
.then(() => setTimeout(() => {
|
|
124
129
|
this._mutationCounter += 1;
|
|
125
|
-
}))
|
|
130
|
+
}))
|
|
131
|
+
.catch(() => {
|
|
132
|
+
console.error("Error loading collection");
|
|
133
|
+
loading = false;
|
|
134
|
+
});
|
|
126
135
|
loading = true;
|
|
127
136
|
}
|
|
128
|
-
return (h("calcite-flow-item", { heading: this._t9nStrings?.profilevariables, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, 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 }), h(
|
|
137
|
+
return (h("calcite-flow-item", { heading: this._t9nStrings?.profilevariables, description: collection.breadcrumb, beforeBack: this._beforeBack, closable: true, onCalciteFlowItemClose: this._emitClose }, 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 }), h("calcite-input", { value: this._filterValue, icon: "magnifying-glass", clearable: true, onCalciteInputInput: this._updateFilterValue, class: "sticky", scale: "m" }), loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: this._t9nStrings?.loading ?? "Loading" })) : (h("calcite-list", null, this.renderEditorVariables(collection)))));
|
|
129
138
|
};
|
|
130
139
|
}
|
|
131
140
|
renderEditorVariables(collection) {
|
|
132
141
|
// Filter the variables. Skip group, we will filter the children later on.
|
|
133
|
-
const filterExpression =
|
|
142
|
+
const filterExpression = K(this._filterValue);
|
|
134
143
|
const filteredVariables = collection.variables.filter((variable) => variable.passFilter(filterExpression));
|
|
135
144
|
if (!filteredVariables.length) {
|
|
136
145
|
return h("div", { class: "notice-container" }, this._t9nStrings?.noitems ?? "No item");
|
|
@@ -143,7 +152,7 @@ const ArcgisArcadeVariables = /*@__PURE__*/ proxyCustomElement(class ArcgisArcad
|
|
|
143
152
|
// Group is a collection but we represent it differently
|
|
144
153
|
return (h("calcite-list-item-group", { heading: variable.getLabel() }, this.renderEditorVariables(variable)));
|
|
145
154
|
default:
|
|
146
|
-
return (h("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (h("calcite-action", { slot: "actions-end", text: this._t9nStrings?.expand ?? "", scale: "s", icon: "chevron-right", iconFlipRtl: true, onClick: this._showCollectionPanel, onKeyPress:
|
|
155
|
+
return (h("calcite-list-item", { label: variable.getLabel(), description: variable.getDescription(), onCalciteListItemSelect: this._emitItemSelected, onKeyPress: this._emitItemSelected, "data-item": variable }, variable.isCollection ? (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 ? h("calcite-icon", { icon: variable.icon, scale: "s", slot: "content-start" }) : null));
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
158
|
render() {
|
|
@@ -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.29/esri/copyright.txt for details.
|
|
4
|
-
* v4.29.0
|
|
4
|
+
* v4.29.0
|
|
5
5
|
*/
|
|
6
6
|
import { A as ArcgisArcadeApi$1, d as defineCustomElement$1 } from './arcade-api.js';
|
|
7
7
|
|