diff --git a/src/@optimizely/forms-sdk/src/models/elements/Textarea.ts b/src/@optimizely/forms-sdk/src/models/elements/Textarea.ts index 994cd0d..f0ac832 100644 --- a/src/@optimizely/forms-sdk/src/models/elements/Textarea.ts +++ b/src/@optimizely/forms-sdk/src/models/elements/Textarea.ts @@ -7,6 +7,5 @@ export interface Textarea extends InputElementBase { } export interface TextareaProperties extends InputElementBaseProperties{ - forms_ExternalSystemsFieldMappings: string[]; autoComplete: string; } diff --git a/src/@optimizely/forms-sdk/src/models/elements/base/ValidatableElementBase.ts b/src/@optimizely/forms-sdk/src/models/elements/base/ValidatableElementBase.ts index 6d1a25a..03b322f 100644 --- a/src/@optimizely/forms-sdk/src/models/elements/base/ValidatableElementBase.ts +++ b/src/@optimizely/forms-sdk/src/models/elements/base/ValidatableElementBase.ts @@ -1,4 +1,4 @@ -import { Validators } from "../../validators/Validators"; +import { ValidatorBase } from "../../validators/base/"; import { FormElementBase, FormElementPropertiesBase } from "./FormElementBase"; /** @@ -11,6 +11,6 @@ export interface ValidatableElementBase extends FormElementBase { } export interface ValidatableElementBaseProperties extends FormElementPropertiesBase { - validators: Validators[] + validators: ValidatorBase[] validatorMessages: string } \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/AllowedExtensionsValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/AllowedExtensionsValidator.ts new file mode 100644 index 0000000..3f618bc --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/AllowedExtensionsValidator.ts @@ -0,0 +1,9 @@ +import { InternalElementValidatorBase, ValidatorModelBase } from "./base"; + +export interface AllowedExtensionsValidator extends InternalElementValidatorBase{ + model: AllowedExtensionsValidatorModel +} + +export interface AllowedExtensionsValidatorModel extends ValidatorModelBase { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/CaptchaValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/CaptchaValidator.ts new file mode 100644 index 0000000..7702552 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/CaptchaValidator.ts @@ -0,0 +1,5 @@ +import { InternalElementValidatorBase } from "./base"; + +export interface CaptchaValidator extends InternalElementValidatorBase { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/DateDDMMYYYYValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/DateDDMMYYYYValidator.ts new file mode 100644 index 0000000..97c5838 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/DateDDMMYYYYValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidator } from "./RegularExpressionValidator"; + +export interface DateDDMMYYYYValidator extends RegularExpressionValidator { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/DateMMDDYYYYValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/DateMMDDYYYYValidator.ts new file mode 100644 index 0000000..59028ea --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/DateMMDDYYYYValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidator } from "./RegularExpressionValidator"; + +export interface DateMMDDYYYYValidator extends RegularExpressionValidator { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/DateYYYYMMDDValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/DateYYYYMMDDValidator.ts new file mode 100644 index 0000000..5c09567 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/DateYYYYMMDDValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidator } from "./RegularExpressionValidator"; + +export interface DateYYYYMMDDValidator extends RegularExpressionValidator { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/EmailValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/EmailValidator.ts new file mode 100644 index 0000000..6836e05 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/EmailValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidator } from "./RegularExpressionValidator"; + +export interface EmailValidator extends RegularExpressionValidator{ + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/IntegerValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/IntegerValidator.ts new file mode 100644 index 0000000..e625775 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/IntegerValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidator } from "./RegularExpressionValidator"; + +export interface IntegerValidator extends RegularExpressionValidator { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/MaxFileSizeValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/MaxFileSizeValidator.ts new file mode 100644 index 0000000..c3cb16d --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/MaxFileSizeValidator.ts @@ -0,0 +1,9 @@ +import { InternalElementValidatorBase, ValidatorModelBase } from "./base"; + +export interface MaxFileSizeValidator extends InternalElementValidatorBase { + model: MaxFileSizeValidationModel +} + +export interface MaxFileSizeValidationModel extends ValidatorModelBase { + sizeInBytes: number +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/NumericValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/NumericValidator.ts new file mode 100644 index 0000000..c4acc1d --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/NumericValidator.ts @@ -0,0 +1,5 @@ +import { ElementValidatorBase } from "./base"; + +export interface NumericValidator extends ElementValidatorBase { + isValidNumber: boolean +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/PositiveIntegerValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/PositiveIntegerValidator.ts new file mode 100644 index 0000000..154c3a1 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/PositiveIntegerValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidatorBase } from "./base"; + +export interface PositiveIntegerValidator extends RegularExpressionValidatorBase { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/RegularExpressionValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/RegularExpressionValidator.ts new file mode 100644 index 0000000..dbf605a --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/RegularExpressionValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidatorBase } from "./base"; + +export interface RegularExpressionValidator extends RegularExpressionValidatorBase{ +} + diff --git a/src/@optimizely/forms-sdk/src/models/validators/RequiredValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/RequiredValidator.ts new file mode 100644 index 0000000..7f49184 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/RequiredValidator.ts @@ -0,0 +1,5 @@ +import { ElementValidatorBase } from "./base"; + +export interface RequiredValidator extends ElementValidatorBase { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/UrlValidator.ts b/src/@optimizely/forms-sdk/src/models/validators/UrlValidator.ts new file mode 100644 index 0000000..797cd5f --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/UrlValidator.ts @@ -0,0 +1,5 @@ +import { RegularExpressionValidatorBase } from "./base"; + +export interface UrlValidator extends RegularExpressionValidatorBase { + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/Validators.ts b/src/@optimizely/forms-sdk/src/models/validators/Validators.ts deleted file mode 100644 index 765d66f..0000000 --- a/src/@optimizely/forms-sdk/src/models/validators/Validators.ts +++ /dev/null @@ -1,14 +0,0 @@ -/** -* Validator for validating input entered into the element -*/ -export interface Validators { - type: string - description: string - model: ValidatorsModel -} - -export interface ValidatorsModel { - message: string - validationCssClass: string - additionalAttributes: any -} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/base/ElementValidatorBase.ts b/src/@optimizely/forms-sdk/src/models/validators/base/ElementValidatorBase.ts new file mode 100644 index 0000000..12af6c1 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/base/ElementValidatorBase.ts @@ -0,0 +1,4 @@ +export interface ElementValidatorBase { + validationOrder: number, + description: string +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/base/InternalElementValidatorBase.ts b/src/@optimizely/forms-sdk/src/models/validators/base/InternalElementValidatorBase.ts new file mode 100644 index 0000000..8dde85d --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/base/InternalElementValidatorBase.ts @@ -0,0 +1,5 @@ +import { ElementValidatorBase } from "./ElementValidatorBase"; + +export interface InternalElementValidatorBase extends ElementValidatorBase{ + +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/base/RegularExpressionValidatorBase.ts b/src/@optimizely/forms-sdk/src/models/validators/base/RegularExpressionValidatorBase.ts new file mode 100644 index 0000000..4ac255a --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/base/RegularExpressionValidatorBase.ts @@ -0,0 +1,11 @@ +import { ElementValidatorBase } from "./ElementValidatorBase"; +import { ValidatorModelBase } from "./ValidatorsBase"; + +export interface RegularExpressionValidatorBase extends ElementValidatorBase{ + model: RegularExpressionValidatorModel +} + +export interface RegularExpressionValidatorModel extends ValidatorModelBase { + jsPattern: string, + dotNetPattern: string +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/base/ValidatorsBase.ts b/src/@optimizely/forms-sdk/src/models/validators/base/ValidatorsBase.ts new file mode 100644 index 0000000..51020c7 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/base/ValidatorsBase.ts @@ -0,0 +1,14 @@ +/** +* Base class for validators +*/ +export interface ValidatorBase { + type: string + description: string + model: ValidatorModelBase +} + +export interface ValidatorModelBase { + message: string + validationCssClass: string + additionalAttributes: any +} \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/base/index.ts b/src/@optimizely/forms-sdk/src/models/validators/base/index.ts new file mode 100644 index 0000000..6d17974 --- /dev/null +++ b/src/@optimizely/forms-sdk/src/models/validators/base/index.ts @@ -0,0 +1,4 @@ +export * from "./ValidatorsBase"; +export * from "./InternalElementValidatorBase"; +export * from "./RegularExpressionValidatorBase"; +export * from "./ElementValidatorBase"; \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/index.ts b/src/@optimizely/forms-sdk/src/models/validators/index.ts index ca0deb7..f137bb2 100644 --- a/src/@optimizely/forms-sdk/src/models/validators/index.ts +++ b/src/@optimizely/forms-sdk/src/models/validators/index.ts @@ -1,3 +1,14 @@ -export * from "./Validators"; -export * from "./models/EmailValidatorModel"; -export * from "./models/RequiredValidatorModel"; \ No newline at end of file +export * from "./base" +export * from "./AllowedExtensionsValidator"; +export * from "./CaptchaValidator"; +export * from "./DateDDMMYYYYValidator"; +export * from "./DateMMDDYYYYValidator"; +export * from "./DateYYYYMMDDValidator"; +export * from "./EmailValidator"; +export * from "./IntegerValidator"; +export * from "./MaxFileSizeValidator"; +export * from "./NumericValidator"; +export * from "./PositiveIntegerValidator" +export * from "./RegularExpressionValidator"; +export * from "./RequiredValidator"; +export * from "./UrlValidator"; \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/models/EmailValidatorModel.ts b/src/@optimizely/forms-sdk/src/models/validators/models/EmailValidatorModel.ts deleted file mode 100644 index a535538..0000000 --- a/src/@optimizely/forms-sdk/src/models/validators/models/EmailValidatorModel.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { ValidatorsModel } from "../Validators" - -/** - * Specialized form validator used to validate email addresses entered by user - */ -interface EmailValidator extends ValidatorsModel { - jsPattern: string - dotnetPattern: string -} - -export default EmailValidator \ No newline at end of file diff --git a/src/@optimizely/forms-sdk/src/models/validators/models/RequiredValidatorModel.ts b/src/@optimizely/forms-sdk/src/models/validators/models/RequiredValidatorModel.ts deleted file mode 100644 index 22cc19e..0000000 --- a/src/@optimizely/forms-sdk/src/models/validators/models/RequiredValidatorModel.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ValidatorsModel } from "../Validators" - -/** - * Specialized form validator used to validate required field - */ -interface RequiredValidator extends ValidatorsModel { - additionalAttributes: { - required: string - ariaRequired: boolean - } -} - -export default RequiredValidator \ No newline at end of file