Skip to content

Query Builder Validation Specification

Teodosia Hristodorova edited this page Nov 22, 2024 · 4 revisions

Query Builder Validation Specification

Contents

  1. Overview
  2. User Stories
  3. Functionality
  4. Test Scenarios
  5. Accessibility
  6. Assumptions and Limitations
  7. References

Owned by

CodeX

Developer Name Teodosia Hristodorova

Designer Name

Requires approval from

  • Radoslav Karaivanov | Date:
  • Galina Edinakova | Date:

Signed off by

Revision History

Version Users Date Notes
1 Teodosia Hristodorova 19/11/2024 Initial Draft

Objectives

igxQueryBuilder should allow validating user input when editing expressions. Should be able to set basic validators to the expression of type 'string', 'number', 'date', 'time' and 'dateTime'.

Should show visual indicators (like error messages, error styles, etc.) when an expression enters an invalid state.

Should have the option to prevent commiting the expression in case of invalid input.

Acceptance criteria

  1. Should allow defining validators collection in the Query Builder fields array. For example:
 this.fieldsEntityA = [
            { field: 'Id', dataType: 'number', validators: [IgxFieldValidators.Min(3), IgxFieldValidators.Max(5)] },
            { field: 'Name', dataType: 'string', validators: [IgxFieldValidators.MinLength(3), IgxFieldValidators.MaxLength(5)] },
            { field: 'Date created', dataType: 'date', validators: [IgxFieldValidators.MinDate(new Date())] }
        ];

These should then be used for expression validation.

Developer stories:

  • Story 1: As a developer, I want to be able to set basic validators to the Query Builder fields.
  • Story 2: As a developer, I want to be able to prevent users from committing the expression when there are errors.

End-user stories:

  • Story 1: As an end-user, I want to be notified when I enter an invalid value so that I can fix it.

IgxFieldValidators

IgxFieldValidators exposes the following validation methods:

Name Description Parameters Returns
Required Marks the input of any type as required None IFieldValidator
Min Sets min value of input of type number min: number IFieldValidator
Max Sets max value of input of type number max: number IFieldValidator
MinLength Sets min length of input of type string length: number IFieldValidator
MaxLength Sets max length of input of type string length: number IFieldValidator
MinDate Sets min date to the calendar of input of type date, time and dateTime date: Date IFieldValidator
MaxDate Sets max date to the calendar of input of type date, time and dateTime date: Date IFieldValidator
Pattern Sets pattern to the inputs of type string pattern: string | RegExp IFieldValidator

Related public interfaces are as follows:

export interface IFieldValidator {
    type: string,
    value?: any
}

Validity is updated when editing expressions via the UI.

3.2. Developer Experience

3.2.1 Configuration

  • For expressions with field of type string and number you can apply all validators exposed for the native input i.e. required, min, max, minlength, maxlength, pattern.
  • For expression with field of type date, time and dateTime you can set minDate and maxDate which would set the corresponding properties in the calender, so all dates outside of this range would be disabled.

3.3. Globalization/Localization

3.4. Keyboard Navigation

Keys Description

3.5. API

Automation

Basic
  • Should apply 'string' column validators properly and calculate 'canCommit' based on it.
  • Should apply 'number' column validators properly and calculate 'canCommit' based on it.
  • Should apply 'date' column validators properly.

ARIA Support

Assumptions Limitation Notes
Clone this wiki locally