import { Category , SupportType } from './annotations' ; import Column from './Column' ; import type { IDataRow , IColumnDesc } from './interfaces' ; import { integrateDefaults } from './internal' ; param label returns { { type : string , label : string } } export function createRankDesc ( label = 'Rank' ) { return { type : 'rank' , label } ; } /**
 * a rank column
 */ @ SupportType ( ) @ Category ( 'support' ) export default class RankColumn extends Column { constructor ( id , desc ) { super ( id , integrateDefaults ( desc , { width : 50 , } ) ) ; } getLabel ( row ) { return String ( this . getValue ( row ) ) ; } getRaw ( row ) { const ranking = this . findMyRanker ( ) ; if ( ! ranking ) { return - 1 ; } return ranking . getRank ( row . i ) ; } getValue ( row ) { const r = this . getRaw ( row ) ; return r === - 1 ? null : r ; } get frozen ( ) { return this . desc . frozen !== false ; } }