56 lines
1.9 KiB
TypeScript
56 lines
1.9 KiB
TypeScript
|
|
/**
|
||
|
|
* @fileOverview
|
||
|
|
*
|
||
|
|
* Created on 5/21/16.
|
||
|
|
* @author Siggi Orn <siggi@jibo.com>
|
||
|
|
*/
|
||
|
|
import { Event, EventContainer } from 'jibo-typed-events';
|
||
|
|
import { Folder } from './Folder';
|
||
|
|
export declare type FieldType = (string | number | boolean);
|
||
|
|
export declare type FieldTypeString = ('string' | 'number' | 'boolean' | 'button');
|
||
|
|
export declare class FieldEvents<ValidType> extends EventContainer {
|
||
|
|
change: Event<ValidType>;
|
||
|
|
constructor();
|
||
|
|
}
|
||
|
|
export declare abstract class Field<ValidType> {
|
||
|
|
folder: Folder;
|
||
|
|
name: string;
|
||
|
|
initial: ValidType;
|
||
|
|
type: FieldTypeString;
|
||
|
|
events: FieldEvents<ValidType>;
|
||
|
|
protected _current: ValidType;
|
||
|
|
protected _limitInput: (input: ValidType) => ValidType;
|
||
|
|
constructor(folder: Folder, name: string, initial: ValidType, type: FieldTypeString);
|
||
|
|
current: ValidType;
|
||
|
|
_setCurrent(value: ValidType, fromRemote: boolean, noChange?: boolean): void;
|
||
|
|
protected _updateRemote(): void;
|
||
|
|
/**
|
||
|
|
* Returns a basic representation of this element for serialization
|
||
|
|
* @returns {any}
|
||
|
|
*/
|
||
|
|
toSimpleObject(): any;
|
||
|
|
}
|
||
|
|
export declare class StringField extends Field<string> {
|
||
|
|
initial: string;
|
||
|
|
constructor(folder: Folder, name: string, initial?: string);
|
||
|
|
}
|
||
|
|
export declare class DropdownField extends Field<string> {
|
||
|
|
options: string[];
|
||
|
|
constructor(folder: Folder, name: string, options: string[], initialIndex?: number);
|
||
|
|
}
|
||
|
|
export declare class CheckboxField extends Field<boolean> {
|
||
|
|
initial: boolean;
|
||
|
|
constructor(folder: Folder, name: string, initial?: boolean);
|
||
|
|
}
|
||
|
|
export declare class NumberField extends Field<number> {
|
||
|
|
initial: number;
|
||
|
|
min: number;
|
||
|
|
max: number;
|
||
|
|
step: number;
|
||
|
|
constructor(folder: Folder, name: string, initial: number, min: number, max: number, step?: number);
|
||
|
|
}
|
||
|
|
export declare class ButtonField extends Field<boolean> {
|
||
|
|
constructor(folder: Folder, name: string);
|
||
|
|
press(): void;
|
||
|
|
}
|