@dative-gpi/foundation-shared-components 1.0.135 → 1.0.136-fat-status-card

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.
@@ -0,0 +1,111 @@
1
+ <template>
2
+ <FSCard
3
+ v-if="$props.modelStatus"
4
+ class="fs-status-fat-card"
5
+ padding="12px"
6
+ height="100px"
7
+ width="140px"
8
+ :style="style"
9
+ >
10
+ <FSCol
11
+ align="center-center"
12
+ >
13
+ <FSIcon
14
+ v-if="icon"
15
+ :color="color"
16
+ >
17
+ {{ icon }}
18
+ </FSIcon>
19
+ <FSText>
20
+ {{ title }}
21
+ </FSText>
22
+ <FSText
23
+ v-if="value"
24
+ :color="color"
25
+ >
26
+ {{ value }}
27
+ </FSText>
28
+ </FSCol>
29
+ </FSCard>
30
+ </template>
31
+
32
+ <script lang="ts">
33
+ import { computed, defineComponent, type PropType, type StyleValue } from "vue";
34
+
35
+ import { ColorEnum, type FSDeviceStatusGroup, type FSModelStatus } from "@dative-gpi/foundation-shared-components/models";
36
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
37
+
38
+ import FSCard from "../FSCard.vue";
39
+ import FSIcon from "../FSChip.vue";
40
+ import FSText from "../FSText.vue";
41
+ import FSCol from "../FSCol.vue";
42
+
43
+ export default defineComponent({
44
+ name: "FSStatusFatCard",
45
+ components: {
46
+ FSCard,
47
+ FSIcon,
48
+ FSText,
49
+ FSCol
50
+ },
51
+ props: {
52
+ title: {
53
+ type: String,
54
+ required: true
55
+ },
56
+ background: {
57
+ type: Boolean,
58
+ required: false
59
+ },
60
+ modelStatus: {
61
+ type: Object as PropType<FSModelStatus | undefined>,
62
+ required: true
63
+ },
64
+ statusGroup: {
65
+ type: Object as PropType<FSDeviceStatusGroup | undefined>,
66
+ required: true
67
+ }
68
+ },
69
+ setup(props) {
70
+ const { getColors } = useColors();
71
+
72
+ const color = computed((): string => {
73
+ return props.statusGroup?.color ?? props.modelStatus?.colorDefault ?? ColorEnum.Primary;
74
+ });
75
+
76
+ const icon = computed((): string | null => {
77
+ return props.statusGroup?.icon ?? props.modelStatus?.iconDefault ?? null;
78
+ });
79
+
80
+ const title = computed((): string => {
81
+ return props.title ?? props.modelStatus?.label;
82
+ });
83
+
84
+ const value = computed((): string | null => {
85
+ if (props.statusGroup?.label) {
86
+ return props.statusGroup.label;
87
+ }
88
+ if (props.statusGroup?.value && !isNaN(parseFloat(props.statusGroup?.value))) {
89
+ return `${parseFloat(props.statusGroup.value).toLocaleString("fullwide", { maximumFractionDigits: 2 })} ${props.statusGroup.unit}`;
90
+ }
91
+ if (props.statusGroup?.value) {
92
+ return `${props.statusGroup?.value} ${props.statusGroup?.unit}`;
93
+ }
94
+ return null;
95
+ });
96
+
97
+ const style = computed((): StyleValue => ({
98
+ "--fs-status-fat-card-background-color": props.background ? getColors(color.value).light : "transparent",
99
+ "--fs-status-fat-card-border-color": props.background ? getColors(color.value).base : getColors(ColorEnum.Light).dark
100
+ }));
101
+
102
+ return {
103
+ color,
104
+ style,
105
+ title,
106
+ value,
107
+ icon
108
+ };
109
+ }
110
+ });
111
+ </script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.135",
4
+ "version": "1.0.136-fat-status-card",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "1.0.135",
14
- "@dative-gpi/foundation-shared-services": "1.0.135"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.136-fat-status-card",
14
+ "@dative-gpi/foundation-shared-services": "1.0.136-fat-status-card"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "a8b8d2c285134ca72edf1bb0d3e224815f04c131"
38
+ "gitHead": "7e0a7db4bf5306f12c0850b4362e409f0bee13c0"
39
39
  }
@@ -0,0 +1,5 @@
1
+ .fs-status-fat-card {
2
+ flex-grow: 1;
3
+ background-color: var(--fs-status-fat-card-background-color);
4
+ border-color: var(--fs-status-fat-card-border-color);
5
+ }
@@ -55,6 +55,7 @@
55
55
  @import "fs_slide_group.scss";
56
56
  @import "fs_slider.scss";
57
57
  @import "fs_span.scss";
58
+ @import "fs_status_fat_card.scss";
58
59
  @import "fs_switch.scss";
59
60
  @import "fs_tag.scss";
60
61
  @import "fs_tabs.scss";