@blinkk/editor
Version:
Structured content editor with live previews.
109 lines (108 loc) • 3.43 kB
TypeScript
import { DeepObject, EditorConfig, SelectiveEditor, TemplateResult } from '@blinkk/selective-edit';
import { LiveTemplate } from '../template';
import { ApiError } from '../api';
import { BaseUI } from '.';
import { LiveEditor } from '../editor';
/**
* Priority of the modal.
*
* Used to determine the stacking order when multiple modals are
* displayed at once.
*/
export declare enum DialogPriorityLevel {
Low = 0,
Normal = 1,
High = 2
}
export interface ModalConfig {
/**
* Custom classes for the modal window.
*/
classes?: Array<string>;
/**
* Method to determine if the modal can be closed by clicking outside
* of the modal content or by pressing ESC.
*/
canClickToCloseFunc?: () => boolean;
priority?: DialogPriorityLevel;
}
export interface DialogModalConfig extends ModalConfig {
/**
* Title for the dialog modal.
*/
title?: string;
}
export interface FormDialogModalConfig extends DialogModalConfig {
/**
* Configuration for creating the selective editor.
*/
selectiveConfig: EditorConfig;
}
export declare enum DialogActionLevel {
Tertiary = 0,
Secondary = 1,
Primary = 2,
Extreme = 3
}
export interface DialogActionConfig {
classes?: Array<string>;
level?: DialogActionLevel;
label: string;
isDisabledFunc: () => boolean;
isSubmit?: boolean;
onClick: (evt: Event) => void;
}
declare const Modal_base: {
new (...args: any[]): {
_listeners?: Record<string, ((...args: any) => void)[]> | undefined;
addListener(eventName: string, callback: (...args: any) => void): void;
readonly listeners: Record<string, ((...args: any) => void)[]>;
triggerListener(eventName: string, ...args: any): void;
};
} & (new (...args: any[]) => {
_uuid?: string | undefined;
readonly uuid: string;
readonly uid: string;
}) & typeof BaseUI;
export declare class Modal extends Modal_base {
config: ModalConfig;
isVisible: boolean;
templateModal?: LiveTemplate;
constructor(config: ModalConfig);
classesForModal(): Record<string, boolean>;
handleKeyup(evt: KeyboardEvent): void;
handleOffClick(evt: Event): void;
hide(): void;
show(): void;
template(editor: LiveEditor): TemplateResult;
templateContent(editor: LiveEditor): TemplateResult;
toggle(): void;
}
export declare class DialogModal extends Modal {
actions: Array<DialogActionConfig>;
config: DialogModalConfig;
isProcessing?: boolean;
constructor(config: DialogModalConfig);
/**
* Add a cancel action to the dialog.
*/
addCancelAction(label?: string): void;
classesForAction(config: DialogActionConfig): Record<string, boolean>;
classesForModal(): Record<string, boolean>;
startProcessing(): void;
stopProcessing(hideModal?: boolean): void;
templateContent(editor: LiveEditor): TemplateResult;
templateFooter(editor: LiveEditor): TemplateResult;
templateHeader(editor: LiveEditor): TemplateResult;
templateTemplate(editor: LiveEditor): TemplateResult;
}
export declare class FormDialogModal extends DialogModal {
config: FormDialogModalConfig;
data: DeepObject;
error?: ApiError;
selective: SelectiveEditor;
constructor(config: FormDialogModalConfig);
handleKeyup(evt: KeyboardEvent): void;
templateContent(editor: LiveEditor): TemplateResult;
}
export {};