@dative-gpi/foundation-shared-components 0.0.8 → 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 +52 -39
- package/components/FSCalendarTwin.vue +120 -102
- package/components/FSCard.vue +35 -21
- package/components/FSCarousel.vue +63 -0
- package/components/FSCheckbox.vue +111 -103
- package/components/FSChip.vue +140 -0
- package/components/FSClock.vue +149 -15
- 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 -101
- package/components/FSRadio.vue +107 -109
- package/components/FSRadioGroup.vue +55 -57
- package/components/FSRemoveDialog.vue +123 -0
- package/components/FSRichTextField.vue +26 -33
- package/components/FSRow.vue +110 -104
- package/components/FSSearchField.vue +35 -27
- package/components/FSSelectField.vue +188 -0
- package/components/FSSlideGroup.vue +45 -49
- package/components/FSSlider.vue +31 -33
- 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 +32 -36
- package/components/FSTagGroup.vue +38 -45
- package/components/FSText.vue +74 -64
- package/components/FSTextArea.vue +187 -185
- package/components/FSTextField.vue +18 -20
- 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 +1 -1
- package/composables/useBreakpoints.ts +23 -4
- 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 +5 -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 -6
- package/styles/components/fs_calendar.scss +24 -1
- package/styles/components/fs_card.scss +2 -5
- 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 +19 -3
- 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_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 +29 -9
- 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 +0 -11
- 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 +21 -1
- 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 -1
- package/utils/levenshtein.ts +97 -0
- package/utils/sort.ts +9 -0
- package/components/FSDatePicker.vue +0 -226
- package/composables/useDates.ts +0 -39
- package/models/FSTags.ts +0 -8
- package/models/FSTextFields.ts +0 -23
- package/styles/components/fs_date_picker.scss +0 -0
- /package/utils/{FSRichTextField.ts → lexical.ts} +0 -0
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>
|
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
<FSTextField
|
|
4
4
|
:label="$props.label"
|
|
5
5
|
:description="$props.description"
|
|
6
|
-
:
|
|
7
|
-
:color="$props.color"
|
|
6
|
+
:hideHeader="$props.hideHeader"
|
|
8
7
|
:required="$props.required"
|
|
9
8
|
:editable="$props.editable"
|
|
10
9
|
:error="messages.length > 0"
|
|
11
|
-
:modelValue="innerValue"
|
|
12
|
-
@update:modelValue="(value) => innerValue = value"
|
|
13
10
|
@keydown.enter="onAdd"
|
|
11
|
+
v-model="innerValue"
|
|
14
12
|
v-bind="$attrs"
|
|
15
13
|
>
|
|
16
|
-
<template #label>
|
|
14
|
+
<template v-if="!$props.hideHeader" #label>
|
|
17
15
|
<slot name="label">
|
|
18
16
|
<FSRow :wrap="false">
|
|
19
17
|
<FSSpan
|
|
@@ -48,14 +46,13 @@
|
|
|
48
46
|
</template>
|
|
49
47
|
<template #append-inner>
|
|
50
48
|
<slot name="append-inner">
|
|
51
|
-
<
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
:
|
|
49
|
+
<FSButton
|
|
50
|
+
variant="icon"
|
|
51
|
+
icon="mdi-tag-outline"
|
|
52
|
+
:editable="$props.editable"
|
|
53
|
+
:color="ColorEnum.Dark"
|
|
55
54
|
@click="onAdd"
|
|
56
|
-
|
|
57
|
-
mdi-tag-outline
|
|
58
|
-
</FSIcon>
|
|
55
|
+
/>
|
|
59
56
|
</slot>
|
|
60
57
|
</template>
|
|
61
58
|
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
@@ -73,13 +70,14 @@
|
|
|
73
70
|
</template>
|
|
74
71
|
|
|
75
72
|
<script lang="ts">
|
|
76
|
-
import { computed, defineComponent, PropType, ref
|
|
73
|
+
import { computed, defineComponent, PropType, ref } from "vue";
|
|
77
74
|
|
|
75
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
78
76
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
79
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
80
77
|
|
|
81
78
|
import FSTextField from "./FSTextField.vue";
|
|
82
79
|
import FSTagGroup from "./FSTagGroup.vue";
|
|
80
|
+
import FSButton from "./FSButton.vue";
|
|
83
81
|
import FSSpan from "./FSSpan.vue";
|
|
84
82
|
import FSCol from "./FSCol.vue";
|
|
85
83
|
import FSRow from "./FSRow.vue";
|
|
@@ -89,6 +87,7 @@ export default defineComponent({
|
|
|
89
87
|
components: {
|
|
90
88
|
FSTextField,
|
|
91
89
|
FSTagGroup,
|
|
90
|
+
FSButton,
|
|
92
91
|
FSSpan,
|
|
93
92
|
FSCol,
|
|
94
93
|
FSRow
|
|
@@ -109,11 +108,6 @@ export default defineComponent({
|
|
|
109
108
|
required: false,
|
|
110
109
|
default: () => []
|
|
111
110
|
},
|
|
112
|
-
color: {
|
|
113
|
-
type: String as PropType<ColorBase>,
|
|
114
|
-
required: false,
|
|
115
|
-
default: ColorBase.Dark
|
|
116
|
-
},
|
|
117
111
|
tagVariant: {
|
|
118
112
|
type: String as PropType<"standard" | "full">,
|
|
119
113
|
required: false,
|
|
@@ -122,7 +116,12 @@ export default defineComponent({
|
|
|
122
116
|
tagColor: {
|
|
123
117
|
type: String as PropType<ColorBase>,
|
|
124
118
|
required: false,
|
|
125
|
-
default:
|
|
119
|
+
default: ColorEnum.Primary
|
|
120
|
+
},
|
|
121
|
+
hideHeader: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
required: false,
|
|
124
|
+
default: false
|
|
126
125
|
},
|
|
127
126
|
required: {
|
|
128
127
|
type: Boolean,
|
|
@@ -142,32 +141,28 @@ export default defineComponent({
|
|
|
142
141
|
},
|
|
143
142
|
emits: ["update:modelValue"],
|
|
144
143
|
setup(props, { emit }) {
|
|
145
|
-
const { modelValue, rules, editable } = toRefs(props);
|
|
146
144
|
|
|
147
|
-
const
|
|
145
|
+
const errors = useColors().getColors(ColorEnum.Error);
|
|
146
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
147
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
148
148
|
|
|
149
|
-
const
|
|
150
|
-
const darks = useColors().getColors(ColorBase.Dark);
|
|
149
|
+
const innerValue = ref("");
|
|
151
150
|
|
|
152
151
|
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
153
|
-
if (!editable
|
|
152
|
+
if (!props.editable) {
|
|
154
153
|
return {
|
|
155
|
-
"--fs-tag-field-
|
|
156
|
-
"--fs-tag-field-base-text": darks.light,
|
|
157
|
-
"--fs-tag-field-dark-text": darks.light
|
|
154
|
+
"--fs-tag-field-color": lights.dark
|
|
158
155
|
};
|
|
159
156
|
}
|
|
160
157
|
return {
|
|
161
|
-
"--fs-tag-field-
|
|
162
|
-
"--fs-tag-field-base-text" : darks.base,
|
|
163
|
-
"--fs-tag-field-dark-text" : darks.dark,
|
|
158
|
+
"--fs-tag-field-color" : darks.base,
|
|
164
159
|
"--fs-tag-field-error-color": errors.base
|
|
165
160
|
};
|
|
166
161
|
});
|
|
167
162
|
|
|
168
163
|
const messages = computed((): string[] => {
|
|
169
164
|
const messages = [];
|
|
170
|
-
for (const rule of rules
|
|
165
|
+
for (const rule of props.rules) {
|
|
171
166
|
const message = rule(props.modelValue);
|
|
172
167
|
if (typeof(message) === "string") {
|
|
173
168
|
messages.push(message);
|
|
@@ -177,10 +172,10 @@ export default defineComponent({
|
|
|
177
172
|
});
|
|
178
173
|
|
|
179
174
|
const onAdd = (): void => {
|
|
180
|
-
if (!editable
|
|
175
|
+
if (!props.editable) {
|
|
181
176
|
return;
|
|
182
177
|
}
|
|
183
|
-
const tags = modelValue
|
|
178
|
+
const tags = props.modelValue ?? [];
|
|
184
179
|
if (!innerValue.value.length || tags.includes(innerValue.value)) {
|
|
185
180
|
return;
|
|
186
181
|
}
|
|
@@ -189,10 +184,10 @@ export default defineComponent({
|
|
|
189
184
|
}
|
|
190
185
|
|
|
191
186
|
const onRemove = (label: string): void => {
|
|
192
|
-
if (!editable
|
|
187
|
+
if (!props.editable) {
|
|
193
188
|
return;
|
|
194
189
|
}
|
|
195
|
-
const tags = modelValue
|
|
190
|
+
const tags = props.modelValue ?? [];
|
|
196
191
|
if (!tags.length || !tags.includes(label)) {
|
|
197
192
|
return;
|
|
198
193
|
}
|
|
@@ -200,6 +195,7 @@ export default defineComponent({
|
|
|
200
195
|
}
|
|
201
196
|
|
|
202
197
|
return {
|
|
198
|
+
ColorEnum,
|
|
203
199
|
innerValue,
|
|
204
200
|
messages,
|
|
205
201
|
style,
|
|
@@ -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>
|
package/components/FSText.vue
CHANGED
|
@@ -1,78 +1,88 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
<span
|
|
3
|
+
:class="classes"
|
|
4
|
+
:style="style"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
>
|
|
7
|
+
<slot />
|
|
8
|
+
</span>
|
|
9
9
|
</template>
|
|
10
10
|
|
|
11
11
|
<script lang="ts">
|
|
12
|
-
import { computed, defineComponent, PropType
|
|
12
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
13
13
|
|
|
14
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
-
import { ColorBase } from "@dative-gpi/foundation-shared-components/
|
|
14
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
16
16
|
|
|
17
17
|
export default defineComponent({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
color: {
|
|
26
|
-
type: String as PropType<ColorBase>,
|
|
27
|
-
required: false,
|
|
28
|
-
default: ColorBase.Dark
|
|
29
|
-
},
|
|
30
|
-
variant: {
|
|
31
|
-
type: String as PropType<"base" | "light" | "dark">,
|
|
32
|
-
required: false,
|
|
33
|
-
default: "dark"
|
|
34
|
-
},
|
|
35
|
-
ellipsis: {
|
|
36
|
-
type: Boolean,
|
|
37
|
-
required: false,
|
|
38
|
-
default: true
|
|
39
|
-
}
|
|
18
|
+
name: "FSText",
|
|
19
|
+
props: {
|
|
20
|
+
font: {
|
|
21
|
+
type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-body" | "text-button" | "text-overline" | "text-underline">,
|
|
22
|
+
required: false,
|
|
23
|
+
default: "text-body"
|
|
40
24
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
25
|
+
lineClamp: {
|
|
26
|
+
type: Number,
|
|
27
|
+
required: false,
|
|
28
|
+
default: 1
|
|
29
|
+
},
|
|
30
|
+
ellipsis: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
required: false,
|
|
33
|
+
default: true
|
|
34
|
+
},
|
|
35
|
+
color: {
|
|
36
|
+
type: String as PropType<ColorBase>,
|
|
37
|
+
required: false,
|
|
38
|
+
default: ColorEnum.Dark
|
|
39
|
+
},
|
|
40
|
+
variant: {
|
|
41
|
+
type: String as PropType<"base" | "light" | "dark">,
|
|
42
|
+
required: false,
|
|
43
|
+
default: "dark"
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
setup(props) {
|
|
47
|
+
const { slots } = useSlots();
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
switch (variant.value) {
|
|
49
|
-
case "base": return {
|
|
50
|
-
"--fs-text-color": colors.base
|
|
51
|
-
};
|
|
52
|
-
case "light": return {
|
|
53
|
-
"--fs-text-color": colors.light
|
|
54
|
-
};
|
|
55
|
-
case "dark": return {
|
|
56
|
-
"--fs-text-color": colors.dark
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
});
|
|
49
|
+
const colors = computed(() => useColors().getColors(props.color));
|
|
60
50
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
51
|
+
const classes = computed((): string[] => {
|
|
52
|
+
const classNames = ["fs-text", props.font];
|
|
53
|
+
if (!slots.default) {
|
|
54
|
+
classNames.push("fs-span-pre-wrap");
|
|
55
|
+
}
|
|
56
|
+
if (props.lineClamp > 1) {
|
|
57
|
+
classNames.push("fs-span-line-clamp");
|
|
58
|
+
}
|
|
59
|
+
else if (props.ellipsis) {
|
|
60
|
+
classNames.push("fs-span-ellipsis");
|
|
61
|
+
}
|
|
62
|
+
return classNames;
|
|
63
|
+
});
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
66
|
+
switch (props.variant) {
|
|
67
|
+
case "base": return {
|
|
68
|
+
"--fs-span-line-clamp": props.lineClamp.toString(),
|
|
69
|
+
"--fs-text-color" : colors.value.base
|
|
75
70
|
};
|
|
76
|
-
|
|
71
|
+
case "light": return {
|
|
72
|
+
"--fs-span-line-clamp": props.lineClamp.toString(),
|
|
73
|
+
"--fs-text-color" : colors.value.light
|
|
74
|
+
};
|
|
75
|
+
case "dark": return {
|
|
76
|
+
"--fs-span-line-clamp": props.lineClamp.toString(),
|
|
77
|
+
"--fs-text-color" : colors.value.dark
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
return {
|
|
83
|
+
classes,
|
|
84
|
+
style
|
|
85
|
+
};
|
|
86
|
+
}
|
|
77
87
|
});
|
|
78
88
|
</script>
|