survey-creator-core
Version:
A framework-independent core package of the SurveyJS Survey Creator component. With Survey Creator, you can visually design complex, interactive JSON forms and surveys in a drag-and-drop interface.
87 lines (86 loc) • 3.22 kB
TypeScript
import { EventBase } from "survey-core";
import { ICreatorPlugin, UIPreset, SurveyCreatorModel, saveToFileHandler, ICreatorPresetConfig } from "survey-creator-core";
import { CreatorPresetEditorModel } from "./presets-editor";
import { IPresetListItem } from "./presets-manager";
/**
* A class that instantiates the Preset Editor and provides APIs to manage its elements.
*/
export declare class UIPresetEditor implements ICreatorPlugin {
private creator;
static defaultPresetName: string;
model: CreatorPresetEditorModel;
static iconName: string;
private activeTab;
private currentPresetIndex;
private currentValue;
private designerPlugin;
private toolboxCompact;
private defaultJson;
private presetsManager;
private pagesList;
private presetsList;
private saveAction;
private saveCount;
/**
* Custom function to handle preset saving. When set, it is called instead of the default save handler.
* @param saveNo The sequential save number (0-based).
* @param callback Call this when the custom save is complete to apply the default save behavior.
*/
savePresetFunc: (saveNo: number, callback: () => void) => void;
/**
* An event raised when the presets list is saved in the Edit Presets List dialog.
*
* Parameters:
*
* - `sender`: `UIPresetEditor`\
* A `UIPresetEditor` instance that raised the event.
* - `options.presets`: `IPresetListItem[]`\
* The updated presets list.
*/
onPresetListSaved: EventBase<UIPresetEditor, {
presets: IPresetListItem[];
}>;
private showPresets;
private hidePresets;
private confirmReset;
private confirmQuit;
constructor(creator: SurveyCreatorModel);
/**
* Adds a new UI preset to UI Preset Editor.
* @param preset A [UI preset] to add.
* @see removePreset
*/
addPreset(preset: UIPreset): void;
/**
* Removes a UI theme from Theme Editor.
* @param presetAccessor A [UI preset] to delete or a preset identifier.
* @see addPreset
*/
removePreset(presetAccessor: string | UIPreset): void;
/**
* Returns a preset by name.
* @param name The preset identifier.
* @returns The preset configuration or undefined if not found.
*/
getPreset(name: string): ICreatorPresetConfig | undefined;
/**
* Returns the currently selected preset.
*/
getCurrentPreset(): ICreatorPresetConfig | undefined;
/**
* Mutable array of all presets. Includes presets from register, add, or user-saved.
* Each item has: name, visible, removable (true for custom presets), sortable.
*/
get presets(): IPresetListItem[];
private performSave;
private saveOrSaveAs;
protected saveHandler(closeOnSave?: boolean): void;
protected saveAsHandler(closeOnSave?: boolean): void;
protected setStatus(status: "saved" | "unsaved" | "saving" | "initial"): void;
saveToFileHandler: typeof saveToFileHandler;
private preventTabSwitch;
activate(): void;
deactivate(): boolean;
onLocaleChanged(): void;
getLicenseText(hasCreatorLicense: boolean, creatorLicenseDateString: string): string;
}