Type Parameters

Hierarchy

  • CollectionCustomizer

Constructors

Properties

addField: ((name: string, definition: ComputedDefinition<S, N>) => CollectionCustomizer<S, N>) = ...

Type declaration

    • (name: string, definition: ComputedDefinition<S, N>): CollectionCustomizer<S, N>
    • Add a new field on the collection.

      See

      Documentation Link

      Example

      .addField('fullName', {
      columnType: 'String',
      dependencies: ['firstName', 'lastName'],
      getValues: (records) => records.map(record => `${record.lastName} ${record.firstName}`),
      });

      Parameters

      • name: string

        the name of the field

      • definition: ComputedDefinition<S, N>

        The definition of the field

      Returns CollectionCustomizer<S, N>

name: string

Accessors

Methods

  • Add a new validator to the edition form of a given field

    See

    Documentation Link

    Example

    .addFieldValidation('firstName', 'LongerThan', 2);
    

    Parameters

    • name: Extract<keyof S[N]["plain"], string>

      The name of the field

    • operator: "Equal" | "NotEqual" | "LessThan" | "GreaterThan" | "LessThanOrEqual" | "GreaterThanOrEqual" | "Match" | "NotContains" | "NotIContains" | "LongerThan" | "ShorterThan" | "IncludesAll" | "IncludesNone" | "Today" | "Yesterday" | "PreviousMonth" | "PreviousQuarter" | "PreviousWeek" | "PreviousYear" | "PreviousMonthToDate" | "PreviousQuarterToDate" | "PreviousWeekToDate" | "PreviousXDaysToDate" | "PreviousXDays" | "PreviousYearToDate" | "Present" | "Blank" | "Missing" | "In" | "NotIn" | "StartsWith" | "EndsWith" | "Contains" | "IStartsWith" | "IEndsWith" | "IContains" | "Like" | "ILike" | "Before" | "After" | "AfterXHoursAgo" | "BeforeXHoursAgo" | "Future" | "Past"

      The validator that you wish to add

    • Optional value: unknown

      A configuration value that the validator may need

    Returns CollectionCustomizer<S, N>

  • Add a many to many relation to the collection

    See

    Documentation Link

    Example

    dvds.addManyToManyRelation('rentalsOfThisDvd', 'rentals', 'dvdRentals', {
    originKey: 'dvdId',
    foreignKey: 'rentalId'
    })

    Type Parameters

    • Foreign extends string

    • Through extends string

    Parameters

    • name: string

      name of the new relation

    • foreignCollection: Foreign

      name of the targeted collection

    • throughCollection: Through

      name of the intermediary collection

    • options: {
          foreignKey: Extract<keyof S[Through]["plain"], string>;
          foreignKeyTarget?: Extract<keyof S[Foreign]["plain"], string>;
          originKey: Extract<keyof S[Through]["plain"], string>;
          originKeyTarget?: Extract<keyof S[N]["plain"], string>;
      }

      extra information about the relation

      • foreignKey: Extract<keyof S[Through]["plain"], string>
      • Optional foreignKeyTarget?: Extract<keyof S[Foreign]["plain"], string>
      • originKey: Extract<keyof S[Through]["plain"], string>
      • Optional originKeyTarget?: Extract<keyof S[N]["plain"], string>

    Returns CollectionCustomizer<S, N>

  • Add a many to one relation to the collection

    See

    Documentation Link

    Example

    books.addManyToOneRelation('myAuthor', 'persons', { foreignKey: 'authorId' })
    

    Type Parameters

    • T extends string

    Parameters

    • name: string

      name of the new relation

    • foreignCollection: T

      name of the targeted collection

    • options: {
          foreignKey: Extract<keyof S[N]["plain"], string>;
          foreignKeyTarget?: Extract<keyof S[T]["plain"], string>;
      }

      extra information about the relation

      • foreignKey: Extract<keyof S[N]["plain"], string>
      • Optional foreignKeyTarget?: Extract<keyof S[T]["plain"], string>

    Returns CollectionCustomizer<S, N>

  • Add a one to many relation to the collection

    See

    Documentation Link

    Example

    persons.addOneToManyRelation('writtenBooks', 'books', { originKey: 'authorId' })
    

    Type Parameters

    • T extends string

    Parameters

    • name: string

      name of the new relation

    • foreignCollection: T

      name of the targeted collection

    • options: {
          originKey: Extract<keyof S[T]["plain"], string>;
          originKeyTarget?: Extract<keyof S[N]["plain"], string>;
      }

      extra information about the relation

      • originKey: Extract<keyof S[T]["plain"], string>
      • Optional originKeyTarget?: Extract<keyof S[N]["plain"], string>

    Returns CollectionCustomizer<S, N>

  • Add a one to one relation to the collection

    See

    Documentation Link

    Example

    persons.addOneToOneRelation('bestFriend', 'persons', { originKey: 'bestFriendId' })
    

    Type Parameters

    • T extends string

    Parameters

    • name: string

      name of the new relation

    • foreignCollection: T

      name of the targeted collection

    • options: {
          originKey: Extract<keyof S[T]["plain"], string>;
          originKeyTarget?: Extract<keyof S[N]["plain"], string>;
      }

      extra information about the relation

      • originKey: Extract<keyof S[T]["plain"], string>
      • Optional originKeyTarget?: Extract<keyof S[N]["plain"], string>

    Returns CollectionCustomizer<S, N>

  • Enable filtering on a specific field with a specific operator using emulation. As for all the emulation method, the field filtering will be done in-memory.

    See

    Documentation Link

    Example

    .emulateFieldOperator('aField', 'In');
    

    Parameters

    • name: Extract<keyof S[N]["plain"], string>

      the name of the field to enable emulation on

    • operator: "Equal" | "NotEqual" | "LessThan" | "GreaterThan" | "LessThanOrEqual" | "GreaterThanOrEqual" | "Match" | "NotContains" | "NotIContains" | "LongerThan" | "ShorterThan" | "IncludesAll" | "IncludesNone" | "Today" | "Yesterday" | "PreviousMonth" | "PreviousQuarter" | "PreviousWeek" | "PreviousYear" | "PreviousMonthToDate" | "PreviousQuarterToDate" | "PreviousWeekToDate" | "PreviousXDaysToDate" | "PreviousXDays" | "PreviousYearToDate" | "Present" | "Blank" | "Missing" | "In" | "NotIn" | "StartsWith" | "EndsWith" | "Contains" | "IStartsWith" | "IEndsWith" | "IContains" | "Like" | "ILike" | "Before" | "After" | "AfterXHoursAgo" | "BeforeXHoursAgo" | "Future" | "Past"

      the operator to emulate

    Returns CollectionCustomizer<S, N>

  • Choose how binary data should be transported to the GUI. By default, all fields are transported as 'datauri', with the exception of primary and foreign keys.

    Using 'datauri' allows to use the FilePicker widget, while 'hex' is more suitable for short binary data (for instance binary uuids).

    Example

    .replaceFieldBinaryMode('avatar', 'datauri');
    

    Parameters

    • name: Extract<keyof S[N]["plain"], string>

      the name of the field

    • binaryMode: BinaryMode

      either 'datauri' or 'hex'

    Returns CollectionCustomizer<S, N>

  • Replace an implementation for a specific operator on a specific field. The operator replacement will be done by the datasource.

    See

    Documentation Link

    Example

    .replaceFieldOperator('fullName', 'Contains', (value) => {
    return {
    aggregator: 'Or',
    conditions: [{
    field: 'firstName',
    operator: 'Contains',
    value
    }, {
    field: 'lastName',
    operator: 'Contains',
    value
    }]
    }
    });

    Type Parameters

    • C extends string

    Parameters

    • name: C

      the name of the field to filter on

    • operator: "Equal" | "NotEqual" | "LessThan" | "GreaterThan" | "LessThanOrEqual" | "GreaterThanOrEqual" | "Match" | "NotContains" | "NotIContains" | "LongerThan" | "ShorterThan" | "IncludesAll" | "IncludesNone" | "Today" | "Yesterday" | "PreviousMonth" | "PreviousQuarter" | "PreviousWeek" | "PreviousYear" | "PreviousMonthToDate" | "PreviousQuarterToDate" | "PreviousWeekToDate" | "PreviousXDaysToDate" | "PreviousXDays" | "PreviousYearToDate" | "Present" | "Blank" | "Missing" | "In" | "NotIn" | "StartsWith" | "EndsWith" | "Contains" | "IStartsWith" | "IEndsWith" | "IContains" | "Like" | "ILike" | "Before" | "After" | "AfterXHoursAgo" | "BeforeXHoursAgo" | "Future" | "Past"

      the operator to replace

    • replacer: OperatorDefinition<S, N, C>

      the proposed implementation

    Returns CollectionCustomizer<S, N>