Columns

<T> represents the object's shape coming from the data source. <R> represents the column data type: string, number, Date, or boolean.

DikeColumnDef

abstract class DikeColumnDef {
  slotId: string | null;
  belongToGroup: string | null;

  columnId: string | null;

  get fieldName(): string {
    return this._fieldName;
  }
  protected _fieldName: string;

  get headerText(): string {
    return this._headerText;
  }
  protected _headerText: string;

  order: number;

  headerTooltip: string;
  resizable: boolean;
  draggable: boolean;
  visible: boolean;
  displayMenu: boolean;

  panel: DikeGridPanel;

  displayOn: DisplayStatus;

  constructor(fieldName: string, headerText: string);
  assign(column: DikeColumnDef): this;
}

DikeGroupColumnDef

class DikeGroupColumnDef extends DikeColumnDef {
  children: DikeColumnDef[];
  displayStatus: DisplayStatus;

  constructor(fieldName: string, headerText: string);
  assign(column: DikeGroupColumnDef): this;
}

DikeDataColumnDef<T, R>

abstract class DikeDataColumnDef<T extends object, R extends string | number | Date | boolean> extends DikeColumnDef {
  get dataType(): DikeColumnDataType {
    return this._dataType;
  }
  protected _dataType: DikeColumnDataType;

  width: number;
  minWidth: number;
  maxWidth: number;
  contentAlign: ColumnAlignment;

  sortable: boolean;
  filterable: boolean;
  editable: boolean;
  groupable: boolean;

  abstract get filter(): DikeFilter[];
  abstract set filter(value: DikeFilter[]);
  
  abstract get customFilterConditions(): CustomFilterConditionInstance<T>;
  abstract set customFilterConditions(value : CustomFilterConditionInstance<T>);

  editionSettings: EditionFieldSettings;
  editionTemplate: Observable<TemplateRef<any> | null> | TemplateRef<any> | null;
  displayTemplate: Observable<TemplateRef<any> | null> | TemplateRef<any> | null;

  constructor(fieldName: string, headerText: string, dataType: DikeColumnDataType);
  assign(column: DikeDataColumnDef<T, R>): this;
  static getDataColumnDefInstance<T extends object>(fieldName: string, headerText: string, dataType: DikeColumnDataType): DikeDataColumnDef<T, string | number | Date | boolean>;

  abstract getValue: GetterFn<T, R>;
  abstract setValue: SetterFn<T, R>;
}

DikeTextColumnDef<T>

class DikeTextColumnDef<T extends object> extends DikeDataColumnDef<T, string> {
  constructor(fieldName: string, headerText: string);
  
  get filter(): DikeTextFilter[] | DikeTextCaseFilter[];
  set filter(value: DikeTextFilter[] | DikeTextCaseFilter[]);
  
  get customFilterConditions(): CustomTextCaseFilterCondition<T> | CustomMultipleTextFilterCondition<T>;
  set customFilterConditions(value : CustomTextCaseFilterCondition<T> | CustomMultipleTextFilterCondition<T>);

  getValue: GetterFn<T, string | null | undefined> = (entry: T): string => {
    return ((entry as { [key in keyof T]: T[key] })[this.fieldName]) as string;
  };

  setValue: SetterFn<T, string> = (entry: T, value: string): void => {
    (entry as { [key in keyof T]: T[key] })[this.fieldName] = value;
  };
}

DikeNumericColumnDef<T>

class DikeNumericColumnDef<T extends object> extends DikeDataColumnDef<T, number> {
  constructor(fieldName: string, headerText: string);

  get filter(): DikeNumericFilter[];
  set filter(value: DikeNumericFilter[]);
  
  get customFilterConditions(): CustomNumericFilterCondition<T> | CustomMultipleNumericFilterCondition<T>;
  set customFilterConditions(value : CustomNumericFilterCondition<T> | CustomMultipleNumericFilterCondition<T>);
  
  getValue: GetterFn<T, number> = (entry: T): number => {
    return ((entry as { [key in keyof T]: T[key] })[this.fieldName]) as number;
  };

  setValue: SetterFn<T, number> = (entry: T, value: number): void => {
    (entry as { [key in keyof T]: T[key] })[this.fieldName] = value;
  };
}

DikeDateColumnDef<T>

class DikeDateColumnDef<T extends object> extends DikeDataColumnDef<T, string | number | Date> {
  constructor(fieldName: string, headerText: string);

  get filter(): DikeDateFilter[];
  set filter(value: DikeDateFilter[]);
  
  get customFilterConditions(): CustomDateFilterCondition<T>;
  set customFilterConditions(value : CustomDateFilterCondition<T>);

  getValue: GetterFn<T, string | number | Date> = (entry: T): string | number | Date => {
    return ((entry as { [key in keyof T]: T[key] })[this.fieldName]) as string | number | Date;
  };

  setValue: SetterFn<T, string | number | Date> = (entry: T, value: string | number | Date): void => {
    (entry as { [key in keyof T]: T[key] })[this.fieldName] = value;
  };
}

DikeBinaryColumnDef<T>

class DikeBinaryColumnDef<T extends object> extends DikeDataColumnDef<T, string | number | boolean> {
  constructor(fieldName: string, headerText: string);

  get filter(): DikeBinaryFilter[];
  set filter(value: DikeBinaryFilter[]);
  
  get customFilterConditions(): CustomBinaryFilterCondition<T>;
  set customFilterConditions(value : CustomBinaryFilterCondition<T>);
  
  getValue: GetterFn<T, string | number | boolean> = (entry: T): string | number | boolean => {
    return ((entry as { [key in keyof T]: T[key] })[this.fieldName]) as string | number | boolean;
  };

  setValue: SetterFn<T, string | number | boolean> = (entry: T, value: string | number | boolean): void => {
    (entry as { [key in keyof T]: T[key] })[this.fieldName] = value;
  };
}

Last updated