aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/odlux/framework/src/components/material-table/columnModel.ts
blob: 42a0bb4d800597b105205ab72bbe7cf4f4c98e53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import * as React from 'react';

export enum ColumnType {
  text,
  numeric,
  boolean,
  custom
}

type CustomControl<TData> = {
  className?: string;
  style?: React.CSSProperties;
  rowData: TData;
}

export type ColumnModel<TData> = {
  title?: string;
  disablePadding?: boolean;
  width?: string | number;
  className?: string;
  style?: React.CSSProperties;
  align?: 'inherit' | 'left' | 'center' | 'right' | 'justify';
  disableSorting?: boolean;
  disableFilter?: boolean;
} & ({
  property: string;
  type: ColumnType.custom;
  customControl: React.ComponentType<CustomControl<TData>>;
} | {
  property: keyof TData;
  type: ColumnType.boolean;
  labels?: { "true": string, "false": string };
} | {
    property: keyof TData;
    type?: ColumnType.numeric | ColumnType.text;
});