@dative-gpi/foundation-shared-components 0.0.230 → 0.1.68

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 (228) hide show
  1. package/components/FSAccordionPanel.vue +8 -10
  2. package/components/FSBadge.vue +2 -4
  3. package/components/FSBreadcrumbs.vue +9 -10
  4. package/components/FSButton.vue +81 -31
  5. package/components/FSCalendar.vue +35 -33
  6. package/components/FSCalendarTwin.vue +77 -84
  7. package/components/FSCard.vue +29 -16
  8. package/components/FSCardPlaceholder.vue +1 -2
  9. package/components/FSCheckbox.vue +5 -7
  10. package/components/FSChip.vue +9 -11
  11. package/components/FSClickable.vue +67 -57
  12. package/components/FSClock.vue +4 -4
  13. package/components/FSCol.vue +2 -3
  14. package/components/FSColor.vue +13 -31
  15. package/components/FSColorIcon.vue +25 -9
  16. package/components/FSDialog.vue +1 -2
  17. package/components/FSDialogFormBody.vue +4 -4
  18. package/components/FSDialogMenu.vue +2 -4
  19. package/components/FSDialogMultiFormBody.vue +63 -50
  20. package/components/FSDialogRemove.vue +1 -0
  21. package/components/FSDialogSubmit.vue +5 -7
  22. package/components/FSDivider.vue +7 -9
  23. package/components/FSEditImage.vue +27 -274
  24. package/components/FSEditImageUI.vue +303 -0
  25. package/components/FSErrorToast.vue +3 -4
  26. package/components/FSFadeOut.vue +18 -13
  27. package/components/FSGrid.vue +6 -9
  28. package/components/FSGridMosaic.vue +1 -2
  29. package/components/FSIcon.vue +7 -8
  30. package/components/FSIconCard.vue +23 -30
  31. package/components/FSIconCheck.vue +1 -2
  32. package/components/FSImage.vue +21 -193
  33. package/components/FSImageCard.vue +2 -2
  34. package/components/FSImageUI.vue +212 -0
  35. package/components/FSLabel.vue +18 -20
  36. package/components/FSLink.vue +19 -21
  37. package/components/FSLoader.vue +10 -14
  38. package/components/FSOptionGroup.vue +58 -12
  39. package/components/FSPagination.vue +3 -5
  40. package/components/FSRadio.vue +5 -7
  41. package/components/FSRadioGroup.vue +2 -4
  42. package/components/FSRow.vue +3 -4
  43. package/components/FSSlideGroup.vue +15 -4
  44. package/components/FSSlider.vue +9 -11
  45. package/components/FSSpan.vue +11 -9
  46. package/components/FSSwitch.vue +65 -37
  47. package/components/FSTab.vue +2 -4
  48. package/components/FSTabs.vue +35 -13
  49. package/components/FSTag.vue +23 -14
  50. package/components/FSTagGroup.vue +3 -5
  51. package/components/FSText.vue +8 -12
  52. package/components/FSWindow.vue +10 -3
  53. package/components/FSWrapGroup.vue +15 -4
  54. package/components/agenda/FSAgenda.vue +204 -0
  55. package/components/agenda/FSAgendaDialogCalendar.vue +76 -0
  56. package/components/agenda/FSAgendaHeader.vue +190 -0
  57. package/components/agenda/FSAgendaHorizontalEvent.vue +162 -0
  58. package/components/agenda/FSAgendaHorizontalTimeLineMarker.vue +46 -0
  59. package/components/agenda/FSAgendaHoursCol.vue +103 -0
  60. package/components/agenda/FSAgendaHoursRow.vue +124 -0
  61. package/components/agenda/FSAgendaVerticalEvent.vue +160 -0
  62. package/components/agenda/FSAgendaVerticalTimeLineMarker.vue +46 -0
  63. package/components/agenda/FSDayAgenda.vue +200 -0
  64. package/components/agenda/FSMonthAgenda.vue +257 -0
  65. package/components/agenda/FSSelectAgendaMode.vue +54 -0
  66. package/components/agenda/FSWeekAgenda.vue +328 -0
  67. package/components/autocompletes/FSAutocompleteLanguage.vue +18 -39
  68. package/components/autocompletes/FSAutocompleteTimeZone.vue +20 -38
  69. package/components/buttons/FSButtonCancelMini.vue +1 -0
  70. package/components/buttons/FSButtonCopy.vue +28 -0
  71. package/components/buttons/FSButtonCopyIcon.vue +28 -0
  72. package/components/buttons/FSButtonCopyLabel.vue +27 -0
  73. package/components/buttons/FSButtonCopyMini.vue +28 -0
  74. package/components/buttons/FSButtonDragIcon.vue +27 -0
  75. package/components/buttons/FSButtonDuplicateMini.vue +1 -0
  76. package/components/buttons/FSButtonEditMini.vue +1 -0
  77. package/components/buttons/FSButtonFileMini.vue +1 -0
  78. package/components/buttons/FSButtonNextMini.vue +1 -0
  79. package/components/buttons/FSButtonPreviousMini.vue +1 -0
  80. package/components/buttons/FSButtonRedoMini.vue +1 -0
  81. package/components/buttons/FSButtonRemoveMini.vue +1 -0
  82. package/components/buttons/FSButtonSaveMini.vue +1 -0
  83. package/components/buttons/FSButtonSearchMini.vue +1 -0
  84. package/components/buttons/FSButtonUndoMini.vue +1 -0
  85. package/components/buttons/FSButtonUpdateMini.vue +1 -0
  86. package/components/buttons/FSButtonValidateMini.vue +1 -0
  87. package/components/deviceOrganisations/FSConnectivity.vue +11 -1
  88. package/components/deviceOrganisations/FSConnectivityCard.vue +20 -49
  89. package/components/deviceOrganisations/FSStatus.vue +11 -1
  90. package/components/deviceOrganisations/FSStatusCard.vue +40 -60
  91. package/components/deviceOrganisations/FSStatusesCarousel.vue +1 -0
  92. package/components/deviceOrganisations/FSStatusesRow.vue +10 -5
  93. package/components/deviceOrganisations/FSWorstAlert.vue +19 -13
  94. package/components/deviceOrganisations/FSWorstAlertCard.vue +36 -47
  95. package/components/fields/FSAutocompleteField.vue +501 -323
  96. package/components/fields/FSAutocompleteTag.vue +100 -0
  97. package/components/fields/FSBaseField.vue +26 -16
  98. package/components/fields/FSColorField.vue +63 -55
  99. package/components/fields/FSCommentField.vue +93 -0
  100. package/components/fields/FSDateField.vue +2 -2
  101. package/components/fields/FSDateRangeField.vue +2 -2
  102. package/components/fields/FSDateTimeField.vue +4 -3
  103. package/components/fields/FSDateTimeRangeField.vue +7 -6
  104. package/components/fields/FSEntityFieldUI.vue +271 -0
  105. package/components/fields/FSGradientField.vue +27 -33
  106. package/components/fields/FSIconField.vue +2 -3
  107. package/components/fields/FSMagicConfigField.vue +28 -19
  108. package/components/fields/FSMagicField.vue +25 -17
  109. package/components/fields/FSNumberField.vue +9 -7
  110. package/components/fields/FSPasswordField.vue +2 -3
  111. package/components/fields/FSRichTextField.vue +32 -5
  112. package/components/fields/FSSearchField.vue +2 -2
  113. package/components/fields/FSSelectField.vue +483 -251
  114. package/components/fields/FSTagField.vue +4 -6
  115. package/components/fields/FSTermField.vue +25 -13
  116. package/components/fields/FSTextArea.vue +18 -6
  117. package/components/fields/FSTextField.vue +13 -10
  118. package/components/fields/FSTimeField.vue +1 -1
  119. package/components/fields/FSTimeSlotField.vue +3 -4
  120. package/components/fields/FSTimeStepField.vue +157 -0
  121. package/components/fields/FSTranslateField.vue +3 -2
  122. package/components/fields/FSTranslateRichTextField.vue +4 -3
  123. package/components/fields/FSTranslateTextArea.vue +233 -0
  124. package/components/fields/FSTreeViewField.vue +7 -9
  125. package/components/fields/periodicField/FSPeriodicDailyField.vue +120 -0
  126. package/components/fields/periodicField/FSPeriodicField.vue +131 -0
  127. package/components/fields/periodicField/FSPeriodicMonthlyField.vue +222 -0
  128. package/components/fields/periodicField/FSPeriodicWeeklyField.vue +120 -0
  129. package/components/fields/periodicField/FSPeriodicYearlyField.vue +144 -0
  130. package/components/lists/FSDataIteratorItem.vue +8 -10
  131. package/components/lists/FSDataTableUI.vue +47 -39
  132. package/components/lists/FSFilterButton.vue +20 -22
  133. package/components/lists/FSHiddenButton.vue +10 -12
  134. package/components/lists/FSLoadDataTable.vue +4 -6
  135. package/components/lists/FSSimpleList.vue +229 -0
  136. package/components/map/FSMap.vue +256 -405
  137. package/components/map/FSMapFeatureGroup.vue +51 -0
  138. package/components/map/FSMapLayerButton.vue +6 -3
  139. package/components/map/FSMapMarker.vue +116 -0
  140. package/components/map/FSMapMarkerClusterGroup.vue +72 -0
  141. package/components/map/FSMapOverlay.vue +69 -83
  142. package/components/map/FSMapPolygon.vue +81 -0
  143. package/components/map/FSMapTileLayer.vue +50 -0
  144. package/components/map/keys.ts +4 -0
  145. package/components/selects/FSSelectAutoRefresh.vue +1 -1
  146. package/components/selects/FSSelectDashboardVariableType.vue +1 -1
  147. package/components/selects/FSSelectDateSetting.vue +3 -3
  148. package/components/selects/FSSelectDays.vue +1 -1
  149. package/components/selects/FSSelectListMode.vue +51 -0
  150. package/components/selects/FSSelectMonths.vue +67 -0
  151. package/components/tiles/FSChartTileUI.vue +116 -0
  152. package/components/tiles/FSCommentTileUI.vue +149 -0
  153. package/components/tiles/FSDashboardOrganisationTileUI.vue +6 -8
  154. package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +6 -8
  155. package/components/tiles/FSDashboardShallowTileUI.vue +6 -8
  156. package/components/tiles/FSDeviceOrganisationTileUI.vue +30 -18
  157. package/components/tiles/FSFolderTileUI.vue +6 -6
  158. package/components/tiles/FSGroupTileUI.vue +31 -22
  159. package/components/tiles/FSLoadTile.vue +5 -7
  160. package/components/tiles/FSLocationTileUI.vue +157 -0
  161. package/components/tiles/FSModelTileUI.vue +18 -0
  162. package/components/tiles/FSServiceAccountOrganisationTileUI.vue +142 -0
  163. package/components/tiles/FSSimpleTileUI.vue +57 -36
  164. package/components/tiles/FSTile.vue +115 -55
  165. package/components/tiles/FSUserOrganisationTileUI.vue +25 -35
  166. package/components/toggleSets/FSToggleSetPosition.vue +1 -1
  167. package/components/views/FSEntityHeader.vue +343 -0
  168. package/components/views/FSEntityView.vue +163 -0
  169. package/components/views/FSListHeader.vue +83 -0
  170. package/components/views/FSListView.vue +83 -0
  171. package/components/views/FSSkeletonView.vue +100 -0
  172. package/composables/useAddress.ts +2 -2
  173. package/composables/useColors.ts +15 -5
  174. package/composables/useMagicFieldProvider.ts +7 -6
  175. package/composables/useSlots.ts +34 -30
  176. package/models/agenda.ts +9 -0
  177. package/models/deviceAlerts.ts +1 -1
  178. package/models/deviceConnectivities.ts +1 -1
  179. package/models/index.ts +1 -0
  180. package/models/magicFields.ts +1 -0
  181. package/models/map.ts +2 -2
  182. package/models/rules.ts +10 -5
  183. package/models/tables.ts +3 -1
  184. package/package.json +4 -4
  185. package/styles/components/fs_agenda.scss +32 -0
  186. package/styles/components/fs_agenda_event.scss +41 -0
  187. package/styles/components/fs_agenda_hours_col.scss +4 -0
  188. package/styles/components/fs_agenda_hours_row.scss +13 -0
  189. package/styles/components/fs_agenda_time_line_marker.scss +19 -0
  190. package/styles/components/fs_card.scss +0 -1
  191. package/styles/components/fs_clickable.scss +5 -3
  192. package/styles/components/fs_color_field.scss +1 -0
  193. package/styles/components/fs_data_table.scss +2 -0
  194. package/styles/components/fs_dialog.scss +11 -15
  195. package/styles/components/fs_edit_image.scss +8 -0
  196. package/styles/components/fs_fade_out.scss +2 -1
  197. package/styles/components/fs_filter_button.scss +1 -6
  198. package/styles/components/fs_gradient_field.scss +11 -11
  199. package/styles/components/fs_magic_config_field.scss +2 -2
  200. package/styles/components/fs_map.scss +36 -30
  201. package/styles/components/fs_option_group.scss +15 -5
  202. package/styles/components/fs_radio.scss +11 -0
  203. package/styles/components/fs_rich_text_field.scss +2 -1
  204. package/styles/components/fs_search_field.scss +3 -0
  205. package/styles/components/fs_select_date_settings.scss +3 -0
  206. package/styles/components/fs_slide_group.scss +5 -0
  207. package/styles/components/fs_span.scss +2 -1
  208. package/styles/components/fs_switch.scss +1 -0
  209. package/styles/components/fs_tabs.scss +9 -0
  210. package/styles/components/fs_text_area.scss +15 -1
  211. package/styles/components/fs_tile.scss +22 -6
  212. package/styles/components/fs_window.scss +5 -0
  213. package/styles/components/fs_wrap_group.scss +4 -0
  214. package/styles/components/index.scss +6 -1
  215. package/styles/globals/overrides.scss +22 -19
  216. package/styles/globals/text_fonts.scss +17 -55
  217. package/tools/alertsTools.ts +54 -0
  218. package/tools/chartsTools.ts +300 -0
  219. package/tools/index.ts +2 -0
  220. package/utils/badge.ts +9 -0
  221. package/utils/filter.ts +18 -0
  222. package/utils/index.ts +2 -0
  223. package/utils/leafletMarkers.ts +8 -2
  224. package/utils/statuses.ts +1 -1
  225. package/utils/time.ts +27 -1
  226. package/components/autocompletes/FSAutocompleteTag.vue +0 -138
  227. package/components/map/FSMapEditPointAddressOverlay.vue +0 -164
  228. package/styles/components/fs_map_overlay.scss +0 -38
@@ -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>
@@ -0,0 +1,200 @@
1
+ <template>
2
+ <FSRow
3
+ class="fs-day-agenda"
4
+ height="100%"
5
+ padding="8px 0 0 0"
6
+ :wrap="false"
7
+ gap="0px"
8
+ :style="style"
9
+ >
10
+ <FSLoader
11
+ v-if="$props.loading"
12
+ width="100%"
13
+ height="100%"
14
+ />
15
+ <FSRow
16
+ v-else
17
+ height="100%"
18
+ gap="0"
19
+ :wrap="false"
20
+ >
21
+ <FSAgendaHoursCol
22
+ :displayNow="$props.nowIsInSelectedRange"
23
+ :modelValue="nowHour"
24
+ />
25
+ <FSCol
26
+ height="100%"
27
+ width="fill"
28
+ class="fs-agenda-body"
29
+ gap="0"
30
+ >
31
+ <span
32
+ v-for="hour in 24"
33
+ class="fs-day-agenda-hour-line"
34
+ :key="hour"
35
+ />
36
+ <FSCol
37
+ style="position: absolute;"
38
+ height="100%"
39
+ padding="0 0 0 3px"
40
+ width="calc(100% - 32px)"
41
+ >
42
+ <slot />
43
+ <FSCol
44
+ style="position: relative;"
45
+ height="100%"
46
+ >
47
+ <FSAgendaVerticalEvent
48
+ v-for="event in dayEvents"
49
+ :key="event.id"
50
+ :variant="event.end < now ? 'past' : event.start > now ? 'future' : 'current'"
51
+ :now="now"
52
+ :dayStart="$props.start"
53
+ :label="event.label"
54
+ :start="event.start"
55
+ :end="event.end"
56
+ :icon="event.icon"
57
+ :iconBis="event.iconBis"
58
+ :id="event.id"
59
+ :color="event.color"
60
+ @click="() => $emit('click:eventId', event.id)"
61
+ >
62
+ <template
63
+ #default="{ label, icon, timeStart, timeEnd, iconBis }"
64
+ >
65
+ <FSCol>
66
+ <FSRow
67
+ class="fs-agenda-event-day-label-container"
68
+ align="center-left"
69
+ gap="4px"
70
+ :wrap="false"
71
+ >
72
+ <FSCol
73
+ height="hug"
74
+ width="fill"
75
+ align="center-left"
76
+ padding="8px 8px 0 8px"
77
+ >
78
+ <FSSpan>
79
+ {{ `${timeStart} - ${timeEnd}` }}
80
+ </FSSpan>
81
+ <FSRow
82
+ align="center-left"
83
+ :wrap="false"
84
+ >
85
+ <FSIcon
86
+ v-if="icon"
87
+ :icon="icon"
88
+ />
89
+ <FSSpan
90
+ font="text-button"
91
+ >
92
+ {{ label }}
93
+ </FSSpan>
94
+ </FSRow>
95
+ </FSCol>
96
+ <FSCol
97
+ v-if="iconBis"
98
+ align="center-right"
99
+ padding="8px 8px 8px 0"
100
+ width="hug"
101
+ >
102
+ <FSIcon
103
+ v-if="iconBis"
104
+ :icon="iconBis"
105
+ />
106
+ </FSCol>
107
+ </FSRow>
108
+ </FSCol>
109
+ </template>
110
+ </FSAgendaVerticalEvent>
111
+ </FSCol>
112
+ </FSCol>
113
+ </FSCol>
114
+ </FSRow>
115
+ </FSRow>
116
+ </template>
117
+
118
+ <script lang="ts">
119
+ import { defineComponent, type PropType, computed, type StyleValue } from 'vue';
120
+
121
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
122
+ import { ColorEnum, type FSAgendaEvent } from "@dative-gpi/foundation-shared-components/models";
123
+
124
+ import FSCol from '../FSCol.vue';
125
+ import FSRow from '../FSRow.vue';
126
+ import FSAgendaHoursCol from './FSAgendaHoursCol.vue';
127
+ import FSAgendaVerticalEvent from './FSAgendaVerticalEvent.vue';
128
+ import FSIcon from '../FSIcon.vue';
129
+ import FSSpan from '../FSSpan.vue';
130
+ import FSLoader from '../FSLoader.vue';
131
+
132
+ export default defineComponent({
133
+ name: 'FSDayAgenda',
134
+ components: {
135
+ FSAgendaHoursCol,
136
+ FSAgendaVerticalEvent,
137
+ FSCol,
138
+ FSIcon,
139
+ FSLoader,
140
+ FSRow,
141
+ FSSpan
142
+ },
143
+ props: {
144
+ now: {
145
+ type: Number,
146
+ required: true
147
+ },
148
+ start: {
149
+ type: Number,
150
+ required: true
151
+ },
152
+ end: {
153
+ type: Number,
154
+ required: true
155
+ },
156
+ firstColumnWidth: {
157
+ type: String,
158
+ required: true
159
+ },
160
+ loading: {
161
+ type: Boolean,
162
+ default: false
163
+ },
164
+ events: {
165
+ type: Array as PropType<FSAgendaEvent[]>,
166
+ default: () => []
167
+ },
168
+ nowIsInSelectedRange: {
169
+ type: Boolean,
170
+ required: true
171
+ },
172
+ },
173
+ emits: ['click:eventId'],
174
+ setup(props) {
175
+ const { getColors } = useColors();
176
+
177
+ const lightColors = getColors(ColorEnum.Light);
178
+
179
+ const nowHour = computed(() => new Date(props.now).getHours());
180
+
181
+ const dayEvents = computed(() => {
182
+ return props.events.filter((event) => {
183
+ return event.start < props.end && event.end > props.start;
184
+ });
185
+ });
186
+
187
+ const style = computed((): StyleValue => {
188
+ return {
189
+ '--fs-day-agenda-hour-line-color': lightColors.light,
190
+ };
191
+ });
192
+
193
+ return {
194
+ dayEvents,
195
+ nowHour,
196
+ style
197
+ };
198
+ },
199
+ });
200
+ </script>
@@ -0,0 +1,257 @@
1
+ <template>
2
+ <FSCol
3
+ class="fs-agenda-month-container"
4
+ height="100%"
5
+ width="100%"
6
+ gap="0"
7
+ >
8
+ <FSRow
9
+ gap="0"
10
+ :wrap="false"
11
+ >
12
+ <FSCol
13
+ height="100%"
14
+ :width="$props.firstColumnWidth"
15
+ >
16
+ </FSCol>
17
+
18
+ <FSAgendaHoursRow
19
+ :displayNow="$props.nowIsInSelectedRange"
20
+ :modelValue="nowHour"
21
+ />
22
+ </FSRow>
23
+ <FSRow
24
+ class="fs-agenda-month"
25
+ :style="style"
26
+ height="100%"
27
+ :wrap="false"
28
+ gap="0px"
29
+ >
30
+ <FSCol
31
+ class="fs-agenda-label-day-container"
32
+ height="100%"
33
+ gap="0"
34
+ :width="$props.firstColumnWidth"
35
+ >
36
+ <FSCol
37
+ v-for="day in monthDays"
38
+ class="fs-agenda-label-day"
39
+ :style="getDayLabelStyle(day.isNowDay)"
40
+ :key="day.dayNumber"
41
+ height="100%"
42
+ width="100%"
43
+ align="center-center"
44
+ >
45
+ <FSCard
46
+ height="100%"
47
+ width="100%"
48
+ :borderRadius="0"
49
+ :border="false"
50
+ variant="standard"
51
+ :color="day.isNowDay ? 'primary' : 'background'"
52
+ >
53
+ <FSCol
54
+ align="center-center"
55
+ >
56
+ <FSSpan
57
+ :color="day.isNowDay ? 'primary' : 'dark'"
58
+ font="text-overline"
59
+ >
60
+ {{ day.dayNumber }}
61
+ </FSSpan>
62
+ </FSCol>
63
+ </FSCard>
64
+ </FSCol>
65
+ </FSCol>
66
+ <FSCol
67
+ class="fs-agenda-body"
68
+ gap="0"
69
+ height="100%"
70
+ width="100%"
71
+ >
72
+ <slot />
73
+ <template
74
+ v-if="loading"
75
+ >
76
+ <FSLoader
77
+ height="100%"
78
+ width="100%"
79
+ padding="2px"
80
+ />
81
+ </template>
82
+ <template
83
+ v-else
84
+ >
85
+ <FSRow
86
+ v-for="day in monthDays"
87
+ :key="day.dayNumber"
88
+ class="fs-agenda-row-day"
89
+ height="100%"
90
+ width="fill"
91
+ align="center-left"
92
+ >
93
+ <FSAgendaHorizontalEvent
94
+ v-for="event in getDayEvents(day.dayStartEpoch)"
95
+ :key="event.id"
96
+ :now="$props.now"
97
+ :variant="event.end < now ? 'past' : event.start > now ? 'future' : 'current'"
98
+ :dayStart="day.dayStartEpoch"
99
+ :label="event.label"
100
+ :start="event.start"
101
+ :end="event.end"
102
+ :icon="event.icon"
103
+ :id="event.id"
104
+ :color="event.color"
105
+ @click="() => $emit('click:eventId', event.id)"
106
+ >
107
+ <template
108
+ #default="{ label, icon }"
109
+ >
110
+ <FSRow
111
+ align="center-left"
112
+ :wrap="false"
113
+ padding="0 0 0 4px"
114
+ gap="4px"
115
+ >
116
+ <FSIcon
117
+ v-if="icon"
118
+ :icon="icon"
119
+ size="16px"
120
+ />
121
+ <FSSpan
122
+ font="text-overline"
123
+ >
124
+ {{ label }}
125
+ </FSSpan>
126
+ </FSRow>
127
+ </template>
128
+ </FSAgendaHorizontalEvent>
129
+ </FSRow>
130
+ </template>
131
+ </FSCol>
132
+ </FSRow>
133
+ </FSCol>
134
+ </template>
135
+
136
+ <script lang="ts">
137
+ import { defineComponent, computed, type PropType, type StyleValue } from 'vue';
138
+
139
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
140
+ import { ColorEnum, type FSAgendaEvent } from "@dative-gpi/foundation-shared-components/models";
141
+
142
+ import FSAgendaHorizontalEvent from './FSAgendaHorizontalEvent.vue';
143
+ import FSAgendaHoursRow from './FSAgendaHoursRow.vue';
144
+ import FSCol from '../FSCol.vue';
145
+ import FSRow from '../FSRow.vue';
146
+ import FSLoader from '../FSLoader.vue';
147
+ import FSIcon from '../FSIcon.vue';
148
+ import FSSpan from '../FSSpan.vue';
149
+ import FSCard from '../FSCard.vue';
150
+
151
+ export default defineComponent({
152
+ name: 'FSMonthAgenda',
153
+ components: {
154
+ FSAgendaHorizontalEvent,
155
+ FSAgendaHoursRow,
156
+ FSCard,
157
+ FSCol,
158
+ FSIcon,
159
+ FSLoader,
160
+ FSRow,
161
+ FSSpan
162
+ },
163
+ props: {
164
+ now: {
165
+ type: Number,
166
+ required: true
167
+ },
168
+ start: {
169
+ type: Number,
170
+ required: true
171
+ },
172
+ end: {
173
+ type: Number,
174
+ required: true
175
+ },
176
+ nowIsInSelectedRange: {
177
+ type: Boolean,
178
+ required: true
179
+ },
180
+ firstColumnWidth: {
181
+ type: String,
182
+ required: true
183
+ },
184
+ loading: {
185
+ type: Boolean,
186
+ default: false
187
+ },
188
+ events: {
189
+ type: Array as PropType<FSAgendaEvent[]>,
190
+ default: () => []
191
+ }
192
+ },
193
+ emits: ['update:start', 'update:end', 'click:eventId'],
194
+ setup(props) {
195
+ const { getColors } = useColors();
196
+
197
+ const primaryColors = getColors(ColorEnum.Primary);
198
+ const lightColors = getColors(ColorEnum.Light);
199
+
200
+ const nowHour = computed(() => new Date(props.now).getHours());
201
+
202
+ const monthDays = computed(() => {
203
+ const monthDaysArray = [];
204
+ const nowDate = new Date(props.now);
205
+
206
+ let currentDay = new Date(props.start);
207
+ const endDate = new Date(props.end);
208
+
209
+ while (currentDay <= endDate) {
210
+ monthDaysArray.push({
211
+ dayNumber: currentDay.getDate(),
212
+ dayStartEpoch: currentDay.getTime(),
213
+ isNowDay: currentDay.toDateString() === nowDate.toDateString(),
214
+ });
215
+
216
+ currentDay.setDate(currentDay.getDate() + 1);
217
+ }
218
+
219
+ return monthDaysArray;
220
+ });
221
+
222
+ const style = computed((): StyleValue => {
223
+ return {
224
+ '--fs-agenda-row-day-border-bottom-color': lightColors.base,
225
+ };
226
+ });
227
+
228
+ const getDayLabelStyle = (isNowDay: boolean = false) => {
229
+ if (isNowDay) {
230
+ return {
231
+ '--fs-agenda-label-day-border-bottom-color': primaryColors.base,
232
+ '--fs-agenda-label-day-border-right-color': lightColors.base,
233
+ };
234
+ }
235
+ return {
236
+ '--fs-agenda-label-day-border-bottom-color': lightColors.base,
237
+ '--fs-agenda-label-day-border-right-color': lightColors.base,
238
+ };
239
+ };
240
+
241
+ const getDayEvents = (dayStartEpoch: number) => {
242
+ return props.events.filter((event) => {
243
+ const dayEndEpoch = dayStartEpoch + 1000 * 60 * 60 * 24;
244
+ return event.start < dayEndEpoch && event.end > dayStartEpoch;
245
+ });
246
+ };
247
+
248
+ return {
249
+ nowHour,
250
+ monthDays,
251
+ style,
252
+ getDayEvents,
253
+ getDayLabelStyle
254
+ };
255
+ },
256
+ });
257
+ </script>
@@ -0,0 +1,54 @@
1
+ <template>
2
+ <FSSelectField
3
+ :items="items"
4
+ :modelValue="$props.modelValue"
5
+ :clearable="false"
6
+ v-bind="$attrs"
7
+ @update:modelValue="$emit('update:modelValue', $event)"
8
+ >
9
+ <template
10
+ #item-prepend="{ item }"
11
+ >
12
+ <FSIcon
13
+ :icon="item.icon"
14
+ />
15
+ </template>
16
+ </FSSelectField>
17
+ </template>
18
+
19
+ <script lang="ts">
20
+ import { defineComponent, type PropType } from 'vue';
21
+
22
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
23
+ import { AgendaMode } from '@dative-gpi/foundation-shared-domain/enums/agendas';
24
+
25
+ import FSSelectField from '../fields/FSSelectField.vue';
26
+ import FSIcon from '../FSIcon.vue';
27
+
28
+ export default defineComponent({
29
+ name: 'FSSelectAgendaMode',
30
+ components: {
31
+ FSIcon,
32
+ FSSelectField
33
+ },
34
+ props: {
35
+ modelValue: {
36
+ type: Number as PropType<AgendaMode>,
37
+ default: AgendaMode.Week,
38
+ },
39
+ },
40
+ emits: ['update:modelValue'],
41
+ setup() {
42
+ const { $tr } = useTranslationsProvider();
43
+
44
+ const items = [
45
+ { id: AgendaMode.Week, label: $tr('ui.agenda.week', 'Week'), icon: 'mdi-calendar-week' },
46
+ { id: AgendaMode.Month, label: $tr('ui.agenda.month', 'Month'), icon: 'mdi-calendar-month' },
47
+ ];
48
+
49
+ return {
50
+ items
51
+ };
52
+ }
53
+ });
54
+ </script>