@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
package/components/FSRow.vue
CHANGED
|
@@ -1,115 +1,121 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<div
|
|
3
|
+
:style="style"
|
|
4
|
+
:class="classes"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</div>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script lang="ts">
|
|
12
|
-
import { computed, defineComponent, PropType
|
|
12
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
13
|
+
|
|
14
|
+
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
13
15
|
|
|
14
16
|
export default defineComponent({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
gap: {
|
|
38
|
-
type: Number,
|
|
39
|
-
required: false,
|
|
40
|
-
default: 8
|
|
41
|
-
}
|
|
17
|
+
name: "FSRow",
|
|
18
|
+
props: {
|
|
19
|
+
width: {
|
|
20
|
+
type: String as PropType<"hug" | "fill" | string>,
|
|
21
|
+
required: false,
|
|
22
|
+
default: "fill"
|
|
23
|
+
},
|
|
24
|
+
height: {
|
|
25
|
+
type: String as PropType<"hug" | "fill" | string>,
|
|
26
|
+
required: false,
|
|
27
|
+
default: "hug"
|
|
28
|
+
},
|
|
29
|
+
align: {
|
|
30
|
+
type: String as PropType<"top-left" | "top-center" | "top-right" | "center-left" | "center-center" | "center-right" | "bottom-left" | "bottom-center" | "bottom-right">,
|
|
31
|
+
required: false,
|
|
32
|
+
default: "top-left"
|
|
33
|
+
},
|
|
34
|
+
wrap: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
required: false,
|
|
37
|
+
default: true
|
|
42
38
|
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
39
|
+
padding: {
|
|
40
|
+
type: [String, Number],
|
|
41
|
+
required: false,
|
|
42
|
+
default: "0"
|
|
43
|
+
},
|
|
44
|
+
gap: {
|
|
45
|
+
type: [String, Number],
|
|
46
|
+
required: false,
|
|
47
|
+
default: "8px"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
setup(props) {
|
|
51
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => ({
|
|
52
|
+
"--fs-row-flex-wrap": props.wrap ? "wrap" : "nowrap",
|
|
53
|
+
"--fs-row-padding" : sizeToVar(props.padding),
|
|
54
|
+
"--fs-row-gap" : sizeToVar(props.gap),
|
|
55
|
+
"--fs-row-width" : sizeToVar(props.width),
|
|
56
|
+
"--fs-row-height" : sizeToVar(props.height)
|
|
57
|
+
}));
|
|
52
58
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
59
|
+
const classes = computed((): string[] => {
|
|
60
|
+
const classNames = ["fs-row"];
|
|
61
|
+
switch (props.width) {
|
|
62
|
+
case "hug":
|
|
63
|
+
classNames.push("fs-row-width-hug");
|
|
64
|
+
break;
|
|
65
|
+
case "fill":
|
|
66
|
+
classNames.push("fs-row-width-fill");
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
classNames.push("fs-row-width-fixed");
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
switch (props.height) {
|
|
73
|
+
case "hug":
|
|
74
|
+
classNames.push("fs-row-height-hug");
|
|
75
|
+
break;
|
|
76
|
+
case "fill":
|
|
77
|
+
classNames.push("fs-row-height-fill");
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
classNames.push("fs-row-height-fixed");
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
switch (props.align) {
|
|
84
|
+
case "top-left":
|
|
85
|
+
classNames.push("fs-row-top-left");
|
|
86
|
+
break;
|
|
87
|
+
case "top-center":
|
|
88
|
+
classNames.push("fs-row-top-center");
|
|
89
|
+
break;
|
|
90
|
+
case "top-right":
|
|
91
|
+
classNames.push("fs-row-top-right");
|
|
92
|
+
break;
|
|
93
|
+
case "center-left":
|
|
94
|
+
classNames.push("fs-row-center-left");
|
|
95
|
+
break;
|
|
96
|
+
case "center-center":
|
|
97
|
+
classNames.push("fs-row-center-center");
|
|
98
|
+
break;
|
|
99
|
+
case "center-right":
|
|
100
|
+
classNames.push("fs-row-center-right");
|
|
101
|
+
break;
|
|
102
|
+
case "bottom-left":
|
|
103
|
+
classNames.push("fs-row-bottom-left");
|
|
104
|
+
break;
|
|
105
|
+
case "bottom-center":
|
|
106
|
+
classNames.push("fs-row-bottom-center");
|
|
107
|
+
break;
|
|
108
|
+
case "bottom-right":
|
|
109
|
+
classNames.push("fs-row-bottom-right");
|
|
110
|
+
break;
|
|
111
|
+
}
|
|
112
|
+
return classNames;
|
|
113
|
+
});
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
115
|
+
return {
|
|
116
|
+
style,
|
|
117
|
+
classes
|
|
118
|
+
};
|
|
119
|
+
}
|
|
114
120
|
});
|
|
115
121
|
</script>
|
|
@@ -1,122 +1,131 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
<FSTextField
|
|
3
|
+
:label="$props.label"
|
|
4
|
+
:description="$props.description"
|
|
5
|
+
:color="$props.color"
|
|
6
|
+
:hideHeader="$props.hideHeader"
|
|
7
|
+
:required="$props.required"
|
|
8
|
+
:editable="$props.editable"
|
|
9
|
+
@keydown.enter="$emit('update:modelValue', innerValue)"
|
|
10
|
+
v-model="innerValue"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template
|
|
14
|
+
v-if="!$props.instant"
|
|
15
|
+
#append
|
|
12
16
|
>
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</
|
|
17
|
+
<slot name="append">
|
|
18
|
+
<FSButton
|
|
19
|
+
:prependIcon="$props.buttonPrependIcon"
|
|
20
|
+
:label="$props.buttonLabel"
|
|
21
|
+
:appendIcon="$props.buttonAppendIcon"
|
|
22
|
+
:variant="$props.buttonVariant"
|
|
23
|
+
:color="$props.buttonColor"
|
|
24
|
+
:editable="$props.editable"
|
|
25
|
+
@click="$emit('update:modelValue', innerValue)"
|
|
26
|
+
/>
|
|
27
|
+
</slot>
|
|
28
|
+
</template>
|
|
29
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
30
|
+
<slot :name="name" v-bind="slotData" />
|
|
31
|
+
</template>
|
|
32
|
+
</FSTextField>
|
|
28
33
|
</template>
|
|
29
34
|
|
|
30
35
|
<script lang="ts">
|
|
31
|
-
import { defineComponent, PropType,
|
|
36
|
+
import { defineComponent, PropType, ref, watch } from "vue";
|
|
32
37
|
|
|
33
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/
|
|
38
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
34
39
|
|
|
35
40
|
import FSTextField from "./FSTextField.vue";
|
|
36
41
|
import FSButton from "./FSButton.vue";
|
|
37
|
-
import FSIcon from "./FSIcon.vue";
|
|
38
42
|
|
|
39
43
|
export default defineComponent({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
name: "FSSearchField",
|
|
45
|
+
components: {
|
|
46
|
+
FSTextField,
|
|
47
|
+
FSButton
|
|
48
|
+
},
|
|
49
|
+
props: {
|
|
50
|
+
label: {
|
|
51
|
+
type: String,
|
|
52
|
+
required: false,
|
|
53
|
+
default: null
|
|
45
54
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
default: null
|
|
51
|
-
},
|
|
52
|
-
description: {
|
|
53
|
-
type: String,
|
|
54
|
-
required: false,
|
|
55
|
-
default: null
|
|
56
|
-
},
|
|
57
|
-
buttonPrependIcon: {
|
|
58
|
-
type: String,
|
|
59
|
-
required: false,
|
|
60
|
-
default: "mdi-magnify"
|
|
61
|
-
},
|
|
62
|
-
buttonLabel: {
|
|
63
|
-
type: String,
|
|
64
|
-
required: false,
|
|
65
|
-
default: null
|
|
66
|
-
},
|
|
67
|
-
buttonAppendIcon: {
|
|
68
|
-
type: String,
|
|
69
|
-
required: false,
|
|
70
|
-
default: null
|
|
71
|
-
},
|
|
72
|
-
buttonVariant: {
|
|
73
|
-
type: String as PropType<"standard" | "full" | "icon">,
|
|
74
|
-
required: false,
|
|
75
|
-
default: "standard"
|
|
76
|
-
},
|
|
77
|
-
value: {
|
|
78
|
-
type: String,
|
|
79
|
-
required: false,
|
|
80
|
-
default: null
|
|
81
|
-
},
|
|
82
|
-
color: {
|
|
83
|
-
type: String as PropType<ColorBase>,
|
|
84
|
-
required: false,
|
|
85
|
-
default: ColorBase.Dark
|
|
86
|
-
},
|
|
87
|
-
buttonColor: {
|
|
88
|
-
type: String as PropType<ColorBase>,
|
|
89
|
-
required: false,
|
|
90
|
-
default: ColorBase.Primary
|
|
91
|
-
},
|
|
92
|
-
required: {
|
|
93
|
-
type: Boolean,
|
|
94
|
-
required: false,
|
|
95
|
-
default: false
|
|
96
|
-
},
|
|
97
|
-
editable: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
required: false,
|
|
100
|
-
default: true
|
|
101
|
-
}
|
|
55
|
+
description: {
|
|
56
|
+
type: String,
|
|
57
|
+
required: false,
|
|
58
|
+
default: null
|
|
102
59
|
},
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
60
|
+
buttonPrependIcon: {
|
|
61
|
+
type: String,
|
|
62
|
+
required: false,
|
|
63
|
+
default: "mdi-magnify"
|
|
64
|
+
},
|
|
65
|
+
buttonLabel: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: false,
|
|
68
|
+
default: null
|
|
69
|
+
},
|
|
70
|
+
buttonAppendIcon: {
|
|
71
|
+
type: String,
|
|
72
|
+
required: false,
|
|
73
|
+
default: null
|
|
74
|
+
},
|
|
75
|
+
buttonVariant: {
|
|
76
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
77
|
+
required: false,
|
|
78
|
+
default: "standard"
|
|
79
|
+
},
|
|
80
|
+
modelValue: {
|
|
81
|
+
type: String,
|
|
82
|
+
required: false,
|
|
83
|
+
default: null
|
|
84
|
+
},
|
|
85
|
+
color: {
|
|
86
|
+
type: String as PropType<ColorBase>,
|
|
87
|
+
required: false,
|
|
88
|
+
default: ColorEnum.Dark
|
|
89
|
+
},
|
|
90
|
+
buttonColor: {
|
|
91
|
+
type: String as PropType<ColorBase>,
|
|
92
|
+
required: false,
|
|
93
|
+
default: ColorEnum.Primary
|
|
94
|
+
},
|
|
95
|
+
hideHeader: {
|
|
96
|
+
type: Boolean,
|
|
97
|
+
required: false,
|
|
98
|
+
default: false
|
|
99
|
+
},
|
|
100
|
+
instant: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: false,
|
|
103
|
+
default: true
|
|
104
|
+
},
|
|
105
|
+
required: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
required: false,
|
|
108
|
+
default: false
|
|
109
|
+
},
|
|
110
|
+
editable: {
|
|
111
|
+
type: Boolean,
|
|
112
|
+
required: false,
|
|
113
|
+
default: true
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
emits: ["update:modelValue"],
|
|
117
|
+
setup(props, { emit }) {
|
|
118
|
+
const innerValue = ref(props.modelValue);
|
|
108
119
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
};
|
|
120
|
+
watch(innerValue, () => {
|
|
121
|
+
if (props.instant) {
|
|
122
|
+
emit("update:modelValue", innerValue.value);
|
|
123
|
+
}
|
|
124
|
+
});
|
|
115
125
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
126
|
+
return {
|
|
127
|
+
innerValue
|
|
128
|
+
};
|
|
129
|
+
}
|
|
121
130
|
});
|
|
122
131
|
</script>
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol>
|
|
3
|
+
<slot v-if="!$props.hideHeader" name="label">
|
|
4
|
+
<FSRow :wrap="false">
|
|
5
|
+
<FSSpan
|
|
6
|
+
v-if="$props.label"
|
|
7
|
+
class="fs-select-field-label"
|
|
8
|
+
font="text-overline"
|
|
9
|
+
:style="style"
|
|
10
|
+
>
|
|
11
|
+
{{ $props.label }}
|
|
12
|
+
</FSSpan>
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label && $props.required"
|
|
15
|
+
class="fs-select-field-label"
|
|
16
|
+
style="margin-left: -8px;"
|
|
17
|
+
font="text-overline"
|
|
18
|
+
:ellipsis="false"
|
|
19
|
+
:style="style"
|
|
20
|
+
>
|
|
21
|
+
*
|
|
22
|
+
</FSSpan>
|
|
23
|
+
<v-spacer style="min-width: 40px;" />
|
|
24
|
+
<FSSpan
|
|
25
|
+
v-if="messages.length > 0"
|
|
26
|
+
class="fs-select-field-messages"
|
|
27
|
+
font="text-overline"
|
|
28
|
+
:style="style"
|
|
29
|
+
>
|
|
30
|
+
{{ messages.join(", ") }}
|
|
31
|
+
</FSSpan>
|
|
32
|
+
</FSRow>
|
|
33
|
+
</slot>
|
|
34
|
+
<v-select
|
|
35
|
+
class="fs-select-field"
|
|
36
|
+
menuIcon="mdi-chevron-down"
|
|
37
|
+
clearIcon="mdi-close"
|
|
38
|
+
variant="outlined"
|
|
39
|
+
:hideDetails="true"
|
|
40
|
+
:items="$props.items"
|
|
41
|
+
:itemTitle="$props.itemTitle"
|
|
42
|
+
:itemValue="$props.itemValue"
|
|
43
|
+
:readonly="!$props.editable"
|
|
44
|
+
:clearable="$props.editable && $props.clearable"
|
|
45
|
+
:error="messages.length > 0"
|
|
46
|
+
:style="style"
|
|
47
|
+
:modelValue="$props.modelValue"
|
|
48
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
49
|
+
v-bind="$attrs"
|
|
50
|
+
>
|
|
51
|
+
<template v-for="(_, name) in slots" v-slot:[name]="slotData">
|
|
52
|
+
<slot :name="name" v-bind="slotData" />
|
|
53
|
+
</template>
|
|
54
|
+
</v-select>
|
|
55
|
+
<slot name="description">
|
|
56
|
+
<FSSpan
|
|
57
|
+
v-if="$props.description"
|
|
58
|
+
class="fs-select-field-description"
|
|
59
|
+
font="text-underline"
|
|
60
|
+
:style="style"
|
|
61
|
+
>
|
|
62
|
+
{{ $props.description }}
|
|
63
|
+
</FSSpan>
|
|
64
|
+
</slot>
|
|
65
|
+
</FSCol>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script lang="ts">
|
|
69
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
70
|
+
|
|
71
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
72
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
73
|
+
|
|
74
|
+
import FSSpan from "./FSSpan.vue";
|
|
75
|
+
import FSCol from "./FSCol.vue";
|
|
76
|
+
import FSRow from "./FSRow.vue";
|
|
77
|
+
|
|
78
|
+
export default defineComponent({
|
|
79
|
+
name: "FSSelectField",
|
|
80
|
+
components: {
|
|
81
|
+
FSSpan,
|
|
82
|
+
FSCol,
|
|
83
|
+
FSRow
|
|
84
|
+
},
|
|
85
|
+
props: {
|
|
86
|
+
label: {
|
|
87
|
+
type: String,
|
|
88
|
+
required: false,
|
|
89
|
+
default: null
|
|
90
|
+
},
|
|
91
|
+
description: {
|
|
92
|
+
type: String,
|
|
93
|
+
required: false,
|
|
94
|
+
default: null
|
|
95
|
+
},
|
|
96
|
+
items: {
|
|
97
|
+
type: Array as PropType<any[]>,
|
|
98
|
+
required: true
|
|
99
|
+
},
|
|
100
|
+
itemValue: {
|
|
101
|
+
type: String,
|
|
102
|
+
required: false,
|
|
103
|
+
default: "id"
|
|
104
|
+
},
|
|
105
|
+
itemTitle: {
|
|
106
|
+
type: String,
|
|
107
|
+
required: false,
|
|
108
|
+
default: "label"
|
|
109
|
+
},
|
|
110
|
+
modelValue: {
|
|
111
|
+
type: [Array, String, Number] as PropType<(string | number)[] | string | number>,
|
|
112
|
+
required: false,
|
|
113
|
+
default: null
|
|
114
|
+
},
|
|
115
|
+
hideHeader: {
|
|
116
|
+
type: Boolean,
|
|
117
|
+
required: false,
|
|
118
|
+
default: false
|
|
119
|
+
},
|
|
120
|
+
required: {
|
|
121
|
+
type: Boolean,
|
|
122
|
+
required: false,
|
|
123
|
+
default: false
|
|
124
|
+
},
|
|
125
|
+
clearable: {
|
|
126
|
+
type: Boolean,
|
|
127
|
+
required: false,
|
|
128
|
+
default: true
|
|
129
|
+
},
|
|
130
|
+
rules: {
|
|
131
|
+
type: Array as PropType<Function[]>,
|
|
132
|
+
required: false,
|
|
133
|
+
default: () => []
|
|
134
|
+
},
|
|
135
|
+
editable: {
|
|
136
|
+
type: Boolean,
|
|
137
|
+
required: false,
|
|
138
|
+
default: true
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
emits: ["update:modelValue"],
|
|
142
|
+
setup(props) {
|
|
143
|
+
const { slots } = useSlots();
|
|
144
|
+
delete slots.label;
|
|
145
|
+
delete slots.description;
|
|
146
|
+
|
|
147
|
+
const errors = useColors().getColors(ColorEnum.Error);
|
|
148
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
149
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
150
|
+
|
|
151
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
152
|
+
if (!props.editable) {
|
|
153
|
+
return {
|
|
154
|
+
"--fs-select-field-cursor" : "default",
|
|
155
|
+
"--fs-select-field-border-color" : lights.base,
|
|
156
|
+
"--fs-select-field-color" : lights.dark,
|
|
157
|
+
"--fs-select-field-active-border-color": lights.base
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
return {
|
|
161
|
+
"--fs-select-field-cursor" : "pointer",
|
|
162
|
+
"--fs-select-field-border-color" : lights.dark,
|
|
163
|
+
"--fs-select-field-color" : darks.base,
|
|
164
|
+
"--fs-select-field-active-border-color": darks.dark,
|
|
165
|
+
"--fs-select-field-error-color" : errors.base,
|
|
166
|
+
"--fs-select-field-error-border-color" : errors.base
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
const messages = computed((): string[] => {
|
|
171
|
+
const messages = [];
|
|
172
|
+
for (const rule of props.rules) {
|
|
173
|
+
const message = rule(props.modelValue ?? "");
|
|
174
|
+
if (typeof(message) === "string") {
|
|
175
|
+
messages.push(message);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return messages;
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
messages,
|
|
183
|
+
slots,
|
|
184
|
+
style
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
</script>
|