|
|
|
@ -1,11 +1,12 @@ |
|
|
|
import Component from './Component'; |
|
|
|
import { toLowerCase } from 'utils/mixins'; |
|
|
|
import { toLowerCase } from '../../utils/mixins'; |
|
|
|
|
|
|
|
const type = 'table'; |
|
|
|
|
|
|
|
export default class ComponentTable extends Component { |
|
|
|
get defaults() { |
|
|
|
return { |
|
|
|
// @ts-ignore
|
|
|
|
...super.defaults, |
|
|
|
type, |
|
|
|
tagName: type, |
|
|
|
@ -13,11 +14,13 @@ export default class ComponentTable extends Component { |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
initialize(o, opt) { |
|
|
|
Component.prototype.initialize.apply(this, arguments); |
|
|
|
const components = this.get('components'); |
|
|
|
initialize(props: any, opts: any) { |
|
|
|
super.initialize(props, opts); |
|
|
|
const components = this.get('components')!; |
|
|
|
!components.length && components.add({ type: 'tbody' }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ComponentTable.isComponent = el => toLowerCase(el.tagName) === type; |
|
|
|
static isComponent(el: HTMLElement) { |
|
|
|
return toLowerCase(el.tagName) === type; |
|
|
|
} |
|
|
|
} |