@@ -398,51 +398,71 @@ export default defineVxeComponent({
398398 const { buttons } = props
399399 const { connectTable } = internalData
400400 const $table = connectTable
401+ const buttonsSlot = slots . buttons
401402 const buttonPrefixSlot = slots . buttonPrefix || slots [ 'button-prefix' ]
402403 const buttonSuffixSlot = slots . buttonSuffix || slots [ 'button-suffix' ]
403- const btnVNs : VxeComponentSlotType [ ] = [ ]
404+ const lbVNs : VxeComponentSlotType [ ] = [ ]
404405 if ( buttonPrefixSlot ) {
405- btnVNs . push ( ...getSlotVNs ( buttonPrefixSlot ( { buttons : buttons || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
406- }
407- if ( buttons ) {
408- buttons . forEach ( ( item , index ) => {
409- const { dropdowns, buttonRender } = item
410- if ( item . visible !== false ) {
411- const compConf = buttonRender ? renderer . get ( buttonRender . name ) : null
412- if ( buttonRender && compConf && compConf . renderToolbarButton ) {
413- const toolbarButtonClassName = compConf . toolbarButtonClassName
414- const params = { $grid : $xeGrid , $gantt : $xeGantt , $table : $table ! , button : item }
415- btnVNs . push (
416- h ( 'span' , {
417- key : `br${ item . code || index } ` ,
418- class : [ 'vxe-button--item' , toolbarButtonClassName ? ( XEUtils . isFunction ( toolbarButtonClassName ) ? toolbarButtonClassName ( params ) : toolbarButtonClassName ) : '' ]
419- } , getSlotVNs ( compConf . renderToolbarButton ( buttonRender , params ) ) )
420- )
421- } else {
422- if ( VxeUIButtonComponent ) {
406+ lbVNs . push (
407+ h ( 'span' , {
408+ key : 'tbp' ,
409+ class : 'vxe-button--prefix-wrapper'
410+ } , getSlotVNs ( buttonPrefixSlot ( { buttons : buttons || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
411+ )
412+ }
413+ if ( buttons || buttonsSlot ) {
414+ const btnVNs : VxeComponentSlotType [ ] = [ ]
415+ if ( buttons ) {
416+ buttons . forEach ( ( item , index ) => {
417+ const { dropdowns, buttonRender } = item
418+ if ( item . visible !== false ) {
419+ const compConf = buttonRender ? renderer . get ( buttonRender . name ) : null
420+ if ( buttonRender && compConf && compConf . renderToolbarButton ) {
421+ const toolbarButtonClassName = compConf . toolbarButtonClassName
422+ const params = { $grid : $xeGrid , $gantt : $xeGantt , $table : $table ! , button : item }
423423 btnVNs . push (
424- h ( VxeUIButtonComponent , {
425- key : `bd${ item . code || index } ` ,
426- ...Object . assign ( { } , item , {
427- content : item . content || item . name ,
428- options : undefined
429- } ) ,
430- onClick : ( eventParams ) => btnEvent ( eventParams , item )
431- } , dropdowns && dropdowns . length
432- ? {
433- dropdowns : ( ) => renderDropdowns ( item , true )
434- }
435- : { } )
424+ h ( 'span' , {
425+ key : `br${ item . code || index } ` ,
426+ class : [ 'vxe-button--item' , toolbarButtonClassName ? ( XEUtils . isFunction ( toolbarButtonClassName ) ? toolbarButtonClassName ( params ) : toolbarButtonClassName ) : '' ]
427+ } , getSlotVNs ( compConf . renderToolbarButton ( buttonRender , params ) ) )
436428 )
429+ } else {
430+ if ( VxeUIButtonComponent ) {
431+ btnVNs . push (
432+ h ( VxeUIButtonComponent , {
433+ key : `bd${ item . code || index } ` ,
434+ ...Object . assign ( { } , item , {
435+ content : item . content || item . name ,
436+ options : undefined
437+ } ) ,
438+ onClick : ( eventParams ) => btnEvent ( eventParams , item )
439+ } , dropdowns && dropdowns . length
440+ ? {
441+ dropdowns : ( ) => renderDropdowns ( item , true )
442+ }
443+ : { } )
444+ )
445+ }
437446 }
438447 }
439- }
440- } )
448+ } )
449+ }
450+ lbVNs . push (
451+ h ( 'span' , {
452+ key : 'tti' ,
453+ class : 'vxe-button--item-wrapper'
454+ } , buttonsSlot ? getSlotVNs ( buttonsSlot ( { buttons : buttons || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) : btnVNs )
455+ )
441456 }
442457 if ( buttonSuffixSlot ) {
443- btnVNs . push ( ...getSlotVNs ( buttonSuffixSlot ( { buttons : buttons || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
444- }
445- return btnVNs
458+ lbVNs . push (
459+ h ( 'span' , {
460+ key : 'tbs' ,
461+ class : 'vxe-button--suffix-wrapper'
462+ } , getSlotVNs ( buttonSuffixSlot ( { buttons : buttons || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
463+ )
464+ }
465+ return lbVNs
446466 }
447467
448468 /**
@@ -452,52 +472,72 @@ export default defineVxeComponent({
452472 const { tools } = props
453473 const { connectTable } = internalData
454474 const $table = connectTable
475+ const toolsSlot = slots . tools
455476 const toolPrefixSlot = slots . toolPrefix || slots [ 'tool-prefix' ]
456477 const toolSuffixSlot = slots . toolSuffix || slots [ 'tool-suffix' ]
457- const btnVNs : VxeComponentSlotType [ ] = [ ]
478+ const rtVNs : VxeComponentSlotType [ ] = [ ]
458479 if ( toolPrefixSlot ) {
459- btnVNs . push ( ...getSlotVNs ( toolPrefixSlot ( { tools : tools || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
460- }
461- if ( tools ) {
462- tools . forEach ( ( item , tIndex ) => {
463- const { dropdowns, toolRender } = item
464- if ( item . visible !== false ) {
465- const rdName = toolRender ? toolRender . name : null
466- const compConf = toolRender ? renderer . get ( rdName ) : null
467- if ( toolRender && compConf && compConf . renderToolbarTool ) {
468- const toolbarToolClassName = compConf . toolbarToolClassName
469- const params = { $grid : $xeGrid , $gantt : $xeGantt , $table : $table ! , tool : item }
470- btnVNs . push (
471- h ( 'span' , {
472- key : rdName as string ,
473- class : [ 'vxe-tool--item' , toolbarToolClassName ? ( XEUtils . isFunction ( toolbarToolClassName ) ? toolbarToolClassName ( params ) : toolbarToolClassName ) : '' ]
474- } , getSlotVNs ( compConf . renderToolbarTool ( toolRender , params ) ) )
475- )
476- } else {
477- if ( VxeUIButtonComponent ) {
480+ rtVNs . push (
481+ h ( 'span' , {
482+ key : 'ttp' ,
483+ class : 'vxe-tool--prefix-wrapper'
484+ } , getSlotVNs ( toolPrefixSlot ( { tools : tools || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
485+ )
486+ }
487+ if ( tools || toolsSlot ) {
488+ const btnVNs : VxeComponentSlotType [ ] = [ ]
489+ if ( tools ) {
490+ tools . forEach ( ( item , tIndex ) => {
491+ const { dropdowns, toolRender } = item
492+ if ( item . visible !== false ) {
493+ const rdName = toolRender ? toolRender . name : null
494+ const compConf = toolRender ? renderer . get ( rdName ) : null
495+ if ( toolRender && compConf && compConf . renderToolbarTool ) {
496+ const toolbarToolClassName = compConf . toolbarToolClassName
497+ const params = { $grid : $xeGrid , $gantt : $xeGantt , $table : $table ! , tool : item }
478498 btnVNs . push (
479- h ( VxeUIButtonComponent , {
480- key : tIndex ,
481- ...Object . assign ( { } , item , {
482- content : item . content || item . name ,
483- options : undefined
484- } ) ,
485- onClick : ( eventParams ) => tolEvent ( eventParams , item )
486- } , dropdowns && dropdowns . length
487- ? {
488- dropdowns : ( ) => renderDropdowns ( item , false )
489- }
490- : { } )
499+ h ( 'span' , {
500+ key : rdName as string ,
501+ class : [ 'vxe-tool--item' , toolbarToolClassName ? ( XEUtils . isFunction ( toolbarToolClassName ) ? toolbarToolClassName ( params ) : toolbarToolClassName ) : '' ]
502+ } , getSlotVNs ( compConf . renderToolbarTool ( toolRender , params ) ) )
491503 )
504+ } else {
505+ if ( VxeUIButtonComponent ) {
506+ btnVNs . push (
507+ h ( VxeUIButtonComponent , {
508+ key : tIndex ,
509+ ...Object . assign ( { } , item , {
510+ content : item . content || item . name ,
511+ options : undefined
512+ } ) ,
513+ onClick : ( eventParams ) => tolEvent ( eventParams , item )
514+ } , dropdowns && dropdowns . length
515+ ? {
516+ dropdowns : ( ) => renderDropdowns ( item , false )
517+ }
518+ : { } )
519+ )
520+ }
492521 }
493522 }
494- }
495- } )
523+ } )
524+ }
525+ rtVNs . push (
526+ h ( 'span' , {
527+ key : 'tti' ,
528+ class : 'vxe-tool--item-wrapper'
529+ } , toolsSlot ? getSlotVNs ( toolsSlot ( { tools : tools || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) : btnVNs )
530+ )
496531 }
497532 if ( toolSuffixSlot ) {
498- btnVNs . push ( ...getSlotVNs ( toolSuffixSlot ( { tools : tools || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
499- }
500- return btnVNs
533+ rtVNs . push (
534+ h ( 'span' , {
535+ key : 'tts' ,
536+ class : 'vxe-tool--suffix-wrapper'
537+ } , getSlotVNs ( toolSuffixSlot ( { tools : tools || [ ] , $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) ) )
538+ )
539+ }
540+ return rtVNs
501541 }
502542
503543 const renderToolImport = ( ) => {
@@ -597,11 +637,7 @@ export default defineVxeComponent({
597637
598638 const renderVN = ( ) => {
599639 const { perfect, loading, refresh, zoom, custom, className } = props
600- const { connectTable } = internalData
601640 const vSize = computeSize . value
602- const toolsSlot = slots . tools
603- const buttonsSlot = slots . buttons
604- const $table = connectTable
605641
606642 return h ( 'div' , {
607643 ref : refElem ,
@@ -613,10 +649,10 @@ export default defineVxeComponent({
613649 } , [
614650 h ( 'div' , {
615651 class : 'vxe-buttons--wrapper'
616- } , buttonsSlot ? buttonsSlot ( { $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) : renderLeftBtns ( ) ) ,
652+ } , renderLeftBtns ( ) ) ,
617653 h ( 'div' , {
618654 class : 'vxe-tools--wrapper'
619- } , toolsSlot ? toolsSlot ( { $grid : $xeGrid , $gantt : $xeGantt , $table : $table } ) : renderRightTools ( ) ) ,
655+ } , renderRightTools ( ) ) ,
620656 h ( 'div' , {
621657 class : 'vxe-tools--operate'
622658 } , [
0 commit comments