File tree Expand file tree Collapse file tree 5 files changed +32
-15
lines changed
Expand file tree Collapse file tree 5 files changed +32
-15
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,8 @@ import { updateHeaderFilterItemSelectionState } from '@ts/grids/grid_core/header
2525import gridCoreUtils from '@ts/grids/grid_core/m_utils' ;
2626import type { Column } from '@ts/grids/new/grid_core/columns_controller/types' ;
2727
28+ import type { HeaderFilterListType } from './types' ;
29+
2830export const getHeaderItemText = (
2931 displayValue ,
3032 column ,
@@ -211,9 +213,9 @@ export const getDataSourceOptions = (
211213 return options . dataSource ;
212214} ;
213215
214- export const getFilterType = (
216+ export const getHeaderFilterListType = (
215217 column : Column ,
216- ) : 'tree' | 'list' => {
218+ ) : HeaderFilterListType => {
217219 const groupInterval = filteringUtils . getGroupInterval ( column ) ;
218220 return groupInterval && groupInterval . length > 1 ? 'tree' : 'list' ;
219221} ;
Original file line number Diff line number Diff line change 1+ import type { FilterType } from '@js/common/grids' ;
12import type { DataSourceLike } from '@js/data/data_source' ;
23
4+ import type { Column } from '../../columns_controller/types' ;
5+
36export type HeaderFilterSearchMode = 'contains' | 'startswith' | 'equals' ;
47export type HeaderFilterType = 'include' | 'exclude' ;
8+ export type HeaderFilterListType = 'tree' | 'list' ;
9+
10+ export interface PopupOptions {
11+ type : HeaderFilterListType ;
12+ column : Column ;
13+ headerFilter : HeaderFilterColumnOptions ;
14+ dataSource ?: DataSourceLike < unknown > ;
15+ isFilterBuilder ?: boolean ;
16+ filterType ?: FilterType ;
17+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18+ filterValues ?: any [ ] ;
19+ apply : ( ) => void ;
20+ hidePopupCallback : ( ) => void ;
21+ }
522
623export type PopupState = {
724 element : Element ;
8- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9- options : Record < string , any > ;
25+ options : PopupOptions ;
1026} | null ;
1127
1228export interface HeaderFilterTextOptions {
Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ describe('HeaderFilter', () => {
114114 { popupState } as any ,
115115 ) ;
116116
117- popupState . value = { element : { } as any , options : expectedOptions } ;
117+ popupState . value = { element : { } as any , options : expectedOptions as any } ;
118118
119119 expect ( oldHeaderFilterMock . showHeaderFilterMenu )
120120 . toHaveBeenCalledTimes ( 1 ) ;
@@ -130,7 +130,7 @@ describe('HeaderFilter', () => {
130130 { popupState } as any ,
131131 ) ;
132132
133- popupState . value = { element : { } as any , options : { } } ;
133+ popupState . value = { element : { } as any , options : { } as any } ;
134134 popupState . value = null ;
135135
136136 expect ( oldHeaderFilterMock . showHeaderFilterMenu )
Original file line number Diff line number Diff line change @@ -156,8 +156,8 @@ describe('HeaderFilter', () => {
156156
157157 const state = viewController . popupState . peek ( ) ;
158158
159- expect ( typeof state ?. options . dataSource . load ) . toBe ( 'function' ) ;
160- expect ( typeof state ?. options . dataSource . postProcess ) . toBe ( 'function' ) ;
159+ expect ( typeof ( state ?. options . dataSource as any ) . load ) . toBe ( 'function' ) ;
160+ expect ( typeof ( state ?. options . dataSource as any ) . postProcess ) . toBe ( 'function' ) ;
161161 } ) ;
162162
163163 // NOTE: Unfortunately, we cannot test perfectly local group functions here
@@ -195,8 +195,8 @@ describe('HeaderFilter', () => {
195195
196196 const state = viewController . popupState . peek ( ) ;
197197
198- expect ( state ?. options . dataSource . group ) . toBeTruthy ( ) ;
199- expect ( checkFn ( state ?. options . dataSource . group ) ) . toBeTruthy ( ) ;
198+ expect ( ( state ?. options . dataSource as any ) . group ) . toBeTruthy ( ) ;
199+ expect ( checkFn ( ( state ?. options . dataSource as any ) . group ) ) . toBeTruthy ( ) ;
200200 } ) ;
201201 } ) ;
202202 } ) ;
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ import { OptionsController } from '../../options_controller/options_controller';
1212import { FilterController } from '../filter_controller' ;
1313import type { AppliedFilters } from '../types' ;
1414import { getAppliedFilterExpressions } from '../utils' ;
15- import { getDataSourceOptions , getFilterType } from './legacy_header_filter' ;
16- import type { PopupState } from './types' ;
15+ import { getDataSourceOptions , getHeaderFilterListType } from './legacy_header_filter' ;
16+ import type { PopupOptions , PopupState } from './types' ;
1717import { getColumnIdentifier } from './utils' ;
1818
1919export class HeaderFilterViewController {
@@ -45,10 +45,9 @@ export class HeaderFilterViewController {
4545 const rootDataSource = this . dataController . getStoreLoadAdapter ( ) ;
4646 const rootHeaderFilterOptions = this . options . oneWay ( 'headerFilter' ) . peek ( ) ;
4747 const filterExpression = this . getFilterExpressionWithoutCurrentColumn ( column ) ;
48- const type = getFilterType ( column ) ;
48+ const type = getHeaderFilterListType ( column ) ;
4949 const { columnsController } = this ;
50- // eslint-disable-next-line @typescript-eslint/no-explicit-any
51- const popupOptions : any = {
50+ const popupOptions : PopupOptions = {
5251 type,
5352 column : { ...column } ,
5453 isFilterBuilder,
You can’t perform that action at this time.
0 commit comments