• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1interface KnockoutObservableBase<T> {
2    peek(): T;
3    (): T;
4    (value: T): void;
5}
6
7interface KnockoutObservable<T> extends KnockoutObservableBase<T> {
8    equalityComparer(a: T, b: T): boolean;
9    valueHasMutated(): void;
10    valueWillMutate(): void;
11}
12
13interface KnockoutObservableArray<T> extends KnockoutObservable<T[]> {
14    indexOf(searchElement: T, fromIndex?: number): number;
15    slice(start: number, end?: number): T[];
16    splice(start: number, deleteCount?: number, ...items: T[]): T[];
17    pop(): T;
18    push(...items: T[]): void;
19    shift(): T;
20    unshift(...items: T[]): number;
21    reverse(): T[];
22    sort(compareFunction?: (a: T, b: T) => number): void;
23    replace(oldItem: T, newItem: T): void;
24    remove(item: T): T[];
25    removeAll(items?: T[]): T[];
26    destroy(item: T): void;
27    destroyAll(items?: T[]): void;
28}
29
30interface KnockoutObservableArrayStatic {
31    fn: KnockoutObservableArray<any>;
32
33    <T>(value?: T[]): KnockoutObservableArray<T>;
34}
35
36declare module ko {
37    export var observableArray: KnockoutObservableArrayStatic;
38}
39
40module Portal.Controls.Validators {
41
42    export class Validator<TValue> {
43        private _subscription;
44        public message: KnockoutObservable<string>;
45        public validationState: KnockoutObservable<number>;
46        public validate: KnockoutObservable<TValue>;
47        constructor(message?: string) { }
48        public destroy(): void { }
49        public _validate(value: TValue): number {return 0 }
50    }
51}
52
53module PortalFx.ViewModels.Controls.Validators {
54
55    export class Validator<TValue> extends Portal.Controls.Validators.Validator<TValue> {
56
57        constructor(message?: string) {
58            super(message);
59        }
60    }
61
62}
63
64interface Contract<TValue> {
65
66    validators: KnockoutObservableArray<PortalFx.ViewModels.Controls.Validators.Validator<TValue>>;
67}
68
69
70class ViewModel<TValue> implements Contract<TValue> {
71
72    public validators: KnockoutObservableArray<PortalFx.ViewModels.Controls.Validators.Validator<TValue>> = ko.observableArray<PortalFx.ViewModels.Controls.Validators.Validator<TValue>>();
73}
74
75