@@ -77,6 +77,7 @@ import {
7777 type TableColumnFormat ,
7878 type Settings ,
7979 isSortDirection ,
80+ type SortDescriptor ,
8081} from '@deephaven/jsapi-utils' ;
8182import {
8283 assertNotNull ,
@@ -237,7 +238,7 @@ function isEmptyConfig({
237238 rollupConfig ?: UIRollupConfig ;
238239 searchFilter ?: DhType . FilterCondition ;
239240 selectDistinctColumns : readonly ColumnName [ ] ;
240- sorts : readonly DhType . Sort [ ] ;
241+ sorts : readonly SortDescriptor [ ] ;
241242} ) : boolean {
242243 return (
243244 advancedFilters . size === 0 &&
@@ -312,7 +313,7 @@ export interface IrisGridProps {
312313 /** @deprecated use `partitionConfig` instead */
313314 partitions ?: ( string | null ) [ ] ;
314315 partitionConfig ?: PartitionConfig ;
315- sorts : readonly DhType . Sort [ ] ;
316+ sorts : readonly SortDescriptor [ ] ;
316317
317318 /** @deprecated use `reverse` instead */
318319 reverseType ?: ReverseType ;
@@ -396,7 +397,7 @@ export interface IrisGridState {
396397 shownAdvancedFilter : number | null ;
397398 hoverAdvancedFilter : number | null ;
398399
399- sorts : readonly DhType . Sort [ ] ;
400+ sorts : readonly SortDescriptor [ ] ;
400401 reverse : boolean ;
401402 customColumns : readonly ColumnName [ ] ;
402403 selectDistinctColumns : readonly ColumnName [ ] ;
@@ -1421,7 +1422,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
14211422 loadingScrimProgress : number | null ,
14221423 quickFilters : ReadonlyQuickFilterMap ,
14231424 advancedFilters : ReadonlyAdvancedFilterMap ,
1424- sorts : readonly DhType . Sort [ ] ,
1425+ sorts : readonly SortDescriptor [ ] ,
14251426 reverse : boolean ,
14261427 rollupConfig : UIRollupConfig | undefined ,
14271428 isMenuShown : boolean
@@ -1602,6 +1603,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
16021603 return '' ;
16031604 }
16041605
1606+ /**
1607+ * Get the model column index for the provided visible index
1608+ * @param columnIndex Visible column index
1609+ * @returns Model column index, or null if not found
1610+ */
16051611 getModelColumn ( columnIndex : GridRangeIndex ) : ModelIndex | null | undefined {
16061612 const { metrics } = this . state ;
16071613 assertNotNull ( metrics ) ;
@@ -1610,6 +1616,11 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
16101616 return null ;
16111617 }
16121618
1619+ if ( columnIndex != null && columnIndex < 0 ) {
1620+ // ColumnBy sources aren't movable, so just return the index directly
1621+ return columnIndex ;
1622+ }
1623+
16131624 return columnIndex != null ? modelColumns . get ( columnIndex ) : null ;
16141625 }
16151626
@@ -2842,7 +2853,7 @@ class IrisGrid extends Component<IrisGridProps, IrisGridState> {
28422853 }
28432854 }
28442855
2845- updateSorts ( sorts : readonly DhType . Sort [ ] ) : void {
2856+ updateSorts ( sorts : readonly SortDescriptor [ ] ) : void {
28462857 this . startLoading ( 'Sorting...' ) ;
28472858 this . setState ( { sorts } ) ;
28482859 this . grid ?. forceUpdate ( ) ;
0 commit comments