mgv-backoffice 1.36.1 → 1.36.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mgv-backoffice",
3
- "version": "1.36.1",
3
+ "version": "1.36.2",
4
4
  "description": "Shared Vue 3 UI component library",
5
5
  "type": "module",
6
6
  "main": "./dist/ui-lib.umd.cjs",
@@ -1,16 +1,26 @@
1
1
  <template>
2
2
  <span v-if="hasDefaultSlot" :class="badgeClasses">
3
- <slot></slot>
3
+ <BadgeContent />
4
4
  </span>
5
5
  </template>
6
6
 
7
7
  <script lang="ts" setup>
8
- import { computed, useSlots } from 'vue'
8
+ import { computed, createTextVNode, Text, useSlots } from 'vue'
9
9
  import { ColorsEnums } from "../enums/ColorsEnums";
10
10
 
11
11
  const slots = useSlots()
12
12
  const hasDefaultSlot = computed(() => !!slots.default)
13
13
 
14
+ // Badge labels are often raw enum names (PROFIT_TARGET, RSI_REVERT); render
15
+ // their underscores as spaces so callers don't have to humanize at every call
16
+ // site. Only plain text nodes are rewritten — element children pass through.
17
+ const BadgeContent = () =>
18
+ (slots.default?.() ?? []).map((node) =>
19
+ node.type === Text && typeof node.children === 'string'
20
+ ? createTextVNode(node.children.replace(/_/g, ' '))
21
+ : node
22
+ )
23
+
14
24
  const props = defineProps({
15
25
  color: {
16
26
  type: String,