@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,93 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCard
|
|
3
|
+
class="fs-load-tile"
|
|
4
|
+
padding="11px"
|
|
5
|
+
:style="style"
|
|
6
|
+
:width="width"
|
|
7
|
+
:height="height"
|
|
8
|
+
>
|
|
9
|
+
<FSRow
|
|
10
|
+
align="center-center"
|
|
11
|
+
height="fill"
|
|
12
|
+
gap="24px"
|
|
13
|
+
>
|
|
14
|
+
<v-skeleton-loader
|
|
15
|
+
type="article"
|
|
16
|
+
/>
|
|
17
|
+
<v-skeleton-loader
|
|
18
|
+
type="image"
|
|
19
|
+
/>
|
|
20
|
+
</FSRow>
|
|
21
|
+
<FSContainer
|
|
22
|
+
v-if="$props.editable"
|
|
23
|
+
class="fs-tile-checkbox"
|
|
24
|
+
:border="false"
|
|
25
|
+
>
|
|
26
|
+
<FSCheckbox
|
|
27
|
+
:modelValue="$props.modelValue"
|
|
28
|
+
@update:modelValue="() => $emit('update:modelValue', !$props.modelValue)"
|
|
29
|
+
/>
|
|
30
|
+
</FSContainer>
|
|
31
|
+
</FSCard>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script lang="ts">
|
|
35
|
+
import { computed, defineComponent } from "vue";
|
|
36
|
+
|
|
37
|
+
import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
38
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
39
|
+
|
|
40
|
+
import FSContainer from "./FSContainer.vue";
|
|
41
|
+
import FSCheckbox from "./FSCheckbox.vue";
|
|
42
|
+
import FSCard from "./FSCard.vue";
|
|
43
|
+
import FSCol from "./FSCol.vue";
|
|
44
|
+
import FSRow from "./FSRow.vue";
|
|
45
|
+
|
|
46
|
+
export default defineComponent({
|
|
47
|
+
name: "FSTile",
|
|
48
|
+
components: {
|
|
49
|
+
FSContainer,
|
|
50
|
+
FSCheckbox,
|
|
51
|
+
FSCard,
|
|
52
|
+
FSCol,
|
|
53
|
+
FSRow
|
|
54
|
+
},
|
|
55
|
+
props: {
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
required: false,
|
|
59
|
+
default: false
|
|
60
|
+
},
|
|
61
|
+
editable: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
required: false,
|
|
64
|
+
default: false
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
setup() {
|
|
68
|
+
const { isMobileSized } = useBreakpoints();
|
|
69
|
+
|
|
70
|
+
const backgroundColors = useColors().getColors(ColorEnum.Background);
|
|
71
|
+
|
|
72
|
+
const width = computed(() => {
|
|
73
|
+
return isMobileSized.value ? 336 : 352;
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const height = computed(() => {
|
|
77
|
+
return isMobileSized.value ? 156 : 170;
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
81
|
+
return {
|
|
82
|
+
"--fs-load-tile-background-color": backgroundColors.base
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
width,
|
|
88
|
+
height,
|
|
89
|
+
style
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
</script>
|
|
@@ -1,65 +1,63 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
<FSTextField
|
|
3
|
+
type="number"
|
|
4
|
+
:label="$props.label"
|
|
5
|
+
:description="$props.description"
|
|
6
|
+
:hideHeader="$props.hideHeader"
|
|
7
|
+
:required="$props.required"
|
|
8
|
+
:editable="$props.editable"
|
|
9
|
+
:modelValue="$props.modelValue?.toString()"
|
|
10
|
+
@update:modelValue="(value) => $emit('update:modelValue', isNaN(parseFloat(value)) ? 0 : parseFloat(value))"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
14
|
+
<slot :name="name" v-bind="slotData" />
|
|
15
|
+
</template>
|
|
16
|
+
</FSTextField>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
19
|
<script lang="ts">
|
|
20
|
-
import { defineComponent
|
|
21
|
-
|
|
22
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
20
|
+
import { defineComponent } from "vue";
|
|
23
21
|
|
|
24
22
|
import FSTextField from "./FSTextField.vue";
|
|
25
23
|
|
|
26
24
|
export default defineComponent({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
name: "FSNumberField",
|
|
26
|
+
components: {
|
|
27
|
+
FSTextField
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
label: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false,
|
|
33
|
+
default: null
|
|
34
|
+
},
|
|
35
|
+
description: {
|
|
36
|
+
type: String,
|
|
37
|
+
required: false,
|
|
38
|
+
default: null
|
|
39
|
+
},
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: Number,
|
|
42
|
+
required: false,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
45
|
+
hideHeader: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: false,
|
|
48
|
+
default: false
|
|
30
49
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
default: null
|
|
36
|
-
},
|
|
37
|
-
description: {
|
|
38
|
-
type: String,
|
|
39
|
-
required: false,
|
|
40
|
-
default: null
|
|
41
|
-
},
|
|
42
|
-
value: {
|
|
43
|
-
type: Number,
|
|
44
|
-
required: false,
|
|
45
|
-
default: null
|
|
46
|
-
},
|
|
47
|
-
color: {
|
|
48
|
-
type: String as PropType<ColorBase>,
|
|
49
|
-
required: false,
|
|
50
|
-
default: ColorBase.Dark
|
|
51
|
-
},
|
|
52
|
-
required: {
|
|
53
|
-
type: Boolean,
|
|
54
|
-
required: false,
|
|
55
|
-
default: false
|
|
56
|
-
},
|
|
57
|
-
editable: {
|
|
58
|
-
type: Boolean,
|
|
59
|
-
required: false,
|
|
60
|
-
default: true
|
|
61
|
-
}
|
|
50
|
+
required: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
required: false,
|
|
53
|
+
default: false
|
|
62
54
|
},
|
|
63
|
-
|
|
55
|
+
editable: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
required: false,
|
|
58
|
+
default: true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
emits: ["update:modelValue"]
|
|
64
62
|
});
|
|
65
63
|
</script>
|
|
@@ -1,119 +1,119 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
</
|
|
2
|
+
<FSTextField
|
|
3
|
+
:label="$props.label"
|
|
4
|
+
:description="$props.description"
|
|
5
|
+
:type="type"
|
|
6
|
+
:hideHeader="$props.hideHeader"
|
|
7
|
+
:required="$props.required"
|
|
8
|
+
:editable="$props.editable"
|
|
9
|
+
:modelValue="$props.modelValue"
|
|
10
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
11
|
+
v-bind="$attrs"
|
|
12
|
+
>
|
|
13
|
+
<template #append-inner>
|
|
14
|
+
<slot name="append-inner">
|
|
15
|
+
<FSButton
|
|
16
|
+
variant="icon"
|
|
17
|
+
:icon="icon"
|
|
18
|
+
:editable="$props.editable"
|
|
19
|
+
:color="ColorEnum.Dark"
|
|
20
|
+
@click="onToggle"
|
|
21
|
+
/>
|
|
22
|
+
</slot>
|
|
23
|
+
</template>
|
|
24
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
25
|
+
<slot :name="name" v-bind="slotData" />
|
|
26
|
+
</template>
|
|
27
|
+
</FSTextField>
|
|
27
28
|
</template>
|
|
28
29
|
|
|
29
30
|
<script lang="ts">
|
|
30
|
-
import { computed, defineComponent,
|
|
31
|
+
import { computed, defineComponent, ref } from "vue";
|
|
31
32
|
|
|
32
33
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
33
|
-
import {
|
|
34
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
34
35
|
|
|
35
36
|
import FSTextField from "./FSTextField.vue";
|
|
36
|
-
import
|
|
37
|
+
import FSButton from "./FSButton.vue";
|
|
37
38
|
|
|
38
39
|
export default defineComponent({
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
name: "FSPasswordField",
|
|
41
|
+
components: {
|
|
42
|
+
FSTextField,
|
|
43
|
+
FSButton
|
|
44
|
+
},
|
|
45
|
+
props: {
|
|
46
|
+
label: {
|
|
47
|
+
type: String,
|
|
48
|
+
required: false,
|
|
49
|
+
default: null
|
|
43
50
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
default: null
|
|
49
|
-
},
|
|
50
|
-
description: {
|
|
51
|
-
type: String,
|
|
52
|
-
required: false,
|
|
53
|
-
default: null
|
|
54
|
-
},
|
|
55
|
-
value: {
|
|
56
|
-
type: String,
|
|
57
|
-
required: false,
|
|
58
|
-
default: null
|
|
59
|
-
},
|
|
60
|
-
color: {
|
|
61
|
-
type: String as PropType<ColorBase>,
|
|
62
|
-
required: false,
|
|
63
|
-
default: ColorBase.Dark
|
|
64
|
-
},
|
|
65
|
-
required: {
|
|
66
|
-
type: Boolean,
|
|
67
|
-
required: false,
|
|
68
|
-
default: false
|
|
69
|
-
},
|
|
70
|
-
editable: {
|
|
71
|
-
type: Boolean,
|
|
72
|
-
required: false,
|
|
73
|
-
default: true
|
|
74
|
-
}
|
|
51
|
+
description: {
|
|
52
|
+
type: String,
|
|
53
|
+
required: false,
|
|
54
|
+
default: null
|
|
75
55
|
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
modelValue: {
|
|
57
|
+
type: String,
|
|
58
|
+
required: false,
|
|
59
|
+
default: null
|
|
60
|
+
},
|
|
61
|
+
hideHeader: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
required: false,
|
|
64
|
+
default: false
|
|
65
|
+
},
|
|
66
|
+
required: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: false,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
editable: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
emits: ["update:modelValue"],
|
|
78
|
+
setup(props) {
|
|
79
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
80
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
const darks = useColors().getColors(ColorBase.Dark);
|
|
82
|
+
const stars = ref(true);
|
|
84
83
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
84
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
85
|
+
if (!props.editable) {
|
|
86
|
+
return {
|
|
87
|
+
"--fs-password-field-cursor" : "default",
|
|
88
|
+
"--fs-password-field-color": lights.dark,
|
|
89
|
+
"--fs-password-field-hover-color": lights.dark
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
"--fs-password-field-cursor" : "pointer",
|
|
94
|
+
"--fs-password-field-color": darks.base,
|
|
95
|
+
"--fs-password-field-hover-color": darks.dark
|
|
96
|
+
};
|
|
97
|
+
});
|
|
99
98
|
|
|
100
|
-
|
|
99
|
+
const type = computed((): string => stars.value ? "password" : "text");
|
|
101
100
|
|
|
102
|
-
|
|
101
|
+
const icon = computed((): string => stars.value ? "mdi-eye-off-outline" : "mdi-eye-outline");
|
|
103
102
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
103
|
+
const onToggle = (): void => {
|
|
104
|
+
if (!props.editable) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
stars.value = !stars.value;
|
|
108
|
+
};
|
|
110
109
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
110
|
+
return {
|
|
111
|
+
ColorEnum,
|
|
112
|
+
type,
|
|
113
|
+
icon,
|
|
114
|
+
style,
|
|
115
|
+
onToggle
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
118
|
});
|
|
119
119
|
</script>
|
package/components/FSRadio.vue
CHANGED
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
2
|
+
<FSCol width="hug">
|
|
3
|
+
<FSRow width="hug" align="center-left">
|
|
4
|
+
<FSIcon
|
|
5
|
+
class="fs-radio"
|
|
6
|
+
size="l"
|
|
7
|
+
:style="style"
|
|
8
|
+
@click.stop="onToggle"
|
|
9
|
+
>
|
|
10
|
+
{{ icon }}
|
|
11
|
+
</FSIcon>
|
|
12
|
+
<slot>
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label"
|
|
15
|
+
class="fs-radio-label"
|
|
16
|
+
:style="style"
|
|
17
|
+
:font="font"
|
|
18
|
+
@click.stop="onToggle"
|
|
19
|
+
>
|
|
20
|
+
{{ $props.label }}
|
|
21
|
+
</FSSpan>
|
|
22
|
+
</slot>
|
|
23
|
+
</FSRow>
|
|
24
|
+
<slot name="description">
|
|
25
|
+
<FSSpan
|
|
26
|
+
v-if="$props.description"
|
|
27
|
+
class="fs-radio-description"
|
|
28
|
+
font="text-underline"
|
|
29
|
+
:style="style"
|
|
30
|
+
>
|
|
31
|
+
{{ $props.description }}
|
|
32
|
+
</FSSpan>
|
|
33
|
+
</slot>
|
|
34
|
+
</FSCol>
|
|
35
35
|
</template>
|
|
36
36
|
|
|
37
37
|
<script lang="ts">
|
|
38
|
-
import { computed, defineComponent, PropType
|
|
38
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
39
39
|
|
|
40
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
40
41
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
41
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
42
42
|
|
|
43
43
|
import FSIcon from "./FSIcon.vue";
|
|
44
44
|
import FSSpan from "./FSSpan.vue";
|
|
@@ -46,87 +46,84 @@ import FSRow from "./FSRow.vue";
|
|
|
46
46
|
import FSCol from "./FSCol.vue";
|
|
47
47
|
|
|
48
48
|
export default defineComponent({
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
name: "FSRadio",
|
|
50
|
+
components: {
|
|
51
|
+
FSIcon,
|
|
52
|
+
FSSpan,
|
|
53
|
+
FSRow,
|
|
54
|
+
FSCol
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
label: {
|
|
58
|
+
type: String,
|
|
59
|
+
required: false,
|
|
60
|
+
default: null
|
|
55
61
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
default: null
|
|
61
|
-
},
|
|
62
|
-
description: {
|
|
63
|
-
type: String,
|
|
64
|
-
required: false,
|
|
65
|
-
default: null
|
|
66
|
-
},
|
|
67
|
-
value: {
|
|
68
|
-
type: [String, Boolean, Number],
|
|
69
|
-
required: true
|
|
70
|
-
},
|
|
71
|
-
selected: {
|
|
72
|
-
type: Boolean,
|
|
73
|
-
required: false,
|
|
74
|
-
default: false
|
|
75
|
-
},
|
|
76
|
-
color: {
|
|
77
|
-
type: String as PropType<ColorBase>,
|
|
78
|
-
required: false,
|
|
79
|
-
default: ColorBase.Primary
|
|
80
|
-
},
|
|
81
|
-
editable: {
|
|
82
|
-
type: Boolean,
|
|
83
|
-
required: false,
|
|
84
|
-
default: true
|
|
85
|
-
}
|
|
62
|
+
description: {
|
|
63
|
+
type: String,
|
|
64
|
+
required: false,
|
|
65
|
+
default: null
|
|
86
66
|
},
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
67
|
+
modelValue: {
|
|
68
|
+
type: [String, Boolean, Number],
|
|
69
|
+
required: true
|
|
70
|
+
},
|
|
71
|
+
selected: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: false
|
|
75
|
+
},
|
|
76
|
+
color: {
|
|
77
|
+
type: String as PropType<ColorBase>,
|
|
78
|
+
required: false,
|
|
79
|
+
default: ColorEnum.Primary
|
|
80
|
+
},
|
|
81
|
+
editable: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
required: false,
|
|
84
|
+
default: true
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
emits: ["update:modelValue"],
|
|
88
|
+
setup(props, { emit }) {
|
|
89
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
90
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
91
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
95
92
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
93
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
94
|
+
if (!props.editable) {
|
|
95
|
+
return {
|
|
96
|
+
"--fs-radio-cursor" : "default",
|
|
97
|
+
"--fs-radio-radio-color": lights.dark,
|
|
98
|
+
"--fs-radio-color" : lights.dark
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
"--fs-radio-cursor" : props.selected ? "default" : "pointer",
|
|
103
|
+
"--fs-radio-radio-color": props.selected ? colors.value.base : darks.base,
|
|
104
|
+
"--fs-radio-color" : darks.base
|
|
105
|
+
};
|
|
106
|
+
});
|
|
110
107
|
|
|
111
|
-
|
|
108
|
+
const icon = computed((): string => props.selected ? "mdi-radiobox-marked" : "mdi-radiobox-blank");
|
|
112
109
|
|
|
113
|
-
|
|
110
|
+
const font = computed((): string => props.selected ? "text-button" : "text-body");
|
|
114
111
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
const onToggle = (): void => {
|
|
113
|
+
if (!props.editable) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!props.selected) {
|
|
117
|
+
emit("update:modelValue", props.modelValue);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
123
120
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
return {
|
|
122
|
+
style,
|
|
123
|
+
icon,
|
|
124
|
+
font,
|
|
125
|
+
onToggle
|
|
126
|
+
};
|
|
127
|
+
}
|
|
131
128
|
});
|
|
132
129
|
</script>
|