@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/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>
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol>
|
|
3
|
+
<slot v-if="!$props.hideHeader" name="label">
|
|
4
|
+
<FSRow
|
|
5
|
+
:wrap="false"
|
|
6
|
+
>
|
|
7
|
+
<FSSpan
|
|
8
|
+
v-if="$props.label"
|
|
9
|
+
class="fs-text-area-label"
|
|
10
|
+
font="text-overline"
|
|
11
|
+
:style="style"
|
|
12
|
+
>
|
|
13
|
+
{{ $props.label }}
|
|
14
|
+
</FSSpan>
|
|
15
|
+
<FSSpan
|
|
16
|
+
v-if="$props.label && $props.required"
|
|
17
|
+
class="fs-text-area-label"
|
|
18
|
+
style="margin-left: -8px;"
|
|
19
|
+
font="text-overline"
|
|
20
|
+
:ellipsis="false"
|
|
21
|
+
:style="style"
|
|
22
|
+
>
|
|
23
|
+
*
|
|
24
|
+
</FSSpan>
|
|
25
|
+
<v-spacer style="min-width: 40px;" />
|
|
26
|
+
<FSSpan
|
|
27
|
+
v-if="messages.length > 0"
|
|
28
|
+
class="fs-text-area-messages"
|
|
29
|
+
font="text-overline"
|
|
30
|
+
:style="style"
|
|
31
|
+
>
|
|
32
|
+
{{ messages.join(", ") }}
|
|
33
|
+
</FSSpan>
|
|
34
|
+
</FSRow>
|
|
35
|
+
</slot>
|
|
36
|
+
<v-textarea
|
|
37
|
+
clearIcon="mdi-close"
|
|
38
|
+
variant="outlined"
|
|
39
|
+
hide-details
|
|
40
|
+
:style="style"
|
|
41
|
+
:class="classes"
|
|
42
|
+
:rows="$props.rows"
|
|
43
|
+
:rules="$props.rules"
|
|
44
|
+
:noResize="!$props.resize"
|
|
45
|
+
:autoGrow="$props.autoGrow"
|
|
46
|
+
:readonly="!$props.editable"
|
|
47
|
+
:clearable="$props.editable"
|
|
48
|
+
:modelValue="$props.modelValue"
|
|
49
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
50
|
+
v-bind="$attrs"
|
|
51
|
+
>
|
|
52
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
53
|
+
<slot :name="name" v-bind="slotData" />
|
|
54
|
+
</template>
|
|
55
|
+
</v-textarea>
|
|
56
|
+
<slot name="description">
|
|
57
|
+
<FSSpan
|
|
58
|
+
v-if="$props.description"
|
|
59
|
+
class="fs-text-area-description"
|
|
60
|
+
font="text-underline"
|
|
61
|
+
:style="style"
|
|
62
|
+
>
|
|
63
|
+
{{ $props.description }}
|
|
64
|
+
</FSSpan>
|
|
65
|
+
</slot>
|
|
66
|
+
</FSCol>
|
|
67
|
+
</template>
|
|
68
|
+
|
|
69
|
+
<script lang="ts">
|
|
70
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
71
|
+
|
|
72
|
+
import { useColors, useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
73
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
74
|
+
|
|
75
|
+
import FSSpan from "./FSSpan.vue";
|
|
76
|
+
import FSCol from "./FSCol.vue";
|
|
77
|
+
import FSRow from "./FSRow.vue";
|
|
78
|
+
|
|
79
|
+
export default defineComponent({
|
|
80
|
+
name: "FSTextArea",
|
|
81
|
+
components: {
|
|
82
|
+
FSSpan,
|
|
83
|
+
FSCol,
|
|
84
|
+
FSRow
|
|
85
|
+
},
|
|
86
|
+
inheritAttrs: false,
|
|
87
|
+
props: {
|
|
88
|
+
label: {
|
|
89
|
+
type: String,
|
|
90
|
+
required: false,
|
|
91
|
+
default: null
|
|
92
|
+
},
|
|
93
|
+
description: {
|
|
94
|
+
type: String,
|
|
95
|
+
required: false,
|
|
96
|
+
default: null
|
|
97
|
+
},
|
|
98
|
+
modelValue: {
|
|
99
|
+
type: String,
|
|
100
|
+
required: false,
|
|
101
|
+
default: null
|
|
102
|
+
},
|
|
103
|
+
required: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
required: false,
|
|
106
|
+
default: false
|
|
107
|
+
},
|
|
108
|
+
rows: {
|
|
109
|
+
type: Number,
|
|
110
|
+
required: false,
|
|
111
|
+
default: 1
|
|
112
|
+
},
|
|
113
|
+
resize: {
|
|
114
|
+
type: Boolean,
|
|
115
|
+
required: false,
|
|
116
|
+
default: true
|
|
117
|
+
},
|
|
118
|
+
autoGrow: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
required: false,
|
|
121
|
+
default: false
|
|
122
|
+
},
|
|
123
|
+
hideHeader: {
|
|
124
|
+
type: Boolean,
|
|
125
|
+
required: false,
|
|
126
|
+
default: false
|
|
127
|
+
},
|
|
128
|
+
rules: {
|
|
129
|
+
type: Array as PropType<Function[]>,
|
|
130
|
+
required: false,
|
|
131
|
+
default: () => []
|
|
132
|
+
},
|
|
133
|
+
editable: {
|
|
134
|
+
type: Boolean,
|
|
135
|
+
required: false,
|
|
136
|
+
default: true
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
emits: ["update:modelValue"],
|
|
140
|
+
setup(props) {
|
|
141
|
+
const { isMobileSized } = useBreakpoints();
|
|
142
|
+
|
|
143
|
+
const errors = useColors().getColors(ColorEnum.Error);
|
|
144
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
145
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
146
|
+
|
|
147
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
148
|
+
let height: string | undefined = undefined;
|
|
149
|
+
let minHeight: string | undefined = undefined;
|
|
150
|
+
if (!props.autoGrow) {
|
|
151
|
+
const base = isMobileSized.value ? 30 : 42;
|
|
152
|
+
const row = isMobileSized.value ? 16 : 20;
|
|
153
|
+
minHeight = `${base}px`;
|
|
154
|
+
if (props.rows > 1) {
|
|
155
|
+
height = `${base + (props.rows - 1) * row}px`;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
height = `${base}px`;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (!props.editable) {
|
|
162
|
+
return {
|
|
163
|
+
"--fs-text-area-cursor" : "default",
|
|
164
|
+
"--fs-text-area-border-color" : lights.base,
|
|
165
|
+
"--fs-text-area-color" : lights.dark,
|
|
166
|
+
"--fs-text-area-active-border-color": lights.base,
|
|
167
|
+
"--fs-text-area-min-height" : minHeight,
|
|
168
|
+
"--fs-text-area-height" : height
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return {
|
|
172
|
+
"--fs-text-area-cursor" : "text",
|
|
173
|
+
"--fs-text-area-border-color" : lights.dark,
|
|
174
|
+
"--fs-text-area-color" : darks.base,
|
|
175
|
+
"--fs-text-area-active-border-color": darks.dark,
|
|
176
|
+
"--fs-text-area-error-color" : errors.base,
|
|
177
|
+
"--fs-text-area-error-border-color" : errors.base,
|
|
178
|
+
"--fs-text-area-min-height" : minHeight,
|
|
179
|
+
"--fs-text-area-height" : height
|
|
180
|
+
};
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
const messages = computed(() => {
|
|
184
|
+
const messages = [];
|
|
185
|
+
for (const rule of props.rules) {
|
|
186
|
+
const message = rule(props.modelValue);
|
|
187
|
+
if (typeof(message) === "string") {
|
|
188
|
+
messages.push(message);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
return messages;
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
const classes = computed((): string[] => {
|
|
195
|
+
const classNames = ["fs-text-area"];
|
|
196
|
+
if (props.autoGrow) {
|
|
197
|
+
classNames.push("fs-text-area-auto-grow");
|
|
198
|
+
}
|
|
199
|
+
return classNames;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
messages,
|
|
204
|
+
style,
|
|
205
|
+
classes
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
</script>
|
|
@@ -1,169 +1,172 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
>
|
|
11
|
-
{{ $props.label }}
|
|
12
|
-
</FSSpan>
|
|
13
|
-
<FSSpan
|
|
14
|
-
v-if="$props.label && $props.required"
|
|
15
|
-
class="fs-text-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-text-field-messages"
|
|
27
|
-
font="text-overline"
|
|
28
|
-
:style="style"
|
|
29
|
-
>
|
|
30
|
-
{{ messages.join(", ") }}
|
|
31
|
-
</FSSpan>
|
|
32
|
-
</FSRow>
|
|
33
|
-
</slot>
|
|
34
|
-
<v-text-field
|
|
35
|
-
class="fs-text-field"
|
|
36
|
-
variant="outlined"
|
|
37
|
-
hide-details
|
|
38
|
-
:style="style"
|
|
39
|
-
:type="$props.type"
|
|
40
|
-
:rules="$props.rules"
|
|
41
|
-
:readonly="!$props.editable"
|
|
42
|
-
:modelValue="$props.value"
|
|
43
|
-
@update:modelValue="(value) => $emit('update:value', value)"
|
|
44
|
-
v-bind="$attrs"
|
|
2
|
+
<FSCol>
|
|
3
|
+
<slot v-if="!$props.hideHeader" name="label">
|
|
4
|
+
<FSRow :wrap="false">
|
|
5
|
+
<FSSpan
|
|
6
|
+
v-if="$props.label"
|
|
7
|
+
class="fs-text-field-label"
|
|
8
|
+
font="text-overline"
|
|
9
|
+
:style="style"
|
|
45
10
|
>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
11
|
+
{{ $props.label }}
|
|
12
|
+
</FSSpan>
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label && $props.required"
|
|
15
|
+
class="fs-text-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-text-field-messages"
|
|
27
|
+
font="text-overline"
|
|
28
|
+
:style="style"
|
|
29
|
+
>
|
|
30
|
+
{{ messages.join(", ") }}
|
|
31
|
+
</FSSpan>
|
|
32
|
+
</FSRow>
|
|
33
|
+
</slot>
|
|
34
|
+
<v-text-field
|
|
35
|
+
class="fs-text-field"
|
|
36
|
+
clearIcon="mdi-close"
|
|
37
|
+
variant="outlined"
|
|
38
|
+
hide-details
|
|
39
|
+
:style="style"
|
|
40
|
+
:type="$props.type"
|
|
41
|
+
:rules="$props.rules"
|
|
42
|
+
:readonly="!$props.editable"
|
|
43
|
+
:clearable="$props.editable"
|
|
44
|
+
:modelValue="$props.modelValue"
|
|
45
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
46
|
+
v-bind="$attrs"
|
|
47
|
+
>
|
|
48
|
+
<template v-for="(_, name) in slots" v-slot:[name]="slotData">
|
|
49
|
+
<slot :name="name" v-bind="slotData" />
|
|
50
|
+
</template>
|
|
51
|
+
</v-text-field>
|
|
52
|
+
<slot name="description">
|
|
53
|
+
<FSSpan
|
|
54
|
+
v-if="$props.description"
|
|
55
|
+
class="fs-text-field-description"
|
|
56
|
+
font="text-underline"
|
|
57
|
+
:style="style"
|
|
58
|
+
>
|
|
59
|
+
{{ $props.description }}
|
|
60
|
+
</FSSpan>
|
|
61
|
+
</slot>
|
|
62
|
+
</FSCol>
|
|
61
63
|
</template>
|
|
62
64
|
|
|
63
65
|
<script lang="ts">
|
|
64
|
-
import { computed, defineComponent, PropType
|
|
66
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
65
67
|
|
|
66
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
67
|
-
import {
|
|
68
|
+
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
69
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
68
70
|
|
|
69
71
|
import FSSpan from "./FSSpan.vue";
|
|
70
72
|
import FSCol from "./FSCol.vue";
|
|
71
73
|
import FSRow from "./FSRow.vue";
|
|
72
74
|
|
|
73
75
|
export default defineComponent({
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
name: "FSTextField",
|
|
77
|
+
components: {
|
|
78
|
+
FSSpan,
|
|
79
|
+
FSCol,
|
|
80
|
+
FSRow
|
|
81
|
+
},
|
|
82
|
+
inheritAttrs: false,
|
|
83
|
+
props: {
|
|
84
|
+
label: {
|
|
85
|
+
type: String,
|
|
86
|
+
required: false,
|
|
87
|
+
default: null
|
|
79
88
|
},
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
required: true,
|
|
85
|
-
default: null
|
|
86
|
-
},
|
|
87
|
-
description: {
|
|
88
|
-
type: String,
|
|
89
|
-
required: false,
|
|
90
|
-
default: null
|
|
91
|
-
},
|
|
92
|
-
type: {
|
|
93
|
-
type: String as PropType<"text" | "password" | "number">,
|
|
94
|
-
required: false,
|
|
95
|
-
default: "text"
|
|
96
|
-
},
|
|
97
|
-
value: {
|
|
98
|
-
type: String,
|
|
99
|
-
required: false,
|
|
100
|
-
default: null
|
|
101
|
-
},
|
|
102
|
-
color: {
|
|
103
|
-
type: String as PropType<ColorBase>,
|
|
104
|
-
required: false,
|
|
105
|
-
default: ColorBase.Dark
|
|
106
|
-
},
|
|
107
|
-
required: {
|
|
108
|
-
type: Boolean,
|
|
109
|
-
required: false,
|
|
110
|
-
default: false
|
|
111
|
-
},
|
|
112
|
-
rules: {
|
|
113
|
-
type: Array as PropType<Function[]>,
|
|
114
|
-
required: false,
|
|
115
|
-
default: () => []
|
|
116
|
-
},
|
|
117
|
-
editable: {
|
|
118
|
-
type: Boolean,
|
|
119
|
-
required: false,
|
|
120
|
-
default: true
|
|
121
|
-
}
|
|
89
|
+
description: {
|
|
90
|
+
type: String,
|
|
91
|
+
required: false,
|
|
92
|
+
default: null
|
|
122
93
|
},
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
94
|
+
type: {
|
|
95
|
+
type: String as PropType<"text" | "password" | "number">,
|
|
96
|
+
required: false,
|
|
97
|
+
default: "text"
|
|
98
|
+
},
|
|
99
|
+
modelValue: {
|
|
100
|
+
type: String,
|
|
101
|
+
required: false,
|
|
102
|
+
default: null
|
|
103
|
+
},
|
|
104
|
+
hideHeader: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
required: false,
|
|
107
|
+
default: false
|
|
108
|
+
},
|
|
109
|
+
required: {
|
|
110
|
+
type: Boolean,
|
|
111
|
+
required: false,
|
|
112
|
+
default: false
|
|
113
|
+
},
|
|
114
|
+
rules: {
|
|
115
|
+
type: Array as PropType<Function[]>,
|
|
116
|
+
required: false,
|
|
117
|
+
default: () => []
|
|
118
|
+
},
|
|
119
|
+
editable: {
|
|
120
|
+
type: Boolean,
|
|
121
|
+
required: false,
|
|
122
|
+
default: true
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
emits: ["update:modelValue"],
|
|
126
|
+
setup(props) {
|
|
127
|
+
const { slots } = useSlots();
|
|
128
|
+
delete slots.label;
|
|
129
|
+
delete slots.description;
|
|
151
130
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
const message = rule(props.value);
|
|
156
|
-
if (typeof(message) === "string") {
|
|
157
|
-
messages.push(message);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
return messages;
|
|
161
|
-
});
|
|
131
|
+
const errors = useColors().getColors(ColorEnum.Error);
|
|
132
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
133
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
162
134
|
|
|
135
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
136
|
+
if (!props.editable) {
|
|
163
137
|
return {
|
|
164
|
-
|
|
165
|
-
|
|
138
|
+
"--fs-text-field-cursor" : "default",
|
|
139
|
+
"--fs-text-field-border-color" : lights.base,
|
|
140
|
+
"--fs-text-field-color" : lights.dark,
|
|
141
|
+
"--fs-text-field-active-border-color": lights.base
|
|
166
142
|
};
|
|
167
|
-
|
|
143
|
+
}
|
|
144
|
+
return {
|
|
145
|
+
"--fs-text-field-cursor" : "text",
|
|
146
|
+
"--fs-text-field-border-color" : lights.dark,
|
|
147
|
+
"--fs-text-field-color" : darks.base,
|
|
148
|
+
"--fs-text-field-active-border-color": darks.dark,
|
|
149
|
+
"--fs-text-field-error-color" : errors.base,
|
|
150
|
+
"--fs-text-field-error-border-color" : errors.base
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
const messages = computed((): string[] => {
|
|
155
|
+
const messages = [];
|
|
156
|
+
for (const rule of props.rules) {
|
|
157
|
+
const message = rule(props.modelValue ?? "");
|
|
158
|
+
if (typeof(message) === "string") {
|
|
159
|
+
messages.push(message);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return messages;
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
return {
|
|
166
|
+
messages,
|
|
167
|
+
slots,
|
|
168
|
+
style
|
|
169
|
+
};
|
|
170
|
+
}
|
|
168
171
|
});
|
|
169
172
|
</script>
|