-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(KtTable): use composition API for Table*Cell files
- Loading branch information
Showing
14 changed files
with
243 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/kotti-ui/source/kotti-table/components/TableBodyEmptyRow.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 37 additions & 15 deletions
52
packages/kotti-ui/source/kotti-table/components/TableHeaderCell.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,41 @@ | ||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
|
||
import type { CreateElement, VNode } from 'vue' | ||
import { defineComponent, h } from 'vue' | ||
import type { PropType } from 'vue' | ||
import type { KottiTable } from '../types' | ||
|
||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
export const TableHeaderCell = { | ||
export const TableHeaderCell = defineComponent({ | ||
name: 'TableHeaderCell', | ||
functional: true, | ||
props: ['column', 'columnIndex'], | ||
render(h: CreateElement, context: any): VNode { | ||
const { column, columnIndex } = context.props | ||
return column.renderHeader(h, { | ||
column, | ||
value: column.label, | ||
columnIndex, | ||
}) | ||
props: { | ||
column: { | ||
required: true, | ||
type: Object as PropType<KottiTable.Column.PropsInternal>, | ||
}, | ||
columnIndex: { | ||
required: true, | ||
type: Number, | ||
}, | ||
}, | ||
setup(props) { | ||
return () => | ||
h( | ||
'div', | ||
{ | ||
class: [ | ||
'kt-table__cell', | ||
'kt-table__header-cell', | ||
props.column.headerCellClass, | ||
], | ||
attrs: { | ||
'data-prop': props.column.prop, | ||
}, | ||
}, | ||
[ | ||
props.column.renderHeader(h, { | ||
column: props.column, | ||
columnIndex: props.columnIndex, | ||
value: props.column.label, | ||
}), | ||
], | ||
) | ||
}, | ||
} | ||
}) |
Oops, something went wrong.