Skip to content

Commit a6df163

Browse files
authored
Merge pull request #32 from vue-pivottable/feat/filterbox-count
Feat/filterbox count
2 parents e591891 + de99fdb commit a6df163

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/components/pivottable-ui/VFilterBox.vue

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div
33
class="pvtFilterBox"
4-
:style="{ display: block, cursor: initial, zIndex: props.zIndex}"
4+
:style="{ display: 'block', cursor: 'initial', zIndex: props.zIndex}"
55
@click="moveFilterBoxToTop"
66
>
77
<div
@@ -51,7 +51,8 @@
5151
type="checkbox"
5252
:checked="!(x in unselectedValues)"
5353
>
54-
<template v-html="x"></template>
54+
{{ x }}
55+
<span>({{ filterBoxValues[x] }})</span>
5556
<a
5657
class="pvtOnly"
5758
@click="selectOnly($event, x)"
@@ -68,10 +69,8 @@
6869
</template>
6970

7071
<script setup>
71-
import { ref, computed, inject } from 'vue'
72-
const sorters = inject('sorters')
73-
const menuLimit = inject('menuLimit')
74-
const localeStrings = inject('localeStrings')
72+
import { ref, computed } from 'vue'
73+
import { useProvideFilterBox } from '../../composables'
7574
const props = defineProps({
7675
unselectedFilterValues: {
7776
type: Object,
@@ -90,10 +89,12 @@ const props = defineProps({
9089
default: () => ({})
9190
}
9291
})
92+
const { localeStrings, sorter, menuLimit } = useProvideFilterBox()
93+
console.log(localeStrings)
9394
const filterBoxValuesList = Object.keys(props.filterBoxValues)
9495
const filterText = ref('')
9596
const showMenu = ref(filterBoxValuesList.length < menuLimit)
96-
const sortedList = [...filterBoxValuesList].sort(sorters(props.filterBoxKey))
97+
const sortedList = [...filterBoxValuesList].sort(sorter(props.filterBoxKey))
9798
const filteredList = computed(() => sortedList.filter(matchesFilter))
9899
const unselectedValues = ref(props.unselectedFilterValues)
99100
const emit = defineEmits([

src/composables/useProvideFilterbox.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { getSort } from '../helper/utilities'
33
const filterBoxKey = Symbol('filterBox')
44

55
export function provideFilterBox (props) {
6-
const localeStrings = props.languagePack[props.locale]
6+
const localeStrings = props.languagePack[props.locale].localeStrings
77
const sorter = (x) => getSort(props.sorters, x)
88
const menuLimit = props.menuLimit
99

0 commit comments

Comments
 (0)