survey-core
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.
87 lines (86 loc) • 3.33 kB
TypeScript
import { IQuestion } from "./base-interfaces";
import { HashTable } from "./helpers";
export interface IValueGetterItem {
name: string;
index?: number;
}
export interface IValueGetterInfo {
context?: IValueGetterContext;
requireStrictCompare?: boolean;
isFound?: boolean;
value?: any;
}
export interface IObjectValueContext {
getValueGetterContext(isUnwrapped?: boolean): IValueGetterContext;
}
export interface IValueGetterContext {
getValue(path: Array<IValueGetterItem>, isRoot: boolean, index: number, createObjects: boolean): IValueGetterInfo;
getTextValue?(name: string, value: any, isDisplayValue: boolean): string;
getRootObj?(): IObjectValueContext;
getQuestion?(): IQuestion;
}
export interface IValueInfoParams {
name: string;
context: IValueGetterContext;
isText?: boolean;
isDisplayValue?: boolean;
createObjects?: boolean;
}
export interface IReturnValue {
isFound: boolean;
value: any;
question?: IQuestion;
strictCompare?: boolean;
}
export declare class ValueGetter {
constructor();
getValueInfo(params: IValueInfoParams): IReturnValue;
private getValueInfoCore;
getValue(name: string, context: IValueGetterContext, isText?: boolean, isDisplayValue?: boolean): any;
getDisplayValue(name: string, context: IValueGetterContext, isDisplayValue?: boolean): string;
isAnyKeyChanged(keys: any, usedNames: string[]): boolean;
private getValueFromObject;
private run;
getPath(name: string): Array<IValueGetterItem>;
private getValueItem;
}
export declare class ValueGetterContextCore implements IValueGetterContext {
constructor();
getValue(path: Array<IValueGetterItem>, isRoot: boolean, index: number, createObjects: boolean): IValueGetterInfo;
protected isSearchNameRevert(): boolean;
private checkValueByPath;
private getNameByPath;
private getMaxIndexByPath;
getTextValue(name: string, value: any, isDisplayValue: boolean): string;
protected getInitialvalue(): any;
protected updateValueByItem(name: string, res: IValueGetterInfo): void;
protected updateItemByIndex(index: number, res: IValueGetterInfo): void;
}
export declare class VariableGetterContext extends ValueGetterContextCore {
private variables;
constructor(variables: HashTable<any>);
protected getInitialvalue(): any;
protected isSearchNameRevert(): boolean;
protected updateValueByItem(name: string, res: IValueGetterInfo): void;
protected updateItemByIndex(index: number, res: IValueGetterInfo): void;
private getValueByItemCore;
}
export declare class VariableGetterContextEx extends VariableGetterContext {
private second;
constructor(variables: HashTable<any>, second: IValueGetterContext);
getValue(path: Array<IValueGetterItem>, isRoot: boolean, index: number, createObjects: boolean): IValueGetterInfo;
}
export declare class ProcessValue {
private contextValue;
properties: HashTable<any>;
asyncValues: HashTable<any>;
onCompleteAsyncFunc: (op: any) => void;
constructor(context: IValueGetterContext);
get context(): IValueGetterContext;
hasValue(text: string): boolean;
getValue(text: string): any;
private getValueInfoByContext;
getValueInfo(valueInfo: any): {
hasValue: boolean;
};
}