@dative-gpi/foundation-shared-components 0.0.12 → 0.0.14
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 +1 -1
- package/components/FSCalendarTwin.vue +2 -0
- package/components/FSCheckbox.vue +3 -3
- package/components/FSClock.vue +47 -40
- package/components/FSCol.vue +2 -2
- package/components/FSDivider.vue +46 -7
- package/components/FSForm.vue +52 -0
- package/components/FSImage.vue +41 -32
- package/components/FSLabel.vue +105 -0
- package/components/FSPagination.vue +25 -9
- package/components/FSPermissions.vue +0 -0
- package/components/FSRadio.vue +3 -3
- package/components/FSSlideGroup.vue +10 -11
- package/components/FSSubmitDialog.vue +1 -1
- package/components/FSSwitch.vue +3 -3
- package/components/FSText.vue +1 -1
- package/components/FSWrapGroup.vue +10 -11
- package/components/{FSAutocompleteField.vue → fields/FSAutocompleteField.vue} +26 -19
- package/components/fields/FSColorField.vue +205 -0
- package/components/{FSDateField.vue → fields/FSDateField.vue} +15 -50
- package/components/{FSDateRangeField.vue → fields/FSDateRangeField.vue} +17 -67
- package/components/{FSDateTimeField.vue → fields/FSDateTimeField.vue} +17 -52
- package/components/{FSDateTimeRangeField.vue → fields/FSDateTimeRangeField.vue} +45 -81
- package/components/{FSIconField.vue → fields/FSIconField.vue} +16 -55
- package/components/{FSNumberField.vue → fields/FSNumberField.vue} +17 -27
- package/components/{FSPasswordField.vue → fields/FSPasswordField.vue} +5 -29
- package/components/{FSRichTextField.vue → fields/FSRichTextField.vue} +13 -11
- package/components/{FSSearchField.vue → fields/FSSearchField.vue} +1 -1
- package/components/{FSSelectField.vue → fields/FSSelectField.vue} +17 -21
- package/components/{FSTagField.vue → fields/FSTagField.vue} +18 -53
- package/components/{FSTextArea.vue → fields/FSTextArea.vue} +26 -26
- package/components/{FSTextField.vue → fields/FSTextField.vue} +18 -18
- package/components/fields/FSTimeField.vue +202 -0
- package/components/fields/FSTimeSlotField.vue +269 -0
- package/components/lists/FSDataTableUI.vue +10 -12
- package/components/lists/FSFilterButton.vue +1 -1
- package/components/tiles/FSDeviceOrganisationTileUI.vue +4 -9
- package/components/tiles/FSGroupTileUI.vue +4 -9
- package/composables/index.ts +1 -0
- package/composables/useBreakpoints.ts +7 -5
- package/composables/useRules.ts +72 -0
- package/elements/FSFormElement.ts +17 -0
- package/icons/flags/France.vue +9 -0
- package/icons/flags/Germany.vue +7 -0
- package/icons/flags/GreatBritain.vue +9 -0
- package/icons/flags/Italy.vue +9 -0
- package/icons/flags/Portugal.vue +59 -0
- package/icons/flags/Spain.vue +546 -0
- package/icons/flags/UnitedStates.vue +12 -0
- package/icons/sets.ts +17 -0
- package/models/rules.ts +8 -0
- package/package.json +4 -4
- package/styles/components/fs_autocomplete_field.scss +3 -60
- package/styles/components/fs_clock.scss +4 -0
- package/styles/components/fs_color_field.scss +21 -0
- package/styles/components/fs_data_table.scss +7 -2
- package/styles/components/fs_divider.scss +5 -0
- package/styles/components/fs_image.scss +12 -1
- package/styles/components/fs_label.scss +86 -0
- package/styles/components/fs_pagination.scss +3 -3
- package/styles/components/fs_rich_text_field.scss +1 -1
- package/styles/components/fs_select_field.scss +3 -4
- package/styles/components/fs_switch.scss +4 -4
- package/styles/components/fs_text_area.scss +2 -0
- package/styles/components/fs_text_field.scss +1 -0
- package/styles/components/fs_time_field.scss +16 -0
- package/styles/components/fs_timeslot_field.scss +12 -0
- package/styles/components/index.scss +4 -0
- package/styles/globals/overrides.scss +8 -6
- package/styles/globals/text_fonts.scss +18 -0
- package/utils/color.ts +7 -0
- package/utils/css.ts +2 -1
- package/utils/icons.ts +88 -2
- package/utils/index.ts +3 -1
- package/utils/time.ts +29 -0
- package/components/FSHeaderButton.vue +0 -17
- package/components/lists/FSDataIteratorGroup.vue +0 -7
|
@@ -13,45 +13,16 @@
|
|
|
13
13
|
:hideHeader="$props.hideHeader"
|
|
14
14
|
:required="$props.required"
|
|
15
15
|
:editable="$props.editable"
|
|
16
|
-
:error="messages.length > 0"
|
|
17
16
|
:readonly="true"
|
|
17
|
+
:rules="$props.rules"
|
|
18
|
+
:messages="messages"
|
|
19
|
+
:validateOn="validateOn"
|
|
20
|
+
:validationValue="$props.modelValue"
|
|
18
21
|
:modelValue="epochToLongTimeFormat($props.modelValue)"
|
|
19
22
|
@click:clear="onClear"
|
|
23
|
+
@blur="blurred = true"
|
|
20
24
|
v-bind="props"
|
|
21
25
|
>
|
|
22
|
-
<template v-if="!$props.hideHeader" #label>
|
|
23
|
-
<slot name="label">
|
|
24
|
-
<FSRow :wrap="false">
|
|
25
|
-
<FSSpan
|
|
26
|
-
v-if="$props.label"
|
|
27
|
-
class="fs-date-field-label"
|
|
28
|
-
font="text-overline"
|
|
29
|
-
:style="style"
|
|
30
|
-
>
|
|
31
|
-
{{ $props.label }}
|
|
32
|
-
</FSSpan>
|
|
33
|
-
<FSSpan
|
|
34
|
-
v-if="$props.label && $props.required"
|
|
35
|
-
class="fs-date-field-label"
|
|
36
|
-
style="margin-left: -8px;"
|
|
37
|
-
font="text-overline"
|
|
38
|
-
:ellipsis="false"
|
|
39
|
-
:style="style"
|
|
40
|
-
>
|
|
41
|
-
*
|
|
42
|
-
</FSSpan>
|
|
43
|
-
<v-spacer style="min-width: 40px;" />
|
|
44
|
-
<FSSpan
|
|
45
|
-
v-if="messages.length > 0"
|
|
46
|
-
class="fs-date-field-messages"
|
|
47
|
-
font="text-overline"
|
|
48
|
-
:style="style"
|
|
49
|
-
>
|
|
50
|
-
{{ messages.join(", ") }}
|
|
51
|
-
</FSSpan>
|
|
52
|
-
</FSRow>
|
|
53
|
-
</slot>
|
|
54
|
-
</template>
|
|
55
26
|
<template #prepend-inner>
|
|
56
27
|
<slot name="prepend-inner">
|
|
57
28
|
<FSButton
|
|
@@ -71,7 +42,7 @@
|
|
|
71
42
|
:modelValue="tabs"
|
|
72
43
|
>
|
|
73
44
|
<FSCard
|
|
74
|
-
width="
|
|
45
|
+
width="346px"
|
|
75
46
|
:elevation="true"
|
|
76
47
|
:border="false"
|
|
77
48
|
:value="0"
|
|
@@ -115,17 +86,17 @@
|
|
|
115
86
|
<script lang="ts">
|
|
116
87
|
import { computed, defineComponent, PropType, ref, watch } from "vue";
|
|
117
88
|
|
|
89
|
+
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
118
90
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
119
91
|
import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
120
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
121
92
|
|
|
122
93
|
import FSTextField from "./FSTextField.vue";
|
|
123
|
-
import FSCalendar from "
|
|
124
|
-
import FSWindow from "
|
|
125
|
-
import FSButton from "
|
|
126
|
-
import FSClock from "
|
|
127
|
-
import FSCard from "
|
|
128
|
-
import FSCol from "
|
|
94
|
+
import FSCalendar from "../FSCalendar.vue";
|
|
95
|
+
import FSWindow from "../FSWindow.vue";
|
|
96
|
+
import FSButton from "../FSButton.vue";
|
|
97
|
+
import FSClock from "../FSClock.vue";
|
|
98
|
+
import FSCard from "../FSCard.vue";
|
|
99
|
+
import FSCol from "../FSCol.vue";
|
|
129
100
|
|
|
130
101
|
export default defineComponent({
|
|
131
102
|
name: "FSDateTimeField",
|
|
@@ -183,6 +154,7 @@ export default defineComponent({
|
|
|
183
154
|
emits: ["update:modelValue"],
|
|
184
155
|
setup(props, { emit }) {
|
|
185
156
|
const { getUserOffsetMillis, epochToLongTimeFormat } = useTimeZone();
|
|
157
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
186
158
|
const { getColors } = useColors();
|
|
187
159
|
|
|
188
160
|
const errors = getColors(ColorEnum.Error);
|
|
@@ -213,16 +185,7 @@ export default defineComponent({
|
|
|
213
185
|
};
|
|
214
186
|
});
|
|
215
187
|
|
|
216
|
-
const messages = computed((): string[] =>
|
|
217
|
-
const messages = [];
|
|
218
|
-
for (const rule of props.rules) {
|
|
219
|
-
const message = rule(props.modelValue ?? null);
|
|
220
|
-
if (typeof(message) === "string") {
|
|
221
|
-
messages.push(message);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
return messages;
|
|
225
|
-
});
|
|
188
|
+
const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
|
|
226
189
|
|
|
227
190
|
const onClear = (): void => {
|
|
228
191
|
emit("update:modelValue", null);
|
|
@@ -245,7 +208,9 @@ export default defineComponent({
|
|
|
245
208
|
ColorEnum,
|
|
246
209
|
innerDate,
|
|
247
210
|
innerTime,
|
|
211
|
+
validateOn,
|
|
248
212
|
messages,
|
|
213
|
+
blurred,
|
|
249
214
|
style,
|
|
250
215
|
menu,
|
|
251
216
|
tabs,
|
|
@@ -7,45 +7,16 @@
|
|
|
7
7
|
:hideHeader="$props.hideHeader"
|
|
8
8
|
:required="$props.required"
|
|
9
9
|
:editable="$props.editable"
|
|
10
|
-
:error="messages.length > 0"
|
|
11
10
|
:readonly="true"
|
|
12
|
-
:
|
|
11
|
+
:rules="$props.rules"
|
|
12
|
+
:messages="messages"
|
|
13
|
+
:validateOn="validateOn"
|
|
14
|
+
:validationValue="$props.modelValue"
|
|
15
|
+
:modelValue="toShortTimeFormat"
|
|
13
16
|
@click="onClick"
|
|
14
17
|
@click:clear="onClear"
|
|
18
|
+
@blur="blurred = true"
|
|
15
19
|
>
|
|
16
|
-
<template v-if="!$props.hideHeader" #label>
|
|
17
|
-
<slot name="label">
|
|
18
|
-
<FSRow :wrap="false">
|
|
19
|
-
<FSSpan
|
|
20
|
-
v-if="$props.label"
|
|
21
|
-
class="fs-date-field-label"
|
|
22
|
-
font="text-overline"
|
|
23
|
-
:style="style"
|
|
24
|
-
>
|
|
25
|
-
{{ $props.label }}
|
|
26
|
-
</FSSpan>
|
|
27
|
-
<FSSpan
|
|
28
|
-
v-if="$props.label && $props.required"
|
|
29
|
-
class="fs-date-field-label"
|
|
30
|
-
style="margin-left: -8px;"
|
|
31
|
-
font="text-overline"
|
|
32
|
-
:ellipsis="false"
|
|
33
|
-
:style="style"
|
|
34
|
-
>
|
|
35
|
-
*
|
|
36
|
-
</FSSpan>
|
|
37
|
-
<v-spacer style="min-width: 40px;" />
|
|
38
|
-
<FSSpan
|
|
39
|
-
v-if="messages.length > 0"
|
|
40
|
-
class="fs-date-field-messages"
|
|
41
|
-
font="text-overline"
|
|
42
|
-
:style="style"
|
|
43
|
-
>
|
|
44
|
-
{{ messages.join(", ") }}
|
|
45
|
-
</FSSpan>
|
|
46
|
-
</FSRow>
|
|
47
|
-
</slot>
|
|
48
|
-
</template>
|
|
49
20
|
<template #prepend-inner>
|
|
50
21
|
<slot name="prepend-inner">
|
|
51
22
|
<FSButton
|
|
@@ -72,19 +43,29 @@
|
|
|
72
43
|
:color="$props.color"
|
|
73
44
|
v-model="innerDateRange"
|
|
74
45
|
/>
|
|
75
|
-
<FSRow
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
46
|
+
<FSRow
|
|
47
|
+
width="100%"
|
|
48
|
+
>
|
|
49
|
+
<FSCol
|
|
50
|
+
width="calc(50% - 4px)"
|
|
51
|
+
>
|
|
52
|
+
<FSClock
|
|
53
|
+
:reminder="true"
|
|
54
|
+
:color="$props.color"
|
|
55
|
+
:date="innerDateLeft"
|
|
56
|
+
v-model="innerTimeLeft"
|
|
57
|
+
/>
|
|
58
|
+
</FSCol>
|
|
59
|
+
<FSCol
|
|
60
|
+
width="calc(50% - 4px)"
|
|
61
|
+
>
|
|
62
|
+
<FSClock
|
|
63
|
+
:reminder="true"
|
|
64
|
+
:color="$props.color"
|
|
65
|
+
:date="innerDateRight"
|
|
66
|
+
v-model="innerTimeRight"
|
|
67
|
+
/>
|
|
68
|
+
</FSCol>
|
|
88
69
|
</FSRow>
|
|
89
70
|
</FSCol>
|
|
90
71
|
</template>
|
|
@@ -94,17 +75,17 @@
|
|
|
94
75
|
<script lang="ts">
|
|
95
76
|
import { computed, defineComponent, PropType, ref } from "vue";
|
|
96
77
|
|
|
78
|
+
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
97
79
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
98
80
|
import { useTimeZone } from "@dative-gpi/foundation-shared-services/composables";
|
|
99
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
100
81
|
|
|
101
|
-
import FSSubmitDialog from "
|
|
102
|
-
import FSCalendarTwin from "
|
|
82
|
+
import FSSubmitDialog from "../FSSubmitDialog.vue";
|
|
83
|
+
import FSCalendarTwin from "../FSCalendarTwin.vue";
|
|
103
84
|
import FSTextField from "./FSTextField.vue";
|
|
104
|
-
import FSButton from "
|
|
105
|
-
import FSClock from "
|
|
106
|
-
import
|
|
107
|
-
import
|
|
85
|
+
import FSButton from "../FSButton.vue";
|
|
86
|
+
import FSClock from "../FSClock.vue";
|
|
87
|
+
import FSCol from "../FSCol.vue";
|
|
88
|
+
import FSRow from "../FSRow.vue";
|
|
108
89
|
|
|
109
90
|
export default defineComponent({
|
|
110
91
|
name: "FSDateTimeRangeField",
|
|
@@ -114,8 +95,8 @@ export default defineComponent({
|
|
|
114
95
|
FSTextField,
|
|
115
96
|
FSButton,
|
|
116
97
|
FSClock,
|
|
117
|
-
|
|
118
|
-
|
|
98
|
+
FSCol,
|
|
99
|
+
FSRow
|
|
119
100
|
},
|
|
120
101
|
props: {
|
|
121
102
|
label: {
|
|
@@ -162,6 +143,7 @@ export default defineComponent({
|
|
|
162
143
|
emits: ["update:modelValue"],
|
|
163
144
|
setup(props, { emit }) {
|
|
164
145
|
const { getUserOffsetMillis, epochToShortTimeFormat } = useTimeZone();
|
|
146
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
165
147
|
const { getColors } = useColors();
|
|
166
148
|
|
|
167
149
|
const errors = getColors(ColorEnum.Error);
|
|
@@ -204,35 +186,13 @@ export default defineComponent({
|
|
|
204
186
|
};
|
|
205
187
|
});
|
|
206
188
|
|
|
207
|
-
const
|
|
189
|
+
const toShortTimeFormat = computed((): string => {
|
|
208
190
|
if (!props.modelValue || !Array.isArray(props.modelValue) || !props.modelValue.length) {
|
|
209
191
|
return "";
|
|
210
192
|
}
|
|
211
193
|
return props.modelValue.map((epoch) => epochToShortTimeFormat(epoch)).join(" - ");
|
|
212
194
|
});
|
|
213
195
|
|
|
214
|
-
const messages = computed((): string[] => {
|
|
215
|
-
const messages = [];
|
|
216
|
-
for (const rule of props.rules) {
|
|
217
|
-
if (props.modelValue && Array.isArray(props.modelValue)) {
|
|
218
|
-
for (const value of props.modelValue) {
|
|
219
|
-
const message = rule(value);
|
|
220
|
-
if (typeof(message) === "string") {
|
|
221
|
-
messages.push(message);
|
|
222
|
-
break;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
else {
|
|
227
|
-
const message = rule(null);
|
|
228
|
-
if (typeof(message) === "string") {
|
|
229
|
-
messages.push(message);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
return messages;
|
|
234
|
-
});
|
|
235
|
-
|
|
236
196
|
const innerDateLeft = computed((): number | null => {
|
|
237
197
|
if (innerDateRange.value && Array.isArray(innerDateRange.value) && innerDateRange.value.length) {
|
|
238
198
|
return innerDateRange.value[0];
|
|
@@ -247,6 +207,8 @@ export default defineComponent({
|
|
|
247
207
|
return null;
|
|
248
208
|
});
|
|
249
209
|
|
|
210
|
+
const messages = computed((): string[] => getMessages(props.modelValue, props.rules, true));
|
|
211
|
+
|
|
250
212
|
const onClick = (): void => {
|
|
251
213
|
if (props.editable) {
|
|
252
214
|
dialog.value = true;
|
|
@@ -269,10 +231,12 @@ export default defineComponent({
|
|
|
269
231
|
|
|
270
232
|
return {
|
|
271
233
|
ColorEnum,
|
|
234
|
+
validateOn,
|
|
272
235
|
messages,
|
|
236
|
+
blurred,
|
|
273
237
|
style,
|
|
274
238
|
dialog,
|
|
275
|
-
|
|
239
|
+
toShortTimeFormat,
|
|
276
240
|
innerDateLeft,
|
|
277
241
|
innerTimeLeft,
|
|
278
242
|
innerDateRight,
|
|
@@ -6,43 +6,14 @@
|
|
|
6
6
|
:hideHeader="$props.hideHeader"
|
|
7
7
|
:required="$props.required"
|
|
8
8
|
:editable="$props.editable"
|
|
9
|
-
:
|
|
9
|
+
:rules="$props.rules"
|
|
10
|
+
:messages="messages"
|
|
11
|
+
:validateOn="validateOn"
|
|
12
|
+
:validationValue="$props.modelValue"
|
|
13
|
+
@blur="blurred = true"
|
|
10
14
|
v-model="innerValue"
|
|
11
15
|
v-bind="$attrs"
|
|
12
16
|
>
|
|
13
|
-
<template v-if="!$props.hideHeader" #label>
|
|
14
|
-
<slot name="label">
|
|
15
|
-
<FSRow :wrap="false">
|
|
16
|
-
<FSSpan
|
|
17
|
-
v-if="$props.label"
|
|
18
|
-
class="fs-icon-field-label"
|
|
19
|
-
font="text-overline"
|
|
20
|
-
:style="style"
|
|
21
|
-
>
|
|
22
|
-
{{ $props.label }}
|
|
23
|
-
</FSSpan>
|
|
24
|
-
<FSSpan
|
|
25
|
-
v-if="$props.label && $props.required"
|
|
26
|
-
class="fs-icon-field-label"
|
|
27
|
-
style="margin-left: -8px;"
|
|
28
|
-
font="text-overline"
|
|
29
|
-
:ellipsis="false"
|
|
30
|
-
:style="style"
|
|
31
|
-
>
|
|
32
|
-
*
|
|
33
|
-
</FSSpan>
|
|
34
|
-
<v-spacer style="min-width: 40px;" />
|
|
35
|
-
<FSSpan
|
|
36
|
-
v-if="messages.length > 0"
|
|
37
|
-
class="fs-icon-field-messages"
|
|
38
|
-
font="text-overline"
|
|
39
|
-
:style="style"
|
|
40
|
-
>
|
|
41
|
-
{{ messages.join(", ") }}
|
|
42
|
-
</FSSpan>
|
|
43
|
-
</FSRow>
|
|
44
|
-
</slot>
|
|
45
|
-
</template>
|
|
46
17
|
<template #append-inner>
|
|
47
18
|
<FSIcon
|
|
48
19
|
v-if="$props.modelValue"
|
|
@@ -70,20 +41,20 @@
|
|
|
70
41
|
import { computed, defineComponent, PropType, ref } from "vue";
|
|
71
42
|
|
|
72
43
|
import { Icons, sortByLevenshteinDistance } from "@dative-gpi/foundation-shared-components/utils";
|
|
44
|
+
import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
73
45
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
74
|
-
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
75
46
|
import { FSToggle } from "@dative-gpi/foundation-shared-components/models";
|
|
76
47
|
|
|
48
|
+
import FSToggleSet from "../FSToggleSet.vue";
|
|
77
49
|
import FSTextField from "./FSTextField.vue";
|
|
78
|
-
import
|
|
79
|
-
import
|
|
80
|
-
import FSCol from "./FSCol.vue";
|
|
50
|
+
import FSIcon from "../FSIcon.vue";
|
|
51
|
+
import FSCol from "../FSCol.vue";
|
|
81
52
|
|
|
82
53
|
export default defineComponent({
|
|
83
54
|
name: "FSIconField",
|
|
84
55
|
components: {
|
|
85
|
-
FSTextField,
|
|
86
56
|
FSToggleSet,
|
|
57
|
+
FSTextField,
|
|
87
58
|
FSIcon,
|
|
88
59
|
FSCol,
|
|
89
60
|
},
|
|
@@ -151,6 +122,7 @@ export default defineComponent({
|
|
|
151
122
|
},
|
|
152
123
|
emits: ["update:modelValue"],
|
|
153
124
|
setup(props) {
|
|
125
|
+
const {validateOn, blurred, getMessages} = useRules();
|
|
154
126
|
const { getColors } = useColors();
|
|
155
127
|
|
|
156
128
|
const errors = getColors(ColorEnum.Error);
|
|
@@ -171,17 +143,6 @@ export default defineComponent({
|
|
|
171
143
|
};
|
|
172
144
|
});
|
|
173
145
|
|
|
174
|
-
const messages = computed((): string[] => {
|
|
175
|
-
const messages = [];
|
|
176
|
-
for (const rule of props.rules) {
|
|
177
|
-
const message = rule(props.modelValue);
|
|
178
|
-
if (typeof(message) === "string") {
|
|
179
|
-
messages.push(message);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return messages;
|
|
183
|
-
});
|
|
184
|
-
|
|
185
146
|
const icons = computed((): FSToggle[] => {
|
|
186
147
|
const innerIcons: FSToggle[] = [];
|
|
187
148
|
if (!innerValue.value || innerValue.value.length < 3) {
|
|
@@ -209,11 +170,7 @@ export default defineComponent({
|
|
|
209
170
|
}
|
|
210
171
|
if (props.modelValue) {
|
|
211
172
|
const selectedIcon = innerIcons.find((icon) => icon.id === props.modelValue);
|
|
212
|
-
if (selectedIcon) {
|
|
213
|
-
innerIcons.splice(innerIcons.indexOf(selectedIcon), 1);
|
|
214
|
-
innerIcons.unshift(selectedIcon);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
173
|
+
if (!selectedIcon) {
|
|
217
174
|
innerIcons.unshift({
|
|
218
175
|
id: props.modelValue,
|
|
219
176
|
prependIcon: props.modelValue
|
|
@@ -223,9 +180,13 @@ export default defineComponent({
|
|
|
223
180
|
return innerIcons;
|
|
224
181
|
});
|
|
225
182
|
|
|
183
|
+
const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
|
|
184
|
+
|
|
226
185
|
return {
|
|
227
186
|
innerValue,
|
|
187
|
+
validateOn,
|
|
228
188
|
messages,
|
|
189
|
+
blurred,
|
|
229
190
|
style,
|
|
230
191
|
icons
|
|
231
192
|
};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTextField
|
|
3
|
-
type="number"
|
|
4
|
-
:label="$props.label"
|
|
5
|
-
:description="$props.description"
|
|
6
|
-
:hideHeader="$props.hideHeader"
|
|
7
|
-
:required="$props.required"
|
|
8
3
|
:editable="$props.editable"
|
|
9
4
|
:modelValue="$props.modelValue?.toString()"
|
|
10
|
-
@update:modelValue="
|
|
5
|
+
@update:modelValue="onUpdate"
|
|
11
6
|
v-bind="$attrs"
|
|
12
7
|
>
|
|
13
8
|
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
@@ -27,37 +22,32 @@ export default defineComponent({
|
|
|
27
22
|
FSTextField
|
|
28
23
|
},
|
|
29
24
|
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
25
|
modelValue: {
|
|
41
26
|
type: Number,
|
|
42
27
|
required: false,
|
|
43
28
|
default: null
|
|
44
29
|
},
|
|
45
|
-
hideHeader: {
|
|
46
|
-
type: Boolean,
|
|
47
|
-
required: false,
|
|
48
|
-
default: false
|
|
49
|
-
},
|
|
50
|
-
required: {
|
|
51
|
-
type: Boolean,
|
|
52
|
-
required: false,
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
30
|
editable: {
|
|
56
31
|
type: Boolean,
|
|
57
32
|
required: false,
|
|
58
33
|
default: true
|
|
59
34
|
}
|
|
60
35
|
},
|
|
61
|
-
emits: ["update:modelValue"]
|
|
36
|
+
emits: ["update:modelValue"],
|
|
37
|
+
setup(_, { emit }) {
|
|
38
|
+
const onUpdate = (value: string) => {
|
|
39
|
+
const match = /([0-9 ]*[,\.]?)?[0-9]+/.exec(value);
|
|
40
|
+
if (match && !isNaN(parseFloat(match[0].replace(",", ".").replace(" ", "")))) {
|
|
41
|
+
emit("update:modelValue", parseFloat(match[0].replace(",", ".").replace(" ", "")));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
emit("update:modelValue", 0);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
onUpdate
|
|
50
|
+
};
|
|
51
|
+
}
|
|
62
52
|
});
|
|
63
53
|
</script>
|
|
@@ -1,29 +1,25 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSTextField
|
|
3
|
-
:label="$props.label"
|
|
4
|
-
:description="$props.description"
|
|
5
3
|
:type="type"
|
|
6
|
-
:hideHeader="$props.hideHeader"
|
|
7
|
-
:required="$props.required"
|
|
8
4
|
:editable="$props.editable"
|
|
9
5
|
:modelValue="$props.modelValue"
|
|
10
6
|
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
11
7
|
v-bind="$attrs"
|
|
12
8
|
>
|
|
9
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
10
|
+
<slot :name="name" v-bind="slotData" />
|
|
11
|
+
</template>
|
|
13
12
|
<template #append-inner>
|
|
14
13
|
<slot name="append-inner">
|
|
15
14
|
<FSButton
|
|
16
15
|
variant="icon"
|
|
17
|
-
:icon="icon"
|
|
18
16
|
:editable="$props.editable"
|
|
19
17
|
:color="ColorEnum.Dark"
|
|
18
|
+
:icon="icon"
|
|
20
19
|
@click="onToggle"
|
|
21
20
|
/>
|
|
22
21
|
</slot>
|
|
23
22
|
</template>
|
|
24
|
-
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
25
|
-
<slot :name="name" v-bind="slotData" />
|
|
26
|
-
</template>
|
|
27
23
|
</FSTextField>
|
|
28
24
|
</template>
|
|
29
25
|
|
|
@@ -34,7 +30,7 @@ import { useColors } from "@dative-gpi/foundation-shared-components/composables"
|
|
|
34
30
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
35
31
|
|
|
36
32
|
import FSTextField from "./FSTextField.vue";
|
|
37
|
-
import FSButton from "
|
|
33
|
+
import FSButton from "../FSButton.vue";
|
|
38
34
|
|
|
39
35
|
export default defineComponent({
|
|
40
36
|
name: "FSPasswordField",
|
|
@@ -43,31 +39,11 @@ export default defineComponent({
|
|
|
43
39
|
FSButton
|
|
44
40
|
},
|
|
45
41
|
props: {
|
|
46
|
-
label: {
|
|
47
|
-
type: String,
|
|
48
|
-
required: false,
|
|
49
|
-
default: null
|
|
50
|
-
},
|
|
51
|
-
description: {
|
|
52
|
-
type: String,
|
|
53
|
-
required: false,
|
|
54
|
-
default: null
|
|
55
|
-
},
|
|
56
42
|
modelValue: {
|
|
57
43
|
type: String,
|
|
58
44
|
required: false,
|
|
59
45
|
default: null
|
|
60
46
|
},
|
|
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
47
|
editable: {
|
|
72
48
|
type: Boolean,
|
|
73
49
|
required: false,
|
|
@@ -172,9 +172,9 @@ import { getAncestor, getSelectedNode } from "@dative-gpi/foundation-shared-comp
|
|
|
172
172
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
173
173
|
|
|
174
174
|
import FSTextField from "./FSTextField.vue";
|
|
175
|
-
import FSIcon from "
|
|
176
|
-
import FSCol from "
|
|
177
|
-
import FSRow from "
|
|
175
|
+
import FSIcon from "../FSIcon.vue";
|
|
176
|
+
import FSCol from "../FSCol.vue";
|
|
177
|
+
import FSRow from "../FSRow.vue";
|
|
178
178
|
|
|
179
179
|
export default defineComponent({
|
|
180
180
|
name: "FSRichTextField",
|
|
@@ -292,14 +292,16 @@ export default defineComponent({
|
|
|
292
292
|
});
|
|
293
293
|
|
|
294
294
|
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
295
|
-
let minHeight: string | undefined =
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
295
|
+
let minHeight: string | undefined = "auto";
|
|
296
|
+
if (!readonly.value) {
|
|
297
|
+
const base = isMobileSized.value ? 30 : 42;
|
|
298
|
+
const row = isMobileSized.value ? 16 : 20;
|
|
299
|
+
if (props.rows > 1) {
|
|
300
|
+
minHeight = `${base + (props.rows - 1) * row}px`;
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
minHeight = `${base}px`;
|
|
304
|
+
}
|
|
303
305
|
}
|
|
304
306
|
|
|
305
307
|
switch (props.variant) {
|
|
@@ -48,7 +48,7 @@ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui
|
|
|
48
48
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
49
49
|
|
|
50
50
|
import FSTextField from "./FSTextField.vue";
|
|
51
|
-
import FSButton from "
|
|
51
|
+
import FSButton from "../FSButton.vue";
|
|
52
52
|
|
|
53
53
|
export default defineComponent({
|
|
54
54
|
name: "FSSearchField",
|