@dative-gpi/foundation-shared-components 0.0.7 → 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 +184 -0
- package/components/FSCalendarTwin.vue +412 -0
- package/components/FSCard.vue +77 -0
- package/components/FSCarousel.vue +63 -0
- package/components/FSCheckbox.vue +111 -104
- package/components/FSChip.vue +140 -0
- package/components/FSClock.vue +172 -0
- 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 -99
- package/components/FSRadio.vue +107 -110
- package/components/FSRadioGroup.vue +55 -57
- package/components/FSRemoveDialog.vue +123 -0
- package/components/FSRichTextField.vue +551 -0
- package/components/FSRow.vue +110 -104
- package/components/FSSearchField.vue +114 -105
- package/components/FSSelectField.vue +188 -0
- package/components/FSSlideGroup.vue +45 -49
- package/components/FSSlider.vue +130 -0
- 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 +183 -128
- package/components/FSTagGroup.vue +38 -45
- package/components/FSText.vue +74 -64
- package/components/FSTextArea.vue +209 -0
- package/components/FSTextField.vue +152 -149
- 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 +2 -1
- package/composables/useBreakpoints.ts +33 -0
- 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 +13 -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 -14
- package/styles/components/fs_calendar.scss +138 -0
- package/styles/components/fs_card.scss +4 -0
- 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 +14 -4
- 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_rich_text_field.scss +67 -0
- 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 +40 -0
- 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 +6 -8
- package/styles/components/fs_text_area.scss +105 -0
- 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 +26 -0
- 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 -0
- package/utils/levenshtein.ts +97 -0
- package/utils/lexical.ts +27 -0
- package/utils/sort.ts +9 -0
- package/composables/useTouch.ts +0 -9
- package/models/FSTags.ts +0 -8
- package/models/FSTextFields.ts +0 -17
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu
|
|
3
|
+
:closeOnContentClick="false"
|
|
4
|
+
v-model="expanded"
|
|
5
|
+
>
|
|
6
|
+
<template #activator="{ props }">
|
|
7
|
+
<FSChip
|
|
8
|
+
class="fs-filter-button"
|
|
9
|
+
variant="standard"
|
|
10
|
+
prependIcon="mdi-filter-variant"
|
|
11
|
+
:color="ColorEnum.Dark"
|
|
12
|
+
:editable="true"
|
|
13
|
+
:label="label"
|
|
14
|
+
v-bind="props"
|
|
15
|
+
/>
|
|
16
|
+
</template>
|
|
17
|
+
<FSCard
|
|
18
|
+
:elevation="true"
|
|
19
|
+
:border="false"
|
|
20
|
+
>
|
|
21
|
+
<FSCol
|
|
22
|
+
gap="16px"
|
|
23
|
+
padding="0 0 0 16px"
|
|
24
|
+
>
|
|
25
|
+
<FSSpan
|
|
26
|
+
font="text-overline"
|
|
27
|
+
>
|
|
28
|
+
{{ $tr("ui.data-table.filter", "Filter") }}
|
|
29
|
+
</FSSpan>
|
|
30
|
+
<FSChip
|
|
31
|
+
class="fs-filter-button-all"
|
|
32
|
+
:editable="true"
|
|
33
|
+
:color="$props.color"
|
|
34
|
+
:variant="all ? 'full' : 'standard'"
|
|
35
|
+
:label="$tr('ui.data-table.all-values', 'All values')"
|
|
36
|
+
@click="onToggleAll"
|
|
37
|
+
/>
|
|
38
|
+
<FSSearchField
|
|
39
|
+
class="fs-filter-button-all"
|
|
40
|
+
prependInnerIcon="mdi-magnify"
|
|
41
|
+
v-model="search"
|
|
42
|
+
/>
|
|
43
|
+
<v-divider />
|
|
44
|
+
<FSFadeOut
|
|
45
|
+
class="fs-filter-button-fade"
|
|
46
|
+
>
|
|
47
|
+
<FSCol>
|
|
48
|
+
<FSChip
|
|
49
|
+
v-for="(filter, index) in searchedFilters"
|
|
50
|
+
class="fs-filter-button-filter"
|
|
51
|
+
:key="index"
|
|
52
|
+
:editable="true"
|
|
53
|
+
:label="filter.text"
|
|
54
|
+
:color="$props.color"
|
|
55
|
+
:variant="getVariant(filter)"
|
|
56
|
+
@click="() => onToggle(filter)"
|
|
57
|
+
>
|
|
58
|
+
<template #default>
|
|
59
|
+
<slot v-bind="{ filter }" />
|
|
60
|
+
</template>
|
|
61
|
+
</FSChip>
|
|
62
|
+
</FSCol>
|
|
63
|
+
</FSFadeOut>
|
|
64
|
+
</FSCol>
|
|
65
|
+
</FSCard>
|
|
66
|
+
</v-menu>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script lang="ts">
|
|
70
|
+
import { computed, defineComponent, PropType, ref } from "vue";
|
|
71
|
+
|
|
72
|
+
import { ColorBase, ColorEnum, FSDataTableColumn, FSDataTableFilter } from "@dative-gpi/foundation-shared-components/models";
|
|
73
|
+
import { useTranslationsProvider } from "@dative-gpi/foundation-shared-services/composables";
|
|
74
|
+
|
|
75
|
+
import FSSearchField from "../FSSearchField.vue";
|
|
76
|
+
import FSFadeOut from "../FSFadeOut.vue";
|
|
77
|
+
import FSCard from "../FSCard.vue";
|
|
78
|
+
import FSChip from "../FSChip.vue";
|
|
79
|
+
import FSSpan from "../FSSpan.vue";
|
|
80
|
+
import FSCol from "../FSCol.vue";
|
|
81
|
+
|
|
82
|
+
export default defineComponent({
|
|
83
|
+
name: "FSFilterButton",
|
|
84
|
+
components: {
|
|
85
|
+
FSSearchField,
|
|
86
|
+
FSFadeOut,
|
|
87
|
+
FSCard,
|
|
88
|
+
FSChip,
|
|
89
|
+
FSSpan,
|
|
90
|
+
FSCol
|
|
91
|
+
},
|
|
92
|
+
props: {
|
|
93
|
+
header: {
|
|
94
|
+
type: Object as PropType<FSDataTableColumn>,
|
|
95
|
+
required: true
|
|
96
|
+
},
|
|
97
|
+
filters: {
|
|
98
|
+
type: Array as PropType<FSDataTableFilter[]>,
|
|
99
|
+
required: false,
|
|
100
|
+
default: () => []
|
|
101
|
+
},
|
|
102
|
+
color: {
|
|
103
|
+
type: String as PropType<ColorBase>,
|
|
104
|
+
required: false,
|
|
105
|
+
default: ColorEnum.Primary
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
emits: ["update:filter"],
|
|
109
|
+
setup(props, { emit }) {
|
|
110
|
+
const { $tr } = useTranslationsProvider();
|
|
111
|
+
|
|
112
|
+
const expanded = ref(false);
|
|
113
|
+
const search = ref(null);
|
|
114
|
+
const all = ref(!props.filters?.some(f => f.hidden) ?? true);
|
|
115
|
+
|
|
116
|
+
const label = computed(() => {
|
|
117
|
+
if (props.filters) {
|
|
118
|
+
const hidden = props.filters.filter(f => f.hidden).length;
|
|
119
|
+
if (hidden > 0) {
|
|
120
|
+
return $tr("ui.data-table.some-filters-visible", "{0}: {1} visible", props.header.text, (props.filters.length - hidden).toString());
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
return $tr("ui.data-table.all-filters-visible", "{0}: All visible", props.header.text);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const searchedFilters = computed((): FSDataTableFilter[] => {
|
|
127
|
+
if (search.value) {
|
|
128
|
+
return props.filters.filter(f => (f.text + f.value).includes(search.value));
|
|
129
|
+
}
|
|
130
|
+
return props.filters;
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const getVariant = (filter: FSDataTableFilter): "standard" | "full" => {
|
|
134
|
+
if (all.value || filter.hidden) {
|
|
135
|
+
return "standard";
|
|
136
|
+
}
|
|
137
|
+
return "full";
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const onToggle = (filter: FSDataTableFilter): void => {
|
|
141
|
+
if (all.value) {
|
|
142
|
+
all.value = false;
|
|
143
|
+
emit("update:filter", props.filters.map(f => ({ ...f, hidden: f.value !== filter.value })));
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
if (filter.hidden && !props.filters.some(f => !f.hidden && f.value !== filter.value)) {
|
|
147
|
+
all.value = true;
|
|
148
|
+
}
|
|
149
|
+
emit("update:filter", props.filters.map(f => ({ ...f, hidden: f.value === filter.value ? !f.hidden : f.hidden })));
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const onToggleAll = (): void => {
|
|
154
|
+
if (all.value) {
|
|
155
|
+
all.value = false;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
all.value = true;
|
|
159
|
+
emit("update:filter", props.filters.map(f => ({ ...f, hidden: false })));
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
searchedFilters,
|
|
165
|
+
ColorEnum,
|
|
166
|
+
expanded,
|
|
167
|
+
search,
|
|
168
|
+
label,
|
|
169
|
+
all,
|
|
170
|
+
getVariant,
|
|
171
|
+
onToggle,
|
|
172
|
+
onToggleAll
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
</script>
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu
|
|
3
|
+
v-model="expanded"
|
|
4
|
+
>
|
|
5
|
+
<template #activator="{ props }">
|
|
6
|
+
<FSButton
|
|
7
|
+
class="fs-header-button"
|
|
8
|
+
icon="mdi-dots-vertical"
|
|
9
|
+
variant="icon"
|
|
10
|
+
:color="ColorEnum.Light"
|
|
11
|
+
v-bind="props"
|
|
12
|
+
/>
|
|
13
|
+
</template>
|
|
14
|
+
<FSCard
|
|
15
|
+
:elevation="true"
|
|
16
|
+
:border="false"
|
|
17
|
+
>
|
|
18
|
+
<FSCol
|
|
19
|
+
gap="16px"
|
|
20
|
+
padding="16px"
|
|
21
|
+
>
|
|
22
|
+
<FSSpan
|
|
23
|
+
font="text-overline"
|
|
24
|
+
>
|
|
25
|
+
{{ $tr("ui.data-table.column-options", "Options for this column") }}
|
|
26
|
+
</FSSpan>
|
|
27
|
+
<FSCol
|
|
28
|
+
padding="16px"
|
|
29
|
+
>
|
|
30
|
+
<FSButton
|
|
31
|
+
variant="icon"
|
|
32
|
+
icon="mdi-eye-off-outline"
|
|
33
|
+
:label="$tr('ui.data-table.hide-column', 'Hide column')"
|
|
34
|
+
:color="ColorEnum.Dark"
|
|
35
|
+
@click="$emit('update:hide')"
|
|
36
|
+
/>
|
|
37
|
+
<FSButton
|
|
38
|
+
v-if="!$props.first"
|
|
39
|
+
variant="icon"
|
|
40
|
+
icon="mdi-chevron-left"
|
|
41
|
+
:label="$tr('ui.data-table.move-left', 'Move to the left')"
|
|
42
|
+
:color="ColorEnum.Dark"
|
|
43
|
+
@click="$emit('update:left')"
|
|
44
|
+
/>
|
|
45
|
+
<FSButton
|
|
46
|
+
v-if="!$props.last"
|
|
47
|
+
variant="icon"
|
|
48
|
+
icon="mdi-chevron-right"
|
|
49
|
+
:label="$tr('ui.data-table.move-right', 'Move to the right')"
|
|
50
|
+
:color="ColorEnum.Dark"
|
|
51
|
+
@click="$emit('update:right')"
|
|
52
|
+
/>
|
|
53
|
+
</FSCol>
|
|
54
|
+
</FSCol>
|
|
55
|
+
</FSCard>
|
|
56
|
+
</v-menu>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
import { defineComponent, ref } from "vue";
|
|
61
|
+
|
|
62
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
63
|
+
|
|
64
|
+
import FSButton from "../FSButton.vue";
|
|
65
|
+
import FSCard from "../FSCard.vue";
|
|
66
|
+
import FSSpan from "../FSSpan.vue";
|
|
67
|
+
import FSCol from "../FSCol.vue";
|
|
68
|
+
|
|
69
|
+
export default defineComponent({
|
|
70
|
+
name: "FSHeaderButton",
|
|
71
|
+
components: {
|
|
72
|
+
FSButton,
|
|
73
|
+
FSCard,
|
|
74
|
+
FSSpan,
|
|
75
|
+
FSCol
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
first: {
|
|
79
|
+
type: Boolean,
|
|
80
|
+
required: false,
|
|
81
|
+
default: false
|
|
82
|
+
},
|
|
83
|
+
last: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
required: false,
|
|
86
|
+
default: false
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
emits: ["update:hide", "update:left", "update:right"],
|
|
90
|
+
setup() {
|
|
91
|
+
const expanded = ref(false);
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
ColorEnum,
|
|
95
|
+
expanded
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
</script>
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu
|
|
3
|
+
:closeOnContentClick="false"
|
|
4
|
+
v-model="expanded"
|
|
5
|
+
>
|
|
6
|
+
<template #activator="{ props }">
|
|
7
|
+
<FSChip
|
|
8
|
+
prependIcon="mdi-eye-off-outline"
|
|
9
|
+
:color="ColorEnum.Light"
|
|
10
|
+
:editable="true"
|
|
11
|
+
:label="$tr('ui.data-table.hidden-columns', '{0} hidden column(s)', $props.headers.length.toString())"
|
|
12
|
+
v-bind="props"
|
|
13
|
+
/>
|
|
14
|
+
</template>
|
|
15
|
+
<FSCard
|
|
16
|
+
:elevation="true"
|
|
17
|
+
:border="false"
|
|
18
|
+
>
|
|
19
|
+
<FSCol
|
|
20
|
+
gap="16px"
|
|
21
|
+
padding="16px"
|
|
22
|
+
>
|
|
23
|
+
<FSSpan
|
|
24
|
+
font="text-overline"
|
|
25
|
+
>
|
|
26
|
+
{{ $tr("ui.data-table.show-columns", "Show columns") }}
|
|
27
|
+
</FSSpan>
|
|
28
|
+
<FSChip
|
|
29
|
+
v-for="(header, index) in $props.headers"
|
|
30
|
+
:color="$props.color"
|
|
31
|
+
:label="header.text"
|
|
32
|
+
:editable="true"
|
|
33
|
+
:key="index"
|
|
34
|
+
@click="$emit('update:show', header)"
|
|
35
|
+
/>
|
|
36
|
+
</FSCol>
|
|
37
|
+
</FSCard>
|
|
38
|
+
</v-menu>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script lang="ts">
|
|
42
|
+
import { defineComponent, PropType, ref } from "vue";
|
|
43
|
+
|
|
44
|
+
import { ColorBase, ColorEnum, FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
|
|
45
|
+
|
|
46
|
+
import FSCard from "../FSCard.vue";
|
|
47
|
+
import FSChip from "../FSChip.vue";
|
|
48
|
+
import FSSpan from "../FSSpan.vue";
|
|
49
|
+
import FSCol from "../FSCol.vue";
|
|
50
|
+
|
|
51
|
+
export default defineComponent({
|
|
52
|
+
name: "FSHiddenButton",
|
|
53
|
+
components: {
|
|
54
|
+
FSCard,
|
|
55
|
+
FSChip,
|
|
56
|
+
FSSpan,
|
|
57
|
+
FSCol
|
|
58
|
+
},
|
|
59
|
+
props: {
|
|
60
|
+
headers: {
|
|
61
|
+
type: Array as PropType<FSDataTableColumn[]>,
|
|
62
|
+
required: true
|
|
63
|
+
},
|
|
64
|
+
color: {
|
|
65
|
+
type: String as PropType<ColorBase>,
|
|
66
|
+
required: false,
|
|
67
|
+
default: ColorEnum.Primary
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
setup() {
|
|
71
|
+
const expanded = ref(false);
|
|
72
|
+
|
|
73
|
+
return {
|
|
74
|
+
ColorEnum,
|
|
75
|
+
expanded
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
</script>
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSTile
|
|
3
|
+
:bottomColor="ColorEnum.Primary"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
>
|
|
8
|
+
<FSCol
|
|
9
|
+
align="center-center"
|
|
10
|
+
width="fill"
|
|
11
|
+
>
|
|
12
|
+
<FSRow
|
|
13
|
+
align="center-center"
|
|
14
|
+
gap="24px"
|
|
15
|
+
:wrap="false"
|
|
16
|
+
:height="infoHeight"
|
|
17
|
+
>
|
|
18
|
+
<FSCol
|
|
19
|
+
gap="12px"
|
|
20
|
+
>
|
|
21
|
+
<FSCol
|
|
22
|
+
gap="6px"
|
|
23
|
+
:width="infoWidth"
|
|
24
|
+
>
|
|
25
|
+
<FSSpan
|
|
26
|
+
font="text-button"
|
|
27
|
+
:lineClamp="2"
|
|
28
|
+
>
|
|
29
|
+
{{ $props.label }}
|
|
30
|
+
</FSSpan>
|
|
31
|
+
<FSSpan
|
|
32
|
+
font="text-overline"
|
|
33
|
+
>
|
|
34
|
+
{{ $props.code }}
|
|
35
|
+
</FSSpan>
|
|
36
|
+
</FSCol>
|
|
37
|
+
<FSRow
|
|
38
|
+
gap="4px"
|
|
39
|
+
>
|
|
40
|
+
<FSConnectivity
|
|
41
|
+
:deviceConnectivity="$props.deviceConnectivity"
|
|
42
|
+
/>
|
|
43
|
+
<FSWorstAlert
|
|
44
|
+
v-if="$props.deviceWorstAlert"
|
|
45
|
+
:deviceAlert="$props.deviceWorstAlert"
|
|
46
|
+
:deviceAlerts="$props.deviceAlerts.length"
|
|
47
|
+
/>
|
|
48
|
+
<FSStatusesRow
|
|
49
|
+
:modelStatuses="lineModelStatuses"
|
|
50
|
+
:deviceStatuses="lineDeviceStatuses"
|
|
51
|
+
/>
|
|
52
|
+
</FSRow>
|
|
53
|
+
</FSCol>
|
|
54
|
+
<FSImage
|
|
55
|
+
v-if="$props.imageId"
|
|
56
|
+
:imageId="$props.imageId"
|
|
57
|
+
:width="imageSize"
|
|
58
|
+
/>
|
|
59
|
+
</FSRow>
|
|
60
|
+
<template v-if="carouselModelStatuses.length">
|
|
61
|
+
<FSDivider />
|
|
62
|
+
<FSStatusesCarousel
|
|
63
|
+
:modelStatuses="carouselModelStatuses"
|
|
64
|
+
:deviceStatuses="carouselDeviceStatuses"
|
|
65
|
+
/>
|
|
66
|
+
</template>
|
|
67
|
+
</FSCol>
|
|
68
|
+
</FSTile>
|
|
69
|
+
</template>
|
|
70
|
+
|
|
71
|
+
<script lang="ts">
|
|
72
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
73
|
+
|
|
74
|
+
import { FSModelStatus, FSDeviceStatus, FSDeviceAlert, FSDeviceConnectivity } from "@dative-gpi/foundation-shared-components/models";
|
|
75
|
+
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
76
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
77
|
+
|
|
78
|
+
import FSStatusesCarousel from "../deviceOrganisations/FSStatusesCarousel.vue";
|
|
79
|
+
import FSConnectivity from "../deviceOrganisations/FSConnectivity.vue";
|
|
80
|
+
import FSStatusesRow from "../deviceOrganisations/FSStatusesRow.vue";
|
|
81
|
+
import FSWorstAlert from "../deviceOrganisations/FSWorstAlert.vue";
|
|
82
|
+
import FSDivider from "../FSDivider.vue";
|
|
83
|
+
import FSImage from "../FSImage.vue";
|
|
84
|
+
import FSSpan from "../FSSpan.vue";
|
|
85
|
+
import FSTile from "../FSTile.vue";
|
|
86
|
+
import FSCol from "../FSCol.vue";
|
|
87
|
+
import FSRow from "../FSRow.vue";
|
|
88
|
+
|
|
89
|
+
export default defineComponent({
|
|
90
|
+
name: "FSDeviceOrganisationTileUI",
|
|
91
|
+
components: {
|
|
92
|
+
FSStatusesCarousel,
|
|
93
|
+
FSConnectivity,
|
|
94
|
+
FSStatusesRow,
|
|
95
|
+
FSWorstAlert,
|
|
96
|
+
FSDivider,
|
|
97
|
+
FSImage,
|
|
98
|
+
FSTile,
|
|
99
|
+
FSSpan,
|
|
100
|
+
FSCol,
|
|
101
|
+
FSRow
|
|
102
|
+
},
|
|
103
|
+
props: {
|
|
104
|
+
imageId: {
|
|
105
|
+
type: String,
|
|
106
|
+
required: false,
|
|
107
|
+
default: null
|
|
108
|
+
},
|
|
109
|
+
label: {
|
|
110
|
+
type: String,
|
|
111
|
+
required: false,
|
|
112
|
+
default: null
|
|
113
|
+
},
|
|
114
|
+
code: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: false,
|
|
117
|
+
default: null
|
|
118
|
+
},
|
|
119
|
+
deviceConnectivity: {
|
|
120
|
+
type: Object as PropType<FSDeviceConnectivity>,
|
|
121
|
+
required: false,
|
|
122
|
+
default: null
|
|
123
|
+
},
|
|
124
|
+
deviceWorstAlert: {
|
|
125
|
+
type: Object as PropType<FSDeviceAlert>,
|
|
126
|
+
required: false,
|
|
127
|
+
default: null
|
|
128
|
+
},
|
|
129
|
+
deviceAlerts: {
|
|
130
|
+
type: Array as PropType<FSDeviceAlert[]>,
|
|
131
|
+
required: false,
|
|
132
|
+
default: null
|
|
133
|
+
},
|
|
134
|
+
modelStatuses: {
|
|
135
|
+
type: Array as PropType<FSModelStatus[]>,
|
|
136
|
+
required: true,
|
|
137
|
+
default: () => []
|
|
138
|
+
},
|
|
139
|
+
deviceStatuses: {
|
|
140
|
+
type: Array as PropType<FSDeviceStatus[]>,
|
|
141
|
+
required: true,
|
|
142
|
+
default: () => []
|
|
143
|
+
},
|
|
144
|
+
modelValue: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
required: false,
|
|
147
|
+
default: false
|
|
148
|
+
},
|
|
149
|
+
editable: {
|
|
150
|
+
type: Boolean,
|
|
151
|
+
required: false,
|
|
152
|
+
default: true
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
setup(props) {
|
|
156
|
+
const { isMobileSized } = useBreakpoints();
|
|
157
|
+
|
|
158
|
+
const lineModelStatuses = computed((): FSModelStatus[] => {
|
|
159
|
+
return props.modelStatuses.filter(modelStatus => {
|
|
160
|
+
if (!modelStatus.inline || modelStatus.groupById) {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
if (!modelStatus.showDefault) {
|
|
164
|
+
if (!props.deviceStatuses.some(deviceStatus => deviceStatus.modelStatusId === modelStatus.id)) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return true;
|
|
169
|
+
}).slice(0, 4).sort((a, b) => a.index - b.index);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
const lineDeviceStatuses = computed((): FSDeviceStatus[] => {
|
|
173
|
+
return props.deviceStatuses.filter(deviceStatus => {
|
|
174
|
+
return lineModelStatuses.value.some(modelStatus => modelStatus.id === deviceStatus.modelStatusId)
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const carouselModelStatuses = computed((): FSModelStatus[] => {
|
|
179
|
+
const notCarouselModelStatuses = props.modelStatuses.filter(modelStatus => {
|
|
180
|
+
if (!modelStatus.inline || modelStatus.groupById) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
return true;
|
|
184
|
+
}).slice(0, 4);
|
|
185
|
+
return props.modelStatuses.filter(modelStatus => {
|
|
186
|
+
if (notCarouselModelStatuses.some(lineModelStatus => modelStatus.id === lineModelStatus.id)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
if (!modelStatus.showDefault) {
|
|
190
|
+
if (!props.deviceStatuses.some(deviceStatus => deviceStatus.modelStatusId === modelStatus.id)) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return true;
|
|
195
|
+
}).sort((a, b) => (a.index + (a.inline ? b.index : 0)) - b.index);
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
const carouselDeviceStatuses = computed((): FSDeviceStatus[] => {
|
|
199
|
+
return props.deviceStatuses.filter(deviceStatus => {
|
|
200
|
+
return carouselModelStatuses.value.some(modelStatus => modelStatus.id === deviceStatus.modelStatusId)
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const imageSize = computed((): number => {
|
|
205
|
+
return isMobileSized.value ? 90 : 100;
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const infoWidth = computed((): string => {
|
|
209
|
+
let width = isMobileSized.value ? 288 : 304;
|
|
210
|
+
if (props.imageId) {
|
|
211
|
+
width -= imageSize.value;
|
|
212
|
+
}
|
|
213
|
+
return `${width}px`;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
const infoHeight = computed((): string => {
|
|
217
|
+
return `${imageSize.value}px`;
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
return {
|
|
221
|
+
ColorEnum,
|
|
222
|
+
lineModelStatuses,
|
|
223
|
+
lineDeviceStatuses,
|
|
224
|
+
carouselModelStatuses,
|
|
225
|
+
carouselDeviceStatuses,
|
|
226
|
+
imageSize,
|
|
227
|
+
infoWidth,
|
|
228
|
+
infoHeight
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
</script>
|