|
|
@@ -1,30 +1,49 @@
|
|
|
<template>
|
|
|
- <div :style="styleMap?.mainStyle" class="w-full h-full box-border flex flex-col overflow-hidden relative">
|
|
|
- <ImageBg v-if="styleMap?.mainStyle?.imageSrc" :src="styleMap?.mainStyle?.imageSrc"
|
|
|
- :image-color-style="styleMap?.mainStyle?.imageStyle" />
|
|
|
- <div v-for="(row, index) in group || []" :key="index" class="flex-1 w-full flex items-center"
|
|
|
- :style="{ columnGap: styleMap?.mainStyle?.columnGap }">
|
|
|
- <div class="h-full flex items-center justify-center overflow-hidden whitespace-pre! relative"
|
|
|
- v-for="(item, index) in row || []" :key="`${index}-${index}`" :style="{
|
|
|
+ <div
|
|
|
+ :style="styleMap?.mainStyle"
|
|
|
+ class="w-full h-full box-border flex flex-col overflow-hidden relative"
|
|
|
+ >
|
|
|
+ <ImageBg
|
|
|
+ v-if="styleMap?.mainStyle?.imageSrc"
|
|
|
+ :src="styleMap?.mainStyle?.imageSrc"
|
|
|
+ :image-color-style="styleMap?.mainStyle?.imageStyle"
|
|
|
+ />
|
|
|
+ <div
|
|
|
+ v-for="(row, index) in resolvedGroup"
|
|
|
+ :key="index"
|
|
|
+ class="flex-1 w-full flex items-center"
|
|
|
+ :style="{ columnGap: styleMap?.mainStyle?.columnGap }"
|
|
|
+ >
|
|
|
+ <div
|
|
|
+ class="h-full flex items-center justify-center overflow-hidden whitespace-pre! relative"
|
|
|
+ v-for="(item, index) in row || []"
|
|
|
+ :key="`${index}-${index}`"
|
|
|
+ :style="{
|
|
|
...(isCustom ? getBtnStyle(item) || styleMap?.itemsStyle : styleMap?.itemsStyle),
|
|
|
...getBtnFlex(
|
|
|
item.width,
|
|
|
row.map((item) => item.width)
|
|
|
)
|
|
|
- }">
|
|
|
- <ImageBg v-if="getBtnStyle(item)?.imageSrc" :src="getBtnStyle(item)?.imageSrc"
|
|
|
- :image-color-style="getBtnStyle(item)?.imageStyle" />
|
|
|
- <span class="z-2">{{ item.text }}</span>
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <ImageBg
|
|
|
+ v-if="getBtnStyle(item)?.imageSrc"
|
|
|
+ :src="getBtnStyle(item)?.imageSrc"
|
|
|
+ :image-color-style="getBtnStyle(item)?.imageStyle"
|
|
|
+ />
|
|
|
+ <span class="z-2" :style="item.resolvedStyle" v-html="item.resolvedText.text"></span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
+import { computed } from 'vue'
|
|
|
import { useWidgetStyle, getStyle } from '../hooks/useWidgetStyle'
|
|
|
import { ButtonItem } from './data'
|
|
|
import { isEmpty, assign } from 'lodash-es'
|
|
|
import { useProjectStore } from '@/store/modules/project'
|
|
|
+import { useLanguage } from '../hooks/useLanguage'
|
|
|
|
|
|
import ImageBg from '../ImageBg.vue'
|
|
|
|
|
|
@@ -41,6 +60,16 @@ const styleMap = useWidgetStyle({
|
|
|
widget: 'lv_buttonmatrix',
|
|
|
props
|
|
|
})
|
|
|
+const { resolveText, getResolvedFontStyle } = useLanguage()
|
|
|
+const resolvedGroup = computed(() =>
|
|
|
+ (props.group || []).map((row) =>
|
|
|
+ (row || []).map((item) => ({
|
|
|
+ ...item,
|
|
|
+ resolvedText: resolveText(item?.text, true),
|
|
|
+ resolvedStyle: getResolvedFontStyle(item?.text)
|
|
|
+ }))
|
|
|
+ )
|
|
|
+)
|
|
|
|
|
|
const projectStore = useProjectStore()
|
|
|
|