@dative-gpi/foundation-shared-components 1.0.69 → 1.0.71-groupings-2

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 (296) hide show
  1. package/assets/images/map/snow.png +0 -0
  2. package/components/FSAccordionPanel.vue +40 -21
  3. package/components/FSBreadcrumbs.vue +21 -12
  4. package/components/FSButton.vue +11 -9
  5. package/components/FSCalendar.vue +50 -12
  6. package/components/FSCalendarTwin.vue +95 -43
  7. package/components/FSCard.vue +61 -9
  8. package/components/FSCardPlaceholder.vue +8 -5
  9. package/components/FSCheckbox.vue +5 -4
  10. package/components/FSChip.vue +73 -45
  11. package/components/FSChipGroup.vue +69 -0
  12. package/components/FSClickable.vue +11 -9
  13. package/components/FSClock.vue +30 -12
  14. package/components/FSCol.vue +11 -5
  15. package/components/FSDialog.vue +2 -1
  16. package/components/FSDialogContent.vue +12 -11
  17. package/components/FSDialogForm.vue +22 -2
  18. package/components/FSDialogFormBody.vue +50 -31
  19. package/components/FSDialogMenu.vue +17 -8
  20. package/components/FSDialogMultiFormBody.vue +23 -13
  21. package/components/FSDialogRemove.vue +7 -8
  22. package/components/FSDialogSubmit.vue +20 -11
  23. package/components/FSEditImageUI.vue +13 -5
  24. package/components/FSFadeOut.vue +53 -21
  25. package/components/FSForm.vue +10 -8
  26. package/components/FSGrid.vue +0 -1
  27. package/components/FSIcon.vue +2 -2
  28. package/components/FSIconCard.vue +68 -12
  29. package/components/FSInformationsMenu.vue +142 -0
  30. package/components/FSInstantPicker.vue +268 -0
  31. package/components/FSLink.vue +25 -9
  32. package/components/FSLoader.vue +28 -10
  33. package/components/FSMenu.vue +47 -0
  34. package/components/FSOptionGroup.vue +8 -8
  35. package/components/FSOptionItem.vue +4 -4
  36. package/components/FSOptionsMenu.vue +165 -0
  37. package/components/FSPagination.vue +1 -1
  38. package/components/FSPlayButtons.vue +72 -0
  39. package/components/FSProgressBar.vue +94 -0
  40. package/components/FSRadio.vue +5 -4
  41. package/components/FSRadioGroup.vue +3 -3
  42. package/components/FSRangePicker.vue +275 -0
  43. package/components/FSRangeSlider.vue +84 -0
  44. package/components/FSRouterLink.vue +42 -0
  45. package/components/FSSlideGroup.vue +9 -7
  46. package/components/FSSlider.vue +44 -79
  47. package/components/FSSpan.vue +22 -8
  48. package/components/FSSwitch.vue +44 -48
  49. package/components/FSTab.vue +15 -13
  50. package/components/FSTabs.vue +5 -2
  51. package/components/FSTag.vue +3 -3
  52. package/components/FSTagGroup.vue +6 -4
  53. package/components/FSText.vue +21 -8
  54. package/components/FSToggleSet.vue +7 -7
  55. package/components/FSTreeView.vue +107 -0
  56. package/components/FSWindow.vue +122 -5
  57. package/components/agenda/FSAgenda.vue +26 -7
  58. package/components/agenda/FSAgendaDialogCalendar.vue +2 -2
  59. package/components/agenda/FSAgendaHeader.vue +35 -10
  60. package/components/agenda/FSAgendaHorizontalEvent.vue +18 -6
  61. package/components/agenda/FSAgendaHoursRow.vue +48 -8
  62. package/components/agenda/FSAgendaVerticalEvent.vue +1 -1
  63. package/components/agenda/FSDayAgenda.vue +0 -1
  64. package/components/agenda/FSMonthAgenda.vue +1 -6
  65. package/components/agenda/FSSelectAgendaMode.vue +2 -2
  66. package/components/agenda/FSWeekAgenda.vue +5 -10
  67. package/components/autocompletes/FSAutoCompleteAddress.vue +25 -20
  68. package/components/autocompletes/FSAutocompleteLanguage.vue +7 -1
  69. package/components/autocompletes/FSAutocompleteTimeZone.vue +7 -1
  70. package/components/buttons/FSButtonAdd.vue +1 -1
  71. package/components/buttons/FSButtonAddLabel.vue +1 -1
  72. package/components/buttons/FSButtonCancel.vue +1 -1
  73. package/components/buttons/FSButtonCancelLabel.vue +1 -1
  74. package/components/buttons/FSButtonCheckbox.vue +4 -4
  75. package/components/buttons/FSButtonCopy.vue +1 -1
  76. package/components/buttons/FSButtonCopyLabel.vue +1 -1
  77. package/components/buttons/FSButtonDuplicate.vue +1 -1
  78. package/components/buttons/FSButtonDuplicateLabel.vue +1 -1
  79. package/components/buttons/FSButtonEdit.vue +1 -1
  80. package/components/buttons/FSButtonEditLabel.vue +1 -1
  81. package/components/buttons/FSButtonFile.vue +1 -1
  82. package/components/buttons/FSButtonFileLabel.vue +1 -1
  83. package/components/buttons/FSButtonNext.vue +1 -1
  84. package/components/buttons/FSButtonNextLabel.vue +1 -1
  85. package/components/buttons/FSButtonPrevious.vue +1 -1
  86. package/components/buttons/FSButtonPreviousLabel.vue +1 -1
  87. package/components/buttons/FSButtonRedo.vue +1 -1
  88. package/components/buttons/FSButtonRedoLabel.vue +1 -1
  89. package/components/buttons/FSButtonRemove.vue +1 -1
  90. package/components/buttons/FSButtonRemoveLabel.vue +1 -1
  91. package/components/buttons/FSButtonSave.vue +1 -1
  92. package/components/buttons/FSButtonSaveLabel.vue +1 -1
  93. package/components/buttons/FSButtonSearch.vue +1 -1
  94. package/components/buttons/FSButtonSearchLabel.vue +1 -1
  95. package/components/buttons/FSButtonUndo.vue +1 -1
  96. package/components/buttons/FSButtonUndoLabel.vue +1 -1
  97. package/components/buttons/FSButtonUpdate.vue +1 -1
  98. package/components/buttons/FSButtonUpdateLabel.vue +1 -1
  99. package/components/buttons/FSButtonValidate.vue +1 -1
  100. package/components/buttons/FSButtonValidateLabel.vue +1 -1
  101. package/components/calendar/FSSimpleCalendar.vue +145 -0
  102. package/components/calendar/FSSimpleCalendarHeader.vue +60 -0
  103. package/components/calendar/FSSimpleMonthSelector.vue +138 -0
  104. package/components/carousels/FSCarousel.vue +23 -0
  105. package/components/carousels/FSCarouselItem.vue +14 -0
  106. package/components/deviceOrganisations/FSConnectivity.vue +5 -3
  107. package/components/deviceOrganisations/FSStatus.vue +5 -3
  108. package/components/deviceOrganisations/FSStatusCard.vue +7 -9
  109. package/components/deviceOrganisations/FSStatusRichCard.vue +171 -0
  110. package/components/deviceOrganisations/FSWorstAlert.vue +24 -36
  111. package/components/deviceOrganisations/FSWorstAlertCard.vue +8 -47
  112. package/components/fields/FSAutocompleteField.vue +85 -82
  113. package/components/fields/FSAutocompleteTag.vue +1 -1
  114. package/components/fields/FSBaseField.vue +42 -25
  115. package/components/fields/FSClosableSearchField.vue +83 -0
  116. package/components/fields/FSColorField.vue +12 -10
  117. package/components/fields/FSCommentField.vue +28 -16
  118. package/components/fields/FSDateField.vue +13 -10
  119. package/components/fields/FSDateRangeField.vue +6 -5
  120. package/components/fields/FSDateTimeField.vue +14 -11
  121. package/components/fields/FSDateTimeRangeDialog.vue +160 -0
  122. package/components/fields/FSDateTimeRangeField.vue +23 -115
  123. package/components/fields/FSEntityFieldUI.vue +19 -16
  124. package/components/fields/FSGradientField.vue +5 -5
  125. package/components/fields/FSIconField.vue +16 -9
  126. package/components/fields/FSMapAddressField.vue +187 -0
  127. package/components/fields/FSNumberField.vue +8 -4
  128. package/components/fields/FSPasswordField.vue +7 -7
  129. package/components/fields/FSPoliciesValidationField.vue +101 -0
  130. package/components/fields/FSRichTextField.vue +78 -58
  131. package/components/fields/FSSearchField.vue +9 -115
  132. package/components/fields/FSSelectField.vue +69 -71
  133. package/components/fields/FSTagField.vue +9 -9
  134. package/components/fields/FSTermField.vue +69 -46
  135. package/components/fields/FSTextArea.vue +17 -11
  136. package/components/fields/FSTextField.vue +15 -10
  137. package/components/fields/FSTimeField.vue +14 -10
  138. package/components/fields/FSTimeRangeField.vue +117 -187
  139. package/components/fields/FSTimeStepField.vue +5 -5
  140. package/components/fields/FSTranslateField.vue +10 -10
  141. package/components/fields/FSTranslateRichTextField.vue +41 -20
  142. package/components/fields/FSTranslateTextArea.vue +10 -10
  143. package/components/fields/FSTreeViewField.vue +21 -19
  144. package/components/fields/periodicField/FSPeriodicDailyField.vue +7 -7
  145. package/components/fields/periodicField/FSPeriodicField.vue +15 -15
  146. package/components/fields/periodicField/FSPeriodicMonthlyField.vue +16 -16
  147. package/components/fields/periodicField/FSPeriodicWeeklyField.vue +28 -18
  148. package/components/fields/periodicField/FSPeriodicYearlyField.vue +12 -12
  149. package/components/lists/FSDataIteratorItem.vue +23 -67
  150. package/components/lists/FSDataTableUI.vue +194 -119
  151. package/components/lists/FSFilterButton.vue +14 -16
  152. package/components/lists/FSHeaderButton.vue +11 -9
  153. package/components/lists/FSHiddenButton.vue +9 -9
  154. package/components/lists/FSLoadDataTable.vue +10 -7
  155. package/components/lists/FSSimpleList.vue +95 -88
  156. package/components/lists/FSSimpleListItem.vue +131 -0
  157. package/components/map/FSMap.vue +144 -158
  158. package/components/map/FSMapFeatureGroup.vue +7 -1
  159. package/components/map/FSMapLayerButton.vue +3 -3
  160. package/components/map/FSMapMarker.vue +103 -42
  161. package/components/map/FSMapMarkerClusterGroup.vue +32 -7
  162. package/components/map/FSMapOverlay.vue +44 -24
  163. package/components/map/FSMapPolygon.vue +16 -4
  164. package/components/map/FSMapTileLayer.vue +26 -9
  165. package/components/map/layers.ts +0 -0
  166. package/components/selects/FSSelectAutoRefresh.vue +8 -8
  167. package/components/selects/FSSelectDashboardVariableType.vue +4 -3
  168. package/components/selects/FSSelectDateSetting.vue +2 -2
  169. package/components/selects/FSSelectDays.vue +8 -8
  170. package/components/selects/FSSelectListMode.vue +2 -2
  171. package/components/selects/FSSelectMapLayer.vue +68 -0
  172. package/components/selects/FSSelectMonths.vue +13 -13
  173. package/components/selects/chartSelectors/FSAggregationSelector.vue +52 -0
  174. package/components/selects/chartSelectors/FSAxisTypeSelector.vue +49 -0
  175. package/components/selects/chartSelectors/FSDisplayAsSelector.vue +53 -0
  176. package/components/selects/chartSelectors/FSFilterTypeSelector.vue +54 -0
  177. package/components/selects/chartSelectors/FSHeatmapRuleSelector.vue +54 -0
  178. package/components/selects/chartSelectors/FSOperationOnSelector.vue +53 -0
  179. package/components/selects/chartSelectors/FSPlanningTypeSelector.vue +53 -0
  180. package/components/selects/chartSelectors/FSSelectEntityType.vue +59 -0
  181. package/components/selects/chartSelectors/FSSerieTypeSelector.vue +53 -0
  182. package/components/tiles/FSAlertTileUI.vue +90 -0
  183. package/components/tiles/FSChartTileUI.vue +61 -52
  184. package/components/tiles/FSCommentTileUI.vue +38 -13
  185. package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +14 -2
  186. package/components/tiles/FSDashboardShallowTileUI.vue +14 -2
  187. package/components/tiles/FSDeviceOrganisationTileUI.vue +0 -6
  188. package/components/tiles/FSEntityCountBadge.vue +83 -0
  189. package/components/tiles/FSFolderTileUI.vue +38 -4
  190. package/components/tiles/FSGroupTileUI.vue +32 -136
  191. package/components/tiles/FSGroupingTileUI.vue +52 -0
  192. package/components/tiles/FSLoadTile.vue +16 -10
  193. package/components/tiles/FSLocationTileUI.vue +50 -80
  194. package/components/tiles/FSServiceAccountOrganisationTileUI.vue +0 -6
  195. package/components/tiles/FSSimpleTileUI.vue +32 -27
  196. package/components/tiles/FSTile.vue +46 -39
  197. package/components/tiles/FSUserOrganisationTileUI.vue +1 -7
  198. package/components/tiles/FSUserTileUI.vue +119 -0
  199. package/components/toggleSets/FSToggleSetPosition.vue +1 -1
  200. package/components/views/FSBaseView.vue +64 -0
  201. package/components/views/FSEntityView.vue +12 -146
  202. package/components/views/FSSimpleView.vue +29 -0
  203. package/components/views/desktop/FSBaseDefaultDesktopView.vue +135 -0
  204. package/components/views/desktop/FSBaseDesktopView.vue +53 -0
  205. package/components/views/desktop/FSBaseEntityDesktopView.vue +211 -0
  206. package/components/views/mobile/FSBaseDefaultMobileView.vue +133 -0
  207. package/components/views/mobile/FSBaseEntityMobileView.vue +206 -0
  208. package/components/views/mobile/FSBaseMobileView.vue +53 -0
  209. package/composables/index.ts +1 -1
  210. package/composables/useAddress.ts +40 -8
  211. package/composables/useBreakpoints.ts +40 -4
  212. package/composables/useColors.ts +16 -7
  213. package/composables/useMapLayers.ts +69 -0
  214. package/composables/useSlots.ts +2 -1
  215. package/models/colors.ts +2 -1
  216. package/models/deviceAlerts.ts +1 -0
  217. package/models/index.ts +0 -1
  218. package/models/map.ts +12 -10
  219. package/models/rules.ts +5 -2
  220. package/models/tables.ts +2 -1
  221. package/models/variableNode.ts +8 -5
  222. package/package.json +5 -5
  223. package/styles/components/fs_agenda.scss +4 -0
  224. package/styles/components/fs_agenda_event.scss +1 -1
  225. package/styles/components/fs_agenda_hours_row.scss +0 -8
  226. package/styles/components/fs_autocomplete_field.scss +0 -13
  227. package/styles/components/fs_breadcrumbs.scss +18 -36
  228. package/styles/components/fs_button.scss +7 -5
  229. package/styles/components/fs_calendar.scss +1 -0
  230. package/styles/components/fs_card.scss +9 -0
  231. package/styles/components/fs_chip.scss +13 -7
  232. package/styles/components/fs_clickable.scss +16 -23
  233. package/styles/components/fs_clock.scss +0 -10
  234. package/styles/components/fs_col.scss +1 -1
  235. package/styles/components/fs_color_field.scss +0 -4
  236. package/styles/components/fs_data_table.scss +6 -9
  237. package/styles/components/fs_dialog.scss +4 -10
  238. package/styles/components/fs_dialog_menu.scss +4 -2
  239. package/styles/components/fs_draggable.scss +0 -5
  240. package/styles/components/fs_fade_out.scss +10 -2
  241. package/styles/components/fs_filter_button.scss +1 -1
  242. package/styles/components/fs_hidden_button.scss +2 -7
  243. package/styles/components/fs_image_card.scss +6 -4
  244. package/styles/components/fs_magic_config_field.scss +1 -2
  245. package/styles/components/fs_map.scss +57 -17
  246. package/styles/components/fs_meta_field.scss +3 -5
  247. package/styles/components/fs_password_field.scss +4 -2
  248. package/styles/components/fs_progress_bar.scss +14 -0
  249. package/styles/components/fs_radio.scss +0 -11
  250. package/styles/components/fs_rich_text_field.scss +1 -10
  251. package/styles/components/fs_select_field.scss +4 -13
  252. package/styles/components/fs_slide_group.scss +3 -1
  253. package/styles/components/fs_slider.scss +0 -40
  254. package/styles/components/fs_span.scss +17 -5
  255. package/styles/components/fs_status_rich_card.scss +6 -0
  256. package/styles/components/fs_tabs.scss +18 -37
  257. package/styles/components/fs_tag.scss +8 -22
  258. package/styles/components/fs_text_area.scss +2 -21
  259. package/styles/components/fs_tile.scss +0 -19
  260. package/styles/components/fs_window.scss +3 -1
  261. package/styles/components/fs_wrap_group.scss +3 -0
  262. package/styles/components/index.scss +2 -6
  263. package/styles/globals/index.scss +1 -5
  264. package/styles/globals/overrides.scss +26 -44
  265. package/styles/globals/scrollbars.scss +8 -0
  266. package/styles/globals/text_fonts.scss +18 -66
  267. package/styles/globals/touchscreen.scss +2 -2
  268. package/tools/alertsTools.ts +94 -18
  269. package/tools/chartsTools.ts +156 -16
  270. package/tools/index.ts +1 -0
  271. package/tools/reportsTools.ts +38 -0
  272. package/tools/timeRangeTools.ts +99 -40
  273. package/utils/badge.ts +9 -5
  274. package/utils/index.ts +2 -0
  275. package/utils/leafletMarkers.ts +4 -4
  276. package/utils/operations.ts +108 -0
  277. package/utils/picker.ts +40 -0
  278. package/utils/sort.ts +2 -2
  279. package/utils/time.ts +13 -13
  280. package/components/fields/FSMagicConfigField.vue +0 -163
  281. package/components/fields/FSMagicField.vue +0 -193
  282. package/components/fields/FSTimeSlotField.vue +0 -250
  283. package/components/views/FSEntityHeader.vue +0 -343
  284. package/components/views/FSListHeader.vue +0 -83
  285. package/components/views/FSListView.vue +0 -83
  286. package/components/views/FSSkeletonView.vue +0 -100
  287. package/composables/useMagicFieldProvider.ts +0 -23
  288. package/models/magicFields.ts +0 -10
  289. package/styles/components/fs_data_iterator_item.scss +0 -33
  290. package/styles/components/fs_icon_field.scss +0 -12
  291. package/styles/components/fs_search_field.scss +0 -3
  292. package/styles/components/fs_tag_field.scss +0 -8
  293. package/styles/components/fs_time_field.scss +0 -12
  294. package/styles/components/fs_timeslot_field.scss +0 -12
  295. package/styles/globals/breakpoints.scss +0 -20
  296. package/styles/globals/fixes.scss +0 -5
Binary file
@@ -6,32 +6,47 @@
6
6
  :disabled="false"
7
7
  :elevation="0"
8
8
  :style="style"
9
+ :hideActions="$props.actionPosition === 'start'"
9
10
  v-bind="$attrs"
10
11
  >
11
- <template
12
- #title
13
- >
14
- <slot
15
- name="title"
12
+ <v-expansion-panel-title>
13
+ <template
14
+ v-slot:default="{ expanded, collapseIcon, expandIcon }"
16
15
  >
17
- <FSRow>
18
- <FSIcon
19
- v-if="$props.prependIcon"
16
+ <FSRow
17
+ gap="4px"
18
+ >
19
+ <FSCol
20
+ v-if="$props.actionPosition === 'start'"
21
+ width="hug"
22
+ align="center-center"
20
23
  >
21
- {{ $props.prependIcon }}
22
- </FSIcon>
23
- <FSSpan
24
- class="fs-accordion-panel-title"
25
- :lineClamp="$props.lineClampTitle"
24
+ <FSIcon
25
+ size="22.5px"
26
+ :icon="expanded ? collapseIcon : expandIcon"
27
+ />
28
+ </FSCol>
29
+ <slot
30
+ name="title"
26
31
  >
27
- {{ $props.title }}
28
- </FSSpan>
32
+ <FSRow>
33
+ <FSIcon
34
+ v-if="$props.prependIcon"
35
+ >
36
+ {{ $props.prependIcon }}
37
+ </FSIcon>
38
+ <FSSpan
39
+ class="fs-accordion-panel-title"
40
+ :lineClamp="$props.lineClampTitle"
41
+ >
42
+ {{ $props.title }}
43
+ </FSSpan>
44
+ </FSRow>
45
+ </slot>
29
46
  </FSRow>
30
- </slot>
31
- </template>
32
- <template
33
- #text
34
- >
47
+ </template>
48
+ </v-expansion-panel-title>
49
+ <v-expansion-panel-text>
35
50
  <slot
36
51
  name="content"
37
52
  >
@@ -47,7 +62,7 @@
47
62
  :modelValue="$props.content"
48
63
  />
49
64
  </slot>
50
- </template>
65
+ </v-expansion-panel-text>
51
66
  </v-expansion-panel>
52
67
  </template>
53
68
 
@@ -128,6 +143,10 @@ export default defineComponent({
128
143
  type: String as PropType<"standard" | "rich-text">,
129
144
  required: false,
130
145
  default: "standard"
146
+ },
147
+ actionPosition: {
148
+ type: String as () => "start" | "end",
149
+ default: "end"
131
150
  }
132
151
  },
133
152
  setup(props) {
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <v-breadcrumbs
3
- :items="$props.items"
3
+ class="fs-breadcrumbs"
4
+ :items="items"
4
5
  :style="style"
5
6
  v-bind="$attrs"
6
7
  >
@@ -8,7 +9,7 @@
8
9
  #title="{ item }"
9
10
  >
10
11
  <FSSpan
11
- :class="classes(item)"
12
+ class="fs-breadcrumbs-label"
12
13
  >
13
14
  {{ item.title }}
14
15
  </FSSpan>
@@ -30,7 +31,9 @@
30
31
  import { computed, defineComponent, type PropType, type StyleValue } from "vue";
31
32
 
32
33
  import { ColorEnum, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
33
- import { useColors } from "@dative-gpi/foundation-shared-components/composables";
34
+ import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
35
+
36
+ import { sizeToVar } from "../utils";
34
37
 
35
38
  import FSSpan from "./FSSpan.vue";
36
39
  import FSIcon from "./FSIcon.vue";
@@ -48,28 +51,34 @@ export default defineComponent({
48
51
  default: () => []
49
52
  }
50
53
  },
51
- setup() {
54
+ setup(props) {
55
+ const { isExtraSmall } = useBreakpoints();
52
56
  const { getColors } = useColors();
53
57
 
54
58
  const darks = getColors(ColorEnum.Dark);
55
59
 
56
60
  const style = computed((): StyleValue => ({
61
+ "--fs-breadcrumbs-height" : sizeToVar(["20px", "16px"]),
57
62
  "--fs-breadcrumbs-color" : darks.dark,
58
63
  "--fs-breadcrumbs-active-color" : darks.base,
59
64
  "--fs-breadcrumbs-disabled-color": darks.soft
60
65
  }));
61
66
 
62
- const classes = (item: FSBreadcrumbItem): string[] => {
63
- const classNames = ["fs-breadcrumbs-label"];
64
- if (item.disabled) {
65
- classNames.push("fs-breadcrumbs-label-disabled");
67
+ const items = computed((): FSBreadcrumbItem[] => {
68
+ if (isExtraSmall.value && props.items.length > 3) {
69
+ const mobileItems: FSBreadcrumbItem[] = [0, -2, -1].map((index) => props.items.at(index)!)
70
+ mobileItems.splice(1, 0, {
71
+ title : "...",
72
+ disabled : true
73
+ });
74
+ return mobileItems;
66
75
  }
67
- return classNames;
68
- };
76
+ return props.items;
77
+ });
69
78
 
70
79
  return {
71
- style,
72
- classes
80
+ items,
81
+ style
73
82
  };
74
83
  }
75
84
  });
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <FSClickable
3
3
  v-if="$props.variant !== 'icon'"
4
- :editable="$props.editable"
4
+ :disabled="$props.disabled"
5
5
  :padding="padding"
6
6
  :variant="$props.variant"
7
7
  :color="$props.color"
@@ -129,7 +129,7 @@
129
129
  <template
130
130
  v-else-if="$props.to"
131
131
  >
132
- <router-link
132
+ <FSRouterLink
133
133
  :to="$props.to"
134
134
  >
135
135
  <FSIcon
@@ -143,7 +143,7 @@
143
143
  >
144
144
  {{ $props.label }}
145
145
  </FSSpan>
146
- </router-link>
146
+ </FSRouterLink>
147
147
  </template>
148
148
  <template
149
149
  v-else
@@ -170,6 +170,7 @@ import { type RouteLocation } from "vue-router";
170
170
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
171
171
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
172
172
 
173
+ import FSRouterLink from "./FSRouterLink.vue";
173
174
  import FSClickable from "./FSClickable.vue";
174
175
  import FSSpan from "./FSSpan.vue";
175
176
  import FSIcon from "./FSIcon.vue";
@@ -185,6 +186,7 @@ const DEFAULT_PADDING = PADDING_ICON_LABEL;
185
186
  export default defineComponent({
186
187
  name: "FSButton",
187
188
  components: {
189
+ FSRouterLink,
188
190
  FSClickable,
189
191
  FSSpan,
190
192
  FSIcon,
@@ -198,7 +200,7 @@ export default defineComponent({
198
200
  default: DEFAULT_PADDING
199
201
  },
200
202
  to: {
201
- type: [String, Object] as PropType<string | RouteLocation | null>,
203
+ type: Object as PropType<RouteLocation | null>,
202
204
  required: false,
203
205
  default: null
204
206
  },
@@ -252,10 +254,10 @@ export default defineComponent({
252
254
  required: false,
253
255
  default: false
254
256
  },
255
- editable: {
257
+ disabled: {
256
258
  type: Boolean,
257
259
  required: false,
258
- default: true
260
+ default: false
259
261
  }
260
262
  },
261
263
  emits: ["click"],
@@ -268,7 +270,7 @@ export default defineComponent({
268
270
  const slots = useSlots();
269
271
 
270
272
  const style = computed((): StyleValue => {
271
- if (!props.editable) {
273
+ if (props.disabled) {
272
274
  switch (props.variant) {
273
275
  case "icon": return {
274
276
  "--fs-button-color": lights.dark,
@@ -293,7 +295,7 @@ export default defineComponent({
293
295
 
294
296
  const iconClasses = computed((): string[] => {
295
297
  const classNames = ["fs-button-icon"];
296
- if (!props.editable) {
298
+ if (props.disabled) {
297
299
  classNames.push("fs-button-disabled");
298
300
  }
299
301
  return classNames;
@@ -329,7 +331,7 @@ export default defineComponent({
329
331
  });
330
332
 
331
333
  const onClick = (event: MouseEvent) => {
332
- if (!props.to && !props.href && props.editable && !props.load) {
334
+ if (!props.to && !props.href && !props.disabled && !props.load) {
333
335
  emit("click", event);
334
336
  }
335
337
  };
@@ -3,13 +3,20 @@
3
3
  width="hug"
4
4
  >
5
5
  <FSRow>
6
- <FSSpan
7
- v-if="$props.label"
8
- class="fs-calendar-label"
9
- font="text-overline"
6
+ <FSSelectField
7
+ :hideHeader="true"
8
+ :clearable="false"
9
+ :items="years"
10
+ v-model="innerYear"
11
+ />
12
+ <FSRow
13
+ align="center-right"
10
14
  >
11
- {{ $props.label }}
12
- </FSSpan>
15
+ <FSButton
16
+ :label="$tr('ui.common.today', 'Today')"
17
+ @click="onClickToday"
18
+ />
19
+ </FSRow>
13
20
  </FSRow>
14
21
  <FSCol
15
22
  class="fs-calendar"
@@ -71,6 +78,7 @@ import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared
71
78
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
72
79
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
73
80
 
81
+ import FSSelectField from "./fields/FSSelectField.vue";
74
82
  import FSButton from "./FSButton.vue";
75
83
  import FSSpan from "./FSSpan.vue";
76
84
  import FSCol from "./FSCol.vue";
@@ -79,17 +87,13 @@ import FSRow from "./FSRow.vue";
79
87
  export default defineComponent({
80
88
  name: "FSCalendar",
81
89
  components: {
90
+ FSSelectField,
82
91
  FSButton,
83
92
  FSSpan,
84
93
  FSCol,
85
94
  FSRow
86
95
  },
87
96
  props: {
88
- label: {
89
- type: String as PropType<string | null>,
90
- required: false,
91
- default: null
92
- },
93
97
  modelValue: {
94
98
  type: Number as PropType<number | null>,
95
99
  required: false,
@@ -117,13 +121,14 @@ export default defineComponent({
117
121
 
118
122
  const colors = computed(() => getColors(props.color));
119
123
  const backgrounds = getColors(ColorEnum.Background);
124
+ const lights = getColors(ColorEnum.Light);
120
125
  const darks = getColors(ColorEnum.Dark);
121
126
 
122
127
  const style = computed((): StyleValue => ({
123
128
  "--fs-calendar-background-color" : backgrounds.base,
124
129
  "--fs-calendar-hover-background-color" : colors.value.light,
125
130
  "--fs-calendar-active-background-color": colors.value.base,
126
- "--fs-calendar-border-color" : darks.base,
131
+ "--fs-calendar-border-color" : lights.dark,
127
132
  "--fs-calendar-hover-border-color" : colors.value.base,
128
133
  "--fs-calendar-active-border-color" : colors.value.base,
129
134
  "--fs-calendar-color" : darks.base,
@@ -138,6 +143,28 @@ export default defineComponent({
138
143
  return new Intl.DateTimeFormat(languageCode.value, { month: "long", year: "numeric" }).format(date);
139
144
  });
140
145
 
146
+ const years = computed((): any[] => {
147
+ const years = [];
148
+ switch (props.limit) {
149
+ case "past":
150
+ for (let i = 1900; i < new Date().getFullYear(); i++) {
151
+ years.push({ label: i.toString(), id: i });
152
+ }
153
+ break;
154
+ case "future":
155
+ for (let i = new Date().getFullYear(); i < 2100; i++) {
156
+ years.push({ label: i.toString(), id: i });
157
+ }
158
+ break;
159
+ default:
160
+ for (let i = 1900; i < 2100; i++) {
161
+ years.push({ label: i.toString(), id: i });
162
+ }
163
+ break;
164
+ }
165
+ return years;
166
+ });
167
+
141
168
  const onClickPrevious = (): void => {
142
169
  if (innerMonth.value > 0) {
143
170
  innerMonth.value--;
@@ -165,6 +192,15 @@ export default defineComponent({
165
192
  emit("update:modelValue", pickerToEpoch(value[0]));
166
193
  };
167
194
 
195
+ const onClickToday = (): void => {
196
+ const today = new Date();
197
+ innerMonth.value = today.getMonth();
198
+ innerYear.value = today.getFullYear();
199
+
200
+ today.setHours(0, 0, 0, 0);
201
+ emit("update:modelValue", pickerToEpoch(today));
202
+ };
203
+
168
204
  const allowedDates = (value: unknown): boolean => {
169
205
  if (!(value instanceof Date)) {
170
206
  return false;
@@ -190,11 +226,13 @@ export default defineComponent({
190
226
  text,
191
227
  innerMonth,
192
228
  innerYear,
229
+ years,
193
230
  epochToPicker,
194
231
  pickerToEpoch,
195
232
  onClickPrevious,
196
233
  onClickNext,
197
234
  onClickDate,
235
+ onClickToday,
198
236
  allowedDates
199
237
  };
200
238
  }
@@ -1,22 +1,25 @@
1
1
  <template>
2
- <FSCol
3
- width="hug"
4
- >
5
- <FSRow
6
- v-if="$props.label"
7
- >
8
- <FSSpan
9
- class="fs-calendar-label"
10
- font="text-overline"
2
+ <FSCol>
3
+ <FSRow>
4
+ <FSSelectField
5
+ :hideHeader="true"
6
+ :clearable="false"
7
+ :items="years"
8
+ :modelValue="innerLeftYear"
9
+ @update:modelValue="onChangeYear"
10
+ />
11
+ <FSRow
12
+ align="center-right"
11
13
  >
12
- {{ $props.label }}
13
- </FSSpan>
14
+ <FSButton
15
+ :label="$tr('ui.common.today', 'Today')"
16
+ @click="onClickToday"
17
+ />
18
+ </FSRow>
14
19
  </FSRow>
15
20
  <FSRow
16
21
  class="fs-calendar-twin"
17
22
  align="top-center"
18
- width="hug"
19
- :height="['380px', '375px']"
20
23
  :style="style"
21
24
  >
22
25
  <FSCol
@@ -118,6 +121,7 @@ import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared
118
121
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
119
122
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
120
123
 
124
+ import FSSelectField from "./fields/FSSelectField.vue";
121
125
  import FSButton from "./FSButton.vue";
122
126
  import FSSpan from "./FSSpan.vue";
123
127
  import FSCol from "./FSCol.vue";
@@ -126,17 +130,13 @@ import FSRow from "./FSRow.vue";
126
130
  export default defineComponent({
127
131
  name: "FSCalendarTwin",
128
132
  components: {
133
+ FSSelectField,
129
134
  FSButton,
130
135
  FSSpan,
131
136
  FSCol,
132
137
  FSRow
133
138
  },
134
139
  props: {
135
- label: {
136
- type: String as PropType<string | null>,
137
- required: false,
138
- default: null
139
- },
140
140
  modelValue: {
141
141
  type: Array as PropType<number[] | null>,
142
142
  required: false,
@@ -165,17 +165,16 @@ export default defineComponent({
165
165
  const innerRightMonth = ref(new Date().getMonth());
166
166
  const innerRightYear = ref(new Date().getFullYear());
167
167
 
168
- const toggle = ref((props.modelValue?.length ?? 0) % 2);
169
-
170
168
  const colors = computed(() => getColors(props.color));
171
169
  const backgrounds = getColors(ColorEnum.Background);
170
+ const lights = getColors(ColorEnum.Light);
172
171
  const darks = getColors(ColorEnum.Dark);
173
172
 
174
173
  const style = computed((): StyleValue => ({
175
174
  "--fs-calendar-background-color" : backgrounds.base,
176
175
  "--fs-calendar-hover-background-color" : colors.value.light,
177
176
  "--fs-calendar-active-background-color": colors.value.base,
178
- "--fs-calendar-border-color" : darks.base,
177
+ "--fs-calendar-border-color" : lights.dark,
179
178
  "--fs-calendar-hover-border-color" : colors.value.base,
180
179
  "--fs-calendar-active-border-color" : colors.value.base,
181
180
  "--fs-calendar-color" : darks.base,
@@ -261,6 +260,28 @@ export default defineComponent({
261
260
  return classNames;
262
261
  });
263
262
 
263
+ const years = computed((): any[] => {
264
+ const years = [];
265
+ switch (props.limit) {
266
+ case "past":
267
+ for (let i = 1900; i < new Date().getFullYear(); i++) {
268
+ years.push({ label: i.toString(), id: i });
269
+ }
270
+ break;
271
+ case "future":
272
+ for (let i = new Date().getFullYear(); i < 2100; i++) {
273
+ years.push({ label: i.toString(), id: i });
274
+ }
275
+ break;
276
+ default:
277
+ for (let i = 1900; i < 2100; i++) {
278
+ years.push({ label: i.toString(), id: i });
279
+ }
280
+ break;
281
+ }
282
+ return years;
283
+ });
284
+
264
285
  const compare = (operator: "before" | "during" | "after", side: "left" | "right", date: { d: number, m: number, y: number }): boolean => {
265
286
  switch (operator) {
266
287
  case "before":
@@ -323,45 +344,73 @@ export default defineComponent({
323
344
 
324
345
  const onClickLeft = (value: unknown): void => {
325
346
  const dates = value as Date[];
326
- const clicked = pickerToEpoch(dates[dates.length - 1]);
327
- if (!props.modelValue || !props.modelValue.length) {
328
- emit("update:modelValue", [clicked, clicked]);
347
+
348
+ // Click on the same date while only one date is selected on the left calendar
349
+ if (dates.length === 0) {
350
+ if (props.modelValue && props.modelValue.length > 0) {
351
+ emit("update:modelValue", [props.modelValue[0], props.modelValue[0]]);
352
+ }
353
+ return;
329
354
  }
330
- else if (props.modelValue.length === 1) {
355
+
356
+ const clicked = pickerToEpoch(dates[dates.length - 1]);
357
+ if (props.modelValue && props.modelValue[0] === props.modelValue[1]) {
331
358
  emit("update:modelValue", [props.modelValue[0], clicked].sort());
332
359
  }
333
360
  else {
334
- if (innerLeftValue.value.length === 0) {
335
- emit("update:modelValue", [clicked, props.modelValue[1]]);
336
- }
337
- else {
338
- emit("update:modelValue", [clicked, props.modelValue[toggle.value]].sort());
339
- toggle.value = (++toggle.value) % 2;
340
- }
361
+ emit("update:modelValue", [clicked, clicked]);
341
362
  }
342
363
  };
343
364
 
344
365
  const onClickRight = (value: unknown): void => {
345
366
  const dates = value as Date[];
367
+
368
+ // Click on the same date while only one date is selected on the right calendar
369
+ if (dates.length === 0) {
370
+ if (props.modelValue && props.modelValue.length > 0) {
371
+ emit("update:modelValue", [props.modelValue[props.modelValue.length - 1], props.modelValue[props.modelValue.length - 1]]);
372
+ }
373
+ return;
374
+ }
375
+
346
376
  const clicked = pickerToEpoch(dates[dates.length - 1]);
347
- if (!props.modelValue || !props.modelValue.length) {
377
+ if (props.modelValue && props.modelValue[0] === props.modelValue[1]) {
378
+ emit("update:modelValue", [props.modelValue[0], clicked].sort());
379
+ }
380
+ else {
348
381
  emit("update:modelValue", [clicked, clicked]);
349
382
  }
350
- else if (props.modelValue.length === 1) {
351
- emit("update:modelValue", [props.modelValue[0], clicked].sort());
383
+ };
384
+
385
+ const onClickToday = (): void => {
386
+ const today = new Date();
387
+ innerLeftMonth.value = today.getMonth();
388
+ innerLeftYear.value = today.getFullYear();
389
+
390
+ if (innerLeftMonth.value === 11) {
391
+ innerRightMonth.value = 0;
392
+ innerRightYear.value = innerLeftYear.value + 1;
352
393
  }
353
394
  else {
354
- if (innerRightValue.value.length === 0) {
355
- emit("update:modelValue", [props.modelValue[0], clicked]);
356
- }
357
- else {
358
- emit("update:modelValue", [clicked, props.modelValue[toggle.value]].sort());
359
- toggle.value = (++toggle.value) % 2;
360
- }
395
+ innerRightMonth.value = innerLeftMonth.value + 1;
396
+ innerRightYear.value = innerLeftYear.value;
361
397
  }
362
- toggle.value = (++toggle.value) % 2;
398
+
399
+ today.setHours(0, 0, 0, 0);
400
+ emit("update:modelValue", [pickerToEpoch(today), pickerToEpoch(today)]);
363
401
  };
364
402
 
403
+ const onChangeYear = (value: number): void => {
404
+ if (innerRightYear.value !== innerLeftYear.value) {
405
+ innerLeftYear.value = value;
406
+ innerRightYear.value = value + 1;
407
+ }
408
+ else {
409
+ innerLeftYear.value = value;
410
+ innerRightYear.value = value;
411
+ }
412
+ }
413
+
365
414
  const allowedDates = (value: unknown): boolean => {
366
415
  if (!(value instanceof Date)) {
367
416
  return false;
@@ -414,11 +463,14 @@ export default defineComponent({
414
463
  innerRightMonth,
415
464
  innerRightYear,
416
465
  innerRightValue,
466
+ years,
417
467
  epochToPicker,
418
468
  onClickPrevious,
419
469
  onClickNext,
420
470
  onClickLeft,
421
471
  onClickRight,
472
+ onClickToday,
473
+ onChangeYear,
422
474
  allowedDates
423
475
  };
424
476
  }