@dative-gpi/foundation-shared-components 0.0.8 → 0.0.9
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/{models/FSButtons.ts → aliases/FSButton.ts} +24 -21
- package/aliases/index.ts +1 -0
- package/components/FSAutocompleteField.vue +207 -0
- package/components/FSBadge.vue +38 -0
- package/components/FSBreadcrumbs.vue +49 -55
- package/components/FSButton.vue +116 -101
- package/components/FSCalendar.vue +52 -39
- package/components/FSCalendarTwin.vue +120 -102
- package/components/FSCard.vue +35 -21
- package/components/FSCarousel.vue +63 -0
- package/components/FSCheckbox.vue +111 -103
- package/components/FSChip.vue +140 -0
- package/components/FSClock.vue +149 -15
- package/components/FSCol.vue +104 -98
- package/components/FSColor.vue +61 -64
- package/components/FSColorIcon.vue +67 -0
- package/components/FSContainer.vue +64 -0
- package/components/FSDateField.vue +211 -0
- package/components/FSDateRangeField.vue +225 -0
- package/components/FSDateTimeField.vue +257 -0
- package/components/FSDateTimeRangeField.vue +286 -0
- package/components/FSDialog.vue +103 -0
- package/components/FSDivider.vue +39 -0
- package/components/FSFadeOut.vue +49 -59
- package/components/FSFileButton.vue +245 -0
- package/components/FSHeaderButton.vue +17 -0
- package/components/FSIcon.vue +23 -23
- package/components/FSIconField.vue +232 -0
- package/components/FSImage.vue +142 -0
- package/components/FSLoadTile.vue +93 -0
- package/components/FSNumberField.vue +51 -53
- package/components/FSPasswordField.vue +99 -101
- package/components/FSRadio.vue +107 -109
- package/components/FSRadioGroup.vue +55 -57
- package/components/FSRemoveDialog.vue +123 -0
- package/components/FSRichTextField.vue +26 -33
- package/components/FSRow.vue +110 -104
- package/components/FSSearchField.vue +35 -27
- package/components/FSSelectField.vue +188 -0
- package/components/FSSlideGroup.vue +45 -49
- package/components/FSSlider.vue +31 -33
- package/components/FSSpan.vue +53 -37
- package/components/FSSubmitDialog.vue +165 -0
- package/components/FSSwitch.vue +110 -109
- package/components/FSTab.vue +61 -61
- package/components/FSTabs.vue +53 -55
- package/components/FSTag.vue +88 -84
- package/components/FSTagField.vue +32 -36
- package/components/FSTagGroup.vue +38 -45
- package/components/FSText.vue +74 -64
- package/components/FSTextArea.vue +187 -185
- package/components/FSTextField.vue +18 -20
- package/components/FSTile.vue +90 -0
- package/components/FSToggleSet.vue +282 -0
- package/components/FSTooltip.vue +21 -0
- package/components/FSWindow.vue +26 -16
- package/components/FSWrapGroup.vue +44 -47
- package/components/deviceOrganisations/FSConnectivity.vue +114 -0
- package/components/deviceOrganisations/FSStatus.vue +117 -0
- package/components/deviceOrganisations/FSStatusesCarousel.vue +105 -0
- package/components/deviceOrganisations/FSStatusesRow.vue +66 -0
- package/components/deviceOrganisations/FSWorstAlert.vue +165 -0
- package/components/lists/FSDataIteratorGroup.vue +7 -0
- package/components/lists/FSDataIteratorItem.vue +103 -0
- package/components/lists/FSDataTable.vue +964 -0
- package/components/lists/FSFilterButton.vue +176 -0
- package/components/lists/FSHeaderButton.vue +99 -0
- package/components/lists/FSHiddenButton.vue +79 -0
- package/components/tiles/FSDeviceOrganisationTileUI.vue +232 -0
- package/components/tiles/FSGroupTileUI.vue +192 -0
- package/composables/index.ts +1 -1
- package/composables/useBreakpoints.ts +23 -4
- package/composables/useColors.ts +53 -23
- package/composables/useSlots.ts +43 -0
- package/index.ts +6 -0
- package/models/breadcrumbs.ts +8 -0
- package/models/colors.ts +17 -0
- package/models/deviceAlerts.ts +10 -0
- package/models/deviceConnectivities.ts +11 -0
- package/models/deviceStatuses.ts +16 -0
- package/models/dispositions.ts +33 -0
- package/models/index.ts +9 -0
- package/models/modelStatuses.ts +11 -0
- package/models/rules.ts +50 -0
- package/models/toggleSets.ts +7 -0
- package/package.json +5 -4
- package/plugins/colorPlugin.ts +2 -2
- package/shims-plugin.d.ts +1 -1
- package/styles/components/fs_autocomplete_field.scss +123 -0
- package/styles/components/fs_button.scss +4 -6
- package/styles/components/fs_calendar.scss +24 -1
- package/styles/components/fs_card.scss +2 -5
- package/styles/components/fs_carousel.scss +4 -0
- package/styles/components/fs_chip.scss +33 -0
- package/styles/components/fs_clock.scss +43 -0
- package/styles/components/fs_col.scss +2 -0
- package/styles/components/fs_color_icon.scss +37 -0
- package/styles/components/fs_container.scss +16 -0
- package/styles/components/fs_data_iterator_item.scss +19 -0
- package/styles/components/fs_data_table.scss +97 -0
- package/styles/components/fs_date_field.scss +8 -0
- package/styles/components/fs_dialog.scss +30 -0
- package/styles/components/fs_divider.scss +5 -0
- package/styles/components/fs_fade_out.scss +10 -2
- package/styles/components/fs_filter_button.scss +12 -0
- package/styles/components/fs_header_button.scss +4 -0
- package/styles/components/fs_icon.scss +19 -3
- package/styles/components/fs_icon_field.scss +12 -0
- package/styles/components/fs_image.scss +7 -0
- package/styles/components/fs_load_tile.scss +49 -0
- package/styles/components/fs_password_field.scss +2 -2
- package/styles/components/fs_row.scss +4 -1
- package/styles/components/fs_select_field.scss +71 -0
- package/styles/components/fs_slide_group.scss +6 -0
- package/styles/components/fs_slider.scss +29 -9
- package/styles/components/fs_span.scss +8 -0
- package/styles/components/fs_submit_dialog.scss +9 -0
- package/styles/components/fs_tabs.scss +4 -0
- package/styles/components/fs_tag_field.scss +0 -11
- package/styles/components/fs_text_field.scss +23 -15
- package/styles/components/fs_tile.scss +33 -0
- package/styles/components/fs_tooltip.scss +5 -0
- package/styles/components/fs_wrap_group.scss +7 -8
- package/styles/components/index.scss +21 -1
- package/styles/globals/breakpoints.scss +7 -0
- package/styles/globals/overrides.scss +20 -7
- package/styles/globals/text_fonts.scss +8 -8
- package/themes/default.ts +1 -11
- package/utils/css.ts +11 -0
- package/utils/icons.ts +75416 -0
- package/utils/index.ts +5 -1
- package/utils/levenshtein.ts +97 -0
- package/utils/sort.ts +9 -0
- package/components/FSDatePicker.vue +0 -226
- package/composables/useDates.ts +0 -39
- package/models/FSTags.ts +0 -8
- package/models/FSTextFields.ts +0 -23
- package/styles/components/fs_date_picker.scss +0 -0
- /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSWrapGroup
|
|
3
|
+
v-if="['wrap'].includes($props.variant)"
|
|
4
|
+
:padding="$props.padding"
|
|
5
|
+
:gap="$props.gap"
|
|
6
|
+
>
|
|
7
|
+
<template v-if="$props.values.length">
|
|
8
|
+
<template v-if="!firstChild">
|
|
9
|
+
<FSButton
|
|
10
|
+
v-for="(item, index) in $props.values"
|
|
11
|
+
:prependIcon="item.prependIcon"
|
|
12
|
+
:appendIcon="item.appendIcon"
|
|
13
|
+
:editable="$props.editable"
|
|
14
|
+
:variant="getVariant(item)"
|
|
15
|
+
:color="getColor(item)"
|
|
16
|
+
:class="getClass(item)"
|
|
17
|
+
:label="item.label"
|
|
18
|
+
:key="index"
|
|
19
|
+
@click="toggle(item)"
|
|
20
|
+
/>
|
|
21
|
+
</template>
|
|
22
|
+
<template v-else>
|
|
23
|
+
<component
|
|
24
|
+
v-for="(item, index) in $props.values"
|
|
25
|
+
:key="index"
|
|
26
|
+
:is="firstChild"
|
|
27
|
+
:prependIcon="getFromFirstChild('prependIcon', item)"
|
|
28
|
+
:appendIcon="getFromFirstChild('appendIcon', item)"
|
|
29
|
+
:variant="getFromFirstChild('variant', item)"
|
|
30
|
+
:color="getFromFirstChild('color', item)"
|
|
31
|
+
:class="getFromFirstChild('class', item)"
|
|
32
|
+
:label="getFromFirstChild('label', item)"
|
|
33
|
+
:icon="getFromFirstChild('icon', item)"
|
|
34
|
+
:editable="$props.editable"
|
|
35
|
+
@click="toggle(item)"
|
|
36
|
+
/>
|
|
37
|
+
</template>
|
|
38
|
+
</template>
|
|
39
|
+
<slot v-else />
|
|
40
|
+
</FSWrapGroup>
|
|
41
|
+
<FSSlideGroup
|
|
42
|
+
v-else
|
|
43
|
+
:padding="$props.padding"
|
|
44
|
+
:gap="$props.gap"
|
|
45
|
+
>
|
|
46
|
+
<template v-if="$props.values.length">
|
|
47
|
+
<template v-if="!firstChild">
|
|
48
|
+
<FSButton
|
|
49
|
+
v-for="(item, index) in $props.values"
|
|
50
|
+
:prependIcon="item.prependIcon"
|
|
51
|
+
:appendIcon="item.appendIcon"
|
|
52
|
+
:editable="$props.editable"
|
|
53
|
+
:variant="getVariant(item)"
|
|
54
|
+
:color="getColor(item)"
|
|
55
|
+
:class="getClass(item)"
|
|
56
|
+
:label="item.label"
|
|
57
|
+
:key="index"
|
|
58
|
+
@click="toggle(item)"
|
|
59
|
+
/>
|
|
60
|
+
</template>
|
|
61
|
+
<template v-else>
|
|
62
|
+
<component
|
|
63
|
+
v-for="(item, index) in $props.values"
|
|
64
|
+
:key="index"
|
|
65
|
+
:is="firstChild"
|
|
66
|
+
:prependIcon="getFromFirstChild('prependIcon', item)"
|
|
67
|
+
:appendIcon="getFromFirstChild('appendIcon', item)"
|
|
68
|
+
:variant="getFromFirstChild('variant', item)"
|
|
69
|
+
:color="getFromFirstChild('color', item)"
|
|
70
|
+
:class="getFromFirstChild('class', item)"
|
|
71
|
+
:label="getFromFirstChild('label', item)"
|
|
72
|
+
:icon="getFromFirstChild('icon', item)"
|
|
73
|
+
:editable="$props.editable"
|
|
74
|
+
@click="toggle(item)"
|
|
75
|
+
/>
|
|
76
|
+
</template>
|
|
77
|
+
</template>
|
|
78
|
+
<slot v-else />
|
|
79
|
+
</FSSlideGroup>
|
|
80
|
+
</template>
|
|
81
|
+
|
|
82
|
+
<script lang="ts">
|
|
83
|
+
import { defineComponent, PropType } from "vue";
|
|
84
|
+
|
|
85
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
86
|
+
import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
87
|
+
import { FSToggle } from "@dative-gpi/foundation-shared-components/models";
|
|
88
|
+
|
|
89
|
+
import FSSlideGroup from "./FSSlideGroup.vue";
|
|
90
|
+
import FSWrapGroup from "./FSWrapGroup.vue";
|
|
91
|
+
import FSButton from "./FSButton.vue";
|
|
92
|
+
|
|
93
|
+
export default defineComponent({
|
|
94
|
+
name: "FSToggleSet",
|
|
95
|
+
components: {
|
|
96
|
+
FSSlideGroup,
|
|
97
|
+
FSWrapGroup,
|
|
98
|
+
FSButton
|
|
99
|
+
},
|
|
100
|
+
props: {
|
|
101
|
+
values: {
|
|
102
|
+
type: Array as PropType<FSToggle[]>,
|
|
103
|
+
required: false,
|
|
104
|
+
default: () => []
|
|
105
|
+
},
|
|
106
|
+
variant: {
|
|
107
|
+
type: String as PropType<"wrap" | "slide">,
|
|
108
|
+
required: false,
|
|
109
|
+
default: "wrap"
|
|
110
|
+
},
|
|
111
|
+
buttonVariant: {
|
|
112
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
113
|
+
required: false,
|
|
114
|
+
default: "standard"
|
|
115
|
+
},
|
|
116
|
+
activeVariant: {
|
|
117
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
118
|
+
required: false,
|
|
119
|
+
default: "standard"
|
|
120
|
+
},
|
|
121
|
+
buttonClass: {
|
|
122
|
+
type: [Array, String] as PropType<string[] | string>,
|
|
123
|
+
required: false,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
activeClass: {
|
|
127
|
+
type: [Array, String] as PropType<string[] | string>,
|
|
128
|
+
required: false,
|
|
129
|
+
default: null
|
|
130
|
+
},
|
|
131
|
+
modelValue: {
|
|
132
|
+
type: [Array, String, Number] as PropType<(string | number)[] | string | number>,
|
|
133
|
+
required: false,
|
|
134
|
+
default: false
|
|
135
|
+
},
|
|
136
|
+
buttonColor: {
|
|
137
|
+
type: String as PropType<ColorBase>,
|
|
138
|
+
required: false,
|
|
139
|
+
default: ColorEnum.Light
|
|
140
|
+
},
|
|
141
|
+
activeColor: {
|
|
142
|
+
type: String as PropType<ColorBase>,
|
|
143
|
+
required: false,
|
|
144
|
+
default: ColorEnum.Primary
|
|
145
|
+
},
|
|
146
|
+
padding: {
|
|
147
|
+
type: [String, Number],
|
|
148
|
+
required: false,
|
|
149
|
+
default: 0
|
|
150
|
+
},
|
|
151
|
+
gap: {
|
|
152
|
+
type: Number,
|
|
153
|
+
required: false,
|
|
154
|
+
default: 8
|
|
155
|
+
},
|
|
156
|
+
multiple: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
required: false,
|
|
159
|
+
default: false
|
|
160
|
+
},
|
|
161
|
+
required: {
|
|
162
|
+
type: Boolean,
|
|
163
|
+
required: false,
|
|
164
|
+
default: false
|
|
165
|
+
},
|
|
166
|
+
editable: {
|
|
167
|
+
type: Boolean,
|
|
168
|
+
required: false,
|
|
169
|
+
default: true
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
emits: ["update:modelValue"],
|
|
173
|
+
setup(props, { emit }) {
|
|
174
|
+
const { getFirstChild } = useSlots();
|
|
175
|
+
|
|
176
|
+
const firstChild = getFirstChild("item");
|
|
177
|
+
|
|
178
|
+
const getFromFirstChild = (prop: string, value: FSToggle): any => {
|
|
179
|
+
switch (prop) {
|
|
180
|
+
case "prependIcon":
|
|
181
|
+
return firstChild.props.prependIcon ?? value.prependIcon;
|
|
182
|
+
case "label":
|
|
183
|
+
return firstChild.props.label ?? value.label;
|
|
184
|
+
case "appendIcon":
|
|
185
|
+
return firstChild.props.appendIcon ?? value.appendIcon;
|
|
186
|
+
case "icon":
|
|
187
|
+
return firstChild.props.icon ?? value.icon;
|
|
188
|
+
case "variant":
|
|
189
|
+
return firstChild.props.variant ?? getVariant(value);
|
|
190
|
+
case "color":
|
|
191
|
+
return firstChild.props.color ?? getColor(value);
|
|
192
|
+
default:
|
|
193
|
+
return firstChild.props[prop];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
const getVariant = (value: FSToggle): "standard" | "full" | "icon" => {
|
|
198
|
+
if (Array.isArray(props.modelValue) && props.modelValue.some(v => v === value.id)) {
|
|
199
|
+
return props.activeVariant;
|
|
200
|
+
}
|
|
201
|
+
if (!Array.isArray(props.modelValue) && props.modelValue === value.id) {
|
|
202
|
+
return props.activeVariant;
|
|
203
|
+
}
|
|
204
|
+
return props.buttonVariant;
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const getColor = (value: FSToggle): ColorBase => {
|
|
208
|
+
if (Array.isArray(props.modelValue) && props.modelValue.some(v => v === value.id)) {
|
|
209
|
+
return props.activeColor;
|
|
210
|
+
}
|
|
211
|
+
if (!Array.isArray(props.modelValue) && props.modelValue === value.id) {
|
|
212
|
+
return props.activeColor;
|
|
213
|
+
}
|
|
214
|
+
return props.buttonColor;
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const getClass = (value: FSToggle): string[] | string => {
|
|
218
|
+
if (Array.isArray(props.modelValue) && props.modelValue.some(v => v === value.id)) {
|
|
219
|
+
return props.activeClass;
|
|
220
|
+
}
|
|
221
|
+
if (!Array.isArray(props.modelValue) && props.modelValue === value.id) {
|
|
222
|
+
return props.activeClass;
|
|
223
|
+
}
|
|
224
|
+
return props.buttonClass;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
const toggle = (value: FSToggle): void => {
|
|
228
|
+
if (Array.isArray(props.modelValue)) {
|
|
229
|
+
if (props.multiple) {
|
|
230
|
+
if (props.modelValue.length && props.modelValue.every(v => v === value.id)) {
|
|
231
|
+
if (!props.required) {
|
|
232
|
+
emit("update:modelValue", []);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
else if (props.modelValue.some(v => v === value.id)) {
|
|
237
|
+
emit("update:modelValue", props.modelValue.filter(v => v !== value.id));
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
emit("update:modelValue", [...props.modelValue, value.id]);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
if (props.modelValue.some(v => v === value.id)) {
|
|
247
|
+
if (!props.required) {
|
|
248
|
+
emit("update:modelValue", []);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
emit("update:modelValue", [value.id]);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
if (props.modelValue === value.id) {
|
|
260
|
+
if (!props.required) {
|
|
261
|
+
emit("update:modelValue", null);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
else {
|
|
266
|
+
emit("update:modelValue", value.id);
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
return {
|
|
273
|
+
firstChild,
|
|
274
|
+
getFromFirstChild,
|
|
275
|
+
getVariant,
|
|
276
|
+
getColor,
|
|
277
|
+
getClass,
|
|
278
|
+
toggle
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
})
|
|
282
|
+
</script>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-tooltip
|
|
3
|
+
class="fs-tooltip"
|
|
4
|
+
location="top"
|
|
5
|
+
>
|
|
6
|
+
<template #activator="{ props }">
|
|
7
|
+
<slot name="activator" v-bind="props" />
|
|
8
|
+
</template>
|
|
9
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
10
|
+
<slot :name="name" v-bind="slotData" />
|
|
11
|
+
</template>
|
|
12
|
+
</v-tooltip>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { defineComponent } from "vue";
|
|
17
|
+
|
|
18
|
+
export default defineComponent({
|
|
19
|
+
name: "FSTooltip"
|
|
20
|
+
});
|
|
21
|
+
</script>
|
package/components/FSWindow.vue
CHANGED
|
@@ -1,26 +1,36 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<v-window
|
|
3
|
+
class="fs-window"
|
|
4
|
+
v-bind="$attrs"
|
|
5
|
+
>
|
|
6
|
+
<v-window-item
|
|
7
|
+
v-for="(component, index) in getChildren()"
|
|
8
|
+
:value="value(component, index)"
|
|
9
|
+
:key="index"
|
|
6
10
|
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</v-window>
|
|
11
|
+
<component :is="component" />
|
|
12
|
+
</v-window-item>
|
|
13
|
+
</v-window>
|
|
11
14
|
</template>
|
|
12
15
|
|
|
13
16
|
<script lang="ts">
|
|
14
|
-
import { defineComponent } from "vue";
|
|
17
|
+
import { defineComponent, VNode } from "vue";
|
|
18
|
+
|
|
19
|
+
import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
20
|
|
|
16
21
|
export default defineComponent({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
name: "FSWindow",
|
|
23
|
+
setup() {
|
|
24
|
+
const { getChildren } = useSlots();
|
|
25
|
+
|
|
26
|
+
const value = (component: VNode, index: number): any => {
|
|
27
|
+
return component?.props?.value ?? index;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
getChildren,
|
|
32
|
+
value
|
|
24
33
|
}
|
|
34
|
+
}
|
|
25
35
|
});
|
|
26
36
|
</script>
|
|
@@ -1,59 +1,56 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
<v-slide-group
|
|
3
|
+
class="fs-wrap-group"
|
|
4
|
+
:style="style"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<v-slide-group-item
|
|
8
|
+
v-for="(component, index) in getChildren()"
|
|
9
|
+
:key="index"
|
|
6
10
|
>
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</v-slide-group-item>
|
|
11
|
-
</FSRow>
|
|
12
|
-
</v-slide-group>
|
|
11
|
+
<component :is="component" />
|
|
12
|
+
</v-slide-group-item>
|
|
13
|
+
</v-slide-group>
|
|
13
14
|
</template>
|
|
14
15
|
|
|
15
16
|
<script lang="ts">
|
|
16
|
-
import {
|
|
17
|
+
import { computed, defineComponent } from "vue";
|
|
17
18
|
|
|
18
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
import FSRow from "./FSRow.vue";
|
|
19
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
20
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
22
21
|
|
|
23
22
|
export default defineComponent({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type: String as PropType<ColorBase>,
|
|
31
|
-
required: false,
|
|
32
|
-
default: ColorBase.Primary
|
|
33
|
-
}
|
|
23
|
+
name: "FSWrapGroup",
|
|
24
|
+
props: {
|
|
25
|
+
padding: {
|
|
26
|
+
type: [String, Number],
|
|
27
|
+
required: false,
|
|
28
|
+
default: 0
|
|
34
29
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const darks = useColors().getColors(ColorBase.Dark);
|
|
41
|
-
|
|
42
|
-
const style: Ref<{ [code: string]: string } & Partial<CSSStyleDeclaration>> = ref({
|
|
43
|
-
"--fs-group-color": darks.base,
|
|
44
|
-
"--fs-group-hover-background-color": colors.light,
|
|
45
|
-
"--fs-group-hover-color": darks.dark,
|
|
46
|
-
"--fs-group-disabled-color": darks.light,
|
|
47
|
-
"--fs-group-light": colors.light,
|
|
48
|
-
"--fs-group-base": colors.base,
|
|
49
|
-
"--fs-group-dark": colors.dark
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
return {
|
|
53
|
-
color,
|
|
54
|
-
colors,
|
|
55
|
-
style
|
|
56
|
-
};
|
|
30
|
+
gap: {
|
|
31
|
+
type: Number,
|
|
32
|
+
required: false,
|
|
33
|
+
default: 8
|
|
57
34
|
}
|
|
35
|
+
},
|
|
36
|
+
setup(props) {
|
|
37
|
+
const { getChildren } = useSlots();
|
|
38
|
+
|
|
39
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
40
|
+
|
|
41
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
42
|
+
return {
|
|
43
|
+
"--fs-group-padding" : typeof(props.padding) === "string" ? props.padding : `${props.padding}px`,
|
|
44
|
+
"--fs-group-gap" : `${props.gap}px`,
|
|
45
|
+
"--fs-group-color" : darks.light,
|
|
46
|
+
"--fs-group-hover-color": darks.dark
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
style,
|
|
52
|
+
getChildren
|
|
53
|
+
};
|
|
54
|
+
}
|
|
58
55
|
});
|
|
59
56
|
</script>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu
|
|
3
|
+
v-if="$props.deviceConnectivity"
|
|
4
|
+
:closeOnContentClick="false"
|
|
5
|
+
v-model="menu"
|
|
6
|
+
>
|
|
7
|
+
<template #activator="{ props }">
|
|
8
|
+
<FSColorIcon
|
|
9
|
+
size="m"
|
|
10
|
+
variant="fill"
|
|
11
|
+
:color="$props.deviceConnectivity.color"
|
|
12
|
+
v-bind="props"
|
|
13
|
+
>
|
|
14
|
+
{{ $props.deviceConnectivity.icon }}
|
|
15
|
+
</FSColorIcon>
|
|
16
|
+
</template>
|
|
17
|
+
<FSCard
|
|
18
|
+
:elevation="true"
|
|
19
|
+
:border="false"
|
|
20
|
+
>
|
|
21
|
+
<FSCol
|
|
22
|
+
align="center-center"
|
|
23
|
+
padding="6px 24px"
|
|
24
|
+
>
|
|
25
|
+
<FSCol
|
|
26
|
+
align="center-center"
|
|
27
|
+
gap="12px"
|
|
28
|
+
>
|
|
29
|
+
<FSChip
|
|
30
|
+
:color="$props.deviceConnectivity.color"
|
|
31
|
+
:prependIcon="$props.deviceConnectivity.icon"
|
|
32
|
+
:label="connectivityLabel"
|
|
33
|
+
/>
|
|
34
|
+
<FSRow
|
|
35
|
+
width="hug"
|
|
36
|
+
>
|
|
37
|
+
<FSText>
|
|
38
|
+
{{ $tr("ui.shared.device-connectivity.last-message", "Last message") }}
|
|
39
|
+
</FSText>
|
|
40
|
+
</FSRow>
|
|
41
|
+
</FSCol>
|
|
42
|
+
<FSRow
|
|
43
|
+
v-if="deviceTimestamp"
|
|
44
|
+
width="hug"
|
|
45
|
+
>
|
|
46
|
+
<FSSpan
|
|
47
|
+
font="text-overline"
|
|
48
|
+
>
|
|
49
|
+
{{ deviceTimestamp }}
|
|
50
|
+
</FSSpan>
|
|
51
|
+
</FSRow>
|
|
52
|
+
</FSCol>
|
|
53
|
+
</FSCard>
|
|
54
|
+
</v-menu>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script lang="ts">
|
|
58
|
+
import { computed, defineComponent, PropType, ref } from "vue";
|
|
59
|
+
|
|
60
|
+
import { useTimeZone, useTranslationsProvider } from "@dative-gpi/foundation-shared-services/composables";
|
|
61
|
+
import { FSDeviceConnectivity } from "@dative-gpi/foundation-shared-components/models";
|
|
62
|
+
import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/models";
|
|
63
|
+
|
|
64
|
+
import FSColorIcon from "../FSColorIcon.vue";
|
|
65
|
+
import FSCard from "../FSCard.vue";
|
|
66
|
+
import FSChip from "../FSChip.vue";
|
|
67
|
+
import FSText from "../FSText.vue";
|
|
68
|
+
import FSSpan from "../FSSpan.vue";
|
|
69
|
+
|
|
70
|
+
export default defineComponent({
|
|
71
|
+
name: "FSConnectivity",
|
|
72
|
+
components: {
|
|
73
|
+
FSColorIcon,
|
|
74
|
+
FSCard,
|
|
75
|
+
FSChip,
|
|
76
|
+
FSText,
|
|
77
|
+
FSSpan
|
|
78
|
+
},
|
|
79
|
+
props: {
|
|
80
|
+
deviceConnectivity: {
|
|
81
|
+
type: Object as PropType<FSDeviceConnectivity>,
|
|
82
|
+
required: true
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
setup(props) {
|
|
86
|
+
const { epochToLongTimeFormat } = useTimeZone();
|
|
87
|
+
const { $tr } = useTranslationsProvider();
|
|
88
|
+
|
|
89
|
+
const menu = ref(false);
|
|
90
|
+
|
|
91
|
+
const connectivityLabel = computed((): string => {
|
|
92
|
+
switch (props.deviceConnectivity.status) {
|
|
93
|
+
case ConnectivityStatus.Connected: return $tr("ui.connectivity-status.connected", "Connected");
|
|
94
|
+
case ConnectivityStatus.PartiallyConnected: return $tr("ui.connectivity-status.partially-connected", "Partially connected");
|
|
95
|
+
case ConnectivityStatus.AlmostOffline: return $tr("ui.connectivity-status.almost-offline", "Almost offline");
|
|
96
|
+
default: return $tr("ui.connectivity-status.offline", "Offline");
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const deviceTimestamp = computed((): string => {
|
|
101
|
+
if (props.deviceConnectivity.sourceTimestamp) {
|
|
102
|
+
return epochToLongTimeFormat(props.deviceConnectivity.sourceTimestamp);
|
|
103
|
+
}
|
|
104
|
+
return "";
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
connectivityLabel,
|
|
109
|
+
deviceTimestamp,
|
|
110
|
+
menu
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
</script>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu
|
|
3
|
+
:closeOnContentClick="false"
|
|
4
|
+
v-model="menu"
|
|
5
|
+
>
|
|
6
|
+
<template #activator="{ props }">
|
|
7
|
+
<FSColorIcon
|
|
8
|
+
size="m"
|
|
9
|
+
variant="fill"
|
|
10
|
+
:color="$props.statusGroup.color"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
>
|
|
13
|
+
{{ $props.statusGroup.icon }}
|
|
14
|
+
</FSColorIcon>
|
|
15
|
+
</template>
|
|
16
|
+
<FSCard
|
|
17
|
+
:elevation="true"
|
|
18
|
+
:border="false"
|
|
19
|
+
>
|
|
20
|
+
<FSCol
|
|
21
|
+
align="center-center"
|
|
22
|
+
padding="6px 24px"
|
|
23
|
+
>
|
|
24
|
+
<FSCol
|
|
25
|
+
align="center-center"
|
|
26
|
+
gap="12px"
|
|
27
|
+
>
|
|
28
|
+
<FSChip
|
|
29
|
+
:color="$props.statusGroup.color"
|
|
30
|
+
:prependIcon="$props.statusGroup.icon"
|
|
31
|
+
:label="$props.statusGroup.label"
|
|
32
|
+
/>
|
|
33
|
+
<FSRow
|
|
34
|
+
v-if="$props.statusGroup.value"
|
|
35
|
+
width="hug"
|
|
36
|
+
>
|
|
37
|
+
<FSText
|
|
38
|
+
font="text-button"
|
|
39
|
+
:color="$props.statusGroup.color"
|
|
40
|
+
>
|
|
41
|
+
{{ $props.statusGroup.value }} {{ $props.statusGroup.unit }}
|
|
42
|
+
</FSText>
|
|
43
|
+
</FSRow>
|
|
44
|
+
<FSRow
|
|
45
|
+
v-if="$props.statusGroup.value && $props.modelStatus.groupById && $props.statusGroup.groupByValue"
|
|
46
|
+
width="hug"
|
|
47
|
+
>
|
|
48
|
+
<FSSpan>
|
|
49
|
+
{{ $props.modelStatus.groupByLabel }} {{ $props.statusGroup.groupByValue }}
|
|
50
|
+
</FSSpan>
|
|
51
|
+
</FSRow>
|
|
52
|
+
</FSCol>
|
|
53
|
+
<FSRow
|
|
54
|
+
v-if="deviceTimestamp"
|
|
55
|
+
width="hug"
|
|
56
|
+
>
|
|
57
|
+
<FSSpan
|
|
58
|
+
font="text-overline"
|
|
59
|
+
>
|
|
60
|
+
{{ deviceTimestamp }}
|
|
61
|
+
</FSSpan>
|
|
62
|
+
</FSRow>
|
|
63
|
+
</FSCol>
|
|
64
|
+
</FSCard>
|
|
65
|
+
</v-menu>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script lang="ts">
|
|
69
|
+
import { computed, defineComponent, PropType, ref } from "vue";
|
|
70
|
+
|
|
71
|
+
import { FSDeviceStatusGroup, FSModelStatus } from "@dative-gpi/foundation-shared-components/models";
|
|
72
|
+
import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
73
|
+
|
|
74
|
+
import FSColorIcon from "../FSColorIcon.vue";
|
|
75
|
+
import FSCard from "../FSCard.vue";
|
|
76
|
+
import FSChip from "../FSChip.vue";
|
|
77
|
+
import FSText from "../FSText.vue";
|
|
78
|
+
import FSSpan from "../FSSpan.vue";
|
|
79
|
+
|
|
80
|
+
export default defineComponent({
|
|
81
|
+
name: "FSStatus",
|
|
82
|
+
components: {
|
|
83
|
+
FSColorIcon,
|
|
84
|
+
FSCard,
|
|
85
|
+
FSChip,
|
|
86
|
+
FSText,
|
|
87
|
+
FSSpan
|
|
88
|
+
},
|
|
89
|
+
props: {
|
|
90
|
+
modelStatus: {
|
|
91
|
+
type: Object as PropType<FSModelStatus>,
|
|
92
|
+
required: true
|
|
93
|
+
},
|
|
94
|
+
statusGroup: {
|
|
95
|
+
type: Object as PropType<FSDeviceStatusGroup>,
|
|
96
|
+
required: true
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
setup(props) {
|
|
100
|
+
const { epochToLongTimeFormat } = useTimeZone();
|
|
101
|
+
|
|
102
|
+
const menu = ref(false);
|
|
103
|
+
|
|
104
|
+
const deviceTimestamp = computed((): string => {
|
|
105
|
+
if (props.statusGroup.sourceTimestamp) {
|
|
106
|
+
return epochToLongTimeFormat(props.statusGroup.sourceTimestamp);
|
|
107
|
+
}
|
|
108
|
+
return "";
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
deviceTimestamp,
|
|
113
|
+
menu
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
</script>
|