src/app/core/entity-list/EntityListConfig.ts

Index

Properties

Properties

columnGroups
columnGroups: ColumnGroupsConfig
Type : ColumnGroupsConfig
Optional

Optional config for which columns are displayed. By default, all columns are shown

columns
columns: (FormFieldConfig | string)[]
Type : (FormFieldConfig | string)[]
Optional

Custom overwrites or additional columns to be displayed in the table.

If any special columns aside from the entity's fields are needed, add them here. Fields of the entity type are available automatically.

dataSource
dataSource: DataSourceType
Type : DataSourceType
Optional

Select what kind of data source is used for the table. (optional) default is "paginated" in online-only session and "in-memory" otherwise see data-source-factory.service.ts

defaultSort
defaultSort: Sort
Type : Sort
Optional

Optional initial sort order. Default is to sort by the first column.

entityType
entityType: string
Type : string
Optional

Select which entities should be displayed in the table (optional) This is only used and necessary if EntityListComponent is used directly in config

filters
filters: FilterConfig[]
Type : FilterConfig[]
Optional

Optional config for available filters. Default is no filters.

title
title: string
Type : string
Optional

Title that is shown on top of the component

import { FilterSelectionOption } from "../filter/filters/filters";
import { FormFieldConfig } from "../common-components/entity-form/FormConfig";
import { Sort } from "@angular/material/sort";
import { unitOfTime } from "moment";
import { TranslatableText } from "../config/multi-lingual-config";
import { DataSourceType } from "#src/app/core/common-components/entities-table/data-source/available-data-sources";

export interface EntityListConfig {
  /**
   * Title that is shown on top of the component
   */
  title?: string;

  /**
   * Select which entities should be displayed in the table
   * (optional) This is only used and necessary if EntityListComponent is used directly in config
   */
  entityType?: string;

  /**
   * Select what kind of data source is used for the table.
   * (optional) default is "paginated" in online-only session and "in-memory" otherwise
   * see `data-source-factory.service.ts`
   */
  dataSource?: DataSourceType;

  /**
   * Custom overwrites or additional columns to be displayed in the table.
   *
   * If any special columns aside from the entity's fields are needed, add them here.
   * Fields of the entity type are available automatically.
   */
  columns?: (FormFieldConfig | string)[];

  /**
   * Optional config for which columns are displayed.
   * By default, all columns are shown
   */
  columnGroups?: ColumnGroupsConfig;

  /**
   * Optional config for available filters.
   * Default is no filters.
   */
  filters?: FilterConfig[];

  /**
   * Optional initial sort order.
   * Default is to sort by the first column.
   */
  defaultSort?: Sort;
}

export interface ColumnGroupsConfig {
  /**
   * The groups of columns the user can switch between (shown as tabs).
   *
   * The first group is selected initially.
   * On a small screen (mobile), the group with the fewest columns is selected initially instead
   * (the first of them if several have the same number of columns).
   */
  groups: GroupConfig[];
}

export interface GroupConfig {
  name: TranslatableText;
  columns: string[];
}

export type FilterConfig<T = any> =
  | BasicFilterConfig
  | BooleanFilterConfig
  | PrebuiltFilterConfig<T>
  | ConfigurableEnumFilterConfig<T>;

export interface BasicFilterConfig {
  id: string;
  type?: string;
  default?: string;
  label?: string;
  singleSelectOnly?: boolean;
}

export interface BooleanFilterConfig extends BasicFilterConfig {
  true: string;
  false: string;
}

export interface PrebuiltFilterConfig<T> extends BasicFilterConfig {
  options: FilterSelectionOption<T>[];
}

export interface DateRangeFilterConfig extends BasicFilterConfig {
  options: DateRangeFilterConfigOption[];
}

export interface DateRangeFilterConfigOption {
  startOffsets?: {
    amount: number;
    unit: unitOfTime.Base | unitOfTime._quarter;
  }[];
  endOffsets?: {
    amount: number;
    unit: unitOfTime.Base | unitOfTime._quarter;
  }[];
  label: string;
}

export interface ConfigurableEnumFilterConfig<T> extends BasicFilterConfig {
  enumId: string;
}

results matching ""

    No results matching ""