'use strict' ; import type DataEventEmitter from './DataEventEmitter' ; import type DataModifier from './Modifiers/DataModifier' ; import type JSON from '../Core/JSON' ; import DataPromise from './DataPromise.js' ; import U from '../Core/Utilities.js' ; const { addEvent , fireEvent , uniqueKey } = U ; private class name param { Highcharts . DataTableColumnCollection } columns param { string } id class DataTable implements DataEventEmitter < DataTable . Event > { name type { Highcharts . DataTableRowObject } see Highcharts . DataTable . isNull for a null test.
     *
     *  example public static readonly NULL : Readonly < DataTable . RowObject > = { } ; function param { Highcharts . DataTableRow | Highcharts . DataTableRowObject } row return { boolean } example public static isNull ( row ) { if ( row === DataTable . NULL ) { return true ; } if ( row instanceof Array ) { if ( ! row . length ) { return false ; } for ( let i = 0 , iEnd = row . length ; i < iEnd ; ++ i ) { if ( row [ i ] !== null ) { return false ; } } } else { const columnNames = Object . keys ( row ) ; if ( ! columnNames . length ) { return false ; } for ( let i = 0 , iEnd = columnNames . length ; i < iEnd ; ++ i ) { if ( row [ columnNames [ i ] ] !== null ) { return false ; } } } return true ; } param { Highcharts . DataTableColumnCollection } columns param { string } id public constructor ( columns = { } , id ? ) { name type { boolean } this . autoId = ! id ; this . columns = { } ; name type { string } this . id = ( id || uniqueKey ( ) ) ; this . modified = this ; this . rowCount = 0 ; this . versionTag = uniqueKey ( ) ; const columnNames = Object . keys ( columns ) , thisColumns = this . columns ; let rowCount = 0 ; for ( let i = 0 , iEnd = columnNames . length , column , columnName ; i < iEnd ; ++ i ) { columnName = columnNames [ i ] ; column = columns [ columnName ] . slice ( ) ; thisColumns [ columnName ] = column ; rowCount = Math . max ( rowCount , column . length ) ; } for ( let i = 0 , iEnd = columnNames . length ; i < iEnd ; ++ i ) { thisColumns [ columnNames [ i ] ] . length = rowCount ; } this . rowCount = rowCount ; } private private readonly aliasMap : Record < string , string > = { } ; public readonly autoId : boolean ; private columns : Record < string , DataTable . Column > ; public readonly id : string ; public modified : DataTable ; private modifier ? : DataModifier ; private rowCount : number ; private versionTag : string ; function param { boolean } skipColumns param { Highcharts . DataTableEventDetail } eventDetail return { Highcharts . DataTable } emits emits public clone ( skipColumns ? , eventDetail ? ) { const table = this , aliasMap = table . aliasMap , aliases = Object . keys ( table . aliasMap ) ; table . emit ( { type : 'cloneTable' , detail : eventDetail } ) ; const tableClone = new DataTable ( ( skipColumns ? { } : table . columns ) , ( table . autoId ? void 0 : table . id ) ) ; if ( ! skipColumns ) { tableClone . versionTag = table . versionTag ; if ( aliases . length ) { const cloneAliasMap = tableClone . aliasMap ; for ( let i = 0 , iEnd = aliases . length , alias ; i < iEnd ; ++ i ) { alias = aliases [ i ] ; cloneAliasMap [ alias ] = aliasMap [ alias ] ; } } } table . emit ( { type : 'afterCloneTable' , detail : eventDetail , tableClone } ) ; return tableClone ; } function param { string } alias return { string | undefined } public deleteColumnAlias ( alias ) { const table = this , aliasMap = table . aliasMap , deletedAlias = aliasMap [ alias ] , modifier = table . modifier ; if ( deletedAlias ) { delete table . aliasMap [ alias ] ; if ( modifier ) { modifier . modifyColumns ( table , { [ deletedAlias ] : new Array ( table . rowCount ) } , 0 ) ; } } return deletedAlias ; } function param { Array < string > } columnNames param { Highcharts . DataTableEventDetail } eventDetail return { Highcharts . DataTableColumnCollection | undefined } emits emits public deleteColumns ( columnNames ? , eventDetail ? ) { const table = this , columns = table . columns , deletedColumns = { } , modifiedColumns = { } , modifier = table . modifier , rowCount = table . rowCount ; columnNames = ( columnNames || Object . keys ( columns ) ) ; if ( columnNames . length ) { table . emit ( { type : 'deleteColumns' , columnNames , detail : eventDetail } ) ; for ( let i = 0 , iEnd = columnNames . length , column , columnName ; i < iEnd ; ++ i ) { columnName = columnNames [ i ] ; column = columns [ columnName ] ; if ( column ) { deletedColumns [ columnName ] = column ; modifiedColumns [ columnName ] = new Array ( rowCount ) ; } delete columns [ columnName ] ; } if ( ! Object . keys ( columns ) . length ) { table . rowCount = 0 ; } if ( modifier ) { modifier . modifyColumns ( table , modifiedColumns , 0 , eventDetail ) ; } table . emit ( { type : 'afterDeleteColumns' , columns : deletedColumns , columnNames , detail : eventDetail } ) ; return deletedColumns ; } } function param { number } rowIndex param { number } rowCount param { Highcharts . DataTableEventDetail } eventDetail return { Array < Highcharts . DataTableRow > } emits emits public deleteRows ( rowIndex ? , rowCount = 1 , eventDetail ? ) { const table = this , deletedRows = [ ] , modifiedRows = [ ] , modifier = table . modifier ; table . emit ( { type : 'deleteRows' , detail : eventDetail , rowCount , rowIndex : ( rowIndex || 0 ) } ) ; if ( typeof rowIndex === 'undefined' ) { rowIndex = 0 ; rowCount = table . rowCount ; } if ( rowCount > 0 && rowIndex < table . rowCount ) { const columns = table . columns , columnNames = Object . keys ( columns ) ; for ( let i = 0 , iEnd = columnNames . length , column , deletedCells ; i < iEnd ; ++ i ) { column = columns [ columnNames [ i ] ] ; deletedCells = column . splice ( rowIndex , rowCount ) ; if ( ! i ) { table . rowCount = column . length ; } for ( let j = 0 , jEnd = deletedCells . length ; j < jEnd ; ++ j ) { deletedRows [ j ] = ( deletedRows [ j ] || [ ] ) ; deletedRows [ j ] [ i ] = deletedCells [ j ] ; } modifiedRows . push ( new Array ( iEnd ) ) ; } } if ( modifier ) { modifier . modifyRows ( table , modifiedRows , ( rowIndex || 0 ) , eventDetail ) ; } table . emit ( { type : 'afterDeleteRows' , detail : eventDetail , rowCount , rowIndex : ( rowIndex || 0 ) , rows : deletedRows } ) ; return deletedRows ; } private param { DataTable . Event } e public emit ( e ) { const frame = this ; switch ( e . type ) { case 'afterDeleteColumns' : case 'afterDeleteRows' : case 'afterSetCell' : case 'afterSetColumns' : case 'afterSetRows' : frame . versionTag = uniqueKey ( ) ; break ; default : } fireEvent ( frame , e . type , e ) ; } function param { string } columnNameOrAlias param { number } rowIndex return { Highcharts . DataTableCellType | undefined } public getCell ( columnNameOrAlias , rowIndex ) { const table = this ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = table . columns [ columnNameOrAlias ] ; if ( column ) { return column [ rowIndex ] ; } } function param { string } columnNameOrAlias param { number } rowIndex return { boolean } public getCellAsBoolean ( columnNameOrAlias , rowIndex ) { const table = this ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = table . columns [ columnNameOrAlias ] ; return ! ! ( column && column [ rowIndex ] ) ; } public getCellAsNumber ( columnNameOrAlias , rowIndex , useNaN ) ; public getCellAsNumber ( columnNameOrAlias , rowIndex , useNaN ? ) ; function param { string } columnNameOrAlias param { number } rowIndex param { boolean } useNaN return { number | null } public getCellAsNumber ( columnNameOrAlias , rowIndex , useNaN ? ) { const table = this ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = table . columns [ columnNameOrAlias ] ; let cellValue = ( column && column [ rowIndex ] ) ; switch ( typeof cellValue ) { case 'boolean' : return ( cellValue ? 1 : 0 ) ; case 'number' : return ( isNaN ( cellValue ) && ! useNaN ? null : cellValue ) ; } cellValue = parseFloat ( `${ cellValue }` ) ; return ( isNaN ( cellValue ) && ! useNaN ? null : cellValue ) ; } function param { string } columnNameOrAlias param { number } rowIndex return { string } public getCellAsString ( columnNameOrAlias , rowIndex ) { const table = this ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = table . columns [ columnNameOrAlias ] ; return `${ ( column && column [ rowIndex ] ) }` ; } public getColumn ( columnNameOrAlias , asReference ? ) ; public getColumn ( columnNameOrAlias , asReference ) ; /**
     * Fetches the given column by the canonical column name or by an alias.
     * This function is a simplified wrap of  getColumns .
     *
     *  function param { string } columnNameOrAlias param { boolean } asReference return { Highcharts . DataTableColumn | undefined } public getColumn ( columnNameOrAlias , asReference ? ) { return this . getColumns ( [ columnNameOrAlias ] , asReference ) [ columnNameOrAlias ] ; } function return { Array < string > } public getColumnAliases ( ) { const table = this , columnAliases = Object . keys ( table . aliasMap ) ; return columnAliases ; } public getColumnAsNumbers ( columnNameOrAlias , useNaN ) ; public getColumnAsNumbers ( columnNameOrAlias , useNaN ? ) ; function param { string } columnNameOrAlias param { boolean } useNaN return { Array < ( number | null ) > } public getColumnAsNumbers ( columnNameOrAlias , useNaN ? ) { const table = this , columns = table . columns ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = columns [ columnNameOrAlias ] , columnAsNumber = [ ] ; if ( column ) { const columnLength = column . length ; if ( useNaN ) { for ( let i = 0 ; i < columnLength ; ++ i ) { columnAsNumber . push ( table . getCellAsNumber ( columnNameOrAlias , i , true ) ) ; } } else { for ( let i = 0 , cellValue ; i < columnLength ; ++ i ) { cellValue = column [ i ] ; if ( typeof cellValue === 'number' ) { return column . slice ( ) as Array < ( number | null ) > ; } if ( cellValue !== null && typeof cellValue !== 'undefined' ) { break ; } } for ( let i = 0 ; i < columnLength ; ++ i ) { columnAsNumber . push ( table . getCellAsNumber ( columnNameOrAlias , i ) ) ; } } } return columnAsNumber ; } function return { Array < string > } public getColumnNames ( ) { const table = this , columnNames = Object . keys ( table . columns ) ; return columnNames ; } public getColumns ( columnNamesOrAliases ? , asReference ? ) ; public getColumns ( columnNamesOrAliases , asReference ) ; function param { Array < string > } columnNamesOrAliases param { boolean } asReference return { Highcharts . DataTableColumnCollection } public getColumns ( columnNamesOrAliases ? , asReference ? ) { const table = this , tableAliasMap = table . aliasMap , tableColumns = table . columns , columns = { } ; columnNamesOrAliases = ( columnNamesOrAliases || Object . keys ( tableColumns ) ) ; for ( let i = 0 , iEnd = columnNamesOrAliases . length , column , columnName ; i < iEnd ; ++ i ) { columnName = columnNamesOrAliases [ i ] ; column = tableColumns [ ( tableAliasMap [ columnName ] || columnName ) ] ; if ( column ) { columns [ columnName ] = ( asReference ? column : column . slice ( ) ) ; } } return columns ; } private return { Highcharts . DataModifier | undefined } public getModifier ( ) { return this . modifier ; } /**
     * Retrieves the row at a given index. This function is a simplified wrap of
     *  getRows .
     *
     *  function param { number } rowIndex param { Array < string > } columnNamesOrAliases return { Highcharts . DataTableRow } public getRow ( rowIndex , columnNamesOrAliases ? ) { return this . getRows ( rowIndex , 1 , columnNamesOrAliases ) [ 0 ] ; } function return { number } public getRowCount ( ) { return this . rowCount ; } function param { string } columnNameOrAlias param { Highcharts . DataTableCellType } cellValue param { number } rowIndexOffset return { number | undefined } public getRowIndexBy ( columnNameOrAlias , cellValue , rowIndexOffset ? ) { const table = this ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = table . columns [ columnNameOrAlias ] ; if ( column ) { const rowIndex = column . indexOf ( cellValue , rowIndexOffset ) ; if ( rowIndex !== - 1 ) { return rowIndex ; } } } /**
     * Retrieves the row at a given index. This function is a simplified wrap of
     *  getRowObjects .
     *
     *  function param { number } rowIndex param { Array < string > } columnNamesOrAliases return { Highcharts . DataTableRowObject } public getRowObject ( rowIndex , columnNamesOrAliases ? ) { return this . getRowObjects ( rowIndex , 1 , columnNamesOrAliases ) [ 0 ] ; } function param { number } rowIndex param { number } rowCount param { Array < string > } columnNamesOrAliases return { Highcharts . DataTableRowObject } public getRowObjects ( rowIndex = 0 , rowCount = ( this . rowCount - rowIndex ) , columnNamesOrAliases ? ) { const table = this , aliasMap = table . aliasMap , columns = table . columns , rows = new Array ( rowCount ) ; columnNamesOrAliases = ( columnNamesOrAliases || Object . keys ( columns ) ) ; const columnNamesLength = columnNamesOrAliases . length ; for ( let i = rowIndex , i2 = 0 , iEnd = Math . min ( table . rowCount , ( rowIndex + rowCount ) ) , row ; i < iEnd ; ++ i , ++ i2 ) { row = rows [ i2 ] = { } ; for ( let j = 0 , jEnd = columnNamesLength , columnName ; j < jEnd ; ++ j ) { columnName = columnNamesOrAliases [ j ] ; row [ columnName ] = columns [ ( aliasMap [ columnName ] || columnName ) ] [ i ] ; } } return rows ; } function param { number } rowIndex param { number } rowCount param { Array < string > } columnNamesOrAliases return { Highcharts . DataTableRow } public getRows ( rowIndex = 0 , rowCount = ( this . rowCount - rowIndex ) , columnNamesOrAliases ? ) { const table = this , aliasMap = table . aliasMap , columns = table . columns , rows = new Array ( rowCount ) ; columnNamesOrAliases = ( columnNamesOrAliases || Object . keys ( columns ) ) ; const columnNamesLength = columnNamesOrAliases . length ; for ( let i = rowIndex , i2 = 0 , iEnd = Math . min ( table . rowCount , ( rowIndex + rowCount ) ) , columnName , row ; i < iEnd ; ++ i , ++ i2 ) { row = rows [ i2 ] = new Array ( columnNamesLength ) ; for ( let j = 0 ; j < columnNamesLength ; ++ j ) { columnName = columnNamesOrAliases [ j ] ; row [ j ] = columns [ ( aliasMap [ columnName ] || columnName ) ] [ i ] ; } } return rows ; } function return { string } public getVersionTag ( ) { return this . versionTag ; } function param { Array < string > } columnNamesOrAliases return { boolean } public hasColumns ( columnNamesOrAliases ) { const table = this , aliasMap = table . aliasMap , columns = table . columns ; for ( let i = 0 , iEnd = columnNamesOrAliases . length , columnName ; i < iEnd ; ++ i ) { columnName = columnNamesOrAliases [ i ] ; if ( ! columns [ columnName ] && ! aliasMap [ columnName ] ) { return false ; } } return true ; } function param { string } columnNameOrAlias param { boolean | number | string | Highcharts . DataTable } cellValue return { boolean } public hasRowWith ( columnNameOrAlias , cellValue ) { const table = this ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; const column = table . columns [ columnNameOrAlias ] ; if ( column ) { return ( column . indexOf ( cellValue ) !== - 1 ) ; } return false ; } function param { string } type param { Highcharts . EventCallbackFunction < Highcharts . DataTable > } callback return { Function } public on ( type , callback ) { return addEvent ( this , type , callback ) ; } function param { string } columnName param { string } newColumnName return { boolean } public renameColumn ( columnName , newColumnName ) { const table = this , columns = table . columns ; if ( columns [ columnName ] ) { if ( columnName !== newColumnName ) { const aliasMap = table . aliasMap ; if ( aliasMap [ newColumnName ] ) { delete aliasMap [ newColumnName ] ; } columns [ newColumnName ] = columns [ columnName ] ; delete columns [ columnName ] ; } return true ; } return false ; } function param { string } columnNameOrAlias param { number | undefined } rowIndex param { Highcharts . DataTableCellType } cellValue param { Highcharts . DataTableEventDetail } eventDetail emits emits public setCell ( columnNameOrAlias , rowIndex , cellValue , eventDetail ? ) { const table = this , columns = table . columns , modifier = table . modifier ; columnNameOrAlias = ( table . aliasMap [ columnNameOrAlias ] || columnNameOrAlias ) ; let column = columns [ columnNameOrAlias ] ; if ( column && column [ rowIndex ] === cellValue ) { return ; } table . emit ( { type : 'setCell' , cellValue , columnName : columnNameOrAlias , detail : eventDetail , rowIndex } ) ; if ( ! column ) { column = columns [ columnNameOrAlias ] = new Array ( table . rowCount ) ; } if ( rowIndex >= table . rowCount ) { table . rowCount = ( rowIndex + 1 ) ; } column [ rowIndex ] = cellValue ; if ( modifier ) { modifier . modifyCell ( table , columnNameOrAlias , rowIndex , cellValue ) ; } table . emit ( { type : 'afterSetCell' , cellValue , columnName : columnNameOrAlias , detail : eventDetail , rowIndex } ) ; } function param { string } columnNameOrAlias param { Highcharts . DataTableColumn } column param { number } rowIndex param { Highcharts . DataTableEventDetail } eventDetail emits emits public setColumn ( columnNameOrAlias , column = [ ] , rowIndex = 0 , eventDetail ? ) { this . setColumns ( { [ columnNameOrAlias ] : column } , rowIndex , eventDetail ) ; } function param { string } columnAlias param { string } columnName return { boolean } public setColumnAlias ( columnAlias , columnName ) { const aliasMap = this . aliasMap ; if ( ! aliasMap [ columnAlias ] ) { aliasMap [ columnAlias ] = columnName ; return true ; } return false ; } function param { Highcharts . DataTableColumnCollection } columns param { number } rowIndex param { Highcharts . DataTableEventDetail } eventDetail emits emits public setColumns ( columns , rowIndex ? , eventDetail ? ) { const table = this , tableColumns = table . columns , tableModifier = table . modifier , tableRowCount = table . rowCount , reset = ( typeof rowIndex === 'undefined' ) , columnNames = Object . keys ( columns ) ; table . emit ( { type : 'setColumns' , columns , columnNames , detail : eventDetail , rowIndex } ) ; for ( let i = 0 , iEnd = columnNames . length , column , columnName ; i < iEnd ; ++ i ) { columnName = columnNames [ i ] ; column = columns [ columnName ] ; columnName = ( table . aliasMap [ columnName ] || columnName ) ; if ( reset ) { tableColumns [ columnName ] = column . slice ( ) ; table . rowCount = column . length ; } else { const tableColumn = ( tableColumns [ columnName ] ? tableColumns [ columnName ] : tableColumns [ columnName ] = new Array ( table . rowCount ) ) ; rowIndex = ( rowIndex || 0 ) ; if ( rowIndex > tableRowCount ) { tableColumn . length = rowIndex ; tableColumn . push ( ... column ) ; } else { tableColumn . splice ( rowIndex , ( column . length - rowIndex ) , ... column ) ; } table . rowCount = Math . max ( table . rowCount , tableColumn . length ) ; } } const tableColumnNames = Object . keys ( tableColumns ) ; for ( let i = 0 , iEnd = tableColumnNames . length ; i < iEnd ; ++ i ) { tableColumns [ tableColumnNames [ i ] ] . length = table . rowCount ; } if ( tableModifier ) { tableModifier . modifyColumns ( table , columns , ( rowIndex || 0 ) ) ; } table . emit ( { type : 'afterSetColumns' , columns , columnNames , detail : eventDetail , rowIndex } ) ; } private param { Highcharts . DataModifier } modifier param { Highcharts . DataTableEventDetail } eventDetail return { Promise < Highcharts . DataTable > } emits emits public setModifier ( modifier ? , eventDetail ? ) { const table = this ; let promise ; table . emit ( { type : 'setModifier' , detail : eventDetail , modifier , modified : table . modified } ) ; table . modifier = modifier ; if ( modifier ) { promise = modifier . modify ( table ) ; } else { promise = DataPromise . resolve ( table ) . then ( ( table ) : this => { table . modified = table ; return table ; } ) ; } return promise . then ( ( table ) : this => { table . emit ( { type : 'afterSetModifier' , detail : eventDetail , modifier , modified : table . modified } ) ; return table ; } ) [ 'catch' ] ( ( error ) : this => { table . emit ( { type : 'setModifierError' , error , modifier , modified : table . modified } ) ; throw error ; } ) ; } /**
     * Sets cell values of a row. Will insert a new row, if no index was
     * provided, or if the index is higher than the total number of table rows.
     *
     * Note: This function is just a simplified wrap of
     *  Highcharts . DataTable .
     *
     *  function param { Highcharts . DataTableRow | Highcharts . DataTableRowObject } row param { number } rowIndex param { Highcharts . DataTableEventDetail } eventDetail emits emits public setRow ( row , rowIndex ? , eventDetail ? ) { this . setRows ( [ row ] , rowIndex , eventDetail ) ; } function param { Array < ( Highcharts . DataTableRow | Highcharts . DataTableRowObject ) > } rows param { number } rowIndex param { Highcharts . DataTableEventDetail } eventDetail emits emits public setRows ( rows , rowIndex = this . rowCount , eventDetail ? ) { const table = this , aliasMap = table . aliasMap , columns = table . columns , columnNames = Object . keys ( columns ) , modifier = table . modifier , rowCount = rows . length ; table . emit ( { type : 'setRows' , detail : eventDetail , rowCount , rowIndex , rows } ) ; for ( let i = 0 , i2 = rowIndex , row ; i < rowCount ; ++ i , ++ i2 ) { row = rows [ i ] ; if ( row === DataTable . NULL ) { for ( let j = 0 , jEnd = columnNames . length ; j < jEnd ; ++ j ) { columns [ columnNames [ j ] ] [ i2 ] = null ; } } else if ( row instanceof Array ) { for ( let j = 0 , jEnd = columnNames . length ; j < jEnd ; ++ j ) { columns [ columnNames [ j ] ] [ i2 ] = row [ j ] ; } } else { const rowColumnNames = Object . keys ( row ) ; for ( let j = 0 , jEnd = rowColumnNames . length , rowColumnName ; j < jEnd ; ++ j ) { rowColumnName = rowColumnNames [ j ] ; rowColumnName = ( aliasMap [ rowColumnName ] || rowColumnName ) ; if ( ! columns [ rowColumnName ] ) { columns [ rowColumnName ] = new Array ( i2 + 1 ) ; } columns [ rowColumnName ] [ i2 ] = row [ rowColumnName ] ; } } } const indexRowCount = ( rowIndex + rowCount ) ; if ( indexRowCount > table . rowCount ) { table . rowCount = indexRowCount ; for ( let i = 0 , iEnd = columnNames . length ; i < iEnd ; ++ i ) { columns [ columnNames [ i ] ] . length = indexRowCount ; } } if ( modifier ) { modifier . modifyRows ( table , rows , rowIndex ) ; } table . emit ( { type : 'afterSetRows' , detail : eventDetail , rowCount , rowIndex , rows } ) ; } } interface DataTable extends DataEventEmitter < DataTable . Event > { } /**
 * Additionally it provides necessary types for events and JSON conversion.
 */ namespace DataTable { /**
     * Event object for cell-related events.
     */ export interface CellEvent extends DataEventEmitter . Event { readonly type : ( 'setCell' | 'afterSetCell' ) ; readonly cellValue : CellType ; readonly columnName : string ; readonly rowIndex : number ; } /**
     * Possible value types for a table cell.
     */ export type CellType = ( DataTable | JSON . Primitive ) ; /**
     * Event object for clone-related events.
     */ export interface CloneEvent extends DataEventEmitter . Event { readonly type : ( 'cloneTable' | 'afterCloneTable' ) ; readonly tableClone ? : DataTable ; } /**
     * Array of table cells in vertical expansion.
     */ export interface Column extends Array < DataTable . CellType > { [ index ] : CellType ; } /**
     * Collection of columns, where the key is the column name (or alias) and
     * the value is an array of column values.
     */ export interface ColumnCollection { [ columnNameOrAlias ] : Column ; } /**
     * Event object for column-related events.
     */ export interface ColumnEvent extends DataEventEmitter . Event { readonly type : ( 'deleteColumns' | 'afterDeleteColumns' | 'setColumns' | 'afterSetColumns' ) ; readonly columns ? : Readonly < ColumnCollection > ; readonly columnNames : Array < string > ; readonly rowIndex ? : number ; } /**
     * All information objects of DataTable events.
     */ export type Event = ( CellEvent | CloneEvent | ColumnEvent | SetModifierEvent | RowEvent ) ; /**
     * Event object for modifier-related events.
     */ export interface ModifierEvent extends DataEventEmitter . Event { readonly type : ( 'setModifier' | 'afterSetModifier' ) ; readonly modifier : ( DataModifier | undefined ) ; } /**
     * Array of table cells in horizontal expansion. Index of the array is the
     * index of the column names.
     */ export interface Row extends Array < CellType > { [ index ] : CellType ; } /**
     * Event object for row-related events.
     */ export interface RowEvent extends DataEventEmitter . Event { readonly type : ( 'deleteRows' | 'afterDeleteRows' | 'setRows' | 'afterSetRows' ) ; readonly rowCount : number ; readonly rowIndex : number ; readonly rows ? : ReadonlyArray < ( Readonly < Row > | Readonly < RowObject > ) > ; } /**
     * Object of row values, where the keys are the column names.
     */ export interface RowObject extends Record < string , CellType > { [ column ] : CellType ; } /**
    * Event object for the setModifier events.
    */ export interface SetModifierEvent extends DataEventEmitter . Event { readonly type : ( 'setModifier' | 'afterSetModifier' | 'setModifierError' ) ; readonly error ? : unknown ; readonly modifier ? : DataModifier ; readonly modified ? : DataTable ; } } export default DataTable ; private typedef { boolean | null | number | string | Highcharts . DataTable | undefined } Highcharts . DataTableCellType private typedef { Array < Highcharts . DataTableCellType > } Highcharts . DataTableColumn private interface readonly name type { Highcharts . DataTableColumn } private typedef { Record < string , ( boolean | number | string | null | undefined ) > } Highcharts . DataTableEventDetail private typedef { Array < Highcharts . DataTableCellType > } Highcharts . DataTableRow private typedef { Record < string , Highcharts . DataTableCellType > } Highcharts . DataTableRowObject ( '' ) ;