@dative-gpi/foundation-shared-components 0.0.6 → 0.0.8
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/components/FSButton.vue +170 -164
- package/components/FSCalendar.vue +171 -0
- package/components/FSCalendarTwin.vue +394 -0
- package/components/FSCard.vue +63 -0
- package/components/FSCheckbox.vue +7 -8
- package/components/FSClock.vue +38 -0
- package/components/FSDatePicker.vue +226 -0
- package/components/FSIcon.vue +1 -1
- package/components/FSNumberField.vue +4 -4
- package/components/FSPasswordField.vue +14 -12
- package/components/FSRadio.vue +0 -1
- package/components/FSRadioGroup.vue +6 -6
- package/components/FSRichTextField.vue +558 -0
- package/components/FSSearchField.vue +103 -102
- package/components/FSSlider.vue +132 -0
- package/components/FSSwitch.vue +9 -9
- package/components/FSTagField.vue +186 -127
- package/components/FSTextArea.vue +207 -0
- package/components/FSTextField.vue +151 -146
- package/composables/index.ts +2 -1
- package/composables/useBreakpoints.ts +14 -0
- package/composables/useDates.ts +39 -0
- package/models/FSTextFields.ts +12 -6
- package/package.json +12 -4
- package/styles/components/fs_button.scss +2 -10
- package/styles/components/fs_calendar.scss +115 -0
- package/styles/components/fs_card.scss +7 -0
- package/styles/components/fs_date_picker.scss +0 -0
- package/styles/components/fs_icon.scss +3 -9
- package/styles/components/fs_rich_text_field.scss +67 -0
- package/styles/components/fs_slider.scss +20 -0
- package/styles/components/fs_tag_field.scss +9 -0
- package/styles/components/fs_text_area.scss +105 -0
- package/styles/components/index.scss +6 -0
- package/utils/FSRichTextField.ts +27 -0
- package/utils/index.ts +1 -0
- package/composables/useTouch.ts +0 -9
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-menu :closeOnContentClick="false">
|
|
3
|
+
<template #activator="{ props }">
|
|
4
|
+
<FSTextField
|
|
5
|
+
class="fs-date-picker"
|
|
6
|
+
:label="$props.label"
|
|
7
|
+
:description="$props.description"
|
|
8
|
+
:color="$props.color"
|
|
9
|
+
:required="$props.required"
|
|
10
|
+
:editable="$props.editable"
|
|
11
|
+
:error="messages.length > 0"
|
|
12
|
+
:readonly="true"
|
|
13
|
+
>
|
|
14
|
+
<template #label>
|
|
15
|
+
<slot name="label">
|
|
16
|
+
<FSRow :wrap="false">
|
|
17
|
+
<FSSpan
|
|
18
|
+
v-if="$props.label"
|
|
19
|
+
class="fs-date-picker-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-date-picker-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-date-picker-messages"
|
|
39
|
+
font="text-overline"
|
|
40
|
+
:style="style"
|
|
41
|
+
>
|
|
42
|
+
{{ messages.join(", ") }}
|
|
43
|
+
</FSSpan>
|
|
44
|
+
</FSRow>
|
|
45
|
+
</slot>
|
|
46
|
+
</template>
|
|
47
|
+
<template #prepend-inner>
|
|
48
|
+
<slot name="prepend-inner">
|
|
49
|
+
<FSIcon :color="prependColor">
|
|
50
|
+
{{ $props.prependIcon }}
|
|
51
|
+
</FSIcon>
|
|
52
|
+
</slot>
|
|
53
|
+
</template>
|
|
54
|
+
<template #append>
|
|
55
|
+
<slot name="append">
|
|
56
|
+
<FSButton
|
|
57
|
+
:prependIcon="$props.buttonPrependIcon"
|
|
58
|
+
:label="$props.buttonLabel"
|
|
59
|
+
:appendIcon="$props.buttonAppendIcon"
|
|
60
|
+
:variant="$props.buttonVariant"
|
|
61
|
+
:color="$props.buttonColor"
|
|
62
|
+
:editable="$props.editable"
|
|
63
|
+
v-bind="props"
|
|
64
|
+
/>
|
|
65
|
+
</slot>
|
|
66
|
+
</template>
|
|
67
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
68
|
+
<slot :name="name" v-bind="slotData" />
|
|
69
|
+
</template>
|
|
70
|
+
</FSTextField>
|
|
71
|
+
</template>
|
|
72
|
+
<FSCol>
|
|
73
|
+
<FSCalendar
|
|
74
|
+
label="test"
|
|
75
|
+
:color="$props.color"
|
|
76
|
+
:buttonColor="$props.buttonColor"
|
|
77
|
+
:modelValue="$props.modelValue"
|
|
78
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
79
|
+
/>
|
|
80
|
+
<FSClock
|
|
81
|
+
:color="$props.color"
|
|
82
|
+
:buttonColor="$props.buttonColor"
|
|
83
|
+
:modelValue="$props.modelValue"
|
|
84
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
85
|
+
/>
|
|
86
|
+
</FSCol>
|
|
87
|
+
</v-menu>
|
|
88
|
+
</template>
|
|
89
|
+
|
|
90
|
+
<script lang="ts">
|
|
91
|
+
import { computed, defineComponent, PropType, toRefs } from "vue";
|
|
92
|
+
|
|
93
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
94
|
+
import { ColorBase } from "@dative-gpi/foundation-shared-components/themes";
|
|
95
|
+
|
|
96
|
+
import FSTextField from "./FSTextField.vue";
|
|
97
|
+
import FSCalendar from "./FSCalendarTwin.vue";
|
|
98
|
+
import FSButton from "./FSButton.vue";
|
|
99
|
+
import FSClock from "./FSClock.vue";
|
|
100
|
+
import FSIcon from "./FSIcon.vue";
|
|
101
|
+
import FSCol from "./FSCol.vue";
|
|
102
|
+
|
|
103
|
+
export default defineComponent({
|
|
104
|
+
name: "FSDatePicker",
|
|
105
|
+
components: {
|
|
106
|
+
FSTextField,
|
|
107
|
+
FSCalendar,
|
|
108
|
+
FSButton,
|
|
109
|
+
FSClock,
|
|
110
|
+
FSIcon,
|
|
111
|
+
FSCol
|
|
112
|
+
},
|
|
113
|
+
props: {
|
|
114
|
+
label: {
|
|
115
|
+
type: String,
|
|
116
|
+
required: false,
|
|
117
|
+
default: null
|
|
118
|
+
},
|
|
119
|
+
description: {
|
|
120
|
+
type: String,
|
|
121
|
+
required: false,
|
|
122
|
+
default: null
|
|
123
|
+
},
|
|
124
|
+
prependIcon: {
|
|
125
|
+
type: String,
|
|
126
|
+
required: false,
|
|
127
|
+
default: "mdi-calendar"
|
|
128
|
+
},
|
|
129
|
+
buttonPrependIcon: {
|
|
130
|
+
type: String,
|
|
131
|
+
required: false,
|
|
132
|
+
default: "mdi-pencil"
|
|
133
|
+
},
|
|
134
|
+
buttonLabel: {
|
|
135
|
+
type: String,
|
|
136
|
+
required: false,
|
|
137
|
+
default: null
|
|
138
|
+
},
|
|
139
|
+
buttonAppendIcon: {
|
|
140
|
+
type: String,
|
|
141
|
+
required: false,
|
|
142
|
+
default: null
|
|
143
|
+
},
|
|
144
|
+
buttonVariant: {
|
|
145
|
+
type: String as PropType<"standard" | "full" | "icon">,
|
|
146
|
+
required: false,
|
|
147
|
+
default: "standard"
|
|
148
|
+
},
|
|
149
|
+
modelValue: {
|
|
150
|
+
type: Array as PropType<Array<number>>,
|
|
151
|
+
required: false,
|
|
152
|
+
default: null
|
|
153
|
+
},
|
|
154
|
+
color: {
|
|
155
|
+
type: String as PropType<ColorBase>,
|
|
156
|
+
required: false,
|
|
157
|
+
default: ColorBase.Dark
|
|
158
|
+
},
|
|
159
|
+
buttonColor: {
|
|
160
|
+
type: String as PropType<ColorBase>,
|
|
161
|
+
required: false,
|
|
162
|
+
default: ColorBase.Primary
|
|
163
|
+
},
|
|
164
|
+
required: {
|
|
165
|
+
type: Boolean,
|
|
166
|
+
required: false,
|
|
167
|
+
default: false
|
|
168
|
+
},
|
|
169
|
+
rules: {
|
|
170
|
+
type: Array as PropType<Function[]>,
|
|
171
|
+
required: false,
|
|
172
|
+
default: () => []
|
|
173
|
+
},
|
|
174
|
+
editable: {
|
|
175
|
+
type: Boolean,
|
|
176
|
+
required: false,
|
|
177
|
+
default: true
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
setup(props) {
|
|
181
|
+
const { color, rules, editable } = toRefs(props);
|
|
182
|
+
|
|
183
|
+
const colors = useColors().getColors(color.value);
|
|
184
|
+
|
|
185
|
+
const backgrounds = useColors().getColors(ColorBase.Background);
|
|
186
|
+
const lights = useColors().getColors(ColorBase.Light);
|
|
187
|
+
const darks = useColors().getColors(ColorBase.Dark);
|
|
188
|
+
|
|
189
|
+
const prependColor = computed((): string => {
|
|
190
|
+
if (!editable.value) {
|
|
191
|
+
return lights.dark;
|
|
192
|
+
}
|
|
193
|
+
return darks.base;
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
197
|
+
if (!editable.value) {
|
|
198
|
+
return {};
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
"--fs-date-picker-background-color" : backgrounds.base,
|
|
202
|
+
"--fs-date-picker-border-color" : colors.base,
|
|
203
|
+
"--fs-date-picker-color" : darks.base,
|
|
204
|
+
"--fs-date-picker-active-color" : lights.base,
|
|
205
|
+
};
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const messages = computed((): string[] => {
|
|
209
|
+
const messages = [];
|
|
210
|
+
for (const rule of rules.value) {
|
|
211
|
+
const message = rule(props.modelValue ?? "");
|
|
212
|
+
if (typeof(message) === "string") {
|
|
213
|
+
messages.push(message);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return messages;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
return {
|
|
220
|
+
prependColor,
|
|
221
|
+
style,
|
|
222
|
+
messages
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
</script>
|
package/components/FSIcon.vue
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
:color="$props.color"
|
|
7
7
|
:required="$props.required"
|
|
8
8
|
:editable="$props.editable"
|
|
9
|
-
:
|
|
10
|
-
@update:
|
|
9
|
+
:modelValue="$props.modelValue?.toString()"
|
|
10
|
+
@update:modelValue="(value) => $emit('update:modelValue', isNaN(parseFloat(value)) ? 0 : parseFloat(value))"
|
|
11
11
|
v-bind="$attrs"
|
|
12
12
|
>
|
|
13
13
|
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
@@ -39,7 +39,7 @@ export default defineComponent({
|
|
|
39
39
|
required: false,
|
|
40
40
|
default: null
|
|
41
41
|
},
|
|
42
|
-
|
|
42
|
+
modelValue: {
|
|
43
43
|
type: Number,
|
|
44
44
|
required: false,
|
|
45
45
|
default: null
|
|
@@ -60,6 +60,6 @@ export default defineComponent({
|
|
|
60
60
|
default: true
|
|
61
61
|
}
|
|
62
62
|
},
|
|
63
|
-
emits: ["update:
|
|
63
|
+
emits: ["update:modelValue"]
|
|
64
64
|
});
|
|
65
65
|
</script>
|
|
@@ -6,19 +6,21 @@
|
|
|
6
6
|
:color="$props.color"
|
|
7
7
|
:required="$props.required"
|
|
8
8
|
:editable="$props.editable"
|
|
9
|
-
:
|
|
10
|
-
@update:
|
|
9
|
+
:modelValue="$props.modelValue"
|
|
10
|
+
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
11
11
|
v-bind="$attrs"
|
|
12
12
|
>
|
|
13
13
|
<template #append-inner>
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
<slot name="append-inner">
|
|
15
|
+
<FSIcon
|
|
16
|
+
class="fs-password-field-icon"
|
|
17
|
+
size="m"
|
|
18
|
+
:style="style"
|
|
19
|
+
@click="onToggle"
|
|
20
|
+
>
|
|
21
|
+
{{ icon }}
|
|
22
|
+
</FSIcon>
|
|
23
|
+
</slot>
|
|
22
24
|
</template>
|
|
23
25
|
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
24
26
|
<slot :name="name" v-bind="slotData" />
|
|
@@ -52,7 +54,7 @@ export default defineComponent({
|
|
|
52
54
|
required: false,
|
|
53
55
|
default: null
|
|
54
56
|
},
|
|
55
|
-
|
|
57
|
+
modelValue: {
|
|
56
58
|
type: String,
|
|
57
59
|
required: false,
|
|
58
60
|
default: null
|
|
@@ -73,7 +75,7 @@ export default defineComponent({
|
|
|
73
75
|
default: true
|
|
74
76
|
}
|
|
75
77
|
},
|
|
76
|
-
emits: ["update:
|
|
78
|
+
emits: ["update:modelValue"],
|
|
77
79
|
setup(props) {
|
|
78
80
|
const { editable } = toRefs(props);
|
|
79
81
|
|
package/components/FSRadio.vue
CHANGED
|
@@ -34,7 +34,7 @@ export default defineComponent({
|
|
|
34
34
|
required: true,
|
|
35
35
|
default: false
|
|
36
36
|
},
|
|
37
|
-
|
|
37
|
+
modelValue: {
|
|
38
38
|
type: [String, Boolean, Number],
|
|
39
39
|
required: false,
|
|
40
40
|
default: 0
|
|
@@ -50,17 +50,17 @@ export default defineComponent({
|
|
|
50
50
|
default: true
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
emits: ["update:
|
|
53
|
+
emits: ["update:modelValue"],
|
|
54
54
|
setup(props, { emit }) {
|
|
55
|
-
const {
|
|
55
|
+
const { modelValue } = toRefs(props);
|
|
56
56
|
|
|
57
57
|
const isSelected = (item: String | Boolean | Number): boolean => {
|
|
58
|
-
return item ==
|
|
58
|
+
return item == modelValue.value;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
const onToggle = (item: String | Boolean | Number): void => {
|
|
62
|
-
if (item !=
|
|
63
|
-
emit("update:
|
|
62
|
+
if (item != modelValue.value) {
|
|
63
|
+
emit("update:modelValue", item);
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
|