Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .changeset/fix-empty-rows-cols-rendering.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"vue-pivottable": patch
---

fix: rows/cols가 비어있을 때 Vue2와 동일하게 렌더링되도록 수정

- 디버그용 console.log 코드 제거
- rows/cols가 모두 비어있을 때도 테이블 구조와 총계가 표시되도록 수정
- rowAttrs가 비어있을 때 헤더에 빈 행이 추가되는 문제 해결
- Vue2의 렌더링 동작과 완전히 일치하도록 조건부 렌더링 로직 개선
2 changes: 1 addition & 1 deletion src/components/pivottable-ui/VDragAndDropCell.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<Draggable
v-if="showDraggable && modelItems.length > 0"
v-if="showDraggable"
tag="td"
:list="modelItems"
:group="{ name: 'shared', pull: true, put: true }"
Expand Down
6 changes: 3 additions & 3 deletions src/components/pivottable/VPivottableBody.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<tbody v-if="pivotData">
<tbody>
<VPivottableBodyRows
v-if="rowKeys.length > 0"
:row-keys="rowKeys"
:col-keys="colKeys"
:show-row-total="showRowTotal"
Expand Down Expand Up @@ -31,6 +32,5 @@ type Props = Pick<

defineProps<Props>()

const { pivotData, rowKeys, colKeys, rowAttrs, colAttrs } =
useProvidePivotData()
const { rowKeys, colKeys, rowAttrs, colAttrs } = useProvidePivotData()
</script>
1 change: 0 additions & 1 deletion src/components/pivottable/VPivottableBodyRows.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ type VPivottableBodyRowsProps = Pick<
}

const props = defineProps<VPivottableBodyRowsProps>()

const {
pivotData,
spanSize,
Expand Down
5 changes: 3 additions & 2 deletions src/components/pivottable/VPivottableBodyRowsTotalRow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<tr v-if="showColTotal">
<tr v-if="showColTotal || (colKeys.length === 0 && rowKeys.length === 0)">
<th
class="pvtTotalLabel"
:colSpan="rowAttrs.length + (colAttrs.length === 0 ? 0 : 1)"
Expand All @@ -18,7 +18,7 @@
{{ getAggregator([], colKey).format(getAggregator([], colKey).value()) }}
</td>
<td
v-if="showRowTotal"
v-if="showRowTotal || (colKeys.length === 0 && rowKeys.length === 0)"
class="pvtGrandTotal"
@click="handleCellClick(grandTotalValue, [], [])($event)"
>
Expand All @@ -45,6 +45,7 @@ const {
colAttrs,
rowAttrs,
colKeys,
rowKeys,
pivotData
} = useProvidePivotData()

Expand Down
4 changes: 2 additions & 2 deletions src/components/pivottable/VPivottableHeader.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<thead v-if="pivotData">
<thead>
<tr
v-for="(c, j) in colAttrs"
:key="`colAttrs${j}`"
Expand Down Expand Up @@ -46,5 +46,5 @@ type Props = Pick<DefaultPropsType, 'showRowTotal' | 'languagePack'>

defineProps<Props>()

const { pivotData, colAttrs, rowAttrs, colKeys } = useProvidePivotData()
const { colAttrs, rowAttrs, colKeys } = useProvidePivotData()
</script>