@@ -2,7 +2,7 @@ import { CreateElement, PropType } from 'vue'
22import { defineVxeComponent } from '../../../ui/src/comp'
33import { VxeUI } from '../../../ui'
44import { formatText , isEnableConf } from '../../../ui/src/utils'
5- import { getPropClass , toCssUnit } from '../../../ui/src/dom'
5+ import { getPropClass } from '../../../ui/src/dom'
66import { getSlotVNs } from '../../../ui/src/vn'
77import { createComponentLog } from '../../../ui/src/log'
88
@@ -142,16 +142,20 @@ export default /* define-vxe-component start */ defineVxeComponent({
142142 *************************/
143143
144144 renderOptions ( h : CreateElement , filterRender : VxeColumnPropTypes . FilterRender | null , compConf : VxeGlobalRendererOptions | null ) {
145+ const VxeUIScrollbarComponent = VxeUI . getComponent ( 'VxeScrollbar' )
146+
145147 const $xeFilterPanel = this
146148 const props = $xeFilterPanel
147149 const $xeTable = $xeFilterPanel . $xeTable
148150 const tableInternalData = $xeTable as unknown as TableInternalData
149151
150152 const { filterStore } = props
151- const { column, maxHeight } = filterStore
153+ const { column } = filterStore
152154 if ( ! column ) {
153155 return [ ]
154156 }
157+ const filterOpts = $xeTable . computeFilterOpts
158+ const { useScrollbar } = filterOpts
155159 const { filterMultiple, filters, slots } = column
156160 const filterOptions = ( filters || [ ] ) as VxeTableDefines . FilterOption [ ]
157161 const filterSlot = slots ? slots . filter : null
@@ -160,33 +164,52 @@ export default /* define-vxe-component start */ defineVxeComponent({
160164 if ( filterSlot ) {
161165 return [
162166 h ( 'div' , {
163- class : 'vxe-table--filter-template' ,
164- style : maxHeight
165- ? {
166- maxHeight : toCssUnit ( maxHeight )
167- }
168- : { }
167+ class : 'vxe-table--filter-template'
169168 } , $xeTable . callSlot ( filterSlot , params , h ) )
170169 ]
171170 } else if ( filterRender && rtFilter ) {
172171 return [
173172 h ( 'div' , {
174- class : 'vxe-table--filter-template' ,
175- style : maxHeight
176- ? {
177- maxHeight : toCssUnit ( maxHeight )
178- }
179- : { }
173+ class : 'vxe-table--filter-template'
180174 } , getSlotVNs ( rtFilter . call ( $xeTable , h , filterRender , params ) ) )
181175 ]
182176 }
183177 const isAllChecked = filterMultiple ? filterStore . isAllSelected : ! filterOptions . some ( ( item ) => item . _checked )
184178 const isAllIndeterminate = filterMultiple && filterStore . isIndeterminate
179+
180+ const optVNs = filterOptions . map ( ( item : any ) => {
181+ const isChecked = item . _checked
182+ const isIndeterminate = false
183+ return h ( 'div' , {
184+ class : [ 'vxe-table--filter-option' , {
185+ 'is--checked' : isChecked
186+ } ] ,
187+ attrs : {
188+ title : item . label
189+ } ,
190+ on : {
191+ click : ( evnt : MouseEvent ) => {
192+ ( $xeFilterPanel as any ) . changeOption ( evnt , ! item . _checked , item )
193+ }
194+ }
195+ } , ( filterMultiple
196+ ? [
197+ h ( 'span' , {
198+ class : [ 'vxe-checkbox--icon' , isIndeterminate ? getIcon ( ) . TABLE_CHECKBOX_INDETERMINATE : ( isChecked ? getIcon ( ) . TABLE_CHECKBOX_CHECKED : getIcon ( ) . TABLE_CHECKBOX_UNCHECKED ) ]
199+ } )
200+ ]
201+ : [ ] ) . concat ( [
202+ h ( 'span' , {
203+ class : 'vxe-checkbox--label'
204+ } , formatText ( item . label , 1 ) )
205+ ] ) )
206+ } )
207+
185208 return [
186- h ( 'ul ' , {
209+ h ( 'div ' , {
187210 class : 'vxe-table--filter-header'
188211 } , [
189- h ( 'li ' , {
212+ h ( 'div ' , {
190213 class : [ 'vxe-table--filter-option' , {
191214 'is--checked' : isAllChecked ,
192215 'is--indeterminate' : isAllIndeterminate
@@ -211,40 +234,19 @@ export default /* define-vxe-component start */ defineVxeComponent({
211234 } , getI18n ( 'vxe.table.allFilter' ) )
212235 ] ) )
213236 ] ) ,
214- h ( 'ul' , {
215- class : 'vxe-table--filter-body' ,
216- style : maxHeight
217- ? {
218- maxHeight : toCssUnit ( maxHeight )
219- }
220- : { }
221- } , filterOptions . map ( ( item : any ) => {
222- const isChecked = item . _checked
223- const isIndeterminate = false
224- return h ( 'li' , {
225- class : [ 'vxe-table--filter-option' , {
226- 'is--checked' : isChecked
227- } ] ,
228- attrs : {
229- title : item . label
237+ useScrollbar
238+ ? h ( VxeUIScrollbarComponent , {
239+ class : 'vxe-table--scrollbar-filter-body' ,
240+ props : {
241+ viewClassName : 'vxe-table--scrollbar-filter-body-view'
230242 } ,
231- on : {
232- click : ( evnt : MouseEvent ) => {
233- ( $xeFilterPanel as any ) . changeOption ( evnt , ! item . _checked , item )
234- }
243+ scopedSlots : {
244+ default : ( ) => optVNs
235245 }
236- } , ( filterMultiple
237- ? [
238- h ( 'span' , {
239- class : [ 'vxe-checkbox--icon' , isIndeterminate ? getIcon ( ) . TABLE_CHECKBOX_INDETERMINATE : ( isChecked ? getIcon ( ) . TABLE_CHECKBOX_CHECKED : getIcon ( ) . TABLE_CHECKBOX_UNCHECKED ) ]
240- } )
241- ]
242- : [ ] ) . concat ( [
243- h ( 'span' , {
244- class : 'vxe-checkbox--label'
245- } , formatText ( item . label , 1 ) )
246- ] ) )
247- } ) )
246+ } )
247+ : h ( 'div' , {
248+ class : 'vxe-table--filter-body'
249+ } , optVNs )
248250 ]
249251 } ,
250252 renderFooter ( h : CreateElement ) {
0 commit comments