|
7 | 7 | <slot |
8 | 8 | name="pvtAttr" |
9 | 9 | :attr-name="attributeName" |
10 | | - >{{ attributeName }}</slot> |
| 10 | + >{{ attributeName }}</slot |
| 11 | + > |
11 | 12 | <span |
12 | 13 | v-if="!hideDropDown" |
13 | 14 | @mousedown.stop |
|
23 | 24 | :filter-box-values="attributeValues" |
24 | 25 | :z-index="zIndex" |
25 | 26 | @mousedown.stop |
26 | | - @update:z-index-of-filter-box="$emit('update:zIndexOfFilterBox', $event)" |
| 27 | + @update:z-index-of-filter-box=" |
| 28 | + $emit('update:zIndexOfFilterBox', $event) |
| 29 | + " |
27 | 30 | @update:unselected-filter-values=" |
28 | 31 | $emit('update:unselectedFilterValues', $event) |
29 | 32 | " |
|
32 | 35 | </li> |
33 | 36 | </template> |
34 | 37 |
|
35 | | -<script setup> |
| 38 | +<script setup lang="ts"> |
36 | 39 | import VFilterBox from './VFilterBox.vue' |
37 | 40 | import { computed } from 'vue' |
38 | 41 |
|
39 | | -const emit = defineEmits([ |
40 | | - 'update:zIndexOfFilterBox', |
41 | | - 'update:unselectedFilterValues', |
42 | | - 'update:openStatusOfFilterBox' |
43 | | -]) |
| 42 | +const emit = defineEmits<{ |
| 43 | + (event: 'update:zIndexOfFilterBox', attributeName: string): void |
| 44 | + ( |
| 45 | + event: 'update:unselectedFilterValues', |
| 46 | + payload: { key: string; value: Record<string, boolean> } |
| 47 | + ): void |
| 48 | + ( |
| 49 | + event: 'update:openStatusOfFilterBox', |
| 50 | + payload: { key: string; value: boolean } |
| 51 | + ): void |
| 52 | +}>() |
44 | 53 |
|
45 | | -const props = defineProps({ |
46 | | - attributeName: { |
47 | | - type: String, |
48 | | - required: true |
49 | | - }, |
50 | | - attributeValues: { |
51 | | - type: Object, |
52 | | - default: () => ({}) |
53 | | - }, |
54 | | - restricted: { |
55 | | - type: Boolean, |
56 | | - default: false |
57 | | - }, |
58 | | - open: { |
59 | | - type: Boolean, |
60 | | - default: false |
61 | | - }, |
62 | | - unselectedFilterValues: { |
63 | | - type: Object, |
64 | | - default: () => ({}) |
65 | | - }, |
66 | | - zIndex: { |
67 | | - default: 1000, |
68 | | - type: Number |
69 | | - }, |
70 | | - hideDropDownForUnused: { |
71 | | - type: Boolean, |
72 | | - default: false |
73 | | - } |
| 54 | +interface DraggableAttributeProps { |
| 55 | + attributeName: string |
| 56 | + attributeValues?: Record<string, number> |
| 57 | + restricted?: boolean |
| 58 | + open?: boolean |
| 59 | + unselectedFilterValues?: Record<string, boolean> |
| 60 | + zIndex?: number |
| 61 | + hideDropDownForUnused?: boolean |
| 62 | +} |
| 63 | +
|
| 64 | +const props = withDefaults(defineProps<DraggableAttributeProps>(), { |
| 65 | + attributeValues: () => ({}), |
| 66 | + restricted: false, |
| 67 | + open: false, |
| 68 | + unselectedFilterValues: () => ({}), |
| 69 | + zIndex: 1000, |
| 70 | + hideDropDownForUnused: false |
74 | 71 | }) |
75 | 72 |
|
76 | 73 | const toggleFilterBox = () => { |
|
0 commit comments