survey-knockout
Version:
survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.
1,395 lines • 385 kB
TypeScript
/*
* Type definition for Survey JavaScript library for Knockout v1.9.12
* Copyright (c) 2015-2022 Devsoft Baltic OÜ - https://surveyjs.io/
* License: MIT (http://www.opensource.org/licenses/mit-license.php)
*/
export enum DragTypeOverMeEnum {
InsideEmptyPanel = 1,
MultilineRight,
MultilineLeft
}
export interface HashTable<T = any> {
}
export interface ILocalizableOwner {
getLocale(): string;
getMarkdownHtml(text: string, name: string): string;
getProcessedText(text: string): string;
getRenderer(name: string): string;
getRendererContext(locStr: LocalizableString): any;
}
export interface ILocalizableString {
getLocaleText(loc: string): string;
setLocaleText(loc: string, newValue: string): any;
getJson(): any;
getLocales(): Array<any>;
getIsMultiple(): boolean;
}
export interface IPropertyDecoratorOptions<T = any> {
defaultValue?: T;
defaultSource?: string;
getDefaultValue?: any;
localizable?: any;
onSet?: any;
}
export interface IArrayPropertyDecoratorOptions {
onPush?: any;
onRemove?: any;
onSet?: any;
}
export interface IObject {
}
export interface IFilePosition {
offset: number;
line: number;
column: number;
}
export interface IFileRange {
start: IFilePosition;
end: IFilePosition;
}
export interface ILiteralExpectation {
type: any;
text: string;
ignoreCase: boolean;
}
export interface IClassParts extends Array<any> {
}
export interface IClassExpectation {
type: any;
parts: IClassParts;
inverted: boolean;
ignoreCase: boolean;
}
export interface IAnyExpectation {
type: any;
}
export interface IEndExpectation {
type: any;
}
export interface IOtherExpectation {
type: any;
description: string;
}
export interface ICached {
nextPos: number;
result: any;
}
export interface IParseOptions {
filename?: string;
startRule?: string;
tracer?: any;
}
/*
* Defines an individual action. Action items can be displayed in certain survey elements - in Toolbar (or action bar), in titles (of pages, panels, questions), in matrix rows (as 'expand details' or 'remove row' buttons), and etc.
*/
export interface IAction {
/*
* Unique string id
*/
id: string;
/*
* Set this property to false to make the toolbar item invisible.
*/
visible?: boolean;
/*
* Toolbar item title
*/
title?: string;
/*
* Toolbar item tooltip
*/
tooltip?: string;
/*
* Set this property to false to disable the toolbar item.
*/
enabled?: boolean;
/*
* Set this property to false to hide the toolbar item title.
*/
showTitle?: boolean;
/*
* A callback that calls on toolbar item click.
*/
action?: any;
/*
* Toolbar item css class
*/
css?: string;
/*
* Toolbar inner element css class
*/
innerCss?: string;
/*
* Toolbar item data object. Used as data for custom template or component rendering
*/
data?: any;
popupModel?: any;
needSeparator?: boolean;
/*
* Set this property to true to activate the toolbar item (page)
*/
active?: boolean;
pressed?: boolean;
/*
* Toolbar item template name
*/
template?: string;
/*
* Toolbar item component name
*/
component?: string;
/*
* Toolbar item icon name
*/
iconName?: string;
/*
* Toolbar item icon size
*/
iconSize?: number;
/*
* Toolbar item child items. Can be used as contianer for options
*/
items?: any;
/*
* Gets or sets an action's location in a matrix question's row.
*
* The following options are available:
*
* - `start` - An action is located at the beginning of a row.
* - `end` - An action is located at the end of a row.
*/
location?: string;
/*
* Set it to true to make the tabIndex -1 to disable keyboard navigation to this item
*/
disableTabStop?: boolean;
/*
* Set it to false to force action "large" mode even if has icon and does not fit to action bar space
*/
disableShrink?: boolean;
/*
* Action button display mode
*/
mode?: "popup" | "large" | "small";
visibleIndex?: number;
}
export interface IDimensions {
scroll: number;
offset: number;
}
export interface IPosition {
left?: string | number;
top?: string | number;
}
export interface INumberPosition extends IPosition {
left?: number;
top?: number;
}
export interface ISize {
width: number;
height: number;
}
export interface ISurveyTriggerOwner {
getObjects(pages: any, questions: any): Array<any>;
setCompleted(): any;
setTriggerValue(name: string, value: any, isVariable: boolean): any;
copyTriggerValue(name: string, fromName: string): any;
focusQuestion(name: string): boolean;
}
export interface IConditionObject {
name: string;
text: string;
question: Question;
context?: Question;
}
export interface IMatrixColumnOwner extends ILocalizableOwner {
getRequiredText(): string;
onColumnPropertyChanged(column: MatrixDropdownColumn, name: string, newValue: any): void;
onColumnItemValuePropertyChanged(column: MatrixDropdownColumn, propertyName: string, obj: ItemValue, name: string, newValue: any, oldValue: any): void;
onShowInMultipleColumnsChanged(column: MatrixDropdownColumn): void;
getCellType(): string;
getCustomCellType(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, cellType: string): string;
onColumnCellTypeChanged(column: MatrixDropdownColumn): void;
}
export interface IMatrixDropdownData {
value: any;
onRowChanged(row: MatrixDropdownRowModelBase, columnName: string, newRowValue: any, isDeletingValue: boolean): void;
onRowChanging(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): any;
isValidateOnValueChanging: boolean;
getRowIndex(row: MatrixDropdownRowModelBase): number;
getRowValue(rowIndex: number): any;
checkIfValueInRowDuplicated(checkedRow: MatrixDropdownRowModelBase, cellQuestion: Question): boolean;
hasDetailPanel(row: MatrixDropdownRowModelBase): boolean;
getIsDetailPanelShowing(row: MatrixDropdownRowModelBase): boolean;
setIsDetailPanelShowing(row: MatrixDropdownRowModelBase, val: boolean): void;
createRowDetailPanel(row: MatrixDropdownRowModelBase): PanelModel;
validateCell(row: MatrixDropdownRowModelBase, columnName: string, rowValue: any): SurveyError;
columns: any;
createQuestion(row: MatrixDropdownRowModelBase, column: MatrixDropdownColumn): Question;
getLocale(): string;
getMarkdownHtml(text: string, name: string): string;
getRenderer(name: string): string;
getRendererContext(locStr: LocalizableString): any;
getProcessedText(text: string): string;
getParentTextProcessor(): ITextProcessor;
getSharedQuestionByName(columnName: string, row: MatrixDropdownRowModelBase): Question;
onTotalValueChanged(): any;
getSurvey(): ISurvey;
}
export interface ISurveyData {
getValue(name: string): any;
setValue(name: string, newValue: any, locNotification: any, allowNotifyValueChanged?: boolean): any;
getVariable(name: string): any;
setVariable(name: string, newValue: any): void;
getComment(name: string): string;
setComment(name: string, newValue: string, locNotification: any): any;
getAllValues(): any;
getFilteredValues(): any;
getFilteredProperties(): any;
}
export interface ITextProcessor {
processText(text: string, returnDisplayValue: boolean): string;
processTextEx(text: string, returnDisplayValue: boolean, doEncoding: boolean): any;
}
export interface ISurveyErrorOwner extends ILocalizableOwner {
getErrorCustomText(text: string, error: SurveyError): string;
}
export interface ISurvey extends ITextProcessor, ISurveyErrorOwner {
getSkeletonComponentName(element: ISurveyElement): string;
currentPage: IPage;
pages: any;
getCss(): any;
isPageStarted(page: IPage): boolean;
getQuestionByName(name: string): IQuestion;
pageVisibilityChanged(page: IPage, newValue: boolean): any;
panelVisibilityChanged(panel: IPanel, newValue: boolean): any;
questionVisibilityChanged(question: IQuestion, newValue: boolean): any;
isEditingSurveyElement: boolean;
isClearValueOnHidden: boolean;
isClearValueOnHiddenContainer: boolean;
questionsOrder: string;
questionCreated(question: IQuestion): any;
questionAdded(question: IQuestion, index: number, parentPanel: any, rootPanel: any): any;
panelAdded(panel: IElement, index: number, parentPanel: any, rootPanel: any): any;
questionRemoved(question: IQuestion): any;
panelRemoved(panel: IElement): any;
questionRenamed(question: IQuestion, oldName: string, oldValueName: string): any;
validateQuestion(question: IQuestion): SurveyError;
validatePanel(panel: IPanel): SurveyError;
hasVisibleQuestionByValueName(valueName: string): boolean;
questionCountByValueName(valueName: string): number;
processHtml(html: string): string;
getSurveyMarkdownHtml(element: Base, text: string, name: string): string;
getRendererForString(element: Base, name: string): string;
getRendererContextForString(element: Base, locStr: LocalizableString): any;
getExpressionDisplayValue(question: IQuestion, value: any, displayValue: string): string;
isDisplayMode: boolean;
isDesignMode: boolean;
areInvisibleElementsShowing: boolean;
areEmptyElementsHidden: boolean;
isLoadingFromJson: boolean;
isUpdateValueTextOnTyping: boolean;
autoGrowComment: boolean;
state: string;
isLazyRendering: boolean;
cancelPreviewByPage(panel: IPanel): any;
editText: string;
cssNavigationEdit: string;
requiredText: string;
beforeSettingQuestionErrors(question: IQuestion, errors: any): void;
beforeSettingPanelErrors(question: IPanel, errors: any): void;
getSurveyErrorCustomText(obj: Base, text: string, error: SurveyError): string;
getElementTitleTagName(element: Base, tagName: string): string;
questionTitlePattern: string;
getUpdatedQuestionTitle(question: IQuestion, title: string): string;
getUpdatedQuestionNo(question: IQuestion, no: string): string;
getUpdatedElementTitleActions(element: ISurveyElement, titleActions: any): Array<IAction>;
getUpdatedMatrixRowActions(question: QuestionMatrixDropdownModelBase, row: MatrixDropdownRowModelBase, actions: any): Array<IAction>;
questionStartIndex: string;
questionTitleLocation: string;
questionDescriptionLocation: string;
questionErrorLocation: string;
storeOthersAsComment: boolean;
maxTextLength: number;
maxOthersLength: number;
clearValueOnDisableItems: boolean;
uploadFiles(question: IQuestion, name: string, files: any, uploadingCallback: any): any;
downloadFile(name: string, content: string, callback: any): any;
clearFiles(question: IQuestion, name: string, value: any, fileName: string, clearCallback: any): any;
updateChoicesFromServer(question: IQuestion, choices: any, serverResult: any): Array<any>;
loadedChoicesFromServer(question: IQuestion): void;
updateQuestionCssClasses(question: IQuestion, cssClasses: any): any;
updatePanelCssClasses(panel: IPanel, cssClasses: any): any;
updatePageCssClasses(panel: IPanel, cssClasses: any): any;
updateChoiceItemCss(question: IQuestion, options: any): any;
afterRenderQuestion(question: IQuestion, htmlElement: any): any;
afterRenderQuestionInput(question: IQuestion, htmlElement: any): any;
afterRenderPanel(panel: IElement, htmlElement: any): any;
afterRenderPage(htmlElement: any): any;
getQuestionByValueNameFromArray(valueName: string, name: string, index: number): IQuestion;
canChangeChoiceItemsVisibility(): boolean;
getChoiceItemVisibility(question: IQuestion, item: any, val: boolean): boolean;
matrixRowAdded(question: IQuestion, row: any): any;
matrixBeforeRowAdded(options: any): any;
matrixRowRemoved(question: IQuestion, rowIndex: number, row: any): any;
matrixRowRemoving(question: IQuestion, rowIndex: number, row: any): boolean;
matrixAllowRemoveRow(question: IQuestion, rowIndex: number, row: any): boolean;
matrixCellCreating(question: IQuestion, options: any): any;
matrixCellCreated(question: IQuestion, options: any): any;
matrixAfterCellRender(question: IQuestion, options: any): any;
matrixCellValueChanged(question: IQuestion, options: any): any;
matrixCellValueChanging(question: IQuestion, options: any): any;
isValidateOnValueChanging: boolean;
matrixCellValidate(question: IQuestion, options: any): SurveyError;
dynamicPanelAdded(question: IQuestion): any;
dynamicPanelRemoved(question: IQuestion, panelIndex: number, panel: IPanel): any;
dynamicPanelItemValueChanged(question: IQuestion, options: any): any;
dragAndDropAllow(options: any): boolean;
scrollElementToTop(element: ISurveyElement, question: IQuestion, page: IPage, id: string): any;
runExpression(expression: string): any;
elementContentVisibilityChanged(element: ISurveyElement): void;
}
export interface ISurveyImpl {
getSurveyData(): ISurveyData;
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
}
export interface IConditionRunner {
runCondition(values: any, properties: any): any;
}
export interface IShortcutText {
shortcutText: string;
}
export interface ISurveyElement extends IShortcutText {
name: string;
isVisible: boolean;
isReadOnly: boolean;
isPage: boolean;
isPanel: boolean;
containsErrors: boolean;
parent: IPanel;
skeletonComponentName: string;
setSurveyImpl(value: ISurveyImpl, isLight?: boolean): any;
onSurveyLoad(): any;
onFirstRendering(): any;
getType(): string;
setVisibleIndex(value: number): number;
locStrsChanged(): any;
delete(): any;
toggleState(): void;
stateChangedCallback(): void;
getTitleToolbar(): AdaptiveActionContainer;
}
export interface IElement extends IConditionRunner, ISurveyElement {
visible: boolean;
renderWidth: string;
width: string;
minWidth?: string;
maxWidth?: string;
isExpanded: boolean;
isCollapsed: boolean;
rightIndent: number;
startWithNewLine: boolean;
registerFunctionOnPropertyValueChanged(name: string, func: any, key: string): void;
unRegisterFunctionOnPropertyValueChanged(name: string, key: string): void;
getPanel(): IPanel;
getLayoutType(): string;
isLayoutTypeSupported(layoutType: string): boolean;
removeElement(el: IElement): boolean;
onAnyValueChanged(name: string): any;
updateCustomWidgets(): any;
clearIncorrectValues(): any;
clearErrors(): any;
dispose(): void;
needResponsiveWidth(): boolean;
}
export interface IQuestion extends IElement, ISurveyErrorOwner {
hasTitle: boolean;
isEmpty(): boolean;
onSurveyValueChanged(newValue: any): any;
updateValueFromSurvey(newValue: any): any;
updateCommentFromSurvey(newValue: any): any;
supportGoNextPageAutomatic(): boolean;
clearUnusedValues(): any;
getDisplayValue(keysAsText: boolean, value: any): any;
getValueName(): string;
clearValue(): any;
clearValueIfInvisible(): any;
isAnswerCorrect(): boolean;
updateValueWithDefaults(): any;
getQuestionFromArray(name: string, index: number): IQuestion;
value: any;
survey: any;
}
export interface IParentElement {
addElement(element: IElement, index: number): any;
removeElement(element: IElement): boolean;
isReadOnly: boolean;
}
export interface IPanel extends ISurveyElement, IParentElement {
getChildrenLayoutType(): string;
getQuestionTitleLocation(): string;
getQuestionStartIndex(): string;
parent: IPanel;
elementWidthChanged(el: IElement): any;
indexOf(el: IElement): number;
elements: any;
ensureRowsVisibility(): void;
}
export interface IPage extends IPanel, IConditionRunner {
isStarted: boolean;
}
export interface ITitleOwner {
name: string;
no: string;
requiredText: string;
isRequireTextOnStart: boolean;
isRequireTextBeforeTitle: boolean;
isRequireTextAfterTitle: boolean;
locTitle: LocalizableString;
}
export interface IProgressInfo {
questionCount: number;
answeredQuestionCount: number;
requiredQuestionCount: number;
requiredAnsweredQuestionCount: number;
}
export interface IWrapperObject {
getOriginalObj(): Base;
getClassNameProperty(): string;
}
export interface IFindElement {
element: Base;
str: LocalizableString;
}
export interface IValidatorOwner {
getValidators(): Array<SurveyValidator>;
validatedValue: any;
getValidatorTitle(): string;
getDataFilteredValues(): any;
getDataFilteredProperties(): any;
}
export interface IMatrixData {
onMatrixRowChanged(row: MatrixRowModel): void;
getCorrectedRowValue(value: any): any;
}
export interface IMatrixCellsOwner extends ILocalizableOwner {
getRows(): Array<any>;
getColumns(): Array<any>;
}
export interface IMultipleTextData extends ILocalizableOwner, IPanel {
getSurvey(): ISurvey;
getTextProcessor(): ITextProcessor;
getAllValues(): any;
getMultipleTextValue(name: string): any;
setMultipleTextValue(name: string, value: any): any;
getItemDefaultValue(name: string): any;
getIsRequiredText(): string;
}
export interface SurveyTemplateRendererTemplateData {
name: string;
data: any;
nodes?: any;
afterRender: any;
}
export interface SurveyTemplateRendererViewModel {
componentData: any;
templateData: SurveyTemplateRendererTemplateData;
}
export interface IQuestionPanelDynamicData {
getItemIndex(item: ISurveyData): number;
getPanelItemData(item: ISurveyData): any;
setPanelItemData(item: ISurveyData, name: string, val: any): any;
getSharedQuestionFromArray(name: string, panelIndex: number): Question;
getSurvey(): ISurvey;
getRootData(): ISurveyData;
}
export declare class ArrayChanges {
constructor(index: number, deleteCount: number, itemsToAdd: any, deletedItems: any);
index: number;
deleteCount: number;
itemsToAdd: any;
deletedItems: any;
}
/*
* The base class for SurveyJS objects.
*/
export declare class Base {
constructor();
static currentDependencis: Dependencies;
static finishCollectDependencies(): Dependencies;
static startCollectDependencies(updater: any, target: Base, property: string): void;
static get commentPrefix(): string;
static set commentPrefix(val: string);
static createItemValue: any;
static itemValueLocStrChanged: any;
/*
* Returns true if a value undefined, null, empty string or empty array.
*/
isValueEmpty(value: any, trimString?: boolean): boolean;
protected trimValue(value: any): any;
protected IsPropertyEmpty(value: any): boolean;
propertyHash: any;
localizableStrings: any;
arraysInfo: any;
eventList: any;
bindingsValue: Bindings;
isDisposedValue: boolean;
onPropChangeFunctions: any;
protected isLoadingFromJsonValue: boolean;
loadingOwner: Base;
/*
* Event that raise on property change of the sender object
* sender - the object that owns the property
* options.name - the property name that has been changed
* options.oldValue - old value. Please note, it equals to options.newValue if property is an array
* options.newValue - new value.
*/
onPropertyChanged: EventBase<Base>;
/*
* Event that raised on changing property of the ItemValue object.
* sender - the object that owns the property
* options.propertyName - the property name to which ItemValue array is belong. It can be "choices" for dropdown question
* options.obj - the instance of ItemValue object which property has been changed
* options.name - the property of ItemObject that has been changed
* options.oldValue - old value
* options.newValue - new value
*/
onItemValuePropertyChanged: Event<(sender: Base, options: any) => any, any>;
getPropertyValueCoreHandler: any;
setPropertyValueCoreHandler: any;
createArrayCoreHandler: any;
surveyChangedCallback: any;
isCreating: boolean;
dispose(): void;
get isDisposed(): boolean;
protected addEvent<T>(): EventBase<T>;
protected onBaseCreating(): void;
/*
* Returns the type of the object as a string as it represents in the json. It should be in lowcase.
*/
getType(): string;
getSurvey(isLive?: boolean): ISurvey;
/*
* Returns true if the object is inluded into survey, otherwise returns false.
*/
get inSurvey(): boolean;
get bindings(): Bindings;
checkBindings(valueName: string, value: any): void;
protected updateBindings(propertyName: string, value: any): void;
protected updateBindingValue(valueName: string, value: any): void;
/*
* Returns the element template name without prefix. Typically it equals to getType().
*/
getTemplate(): string;
/*
* Returns true if the object is loading from Json at the current moment.
*/
get isLoadingFromJson(): boolean;
protected getIsLoadingFromJson(): boolean;
startLoadingFromJson(): void;
endLoadingFromJson(): void;
/*
* Deserialized the current object into JSON
*/
toJSON(): any;
/*
* Load object properties and elements. It doesn't reset properties that was changed before and they are not defined in the json parameter.
*/
fromJSON(json: any): void;
onSurveyLoad(): void;
/*
* Make a clone of the existing object. Create a new object of the same type and load all properties into it.
*/
clone(): Base;
/*
* Returns the serializable property that belongs to this instance by property name. It returns null if the property is not exists.
*/
getPropertyByName(propName: string): JsonObjectProperty;
isPropertyVisible(propName: string): boolean;
static createProgressInfo(): IProgressInfo;
getProgressInfo(): IProgressInfo;
localeChanged(): void;
locStrsChanged(): void;
/*
* Returns the property value by name
*/
getPropertyValue(name: string, defaultValue?: any): any;
protected getPropertyValueCore(propertiesHash: any, name: string): any;
geValueFromHash(): any;
protected setPropertyValueCore(propertiesHash: any, name: string, val: any): void;
get isEditingSurveyElement(): boolean;
iteratePropertiesHash(func: any): void;
/*
* set property value
*/
setPropertyValue(name: string, val: any): void;
protected setArrayPropertyDirectly(name: string, val: any, sendNotification?: boolean): void;
protected setPropertyValueDirectly(name: string, val: any): void;
protected clearPropertyValue(name: string): void;
onPropertyValueChangedCallback(name: string, oldValue: any, newValue: any, sender: Base, arrayChanges: ArrayChanges): void;
itemValuePropertyChanged(item: ItemValue, name: string, oldValue: any, newValue: any): void;
protected onPropertyValueChanged(name: string, oldValue: any, newValue: any): void;
protected propertyValueChanged(name: string, oldValue: any, newValue: any, arrayChanges?: ArrayChanges, target?: Base): void;
protected get isInternal(): boolean;
/*
* Register a function that will be called on a property value changed.
*/
registerFunctionOnPropertyValueChanged(name: string, func: any, key?: string): void;
/*
* Register a function that will be called on a property value changed from the names list.
*/
registerFunctionOnPropertiesValueChanged(names: any, func: any, key?: string): void;
/*
* Unregister notification on property value changed
*/
unRegisterFunctionOnPropertyValueChanged(name: string, key?: string): void;
/*
* Unregister notification on property value changed for all properties in the names list.
*/
unRegisterFunctionOnPropertiesValueChanged(names: any, key?: string): void;
createCustomLocalizableObj(name: string): void;
protected createLocalizableString(name: string, owner: ILocalizableOwner, useMarkDown?: boolean, defaultStr?: string | boolean): LocalizableString;
getLocalizableString(name: string): LocalizableString;
getLocalizableStringText(name: string, defaultStr?: string): string;
setLocalizableStringText(name: string, value: string): void;
addUsedLocales(locales: any): void;
searchText(text: string, founded: any): void;
protected getSearchableLocKeys(keys: any): void;
protected getSearchableItemValueKeys(keys: any): void;
protected AddLocStringToUsedLocales(locStr: LocalizableString, locales: any): void;
protected createItemValues(name: string): Array<any>;
protected createNewArrayCore(name: string): Array<any>;
protected ensureArray(name: string, onPush?: any, onRemove?: any): any;
protected createNewArray(name: string, onPush?: any, onRemove?: any): Array<any>;
protected getItemValueType(): string;
protected setArray(name: string, src: any, dest: any, isItemValues: boolean, onPush: any): void;
protected isTwoValueEquals(x: any, y: any, caseInSensitive?: boolean, trimString?: boolean): boolean;
protected copyCssClasses(dest: any, source: any): void;
}
export declare class Bindings {
constructor(obj: Base);
properties: any;
values: any;
getType(): string;
getNames(): Array<any>;
getProperties(): Array<JsonObjectProperty>;
setBinding(propertyName: string, valueName: string): void;
clearBinding(propertyName: string): void;
isEmpty(): boolean;
getValueNameByPropertyName(propertyName: string): string;
getPropertiesByValueName(valueName: string): Array<any>;
getJson(): any;
setJson(value: any): void;
}
export declare class ButtonGroupItemModel {
constructor(question: QuestionButtonGroupModel, item: ItemValue, index: number);
question: QuestionButtonGroupModel;
item: ItemValue;
index: number;
get value(): any;
get iconName(): any;
get iconSize(): any;
get caption(): LocalizableString;
get showCaption(): any;
get isRequired(): boolean;
get selected(): boolean;
get readOnly(): boolean;
get name(): string;
get id(): string;
get hasErrors(): boolean;
get describedBy(): string;
get css(): any;
onChange(): void;
}
export declare class ButtonGroupItemViewModel {
constructor(model: any);
model: any;
}
export declare class ComponentCollection {
static Instance: ComponentCollection;
customQuestionValues: any;
onCreateComposite: any;
onCreateCustom: any;
onAddingJson: any;
add(json: any): void;
get items(): any;
getCustomQuestionByName(name: string): ComponentQuestionJSON;
clear(): void;
createQuestion(name: string, questionJSON: ComponentQuestionJSON): Question;
protected createCompositeModel(name: string, questionJSON: ComponentQuestionJSON): QuestionCompositeModel;
protected createCustomModel(name: string, questionJSON: ComponentQuestionJSON): QuestionCustomModel;
}
export declare class ComponentQuestionJSON {
constructor(name: string, json: any);
name: string;
json: any;
onInit(): void;
onCreated(question: Question): void;
onLoaded(question: Question): void;
onAfterRender(question: Question, htmlElement: any): void;
onAfterRenderContentElement(question: Question, element: Question, htmlElement: any): void;
onPropertyChanged(question: Question, propertyName: string, newValue: any): void;
onValueChanged(question: Question, name: string, newValue: any): void;
onItemValuePropertyChanged(question: Question, item: ItemValue, propertyName: string, name: string, newValue: any): void;
getDisplayValue(keyAsText: boolean, value: any, question: Question): any;
get isComposite(): boolean;
}
export declare class ComputedUpdater<T = any> {
constructor(_updater: any);
static ComputedUpdaterType: any;
dependencies: Dependencies;
type: any;
get updater(): any;
setDependencies(dependencies: Dependencies): void;
protected getDependencies(): Dependencies;
dispose(): any;
}
export declare class ConditionsParser {
conditionError: ConditionsParserError;
static parserCache: any;
createCondition(text: string): Operand;
parseExpression(text: string): Operand;
get error(): ConditionsParserError;
}
export declare class ConditionsParserError {
constructor(at: number, code: string);
at: number;
code: string;
}
export declare class CssClassBuilder {
classes: any;
isEmpty(): boolean;
append(value: string, condition?: boolean): CssClassBuilder;
toString(): string;
}
export declare class CustomPropertiesCollection {
static properties: IObject;
static parentClasses: any;
static addProperty(className: string, property: any): void;
static removeProperty(className: string, propertyName: string): void;
static addClass(className: string, parentClassName: string): void;
static getProperties(className: string): Array<any>;
static createProperties(obj: any): void;
}
export declare class CustomWidgetCollection {
static Instance: CustomWidgetCollection;
widgetsValues: any;
widgetsActivatedBy: any;
onCustomWidgetAdded: Event<(customWidget: QuestionCustomWidget) => any, any>;
get widgets(): any;
add(widgetJson: any, activatedBy?: string): void;
addCustomWidget(widgetJson: any, activatedBy?: string): QuestionCustomWidget;
/*
* Returns the way the custom wiget is activated. It can be activated by a property ("property"), question type ("type") or by new/custom question type ("customtype").
*/
getActivatedBy(widgetName: string): string;
/*
* Sets the way the custom wiget is activated. The activation types are: property ("property"), question type ("type") or new/custom question type ("customtype"). A custom wiget may support all or only some of this activation types.
*/
setActivatedBy(widgetName: string, activatedBy: string): void;
clear(): void;
getCustomWidgetByName(name: string): QuestionCustomWidget;
getCustomWidget(question: IQuestion): QuestionCustomWidget;
}
export declare class DefaultTitleModel {
static getIconCss(cssClasses: any, isCollapsed: boolean): string;
}
export declare class DefaultTitleViewModel {
constructor(element: any);
element: any;
getIconCss(): any;
}
export declare class Dependencies {
constructor(currentDependency: any, target: Base, property: string);
currentDependency: any;
target: Base;
property: string;
static DependenciesCount: number;
dependencies: any;
id: string;
addDependency(target: Base, property: string): void;
dispose(): void;
}
export declare class DragDropInfo {
constructor(source: IElement, target: IElement, nestedPanelDepth?: number);
source: IElement;
target: IElement;
nestedPanelDepth: number;
destination: ISurveyElement;
isBottom: boolean;
isEdge: boolean;
}
export declare class DragOrClickHelper {
constructor(dragHandler: any);
pointerDownEvent: any;
currentTarget: any;
startX: any;
startY: any;
currentX: any;
currentY: any;
itemModel: any;
onPointerDown(pointerDownEvent: any, itemModel?: any): void;
onPointerUp: any;
tryToStartDrag: any;
}
export declare class ElementFactory {
static Instance: ElementFactory;
creatorHash: any;
registerElement(elementType: string, elementCreator: any): void;
clear(): void;
unregisterElement(elementType: string, removeFromSerializer?: boolean): void;
getAllTypes(): Array<any>;
createElement(elementType: string, name: string): IElement;
}
export declare class Event<T, Options> {
onCallbacksChanged: any;
protected callbacks: any;
get isEmpty(): boolean;
fire(sender: any, options: any): void;
clear(): void;
add(func: T): void;
remove(func: T): void;
hasFunc(func: T): boolean;
}
export declare class ExpressionRunnerBase {
constructor(expression: string);
expressionValue: string;
operand: Operand;
processValue: ProcessValue;
parser: ConditionsParser;
isAsyncValue: boolean;
hasFunctionValue: boolean;
asyncFuncList: any;
get expression(): string;
set expression(val: string);
getVariables(): Array<any>;
hasFunction(): boolean;
get isAsync(): boolean;
canRun(): boolean;
protected runCore(values: any, properties?: any): any;
protected doOnComplete(res: any): void;
}
export declare class FunctionFactory {
static Instance: FunctionFactory;
functionHash: any;
isAsyncHash: any;
register(name: string, func: any, isAsync?: boolean): void;
unregister(name: string): void;
hasFunction(name: string): boolean;
isAsyncFunction(name: string): boolean;
clear(): void;
getAll(): Array<any>;
run(name: string, params: any, properties?: any): any;
}
export declare class Helpers {
/*
* A static methods that returns true if a value undefined, null, empty string or empty array.
*/
static isValueEmpty(value: any): boolean;
static isArrayContainsEqual(x: any, y: any): boolean;
static isArraysEqual(x: any, y: any, ignoreOrder?: boolean, caseSensitive?: boolean, trimStrings?: boolean): boolean;
static isTwoValueEquals(x: any, y: any, ignoreOrder?: boolean, caseSensitive?: boolean, trimStrings?: boolean): boolean;
static randomizeArray<T>(array: any): Array<T>;
static getUnbindValue(value: any): any;
static createCopy(obj: any): any;
static isConvertibleToNumber(value: any): boolean;
static isNumber(value: any): boolean;
static getMaxLength(maxLength: number, surveyLength: number): any;
static getNumberByIndex(index: number, startIndexStr: string): string;
static isCharNotLetterAndDigit(ch: string): boolean;
static isCharDigit(ch: string): boolean;
static correctAfterPlusMinis(a: number, b: number, res: number): number;
static correctAfterMultiple(a: number, b: number, res: number): number;
}
export declare class ImplementorBase {
constructor(element: any);
element: any;
implementedMark: any;
dispose(): void;
}
export declare class JsonError {
constructor(type: string, message: string);
type: string;
message: string;
description: string;
at: any;
getFullDescription(): string;
}
/*
* The metadata object. It contains object properties' runtime information and allows you to modify it.
*/
export declare class JsonMetadata {
classes: any;
alternativeNames: any;
childrenClasses: any;
classProperties: any;
classHashProperties: any;
getObjPropertyValue(obj: any, name: string): any;
setObjPropertyValue(obj: any, name: string, val: any): void;
addClass(name: string, properties: any, creator?: any, parentName?: string): JsonMetadataClass;
removeClass(name: string): void;
overrideClassCreatore(name: string, creator: any): void;
overrideClassCreator(name: string, creator: any): void;
getProperties(className: string): Array<JsonObjectProperty>;
getPropertiesByObj(obj: any): Array<JsonObjectProperty>;
getDynamicPropertiesByObj(obj: any, dynamicType?: string): Array<JsonObjectProperty>;
hasOriginalProperty(obj: Base, propName: string): boolean;
getOriginalProperty(obj: Base, propName: string): JsonObjectProperty;
getProperty(className: string, propertyName: string): JsonObjectProperty;
findProperty(className: string, propertyName: string): JsonObjectProperty;
findProperties(className: string, propertyNames: any): Array<JsonObjectProperty>;
getAllPropertiesByName(propertyName: string): Array<JsonObjectProperty>;
getAllClasses(): Array<any>;
createClass(name: string, json?: any): any;
getChildrenClasses(name: string, canBeCreated?: boolean): Array<JsonMetadataClass>;
getRequiredProperties(name: string): Array<any>;
addProperties(className: string, propertiesInfos: any): void;
addProperty(className: string, propertyInfo: any): JsonObjectProperty;
removeProperty(className: string, propertyName: string): boolean;
findClass(name: string): JsonMetadataClass;
isDescendantOf(className: string, ancestorClassName: string): boolean;
addAlterNativeClassName(name: string, alternativeName: string): void;
generateSchema(className?: string): any;
}
export declare class JsonMetadataClass {
constructor(name: string, properties: any, creator?: any, parentName?: string);
name: string;
creator: any;
parentName: string;
static requiredSymbol: string;
static typeSymbol: string;
properties: any;
find(name: string): JsonObjectProperty;
createProperty(propInfo: any): JsonObjectProperty;
}
export declare class JsonObject {
static typePropertyName: string;
static positionPropertyName: string;
static metaDataValue: JsonMetadata;
static get metaData(): JsonMetadata;
errors: any;
lightSerializing: boolean;
toJsonObject(obj: any, storeDefaults?: boolean): any;
toObject(jsonObj: any, obj: any): void;
toObjectCore(jsonObj: any, obj: any): void;
toJsonObjectCore(obj: any, property: JsonObjectProperty, storeDefaults?: boolean): any;
valueToJson(obj: any, result: any, property: JsonObjectProperty, storeDefaults?: boolean): void;
valueToObj(value: any, obj: any, property: JsonObjectProperty): void;
}
export declare class MatrixCells {
constructor(cellsOwner: IMatrixCellsOwner);
cellsOwner: IMatrixCellsOwner;
values: any;
get isEmpty(): boolean;
setCellText(row: any, column: any, val: string): void;
setDefaultCellText(column: any, val: string): void;
getCellLocText(row: any, column: any): LocalizableString;
getDefaultCellLocText(column: any, val: string): LocalizableString;
getCellDisplayLocText(row: any, column: any): LocalizableString;
getCellText(row: any, column: any): string;
getDefaultCellText(column: any): string;
getCellDisplayText(row: any, column: any): string;
get rows(): any;
get columns(): any;
getJson(): any;
setJson(value: any): void;
protected createString(): LocalizableString;
}
export declare class MatrixDropdownCell {
constructor(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, data: IMatrixDropdownData);
column: MatrixDropdownColumn;
row: MatrixDropdownRowModelBase;
data: IMatrixDropdownData;
questionValue: Question;
locStrsChanged(): void;
protected createQuestion(column: MatrixDropdownColumn, row: MatrixDropdownRowModelBase, data: IMatrixDropdownData): Question;
get question(): Question;
get value(): any;
set value(val: any);
runCondition(values: any, properties: any): void;
}
export declare class Operand {
toString(func?: any): string;
getType(): string;
evaluate(processValue?: ProcessValue): any;
setVariables(variables: any): any;
hasFunction(): boolean;
hasAsyncFunction(): boolean;
addToAsyncList(list: any): void;
isEqual(op: Operand): boolean;
protected isContentEqual(op: Operand): boolean;
protected areOperatorsEquals(op1: Operand, op2: Operand): boolean;
}
export declare class OperandMaker {
static unaryFunctions: any;
static binaryFunctions: any;
static signs: any;
}
export declare class PanelViewModel {
constructor(question: any, targetElement: any);
question: any;
targetElement: any;
}
export declare class PopupUtils {
static calculatePosition(targetRect: any, height: number, width: number, verticalPosition: any, horizontalPosition: any, showPointer: boolean): INumberPosition;
static updateVerticalDimensions(top: number, height: number, windowHeight: number): any;
static updateHorizontalDimensions(left: number, width: number, windowWidth: number, horizontalPosition: any): any;
static updateVerticalPosition(targetRect: any, height: number, verticalPosition: any, showPointer: boolean, windowHeight: number): any;
static calculatePopupDirection(verticalPosition: any, horizontalPosition: any): string;
static calculatePointerTarget(targetRect: any, top: number, left: number, verticalPosition: any, horizontalPosition: any, width?: number, margins?: number): INumberPosition;
}
export declare class PopupViewModel {
constructor(popupViewModel: any);
popupViewModel: any;
dispose(): void;
}
export declare class ProcessValue {
constructor();
values: any;
properties: any;
getFirstName(text: string, obj?: any): string;
hasValue(text: string, values?: any): boolean;
getValue(text: string, values?: any): any;
setValue(obj: any, text: string, value: any): void;
getValueInfo(valueInfo: any): void;
}
export declare class ProgressButtonsViewModel {
constructor(survey: any, element: any);
progressButtonsModel: any;
scrollButtonCssKo: any;
hasScroller: any;
updateScroller: any;
isListElementClickable(index: any): boolean;
getListElementCss(index: any): string;
clickListElement(index: any): void;
getScrollButtonCss(isLeftScroll: boolean): any;
clickScrollButton(listContainerElement: any, isLeftScroll: boolean): void;
dispose(): void;
}
export declare class ProgressViewModel {
constructor(model: any);
model: any;
getProgressTextInBarCss(css: any): string;
getProgressTextUnderBarCss(css: any): string;
}
export declare class QuestionCustomWidget {
constructor(name: string, widgetJson: any);
name: string;
widgetJson: any;
htmlTemplate: string;
isFirstRender: boolean;
afterRender(question: IQuestion, el: any): void;
willUnmount(question: IQuestion, el: any): void;
getDisplayValue(question: IQuestion, value?: any): string;
isFit(question: IQuestion): boolean;
get canShowInToolbox(): boolean;
get showInToolbox(): boolean;
set showInToolbox(val: boolean);
init(): void;
activatedByChanged(activatedBy: string): void;
get isDefaultRender(): boolean;
get pdfQuestionType(): string;
get pdfRender(): any;
}
export declare class QuestionFactory {
static Instance: QuestionFactory;
static get DefaultChoices(): any;
static get DefaultColums(): any;
static get DefaultRows(): any;
static get DefaultMutlipleTextItems(): any;
creatorHash: any;
registerQuestion(questionType: string, questionCreator: any): void;
unregisterElement(elementType: string): void;
clear(): void;
getAllTypes(): Array<any>;
createQuestion(questionType: string, name: string): Question;
}
export declare class QuestionMatrixDropdownRenderedCell {
constructor();
static counter: number;
idValue: number;
itemValue: ItemValue;
minWidth: string;
width: string;
locTitle: LocalizableString;
cell: MatrixDropdownCell;
column: MatrixDropdownColumn;
row: MatrixDropdownRowModelBase;
question: Question;
isRemoveRow: boolean;
choiceIndex: number;
matrix: QuestionMatrixDropdownModelBase;
requiredText: string;
isEmpty: boolean;
colSpans: number;
panel: PanelModel;
isShowHideDetail: boolean;
isActionsCell: boolean;
isDragHandlerCell: boolean;
classNameValue: string;
get hasQuestion(): boolean;
get hasTitle(): boolean;
get hasPanel(): boolean;
get id(): number;
get showErrorOnTop(): boolean;
get showErrorOnBottom(): boolean;
get item(): ItemValue;
set item(val: ItemValue);
get isChoice(): boolean;
get choiceValue(): any;
get isCheckbox(): boolean;
get isFirstChoice(): boolean;
get className(): string;
get headers(): string;
getTitle(): string;
calculateFinalClassName(matrixCssClasses: any): string;
}
export declare class RendererFactory {
static Instance: RendererFactory;
renderersHash: any;
unregisterRenderer(questionType: string, rendererAs: string): void;
registerRenderer(questionType: string, renderAs: string, renderer: any): void;
getRenderer(questionType: string, renderAs: string): any;
getRendererByQuestion(question: Question): any;
clear(): void;
}
export declare class ResponsivityManager {
constructor(container: any, model: any, itemsSelector: string, dotsItemSize?: number);
resizeObserver: any;
isInitialized: boolean;
protected minDimensionConst: number;
separatorSize: number;
separatorAddConst: number;
paddingSizeConst: number;
protected recalcMinDimensionConst: boolean;
getComputedStyle: any;
protected getDimensions(element: any): IDimensions;
protected getAvailableSpace(): number;
protected calcItemSize(item: any): number;
dispose(): void;
}
export declare class StringEditorViewModel {
constructor(locString: any);
locString: any;
get koHasHtml(): any;
get editValue(): any;
set editValue(val: any);
onInput(sender: StringEditorViewModel, event: any): void;
onClick(sender: StringEditorViewModel, event: any): void;
dispose(): void;
}
export declare class StylesManager {
constructor();
static SurveyJSStylesSheetId: string;
static Styles: any;
static Media: any;
static ThemeColors: any;
static ThemeCss: any;
static modernThemeCss: any;
static bootstrapThemeCss: any;
static bootstrapmaterialThemeCss: any;
sheet: any;
static applyTheme(themeName?: string, themeSelector?: string): void;
static Enabled: boolean;
initializeStyles(sheet: any): void;
}
export declare class SurveyError {
constructor(text?: string, errorOwner?: ISurveyErrorOwner);
text: string;
locTextValue: LocalizableString;
visible: boolean;
get locText(): LocalizableString;
getText(): string;
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class SurveyProgressButtonsModel {
constructor(survey: SurveyModel);
isListElementClickable(index: number): boolean;
getListElementCss(index: number): string;
getScrollButtonCss(hasScroller: boolean, isLeftScroll: boolean): string;
clickListElement(index: number): void;
}
export declare class SurveyProgressModel {
static getProgressTextInBarCss(css: any): string;
static getProgressTextUnderBarCss(css: any): string;
}
export declare class SurveyTemplateText {
constructor();
addText(newText: string, id: string, name: string): void;
replaceText(replaceText: string, id: string, questionType?: string): void;
protected getId(id: string, questionType: string): string;
protected get text(): string;
protected set text(val: string);
}
export declare class SurveyTimer {
static instanceValue: SurveyTimer;
static get instance(): SurveyTimer;
listenerCounter: number;
timerId: number;
onTimer: Event<() => any, any>;
start(func?: any): void;
stop(func?: any): void;
doTimer(): void;
}
export declare class SvgIconData {
}
export declare class SvgIconRegistry {
icons: SvgIconData;
iconPrefix: string;
registerIconFromSymbol(iconId: string, iconSymbolSvg: string): void;
registerIconFromSvgViaElement(iconId: string, iconSvg: string, iconPrefix?: string): void;
registerIconFromSvg(iconId: string, iconSvg: string, iconPrefix?: string): boolean;
iconsRenderedHtml(): any;
renderIcons(): void;
}
export declare class SyntaxError {
constructor(message: string, expected: any, found: string, location: IFileRange);
static buildMessage(expected: any, found: string): string;
message: string;
expected: any;
found: string;
location: IFileRange;
name: string;
}
export declare class TextPreProcessor {
_unObservableValues: any;
onProcess: any;
process(text: string, returnDisplayValue?: boolean, doEncoding?: boolean): string;
processValue(name: string, returnDisplayValue: boolean): TextPreProcessorValue;
get hasAllValuesOnLastRun(): boolean;
}
export declare class TextPreProcessorItem {
start: number;
end: number;
}
export declare class TextPreProcessorValue {
constructor(name: string, returnDisplayValue: boolean);
name: string;
returnDisplayValue: boolean;
value: any;
isExists: boolean;
canProcess: boolean;
}
export declare class TooltipErrorViewModel {
constructor(question: any);
question: any;
tooltipManager: any;
afterRender: any;
}
export declare class TooltipManager {
constructor(tooltipElement: any);
tooltipElement: any;
targetElement: any;
dispose(): void;
onMouseMoveCallback: any;
}
export declare class ValidatorResult {
constructor(value: any, error?: SurveyError);
value: any;
error: SurveyError;
}
export declare class ValidatorRunner {
asyncValidators: any;
onAsyncCompleted: any;
run(owner: IValidatorOwner): Array<SurveyError>;
}
export declare class XmlParser {
parser: any;
assignValue(target: any, name: string, value: any): void;
xml2Json(xmlNode: any, result: any): void;
parseXmlString(xmlString: string): any;
}
/*
* The class contains methods to work with api.surveyjs.io service.
*/
export declare class dxSurveyService {
constructor();
static get serviceUrl(): string;
static set serviceUrl(val: string);
loadSurvey(surveyId: string, onLoad: any): void;
getSurveyJsonAndIsCompleted(surveyId: string, clientId: string, onLoad: any): void;
sendResult(postId: string, result: any, onSendResult: any, clientId?: string, isPartialCompleted?: boolean): void;
sendFile(postId: string, file: any, onSendFile: any): void;
getResult(resultId: string, name: string, onGetResult: any): void;
isCompleted(resultId: string, clientId: string, onIsCompleted: any): void;
}
export declare class Action extends Base implements IAction {
constructor(innerItem: IAction);
innerItem: IAction;
updateCallback: any;
location: string;
id: string;
iconName: string;
iconSize: number;
visible: boolean;
title: string;
tooltip: string;
enabled: boolean;
showTitle: boolean;
action: any;
css: string;
innerCss: string;
data: any;
popupModel: any;
needSeparator: boolean;
active: boolean;
pressed: boolean;
template: string;
component: string;
items: any;
visibleIndex: number;
mode: "popup" | "large" | "small";
disableTabStop: boolean;
disableShrink: boolean;
cssClassesValue: any;
get cssClasses(): any;
get disabled(): boolean;
get hasTitle(): boolean;
get isVisible(): boolean;
get canShrink(): boolean;
getActionRootCss(): string;
getActionBarItemTitleCss(): string;
getActionBarItemCss(): string;
minDimension: number;
maxDimension: number;
}
export declare class ActionContainer<T extends Action = Action> extends Base {
constructor();
actions: any;
cssClassesValue: any;
protected getRenderedActions(): Array<T>;
updateCallback: any;
containerCss: string;
protected raiseUpdate(isResetInitialized: boolean): void;
protected onSet(): void;
protected onPush(item: T): void;
protected onRemove(item: T): void;
get hasActions(): boolean;
get renderedActions(): any;
get visibleActions(): any;
getRootCss(): string;
get cssClasses(): any;
setItems(items: any, sortByVisibleIndex?: boolean): void;
initResponsivityManager(container: any): void;
resetResponsivityManager(): void;
}
export declare class ActionContainerImplementor extends ImplementorBase {
constructor(model: any, handleClick?: boolean);
handleClick: boolean;
itemsSubscription: any;
dispose(): void;
}
export declare class AnswerRequiredError extends SurveyError {
constructor(text?: string, errorOwner?: ISurveyErrorOwner);
text: string;
getErrorType(): string;
protected getDefaultText(): string;
}
export declare class ArrayOperand extends Operand {
constructor(values: any);
values: any;
getType(): string;
toString(func?: any): string;
evaluate(processValue?: ProcessValue): Array<a