Getting started

Decorators

Components

Directive

Validators

To extend the GV class and create custom static methods that return functions, follow the steps outlined below. This approach allows users to add their own validators or controls tailored to their specific requirements.

Step 1: Create a new TypeScript file for CustomGV

In your project, create a new TypeScript file, e.g., customGVMethods.ts, to define the extended CustomGV class.

Step 2: Import necessary classes and types

In the customGVMethods.ts file, import the required classes and types from the library:

typescriptCopy code
import { GV, GVDefaultValidators, GVCore, ValidatorFn, GVErrMessage, AsyncValidatorFn } from 'path/to/library';

Step 3: Extend the GV class

Extend the GV class to create the CustomGV class:

typescriptCopy code
export class CustomGV extends GV {
  // Custom static methods will be added here
}

Step 4: Add Custom Static Methods

Now, you can add your custom static methods to the CustomGV class. Each custom static method should return a function that can be used as a validator or control.

For example, let's add a custom validator called customValidator:

typescriptCopy code
export class CustomGV extends GV {
  // Existing custom static methods, if any...

  static customValidator(msg?: string): Function {
    return GV.addControl(GVDefaultValidators.required(), {
      validator: 'custom',
      text: msg
    });
  }

  // Add more custom static methods as needed...
}

Step 5: Usage in Application Code