@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,192 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSTile
|
|
3
|
+
:bottomColor="ColorEnum.Error"
|
|
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
|
+
>
|
|
28
|
+
{{ $props.label }}
|
|
29
|
+
</FSSpan>
|
|
30
|
+
<FSSpan
|
|
31
|
+
font="text-overline"
|
|
32
|
+
>
|
|
33
|
+
{{ $props.code }}
|
|
34
|
+
</FSSpan>
|
|
35
|
+
</FSCol>
|
|
36
|
+
<FSCol
|
|
37
|
+
gap="6px"
|
|
38
|
+
>
|
|
39
|
+
<FSRow
|
|
40
|
+
align="center-left"
|
|
41
|
+
>
|
|
42
|
+
<FSColor
|
|
43
|
+
align="center-center"
|
|
44
|
+
padding="0 8px"
|
|
45
|
+
height="24px"
|
|
46
|
+
:color="ColorEnum.Primary"
|
|
47
|
+
>
|
|
48
|
+
<FSText
|
|
49
|
+
font="text-overline"
|
|
50
|
+
>
|
|
51
|
+
{{ groupsLabel }}
|
|
52
|
+
</FSText>
|
|
53
|
+
</FSColor>
|
|
54
|
+
<FSSpan
|
|
55
|
+
font="text-overline"
|
|
56
|
+
>
|
|
57
|
+
{{ $tr("ui.group-tile.group(s)", "Group(s)") }}
|
|
58
|
+
</FSSpan>
|
|
59
|
+
</FSRow>
|
|
60
|
+
<FSRow
|
|
61
|
+
align="center-left"
|
|
62
|
+
>
|
|
63
|
+
<FSColor
|
|
64
|
+
align="center-center"
|
|
65
|
+
padding="0 8px"
|
|
66
|
+
height="24px"
|
|
67
|
+
:color="ColorEnum.Success"
|
|
68
|
+
>
|
|
69
|
+
<FSText
|
|
70
|
+
font="text-overline"
|
|
71
|
+
>
|
|
72
|
+
{{ deviceOrganisationsLabel }}
|
|
73
|
+
</FSText>
|
|
74
|
+
</FSColor>
|
|
75
|
+
<FSSpan
|
|
76
|
+
font="text-overline"
|
|
77
|
+
>
|
|
78
|
+
{{ $tr("ui.group-tile.device(s)", "Device(s)") }}
|
|
79
|
+
</FSSpan>
|
|
80
|
+
</FSRow>
|
|
81
|
+
</FSCol>
|
|
82
|
+
</FSCol>
|
|
83
|
+
<FSImage
|
|
84
|
+
v-if="$props.imageId"
|
|
85
|
+
:imageId="$props.imageId"
|
|
86
|
+
:width="imageSize"
|
|
87
|
+
/>
|
|
88
|
+
</FSRow>
|
|
89
|
+
</FSCol>
|
|
90
|
+
</FSTile>
|
|
91
|
+
</template>
|
|
92
|
+
|
|
93
|
+
<script lang="ts">
|
|
94
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
95
|
+
|
|
96
|
+
import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
97
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
98
|
+
|
|
99
|
+
import FSImage from "../FSImage.vue";
|
|
100
|
+
import FSColor from "../FSColor.vue";
|
|
101
|
+
import FSSpan from "../FSSpan.vue";
|
|
102
|
+
import FSText from "../FSText.vue";
|
|
103
|
+
import FSTile from "../FSTile.vue";
|
|
104
|
+
import FSCol from "../FSCol.vue";
|
|
105
|
+
import FSRow from "../FSRow.vue";
|
|
106
|
+
|
|
107
|
+
export default defineComponent({
|
|
108
|
+
name: "FSGroupTileUI",
|
|
109
|
+
components: {
|
|
110
|
+
FSImage,
|
|
111
|
+
FSColor,
|
|
112
|
+
FSSpan,
|
|
113
|
+
FSText,
|
|
114
|
+
FSTile,
|
|
115
|
+
FSCol,
|
|
116
|
+
FSRow
|
|
117
|
+
},
|
|
118
|
+
props: {
|
|
119
|
+
imageId: {
|
|
120
|
+
type: String,
|
|
121
|
+
required: false,
|
|
122
|
+
default: null
|
|
123
|
+
},
|
|
124
|
+
label: {
|
|
125
|
+
type: String,
|
|
126
|
+
required: false,
|
|
127
|
+
default: null
|
|
128
|
+
},
|
|
129
|
+
code: {
|
|
130
|
+
type: String,
|
|
131
|
+
required: false,
|
|
132
|
+
default: null
|
|
133
|
+
},
|
|
134
|
+
recursiveGroupsIds: {
|
|
135
|
+
type: Array as PropType<String[]>,
|
|
136
|
+
required: false,
|
|
137
|
+
default: () => []
|
|
138
|
+
},
|
|
139
|
+
recursiveDeviceOrganisationsIds: {
|
|
140
|
+
type: Array as PropType<String[]>,
|
|
141
|
+
required: false,
|
|
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 groupsLabel = computed((): string => {
|
|
159
|
+
return props.recursiveGroupsIds.length > 99 ? "99+" : props.recursiveGroupsIds.length.toString();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
const deviceOrganisationsLabel = computed((): string => {
|
|
163
|
+
return props.recursiveDeviceOrganisationsIds.length > 99 ? "99+" : props.recursiveDeviceOrganisationsIds.length.toString();
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
const imageSize = computed((): number => {
|
|
167
|
+
return isMobileSized.value ? 90 : 100;
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const infoWidth = computed((): string => {
|
|
171
|
+
let width = isMobileSized.value ? 288 : 304;
|
|
172
|
+
if (props.imageId) {
|
|
173
|
+
width -= imageSize.value;
|
|
174
|
+
}
|
|
175
|
+
return `${width}px`;
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
const infoHeight = computed((): string => {
|
|
179
|
+
return `${imageSize.value}px`;
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
ColorEnum,
|
|
184
|
+
groupsLabel,
|
|
185
|
+
deviceOrganisationsLabel,
|
|
186
|
+
imageSize,
|
|
187
|
+
infoWidth,
|
|
188
|
+
infoHeight
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
</script>
|
package/composables/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
2
|
+
|
|
3
|
+
export const useBreakpoints = () => {
|
|
4
|
+
const windowWidth = ref(window.innerWidth);
|
|
5
|
+
|
|
6
|
+
const onWidthChange = () => windowWidth.value = window.innerWidth;
|
|
7
|
+
|
|
8
|
+
onMounted(() => {
|
|
9
|
+
window.addEventListener("resize", onWidthChange);
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
onUnmounted(() => {
|
|
13
|
+
window.removeEventListener("resize", onWidthChange);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const isTouchScreenEnabled = (): boolean => {
|
|
17
|
+
return navigator.maxTouchPoints > 0;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const isMobileSized = computed((): boolean => {
|
|
21
|
+
return windowWidth.value < 1264;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const isExtraSmall = computed((): boolean => {
|
|
25
|
+
return windowWidth.value < 600;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
isTouchScreenEnabled,
|
|
30
|
+
isMobileSized,
|
|
31
|
+
isExtraSmall
|
|
32
|
+
};
|
|
33
|
+
}
|
package/composables/useColors.ts
CHANGED
|
@@ -2,28 +2,36 @@ import { useTheme } from "vuetify";
|
|
|
2
2
|
|
|
3
3
|
import Color from "color";
|
|
4
4
|
|
|
5
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/
|
|
5
|
+
import { ColorBase, ColorEnum, ColorVariations } from "@dative-gpi/foundation-shared-components/models";
|
|
6
6
|
|
|
7
7
|
export const useColors = () => {
|
|
8
8
|
const theme = useTheme().current.value;
|
|
9
9
|
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
const isGrayScale = (color: Color): boolean => {
|
|
11
|
+
const maxDiff = Math.max(
|
|
12
|
+
Math.abs(color.red() - color.green()),
|
|
13
|
+
Math.abs(color.green() - color.blue()),
|
|
14
|
+
Math.abs(color.blue() - color.red())
|
|
15
|
+
);
|
|
16
|
+
return maxDiff < 10;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const lighten = (base: Color): Color => {
|
|
20
|
+
if (isGrayScale(base)) {
|
|
21
|
+
return base.value(Math.min(base.value() + 10, 100));
|
|
15
22
|
}
|
|
23
|
+
return base.saturationv(10).value(100);
|
|
16
24
|
};
|
|
17
25
|
|
|
18
26
|
const darken = (base: Color): Color => {
|
|
19
27
|
return base.value(Math.max(base.value() - 15, 0));
|
|
20
28
|
};
|
|
21
29
|
|
|
22
|
-
const getColors = (color: ColorBase
|
|
23
|
-
const themed = (Object as any).values(
|
|
30
|
+
const getColors = (color: ColorBase): ColorVariations => {
|
|
31
|
+
const themed = (Object as any).values(ColorEnum).includes(color);
|
|
24
32
|
|
|
25
|
-
const base = themed ? new Color(theme.colors[color as
|
|
26
|
-
const light = lighten(
|
|
33
|
+
const base = themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
|
|
34
|
+
const light = lighten(base);
|
|
27
35
|
const dark = darken(base);
|
|
28
36
|
|
|
29
37
|
return {
|
|
@@ -33,24 +41,46 @@ export const useColors = () => {
|
|
|
33
41
|
};
|
|
34
42
|
};
|
|
35
43
|
|
|
36
|
-
const getContrasts = (color: ColorBase
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const getContrasts = (color: ColorBase): ColorVariations => {
|
|
45
|
+
const themed = (Object as any).values(ColorEnum).includes(color);
|
|
46
|
+
|
|
47
|
+
const base = themed ? new Color(theme.colors[color as ColorEnum]) : new Color(color);
|
|
48
|
+
|
|
49
|
+
if (isGrayScale(base)) {
|
|
50
|
+
switch (color) {
|
|
51
|
+
case ColorEnum.Light:
|
|
52
|
+
return getColors(ColorEnum.Dark);
|
|
53
|
+
case ColorEnum.Dark:
|
|
54
|
+
return getColors(ColorEnum.Light);
|
|
55
|
+
default:
|
|
56
|
+
if (base.value() > 50) {
|
|
57
|
+
base.value(Math.max(base.value() - 65, 0));
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
base.value(Math.min(base.value() + 65, 100));
|
|
61
|
+
}
|
|
62
|
+
break;
|
|
48
63
|
}
|
|
49
64
|
}
|
|
65
|
+
return getColors(color);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const getGradients = (colors: ColorBase | ColorBase[]): ColorVariations => {
|
|
69
|
+
const variations = Array.isArray(colors) ? colors.map(getColors) : [getColors(colors)];
|
|
70
|
+
|
|
71
|
+
if (variations.length === 1) {
|
|
72
|
+
return variations[0];
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
light: `linear-gradient(90deg, ${variations.map(v => v.light).join(", ")})`,
|
|
76
|
+
base: `linear-gradient(90deg, ${variations.map(v => v.base).join(", ")})`,
|
|
77
|
+
dark: `linear-gradient(90deg, ${variations.map(v => v.dark).join(", ")})`,
|
|
78
|
+
};
|
|
50
79
|
}
|
|
51
80
|
|
|
52
81
|
return {
|
|
53
82
|
getColors,
|
|
54
|
-
getContrasts
|
|
83
|
+
getContrasts,
|
|
84
|
+
getGradients
|
|
55
85
|
};
|
|
56
86
|
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useSlots as useVueSlots } from "vue"
|
|
2
|
+
|
|
3
|
+
export const useSlots = () => {
|
|
4
|
+
const getChildren = (name: string | undefined): any => {
|
|
5
|
+
const innerSlots = { ...useVueSlots() };
|
|
6
|
+
const innerName = name ?? "default";
|
|
7
|
+
if (innerSlots[innerName] != null) {
|
|
8
|
+
const slot = innerSlots[innerName]!;
|
|
9
|
+
switch (typeof(slot()[0].type)) {
|
|
10
|
+
// Directive wrapper (v-for, v-if)
|
|
11
|
+
case "symbol":
|
|
12
|
+
switch (slot()[0].type) {
|
|
13
|
+
case Symbol.for("v-fgt"):
|
|
14
|
+
return slot()[0].children;
|
|
15
|
+
case Symbol.for("v-cmt"):
|
|
16
|
+
return slot();
|
|
17
|
+
}
|
|
18
|
+
// Custom component
|
|
19
|
+
case "object":
|
|
20
|
+
return slot();
|
|
21
|
+
// Pre-existing component
|
|
22
|
+
case "string":
|
|
23
|
+
return slot();
|
|
24
|
+
}
|
|
25
|
+
return slot();
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const getFirstChild = (name: string | undefined): any => {
|
|
31
|
+
const children = getChildren(name);
|
|
32
|
+
if (children != null) {
|
|
33
|
+
return children[0];
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
slots: { ...useVueSlots() },
|
|
40
|
+
getChildren,
|
|
41
|
+
getFirstChild
|
|
42
|
+
};
|
|
43
|
+
}
|
package/index.ts
ADDED
package/models/colors.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export enum ColorEnum {
|
|
2
|
+
Background = "background",
|
|
3
|
+
Light = "light",
|
|
4
|
+
Dark = "dark",
|
|
5
|
+
Primary = "primary",
|
|
6
|
+
Error = "error",
|
|
7
|
+
Warning = "warning",
|
|
8
|
+
Success = "success"
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface ColorVariations {
|
|
12
|
+
light: string;
|
|
13
|
+
base: string;
|
|
14
|
+
dark: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ColorBase = (String | ColorEnum);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AlertStatus, Criticity } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
|
+
|
|
3
|
+
export interface FSDeviceAlert {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
status: AlertStatus;
|
|
7
|
+
criticity: Criticity;
|
|
8
|
+
sourceTimestamp?: number;
|
|
9
|
+
enqueuedTimestamp?: number;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ConnectivityStatus } from "@dative-gpi/foundation-shared-domain/models";
|
|
2
|
+
|
|
3
|
+
export interface FSDeviceConnectivity {
|
|
4
|
+
id: string;
|
|
5
|
+
sourceTimestamp?: number;
|
|
6
|
+
enqueuedTimestamp?: number;
|
|
7
|
+
processedTimestamp?: number;
|
|
8
|
+
status: ConnectivityStatus;
|
|
9
|
+
icon: string;
|
|
10
|
+
color: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface FSDeviceStatus {
|
|
2
|
+
modelStatusId: string;
|
|
3
|
+
statusGroups: FSDeviceStatusGroup[];
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export interface FSDeviceStatusGroup {
|
|
7
|
+
label: string;
|
|
8
|
+
groupByValue?: string;
|
|
9
|
+
value: string;
|
|
10
|
+
unit?: string;
|
|
11
|
+
icon: string;
|
|
12
|
+
color: string;
|
|
13
|
+
sourceTimestamp?: number;
|
|
14
|
+
enqueuedTimestamp?: number;
|
|
15
|
+
processedTimestamp?: number;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface FSDataTableColumn {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
text?: string;
|
|
4
|
+
value?: string;
|
|
5
|
+
index: number;
|
|
6
|
+
hidden: boolean;
|
|
7
|
+
width?: string | number;
|
|
8
|
+
|
|
9
|
+
sortable?: boolean;
|
|
10
|
+
sort?: (a: any, b: any) => number;
|
|
11
|
+
|
|
12
|
+
filterable?: boolean;
|
|
13
|
+
fixedFilters?: { value: any, text: string }[];
|
|
14
|
+
methodFilter?: (value: any, item: any) => boolean;
|
|
15
|
+
filter?: (value: any, search: string, item: any) => boolean;
|
|
16
|
+
|
|
17
|
+
innerValue?: (value: any) => any;
|
|
18
|
+
|
|
19
|
+
// Should not be set directly !
|
|
20
|
+
slotName?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface FSDataTableFilter {
|
|
24
|
+
text: string;
|
|
25
|
+
value: string;
|
|
26
|
+
hidden: boolean;
|
|
27
|
+
filter?: (value: any, property: any, item: any) => boolean;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface FSDataTableOrder {
|
|
31
|
+
key: string;
|
|
32
|
+
order: "asc" | "desc";
|
|
33
|
+
}
|
package/models/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./breadcrumbs";
|
|
2
|
+
export * from "./colors";
|
|
3
|
+
export * from "./deviceAlerts";
|
|
4
|
+
export * from "./deviceConnectivities";
|
|
5
|
+
export * from "./deviceStatuses";
|
|
6
|
+
export * from "./dispositions";
|
|
7
|
+
export * from "./modelStatuses";
|
|
8
|
+
export * from "./rules";
|
|
9
|
+
export * from "./toggleSets";
|
package/models/rules.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useTimeZone, useTranslationsProvider } from "@dative-gpi/foundation-shared-services/composables";
|
|
2
|
+
|
|
3
|
+
const { epochToLongDateFormat } = useTimeZone();
|
|
4
|
+
const { $tr } = useTranslationsProvider();
|
|
5
|
+
|
|
6
|
+
export const TextRules = {
|
|
7
|
+
required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
|
|
8
|
+
min: (min: number, message: string) => (value: string) => value.length >= min || (message ?? $tr("ui.rules.text-min", "Must be at least {0} characters", min.toString())),
|
|
9
|
+
max: (max: number, message: string) => (value: string) => value.length <= max || (message ?? $tr("ui.rules.text-max", "Must be at most {0} characters", max.toString())),
|
|
10
|
+
email: (message: string) => (value: string) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value) || (message ?? $tr("ui.rules.text-email", "Must be a valid email")),
|
|
11
|
+
digit: (message: string) => (value: string) => /(?=.*\d)/.test(value) || (message ?? $tr("ui.rules.text-digit", "Must contain a digit")),
|
|
12
|
+
uppercase: (message: string) => (value: string) => /(?=.*[A-Z])/.test(value) || (message ?? $tr("ui.rules.text-uppercase", "Must contain an uppercase letter")),
|
|
13
|
+
lowercase: (message: string) => (value: string) => /(?=.*[a-z])/.test(value) || (message ?? $tr("ui.rules.text-lowercase", "Must contain a lowercase letter")),
|
|
14
|
+
special: (message: string) => (value: string) => /(?=.*[!@#$%^&*])/.test(value) || (message ?? $tr("ui.rules.text-special-character", "Must contain a special character"))
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const TagRules = {
|
|
18
|
+
required: (message: string) => (value: string[]) => value.length > 0 || (message ?? $tr("ui.rules.required", "Required")),
|
|
19
|
+
min: (min: number, message: string) => (value: string[]) => value.length >= min || (message ?? $tr("ui.rules.tag-min", "Must be at least {0} elements", min.toString())),
|
|
20
|
+
max: (max: number, message: string) => (value: string[]) => value.length <= max || (message ?? $tr("ui.rules.tag-max", "Must be at most {0} elements", max.toString()))
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const NumberRules = {
|
|
24
|
+
required: (message: string) => (value: string) => (!!value && !isNaN(parseFloat(value))) || (message ?? $tr("ui.rules.required", "Required")),
|
|
25
|
+
min: (min: number, message: string) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) >= min) || (message ?? $tr("ui.rules.number-min", "Must be at least {0}", min.toString())),
|
|
26
|
+
max: (max: number, message: string) => (value: string) => (!!value && !isNaN(parseFloat(value)) && parseFloat(value) <= max) || (message ?? $tr("ui.rules.number-max", "Must be at most {0}", max.toString())),
|
|
27
|
+
integer: (message: string) => (value: string) => (!!value && !isNaN(parseFloat(value)) && Number.isInteger(parseFloat(value))) || (message ?? $tr("ui.rules.number-integer", "Must be an integer"))
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const IconRules = {
|
|
31
|
+
required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const DateRules = {
|
|
35
|
+
required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
|
|
36
|
+
min: (min: number, message: string) => (value: number) => (!value || value >= min) || (message ?? $tr("ui.rules.date-min", "Must be after {0}", epochToLongDateFormat(min))),
|
|
37
|
+
max: (max: number, message: string) => (value: number) => (!value || value <= max) || (message ?? $tr("ui.rules.date-max", "Must be before {0}", epochToLongDateFormat(max)))
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const SelectRules = {
|
|
41
|
+
required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
|
|
42
|
+
min: (min: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length >= min) || (message ?? $tr("ui.rules.select-min", "Must select at least {0} elements", min.toString())),
|
|
43
|
+
max: (max: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length <= max) || (message ?? $tr("ui.rules.select-max", "Must select at most {0} elements", max.toString()))
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const AutocompleteRules = {
|
|
47
|
+
required: (message: string) => (value: string) => !!value || (message ?? $tr("ui.rules.required", "Required")),
|
|
48
|
+
min: (min: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length >= min) || (message ?? $tr("ui.rules.autocomplete-min", "Must select at least {0} elements", min.toString())),
|
|
49
|
+
max: (max: number, message: string) => (value: string[]) => (Array.isArray(value) && value.length <= max) || (message ?? $tr("ui.rules.autocomplete-max", "Must select at most {0} elements", max.toString()))
|
|
50
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -9,10 +9,19 @@
|
|
|
9
9
|
"author": "",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
13
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
12
|
+
"@dative-gpi/foundation-shared-domain": "0.0.9",
|
|
13
|
+
"@dative-gpi/foundation-shared-services": "0.0.9",
|
|
14
14
|
"@fontsource/montserrat": "^5.0.16",
|
|
15
|
+
"@lexical/history": "^0.12.5",
|
|
16
|
+
"@lexical/link": "^0.12.5",
|
|
17
|
+
"@lexical/plain-text": "^0.12.5",
|
|
18
|
+
"@lexical/rich-text": "^0.12.5",
|
|
19
|
+
"@lexical/selection": "^0.12.5",
|
|
20
|
+
"@lexical/text": "^0.12.5",
|
|
21
|
+
"@lexical/utils": "^0.12.5",
|
|
22
|
+
"blurhash": "^2.0.5",
|
|
15
23
|
"color": "^4.2.3",
|
|
24
|
+
"lexical": "^0.12.5",
|
|
16
25
|
"vue": "^3.2.0"
|
|
17
26
|
},
|
|
18
27
|
"devDependencies": {
|
|
@@ -20,5 +29,5 @@
|
|
|
20
29
|
"sass": "^1.69.5",
|
|
21
30
|
"sass-loader": "^13.3.2"
|
|
22
31
|
},
|
|
23
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "d079d93c7d8677f8269b97bc71820bc35dc46921"
|
|
24
33
|
}
|
package/plugins/colorPlugin.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { DefineComponent, Plugin } from "vue";
|
|
2
2
|
import { useTheme } from "vuetify";
|
|
3
3
|
|
|
4
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/
|
|
4
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
5
5
|
|
|
6
6
|
export const ColorPlugin: Plugin = {
|
|
7
7
|
install: (app) => {
|
|
8
8
|
app.config.globalProperties.$color = function(this: InstanceType<DefineComponent>, key: ColorBase): string {
|
|
9
9
|
const theme = this.$vuetify ? (this.$vuetify as any).theme.current : useTheme().current.value;
|
|
10
|
-
return theme.colors[key];
|
|
10
|
+
return theme.colors[key] ?? key;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
}
|
package/shims-plugin.d.ts
CHANGED