131131 </table >
132132</template >
133133
134- <script setup>
135- import { defaultProps , PivotData , sortAs } from ' @/helper'
134+ <script setup lang="ts" >
135+ import { aggregators , PivotData , sortAs } from ' @/helper'
136136import VRendererCell from ' ./VRendererCell.vue'
137137import VAggregatorCell from ' ./VAggregatorCell.vue'
138138import VDragAndDropCell from ' ./VDragAndDropCell.vue'
139139import VPivottable from ' ../pivottable/VPivottable.vue'
140- import TableRenderer from ' ../pivottable/renderer/index'
141140import { computed , watch } from ' vue'
142141import {
143142 usePropsState ,
144143 useMaterializeInput ,
145144 usePivotUiState ,
146145 provideFilterBox
147146} from ' @/composables'
147+ import { DefaultPropsType } from ' @/types'
148148
149- const props = defineProps ({
150- ... defaultProps,
151- hiddenAttributes: {
152- type: Array ,
153- default : () => []
154- },
155- hiddenFromAggregators: {
156- type: Array ,
157- default : () => []
158- },
159- hiddenFromDragDrop: {
160- type: Array ,
161- default : () => []
162- },
163- restrictedFromDragDrop: {
164- type: Array ,
165- default : () => []
166- },
167- menuLimit: {
168- type: Number ,
169- default: 500
170- },
171- pivotModel: {
172- type: Object ,
173- default : () => ({})
174- },
175- hideFilterBoxOfUnusedAttributes: {
176- type: Boolean ,
177- default: false
149+ const props = withDefaults (
150+ defineProps <
151+ DefaultPropsType & {
152+ hiddenAttributes?: string []
153+ hiddenFromAggregators ?: string []
154+ hiddenFromDragDrop ?: string []
155+ restrictedFromDragDrop ?: string []
156+ menuLimit ?: number
157+ pivotModel ?: any
158+ hideFilterBoxOfUnusedAttributes ?: boolean
159+ }
160+ > (),
161+ {
162+ aggregators : () => aggregators ,
163+ hiddenAttributes : () => [],
164+ hiddenFromAggregators : () => [],
165+ hiddenFromDragDrop : () => [],
166+ restrictedFromDragDrop : () => [],
167+ menuLimit: 500 ,
168+ hideFilterBoxOfUnusedAttributes: false
178169 }
179- })
170+ )
171+
180172const {
181173 state,
182174 localeStrings,
@@ -205,7 +197,7 @@ const { allFilters, materializedInput } = useMaterializeInput(
205197)
206198
207199const rendererItems = computed (() =>
208- Object .keys (state .renderers ).length ? state .renderers : TableRenderer
200+ Object .keys (state .renderers ).length ? state .renderers : {}
209201)
210202const aggregatorItems = computed (() => state .aggregators )
211203const rowAttrs = computed (() => {
@@ -238,7 +230,7 @@ const unusedAttrs = computed(() => {
238230 ! state .hiddenAttributes .includes (e ) &&
239231 ! state .hiddenFromDragDrop .includes (e )
240232 )
241- .sort (sortAs (state .unusedOrder ))
233+ .sort (sortAs (pivotUiState .unusedOrder ))
242234})
243235
244236const pivotData = computed (() => new PivotData (state ))
@@ -264,12 +256,13 @@ const pivotProps = computed(() => ({
264256 rowOrder: state .rowOrder ,
265257 colOrder: state .colOrder ,
266258 tableMaxWidth: state .tableMaxWidth ,
267- localeStrings: localeStrings .value
259+ localeStrings: localeStrings .value ,
260+ menuLimit: props .menuLimit
268261}))
269262
270- onUpdateUnusedOrder (props . unusedAttrs )
263+ onUpdateUnusedOrder (unusedAttrs . value )
271264
272- provideFilterBox (props )
265+ provideFilterBox (pivotProps . value )
273266
274267watch (
275268 [allFilters , materializedInput ],
0 commit comments