@dative-gpi/foundation-shared-components 1.0.142 → 1.0.143-onboarding

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.
@@ -1,132 +1,96 @@
1
1
  <template>
2
- <FSTile
2
+ <FSSimpleTileUI
3
3
  :activeColor="$props.color"
4
4
  :bottomColor="$props.color"
5
5
  :modelValue="$props.modelValue"
6
6
  :width="$props.width"
7
+ :label="$props.label"
8
+ :icon="$props.icon"
9
+ :code="$props.code"
7
10
  v-bind="$attrs"
8
11
  >
9
- <FSCol
10
- align="center-center"
11
- width="fill"
12
+ <template
13
+ #append-info
12
14
  >
13
- <FSRow
14
- align="center-left"
15
- gap="24px"
16
- :height="imageSize"
17
- :wrap="false"
15
+ <FSCol
16
+ gap="8px"
18
17
  >
19
- <FSCol
20
- gap="12px"
21
- :width="infoWidth"
18
+ <FSRow
19
+ v-if="$props.deviceCount"
20
+ :wrap="false"
21
+ align="center-left"
22
22
  >
23
- <FSCol
24
- gap="4px"
25
- >
26
- <FSSpan
27
- font="text-button"
28
- :lineClamp="1"
29
- >
30
- {{ $props.label }}
31
- </FSSpan>
32
- <FSSpan
33
- v-if="$props.code"
34
- font="text-overline"
35
- variant="soft"
36
- >
37
- {{ $props.code }}
38
- </FSSpan>
39
- </FSCol>
40
- <FSCol
41
- gap="8px"
23
+ <FSColor
24
+ width="24px"
25
+ height="24px"
26
+ :color="ColorEnum.Primary"
27
+ :border="false"
42
28
  >
43
29
  <FSRow
44
- v-if="$props.deviceCount"
45
- :wrap="false"
46
- align="center-left"
30
+ align="center-center"
47
31
  >
48
- <FSColor
49
- padding="0 8px"
50
- height="24px"
51
- :color="ColorEnum.Light"
52
- :border="false"
53
- >
54
- <FSRow
55
- align="center-center"
56
- >
57
- <FSSpan
58
- font="text-overline"
59
- >
60
- {{ $props.deviceCount <= 99 ? $props.deviceCount : "99+" }}
61
- </FSSpan>
62
- </FSRow>
63
- </FSColor>
64
32
  <FSSpan
65
33
  font="text-overline"
66
34
  >
67
- {{ $tr("ui.common.devices", "Equipment(s)") }}
35
+ {{ capNumberToString($props.deviceCount) }}
68
36
  </FSSpan>
69
37
  </FSRow>
38
+ </FSColor>
39
+ <FSSpan
40
+ font="text-overline"
41
+ >
42
+ {{ $tr("ui.common.devices", "Equipment(s)") }}
43
+ </FSSpan>
44
+ </FSRow>
45
+ <FSRow
46
+ v-if="$props.address"
47
+ :wrap="false"
48
+ align="center-left"
49
+ >
50
+ <FSColor
51
+ width="24px"
52
+ height="24px"
53
+ :color="ColorEnum.Primary"
54
+ :border="false"
55
+ >
70
56
  <FSRow
71
- v-if="$props.address"
72
- :wrap="false"
73
- align="center-left"
57
+ align="center-center"
74
58
  >
75
- <FSColor
76
- width="24px"
77
- height="24px"
78
- :color="ColorEnum.Light"
79
- :border="false"
80
- >
81
- <FSRow
82
- align="center-center"
83
- >
84
- <FSIcon
85
- icon="mdi-map-marker"
86
- size="16px"
87
- />
88
- </FSRow>
89
- </FSColor>
90
- <FSSpan
91
- font="text-overline"
92
- >
93
- {{ $props.address }}
94
- </FSSpan>
59
+ <FSIcon
60
+ icon="mdi-map-marker-radius-outline"
61
+ size="16px"
62
+ />
95
63
  </FSRow>
96
- </FSCol>
97
- </FSCol>
98
- <FSIconCard
99
- backgroundVariant="standard"
100
- :backgroundColor="ColorEnum.Background"
101
- :iconColor="$props.color"
102
- :icon="$props.icon"
103
- :size="imageSize"
104
- />
105
- </FSRow>
106
- </FSCol>
107
- </FSTile>
64
+ </FSColor>
65
+ <FSSpan
66
+ font="text-overline"
67
+ >
68
+ {{ $props.address }}
69
+ </FSSpan>
70
+ </FSRow>
71
+ </FSCol>
72
+ </template>
73
+ </FSSimpleTileUI>
108
74
  </template>
109
75
 
110
76
  <script lang="ts">
111
- import { computed, defineComponent, type PropType } from "vue";
77
+ import { defineComponent, type PropType } from "vue";
112
78
 
79
+ import { capNumberToString } from '@dative-gpi/foundation-shared-components/utils';
113
80
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
114
- import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
115
81
 
116
- import FSIconCard from "../FSIconCard.vue";
82
+ import FSSimpleTileUI from './FSSimpleTileUI.vue';
117
83
  import FSColor from "../FSColor.vue";
118
84
  import FSSpan from "../FSSpan.vue";
119
- import FSTile from "./FSTile.vue";
120
85
  import FSCol from "../FSCol.vue";
121
86
  import FSRow from "../FSRow.vue";
122
87
 
123
88
  export default defineComponent({
124
89
  name: "FSLocationTileUI",
125
90
  components: {
126
- FSIconCard,
91
+ FSSimpleTileUI,
127
92
  FSColor,
128
93
  FSSpan,
129
- FSTile,
130
94
  FSCol,
131
95
  FSRow
132
96
  },
@@ -172,20 +136,10 @@ export default defineComponent({
172
136
  }
173
137
  },
174
138
  setup() {
175
- const { isMobileSized } = useBreakpoints();
176
-
177
- const imageSize = computed((): number => {
178
- return isMobileSized.value ? 90 : 100;
179
- });
180
-
181
- const infoWidth = computed((): string => {
182
- return `calc(100% - ${imageSize.value}px - 24px)`;
183
- });
184
139
 
185
140
  return {
186
141
  ColorEnum,
187
- imageSize,
188
- infoWidth
142
+ capNumberToString
189
143
  };
190
144
  }
191
145
  });
@@ -17,21 +17,29 @@
17
17
  :wrap="false"
18
18
  >
19
19
  <FSCol
20
- gap="6px"
20
+ gap="12px"
21
21
  :width="infoWidth"
22
22
  >
23
- <FSSpan
24
- font="text-button"
25
- :lineClamp="2"
23
+ <FSCol
24
+ gap="4px"
26
25
  >
27
- {{ $props.label }}
28
- </FSSpan>
29
- <FSSpan
30
- font="text-overline"
31
- variant="soft"
32
- >
33
- {{ $props.code }}
34
- </FSSpan>
26
+ <FSSpan
27
+ font="text-button"
28
+ :lineClamp="2"
29
+ >
30
+ {{ $props.label }}
31
+ </FSSpan>
32
+ <FSSpan
33
+ font="text-overline"
34
+ variant="soft"
35
+ >
36
+ {{ $props.code }}
37
+ </FSSpan>
38
+ </FSCol>
39
+ <slot
40
+ name="append-info"
41
+ v-bind="$attrs"
42
+ />
35
43
  </FSCol>
36
44
  <FSImage
37
45
  v-if="$props.imageId"
@@ -78,7 +86,7 @@ export default defineComponent({
78
86
  },
79
87
  props: {
80
88
  imageId: {
81
- type: String as PropType<string>,
89
+ type: String as PropType<string | null>,
82
90
  required: false,
83
91
  default: null
84
92
  },
@@ -93,8 +101,9 @@ export default defineComponent({
93
101
  default: null
94
102
  },
95
103
  icon: {
96
- type: String as PropType<string>,
104
+ type: String as PropType<string | null>,
97
105
  required: false,
106
+ default: null
98
107
  },
99
108
  iconBackgroundVariant: {
100
109
  type: String as PropType<"background" | "standard" | "full" | "gradient">,
@@ -97,6 +97,7 @@ import FSCard from "../FSCard.vue";
97
97
 
98
98
  export default defineComponent({
99
99
  name: "FSTile",
100
+ inheritAttrs: false,
100
101
  components: {
101
102
  FSClickable,
102
103
  FSCheckbox,
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.142",
4
+ "version": "1.0.143-onboarding",
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.142",
14
- "@dative-gpi/foundation-shared-services": "1.0.142"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.143-onboarding",
14
+ "@dative-gpi/foundation-shared-services": "1.0.143-onboarding"
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": "36eca468f78075f88bb6638dbfdee9bdecf270ce"
38
+ "gitHead": "44c75a707aeddf8826add43b55f4971b91046b70"
39
39
  }
@@ -4,6 +4,7 @@
4
4
  padding: var(--fs-card-padding);
5
5
  height: var(--fs-card-height);
6
6
  width: var(--fs-card-width);
7
+ position: relative;
7
8
  display: flex;
8
9
 
9
10
  border-color: var(--fs-card-border-color);
@@ -21,4 +22,11 @@
21
22
  &-gradient {
22
23
  background: var(--fs-card-background-color);
23
24
  }
25
+
26
+ .fs-card-top-right {
27
+ position: absolute;
28
+ line-height: normal;
29
+ right: var(--fs-card-top-right-padding);
30
+ top: var(--fs-card-top-right-padding);
31
+ }
24
32
  }
@@ -1,6 +1,6 @@
1
1
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
2
2
  import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/enums";
3
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models"
3
+ import { ColorEnum } from "../models"
4
4
  import { getTimeBestString } from "../utils";
5
5
 
6
6
  const { $tr } = useTranslationsProvider();
@@ -20,13 +20,40 @@ export const AlertTools = {
20
20
  },
21
21
  statusLabel(value: AlertStatus): string {
22
22
  switch (value) {
23
- case AlertStatus.Pending: return $tr("ui.alert-status.pending", "Pending");
24
- case AlertStatus.Untriggered: return $tr("ui.alert-status.untriggered", "Untriggered");
25
- case AlertStatus.Unresolved: return $tr("ui.alert-status.unresolved", "Unresolved");
26
- case AlertStatus.Resolved: return $tr("ui.alert-status.resolved", "Resolved");
27
- case AlertStatus.Expired: return $tr("ui.alert-status.expired", "Expired");
28
- case AlertStatus.Triggered: return $tr("ui.alert-status.triggered", "Triggered");
29
- case AlertStatus.Abandoned: return $tr("ui.alert-status.abandoned", "Abandoned");
23
+ case AlertStatus.Pending:
24
+ return $tr('ui.alert-status.pending','Pending');
25
+ case AlertStatus.Untriggered:
26
+ return $tr('ui.alert-status.untriggered','Untriggered');
27
+ case AlertStatus.Unresolved:
28
+ return $tr('ui.alert-status.unresolved','Unresolved');
29
+ case AlertStatus.Resolved:
30
+ return $tr('ui.alert-status.resolved','Resolved');
31
+ case AlertStatus.Expired:
32
+ return $tr('ui.alert-status.expired','Expired');
33
+ case AlertStatus.Triggered:
34
+ return $tr('ui.alert-status.triggered','Triggered');
35
+ case AlertStatus.Abandoned:
36
+ return $tr('ui.alert-status.abandoned','Abandoned');
37
+ default: return "";
38
+ }
39
+ },
40
+ statusAlternativeColor(value: AlertStatus): string {
41
+ switch (value) {
42
+ case AlertStatus.Pending:
43
+ case AlertStatus.Unresolved:
44
+ case AlertStatus.Triggered: return "#da2d2d";
45
+ default: return "#1e56e5";
46
+ }
47
+ },
48
+ statusAlternativeIcon(value: AlertStatus): string {
49
+ switch (value) {
50
+ case AlertStatus.Pending: return "timer";
51
+ case AlertStatus.Untriggered: return "timer_off";
52
+ case AlertStatus.Unresolved: return "error_outline";
53
+ case AlertStatus.Resolved: return "check_circle_outline";
54
+ case AlertStatus.Expired: return "schedule";
55
+ case AlertStatus.Triggered: return "error_outline";
56
+ case AlertStatus.Abandoned: return "block"
30
57
  default: return "";
31
58
  }
32
59
  },
@@ -47,23 +74,23 @@ export const AlertTools = {
47
74
  },
48
75
  criticityLabel(value: Criticity): string {
49
76
  switch (value) {
50
- case Criticity.Warning: return $tr("ui.common.warning", "Warning");
51
- case Criticity.Error: return $tr("ui.common.error", "Error");
52
- case Criticity.Information: return $tr("ui.common.information", "Information")
53
- default: return $tr("ui.common.none", "None");
77
+ case Criticity.Warning: return $tr('ui.common.warning','Warning');
78
+ case Criticity.Error: return $tr('ui.common.error','Error');
79
+ default: return $tr('ui.common.information','Information');
54
80
  }
55
81
  }
56
82
  }
57
83
 
58
- export const prettyDuration = (n: number) => {
84
+ export const prettyDuration = (n: number | undefined) => {
85
+ if (n == null) { return "00m 00s"; }
59
86
  const day = Math.floor(n / 24 / 60 / 60);
60
87
  const hours = Math.floor((n - day * 24 * 60 * 60) / 3600);
61
88
  const minutes = Math.floor((n - day * 24 * 60 * 60 - hours * 60 * 60) / 60);
62
89
  const seconds = Math.floor(n - day * 24 * 60 * 60 - hours * 60 * 60 - minutes * 60);
63
90
 
64
91
  return day > 0 ?
65
- `${getTimeBestString(day * 24 * 60 * 60)} ${getTimeBestString(hours * 60 * 60)} ${getTimeBestString(minutes * 60)} ${getTimeBestString(seconds)}`
92
+ `${getTimeBestString(day * 24 * 60 * 60)} ${hours > 0 ? getTimeBestString(hours * 60 * 60) : ''} ${minutes > 0 ? getTimeBestString(minutes * 60) : ''} ${getTimeBestString(seconds)}`
66
93
  : hours > 0
67
- ? `${getTimeBestString(hours * 60 * 60)} ${getTimeBestString(minutes * 60)} ${getTimeBestString(seconds)}`
68
- : `${getTimeBestString(minutes * 60)} ${getTimeBestString(seconds)}`;
94
+ ? `${getTimeBestString(hours * 60 * 60)} ${minutes > 0 ? getTimeBestString(minutes * 60) : ''} ${getTimeBestString(seconds)}`
95
+ : `${minutes > 0 ? getTimeBestString(minutes * 60) : ''} ${getTimeBestString(seconds)}`;
69
96
  };
package/utils/badge.ts CHANGED
@@ -1,9 +1,13 @@
1
- export const getBadgeFromNumber = (value: number, parenthesis: boolean = false): string => {
1
+ export const capNumberToString = (value: number, maximum: number = 99): string => {
2
+ if (value > maximum) {
3
+ return `${maximum}+`;
4
+ }
5
+ return `${value.toString()}`;
6
+ }
7
+
8
+ export const getBadgeFromNumber = (value: number, parenthesis: boolean = false, maximum: number = 99): string => {
2
9
  if (value < 1) {
3
10
  return "";
4
11
  }
5
- if (value > 99) {
6
- return `${parenthesis ? '(' : ''}99+${parenthesis ? ')' : ''}`;
7
- }
8
- return `${parenthesis ? '(' : ''}${value.toString()}${parenthesis ? ')' : ''}`;
12
+ return parenthesis ? `(${capNumberToString(value, maximum)})` : capNumberToString(value, maximum);
9
13
  }