@mantlebee/ts-data
    Preparing search index...

    Class FilterExtensionWithFixedFilters<TItem>

    FilterExtension that always sends a fixed expression too: alone when the user has no filters, otherwise grouped with the user filters through groupsLogic (default FilterLogics.and).

    // Only the active users, whatever the user filters.
    const filtering = new FilterExtensionWithFixedFilters<User>({
    filters: [{ field: "active", operator: FilterOperators.equal, value: true }],
    logic: FilterLogics.and,
    });
    // payload.filters without user filters: the fixed expression itself.
    filtering.addFilter({ field: "age", operator: FilterOperators.greaterThanOrEqual, value: 18 });
    // payload.filters: { groups: [fixed, { filters: [age >= 18], logic: "and" }], logic: "and" }

    Type Parameters

    • TItem = Any

      Type of the items.

    Hierarchy (View Summary)

    Implements

    Index
    _changeDelay: number
    _eventBus: EventBus<FilterExtensionEvents<TItem>>

    Bus used to register handlers and to raise the events.

    _filters: List<Filter<TItem>> = []
    _fixedFilters: FiltersExpression<TItem>
    _groupsLogic: FilterLogics
    _logic: FilterLogics = FilterLogics.and
    • Registers a handler for an event.

      Type Parameters

      • TKey extends string

        Name of the event to listen to.

      Parameters

      Returns IDisposable

      a subscription; dispose it to remove this single handler.