@dative-gpi/foundation-shared-components 1.0.51 → 1.0.53

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.
Files changed (36) hide show
  1. package/components/FSCard.vue +6 -2
  2. package/components/FSClickable.vue +6 -9
  3. package/components/FSDialogRemove.vue +1 -0
  4. package/components/agenda/FSAgenda.vue +210 -0
  5. package/components/agenda/FSAgendaDialogCalendar.vue +76 -0
  6. package/components/agenda/FSAgendaHeader.vue +190 -0
  7. package/components/agenda/FSAgendaHorizontalEvent.vue +162 -0
  8. package/components/agenda/FSAgendaHorizontalTimeLineMarker.vue +46 -0
  9. package/components/agenda/FSAgendaHoursCol.vue +103 -0
  10. package/components/agenda/FSAgendaHoursRow.vue +124 -0
  11. package/components/agenda/FSAgendaVerticalEvent.vue +160 -0
  12. package/components/agenda/FSAgendaVerticalTimeLineMarker.vue +46 -0
  13. package/components/agenda/FSDayAgenda.vue +200 -0
  14. package/components/agenda/FSMonthAgenda.vue +258 -0
  15. package/components/agenda/FSSelectAgendaMode.vue +54 -0
  16. package/components/agenda/FSWeekAgenda.vue +329 -0
  17. package/components/fields/FSCommentField.vue +93 -0
  18. package/components/tiles/FSChartTileUI.vue +116 -0
  19. package/components/tiles/FSCommentTileUI.vue +149 -0
  20. package/components/tiles/FSLocationTileUI.vue +138 -0
  21. package/components/tiles/FSModelTileUI.vue +59 -0
  22. package/models/agenda.ts +9 -0
  23. package/models/index.ts +1 -0
  24. package/package.json +4 -4
  25. package/styles/components/fs_agenda.scss +32 -0
  26. package/styles/components/fs_agenda_event.scss +41 -0
  27. package/styles/components/fs_agenda_hours_col.scss +4 -0
  28. package/styles/components/fs_agenda_hours_row.scss +13 -0
  29. package/styles/components/fs_agenda_time_line_marker.scss +19 -0
  30. package/styles/components/fs_clickable.scss +4 -2
  31. package/styles/components/fs_dialog.scss +11 -15
  32. package/styles/components/fs_tile.scss +4 -0
  33. package/styles/components/index.scss +5 -0
  34. package/tools/alertsTools.ts +54 -0
  35. package/tools/chartsTools.ts +300 -0
  36. package/tools/index.ts +2 -0
@@ -0,0 +1,162 @@
1
+ <template>
2
+ <FSAgendaHorizontalEvent
3
+ v-if="$props.variant === 'current'"
4
+ :key="$props.id"
5
+ variant="future"
6
+ :now="$props.now"
7
+ :dayStart="$props.dayStart"
8
+ :label="$props.label"
9
+ :start="$props.start"
10
+ :end="$props.end"
11
+ :icon="$props.icon"
12
+ :iconBis="$props.iconBis"
13
+ :id="$props.id"
14
+ :color="$props.color"
15
+ @click="$emit('click', $props.id)"
16
+ >
17
+ <template
18
+ #default="{ label, icon, timeStart, timeEnd, iconBis, variant }"
19
+ >
20
+ <slot
21
+ name="default"
22
+ :label="label"
23
+ :icon="icon"
24
+ :iconBis="iconBis"
25
+ :timeStart="timeStart"
26
+ :timeEnd="timeEnd"
27
+ :variant="variant"
28
+ />
29
+ </template>
30
+ </FSAgendaHorizontalEvent>
31
+ <FSClickable
32
+ v-if="$props.variant !== 'current' || $props.dayStart < $props.now"
33
+ :class="`fs-agenda-event fs-agenda-event-${$props.variant}`"
34
+ :variant="$props.variant === 'current' ? 'full' : 'standard'"
35
+ :style="style"
36
+ :color="$props.color"
37
+ :width="`${width}%`"
38
+ height="calc(100% - 4px)"
39
+ :border="false"
40
+ @click="$emit('click', $props.id)"
41
+ >
42
+ <slot
43
+ name="default"
44
+ :label="label"
45
+ :icon="icon"
46
+ :iconBis="iconBis"
47
+ :timeStart="epochToShortTimeOnlyFormat($props.start)"
48
+ :timeEnd="epochToShortTimeOnlyFormat($props.end)"
49
+ :variant="$props.variant"
50
+ />
51
+ </FSClickable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { defineComponent, computed, type StyleValue, type PropType } from 'vue';
56
+
57
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
58
+
59
+ import FSClickable from '../FSClickable.vue';
60
+
61
+
62
+ export default defineComponent({
63
+ name: 'FSAgendaHorizontalEvent',
64
+ components: {
65
+ FSClickable
66
+ },
67
+ emits: ['click'],
68
+ props: {
69
+ variant: {
70
+ type: String as PropType<'past' | 'current' | 'future'>,
71
+ default: 'future'
72
+ },
73
+ label: {
74
+ type: String,
75
+ required: true
76
+ },
77
+ start: {
78
+ type: Number,
79
+ required: true
80
+ },
81
+ end: {
82
+ type: Number,
83
+ required: true
84
+ },
85
+ icon: {
86
+ type: String,
87
+ required: false
88
+ },
89
+ iconBis: {
90
+ type: String,
91
+ required: false
92
+ },
93
+ id: {
94
+ type: String,
95
+ required: true
96
+ },
97
+ color: {
98
+ type: String,
99
+ required: true
100
+ },
101
+ dayStart: {
102
+ type: Number,
103
+ required: true
104
+ },
105
+ now: {
106
+ type: Number,
107
+ required: true
108
+ }
109
+ },
110
+ setup(props) {
111
+ const { dayToMillisecond, epochToShortTimeOnlyFormat, millisecondToDay } = useDateFormat();
112
+
113
+ const dayEnd = computed(() => {
114
+ return new Date(props.dayStart).setHours(23, 59, 59, 999);
115
+ });
116
+
117
+ const dayDuration = computed(() => {
118
+ return dayEnd.value - props.dayStart;
119
+ });
120
+
121
+ const dayDurationOffset = computed(() => {
122
+ return dayDuration.value - dayToMillisecond(1);
123
+ });
124
+
125
+ const leftPosition = computed(() => {
126
+ if (props.start < props.dayStart) {
127
+ return 0;
128
+ }
129
+ return millisecondToDay(props.start - props.dayStart - dayDurationOffset.value) * 100;
130
+ });
131
+
132
+ const width = computed(() => {
133
+ let start = props.start - dayDurationOffset.value;
134
+ let end = props.end - dayDurationOffset.value;
135
+ if(props.variant === 'current') {
136
+ end = props.now;
137
+ } else if (props.end > dayEnd.value) {
138
+ end = dayEnd.value - dayDurationOffset.value;
139
+ }
140
+ if (props.start < props.dayStart) {
141
+ start = props.dayStart;
142
+ }
143
+
144
+ const duration = millisecondToDay(end - start);
145
+ return duration > 0 ? (duration * 100) : 0;
146
+ });
147
+
148
+ const style = computed((): StyleValue => {
149
+ return {
150
+ '--fs-agenda-event-left': `${leftPosition.value}%`,
151
+ };
152
+ });
153
+
154
+ return {
155
+ style,
156
+ width,
157
+ epochToShortTimeOnlyFormat
158
+ };
159
+ }
160
+ });
161
+
162
+ </script>
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div
3
+ class="fs-agenda-horizontal-time-line-marker"
4
+ :style="style"
5
+ >
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent, computed, type StyleValue } from 'vue';
11
+
12
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
13
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
14
+
15
+ export default defineComponent({
16
+ name: 'FSAgendaHorizontalTimeLineMarker',
17
+ props: {
18
+ modelValue: {
19
+ type: Number,
20
+ required: true,
21
+ }
22
+ },
23
+ setup(props) {
24
+ const { getColors } = useColors();
25
+
26
+ const primaryColor = getColors(ColorEnum.Primary);
27
+
28
+ const nowDate = computed(() => {
29
+ return new Date(props.modelValue);
30
+ });
31
+
32
+ const leftOffset = computed(() => {
33
+ return nowDate.value.getHours() * 100 / 24 + nowDate.value.getMinutes() * 100 / 24 / 60;
34
+ });
35
+
36
+ const style = computed((): StyleValue => ({
37
+ "--fs-agenda-horizontal-time-line-marker-left": `${leftOffset.value}%`,
38
+ "--fs-agenda-horizontal-time-line-marker-color": primaryColor.base
39
+ }));
40
+
41
+ return {
42
+ style,
43
+ };
44
+ },
45
+ });
46
+ </script>
@@ -0,0 +1,103 @@
1
+ <template>
2
+ <FSRow
3
+ padding="0 0 0 4px"
4
+ gap="0"
5
+ width="hug"
6
+ height="100%"
7
+ >
8
+ <FSCol
9
+ class="fs-agenda-hours-col"
10
+ :wrap="false"
11
+ gap="0"
12
+ height="100%"
13
+ align="center-center"
14
+ >
15
+ <FSRow
16
+ v-for="hour in hours"
17
+ :key="hour"
18
+ width="100%"
19
+ height="100%"
20
+ align="center-center"
21
+ >
22
+ <FSCard
23
+ class="fs-agenda-hours-col-now"
24
+ color="primary"
25
+ variant="full"
26
+ width="100%"
27
+ v-if="displayNow && hour === modelValue"
28
+ >
29
+ <FSCol
30
+ align="center-center"
31
+ >
32
+ <FSSpan
33
+ class="fs-agenda-hours-col-text fs-agenda-hours-col-text-now"
34
+ >
35
+ {{ $tr('ui.common.hours-only', '{0}h', to2Digits(hour)) }}
36
+ </FSSpan>
37
+ </FSCol>
38
+ </FSCard>
39
+ <FSText
40
+ v-else
41
+ class="fs-agenda-hours-col-text"
42
+ :color="fontColor"
43
+ >
44
+ {{ $tr('ui.common.hours-only', '{0}h', to2Digits(hour)) }}
45
+ </FSText>
46
+ </FSRow>
47
+ </FSCol>
48
+ </FSRow>
49
+ </template>
50
+
51
+ <script lang="ts">
52
+ import { defineComponent, computed } from 'vue';
53
+
54
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
55
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
56
+
57
+ import FSText from '../FSText.vue';
58
+ import FSRow from '../FSRow.vue';
59
+ import FSCard from '../FSCard.vue';
60
+ import FSSpan from '../FSSpan.vue';
61
+ import FSCol from '../FSCol.vue';
62
+
63
+ export default defineComponent({
64
+ name: 'FSAgendaHoursCol',
65
+ components: {
66
+ FSCard,
67
+ FSCol,
68
+ FSSpan,
69
+ FSText,
70
+ FSRow,
71
+ },
72
+ props: {
73
+ modelValue: {
74
+ type: Number,
75
+ required: true,
76
+ },
77
+ displayNow: {
78
+ type: Boolean,
79
+ required: false,
80
+ default: false,
81
+ },
82
+ },
83
+ setup() {
84
+ const { getColors } = useColors();
85
+
86
+ const lightColors = getColors(ColorEnum.Light);
87
+ const fontColor = lightColors.dark;
88
+
89
+ const hours = computed(() => {
90
+ return Array.from({ length: 24 }, (_, i) => i);
91
+ });
92
+
93
+ const to2Digits = (value: number) => value.toString().padStart(2, '0');
94
+
95
+ return {
96
+ fontColor,
97
+ hours,
98
+ to2Digits
99
+ };
100
+ },
101
+ });
102
+
103
+ </script>
@@ -0,0 +1,124 @@
1
+ <template>
2
+ <FSCol
3
+ gap="0"
4
+ >
5
+ <FSRow
6
+ class="fs-agenda-hours-row"
7
+ :wrap="false"
8
+ gap="0"
9
+ align="center-center"
10
+ >
11
+ <FSRow
12
+ v-for="hour in hours"
13
+ :key="hour"
14
+ width="100%"
15
+ align="center-center"
16
+ >
17
+ <FSCard
18
+ class="fs-agenda-hours-row-now"
19
+ color="primary"
20
+ variant="full"
21
+ v-if="displayNow && hour === modelValue"
22
+ >
23
+ <FSSpan
24
+ class="fs-agenda-hours-row-text fs-agenda-hours-row-text-now"
25
+ >
26
+ {{ $tr('ui.common.hours-only', '{0}h', to2Digits(hour)) }}
27
+ </FSSpan>
28
+ </FSCard>
29
+ <FSText
30
+ v-else
31
+ class="fs-agenda-hours-row-text"
32
+ :color="fontColor"
33
+ >
34
+ {{ $tr('ui.common.hours-only', '{0}h', to2Digits(hour)) }}
35
+ </FSText>
36
+ </FSRow>
37
+ </FSRow>
38
+ <FSRow
39
+ class="fs-agenda-hours-row"
40
+ :wrap="false"
41
+ gap="0"
42
+ >
43
+ <FSRow
44
+ v-for="hour in hours"
45
+ :key="hour"
46
+ :style="getMarkerStyle(displayNow && hour === modelValue)"
47
+ width="100%"
48
+ height="0"
49
+ align="center-center"
50
+ >
51
+ <span
52
+ class="fs-agenda-hours-row-marker"
53
+ />
54
+ </FSRow>
55
+ </FSRow>
56
+ </FSCol>
57
+ </template>
58
+
59
+ <script lang="ts">
60
+ import { defineComponent, computed, type StyleValue } from 'vue';
61
+
62
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
63
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
64
+
65
+ import FSText from '../FSText.vue';
66
+ import FSRow from '../FSRow.vue';
67
+ import FSCard from '../FSCard.vue';
68
+ import FSSpan from '../FSSpan.vue';
69
+ import FSCol from '../FSCol.vue';
70
+
71
+ export default defineComponent({
72
+ name: 'FSAgendaHoursRow',
73
+ components: {
74
+ FSCard,
75
+ FSCol,
76
+ FSSpan,
77
+ FSText,
78
+ FSRow,
79
+ },
80
+ props: {
81
+ modelValue: {
82
+ type: Number,
83
+ required: true,
84
+ },
85
+ displayNow: {
86
+ type: Boolean,
87
+ required: false,
88
+ default: false,
89
+ },
90
+ },
91
+ setup() {
92
+ const { getColors } = useColors();
93
+
94
+ const lightColors = getColors(ColorEnum.Light);
95
+ const primaryColors = getColors(ColorEnum.Primary);
96
+ const fontColor = lightColors.dark;
97
+
98
+ const hours = computed(() => {
99
+ return Array.from({ length: 24 }, (_, i) => i);
100
+ });
101
+
102
+ const getMarkerStyle = (isNowHour: boolean): StyleValue => {
103
+ if(isNowHour) {
104
+ return {
105
+ '--fs-agenda-hours-row-marker-color': primaryColors.base,
106
+ }
107
+ }
108
+ return {
109
+ '--fs-agenda-hours-row-marker-color': lightColors.base,
110
+ }
111
+ };
112
+
113
+ const to2Digits = (value: number) => value.toString().padStart(2, '0');
114
+
115
+ return {
116
+ fontColor,
117
+ hours,
118
+ getMarkerStyle,
119
+ to2Digits
120
+ };
121
+ },
122
+ });
123
+
124
+ </script>
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <FSAgendaVerticalEvent
3
+ v-if="$props.variant === 'current'"
4
+ :key="$props.id"
5
+ variant="future"
6
+ :now="$props.now"
7
+ :dayStart="$props.dayStart"
8
+ :label="$props.label"
9
+ :start="$props.start"
10
+ :end="$props.end"
11
+ :icon="$props.icon"
12
+ :iconBis="$props.iconBis"
13
+ :id="$props.id"
14
+ :color="$props.color"
15
+ @click="$emit('click', $props.id)"
16
+ >
17
+ <template
18
+ #default="{ label, icon, timeStart, timeEnd, iconBis, variant }"
19
+ >
20
+ <slot
21
+ name="default"
22
+ :label="label"
23
+ :icon="icon"
24
+ :iconBis="iconBis"
25
+ :timeStart="timeStart"
26
+ :timeEnd="timeEnd"
27
+ :variant="variant"
28
+ />
29
+ </template>
30
+ </FSAgendaVerticalEvent>
31
+ <FSClickable
32
+ v-if="$props.variant !== 'current' || $props.dayStart < $props.now"
33
+ :class="`fs-agenda-event fs-agenda-vertical-event fs-agenda-event-${$props.variant}`"
34
+ :variant="$props.variant === 'current' ? 'full' : 'standard'"
35
+ :style="style"
36
+ :color="$props.color"
37
+ :height="`${height}%`"
38
+ width="100%"
39
+ :border="false"
40
+ @click="$emit('click', $props.id)"
41
+ >
42
+ <slot
43
+ name="default"
44
+ :label="label"
45
+ :icon="icon"
46
+ :iconBis="iconBis"
47
+ :timeStart="epochToShortTimeOnlyFormat($props.start)"
48
+ :timeEnd="epochToShortTimeOnlyFormat($props.end)"
49
+ :variant="$props.variant"
50
+ />
51
+ </FSClickable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { defineComponent, computed, type StyleValue, type PropType } from 'vue';
56
+
57
+ import { useDateFormat } from "@dative-gpi/foundation-shared-services/composables";
58
+
59
+ import FSClickable from '../FSClickable.vue';
60
+
61
+ export default defineComponent({
62
+ name: 'FSAgendaVerticalEvent',
63
+ components: {
64
+ FSClickable
65
+ },
66
+ emits: ['click'],
67
+ props: {
68
+ variant: {
69
+ type: String as PropType<'past' | 'current' | 'future'>,
70
+ default: 'future'
71
+ },
72
+ label: {
73
+ type: String,
74
+ required: true
75
+ },
76
+ start: {
77
+ type: Number,
78
+ required: true
79
+ },
80
+ end: {
81
+ type: Number,
82
+ required: true
83
+ },
84
+ icon: {
85
+ type: String,
86
+ required: false
87
+ },
88
+ iconBis: {
89
+ type: String,
90
+ required: false
91
+ },
92
+ id: {
93
+ type: String,
94
+ required: true
95
+ },
96
+ color: {
97
+ type: String,
98
+ required: true
99
+ },
100
+ dayStart: {
101
+ type: Number,
102
+ required: true
103
+ },
104
+ now: {
105
+ type: Number,
106
+ required: true
107
+ }
108
+ },
109
+ setup(props) {
110
+ const { dayToMillisecond, epochToShortTimeOnlyFormat, millisecondToDay } = useDateFormat();
111
+
112
+ const dayEnd = computed(() => {
113
+ return new Date(props.dayStart).setHours(23, 59, 59, 999);
114
+ });
115
+
116
+ const dayDuration = computed(() => {
117
+ return dayEnd.value - props.dayStart;
118
+ });
119
+
120
+ const dayDurationOffset = computed(() => {
121
+ return dayDuration.value - dayToMillisecond(1);
122
+ });
123
+
124
+ const topPosition = computed(() => {
125
+ if (props.start < props.dayStart) {
126
+ return 0;
127
+ }
128
+ return millisecondToDay(props.start - props.dayStart - dayDurationOffset.value) * 100;
129
+ });
130
+
131
+ const height = computed(() => {
132
+ let start = props.start - dayDurationOffset.value;
133
+ let end = props.end - dayDurationOffset.value;
134
+ if (props.variant === 'current') {
135
+ end = props.now;
136
+ } else if (props.end > dayEnd.value) {
137
+ end = dayEnd.value - dayDurationOffset.value;
138
+ }
139
+ if (props.start < props.dayStart) {
140
+ start = props.dayStart;
141
+ }
142
+
143
+ const duration = millisecondToDay(end - start);
144
+ return duration > 0 ? (duration * 100) : 0;
145
+ });
146
+
147
+ const style = computed((): StyleValue => {
148
+ return {
149
+ '--fs-agenda-event-top': `${topPosition.value}%`,
150
+ };
151
+ });
152
+
153
+ return {
154
+ style,
155
+ height,
156
+ epochToShortTimeOnlyFormat
157
+ };
158
+ }
159
+ });
160
+ </script>
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <div
3
+ class="fs-agenda-vertical-time-line-marker"
4
+ :style="style"
5
+ >
6
+ </div>
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent, computed, type StyleValue } from 'vue';
11
+
12
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
13
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
14
+
15
+ export default defineComponent({
16
+ name: 'FSAgendaVerticalTimeLineMarker',
17
+ props: {
18
+ modelValue: {
19
+ type: Number,
20
+ required: true,
21
+ }
22
+ },
23
+ setup(props) {
24
+ const { getColors } = useColors();
25
+
26
+ const primaryColor = getColors(ColorEnum.Primary);
27
+
28
+ const nowDate = computed(() => {
29
+ return new Date(props.modelValue);
30
+ });
31
+
32
+ const topOffset = computed(() => {
33
+ return nowDate.value.getHours() * 100 / 24 + nowDate.value.getMinutes() * 100 / 24 / 60;
34
+ });
35
+
36
+ const style = computed((): StyleValue => ({
37
+ "--fs-agenda-vertical-time-line-marker-top": `${topOffset.value}%`,
38
+ "--fs-agenda-vertical-time-line-marker-color": primaryColor.base
39
+ }));
40
+
41
+ return {
42
+ style,
43
+ };
44
+ },
45
+ });
46
+ </script>