Skip to content

Commit 97cdf74

Browse files
Seungwoo321claude
andcommitted
fix: resolve VuePivottable required props and type issues
- Make aggregatorName, renderers, rendererName optional in DefaultPropsType - Add proper defaults in VPivottable component - Fix TSVExportRenderers to handle undefined aggregatorName - Resolve Vue warn messages for missing required props Fixes missing required props warnings when using VuePivottable 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 3842dc1 commit 97cdf74

File tree

5 files changed

+29
-9
lines changed

5 files changed

+29
-9
lines changed

src/SImpleApp.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div id="app">
3+
<VuePivottable
4+
:data="[
5+
{ color: 'blue', shape: 'circle' },
6+
{ color: 'red', shape: 'triangle' }
7+
]"
8+
:rows="['color']"
9+
:cols="['shape']"
10+
/>
11+
</div>
12+
</template>
13+
14+
<script setup>
15+
import { VuePivottable } from './index.ts'
16+
import 'vue-pivottable/dist/vue-pivottable.css'
17+
</script>
18+
19+
<style scoped></style>

src/components/pivottable/VPivottable.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { aggregators, locales } from '@/helper'
1414
const props = withDefaults(defineProps<DefaultPropsType>(), {
1515
aggregators: () => aggregators,
1616
aggregatorName: 'Count',
17+
renderers: () => TableRenderer,
1718
rendererName: 'Table',
1819
rowOrder: 'key_a_to_z',
1920
colOrder: 'key_a_to_z',
@@ -29,6 +30,6 @@ const props = withDefaults(defineProps<DefaultPropsType>(), {
2930
})
3031
3132
const rendererComponent = computed(
32-
() => props.renderers[props.rendererName] || TableRenderer.Table
33+
() => (props.renderers || TableRenderer)[props.rendererName || 'Table'] || TableRenderer.Table
3334
)
3435
</script>

src/components/pivottable/renderer/TSVExportRenderers.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const headerRow = computed(() => {
2727
const header = [...pivotData.value.props.rows]
2828
2929
if (colKeys.value.length === 1 && colKeys.value[0].length === 0) {
30-
header.push(props.aggregatorName)
30+
header.push(props.aggregatorName || 'Count')
3131
} else {
3232
colKeys.value.forEach((c: any[]) => header.push(c.join('-')))
3333
}

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { createApp } from 'vue'
22

33
// import App from './App.vue'
4-
import MemoeryTestApp from './MemoeryTestApp.vue'
4+
import SimpleApp from './SimpleApp.vue'
55
// import VuePivottable from '@/'
66

7-
const app = createApp(MemoeryTestApp)
7+
const app = createApp(SimpleApp)
88

99
// app.component('VuePivottableUi', VuePivottableUi)
1010

src/types/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ export interface RendererDefinition {
1313
export interface DefaultPropsType {
1414
data: any
1515
aggregators?: Record<string, AggregatorTemplate>
16-
aggregatorName: string
16+
aggregatorName?: string
1717
heatmapMode?: 'full' | 'col' | 'row' | ''
1818
tableColorScaleGenerator?: (...args: any[]) => any
1919
tableOptions?: Record<string, any>
20-
renderers: Record<string, RendererDefinition>
21-
rendererName: string
20+
renderers?: Record<string, RendererDefinition>
21+
rendererName?: string
2222
locale?: string
2323
languagePack?: Record<string, Locale>
2424
showRowTotal?: boolean
2525
showColTotal?: boolean
26-
cols: string[]
27-
rows: string[]
26+
cols?: string[]
27+
rows?: string[]
2828
vals?: string[]
2929
attributes?: string[]
3030
valueFilter?: Record<string, any>

0 commit comments

Comments
 (0)