Migrate table to cue model (#61852)

* WIP table cue model

* WIP table types migration

* refactor

* WIP table cue

* docs

* veneer fix, docs

* docs
This commit is contained in:
Victor Marin
2023-03-01 17:48:36 +02:00
committed by GitHub
parent e1bc3fad83
commit a91e0a49c9
19 changed files with 216 additions and 72 deletions

View File

@@ -631,13 +631,35 @@ export enum TableCellBackgroundDisplayMode {
}
/**
* TODO docs
* Sort by field state
*/
export interface TableSortByFieldState {
/**
* Flag used to indicate descending sort order
*/
desc?: boolean;
/**
* Sets the display name of the field to sort by
*/
displayName: string;
}
/**
* Footer options
*/
export interface TableFooterOptions {
countRows?: boolean;
enablePagination?: boolean;
fields?: Array<string>;
reducer: Array<string>;
show: boolean;
}
export const defaultTableFooterOptions: Partial<TableFooterOptions> = {
fields: [],
reducer: [],
};
/**
* Auto mode table cell options
*/

View File

@@ -11,12 +11,23 @@ TableCellDisplayMode: "auto" | "color-text" | "color-background" | "color-backgr
// or a gradient.
TableCellBackgroundDisplayMode: "basic" | "gradient" @cuetsy(kind="enum",memberNames="Basic|Gradient")
// TODO docs
// Sort by field state
TableSortByFieldState: {
// Sets the display name of the field to sort by
displayName: string
// Flag used to indicate descending sort order
desc?: bool
} @cuetsy(kind="interface")
// Footer options
TableFooterOptions: {
show: bool
reducer: [...string] // actually 1 value
fields?: [...string]
enablePagination?: bool
countRows?: bool
} @cuetsy(kind="interface")
// Auto mode table cell options
TableAutoCellOptions: {
type: TableCellDisplayMode & "auto"

View File

@@ -23,3 +23,12 @@ export interface TextDimensionConfig extends BaseDimensionConfig<string>, Omit<r
export interface ColorDimensionConfig extends BaseDimensionConfig<string>, Omit<raw.ColorDimensionConfig, 'fixed'> {}
export * from '../common/common.gen';
// TODO remove when https://github.com/grafana/cuetsy/issues/74 is fixed
export const defaultTableFieldOptions: raw.TableFieldOptions = {
align: 'auto',
inspect: false,
cellOptions: {
type: raw.TableCellDisplayMode.Auto,
},
};