import { renderers } from './renderer/renderers' ; import { toolbarDialogAddons , toolbarActions } from './ui/toolbar' ; import type { Column , Ranking , IGroupData , IGroupItem } from './model' ; import type { IDataProvider } from './provider' ; import type { ICellRendererFactory , ERenderMode } from './renderer' ; import type { IToolbarAction , IToolbarDialogAddon } from './ui' ; /**
 * custom height implementation logic
 */ export interface IDynamicHeight { /**
     * default height for a row for optimized styling
     */ defaultHeight : number ; param { IGroupItem | IGroupData } item returns { number } height ( item ) : number ; param { IGroupItem | IGroupData | null } item returns { number } padding ( item ) : number ; } export interface ILineUpFlags { default disableFrozenColumns : boolean ; default advancedRankingFeatures : boolean ; default advancedModelFeatures : boolean ; default advancedUIFeatures : boolean ; } export interface IToolbarLookup < T > { [ key ] : T ; } export interface ILivePreviewOptions { search : boolean ; filter : boolean ; vis : boolean ; sort : boolean ; group : boolean ; groupSort : boolean ; colorMapping : boolean ; dataMapping : boolean ; reduce : boolean ; rename : boolean ; cutOff : boolean ; } export interface ILineUpOptions { default summaryHeader : boolean ; default animated : boolean ; default expandLineOnHover : boolean ; default sidePanel : boolean ; default sidePanelCollapsed : boolean ; default hierarchyIndicator : boolean ; default onDialogBackgroundClick : 'cancel' | 'confirm' ; default livePreviews : Partial < ILivePreviewOptions > ; default defaultSlopeGraphMode : 'item' | 'band' ; default labelRotation : number ; default rowHeight : number ; default rowPadding : number ; default groupHeight : number ; default groupPadding : number ; param { number } rowIndex returns { "high" | "low" } levelOfDetail : ( rowIndex : number ) => 'high' | 'low' ; param { ( IGroupItem | IGroupData ) [ ] } data param { Ranking } ranking returns { IDynamicHeight | null } dynamicHeight : ( data : ( IGroupItem | IGroupData ) [ ] , ranking : Ranking ) => IDynamicHeight | null ; param { HTMLElement } row param { number } rowIndex customRowUpdate : ( row : HTMLElement , rowIndex : number ) => void ; /**
     * register custom toolbar actions and dialog addons
     */ toolbarActions : IToolbarLookup < IToolbarAction > ; toolbarDialogAddons : IToolbarLookup < IToolbarDialogAddon > ; /**
     * hook for postprocess the toolbar actions for a column
     */ resolveToolbarActions : ( col : Column , keys : string [ ] , lookup : IToolbarLookup < IToolbarAction > ) => IToolbarAction [ ] ; /**
     * hook for postprocess the toolbar dialog addons for a column
     */ resolveToolbarDialogAddons : ( col : Column , keys : string [ ] , lookup : IToolbarLookup < IToolbarDialogAddon > ) => IToolbarDialogAddon [ ] ; /**
     * register custom renderer factories
     */ renderers : { [ type ] : ICellRendererFactory ; } ; /**
     * custom check whether a given renderer can render the given column in the given mode
     */ canRender : ( type : string , renderer : ICellRendererFactory , col : Column , mode : ERenderMode ) => boolean ; /**
     * custom flags for optimization
     */ flags : Partial < ILineUpFlags > ; default ignoreUnsupportedBrowser : boolean ; default copyableRows : boolean ; } export interface ITaggleOptions extends ILineUpOptions { default overviewMode : boolean ; } export interface ILineUpLike { readonly node : HTMLElement ; readonly data : IDataProvider ; dump ( ) : any ; destroy ( ) : void ; } function resolveToolbarActions ( col , keys , lookup ) { const actions = [ ] ; keys . forEach ( ( key ) => { if ( lookup . hasOwnProperty ( key ) ) { actions . push ( lookup [ key ] ) ; } else { console . warn ( `cannot find toolbar action of type: "${ col . desc . type }" with key "${ key }"` ) ; } } ) ; return actions ; } function resolveToolbarDialogAddons ( col , keys , lookup ) { const actions = [ ] ; keys . forEach ( ( key ) => { if ( lookup . hasOwnProperty ( key ) ) { actions . push ( lookup [ key ] ) ; } else { console . warn ( `cannot find toolbar dialog addon of type: "${ col . desc . type }" with key "${ key }"` ) ; } } ) ; return actions ; } export function defaultOptions ( ) { return { toolbarActions , toolbarDialogAddons , resolveToolbarActions , resolveToolbarDialogAddons , renderers : Object . assign ( { } , renderers ) , canRender : ( ) => true , labelRotation : 0 , summaryHeader : true , animated : true , expandLineOnHover : false , sidePanel : true , sidePanelCollapsed : false , hierarchyIndicator : true , defaultSlopeGraphMode : 'item' , overviewMode : false , livePreviews : { search : true , filter : true , vis : true , sort : true , group : true , groupSort : true , colorMapping : true , } , onDialogBackgroundClick : 'confirm' , rowHeight : 18 , groupHeight : 40 , groupPadding : 5 , rowPadding : 2 , levelOfDetail : ( ) => 'high' , customRowUpdate : ( ) => undefined , dynamicHeight : ( ) => null , flags : { disableFrozenColumns : true , advancedRankingFeatures : true , advancedModelFeatures : true , advancedUIFeatures : true , } , ignoreUnsupportedBrowser : false , copyableRows : true , } ; }