MCPcopy
hub / github.com/vuetifyjs/vuetify / setup

Function setup

packages/vuetify/src/labs/VHeatmap/VHeatmap.tsx:92–275  ·  view source on GitHub ↗
(props, { slots })

Source from the content-addressed store, hash-verified

90 props: makeVHeatmapProps(),
91
92 setup (props, { slots }) {
93 const { themeClasses } = provideTheme(props)
94 const {
95 rows,
96 rowItems,
97 groups,
98 hasExplicitColumns,
99 cellWidth,
100 cellHeight,
101 gap,
102 cellStep,
103 rowStep,
104 totalWidth,
105 totalHeight,
106 bucketColors,
107 linearColors,
108 colorSpaceClass,
109 bucketBoundaries,
110 } = useHeatmap(props)
111
112 const activeBuckets = ref<number[]>([])
113
114 const colorProperties = computed(() => {
115 const style: CSSProperties = {}
116 const buckets = bucketColors.value
117 const linear = linearColors.value
118
119 for (let i = 0; i < buckets.length; i++) {
120 style[`--v-heatmap-color-bucket-${i}`] = buckets[i]
121 }
122
123 if (linear) {
124 style['--v-heatmap-color-start'] = linear.from
125 style['--v-heatmap-color-end'] = linear.to
126 }
127
128 return style
129 })
130
131 watch(bucketBoundaries, val => {
132 activeBuckets.value = val.map((_, i) => i)
133 }, { immediate: true })
134
135 function toggle (index: number) {
136 const position = activeBuckets.value.indexOf(index)
137
138 if (position >= 0) activeBuckets.value.splice(position, 1)
139 else activeBuckets.value.push(index)
140 }
141
142 function isDisabled (cell: HeatmapCell) {
143 if (cell.bucketIndex < 0) return false
144 return !activeBuckets.value.includes(cell.bucketIndex)
145 }
146
147 useRender(() => {
148 const radius = convertToUnit(props.rounded)
149 const hasGroupLabels = !props.hideColumnHeaders && (!!slots['group-header'] || groups.value.some(group => group.label))

Callers

nothing calls this directly

Calls 6

provideThemeFunction · 0.90
useHeatmapFunction · 0.90
refFunction · 0.90
useRenderFunction · 0.90
convertToUnitFunction · 0.90
isDisabledFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…