@dative-gpi/foundation-shared-components 1.0.142 → 1.0.143-actions-color

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,50 +1,56 @@
1
1
  <template>
2
- <FSRow
3
- :align="$props.align"
4
- :width="$props.width"
5
- :class="classes"
6
- :style="style"
7
- :wrap="false"
8
- v-bind="$attrs"
2
+ <component
3
+ :is="$props.to ? 'FSRouterLink' : 'div'"
4
+ v-bind="$props.to ? { to: $props.to } : {}"
9
5
  >
10
- <slot
11
- name="prepend"
12
- v-bind="{ color: $props.color, colors }"
6
+ <FSRow
7
+ :align="$props.align"
8
+ :width="$props.width"
9
+ :class="classes"
10
+ :style="style"
11
+ :wrap="false"
12
+ v-bind="$attrs"
13
13
  >
14
- <FSIcon
15
- v-if="$props.prependIcon"
16
- size="s"
14
+ <slot
15
+ name="prepend"
16
+ v-bind="{ color: $props.color, colors }"
17
17
  >
18
- {{ $props.prependIcon }}
19
- </FSIcon>
20
- </slot>
21
- <slot
22
- v-bind="{ color: $props.color, colors }"
23
- >
24
- <FSSpan
25
- v-if="$props.label"
26
- font="text-overline"
27
- class="fs-chip-label"
18
+ <FSIcon
19
+ v-if="$props.prependIcon"
20
+ size="s"
21
+ >
22
+ {{ $props.prependIcon }}
23
+ </FSIcon>
24
+ </slot>
25
+ <slot
26
+ v-bind="{ color: $props.color, colors }"
28
27
  >
29
- {{ $props.label }}
30
- </FSSpan>
31
- </slot>
32
- <slot
33
- name="append"
34
- v-bind="{ color: $props.color, colors }"
35
- >
36
- <FSIcon
37
- v-if="$props.appendIcon"
38
- size="s"
28
+ <FSSpan
29
+ v-if="$props.label"
30
+ font="text-overline"
31
+ class="fs-chip-label"
32
+ >
33
+ {{ $props.label }}
34
+ </FSSpan>
35
+ </slot>
36
+ <slot
37
+ name="append"
38
+ v-bind="{ color: $props.color, colors }"
39
39
  >
40
- {{ $props.appendIcon }}
41
- </FSIcon>
42
- </slot>
43
- </FSRow>
40
+ <FSIcon
41
+ v-if="$props.appendIcon"
42
+ size="s"
43
+ >
44
+ {{ $props.appendIcon }}
45
+ </FSIcon>
46
+ </slot>
47
+ </FSRow>
48
+ </component>
44
49
  </template>
45
50
 
46
51
  <script lang="ts">
47
52
  import { computed, defineComponent, type PropType, type StyleValue } from "vue";
53
+ import { type RouteLocation } from "vue-router";
48
54
 
49
55
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
50
56
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
@@ -53,6 +59,7 @@ import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
53
59
  import FSIcon from "./FSIcon.vue";
54
60
  import FSSpan from "./FSSpan.vue";
55
61
  import FSRow from "./FSRow.vue";
62
+ import FSRouterLink from '@dative-gpi/foundation-shared-components/components/FSRouterLink.vue';
56
63
 
57
64
  export default defineComponent({
58
65
  name: "FSChip",
@@ -61,6 +68,7 @@ export default defineComponent({
61
68
  FSSpan,
62
69
  FSRow
63
70
  },
71
+ inheritsAttrs: false,
64
72
  props: {
65
73
  prependIcon: {
66
74
  type: String as PropType<string | null>,
@@ -106,7 +114,12 @@ export default defineComponent({
106
114
  type: String as PropType<"center-center" | "center-left">,
107
115
  required: false,
108
116
  default: "center-center"
109
- }
117
+ },
118
+ to: {
119
+ type: Object as PropType<RouteLocation | null>,
120
+ required: false,
121
+ default: null
122
+ },
110
123
  },
111
124
  setup(props) {
112
125
  const { getColors } = useColors();
@@ -165,6 +178,7 @@ export default defineComponent({
165
178
  });
166
179
 
167
180
  return {
181
+ FSRouterLink,
168
182
  classes,
169
183
  colors,
170
184
  style
@@ -34,9 +34,11 @@
34
34
  <script lang="ts">
35
35
  import { computed, defineComponent, type PropType, ref } from "vue";
36
36
 
37
- import { type FSDeviceAlert } from "@dative-gpi/foundation-shared-components/models";
37
+ import { capNumberToString } from '@dative-gpi/foundation-shared-components/utils';
38
38
  import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
39
39
 
40
+ import { type FSDeviceAlert } from "@dative-gpi/foundation-shared-components/models";
41
+
40
42
  import FSWorstAlertCard from "./FSWorstAlertCard.vue";
41
43
  import FSColorIcon from "../FSColorIcon.vue";
42
44
  import FSBadge from "../FSBadge.vue";
@@ -79,10 +81,8 @@ export default defineComponent({
79
81
  if (!props.deviceAlerts || props.deviceAlerts.length < 1) {
80
82
  return null;
81
83
  }
82
- if (props.deviceAlerts.length > 9) {
83
- return "9+";
84
- }
85
- return props.deviceAlerts.length.toString();
84
+
85
+ return capNumberToString(props.deviceAlerts.length, 9);
86
86
  });
87
87
 
88
88
  return {
@@ -17,7 +17,7 @@
17
17
  gap="0px"
18
18
  >
19
19
  <FSText>
20
- {{ $tr('ui.alert.status', 'Status') }} : {{ AlertTools.statusLabel($props.deviceAlert?.status) }}
20
+ {{ $tr('entity.alert.current-status', 'Status') }} : {{ AlertTools.statusLabel($props.deviceAlert?.status) }}
21
21
  </FSText>
22
22
  <FSText
23
23
  font="text-button"
@@ -1,54 +1,60 @@
1
1
  <template>
2
2
  <FSTile
3
- :width="['275px','336px']"
4
- :height="['124px','156px']"
3
+ :width="['324px','272px']"
4
+ :height="['132px', '116px']"
5
+ :padding="['16px', '12px']"
5
6
  borderRadius="8px"
6
7
  v-bind="$attrs"
7
8
  >
8
- <template
9
- #default
9
+ <FSRow
10
+ align="center-left"
11
+ gap="16px"
12
+ :wrap="false"
10
13
  >
11
- <FSRow
14
+ <FSCol
12
15
  align="center-left"
13
- padding="4px 4px 4px 8px"
14
- gap="16px"
15
- :wrap="false"
16
+ :gap="['12px', '8px']"
16
17
  >
17
- <FSCol
18
+ <FSSpan
19
+ font="text-overline"
20
+ :lineClamp="4"
21
+ >
22
+ {{ $props.label }}
23
+ </FSSpan>
24
+ <FSRow
18
25
  align="center-left"
19
- gap="4px"
26
+ :gap="['12px', '8px']"
20
27
  >
21
- <FSSpan
22
- font="text-overline"
23
- :lineClamp="4"
24
- >
25
- {{ $props.label }}
26
- </FSSpan>
27
28
  <FSIcon
28
- :color="ColorEnum.Error"
29
- size="18px"
29
+ :color="ColorEnum.Primary"
30
+ :size="['18px', '16px']"
30
31
  >
31
32
  {{ chartIcon(type) }}
32
33
  </FSIcon>
33
- </FSCol>
34
- <FSCol
35
- align="center-right"
36
- width="hug"
37
- >
38
- <FSImage
39
- v-if="$props.imageId"
40
- :height="['82px','90px']"
41
- :width="['82px','90px']"
42
- :imageId="$props.imageId"
43
- />
44
- <FSIcon
45
- v-else-if="$props.icon"
46
- :size="['82px','90px']"
47
- :icon="$props.icon"
34
+ <FSChip
35
+ v-if="$props.scope === ApplicationScope.OrganisationType"
36
+ :color="ColorEnum.Light"
37
+ :label="$tr('ui.chart-origin.organisation-type', 'Shared')"
48
38
  />
49
- </FSCol>
50
- </FSRow>
51
- </template>
39
+ </FSRow>
40
+ </FSCol>
41
+ <FSCol
42
+ align="center-right"
43
+ width="hug"
44
+ >
45
+ <FSImage
46
+ v-if="$props.imageId"
47
+ :imageId="$props.imageId"
48
+ :height="['84px', '72px']"
49
+ :width="['84px', '72px']"
50
+ />
51
+ <FSIconCard
52
+ v-else-if="$props.icon"
53
+ :size="['84px', '72px']"
54
+ :icon="$props.icon"
55
+ />
56
+ </FSCol>
57
+ </FSRow>
52
58
  </FSTile>
53
59
  </template>
54
60
 
@@ -57,16 +63,17 @@ import { defineComponent } from "vue";
57
63
  import type { PropType } from "vue";
58
64
 
59
65
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
60
- import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
66
+ import { ApplicationScope, ChartType } from "@dative-gpi/foundation-shared-domain/enums";
61
67
 
62
68
  import { chartIcon } from "@dative-gpi/foundation-shared-components/tools";
63
69
 
64
70
  import FSImage from "../FSImage.vue";
65
71
  import FSTile from "./FSTile.vue";
66
72
  import FSSpan from "../FSSpan.vue";
67
- import FSIcon from "../FSIcon.vue";
68
73
  import FSRow from "../FSRow.vue";
69
74
  import FSCol from "../FSCol.vue";
75
+ import FSIconCard from '../FSIconCard.vue';
76
+ import FSChip from '../FSChip.vue';
70
77
 
71
78
 
72
79
  export default defineComponent({
@@ -74,10 +81,11 @@ export default defineComponent({
74
81
  components: {
75
82
  FSImage,
76
83
  FSTile,
77
- FSIcon,
78
84
  FSRow,
79
85
  FSCol,
80
86
  FSSpan,
87
+ FSChip,
88
+ FSIconCard
81
89
  },
82
90
  props: {
83
91
  label: {
@@ -99,11 +107,17 @@ export default defineComponent({
99
107
  type: Number as PropType<ChartType>,
100
108
  required: false,
101
109
  default: ChartType.None
102
- }
110
+ },
111
+ scope: {
112
+ type: Number as PropType<ApplicationScope>,
113
+ required: false,
114
+ default: ApplicationScope.None
115
+ },
103
116
  },
104
117
  setup() {
105
118
  return {
106
119
  ColorEnum,
120
+ ApplicationScope,
107
121
  chartIcon
108
122
  };
109
123
  }
@@ -3,7 +3,16 @@
3
3
  :bottomColor="color"
4
4
  :icon="$props.icon"
5
5
  v-bind="$attrs"
6
- />
6
+ >
7
+ <template
8
+ #append-info
9
+ >
10
+ <FSChip
11
+ :label="$tr('ui.dashboard-type.organisation-type', 'Shared')"
12
+ :color="ColorEnum.Light"
13
+ />
14
+ </template>
15
+ </FSSimpleTileUI>
7
16
  </template>
8
17
 
9
18
  <script lang="ts">
@@ -12,10 +21,12 @@ import { computed, defineComponent, type PropType } from "vue";
12
21
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
13
22
 
14
23
  import FSSimpleTileUI from "./FSSimpleTileUI.vue";
24
+ import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
15
25
 
16
26
  export default defineComponent({
17
27
  name: "FSDashboardOrganisationTypeTileUI",
18
28
  components: {
29
+ FSChip,
19
30
  FSSimpleTileUI
20
31
  },
21
32
  props: {
@@ -39,7 +50,8 @@ export default defineComponent({
39
50
  });
40
51
 
41
52
  return {
42
- color
53
+ color,
54
+ ColorEnum
43
55
  };
44
56
  }
45
57
  });
@@ -3,7 +3,16 @@
3
3
  :bottomColor="color"
4
4
  :icon="$props.icon"
5
5
  v-bind="$attrs"
6
- />
6
+ >
7
+ <template
8
+ #append-info
9
+ >
10
+ <FSChip
11
+ :label="$tr('ui.dashboard-type.shallow', 'Shallow copy')"
12
+ :color="ColorEnum.Light"
13
+ />
14
+ </template>
15
+ </FSSimpleTileUI>
7
16
  </template>
8
17
 
9
18
  <script lang="ts">
@@ -12,10 +21,12 @@ import { computed, defineComponent, type PropType } from "vue";
12
21
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
13
22
 
14
23
  import FSSimpleTileUI from "./FSSimpleTileUI.vue";
24
+ import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
15
25
 
16
26
  export default defineComponent({
17
27
  name: "FSDashboardShallowTileUI",
18
28
  components: {
29
+ FSChip,
19
30
  FSSimpleTileUI
20
31
  },
21
32
  props: {
@@ -39,7 +50,8 @@ export default defineComponent({
39
50
  });
40
51
 
41
52
  return {
42
- color
53
+ color,
54
+ ColorEnum
43
55
  };
44
56
  }
45
57
  });
@@ -1,135 +1,95 @@
1
1
  <template>
2
- <FSTile
2
+ <FSSimpleTileUI
3
3
  :activeColor="ColorEnum.Primary"
4
4
  :bottomColor="ColorEnum.Error"
5
5
  :width="$props.width"
6
6
  :modelValue="$props.modelValue"
7
+ :label="$props.label"
8
+ :code="$props.code"
9
+ :imageId="$props.imageId"
10
+ :icon="$props.icon"
7
11
  v-bind="$attrs"
8
12
  >
9
- <FSCol
10
- align="center-center"
11
- width="fill"
13
+ <template
14
+ #append-info
12
15
  >
13
- <FSRow
14
- align="center-center"
15
- gap="24px"
16
- :height="imageSize"
17
- :wrap="false"
16
+ <FSCol
17
+ gap="6px"
18
18
  >
19
- <FSCol
20
- gap="12px"
21
- :width="infoWidth"
19
+ <FSRow
20
+ align="center-left"
22
21
  >
23
- <FSCol
24
- gap="6px"
25
- >
26
- <FSSpan
27
- font="text-button"
28
- :lineClamp="1"
29
- >
30
- {{ $props.label }}
31
- </FSSpan>
32
- <FSSpan
33
- font="text-overline"
34
- variant="soft"
35
- >
36
- {{ $props.code }}
37
- </FSSpan>
38
- </FSCol>
39
- <FSCol
40
- gap="6px"
22
+ <FSColor
23
+ height="24px"
24
+ width="24px"
25
+ :color="ColorEnum.Primary"
26
+ :border="false"
41
27
  >
42
28
  <FSRow
43
- align="center-left"
29
+ align="center-center"
44
30
  >
45
- <FSColor
46
- padding="0 8px"
47
- height="24px"
48
- :color="ColorEnum.Primary"
49
- :border="false"
50
- >
51
- <FSRow
52
- align="center-center"
53
- >
54
- <FSSpan
55
- font="text-overline"
56
- >
57
- {{ groupsLabel }}
58
- </FSSpan>
59
- </FSRow>
60
- </FSColor>
61
31
  <FSSpan
62
32
  font="text-overline"
63
33
  >
64
- {{ $tr("ui.common.groups", "Group(s)") }}
34
+ {{ groupsBadgeContent }}
65
35
  </FSSpan>
66
36
  </FSRow>
37
+ </FSColor>
38
+ <FSSpan
39
+ font="text-overline"
40
+ >
41
+ {{ $tr("ui.common.groups", "Group(s)") }}
42
+ </FSSpan>
43
+ </FSRow>
44
+ <FSRow
45
+ align="center-left"
46
+ >
47
+ <FSColor
48
+ height="24px"
49
+ width="24px"
50
+ :color="ColorEnum.Success"
51
+ :border="false"
52
+ >
67
53
  <FSRow
68
- align="center-left"
54
+ align="center-center"
69
55
  >
70
- <FSColor
71
- padding="0 8px"
72
- height="24px"
73
- :color="ColorEnum.Success"
74
- :border="false"
75
- >
76
- <FSRow
77
- align="center-center"
78
- >
79
- <FSSpan
80
- font="text-overline"
81
- >
82
- {{ deviceOrganisationsLabel }}
83
- </FSSpan>
84
- </FSRow>
85
- </FSColor>
86
56
  <FSSpan
87
57
  font="text-overline"
88
58
  >
89
- {{ $tr("ui.common.devices", "Device(s)") }}
59
+ {{ deviceOrganisationsBadgeContent }}
90
60
  </FSSpan>
91
61
  </FSRow>
92
- </FSCol>
93
- </FSCol>
94
- <FSImage
95
- v-if="$props.imageId"
96
- :imageId="$props.imageId"
97
- :width="imageSize"
98
- />
99
- <FSIconCard
100
- v-else-if="$props.icon"
101
- backgroundVariant="standard"
102
- :backgroundColor="ColorEnum.Background"
103
- :icon="$props.icon"
104
- :size="imageSize"
105
- />
106
- </FSRow>
107
- </FSCol>
108
- </FSTile>
62
+ </FSColor>
63
+ <FSSpan
64
+ font="text-overline"
65
+ >
66
+ {{ $tr("ui.common.devices", "Device(s)") }}
67
+ </FSSpan>
68
+ </FSRow>
69
+ </FSCol>
70
+ </template>
71
+ </FSSimpleTileUI>
109
72
  </template>
110
73
 
111
74
  <script lang="ts">
112
75
  import { computed, defineComponent, type PropType } from "vue";
113
76
 
114
- import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
77
+ import { capNumberToString } from '@dative-gpi/foundation-shared-components/utils';
78
+
115
79
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
116
80
 
117
- import FSIconCard from "../FSIconCard.vue";
118
- import FSImage from "../FSImage.vue";
81
+ import FSSimpleTileUI from './FSSimpleTileUI.vue';
119
82
  import FSColor from "../FSColor.vue";
120
83
  import FSSpan from "../FSSpan.vue";
121
- import FSTile from "./FSTile.vue";
122
84
  import FSCol from "../FSCol.vue";
123
85
  import FSRow from "../FSRow.vue";
124
86
 
125
87
  export default defineComponent({
126
88
  name: "FSGroupTileUI",
127
89
  components: {
128
- FSIconCard,
129
- FSImage,
90
+ FSSimpleTileUI,
130
91
  FSColor,
131
92
  FSSpan,
132
- FSTile,
133
93
  FSCol,
134
94
  FSRow
135
95
  },
@@ -175,33 +135,14 @@ export default defineComponent({
175
135
  },
176
136
  },
177
137
  setup(props) {
178
- const { isMobileSized } = useBreakpoints();
179
-
180
- const groupsLabel = computed((): string => {
181
- return props.recursiveGroupsIds.length > 99 ? "99+" : props.recursiveGroupsIds.length.toString();
182
- });
183
-
184
- const deviceOrganisationsLabel = computed((): string => {
185
- return props.recursiveDeviceOrganisationsIds.length > 99 ? "99+" : props.recursiveDeviceOrganisationsIds.length.toString();
186
- });
187
-
188
- const imageSize = computed((): number => {
189
- return isMobileSized.value ? 90 : 100;
190
- });
138
+ const groupsBadgeContent = computed(() => capNumberToString(props.recursiveGroupsIds.length));
191
139
 
192
- const infoWidth = computed((): string => {
193
- if (!props.imageId && !props.icon) {
194
- return "100%";
195
- }
196
- return `calc(100% - ${imageSize.value}px - 24px)`;
197
- });
140
+ const deviceOrganisationsBadgeContent = computed(() => capNumberToString(props.recursiveDeviceOrganisationsIds.length));
198
141
 
199
142
  return {
200
- deviceOrganisationsLabel,
201
- groupsLabel,
143
+ deviceOrganisationsBadgeContent,
144
+ groupsBadgeContent,
202
145
  ColorEnum,
203
- imageSize,
204
- infoWidth
205
146
  };
206
147
  }
207
148
  });
@@ -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-actions-color",
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-actions-color",
14
+ "@dative-gpi/foundation-shared-services": "1.0.143-actions-color"
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": "80048decd45a755d4b108e300c1c6423142af11b"
39
39
  }
@@ -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
  }