@arcgis/coding-components
Version:
ArcGIS Coding Components
70 lines (69 loc) • 2.8 kB
TypeScript
/// <reference path="../../index.d.ts" />
import type { Selection, editor as Editor } from "monaco-editor";
import type { PublicLitElement as LitElement } from "@arcgis/lumina";
/** @internal */
export abstract class ArcgisCodeEditor extends LitElement {
/**
* The instance of the Monaco Editor after the component has been rendered.
* To determine when a component is rendered, you can use componentOnReady() method.
* The method returns a Promise that resolves after the component rendered for the first time.
*/
get editorInstance(): Editor.IStandaloneCodeEditor | undefined;
/**
* Options to update on the editor.
* For example:
* ```json
* {
* "fontSize": 18
* }
* ```
*
* To get the full list of options set on the editor, use the editorInstance property and see Monaco Editor options documentation for more details.
*/
accessor editorOptions: Editor.IEditorOptions & Editor.IGlobalEditorOptions | undefined;
/**
* The language for the editor.
* Currently supported language: arcade, arcgis-sql-expression, sql-layer-sql-server, sql-layer-postgres,
* sql-layer-bigquery, json, css, html, javascript, typescript, and text.
*/
accessor language: string | undefined;
/**
* A unique identifier for the model.
* The unique identifier is sometimes used by language defaults to store model metadata.
* For example, with arcade, the model id is used to store the arcade profile and other metadata.
* The unique identifier is especially useful when there are multiple editors on the same page.
*/
accessor modelId: `${string}-${string}-${string}-${string}-${string}`;
/**
* The initial value for the editor.
* The value is the script, code, css, json, etc.
*
* @default ""
*/
accessor value: string;
/**
* Inserts a snippet at the current position in the editor.
*
* @param text - The string snippet to insert
*/
insertSnippet(text: string | null | undefined): Promise<void>;
/**
* Inserts a text at the current position in the editor.
*
* @param text - The string to insert
*/
insertText(text: string | null | undefined): Promise<void>;
/** Sets the focus on the editor. */
setFocus(): Promise<void>;
/** Emitted when the selection has changed. */
readonly arcgisSelectionChange: import("@arcgis/lumina").TargetedEvent<this, {
selection: Selection;
model: Editor.ITextModel | null | undefined;
}>;
/** Emitted when the value has changed (script, code, css, json, etc.) */
readonly arcgisValueChange: import("@arcgis/lumina").TargetedEvent<this, string>;
readonly "@eventTypes": {
arcgisSelectionChange: ArcgisCodeEditor["arcgisSelectionChange"]["detail"];
arcgisValueChange: ArcgisCodeEditor["arcgisValueChange"]["detail"];
};
}