@dative-gpi/foundation-shared-components 1.0.73 → 1.0.74

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.
@@ -105,7 +105,7 @@ export default defineComponent({
105
105
  const { getColors, getGradients } = useColors();
106
106
 
107
107
  const colors = computed(() => {
108
- if(Array.isArray(props.color)) {
108
+ if (Array.isArray(props.color)) {
109
109
  return getColors(props.color[0]);
110
110
  }
111
111
  return getColors(props.color);
@@ -115,6 +115,23 @@ export default defineComponent({
115
115
  const lights = getColors(ColorEnum.Light);
116
116
  const darks = getColors(ColorEnum.Dark);
117
117
 
118
+ const borderColor = computed((): ColorBase => {
119
+ switch (props.variant) {
120
+ case "background":
121
+ return lights.dark;
122
+ case "standard" :
123
+ if (Array.isArray(props.color)) {
124
+ return colors.value.lightContrast!;
125
+ }
126
+ if (([ColorEnum.Background, ColorEnum.Light, ColorEnum.Dark] as ColorBase[]).includes(props.color)) {
127
+ return lights.dark;
128
+ }
129
+ return colors.value.lightContrast!;
130
+ case "full" : return colors.value.base;
131
+ case "gradient" : return colors.value.lightContrast!;
132
+ }
133
+ });
134
+
118
135
  const style = computed((): StyleValue => {
119
136
  switch (props.variant) {
120
137
  case "background": return {
@@ -125,7 +142,7 @@ export default defineComponent({
125
142
  "--fs-card-height" : sizeToVar(props.height),
126
143
  "--fs-card-width" : sizeToVar(props.width),
127
144
  "--fs-card-background-color": backgrounds.base,
128
- "--fs-card-border-color" : lights.dark,
145
+ "--fs-card-border-color" : borderColor.value,
129
146
  "--fs-card-color" : darks.base
130
147
  }
131
148
  case "standard": return {
@@ -136,7 +153,7 @@ export default defineComponent({
136
153
  "--fs-card-height" : sizeToVar(props.height),
137
154
  "--fs-card-width" : sizeToVar(props.width),
138
155
  "--fs-card-background-color": colors.value.light,
139
- "--fs-card-border-color" : colors.value.lightContrast!,
156
+ "--fs-card-border-color" : borderColor.value,
140
157
  "--fs-card-color" : colors.value.lightContrast!
141
158
  }
142
159
  case "full": return {
@@ -147,7 +164,7 @@ export default defineComponent({
147
164
  "--fs-card-height" : sizeToVar(props.height),
148
165
  "--fs-card-width" : sizeToVar(props.width),
149
166
  "--fs-card-background-color": colors.value.base,
150
- "--fs-card-border-color" : colors.value.base,
167
+ "--fs-card-border-color" : borderColor.value,
151
168
  "--fs-card-color" : colors.value.baseContrast!
152
169
  }
153
170
  case "gradient": return {
@@ -158,7 +175,7 @@ export default defineComponent({
158
175
  "--fs-card-height" : sizeToVar(props.height),
159
176
  "--fs-card-width" : sizeToVar(props.width),
160
177
  "--fs-card-background-color": gradients.value.base,
161
- "--fs-card-border-color" : colors.value.lightContrast!,
178
+ "--fs-card-border-color" : borderColor.value,
162
179
  "--fs-card-color" : colors.value.lightContrast!
163
180
  }
164
181
  }
@@ -58,7 +58,7 @@ export default defineComponent({
58
58
  iconColor: {
59
59
  type: String as PropType<ColorBase>,
60
60
  required: false,
61
- default: ColorEnum.Primary
61
+ default: ColorEnum.Dark
62
62
  },
63
63
  iconVariant: {
64
64
  type: String as PropType<"base" | "baseContrast" | "soft" | "softContrast" | "light" | "lightContrast" | "dark" | "darkContrast">,
@@ -3,8 +3,8 @@
3
3
  :clearable="false"
4
4
  :toggleSet="false"
5
5
  :multiple="false"
6
- :items="places"
7
- :modelValue="modelValuePlace"
6
+ :items="items"
7
+ :modelValue="$props.modelValue?.placeId"
8
8
  @update:modelValue="onUpdate"
9
9
  v-model:search="search"
10
10
  v-bind="$attrs"
@@ -12,7 +12,7 @@
12
12
  </template>
13
13
 
14
14
  <script lang="ts">
15
- import { defineComponent, onMounted, ref, watch } from "vue";
15
+ import { computed, defineComponent, ref } from "vue";
16
16
 
17
17
  import { type Address, type Place } from "@dative-gpi/foundation-shared-domain/models";
18
18
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
@@ -38,7 +38,15 @@ export default defineComponent({
38
38
  const { search: searchAddress, get: getAddress } = useAddress();
39
39
 
40
40
  const places = ref<Place[]>([]);
41
- const modelValuePlace = ref<Place | null>(null);
41
+
42
+ const items = computed(() => {
43
+ if(props.modelValue) {
44
+ const currentPlace = addressToPlace(props.modelValue);
45
+ const searchedPlaces = places.value.filter((place) => place.id !== currentPlace.id);
46
+ return [currentPlace, ...searchedPlaces];
47
+ }
48
+ return places.value;
49
+ });
42
50
 
43
51
  const fetch = async (search: string | null) => {
44
52
  if (search === null) {
@@ -69,7 +77,9 @@ export default defineComponent({
69
77
  (item) => (item).id,
70
78
  (item) => (item).label,
71
79
  true,
72
- false
80
+ false,
81
+ 0,
82
+ 500
73
83
  );
74
84
 
75
85
  const addressToPlace = (address: Address): Place => {
@@ -79,23 +89,9 @@ export default defineComponent({
79
89
  };
80
90
  };
81
91
 
82
- onMounted(() => {
83
- if(!props.modelValue) {
84
- return;
85
- }
86
- modelValuePlace.value = addressToPlace(props.modelValue);
87
- });
88
-
89
- watch(() => props.modelValue, (newValue) => {
90
- if(!newValue) {
91
- return;
92
- }
93
- modelValuePlace.value = addressToPlace(newValue);
94
- });
95
-
96
92
  return {
97
- modelValuePlace,
98
93
  places,
94
+ items,
99
95
  search,
100
96
  onUpdate
101
97
  };
@@ -9,16 +9,17 @@
9
9
  >
10
10
  <FSBadge
11
11
  :content="badgeLabel"
12
- :color="criticityColor"
12
+ :color="AlertTools.criticityColor($props.deviceWorstAlert?.criticity)"
13
13
  >
14
14
  <FSColorIcon
15
15
  class="fs-stopclick"
16
- size="m"
17
- :color="criticityColor"
16
+ :padding="$props.padding"
17
+ :color="AlertTools.criticityColor($props.deviceWorstAlert?.criticity)"
18
+ :size="$props.size"
18
19
  @click.prevent.stop
19
20
  v-bind="props"
20
21
  >
21
- {{ statusIcon }}
22
+ {{ AlertTools.statusIcon($props.deviceWorstAlert?.status) }}
22
23
  </FSColorIcon>
23
24
  </FSBadge>
24
25
  </template>
@@ -34,8 +35,7 @@
34
35
  import { computed, defineComponent, type PropType, ref } from "vue";
35
36
 
36
37
  import { type FSDeviceAlert } from "@dative-gpi/foundation-shared-components/models";
37
- import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/enums";
38
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
38
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
39
39
 
40
40
  import FSWorstAlertCard from "./FSWorstAlertCard.vue";
41
41
  import FSColorIcon from "../FSColorIcon.vue";
@@ -62,32 +62,19 @@ export default defineComponent({
62
62
  type: Function,
63
63
  required: false,
64
64
  default: null
65
+ },
66
+ size: {
67
+ type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
68
+ default: "m"
69
+ },
70
+ padding: {
71
+ type: [String, Number] as PropType<string | number>,
72
+ default: "8px"
65
73
  }
66
74
  },
67
75
  setup(props) {
68
76
  const menu = ref(false);
69
77
 
70
- const criticityColor = computed(() => {
71
- switch (props.deviceWorstAlert?.criticity) {
72
- case Criticity.Error: return ColorEnum.Error;
73
- case Criticity.Warning: return ColorEnum.Warning;
74
- default: return ColorEnum.Primary;
75
- }
76
- });
77
-
78
- const statusIcon = computed(() => {
79
- switch (props.deviceWorstAlert?.status) {
80
- case AlertStatus.Pending: return "mdi-timer-outline";
81
- case AlertStatus.Untriggered: return "mdi-timer-off-outline";
82
- case AlertStatus.Unresolved: return "mdi-alert-circle-outline";
83
- case AlertStatus.Resolved: return "mdi-check-circle-outline";
84
- case AlertStatus.Expired: return "mdi-clock-outline";
85
- case AlertStatus.Triggered: return "mdi-alert-circle-outline";
86
- case AlertStatus.Abandoned: return "mdi-cancel"
87
- default: return "";
88
- }
89
- });
90
-
91
78
  const badgeLabel = computed((): string | null => {
92
79
  if (!props.deviceAlerts || props.deviceAlerts.length < 1) {
93
80
  return null;
@@ -99,8 +86,7 @@ export default defineComponent({
99
86
  });
100
87
 
101
88
  return {
102
- criticityColor,
103
- statusIcon,
89
+ AlertTools,
104
90
  badgeLabel,
105
91
  menu
106
92
  };
@@ -9,19 +9,19 @@
9
9
  >
10
10
  <FSChip
11
11
  :label="$tr('ui.common.alert', 'Alert')"
12
- :prependIcon="statusIcon"
13
- :color="criticityColor"
12
+ :prependIcon="AlertTools.statusIcon($props.deviceAlert?.status)"
13
+ :color="AlertTools.criticityColor($props.deviceAlert?.criticity)"
14
14
  />
15
15
  <FSCol
16
16
  align="center-center"
17
17
  gap="0px"
18
18
  >
19
19
  <FSText>
20
- {{ $tr('ui.alert.status', 'Status') }} : {{ statusLabel }}
20
+ {{ $tr('ui.alert.status', 'Status') }} : {{ AlertTools.statusLabel($props.deviceAlert?.status) }}
21
21
  </FSText>
22
22
  <FSText
23
23
  font="text-button"
24
- :color="criticityColor"
24
+ :color="AlertTools.criticityColor($props.deviceAlert?.criticity)"
25
25
  >
26
26
  {{ $props.deviceAlert.label }}
27
27
  </FSText>
@@ -46,11 +46,9 @@
46
46
  <script lang="ts">
47
47
  import { computed, defineComponent, type PropType } from "vue";
48
48
 
49
- import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
50
- import { type FSDeviceAlert} from "@dative-gpi/foundation-shared-components/models";
51
- import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/enums";
49
+ import { type FSDeviceAlert } from "@dative-gpi/foundation-shared-components/models";
52
50
  import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
53
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
51
+ import { AlertTools } from "@dative-gpi/foundation-shared-components/tools";
54
52
 
55
53
  import FSButton from "../FSButton.vue";
56
54
  import FSCard from "../FSCard.vue";
@@ -81,41 +79,6 @@ export default defineComponent({
81
79
  emits: ["close"],
82
80
  setup(props) {
83
81
  const { epochToLongTimeFormat } = useDateFormat();
84
- const { $tr } = useTranslationsProvider();
85
-
86
- const criticityColor = computed(() => {
87
- switch (props.deviceAlert?.criticity) {
88
- case Criticity.Error: return ColorEnum.Error;
89
- case Criticity.Warning: return ColorEnum.Warning;
90
- default: return ColorEnum.Primary;
91
- }
92
- });
93
-
94
- const statusIcon = computed(() => {
95
- switch (props.deviceAlert?.status) {
96
- case AlertStatus.Pending: return "mdi-timer-outline";
97
- case AlertStatus.Untriggered: return "mdi-timer-off-outline";
98
- case AlertStatus.Unresolved: return "mdi-alert-circle-outline";
99
- case AlertStatus.Resolved: return "mdi-check-circle-outline";
100
- case AlertStatus.Expired: return "mdi-clock-outline";
101
- case AlertStatus.Triggered: return "mdi-alert-circle-outline";
102
- case AlertStatus.Abandoned: return "mdi-cancel"
103
- default: return "";
104
- }
105
- });
106
-
107
- const statusLabel = computed(() => {
108
- switch (props.deviceAlert?.status) {
109
- case AlertStatus.Pending: return $tr("ui.alert-status.pending", "Pending");
110
- case AlertStatus.Untriggered: return $tr("ui.alert-status.untriggered", "Untriggered");
111
- case AlertStatus.Unresolved: return $tr("ui.alert-status.unresolved", "Unresolved");
112
- case AlertStatus.Resolved: return $tr("ui.alert-status.resolved", "Resolved");
113
- case AlertStatus.Expired: return $tr("ui.alert-status.expired", "Expired");
114
- case AlertStatus.Triggered: return $tr("ui.alert-status.triggered", "Triggered");
115
- case AlertStatus.Abandoned: return $tr("ui.alert-status.abandoned", "Abandoned");
116
- default: return "";
117
- }
118
- });
119
82
 
120
83
  const deviceTimestamp = computed((): string => {
121
84
  if (props.deviceAlert.sourceTimestamp) {
@@ -126,9 +89,7 @@ export default defineComponent({
126
89
 
127
90
  return {
128
91
  deviceTimestamp,
129
- criticityColor,
130
- statusLabel,
131
- statusIcon
92
+ AlertTools
132
93
  };
133
94
  }
134
95
  });
@@ -127,6 +127,7 @@
127
127
  #body
128
128
  >
129
129
  <FSSearchField
130
+ :clearable="$props.clearable"
130
131
  :hideHeader="true"
131
132
  v-model="search"
132
133
  />
@@ -44,7 +44,7 @@
44
44
  v-else-if="$props.icon"
45
45
  :backgroundVariant="$props.iconBackgroundVariant"
46
46
  :backgroundColor="$props.iconBackgroundColor"
47
- :iconColor="$props.activeColor"
47
+ :iconColor="$props.iconColor"
48
48
  :border="$props.iconBorder"
49
49
  :icon="$props.icon"
50
50
  :size="imageSize"
@@ -112,6 +112,11 @@ export default defineComponent({
112
112
  required: false,
113
113
  default: true
114
114
  },
115
+ iconColor: {
116
+ type: String as PropType<ColorBase>,
117
+ required: false,
118
+ default: ColorEnum.Dark
119
+ },
115
120
  activeColor: {
116
121
  type: String as PropType<ColorBase>,
117
122
  required: false,
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.73",
4
+ "version": "1.0.74",
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.73",
14
- "@dative-gpi/foundation-shared-services": "1.0.73"
13
+ "@dative-gpi/foundation-shared-domain": "1.0.74",
14
+ "@dative-gpi/foundation-shared-services": "1.0.74"
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": "b603eafcaf25f621ed41de64599ffabe0e58ced4"
38
+ "gitHead": "b9ba9b12c53de7d812e658a3438903e8e6998aad"
39
39
  }