Use dark colors for code blocks Copy
1
import "@arcgis/coding-components/components/arcgis-arcade-editor";
No specific import is needed for this component.
Arcade is a portable, and lightweight expression language used to create custom content throughout the ArcGIS system. Like other expression languages, it can perform mathematical calculations, format text, and evaluate logical statements. It also supports multi-statement expressions, variables, and flow control statements. Arcade is unique when compared to other expression and scripting languages due to its inclusion of feature and geometry data types.
Map Viewer (MV) was the first ArcGIS Online product to incorporate the new Arcade editor after the editor's introduction in the November 2022 ArcGIS Online release. This was possible thanks to the Arcade editor component, which enabled MV to implement its own Arcade expression builder. You can now also find the editor in ArcGIS Dashboards, ArcGIS Field Maps, and ArcGIS Velocity.
You can easily get your own dedicated Arcade expression builder with the Arcade editor component, which includes:
Property
editorOptions: (IEditorOptions & IGlobalEditorOptions)
Options to update on the editor. For example:
Use dark colors for code blocks Copy
To get the full list of available options, see the Monaco Editor options documentation for more details.
Property
hideDocumentationActions: boolean
If true, it will hide the documentation action in the side panel
Property
hideSideBar: boolean
If true, it will hide the side actions bar. The editor will be in a minimalistic UX.
openedSidePanel: T extends { customPanels: Array<ICustomSidePanel>; } ? "none" | "variables" | "suggestions" | "api" : string
The name of the opened side panel. 'none' means 'no panel opened'.
Property
profile: IEditorProfileDefinition | IPredefinedProfile
The profile contains metadata used by the editor for editing context and help. Example:
Use dark colors for code blocks Copy
1
2
3
4
5
6
7
8
9
10
{
bundles: ["core", "dataAccess", "geometry", "portal"],
variables: [
{
name: "$feature",
description: "The feature passed to the script during execution.",
definition: aFeatureLayerInstance
}
]
}
Property
script: string
The arcade script. Use this property to define or update the script.
sideActionBarExpanded: boolean
If true, the side action bar will be expanded
Property
snippets: Array<ApiSnippet>
Collection of snippets
Property
suggestions: Array<IEditorCodeSuggestion> | Array<IEditorCodeSuggestionGroup>
Collection of suggestions
Property
testData: IEditorTestContext
Test data used to execute the script in the editor. If undefined the execute script UX will be hidden.
No slots to display.
Events arcgisDiagnosticsChangeEvent
arcgisDiagnosticsChange: Array<Diagnostic>
Emitted when the diagnostics collection has changed.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
arcgisScriptChangeEvent
arcgisScriptChange: CustomEvent<string>
Emitted when the script string has changed.
composedThe event is composable and will propagate across the shadow DOM into the standard DOM.
cancelableThe event's default behavior can be canceled, allowing for custom behavior to be implemented instead.
Methods componentOnReadyMethod
componentOnReady(): Promise<void>
Create a promise that resolves once component is fully loaded.
ExampleUse dark colors for code blocks Copy
1
2
3
4
const arcgisArcadeEditor = document.querySelector("arcgis-arcade-editor");
document.body.append(arcgisArcadeEditor);
await arcgisArcadeEditor.componentOnReady();
console.log("arcgis-arcade-editor is ready to go!");
deprecatedMethod
getScript(): Promise<string | undefined>
DeprecatedDeprecated since 4.30.
Use script
property instead.
Method
getTestResult(): Promise<ArcadeResult>
Returns the Arcade result for the script for the provided test data.
Method
setFocus(): Promise<void>
Set the focus on the element.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4