survey-creator-core
Version:
Use SurveyJS Creator to create or edit JSON for SurveyJS Form Library.
317 lines (316 loc) • 13.8 kB
TypeScript
import { Base, IAction, ItemValue, JsonObjectProperty, MatrixDropdownColumn, Question, SurveyModel, ILocalizableString, PopupBaseViewModel, PageModel, ILocalizableOwner, LocalizableString } from "survey-core";
/**
* List available question convert modes
*/
export declare enum QuestionConvertMode {
AllTypes = 0,
CompatibleTypes = 1
}
export declare var settings: {
translation: {
sortByName: boolean;
exportPrefix: string;
/**
* The maximum number of locales that user can select at once for translation
*/
maximumSelectedLocales: number;
/**
* The name of the translation export file in csv format
*/
exportFileName: string;
};
themeEditor: {
exportFileName: string;
defaultFontFamily: string;
};
operators: {
empty: any[];
notempty: any[];
equal: string[];
notequal: string[];
contains: string[];
notcontains: string[];
anyof: string[];
allof: string[];
greater: string[];
less: string[];
greaterorequal: string[];
lessorequal: string[];
};
defaultNewSurveyJSON: {};
designer: {
/**
* The default question type on clicking Add Question button.
*/
defaultAddQuestionType: string;
/**
* Set this property to false, to hide "Add Question" button on designer surface
*/
showAddQuestionButton: boolean;
};
logic: {
questionSortOrder: string;
defaultOperator: string;
defaultOperators: {
default: string;
checkbox: string;
tagbox: string;
};
includeComplexQuestions: boolean;
visibleActions: string[];
invisibleTriggers: string[];
logicItemTitleMaxChars: number;
openBracket: string;
closeBracket: string;
/**
* Set these properties to false if you don't want to update expressions on changing question and column names and on changing choices values
*/
updateExpressionsOnChanging: {
questionName: boolean;
columnName: boolean;
choiceValue: boolean;
};
/**
* Set these properties to false if you don't want to update expressions on deleting question
*/
updateExpressionsOnDeleting: {
question: boolean;
};
};
/**
* Determines which types of questions the conversion will be available for.
*/
questionConvertMode: QuestionConvertMode;
propertyGrid: {
useButtonGroup: boolean;
maxCharsInButtonGroup: number;
showNavigationButtons: boolean;
enableSearch: boolean;
maxColumns: number;
minChoices: number;
maxChoices: number;
maxRows: number;
maxRateValues: number;
maximumColumnsCount: number;
minimumChoicesCount: number;
maximumChoicesCount: number;
maximumRowsCount: number;
maximumRateValues: number;
generalTabName: string;
defaultExpandedTabName: string;
allowExpandMultipleCategories: boolean;
};
toolbox: {
/**
* Use it to change the default question JSON on dropping it into designer or converting questions
*/
defaultJSON: {
[index: string]: any;
};
};
/**
* Notification settings
*/
notifications: {
lifetime: number;
};
/**
* Auto save parameters
*/
autoSave: {
delay: number;
};
/**
* Drag Drop Settings
*/
dragDrop: {
restrictDragQuestionBetweenPages: boolean;
allowDragToTheSameLine: boolean;
};
/**
* Creator layout settings
*/
layout: {
showTabs: boolean;
showToolbar: boolean;
allowCollapseSidebar: boolean;
};
jsonEditor: {
indentation: number;
exportFileName: string;
};
useLegacyIcons: boolean;
pageContentLazyRendering: boolean;
};
export interface ICollectionItemAllowOperations {
allowDelete: boolean;
allowEdit: boolean;
allowAdd: boolean;
}
export interface ICreatorPlugin {
activate: () => void;
update?: () => void;
deactivate?: () => boolean;
canDeactivateAsync?: (onSuccess: () => void) => void;
defaultAllowingDeactivate?: () => boolean | undefined;
dispose?: () => void;
onDesignerSurveyPropertyChanged?: (obj: Base, propName: string) => void;
model: Base;
}
export interface ITabOptions {
name: string;
plugin: ICreatorPlugin;
title?: string;
iconName?: string;
componentName?: string;
index?: number;
}
export interface ISurveyCreatorOptions {
isMobileView: boolean;
alwaySaveTextInPropertyEditors: boolean;
readOnly: boolean;
maxLogicItemsInCondition: number;
/**
* @deprecated
*/
showObjectTitles: boolean;
/**
* @deprecated
*/
showTitlesInExpressions: boolean;
useElementTitles: boolean;
allowEditExpressionsInTextEditor: boolean;
maximumColumnsCount: number;
minimumChoicesCount: number;
maximumChoicesCount: number;
maximumRowsCount: number;
maximumRateValues: number;
maxNestedPanels: number;
maxPanelNestingLevel: number;
forbiddenNestedElements: {
panel: string[];
paneldynamic: string[];
};
enableLinkFileEditor: boolean;
inplaceEditForValues: boolean;
rootElement?: HTMLElement;
previewShowResults: boolean;
showOneCategoryInPropertyGrid: boolean;
getObjectDisplayName(obj: Base, area: string, reason: string, displayName: string): string;
getElementAddornerCssCallback(obj: Base, className: string): string;
onCanShowPropertyCallback(object: any, property: JsonObjectProperty, showMode: string, parentObj: any, parentProperty: JsonObjectProperty): boolean;
onPropertyEditorCreatedCallback(object: any, property: JsonObjectProperty, editor: Question): any;
onPropertyGridSurveyCreatedCallback(object: any, survey: SurveyModel): any;
onPropertyEditorUpdateTitleActionsCallback(object: any, property: JsonObjectProperty, editor: Question, titleActions: IAction[]): any;
onPropertyGridShowModalCallback(object: any, property: JsonObjectProperty, editor: Question, popupEditor: any, popupModel: PopupBaseViewModel): any;
onIsPropertyReadOnlyCallback(obj: Base, property: JsonObjectProperty, readOnly: boolean, parentObj: Base, parentProperty: JsonObjectProperty): boolean;
onCanDeleteItemCallback(object: any, item: Base, allowDelete: boolean): boolean;
onCollectionItemDeletingCallback(obj: Base, property: JsonObjectProperty, collection: Array<Base>, item: Base): boolean;
onCollectionItemAllowingCallback(obj: Base, property: JsonObjectProperty, collection: Array<Base>, item: Base, options: ICollectionItemAllowOperations): void;
onItemValueAddedCallback(obj: Base, propertyName: string, itemValue: ItemValue, itemValues: Array<ItemValue>): any;
onFastEntryCallback(items: Array<ItemValue>, lines: Array<string>): Array<ItemValue>;
onMatrixDropdownColumnAddedCallback(matrix: Question, column: MatrixDropdownColumn, columns: Array<MatrixDropdownColumn>): any;
onSetPropertyEditorOptionsCallback(propertyName: string, obj: Base, editorOptions: any): any;
onGetErrorTextOnValidationCallback(propertyName: string, obj: Base, value: any): string;
onValueChangingCallback(options: any): void;
onGetElementEditorTitleCallback(obj: Base, title: string): string;
startUndoRedoTransaction(name?: string): void;
stopUndoRedoTransaction(): void;
createSurvey(json: any, reason: string, model?: any, callback?: (survey: SurveyModel) => void, area?: string): SurveyModel;
onConditionQuestionsGetListCallback(propertyName: string, obj: Base, editor: any, list: any[], variables: string[]): string;
isConditionOperatorEnabled(questionName: string, question: Question, operator: string, isEnabled: boolean): boolean;
onLogicGetTitleCallback(expression: string, displayExpression: string, text: string, logicItem: any): string;
getProcessedTranslationItemText(locale: string, locString: ILocalizableString, newText: string, obj: any): string;
getTranslationExportedText(obj: Base, name: string, locString: ILocalizableString, locale: string, text: string): string;
uploadFiles(files: File[], question: Question, callback: (status: string, data: any) => any, context?: {
element: Base;
item?: any;
elementType?: string;
propertyName?: string;
}): void;
getHasMachineTranslation(): boolean;
doMachineTranslation(fromLocale: string, toLocale: string, strings: Array<string>, callback: (translated: Array<string>) => void): void;
chooseFiles(input: HTMLInputElement, callback: (files: File[]) => void, context?: {
element: Base;
item?: any;
elementType?: string;
propertyName?: string;
}): void;
translationLocalesOrder: Array<string>;
canAddPage(pageToAdd?: PageModel): boolean;
}
export declare class EmptySurveyCreatorOptions implements ISurveyCreatorOptions, ILocalizableOwner {
previewShowResults: boolean;
rootElement: HTMLElement;
enableLinkFileEditor: boolean;
getProcessedTranslationItemText(locale: string, locString: ILocalizableString, newText: string, obj: any): string;
isMobileView: boolean;
alwaySaveTextInPropertyEditors: boolean;
readOnly: boolean;
maxLogicItemsInCondition: number;
/**
* @deprecated
*/
showObjectTitles: boolean;
/**
* @deprecated
*/
showTitlesInExpressions: boolean;
useElementTitles: boolean;
allowEditExpressionsInTextEditor: boolean;
maximumColumnsCount: number;
minimumChoicesCount: number;
maximumChoicesCount: number;
maximumRowsCount: number;
maximumRateValues: number;
machineTranslationValue: boolean;
inplaceEditForValues: boolean;
maxNestedPanels: number;
maxPanelNestingLevel: number;
forbiddenNestedElements: {
panel: string[];
paneldynamic: string[];
};
showOneCategoryInPropertyGrid: boolean;
getObjectDisplayName(obj: Base, area: string, reason: string, displayName: string): string;
onCanShowPropertyCallback(object: any, property: JsonObjectProperty, showMode: string, parentObj: any, parentProperty: JsonObjectProperty): boolean;
getElementAddornerCssCallback(obj: Base, className: string): string;
onPropertyGridSurveyCreatedCallback(object: any, survey: SurveyModel): void;
onPropertyEditorCreatedCallback(object: any, property: JsonObjectProperty, editor: Question): void;
onPropertyEditorUpdateTitleActionsCallback(object: any, property: JsonObjectProperty, editor: Question, titleActions: IAction[]): void;
onPropertyGridShowModalCallback(object: any, property: JsonObjectProperty, editor: Question, popupEditor: any, popupModel: PopupBaseViewModel): void;
onIsPropertyReadOnlyCallback(obj: Base, property: JsonObjectProperty, readOnly: boolean, parentObj: Base, parentProperty: JsonObjectProperty): boolean;
onCanDeleteItemCallback(object: any, item: Base, allowDelete: boolean): boolean;
onCollectionItemDeletingCallback(obj: Base, property: JsonObjectProperty, collection: Array<Base>, item: Base): boolean;
onCollectionItemAllowingCallback(obj: Base, property: JsonObjectProperty, collection: Array<Base>, item: Base, options: ICollectionItemAllowOperations): void;
onItemValueAddedCallback(obj: Base, propertyName: string, itemValue: ItemValue, itemValues: Array<ItemValue>): void;
onFastEntryCallback(items: Array<ItemValue>, lines: Array<string>): Array<ItemValue>;
onMatrixDropdownColumnAddedCallback(matrix: Question, column: MatrixDropdownColumn, columns: Array<MatrixDropdownColumn>): void;
onSetPropertyEditorOptionsCallback(propertyName: string, obj: Base, editorOptions: any): void;
onGetErrorTextOnValidationCallback(propertyName: string, obj: Base, value: any): string;
onValueChangingCallback(options: any): void;
onGetElementEditorTitleCallback(obj: Base, title: string): string;
startUndoRedoTransaction(name?: string): void;
stopUndoRedoTransaction(): void;
createSurvey(json: any, reason: string, model?: any, callback?: (survey: SurveyModel) => void, area?: string): SurveyModel;
onConditionQuestionsGetListCallback(propertyName: string, obj: Base, editor: any, list: any[], variables: string[]): string;
isConditionOperatorEnabled(questionName: string, question: Question, operator: string, isEnabled: boolean): boolean;
onLogicGetTitleCallback(expression: string, displayExpression: string, text: string, logicItem: any): string;
getTranslationExportedText(obj: Base, name: string, locString: ILocalizableString, locale: string, text: string): string;
uploadFiles(files: File[], question: Question, callback: (status: string, data: any) => any): void;
getHasMachineTranslation(): boolean;
doMachineTranslation(fromLocale: string, toLocale: string, strings: Array<string>, callback: (translated: Array<string>) => void): void;
chooseFiles(input: HTMLInputElement, callback: (files: File[]) => void, context?: {
element: Base;
item?: any;
elementType?: string;
propertyName?: string;
}): void;
translationLocalesOrder: Array<string>;
canAddPage(pageToAdd?: PageModel): boolean;
getLocale(): string;
getMarkdownHtml(text: string, name: string, item?: any): string;
getProcessedText(text: string): string;
getRenderer(name: string): string;
getRendererContext(locStr: LocalizableString): LocalizableString;
}