dotvvm-types 4.0.8 → 4.1.0-preview06-final
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +28 -3
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -150,7 +150,6 @@ declare module "utils/evaluator" {
|
|
|
150
150
|
*/
|
|
151
151
|
export function traverseContext(context: any, path: string): any;
|
|
152
152
|
export function findPathToChildObject(vm: any, child: any, path: string): string | null;
|
|
153
|
-
export function evaluateOnViewModel(context: any, expression: string): any;
|
|
154
153
|
export function getDataSourceItems(viewModel: any): Array<KnockoutObservable<any>>;
|
|
155
154
|
export function wrapObservable(func: () => any, isArray?: boolean): KnockoutComputed<any>;
|
|
156
155
|
export const unwrapComputedProperty: (obs: any) => any;
|
|
@@ -563,22 +562,45 @@ declare module "validation/actions" {
|
|
|
563
562
|
declare module "validation/validation" {
|
|
564
563
|
import { ValidationError } from "validation/error";
|
|
565
564
|
import { DotvvmEvent } from "events";
|
|
566
|
-
type DotvvmValidationErrorsChangedEventArgs = PostbackOptions & {
|
|
565
|
+
type DotvvmValidationErrorsChangedEventArgs = Partial<PostbackOptions> & {
|
|
567
566
|
readonly allErrors: ValidationError[];
|
|
568
567
|
};
|
|
569
568
|
export const events: {
|
|
570
569
|
validationErrorsChanged: DotvvmEvent<DotvvmValidationErrorsChangedEventArgs>;
|
|
571
570
|
};
|
|
572
571
|
export const globalValidationObject: {
|
|
572
|
+
/** Dictionary of client-side validation rules. Add new items to this object if you want to add support for new validation rules */
|
|
573
573
|
rules: {
|
|
574
574
|
[name: string]: import("validation/validators").DotvvmValidator;
|
|
575
575
|
};
|
|
576
|
+
/** List of all currently active errors */
|
|
576
577
|
errors: ValidationError[];
|
|
577
578
|
events: {
|
|
578
579
|
validationErrorsChanged: DotvvmEvent<DotvvmValidationErrorsChangedEventArgs>;
|
|
579
580
|
};
|
|
581
|
+
/** Add the specified list of validation errors. `dotvvm.validation.addErrors([ { errorMessage: "test error", propertyPath: "/LoginForm/Name" } ])` */
|
|
582
|
+
addErrors: typeof addErrors;
|
|
583
|
+
/** Removes errors from the specified properties.
|
|
584
|
+
* The errors are removed recursively, so calling `dotvvm.validation.removeErrors("/")` removes all errors in the page,
|
|
585
|
+
* `dotvvm.validation.removeErrors("/Detail")` removes all errors from the object in property root.Detail */
|
|
586
|
+
removeErrors: typeof removeErrors;
|
|
580
587
|
};
|
|
581
588
|
export function init(): void;
|
|
589
|
+
export type ValidationErrorDescriptor = {
|
|
590
|
+
/** Error to be displayed to the user */
|
|
591
|
+
errorMessage: string;
|
|
592
|
+
/** Path in the view model to the annotated property, for example `/LoginPage/Name` */
|
|
593
|
+
propertyPath: string;
|
|
594
|
+
};
|
|
595
|
+
export type AddErrorsOptions = {
|
|
596
|
+
/** Root object from which are the property paths resolved. By default it's the root view model of the page */
|
|
597
|
+
root?: KnockoutObservable<any> | any;
|
|
598
|
+
/** When set to false, the validationErrorsChanged is not triggered. By default it's true -> the error is triggered.
|
|
599
|
+
* The validationErrorsChanged event controls the `Validator`s in the DotHTML page, so when it's not triggered, the change won't be visible. */
|
|
600
|
+
triggerErrorsChanged?: false;
|
|
601
|
+
};
|
|
602
|
+
export function removeErrors(...paths: string[]): void;
|
|
603
|
+
export function addErrors(errors: ValidationErrorDescriptor[], options?: AddErrorsOptions): void;
|
|
582
604
|
/**
|
|
583
605
|
* Adds validation errors from the server to the appropriate arrays
|
|
584
606
|
*/
|
|
@@ -694,6 +716,7 @@ declare module "utils/dateTimeHelper" {
|
|
|
694
716
|
declare module "dotvvm-root" {
|
|
695
717
|
import { getCulture } from "dotvvm-base";
|
|
696
718
|
import * as events from "events";
|
|
719
|
+
import * as validation from "validation/validation";
|
|
697
720
|
import { postBack } from "postback/postback";
|
|
698
721
|
import { serialize } from "serialization/serialize";
|
|
699
722
|
import { serializeDate, parseDate } from "serialization/date";
|
|
@@ -746,10 +769,12 @@ declare module "dotvvm-root" {
|
|
|
746
769
|
};
|
|
747
770
|
errors: import("validation/error").ValidationError[];
|
|
748
771
|
events: {
|
|
749
|
-
validationErrorsChanged: events.DotvvmEvent<PostbackOptions & {
|
|
772
|
+
validationErrorsChanged: events.DotvvmEvent<Partial<PostbackOptions> & {
|
|
750
773
|
readonly allErrors: import("validation/error").ValidationError[];
|
|
751
774
|
}>;
|
|
752
775
|
};
|
|
776
|
+
addErrors: typeof validation.addErrors;
|
|
777
|
+
removeErrors: typeof validation.removeErrors;
|
|
753
778
|
};
|
|
754
779
|
postBack: typeof postBack;
|
|
755
780
|
init: typeof init;
|