UNPKG

sprotty

Version:

A next-gen framework for graphical views

72 lines 4.1 kB
/******************************************************************************** * Copyright (c) 2019-2022 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ import { Action } from 'sprotty-protocol/lib/actions'; import { IActionDispatcherProvider } from '../../base/actions/action-dispatcher'; import { IActionHandler } from '../../base/actions/action-handler'; import { ICommand } from '../../base/commands/command'; import { SModelElementImpl, SModelRootImpl } from '../../base/model/smodel'; import { AbstractUIExtension } from '../../base/ui-extensions/ui-extension'; import { DOMHelper } from '../../base/views/dom-helper'; import { ViewerOptions } from '../../base/views/viewer-options'; import { KeyCode, KeyboardModifier } from '../../utils/keyboard'; import { EditLabelValidationResult, IEditLabelValidator } from './edit-label'; import { EditableLabel } from './model'; /** Shows a UI extension for editing a label on emitted `EditLabelAction`s. */ export declare class EditLabelActionHandler implements IActionHandler { handle(action: Action): void | Action | ICommand; } export interface IEditLabelValidationDecorator { decorate(input: HTMLInputElement | HTMLTextAreaElement, validationResult: EditLabelValidationResult): void; dispose(input: HTMLInputElement | HTMLTextAreaElement): void; } export declare class EditLabelUI extends AbstractUIExtension { static readonly ID = "editLabelUi"; actionDispatcherProvider: IActionDispatcherProvider; protected viewerOptions: ViewerOptions; protected domHelper: DOMHelper; labelValidator: IEditLabelValidator; validationDecorator: IEditLabelValidationDecorator; protected inputElement: HTMLInputElement; protected textAreaElement: HTMLTextAreaElement; protected label?: EditableLabel & SModelElementImpl; protected labelElement: HTMLElement | null; protected validationTimeout?: number; protected isActive: boolean; protected blockApplyEditOnInvalidInput: boolean; protected isCurrentLabelValid: boolean; protected previousLabelContent?: string; id(): string; containerClass(): string; protected get labelId(): string; protected initializeContents(containerElement: HTMLElement): void; protected configureAndAdd(element: HTMLInputElement | HTMLTextAreaElement, containerElement: HTMLElement): void; get editControl(): HTMLInputElement | HTMLTextAreaElement; protected hideIfEscapeEvent(event: KeyboardEvent): void; protected applyLabelEditOnEvent(event: KeyboardEvent, code?: KeyCode, ...modifiers: KeyboardModifier[]): void; protected validateLabelIfContentChange(event: KeyboardEvent, value: string): void; protected applyLabelEdit(): Promise<void>; protected performLabelValidation(event: KeyboardEvent, value: string): void; protected validateLabel(value: string): Promise<EditLabelValidationResult>; protected showValidationResult(result: EditLabelValidationResult): void; protected clearValidationResult(): void; show(root: Readonly<SModelRootImpl>, ...contextElementIds: string[]): void; hide(): void; protected onBeforeShow(containerElement: HTMLElement, root: Readonly<SModelRootImpl>, ...contextElementIds: string[]): void; protected setPosition(containerElement: HTMLElement): void; protected applyTextContents(): void; protected applyFontStyling(): void; } //# sourceMappingURL=edit-label-ui.d.ts.map