1- import { Component , Emit , h , OnBeforeRender , OnConnected , Prop , WuComponent } from '@wu-component/web-core-plus' ;
1+ import { Component , Emit , h , OnBeforeRender , OnConnected , Prop , WuComponent , Fragment } from '@wu-component/web-core-plus' ;
22import '@wu-component/wu-checkbox' ;
33import '@wu-component/wu-input' ;
44import css from './index.scss' ;
@@ -27,9 +27,9 @@ export class WuTable extends WuComponent implements OnConnected, OnBeforeRender
2727 * @private
2828 */
2929 private setFixedLeft ( ) {
30- if ( this . rootNode ) {
31- const fixedLeftEls = this . rootNode . querySelectorAll ( '.fixed-left' ) ;
32- const boxRect = this . rootNode . getBoundingClientRect ( ) ;
30+ if ( this . shadowRoot ) {
31+ const fixedLeftEls = this . shadowRoot . querySelectorAll ( '.fixed-left' ) ;
32+ const boxRect = this . shadowRoot . querySelector ( '.wu-table' ) . getBoundingClientRect ( ) ;
3333 fixedLeftEls . forEach ( ( fixedLeftEl : HTMLElement , index : number ) => {
3434 const rect = fixedLeftEl . getBoundingClientRect ( ) ;
3535 fixedLeftEl . style . left = rect . left - boxRect . left - 1 + 'px' ;
@@ -42,7 +42,7 @@ export class WuTable extends WuComponent implements OnConnected, OnBeforeRender
4242 * @private
4343 */
4444 private setFixedRight ( ) {
45- if ( this . rootNode ) {
45+ if ( this . shadowRoot ) {
4646 const fixedRightEls = this . shadowRoot . querySelectorAll ( '.fixed-right' ) ;
4747 fixedRightEls . forEach ( ( fixedRightEl : HTMLElement , index : number ) => {
4848 fixedRightEl . style . right = '0px' ;
@@ -186,7 +186,9 @@ export class WuTable extends WuComponent implements OnConnected, OnBeforeRender
186186 }
187187
188188 public override render ( _renderProps = { } , _store = { } ) {
189- if ( ! this . columns . length ) return ;
189+ if ( ! this . columns . length ) {
190+ return < Fragment > </ Fragment > ;
191+ }
190192 if ( this . fixedRight ) {
191193 this . columns [ this . columns . length - 1 ] . fixed = true ;
192194 }
@@ -223,6 +225,7 @@ export class WuTable extends WuComponent implements OnConnected, OnBeforeRender
223225 'wu-table-column-selection' : column . type && column . selection === 'selection' ,
224226 } ) }
225227 >
228+ { /*@ts -ignore*/ }
226229 < div class = "cell" > { column . type && column . type === 'selection' ? < wu-plus-checkbox checked = { false } { ...this . getCheckedState ( ) } onChange = { _ => this . changeHandlerTh ( _ , column , { isAllSelect : true } ) } /> : < div class = "cell" > { column . title } </ div > } </ div >
227230 </ th >
228231 ) ;
@@ -259,10 +262,12 @@ export class WuTable extends WuComponent implements OnConnected, OnBeforeRender
259262 >
260263 { column . type && column . type === 'selection' ? (
261264 < div class = "cell" >
265+ { /*@ts -ignore*/ }
262266 < wu-plus-checkbox checked = { item . checked } onChange = { _ => this . changeHandlerTd ( _ , item , { isAllSelect : false } ) } />
263267 </ div >
264268 ) : column . editable && item . editingKey === column . key ? (
265269 < div class = "cell" >
270+ { /*@ts -ignore*/ }
266271 < wu-plus-input ref = { _ => ( this . editingInput = _ ) } size = "mini" onChange = { evt => this . onChange ( evt , item , column ) } value = { item [ column . key ] } />
267272 </ div >
268273 ) : (
0 commit comments