@dative-gpi/foundation-shared-components 0.0.12 → 0.0.13
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/FSCheckbox.vue +3 -3
- package/components/FSClock.vue +45 -30
- 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/FSSubmitDialog.vue +1 -1
- package/components/FSSwitch.vue +3 -3
- package/components/FSText.vue +1 -1
- package/components/{FSAutocompleteField.vue → fields/FSAutocompleteField.vue} +18 -17
- package/components/fields/FSColorField.vue +194 -0
- package/components/{FSDateField.vue → fields/FSDateField.vue} +14 -49
- package/components/{FSDateRangeField.vue → fields/FSDateRangeField.vue} +18 -64
- package/components/{FSDateTimeField.vue → fields/FSDateTimeField.vue} +16 -51
- package/components/{FSDateTimeRangeField.vue → fields/FSDateTimeRangeField.vue} +23 -67
- package/components/{FSIconField.vue → fields/FSIconField.vue} +15 -50
- package/components/{FSNumberField.vue → fields/FSNumberField.vue} +0 -24
- package/components/{FSPasswordField.vue → fields/FSPasswordField.vue} +5 -29
- package/components/{FSRichTextField.vue → fields/FSRichTextField.vue} +3 -3
- 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} +15 -50
- package/components/{FSTextArea.vue → fields/FSTextArea.vue} +24 -24
- package/components/{FSTextField.vue → fields/FSTextField.vue} +18 -18
- package/components/fields/FSTimeField.vue +104 -0
- package/components/fields/FSTimeSlotField.vue +263 -0
- package/components/lists/FSDataTableUI.vue +2 -2
- 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/pages/FSExternalIdentityButton.vue +64 -0
- package/pages/FSLanguageSetter.vue +140 -0
- package/pages/FSLoginPage.vue +253 -0
- package/styles/components/fs_clock.scss +4 -0
- package/styles/components/fs_color_field.scss +17 -0
- 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_time_field.scss +3 -0
- package/styles/components/fs_timeslot_field.scss +75 -0
- package/styles/components/index.scss +4 -0
- package/styles/globals/text_fonts.scss +18 -0
- package/styles/main.scss +3 -1
- package/styles/pages/fs_language_setter.scss +55 -0
- package/styles/pages/index.scss +1 -0
- package/utils/color.ts +7 -0
- package/utils/css.ts +2 -1
- 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
|
@@ -36,17 +36,19 @@
|
|
|
36
36
|
<v-textarea
|
|
37
37
|
clearIcon="mdi-close"
|
|
38
38
|
variant="outlined"
|
|
39
|
-
hide-details
|
|
40
39
|
:style="style"
|
|
41
40
|
:class="classes"
|
|
42
41
|
:rows="$props.rows"
|
|
43
|
-
:
|
|
42
|
+
:hideDetails="true"
|
|
44
43
|
:noResize="!$props.resize"
|
|
45
44
|
:autoGrow="$props.autoGrow"
|
|
46
45
|
:readonly="!$props.editable"
|
|
47
|
-
:clearable="$props.editable"
|
|
46
|
+
:clearable="$props.editable && !!$props.modelValue"
|
|
47
|
+
:rules="$props.rules"
|
|
48
|
+
:validateOn="validateOn"
|
|
48
49
|
:modelValue="$props.modelValue"
|
|
49
50
|
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
51
|
+
@blur="blurred = true"
|
|
50
52
|
v-bind="$attrs"
|
|
51
53
|
>
|
|
52
54
|
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
@@ -69,12 +71,12 @@
|
|
|
69
71
|
<script lang="ts">
|
|
70
72
|
import { computed, defineComponent, PropType } from "vue";
|
|
71
73
|
|
|
72
|
-
import { useColors, useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
|
|
74
|
+
import { useColors, useBreakpoints, useRules } from "@dative-gpi/foundation-shared-components/composables";
|
|
73
75
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
74
76
|
|
|
75
|
-
import FSSpan from "
|
|
76
|
-
import FSCol from "
|
|
77
|
-
import FSRow from "
|
|
77
|
+
import FSSpan from "../FSSpan.vue";
|
|
78
|
+
import FSCol from "../FSCol.vue";
|
|
79
|
+
import FSRow from "../FSRow.vue";
|
|
78
80
|
|
|
79
81
|
export default defineComponent({
|
|
80
82
|
name: "FSTextArea",
|
|
@@ -83,7 +85,6 @@ export default defineComponent({
|
|
|
83
85
|
FSCol,
|
|
84
86
|
FSRow
|
|
85
87
|
},
|
|
86
|
-
inheritAttrs: false,
|
|
87
88
|
props: {
|
|
88
89
|
label: {
|
|
89
90
|
type: String,
|
|
@@ -100,11 +101,6 @@ export default defineComponent({
|
|
|
100
101
|
required: false,
|
|
101
102
|
default: null
|
|
102
103
|
},
|
|
103
|
-
required: {
|
|
104
|
-
type: Boolean,
|
|
105
|
-
required: false,
|
|
106
|
-
default: false
|
|
107
|
-
},
|
|
108
104
|
rows: {
|
|
109
105
|
type: Number,
|
|
110
106
|
required: false,
|
|
@@ -125,11 +121,21 @@ export default defineComponent({
|
|
|
125
121
|
required: false,
|
|
126
122
|
default: false
|
|
127
123
|
},
|
|
124
|
+
required: {
|
|
125
|
+
type: Boolean,
|
|
126
|
+
required: false,
|
|
127
|
+
default: false
|
|
128
|
+
},
|
|
128
129
|
rules: {
|
|
129
130
|
type: Array as PropType<Function[]>,
|
|
130
131
|
required: false,
|
|
131
132
|
default: () => []
|
|
132
133
|
},
|
|
134
|
+
messages: {
|
|
135
|
+
type: Array as PropType<string[]>,
|
|
136
|
+
required: false,
|
|
137
|
+
default: null
|
|
138
|
+
},
|
|
133
139
|
editable: {
|
|
134
140
|
type: Boolean,
|
|
135
141
|
required: false,
|
|
@@ -138,6 +144,7 @@ export default defineComponent({
|
|
|
138
144
|
},
|
|
139
145
|
emits: ["update:modelValue"],
|
|
140
146
|
setup(props) {
|
|
147
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
141
148
|
const { isMobileSized } = useBreakpoints();
|
|
142
149
|
const { getColors } = useColors();
|
|
143
150
|
|
|
@@ -181,17 +188,6 @@ export default defineComponent({
|
|
|
181
188
|
};
|
|
182
189
|
});
|
|
183
190
|
|
|
184
|
-
const messages = computed(() => {
|
|
185
|
-
const messages = [];
|
|
186
|
-
for (const rule of props.rules) {
|
|
187
|
-
const message = rule(props.modelValue);
|
|
188
|
-
if (typeof(message) === "string") {
|
|
189
|
-
messages.push(message);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return messages;
|
|
193
|
-
});
|
|
194
|
-
|
|
195
191
|
const classes = computed((): string[] => {
|
|
196
192
|
const classNames = ["fs-text-area"];
|
|
197
193
|
if (props.autoGrow) {
|
|
@@ -200,8 +196,12 @@ export default defineComponent({
|
|
|
200
196
|
return classNames;
|
|
201
197
|
});
|
|
202
198
|
|
|
199
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
200
|
+
|
|
203
201
|
return {
|
|
202
|
+
validateOn,
|
|
204
203
|
messages,
|
|
204
|
+
blurred,
|
|
205
205
|
style,
|
|
206
206
|
classes
|
|
207
207
|
};
|
|
@@ -35,14 +35,16 @@
|
|
|
35
35
|
class="fs-text-field"
|
|
36
36
|
clearIcon="mdi-close"
|
|
37
37
|
variant="outlined"
|
|
38
|
-
hide-details
|
|
39
38
|
:style="style"
|
|
40
39
|
:type="$props.type"
|
|
41
|
-
:
|
|
40
|
+
:hideDetails="true"
|
|
42
41
|
:readonly="!$props.editable"
|
|
43
|
-
:clearable="$props.editable"
|
|
42
|
+
:clearable="$props.editable && !!$props.modelValue"
|
|
43
|
+
:rules="$props.rules"
|
|
44
|
+
:validateOn="validateOn"
|
|
44
45
|
:modelValue="$props.modelValue"
|
|
45
46
|
@update:modelValue="(value) => $emit('update:modelValue', value)"
|
|
47
|
+
@blur="blurred = true"
|
|
46
48
|
v-bind="$attrs"
|
|
47
49
|
>
|
|
48
50
|
<template v-for="(_, name) in slots" v-slot:[name]="slotData">
|
|
@@ -65,12 +67,12 @@
|
|
|
65
67
|
<script lang="ts">
|
|
66
68
|
import { computed, defineComponent, PropType } from "vue";
|
|
67
69
|
|
|
68
|
-
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
70
|
+
import { useColors, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
69
71
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
70
72
|
|
|
71
|
-
import FSSpan from "
|
|
72
|
-
import FSCol from "
|
|
73
|
-
import FSRow from "
|
|
73
|
+
import FSSpan from "../FSSpan.vue";
|
|
74
|
+
import FSCol from "../FSCol.vue";
|
|
75
|
+
import FSRow from "../FSRow.vue";
|
|
74
76
|
|
|
75
77
|
export default defineComponent({
|
|
76
78
|
name: "FSTextField",
|
|
@@ -79,7 +81,6 @@ export default defineComponent({
|
|
|
79
81
|
FSCol,
|
|
80
82
|
FSRow
|
|
81
83
|
},
|
|
82
|
-
inheritAttrs: false,
|
|
83
84
|
props: {
|
|
84
85
|
label: {
|
|
85
86
|
type: String,
|
|
@@ -116,6 +117,11 @@ export default defineComponent({
|
|
|
116
117
|
required: false,
|
|
117
118
|
default: () => []
|
|
118
119
|
},
|
|
120
|
+
messages: {
|
|
121
|
+
type: Array as PropType<string[]>,
|
|
122
|
+
required: false,
|
|
123
|
+
default: null
|
|
124
|
+
},
|
|
119
125
|
editable: {
|
|
120
126
|
type: Boolean,
|
|
121
127
|
required: false,
|
|
@@ -124,6 +130,7 @@ export default defineComponent({
|
|
|
124
130
|
},
|
|
125
131
|
emits: ["update:modelValue"],
|
|
126
132
|
setup(props) {
|
|
133
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
127
134
|
const { getColors } = useColors();
|
|
128
135
|
const { slots } = useSlots();
|
|
129
136
|
|
|
@@ -153,19 +160,12 @@ export default defineComponent({
|
|
|
153
160
|
};
|
|
154
161
|
});
|
|
155
162
|
|
|
156
|
-
const messages = computed((): string[] =>
|
|
157
|
-
const messages = [];
|
|
158
|
-
for (const rule of props.rules) {
|
|
159
|
-
const message = rule(props.modelValue ?? "");
|
|
160
|
-
if (typeof(message) === "string") {
|
|
161
|
-
messages.push(message);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return messages;
|
|
165
|
-
});
|
|
163
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
166
164
|
|
|
167
165
|
return {
|
|
166
|
+
validateOn,
|
|
168
167
|
messages,
|
|
168
|
+
blurred,
|
|
169
169
|
slots,
|
|
170
170
|
style
|
|
171
171
|
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSNumberField
|
|
3
|
+
class="fs-time-field"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
:modelValue="innerTime"
|
|
6
|
+
@update:modelValue="onSubmitValue"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<template #append>
|
|
10
|
+
<FSSelectField
|
|
11
|
+
class="fs-time-field-select"
|
|
12
|
+
:editable="$props.editable"
|
|
13
|
+
:hideHeader="true"
|
|
14
|
+
:clearable="false"
|
|
15
|
+
:items="timeScale"
|
|
16
|
+
:modelValue="selectedUnit.id"
|
|
17
|
+
@update:modelValue="onSubmitTimeScale"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
</FSNumberField>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script lang="ts">
|
|
24
|
+
import { computed, defineComponent, ref } from "vue";
|
|
25
|
+
|
|
26
|
+
import { getTimeScaleIndex, timeScale } from "@dative-gpi/foundation-shared-components/utils";
|
|
27
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
28
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
29
|
+
|
|
30
|
+
import FSNumberField from "./FSNumberField.vue";
|
|
31
|
+
import FSSelectField from "./FSSelectField.vue";
|
|
32
|
+
|
|
33
|
+
export default defineComponent({
|
|
34
|
+
name: "FSTimeField",
|
|
35
|
+
components: {
|
|
36
|
+
FSNumberField,
|
|
37
|
+
FSSelectField
|
|
38
|
+
},
|
|
39
|
+
props: {
|
|
40
|
+
modelValue: {
|
|
41
|
+
type: Number,
|
|
42
|
+
required: false,
|
|
43
|
+
default: null
|
|
44
|
+
},
|
|
45
|
+
editable: {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
required: false,
|
|
48
|
+
default: true
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
emits: ["update:modelValue"],
|
|
52
|
+
setup(props, { emit }) {
|
|
53
|
+
const innerTime = ref(props.modelValue);
|
|
54
|
+
const selectedUnit = ref(timeScale[0]);
|
|
55
|
+
|
|
56
|
+
if (getTimeScaleIndex(props.modelValue) !== 0) {
|
|
57
|
+
selectedUnit.value = timeScale[getTimeScaleIndex(props.modelValue)];
|
|
58
|
+
innerTime.value = props.modelValue / selectedUnit.value.id;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const errors = useColors().getColors(ColorEnum.Error);
|
|
62
|
+
const lights = useColors().getColors(ColorEnum.Light);
|
|
63
|
+
const darks = useColors().getColors(ColorEnum.Dark);
|
|
64
|
+
|
|
65
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
66
|
+
if (!props.editable) {
|
|
67
|
+
return {
|
|
68
|
+
"--fs-time-field-cursor" : "default",
|
|
69
|
+
"--fs-time-field-border-color" : lights.base,
|
|
70
|
+
"--fs-time-field-color" : lights.dark,
|
|
71
|
+
"--fs-time-field-active-border-color": lights.base
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
"--fs-time-field-cursor" : "text",
|
|
76
|
+
"--fs-time-field-border-color" : lights.dark,
|
|
77
|
+
"--fs-time-field-color" : darks.base,
|
|
78
|
+
"--fs-time-field-active-border-color": darks.dark,
|
|
79
|
+
"--fs-time-field-error-color" : errors.base,
|
|
80
|
+
"--fs-time-field-error-border-color" : errors.base
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const onSubmitValue = (value: number): void => {
|
|
85
|
+
innerTime.value = value;
|
|
86
|
+
emit("update:modelValue", innerTime.value * selectedUnit.value.id);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const onSubmitTimeScale = (value: number): void => {
|
|
90
|
+
selectedUnit.value = timeScale.find((item) => item.id === value);
|
|
91
|
+
emit("update:modelValue", innerTime.value * selectedUnit.value.id);
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
return {
|
|
95
|
+
style,
|
|
96
|
+
innerTime,
|
|
97
|
+
selectedUnit,
|
|
98
|
+
timeScale,
|
|
99
|
+
onSubmitValue,
|
|
100
|
+
onSubmitTimeScale,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCol>
|
|
3
|
+
<slot v-if="!$props.hideHeader" name="label">
|
|
4
|
+
<FSRow :wrap="false">
|
|
5
|
+
<FSSpan
|
|
6
|
+
v-if="$props.label"
|
|
7
|
+
class="fs-time-slot-field-label"
|
|
8
|
+
font="text-overline"
|
|
9
|
+
:style="style"
|
|
10
|
+
>
|
|
11
|
+
{{ $props.label }}
|
|
12
|
+
</FSSpan>
|
|
13
|
+
<FSSpan
|
|
14
|
+
v-if="$props.label && $props.required"
|
|
15
|
+
class="fs-time-slot-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-time-slot-field-messages"
|
|
27
|
+
font="text-overline"
|
|
28
|
+
:style="style"
|
|
29
|
+
>
|
|
30
|
+
{{ messages.join(", ") }}
|
|
31
|
+
</FSSpan>
|
|
32
|
+
</FSRow>
|
|
33
|
+
</slot>
|
|
34
|
+
<FSRow>
|
|
35
|
+
<FSSelectField
|
|
36
|
+
class="fs-time-slot-field-select"
|
|
37
|
+
:editable="$props.editable"
|
|
38
|
+
:items="daysObject"
|
|
39
|
+
:hideHeader="true"
|
|
40
|
+
:clearable="false"
|
|
41
|
+
:style="style"
|
|
42
|
+
:modelValue="dayStart"
|
|
43
|
+
@update:modelValue="onChangeDayStart"
|
|
44
|
+
>
|
|
45
|
+
<template v-for="(_, name) in slots" v-slot:[name]="slotData">
|
|
46
|
+
<slot :name="name" v-bind="slotData" />
|
|
47
|
+
</template>
|
|
48
|
+
<template #append>
|
|
49
|
+
<FSClock
|
|
50
|
+
class="fs-time-slot-field-number"
|
|
51
|
+
:editable="$props.editable"
|
|
52
|
+
:color="ColorEnum.Light"
|
|
53
|
+
:reminder="false"
|
|
54
|
+
:slider="false"
|
|
55
|
+
:style="style"
|
|
56
|
+
:modelValue="$props.modelValue[0][1]"
|
|
57
|
+
@update:modelValue="onChangeHourStart"
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
</FSSelectField>
|
|
61
|
+
<FSSelectField
|
|
62
|
+
class="fs-time-slot-field-select"
|
|
63
|
+
:editable="$props.editable"
|
|
64
|
+
:items="daysObject"
|
|
65
|
+
:hideHeader="true"
|
|
66
|
+
:clearable="false"
|
|
67
|
+
:style="style"
|
|
68
|
+
:modelValue="dayEnd"
|
|
69
|
+
@update:modelValue="onChangeDayEnd"
|
|
70
|
+
>
|
|
71
|
+
<template #append>
|
|
72
|
+
<FSClock
|
|
73
|
+
class="fs-time-slot-field-number"
|
|
74
|
+
:editable="$props.editable"
|
|
75
|
+
:color="ColorEnum.Light"
|
|
76
|
+
:reminder="false"
|
|
77
|
+
:slider="false"
|
|
78
|
+
:style="style"
|
|
79
|
+
:modelValue="$props.modelValue[1][1]"
|
|
80
|
+
@update:modelValue="onChangeHourEnd"
|
|
81
|
+
/>
|
|
82
|
+
</template>
|
|
83
|
+
</FSSelectField>
|
|
84
|
+
</FSRow>
|
|
85
|
+
<slot name="description">
|
|
86
|
+
<FSSpan
|
|
87
|
+
v-if="$props.description"
|
|
88
|
+
class="fs-time-slot-field-description"
|
|
89
|
+
font="text-underline"
|
|
90
|
+
:style="style"
|
|
91
|
+
>
|
|
92
|
+
{{ $props.description }}
|
|
93
|
+
</FSSpan>
|
|
94
|
+
</slot>
|
|
95
|
+
</FSCol>
|
|
96
|
+
</template>
|
|
97
|
+
|
|
98
|
+
<script lang="ts">
|
|
99
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
100
|
+
|
|
101
|
+
import { useColors, useRules, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
102
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
103
|
+
import { Days } from "@dative-gpi/foundation-shared-domain/models";
|
|
104
|
+
|
|
105
|
+
import FSSelectField from "./FSSelectField.vue";
|
|
106
|
+
import FSClock from "../FSClock.vue";
|
|
107
|
+
import FSSpan from "../FSSpan.vue";
|
|
108
|
+
import FSCol from "../FSCol.vue";
|
|
109
|
+
import FSRow from "../FSRow.vue";
|
|
110
|
+
|
|
111
|
+
export default defineComponent({
|
|
112
|
+
name: "FSTimeSlotField",
|
|
113
|
+
components: {
|
|
114
|
+
FSSelectField,
|
|
115
|
+
FSClock,
|
|
116
|
+
FSSpan,
|
|
117
|
+
FSCol,
|
|
118
|
+
FSRow
|
|
119
|
+
},
|
|
120
|
+
props: {
|
|
121
|
+
label: {
|
|
122
|
+
type: String,
|
|
123
|
+
required: false,
|
|
124
|
+
default: null
|
|
125
|
+
},
|
|
126
|
+
description: {
|
|
127
|
+
type: String,
|
|
128
|
+
required: false,
|
|
129
|
+
default: null
|
|
130
|
+
},
|
|
131
|
+
modelValue: {
|
|
132
|
+
type: Array as PropType<number[][]>,
|
|
133
|
+
required: true,
|
|
134
|
+
default: null
|
|
135
|
+
},
|
|
136
|
+
hideHeader: {
|
|
137
|
+
type: Boolean,
|
|
138
|
+
required: false,
|
|
139
|
+
default: false
|
|
140
|
+
},
|
|
141
|
+
required: {
|
|
142
|
+
type: Boolean,
|
|
143
|
+
required: false,
|
|
144
|
+
default: false
|
|
145
|
+
},
|
|
146
|
+
rules: {
|
|
147
|
+
type: Array as PropType<Function[]>,
|
|
148
|
+
required: false,
|
|
149
|
+
default: () => []
|
|
150
|
+
},
|
|
151
|
+
messages: {
|
|
152
|
+
type: Array as PropType<string[]>,
|
|
153
|
+
required: false,
|
|
154
|
+
default: null
|
|
155
|
+
},
|
|
156
|
+
editable: {
|
|
157
|
+
type: Boolean,
|
|
158
|
+
required: false,
|
|
159
|
+
default: true
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
emits: ["update:modelValue"],
|
|
163
|
+
setup(props, { emit }) {
|
|
164
|
+
const { validateOn, blurred, getMessages } = useRules();
|
|
165
|
+
const { getColors } = useColors();
|
|
166
|
+
const { slots } = useSlots();
|
|
167
|
+
|
|
168
|
+
delete slots.label;
|
|
169
|
+
delete slots.description;
|
|
170
|
+
|
|
171
|
+
const errors = getColors(ColorEnum.Error);
|
|
172
|
+
const lights = getColors(ColorEnum.Light);
|
|
173
|
+
const darks = getColors(ColorEnum.Dark);
|
|
174
|
+
|
|
175
|
+
const daysObject: { id: number; label: string }[] = Object.keys(Days).reduce((acc, key) => {
|
|
176
|
+
if(isNaN(Number(key))){
|
|
177
|
+
acc.push({
|
|
178
|
+
id: Days[key],
|
|
179
|
+
label: key
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
return acc;
|
|
183
|
+
}, []);
|
|
184
|
+
|
|
185
|
+
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
186
|
+
if (!props.editable) {
|
|
187
|
+
return {
|
|
188
|
+
"--fs-time-slot-field-cursor" : "default",
|
|
189
|
+
"--fs-time-slot-field-border-color" : lights.base,
|
|
190
|
+
"--fs-time-slot-field-color" : lights.dark,
|
|
191
|
+
"--fs-time-slot-field-active-border-color": lights.base
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
"--fs-time-slot-field-cursor" : "text",
|
|
196
|
+
"--fs-time-slot-field-border-color" : lights.dark,
|
|
197
|
+
"--fs-time-slot-field-color" : darks.base,
|
|
198
|
+
"--fs-time-slot-field-active-border-color": darks.dark,
|
|
199
|
+
"--fs-time-slot-field-error-color" : errors.base,
|
|
200
|
+
"--fs-time-slot-field-error-border-color" : errors.base
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
const dayStart = computed((): number => {
|
|
205
|
+
return props.modelValue[1][0] === 7 ? 7 : props.modelValue[0][0];
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
const dayEnd = computed((): number => {
|
|
209
|
+
return props.modelValue[0][0] === 7 ? 7 : props.modelValue[1][0];
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
|
|
213
|
+
|
|
214
|
+
const onChangeDayStart = (value: number) => {
|
|
215
|
+
if (value === 7) {
|
|
216
|
+
emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
if (props.modelValue[1][0] === 7) {
|
|
220
|
+
emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
emit("update:modelValue", [[value, props.modelValue[0][1]], props.modelValue[1]]);
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const onChangeHourStart = (value: number) => {
|
|
227
|
+
emit("update:modelValue", [[props.modelValue[0][0], value], props.modelValue[1]]);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const onChangeDayEnd = (value: number) => {
|
|
231
|
+
if (value === 7) {
|
|
232
|
+
emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
if (props.modelValue[0][0] === 7) {
|
|
236
|
+
emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
emit("update:modelValue", [props.modelValue[0], [value, props.modelValue[1][1]]]);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
const onChangeHourEnd = (value: number) => {
|
|
243
|
+
emit("update:modelValue", [props.modelValue[0], [props.modelValue[1][0], value]]);
|
|
244
|
+
};
|
|
245
|
+
|
|
246
|
+
return {
|
|
247
|
+
ColorEnum,
|
|
248
|
+
daysObject,
|
|
249
|
+
dayStart,
|
|
250
|
+
dayEnd,
|
|
251
|
+
validateOn,
|
|
252
|
+
messages,
|
|
253
|
+
blurred,
|
|
254
|
+
slots,
|
|
255
|
+
style,
|
|
256
|
+
onChangeDayStart,
|
|
257
|
+
onChangeHourStart,
|
|
258
|
+
onChangeDayEnd,
|
|
259
|
+
onChangeHourEnd
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
</script>
|
|
@@ -415,11 +415,11 @@ import { useBreakpoints, useColors, useSlots } from "@dative-gpi/foundation-shar
|
|
|
415
415
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
416
416
|
|
|
417
417
|
import FSDataIteratorItem from "./FSDataIteratorItem.vue";
|
|
418
|
+
import FSSearchField from "../fields/FSSearchField.vue";
|
|
419
|
+
import FSSelectField from "../fields/FSSelectField.vue";
|
|
418
420
|
import FSFilterButton from "./FSFilterButton.vue";
|
|
419
421
|
import FSHiddenButton from "./FSHiddenButton.vue";
|
|
420
422
|
import FSHeaderButton from "./FSHeaderButton.vue";
|
|
421
|
-
import FSSearchField from "../FSSearchField.vue";
|
|
422
|
-
import FSSelectField from "../FSSelectField.vue";
|
|
423
423
|
import FSContainer from "../FSContainer.vue";
|
|
424
424
|
import FSToggleSet from "../FSToggleSet.vue";
|
|
425
425
|
import FSCheckbox from "../FSCheckbox.vue";
|
|
@@ -73,7 +73,7 @@ import { computed, defineComponent, PropType, ref } from "vue";
|
|
|
73
73
|
import { ColorBase, ColorEnum, FSDataTableColumn, FSDataTableFilter } from "@dative-gpi/foundation-shared-components/models";
|
|
74
74
|
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
|
|
75
75
|
|
|
76
|
-
import FSSearchField from "../FSSearchField.vue";
|
|
76
|
+
import FSSearchField from "../fields/FSSearchField.vue";
|
|
77
77
|
import FSFadeOut from "../FSFadeOut.vue";
|
|
78
78
|
import FSCard from "../FSCard.vue";
|
|
79
79
|
import FSChip from "../FSChip.vue";
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
align="center-center"
|
|
14
14
|
gap="24px"
|
|
15
15
|
:wrap="false"
|
|
16
|
-
:height="
|
|
16
|
+
:height="imageSize"
|
|
17
17
|
>
|
|
18
18
|
<FSCol
|
|
19
19
|
gap="12px"
|
|
@@ -205,16 +205,12 @@ export default defineComponent({
|
|
|
205
205
|
return isMobileSized.value ? 90 : 100;
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
const infoWidth = computed(():
|
|
208
|
+
const infoWidth = computed((): number => {
|
|
209
209
|
let width = isMobileSized.value ? 288 : 304;
|
|
210
210
|
if (props.imageId) {
|
|
211
211
|
width -= imageSize.value;
|
|
212
212
|
}
|
|
213
|
-
return
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
const infoHeight = computed((): string => {
|
|
217
|
-
return `${imageSize.value}px`;
|
|
213
|
+
return width;
|
|
218
214
|
});
|
|
219
215
|
|
|
220
216
|
return {
|
|
@@ -224,8 +220,7 @@ export default defineComponent({
|
|
|
224
220
|
carouselModelStatuses,
|
|
225
221
|
carouselDeviceStatuses,
|
|
226
222
|
imageSize,
|
|
227
|
-
infoWidth
|
|
228
|
-
infoHeight
|
|
223
|
+
infoWidth
|
|
229
224
|
};
|
|
230
225
|
}
|
|
231
226
|
});
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
align="center-center"
|
|
14
14
|
gap="24px"
|
|
15
15
|
:wrap="false"
|
|
16
|
-
:height="
|
|
16
|
+
:height="imageSize"
|
|
17
17
|
>
|
|
18
18
|
<FSCol
|
|
19
19
|
gap="12px"
|
|
@@ -167,16 +167,12 @@ export default defineComponent({
|
|
|
167
167
|
return isMobileSized.value ? 90 : 100;
|
|
168
168
|
});
|
|
169
169
|
|
|
170
|
-
const infoWidth = computed(():
|
|
170
|
+
const infoWidth = computed((): number => {
|
|
171
171
|
let width = isMobileSized.value ? 288 : 304;
|
|
172
172
|
if (props.imageId) {
|
|
173
173
|
width -= imageSize.value;
|
|
174
174
|
}
|
|
175
|
-
return
|
|
176
|
-
});
|
|
177
|
-
|
|
178
|
-
const infoHeight = computed((): string => {
|
|
179
|
-
return `${imageSize.value}px`;
|
|
175
|
+
return width;
|
|
180
176
|
});
|
|
181
177
|
|
|
182
178
|
return {
|
|
@@ -184,8 +180,7 @@ export default defineComponent({
|
|
|
184
180
|
groupsLabel,
|
|
185
181
|
deviceOrganisationsLabel,
|
|
186
182
|
imageSize,
|
|
187
|
-
infoWidth
|
|
188
|
-
infoHeight
|
|
183
|
+
infoWidth
|
|
189
184
|
};
|
|
190
185
|
}
|
|
191
186
|
});
|