@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/FSTag.vue
CHANGED
|
@@ -1,102 +1,106 @@
|
|
|
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
|
+
<FSRow
|
|
3
|
+
class="fs-tag"
|
|
4
|
+
width="hug"
|
|
5
|
+
align="center-left"
|
|
6
|
+
:style="style"
|
|
7
|
+
:wrap="false"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
>
|
|
10
|
+
<slot v-bind="{ color: $props.color, colors }">
|
|
11
|
+
<FSSpan
|
|
12
|
+
v-if="$props.label"
|
|
13
|
+
class="fs-tag-label"
|
|
14
|
+
>
|
|
15
|
+
{{ $props.label }}
|
|
16
|
+
</FSSpan>
|
|
17
|
+
</slot>
|
|
18
|
+
<slot name="button" v-bind="{ color: $props.color, colors }">
|
|
19
|
+
<v-btn
|
|
20
|
+
v-if="$props.editable"
|
|
21
|
+
class="fs-tag-button"
|
|
22
|
+
:ripple="false"
|
|
23
|
+
@click="$emit('remove')"
|
|
24
|
+
>
|
|
25
|
+
<FSIcon
|
|
26
|
+
size="s"
|
|
27
|
+
>
|
|
28
|
+
mdi-close
|
|
29
|
+
</FSIcon>
|
|
30
|
+
</v-btn>
|
|
31
|
+
</slot>
|
|
32
|
+
</FSRow>
|
|
27
33
|
</template>
|
|
28
34
|
|
|
29
35
|
<script lang="ts">
|
|
30
|
-
import { computed, defineComponent, PropType
|
|
36
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
31
37
|
|
|
38
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
32
39
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
33
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
34
40
|
|
|
35
41
|
import FSIcon from "./FSIcon.vue";
|
|
36
42
|
import FSSpan from "./FSSpan.vue";
|
|
37
43
|
import FSRow from "./FSRow.vue";
|
|
38
44
|
|
|
39
45
|
export default defineComponent({
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
name: "FSTag",
|
|
47
|
+
components: {
|
|
48
|
+
FSIcon,
|
|
49
|
+
FSSpan,
|
|
50
|
+
FSRow
|
|
51
|
+
},
|
|
52
|
+
props: {
|
|
53
|
+
label: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false,
|
|
56
|
+
default: null
|
|
45
57
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
},
|
|
51
|
-
variant: {
|
|
52
|
-
type: String as PropType<"standard" | "full">,
|
|
53
|
-
required: false,
|
|
54
|
-
default: "full"
|
|
55
|
-
},
|
|
56
|
-
color: {
|
|
57
|
-
type: String as PropType<ColorBase>,
|
|
58
|
-
required: false,
|
|
59
|
-
default: ColorBase.Primary
|
|
60
|
-
},
|
|
61
|
-
editable: {
|
|
62
|
-
type: Boolean,
|
|
63
|
-
required: false,
|
|
64
|
-
default: true
|
|
65
|
-
}
|
|
58
|
+
variant: {
|
|
59
|
+
type: String as PropType<"standard" | "full">,
|
|
60
|
+
required: false,
|
|
61
|
+
default: "full"
|
|
66
62
|
},
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
"--fs-tag-active-color": textColors.light
|
|
83
|
-
};
|
|
84
|
-
case "full": return {
|
|
85
|
-
"--fs-tag-background-color": colors.base,
|
|
86
|
-
"--fs-tag-color": textColors.light,
|
|
87
|
-
"--fs-tag-hover-background-color": colors.base,
|
|
88
|
-
"--fs-tag-hover-color": textColors.light,
|
|
89
|
-
"--fs-tag-active-background-color": colors.dark,
|
|
90
|
-
"--fs-tag-active-color": textColors.light
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
});
|
|
63
|
+
color: {
|
|
64
|
+
type: String as PropType<ColorBase>,
|
|
65
|
+
required: false,
|
|
66
|
+
default: ColorEnum.Primary
|
|
67
|
+
},
|
|
68
|
+
editable: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false,
|
|
71
|
+
default: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
emits: ["remove"],
|
|
75
|
+
setup(props) {
|
|
76
|
+
const textColors = computed(() => useColors().getContrasts(props.color));
|
|
77
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
94
78
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
79
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
80
|
+
switch (props.variant) {
|
|
81
|
+
case "standard": return {
|
|
82
|
+
"--fs-tag-background-color" : colors.value.light,
|
|
83
|
+
"--fs-tag-color" : textColors.value.base,
|
|
84
|
+
"--fs-tag-hover-background-color" : colors.value.base,
|
|
85
|
+
"--fs-tag-hover-color" : textColors.value.light,
|
|
86
|
+
"--fs-tag-active-background-color": colors.value.dark,
|
|
87
|
+
"--fs-tag-active-color" : textColors.value.light
|
|
99
88
|
};
|
|
100
|
-
|
|
89
|
+
case "full": return {
|
|
90
|
+
"--fs-tag-background-color" : colors.value.base,
|
|
91
|
+
"--fs-tag-color" : textColors.value.light,
|
|
92
|
+
"--fs-tag-hover-background-color" : colors.value.base,
|
|
93
|
+
"--fs-tag-hover-color" : textColors.value.light,
|
|
94
|
+
"--fs-tag-active-background-color": colors.value.dark,
|
|
95
|
+
"--fs-tag-active-color" : textColors.value.light
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
colors,
|
|
102
|
+
style
|
|
103
|
+
};
|
|
104
|
+
}
|
|
101
105
|
});
|
|
102
106
|
</script>
|
|
@@ -1,152 +1,207 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<FSCol>
|
|
3
|
+
<FSTextField
|
|
4
|
+
:label="$props.label"
|
|
5
|
+
:description="$props.description"
|
|
6
|
+
:hideHeader="$props.hideHeader"
|
|
7
|
+
:required="$props.required"
|
|
8
|
+
:editable="$props.editable"
|
|
9
|
+
:error="messages.length > 0"
|
|
10
|
+
@keydown.enter="onAdd"
|
|
11
|
+
v-model="innerValue"
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
>
|
|
14
|
+
<template v-if="!$props.hideHeader" #label>
|
|
15
|
+
<slot name="label">
|
|
16
|
+
<FSRow :wrap="false">
|
|
17
|
+
<FSSpan
|
|
18
|
+
v-if="$props.label"
|
|
19
|
+
class="fs-tag-field-label"
|
|
20
|
+
font="text-overline"
|
|
21
|
+
:style="style"
|
|
22
|
+
>
|
|
23
|
+
{{ $props.label }}
|
|
24
|
+
</FSSpan>
|
|
25
|
+
<FSSpan
|
|
26
|
+
v-if="$props.label && $props.required"
|
|
27
|
+
class="fs-tag-field-label"
|
|
28
|
+
style="margin-left: -8px;"
|
|
29
|
+
font="text-overline"
|
|
30
|
+
:ellipsis="false"
|
|
31
|
+
:style="style"
|
|
32
|
+
>
|
|
33
|
+
*
|
|
34
|
+
</FSSpan>
|
|
35
|
+
<v-spacer style="min-width: 40px;" />
|
|
36
|
+
<FSSpan
|
|
37
|
+
v-if="messages.length > 0"
|
|
38
|
+
class="fs-tag-field-messages"
|
|
39
|
+
font="text-overline"
|
|
40
|
+
:style="style"
|
|
41
|
+
>
|
|
42
|
+
{{ messages.join(", ") }}
|
|
43
|
+
</FSSpan>
|
|
44
|
+
</FSRow>
|
|
45
|
+
</slot>
|
|
46
|
+
</template>
|
|
47
|
+
<template #append-inner>
|
|
48
|
+
<slot name="append-inner">
|
|
49
|
+
<FSButton
|
|
50
|
+
variant="icon"
|
|
51
|
+
icon="mdi-tag-outline"
|
|
9
52
|
:editable="$props.editable"
|
|
10
|
-
:
|
|
11
|
-
@
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
</template>
|
|
28
|
-
</FSTextField>
|
|
29
|
-
<FSTagGroup
|
|
30
|
-
:tags="$props.value"
|
|
31
|
-
:variant="$props.variant"
|
|
32
|
-
:color="$props.tagColor"
|
|
33
|
-
:editable="$props.editable"
|
|
34
|
-
@remove="onRemove"
|
|
35
|
-
/>
|
|
36
|
-
</FSCol>
|
|
53
|
+
:color="ColorEnum.Dark"
|
|
54
|
+
@click="onAdd"
|
|
55
|
+
/>
|
|
56
|
+
</slot>
|
|
57
|
+
</template>
|
|
58
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
59
|
+
<slot :name="name" v-bind="slotData" />
|
|
60
|
+
</template>
|
|
61
|
+
</FSTextField>
|
|
62
|
+
<FSTagGroup
|
|
63
|
+
:tags="$props.modelValue"
|
|
64
|
+
:variant="$props.tagVariant"
|
|
65
|
+
:color="$props.tagColor"
|
|
66
|
+
:editable="$props.editable"
|
|
67
|
+
@remove="onRemove"
|
|
68
|
+
/>
|
|
69
|
+
</FSCol>
|
|
37
70
|
</template>
|
|
38
71
|
|
|
39
72
|
<script lang="ts">
|
|
40
|
-
import { computed, defineComponent, PropType, ref
|
|
73
|
+
import { computed, defineComponent, PropType, ref } from "vue";
|
|
41
74
|
|
|
75
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
42
76
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
43
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
44
77
|
|
|
45
78
|
import FSTextField from "./FSTextField.vue";
|
|
46
79
|
import FSTagGroup from "./FSTagGroup.vue";
|
|
47
|
-
import
|
|
80
|
+
import FSButton from "./FSButton.vue";
|
|
81
|
+
import FSSpan from "./FSSpan.vue";
|
|
82
|
+
import FSCol from "./FSCol.vue";
|
|
83
|
+
import FSRow from "./FSRow.vue";
|
|
48
84
|
|
|
49
85
|
export default defineComponent({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
86
|
+
name: "FSTagField",
|
|
87
|
+
components: {
|
|
88
|
+
FSTextField,
|
|
89
|
+
FSTagGroup,
|
|
90
|
+
FSButton,
|
|
91
|
+
FSSpan,
|
|
92
|
+
FSCol,
|
|
93
|
+
FSRow
|
|
94
|
+
},
|
|
95
|
+
props: {
|
|
96
|
+
label: {
|
|
97
|
+
type: String,
|
|
98
|
+
required: false,
|
|
99
|
+
default: null
|
|
55
100
|
},
|
|
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
|
-
default: false
|
|
91
|
-
},
|
|
92
|
-
editable: {
|
|
93
|
-
type: Boolean,
|
|
94
|
-
required: false,
|
|
95
|
-
default: true
|
|
96
|
-
}
|
|
101
|
+
description: {
|
|
102
|
+
type: String,
|
|
103
|
+
required: false,
|
|
104
|
+
default: null
|
|
105
|
+
},
|
|
106
|
+
modelValue: {
|
|
107
|
+
type: Array as PropType<string[]>,
|
|
108
|
+
required: false,
|
|
109
|
+
default: () => []
|
|
110
|
+
},
|
|
111
|
+
tagVariant: {
|
|
112
|
+
type: String as PropType<"standard" | "full">,
|
|
113
|
+
required: false,
|
|
114
|
+
default: "full"
|
|
115
|
+
},
|
|
116
|
+
tagColor: {
|
|
117
|
+
type: String as PropType<ColorBase>,
|
|
118
|
+
required: false,
|
|
119
|
+
default: ColorEnum.Primary
|
|
120
|
+
},
|
|
121
|
+
hideHeader: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
required: false,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
required: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
required: false,
|
|
129
|
+
default: false
|
|
130
|
+
},
|
|
131
|
+
rules: {
|
|
132
|
+
type: Array as PropType<Function[]>,
|
|
133
|
+
required: false,
|
|
134
|
+
default: () => []
|
|
97
135
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
136
|
+
editable: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
required: false,
|
|
139
|
+
default: true
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
emits: ["update:modelValue"],
|
|
143
|
+
setup(props, { emit }) {
|
|
101
144
|
|
|
102
|
-
|
|
145
|
+
const errors = useColors().getColors(ColorEnum.Error);
|
|
146
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
147
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
103
148
|
|
|
104
|
-
|
|
149
|
+
const innerValue = ref("");
|
|
105
150
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
"--fs-tag-field-dark-text": darks.dark
|
|
118
|
-
};
|
|
119
|
-
});
|
|
151
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
152
|
+
if (!props.editable) {
|
|
153
|
+
return {
|
|
154
|
+
"--fs-tag-field-color": lights.dark
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
"--fs-tag-field-color" : darks.base,
|
|
159
|
+
"--fs-tag-field-error-color": errors.base
|
|
160
|
+
};
|
|
161
|
+
});
|
|
120
162
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
emit("update:value", tags.concat(innerValue.value));
|
|
130
|
-
innerValue.value = "";
|
|
163
|
+
const messages = computed((): string[] => {
|
|
164
|
+
const messages = [];
|
|
165
|
+
for (const rule of props.rules) {
|
|
166
|
+
const message = rule(props.modelValue);
|
|
167
|
+
if (typeof(message) === "string") {
|
|
168
|
+
messages.push(message);
|
|
131
169
|
}
|
|
170
|
+
}
|
|
171
|
+
return messages;
|
|
172
|
+
});
|
|
132
173
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
174
|
+
const onAdd = (): void => {
|
|
175
|
+
if (!props.editable) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
const tags = props.modelValue ?? [];
|
|
179
|
+
if (!innerValue.value.length || tags.includes(innerValue.value)) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
emit("update:modelValue", tags.concat(innerValue.value));
|
|
183
|
+
innerValue.value = "";
|
|
184
|
+
}
|
|
143
185
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
186
|
+
const onRemove = (label: string): void => {
|
|
187
|
+
if (!props.editable) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
const tags = props.modelValue ?? [];
|
|
191
|
+
if (!tags.length || !tags.includes(label)) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
emit("update:modelValue", tags.filter(t => t !== label));
|
|
150
195
|
}
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
ColorEnum,
|
|
199
|
+
innerValue,
|
|
200
|
+
messages,
|
|
201
|
+
style,
|
|
202
|
+
onAdd,
|
|
203
|
+
onRemove
|
|
204
|
+
};
|
|
205
|
+
}
|
|
151
206
|
});
|
|
152
207
|
</script>
|
|
@@ -1,60 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
2
|
+
<FSWrapGroup v-bind="$attrs">
|
|
3
|
+
<FSTag
|
|
4
|
+
v-for="(tag, index) in $props.tags"
|
|
5
|
+
:key="index"
|
|
6
|
+
:label="tag"
|
|
7
|
+
:variant="$props.variant"
|
|
8
|
+
:color="$props.color"
|
|
9
|
+
:editable="$props.editable"
|
|
10
|
+
@remove="() => $emit('remove', tag)"
|
|
11
|
+
/>
|
|
12
|
+
<slot />
|
|
13
|
+
</FSWrapGroup>
|
|
14
14
|
</template>
|
|
15
15
|
|
|
16
16
|
<script lang="ts">
|
|
17
17
|
import { defineComponent, PropType } from "vue";
|
|
18
18
|
|
|
19
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/
|
|
19
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
20
20
|
|
|
21
21
|
import FSWrapGroup from "./FSWrapGroup.vue";
|
|
22
22
|
import FSTag from "./FSTag.vue";
|
|
23
23
|
|
|
24
|
-
export interface FSTagItem {
|
|
25
|
-
label: string,
|
|
26
|
-
variant: "standard" | "full",
|
|
27
|
-
color: ColorBase,
|
|
28
|
-
editable: boolean
|
|
29
|
-
}
|
|
30
|
-
|
|
31
24
|
export default defineComponent({
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
name: "FSTagGroup",
|
|
26
|
+
components: {
|
|
27
|
+
FSWrapGroup,
|
|
28
|
+
FSTag
|
|
29
|
+
},
|
|
30
|
+
props: {
|
|
31
|
+
tags: {
|
|
32
|
+
type: Array as PropType<string[]>,
|
|
33
|
+
required: false,
|
|
34
|
+
default: () => []
|
|
35
|
+
},
|
|
36
|
+
variant: {
|
|
37
|
+
type: String as PropType<"standard" | "full">,
|
|
38
|
+
required: false,
|
|
39
|
+
default: "full"
|
|
40
|
+
},
|
|
41
|
+
color: {
|
|
42
|
+
type: String as PropType<ColorBase>,
|
|
43
|
+
required: false,
|
|
44
|
+
default: ColorEnum.Primary
|
|
36
45
|
},
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
default: () => []
|
|
42
|
-
},
|
|
43
|
-
variant: {
|
|
44
|
-
type: String as PropType<"standard" | "full">,
|
|
45
|
-
required: false,
|
|
46
|
-
default: "full"
|
|
47
|
-
},
|
|
48
|
-
color: {
|
|
49
|
-
type: String as PropType<ColorBase>,
|
|
50
|
-
required: false,
|
|
51
|
-
default: ColorBase.Primary
|
|
52
|
-
},
|
|
53
|
-
editable: {
|
|
54
|
-
type: Boolean,
|
|
55
|
-
required: false,
|
|
56
|
-
default: true
|
|
57
|
-
}
|
|
46
|
+
editable: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
required: false,
|
|
49
|
+
default: true
|
|
58
50
|
}
|
|
51
|
+
}
|
|
59
52
|
});
|
|
60
53
|
</script>
|