mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-25 11:11:46 +08:00
Knockout.validation support new Knockout definition (generics) and replace bool to boolean.
This commit is contained in:
+53
-56
@@ -5,66 +5,66 @@
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
interface KnockoutValidationGroupingOptions {
|
||||
deep?: bool;
|
||||
observable?: bool;
|
||||
interface KnockoutValidationGroupingOptions {
|
||||
deep?: boolean;
|
||||
observable?: boolean;
|
||||
}
|
||||
|
||||
interface KnockoutValidationConfiguration {
|
||||
registerExtenders?: bool;
|
||||
messagesOnModified?: bool;
|
||||
interface KnockoutValidationConfiguration {
|
||||
registerExtenders?: boolean;
|
||||
messagesOnModified?: boolean;
|
||||
messageTemplate?: string;
|
||||
insertMessages?: bool;
|
||||
parseInputAttributes?: bool;
|
||||
writeInputAttributes?: bool;
|
||||
decorateElement?: bool;
|
||||
insertMessages?: boolean;
|
||||
parseInputAttributes?: boolean;
|
||||
writeInputAttributes?: boolean;
|
||||
decorateElement?: boolean;
|
||||
errorClass?: string;
|
||||
errorElementClass?: string;
|
||||
errorMessageClass?: string;
|
||||
grouping?: KnockoutValidationGroupingOptions;
|
||||
grouping?: KnockoutValidationGroupingOptions;
|
||||
}
|
||||
|
||||
interface KnockoutValidationUtils {
|
||||
isArray(o: any): bool;
|
||||
isObject(o: any): bool;
|
||||
interface KnockoutValidationUtils {
|
||||
isArray(o: any): boolean;
|
||||
isObject(o: any): boolean;
|
||||
values(o: any): any[];
|
||||
getValue(o: any): any;
|
||||
hasAttribute(node: Element, attr: string): bool;
|
||||
isValidatable(o: any): bool;
|
||||
hasAttribute(node: Element, attr: string): boolean;
|
||||
isValidatable(o: any): boolean;
|
||||
insertAfter(node: Element, newNode: Element): void;
|
||||
newId(): number;
|
||||
getConfigOptions(element: Element): KnockoutValidationConfiguration;
|
||||
setDomData(node: Element, data: KnockoutValidationConfiguration): void;
|
||||
getDomData(node: Element): KnockoutValidationConfiguration;
|
||||
contextFor(node: Element): KnockoutValidationConfiguration;
|
||||
isEmptyVal(val: any): bool;
|
||||
isEmptyVal(val: any): boolean;
|
||||
}
|
||||
|
||||
interface KnockoutValidationAsyncCallbackArgs {
|
||||
isValid: bool;
|
||||
interface KnockoutValidationAsyncCallbackArgs {
|
||||
isValid: boolean;
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface KnockoutValidationAsyncCallback {
|
||||
(result: boolean): void;
|
||||
(result: KnockoutValidationAsyncCallbackArgs): void;
|
||||
}
|
||||
|
||||
interface KnockoutValidationRuleDefinition {
|
||||
message: string;
|
||||
validator(value: any, params: any): boolean;
|
||||
}
|
||||
|
||||
interface KnockoutValidationAsyncCallback {
|
||||
(result: bool): void;
|
||||
(result: KnockoutValidationAsyncCallbackArgs): void;
|
||||
interface KnockoutValidationAsyncRuleDefinition extends KnockoutValidationRuleDefinition {
|
||||
async: boolean;
|
||||
validator(value: any, params: any, callback: KnockoutValidationAsyncCallback): void;
|
||||
}
|
||||
|
||||
interface KnockoutValidationRuleDefinition {
|
||||
message: string;
|
||||
validator(value: any, params: any): bool;
|
||||
interface KnockoutValidationAnonymousRuleDefinition {
|
||||
validation: KnockoutValidationRuleDefinition;
|
||||
}
|
||||
|
||||
interface KnockoutValidationAsyncRuleDefinition extends KnockoutValidationRuleDefinition {
|
||||
async: bool;
|
||||
validator(value: any, params: any, callback: KnockoutValidationAsyncCallback): void;
|
||||
}
|
||||
|
||||
interface KnockoutValidationAnonymousRuleDefinition {
|
||||
validation: KnockoutValidationRuleDefinition;
|
||||
}
|
||||
|
||||
interface KnockoutValidationRuleDefinitions {
|
||||
interface KnockoutValidationRuleDefinitions {
|
||||
date: KnockoutValidationRuleDefinition;
|
||||
dateISO: KnockoutValidationRuleDefinition;
|
||||
digit: KnockoutValidationRuleDefinition;
|
||||
@@ -80,30 +80,30 @@ interface KnockoutValidationRuleDefinitions {
|
||||
phoneUS: KnockoutValidationRuleDefinition;
|
||||
required: KnockoutValidationRuleDefinition;
|
||||
step: KnockoutValidationRuleDefinition;
|
||||
unique: KnockoutValidationRuleDefinition;
|
||||
unique: KnockoutValidationRuleDefinition;
|
||||
}
|
||||
|
||||
interface KnockoutValidationRule {
|
||||
interface KnockoutValidationRule {
|
||||
rule: string;
|
||||
params: any;
|
||||
message?: string;
|
||||
condition?: () => bool;
|
||||
condition?: () => boolean;
|
||||
}
|
||||
|
||||
interface KnockoutValidationErrors {
|
||||
interface KnockoutValidationErrors {
|
||||
(): string[];
|
||||
showAllMessages(): void;
|
||||
showAllMessages(show: bool): void;
|
||||
showAllMessages(show: boolean): void;
|
||||
}
|
||||
|
||||
interface KnockoutValidationGroup {
|
||||
interface KnockoutValidationGroup {
|
||||
errors?: KnockoutValidationErrors;
|
||||
isValid?: () => bool;
|
||||
isAnyMessageShown?: () => bool;
|
||||
isValid?: () => boolean;
|
||||
isAnyMessageShown?: () => boolean;
|
||||
}
|
||||
|
||||
interface KnockoutValidationStatic {
|
||||
init(options?: KnockoutValidationConfiguration, force?: bool): void;
|
||||
interface KnockoutValidationStatic {
|
||||
init(options?: KnockoutValidationConfiguration, force?: boolean): void;
|
||||
configure(options: KnockoutValidationConfiguration): void;
|
||||
reset(): void;
|
||||
|
||||
@@ -111,11 +111,8 @@ interface KnockoutValidationStatic {
|
||||
|
||||
formatMessage(message: string, params: string): string;
|
||||
|
||||
addRule(observable: KnockoutObservableAny, rule: KnockoutValidationRule): KnockoutObservableAny;
|
||||
addRule(observable: KnockoutObservableString, rule: KnockoutValidationRule): KnockoutObservableString;
|
||||
addRule(observable: KnockoutObservableNumber, rule: KnockoutValidationRule): KnockoutObservableNumber;
|
||||
addRule(observable: KnockoutObservableBool, rule: KnockoutValidationRule): KnockoutObservableBool;
|
||||
addRule(observable: KnockoutObservableDate, rule: KnockoutValidationRule): KnockoutObservableDate;
|
||||
addRule<T>(observable: KnockoutObservable<T>, rule: KnockoutValidationRule): KnockoutObservable<T>;
|
||||
|
||||
addAnonymousRule(observable: KnockoutObservableBase, ruleObj: KnockoutValidationAnonymousRuleDefinition): void;
|
||||
|
||||
insertValidationMessage(element: Element): Element;
|
||||
@@ -128,18 +125,18 @@ interface KnockoutValidationStatic {
|
||||
utils: KnockoutValidationUtils;
|
||||
|
||||
localize(msgTranslations: any): void;
|
||||
validateObservable(observable: KnockoutObservableBase): bool;
|
||||
validateObservable(observable: KnockoutObservableBase): boolean;
|
||||
}
|
||||
|
||||
interface KnockoutStatic {
|
||||
interface KnockoutStatic {
|
||||
validation: KnockoutValidationStatic;
|
||||
validatedObservable(initialValue: any): KnockoutObservableBase;
|
||||
applyBindingsWithValidation(viewModel: any, rootNode?: any, options?: KnockoutValidationConfiguration): void;
|
||||
applyBindingsWithValidation(viewModel: any, rootNode?: any, options?: KnockoutValidationConfiguration): void;
|
||||
}
|
||||
|
||||
interface KnockoutSubscribableFunctions {
|
||||
interface KnockoutSubscribableFunctions {
|
||||
isValid: KnockoutComputed;
|
||||
isValidating: KnockoutObservableBool;
|
||||
rules: KnockoutObservableArray;
|
||||
isValidating: KnockoutObservable<boolean>;
|
||||
rules: KnockoutObservableArray;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user