ng-zorro-antd
Version:
An enterprise-class UI components based on Ant Design and Angular
120 lines • 4.31 kB
TypeScript
import { editor } from "monaco-editor";
import * as i0 from "@angular/core";
import { AfterViewInit, EventEmitter, TemplateRef } from "@angular/core";
import { ControlValueAccessor } from "@angular/forms";
import { NzSafeAny, OnChangeType, OnTouchedType } from "ng-zorro-antd/core/types";
import { BehaviorSubject, Observable } from "rxjs";
import IStandAloneEditorConstructionOptions = editor.IStandaloneEditorConstructionOptions;
import IDiffEditorConstructionOptions = editor.IDiffEditorConstructionOptions;
export type EditorOptions = IStandAloneEditorConstructionOptions;
export type DiffEditorOptions = IDiffEditorConstructionOptions;
export type JoinedEditorOptions = EditorOptions | DiffEditorOptions;
export type NzEditorMode = 'normal' | 'diff';
export declare const NzCodeEditorLoadingStatus: {
readonly UNLOAD: "unload";
readonly LOADING: "loading";
readonly LOADED: "LOADED";
};
export type NzCodeEditorLoadingStatus = (typeof NzCodeEditorLoadingStatus)[keyof typeof NzCodeEditorLoadingStatus];
declare namespace code_editor_component_d_exports {
export { NzCodeEditorComponent };
}
export declare class NzCodeEditorComponent implements AfterViewInit, ControlValueAccessor {
private nzCodeEditorService;
private ngZone;
private platform;
private destroyRef;
nzEditorMode: NzEditorMode;
nzOriginalText: string;
nzLoading: boolean;
nzFullControl: boolean;
nzToolkit?: TemplateRef<void>;
set nzEditorOption(value: JoinedEditorOptions);
readonly nzEditorInitialized: EventEmitter<editor.IStandaloneCodeEditor | editor.IStandaloneDiffEditor>;
editorOptionCached: JoinedEditorOptions;
private readonly el;
private resize$;
private editorOption$;
private editorInstance;
private value;
private modelSet;
private onDidChangeContentDisposable;
constructor();
/**
* Initialize a monaco editor instance.
*/
ngAfterViewInit(): void;
writeValue(value: string): void;
registerOnChange(fn: OnChangeType): NzSafeAny;
registerOnTouched(fn: OnTouchedType): void;
onChange: OnChangeType;
onTouch: OnTouchedType;
layout(): void;
private setup;
private registerOptionChanges;
private initMonacoEditorInstance;
private registerResizeChange;
private setValue;
/**
* {@link editor.ICodeEditor}#setValue resets the cursor position to the start of the document.
* This helper memorizes the cursor position and selections and restores them after the given
* function has been called.
*/
private preservePositionAndSelections;
private setValueEmitter;
private emitValue;
private updateOptionToMonaco;
static ɵfac: i0.ɵɵFactoryDeclaration<NzCodeEditorComponent, never>;
static ɵcmp: i0.ɵɵComponentDeclaration<NzCodeEditorComponent, "nz-code-editor", ["nzCodeEditor"], {
"nzEditorMode": {
"alias": "nzEditorMode";
"required": false;
};
"nzOriginalText": {
"alias": "nzOriginalText";
"required": false;
};
"nzLoading": {
"alias": "nzLoading";
"required": false;
};
"nzFullControl": {
"alias": "nzFullControl";
"required": false;
};
"nzToolkit": {
"alias": "nzToolkit";
"required": false;
};
"nzEditorOption": {
"alias": "nzEditorOption";
"required": false;
};
}, {
"nzEditorInitialized": "nzEditorInitialized";
}, never, never, true, never>;
static ngAcceptInputType_nzLoading: unknown;
static ngAcceptInputType_nzFullControl: unknown;
}
export declare class NzCodeEditorModule {
static ɵfac: i0.ɵɵFactoryDeclaration<NzCodeEditorModule, never>;
static ɵmod: i0.ɵɵNgModuleDeclaration<NzCodeEditorModule, never, [typeof NzCodeEditorComponent], [typeof NzCodeEditorComponent]>;
static ɵinj: i0.ɵɵInjectorDeclaration<NzCodeEditorModule>;
}
export declare class NzCodeEditorService {
private readonly nzConfigService;
private document;
private firstEditorInitialized;
private option;
private config;
option$: BehaviorSubject<JoinedEditorOptions>;
constructor();
private _updateDefaultOption;
requestToInit(): Observable<JoinedEditorOptions>;
private loadMonacoScript;
private onLoad;
private onInit;
private getLatestOption;
static ɵfac: i0.ɵɵFactoryDeclaration<NzCodeEditorService, never>;
static ɵprov: i0.ɵɵInjectableDeclaration<any>;
}