@dative-gpi/foundation-shared-components 1.0.66 → 1.0.67-tree-view-02

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 (295) 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 +19 -5
  46. package/components/FSSlider.vue +44 -79
  47. package/components/FSSpan.vue +12 -7
  48. package/components/FSSwitch.vue +44 -48
  49. package/components/FSTab.vue +15 -13
  50. package/components/FSTabs.vue +32 -7
  51. package/components/FSTag.vue +3 -3
  52. package/components/FSTagGroup.vue +6 -4
  53. package/components/FSText.vue +11 -7
  54. package/components/FSToggleSet.vue +7 -7
  55. package/components/FSTreeView.vue +107 -0
  56. package/components/FSWindow.vue +122 -5
  57. package/components/FSWrapGroup.vue +13 -1
  58. package/components/agenda/FSAgenda.vue +26 -7
  59. package/components/agenda/FSAgendaDialogCalendar.vue +2 -2
  60. package/components/agenda/FSAgendaHeader.vue +35 -10
  61. package/components/agenda/FSAgendaHorizontalEvent.vue +18 -6
  62. package/components/agenda/FSAgendaHoursRow.vue +48 -8
  63. package/components/agenda/FSAgendaVerticalEvent.vue +1 -1
  64. package/components/agenda/FSDayAgenda.vue +0 -1
  65. package/components/agenda/FSMonthAgenda.vue +1 -6
  66. package/components/agenda/FSSelectAgendaMode.vue +2 -2
  67. package/components/agenda/FSWeekAgenda.vue +5 -10
  68. package/components/autocompletes/FSAutoCompleteAddress.vue +25 -20
  69. package/components/autocompletes/FSAutocompleteLanguage.vue +7 -1
  70. package/components/autocompletes/FSAutocompleteTimeZone.vue +7 -1
  71. package/components/buttons/FSButtonAdd.vue +1 -1
  72. package/components/buttons/FSButtonAddLabel.vue +1 -1
  73. package/components/buttons/FSButtonCancel.vue +1 -1
  74. package/components/buttons/FSButtonCancelLabel.vue +1 -1
  75. package/components/buttons/FSButtonCheckbox.vue +4 -4
  76. package/components/buttons/FSButtonCopy.vue +1 -1
  77. package/components/buttons/FSButtonCopyLabel.vue +1 -1
  78. package/components/buttons/FSButtonDuplicate.vue +1 -1
  79. package/components/buttons/FSButtonDuplicateLabel.vue +1 -1
  80. package/components/buttons/FSButtonEdit.vue +1 -1
  81. package/components/buttons/FSButtonEditLabel.vue +1 -1
  82. package/components/buttons/FSButtonFile.vue +1 -1
  83. package/components/buttons/FSButtonFileLabel.vue +1 -1
  84. package/components/buttons/FSButtonNext.vue +1 -1
  85. package/components/buttons/FSButtonNextLabel.vue +1 -1
  86. package/components/buttons/FSButtonPrevious.vue +1 -1
  87. package/components/buttons/FSButtonPreviousLabel.vue +1 -1
  88. package/components/buttons/FSButtonRedo.vue +1 -1
  89. package/components/buttons/FSButtonRedoLabel.vue +1 -1
  90. package/components/buttons/FSButtonRemove.vue +1 -1
  91. package/components/buttons/FSButtonRemoveLabel.vue +1 -1
  92. package/components/buttons/FSButtonSave.vue +1 -1
  93. package/components/buttons/FSButtonSaveLabel.vue +1 -1
  94. package/components/buttons/FSButtonSearch.vue +1 -1
  95. package/components/buttons/FSButtonSearchLabel.vue +1 -1
  96. package/components/buttons/FSButtonUndo.vue +1 -1
  97. package/components/buttons/FSButtonUndoLabel.vue +1 -1
  98. package/components/buttons/FSButtonUpdate.vue +1 -1
  99. package/components/buttons/FSButtonUpdateLabel.vue +1 -1
  100. package/components/buttons/FSButtonValidate.vue +1 -1
  101. package/components/buttons/FSButtonValidateLabel.vue +1 -1
  102. package/components/calendar/FSSimpleCalendar.vue +145 -0
  103. package/components/calendar/FSSimpleCalendarHeader.vue +60 -0
  104. package/components/calendar/FSSimpleMonthSelector.vue +138 -0
  105. package/components/deviceOrganisations/FSConnectivity.vue +5 -3
  106. package/components/deviceOrganisations/FSStatus.vue +5 -3
  107. package/components/deviceOrganisations/FSStatusCard.vue +7 -9
  108. package/components/deviceOrganisations/FSStatusRichCard.vue +171 -0
  109. package/components/deviceOrganisations/FSWorstAlert.vue +24 -36
  110. package/components/deviceOrganisations/FSWorstAlertCard.vue +8 -47
  111. package/components/fields/FSAutocompleteField.vue +85 -82
  112. package/components/fields/FSAutocompleteTag.vue +1 -1
  113. package/components/fields/FSBaseField.vue +42 -25
  114. package/components/fields/FSClosableSearchField.vue +83 -0
  115. package/components/fields/FSColorField.vue +12 -10
  116. package/components/fields/FSCommentField.vue +28 -16
  117. package/components/fields/FSDateField.vue +13 -10
  118. package/components/fields/FSDateRangeField.vue +6 -5
  119. package/components/fields/FSDateTimeField.vue +14 -11
  120. package/components/fields/FSDateTimeRangeDialog.vue +160 -0
  121. package/components/fields/FSDateTimeRangeField.vue +23 -115
  122. package/components/fields/FSEntityFieldUI.vue +19 -16
  123. package/components/fields/FSGradientField.vue +5 -5
  124. package/components/fields/FSIconField.vue +16 -9
  125. package/components/fields/FSMagicConfigField.vue +15 -7
  126. package/components/fields/FSMagicField.vue +7 -2
  127. package/components/fields/FSMapAddressField.vue +187 -0
  128. package/components/fields/FSNumberField.vue +8 -4
  129. package/components/fields/FSPasswordField.vue +7 -7
  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 +310 -0
  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 +198 -123
  151. package/components/lists/FSDraggable.vue +2 -2
  152. package/components/lists/FSFilterButton.vue +14 -16
  153. package/components/lists/FSHeaderButton.vue +11 -9
  154. package/components/lists/FSHiddenButton.vue +9 -9
  155. package/components/lists/FSLoadDataTable.vue +10 -7
  156. package/components/lists/FSSimpleList.vue +95 -88
  157. package/components/lists/FSSimpleListItem.vue +131 -0
  158. package/components/map/FSMap.vue +144 -158
  159. package/components/map/FSMapFeatureGroup.vue +7 -1
  160. package/components/map/FSMapLayerButton.vue +4 -3
  161. package/components/map/FSMapMarker.vue +103 -42
  162. package/components/map/FSMapMarkerClusterGroup.vue +32 -7
  163. package/components/map/FSMapOverlay.vue +44 -24
  164. package/components/map/FSMapPolygon.vue +16 -4
  165. package/components/map/FSMapTileLayer.vue +26 -9
  166. package/components/map/layers.ts +0 -0
  167. package/components/selects/FSSelectAutoRefresh.vue +8 -8
  168. package/components/selects/FSSelectDashboardVariableType.vue +4 -3
  169. package/components/selects/FSSelectDateSetting.vue +2 -2
  170. package/components/selects/FSSelectDays.vue +8 -8
  171. package/components/selects/FSSelectListMode.vue +2 -2
  172. package/components/selects/FSSelectMapLayer.vue +68 -0
  173. package/components/selects/FSSelectMonths.vue +13 -13
  174. package/components/selects/chartSelectors/FSAggregationSelector.vue +52 -0
  175. package/components/selects/chartSelectors/FSAxisTypeSelector.vue +49 -0
  176. package/components/selects/chartSelectors/FSDisplayAsSelector.vue +53 -0
  177. package/components/selects/chartSelectors/FSFilterTypeSelector.vue +54 -0
  178. package/components/selects/chartSelectors/FSHeatmapRuleSelector.vue +54 -0
  179. package/components/selects/chartSelectors/FSOperationOnSelector.vue +53 -0
  180. package/components/selects/chartSelectors/FSPlanningTypeSelector.vue +53 -0
  181. package/components/selects/chartSelectors/FSPlotPerSelector.vue +52 -0
  182. package/components/selects/chartSelectors/FSSelectEntityType.vue +59 -0
  183. package/components/selects/chartSelectors/FSSerieTypeSelector.vue +53 -0
  184. package/components/tiles/FSAlertTileUI.vue +90 -0
  185. package/components/tiles/FSChartTileUI.vue +61 -52
  186. package/components/tiles/FSCommentTileUI.vue +38 -13
  187. package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +14 -2
  188. package/components/tiles/FSDashboardShallowTileUI.vue +14 -2
  189. package/components/tiles/FSDeviceOrganisationTileUI.vue +0 -6
  190. package/components/tiles/FSEntityCountBadge.vue +72 -0
  191. package/components/tiles/FSFolderTileUI.vue +38 -4
  192. package/components/tiles/FSGroupTileUI.vue +32 -136
  193. package/components/tiles/FSLoadTile.vue +16 -10
  194. package/components/tiles/FSLocationTileUI.vue +45 -63
  195. package/components/tiles/FSServiceAccountOrganisationTileUI.vue +0 -6
  196. package/components/tiles/FSSimpleTileUI.vue +30 -24
  197. package/components/tiles/FSTile.vue +46 -39
  198. package/components/tiles/FSUserOrganisationTileUI.vue +1 -7
  199. package/components/tiles/FSUserTileUI.vue +119 -0
  200. package/components/toggleSets/FSToggleSetPosition.vue +1 -1
  201. package/components/views/FSBaseView.vue +64 -0
  202. package/components/views/FSEntityView.vue +12 -146
  203. package/components/views/FSSimpleView.vue +29 -0
  204. package/components/views/desktop/FSBaseDefaultDesktopView.vue +135 -0
  205. package/components/views/desktop/FSBaseDesktopView.vue +53 -0
  206. package/components/views/desktop/FSBaseEntityDesktopView.vue +211 -0
  207. package/components/views/mobile/FSBaseDefaultMobileView.vue +133 -0
  208. package/components/views/mobile/FSBaseEntityMobileView.vue +206 -0
  209. package/components/views/mobile/FSBaseMobileView.vue +53 -0
  210. package/composables/index.ts +1 -0
  211. package/composables/useAddress.ts +40 -8
  212. package/composables/useBreakpoints.ts +40 -4
  213. package/composables/useColors.ts +16 -7
  214. package/composables/useMagicFieldProvider.ts +1 -0
  215. package/composables/useMapLayers.ts +69 -0
  216. package/composables/useSlots.ts +2 -1
  217. package/models/colors.ts +2 -1
  218. package/models/deviceAlerts.ts +1 -0
  219. package/models/magicFields.ts +1 -0
  220. package/models/map.ts +12 -10
  221. package/models/rules.ts +5 -2
  222. package/models/tables.ts +2 -1
  223. package/models/variableNode.ts +8 -5
  224. package/package.json +5 -5
  225. package/styles/components/fs_agenda.scss +4 -0
  226. package/styles/components/fs_agenda_event.scss +1 -1
  227. package/styles/components/fs_agenda_hours_row.scss +0 -8
  228. package/styles/components/fs_autocomplete_field.scss +0 -13
  229. package/styles/components/fs_breadcrumbs.scss +18 -36
  230. package/styles/components/fs_button.scss +7 -5
  231. package/styles/components/fs_calendar.scss +1 -0
  232. package/styles/components/fs_card.scss +9 -0
  233. package/styles/components/fs_chip.scss +13 -7
  234. package/styles/components/fs_clickable.scss +16 -23
  235. package/styles/components/fs_clock.scss +0 -10
  236. package/styles/components/fs_col.scss +1 -1
  237. package/styles/components/fs_color_field.scss +0 -4
  238. package/styles/components/fs_data_table.scss +6 -9
  239. package/styles/components/fs_dialog.scss +4 -10
  240. package/styles/components/fs_dialog_menu.scss +4 -2
  241. package/styles/components/fs_draggable.scss +0 -5
  242. package/styles/components/fs_fade_out.scss +10 -2
  243. package/styles/components/fs_filter_button.scss +1 -1
  244. package/styles/components/fs_hidden_button.scss +2 -7
  245. package/styles/components/fs_image_card.scss +6 -4
  246. package/styles/components/fs_magic_config_field.scss +1 -2
  247. package/styles/components/fs_map.scss +57 -17
  248. package/styles/components/fs_meta_field.scss +3 -5
  249. package/styles/components/fs_password_field.scss +4 -2
  250. package/styles/components/fs_progress_bar.scss +14 -0
  251. package/styles/components/fs_radio.scss +0 -11
  252. package/styles/components/fs_rich_text_field.scss +1 -10
  253. package/styles/components/fs_select_field.scss +4 -13
  254. package/styles/components/fs_slide_group.scss +7 -0
  255. package/styles/components/fs_slider.scss +0 -40
  256. package/styles/components/fs_span.scss +13 -5
  257. package/styles/components/fs_status_rich_card.scss +6 -0
  258. package/styles/components/fs_tabs.scss +18 -37
  259. package/styles/components/fs_tag.scss +8 -22
  260. package/styles/components/fs_text_area.scss +2 -21
  261. package/styles/components/fs_tile.scss +0 -19
  262. package/styles/components/fs_window.scss +3 -1
  263. package/styles/components/fs_wrap_group.scss +7 -0
  264. package/styles/components/index.scss +2 -6
  265. package/styles/globals/index.scss +1 -5
  266. package/styles/globals/overrides.scss +26 -54
  267. package/styles/globals/scrollbars.scss +8 -0
  268. package/styles/globals/text_fonts.scss +18 -66
  269. package/styles/globals/touchscreen.scss +2 -2
  270. package/tools/alertsTools.ts +94 -18
  271. package/tools/chartsTools.ts +155 -16
  272. package/tools/index.ts +3 -1
  273. package/tools/reportsTools.ts +38 -0
  274. package/tools/timeRangeTools.ts +125 -0
  275. package/utils/badge.ts +9 -5
  276. package/utils/filter.ts +4 -1
  277. package/utils/index.ts +2 -0
  278. package/utils/leafletMarkers.ts +4 -4
  279. package/utils/operations.ts +108 -0
  280. package/utils/picker.ts +40 -0
  281. package/utils/sort.ts +2 -2
  282. package/utils/time.ts +13 -13
  283. package/components/fields/FSTimeSlotField.vue +0 -250
  284. package/components/views/FSEntityHeader.vue +0 -343
  285. package/components/views/FSListHeader.vue +0 -83
  286. package/components/views/FSListView.vue +0 -83
  287. package/components/views/FSSkeletonView.vue +0 -100
  288. package/styles/components/fs_data_iterator_item.scss +0 -33
  289. package/styles/components/fs_icon_field.scss +0 -12
  290. package/styles/components/fs_search_field.scss +0 -3
  291. package/styles/components/fs_tag_field.scss +0 -8
  292. package/styles/components/fs_time_field.scss +0 -12
  293. package/styles/components/fs_timeslot_field.scss +0 -12
  294. package/styles/globals/breakpoints.scss +0 -20
  295. package/styles/globals/fixes.scss +0 -5
@@ -0,0 +1,40 @@
1
+ export enum TimePrecision {
2
+ Hours = 1,
3
+ Days = 2,
4
+ Months = 3
5
+ }
6
+
7
+ /**
8
+ * Compute ticks for a time range based on the specified precision.
9
+ */
10
+ export const computeTicks = ({ start, end, tickCount, precision }: { start: number, end: number, tickCount: number, precision: TimePrecision }): number[] => {
11
+ const ticks: number[] = [];
12
+ const range = end - start;
13
+
14
+ if (precision === TimePrecision.Hours) {
15
+ // Tick toutes les X heures, aligné sur l'heure pleine
16
+ const step = Math.ceil(range / tickCount / 3600000) * 3600000;
17
+ const alignedStart = Math.ceil(start / 3600000) * 3600000;
18
+ for (let i = 0; i < tickCount; i++) {
19
+ const tick = alignedStart + i * step;
20
+ if (tick < end) { ticks.push(tick); }
21
+ }
22
+ } else if (precision === TimePrecision.Days) {
23
+ // Tick tous les X jours, aligné sur minuit
24
+ const step = Math.ceil(range / tickCount / 86400000) * 86400000;
25
+ const date = new Date(start);
26
+ date.setHours(0, 0, 0, 0);
27
+ const alignedStart = date.getTime() + (date.getTime() < start ? step : 0);
28
+ for (let i = 0; i < tickCount; i++) {
29
+ const tick = alignedStart + i * step;
30
+ if (tick < end) { ticks.push(tick); }
31
+ }
32
+ } else {
33
+ // Tick tous les X mois (approximation linéaire)
34
+ const interval = range / tickCount;
35
+ for (let i = 0; i < tickCount; i++) {
36
+ ticks.push(start + i * interval);
37
+ }
38
+ }
39
+ return ticks;
40
+ }
package/utils/sort.ts CHANGED
@@ -23,7 +23,7 @@ export const alphanumericSort = (a: any, b: any) => {
23
23
  if (b == null) {
24
24
  return 1;
25
25
  }
26
- a = asString(a);
27
- b = asString(b);
26
+ a = asString(a).trim();
27
+ b = asString(b).trim();
28
28
  return a.localeCompare(b, undefined, { numeric: true });
29
29
  };
package/utils/time.ts CHANGED
@@ -5,13 +5,13 @@ import { TimeUnit } from "@dative-gpi/foundation-shared-domain/enums"
5
5
  const { $tr } = useTranslationsProvider();
6
6
 
7
7
  export const timeSteps = [
8
- { id: TimeUnit.Second, label: $tr("ui.time-step.second.singular", "Second"), plural: $tr("ui.time-step.second.plural", "Seconds") },
9
- { id: TimeUnit.Minute, label: $tr("ui.time-step.minute.singular", "Minute"), plural: $tr("ui.time-step.minute.plural", "Minutes") },
10
- { id: TimeUnit.Hour, label: $tr("ui.time-step.hour.singular", "Hour"), plural: $tr("ui.time-step.hour.plural", "Hours") },
11
- { id: TimeUnit.Day, label: $tr("ui.time-step.day.singular", "Day"), plural: $tr("ui.time-step.day.plural", "Days") },
12
- { id: TimeUnit.Week, label: $tr("ui.time-step.week.singular", "Week"), plural: $tr("ui.time-step.week.plural", "Weeks") },
13
- { id: TimeUnit.Month, label: $tr("ui.time-step.month.singular", "Month"), plural: $tr("ui.time-step.month.plural", "Months") },
14
- { id: TimeUnit.Year, label: $tr("ui.time-step.year.singular", "Year"), plural: $tr("ui.time-step.year.plural", "Years") },
8
+ { id: TimeUnit.Second, get label() { return $tr("ui.common.second", "Second") }, get plural() { return $tr("ui.common.seconds", "Seconds") } },
9
+ { id: TimeUnit.Minute, get label() { return $tr("ui.common.minute", "Minute") }, get plural() { return $tr("ui.common.minutes", "Minutes") } },
10
+ { id: TimeUnit.Hour, get label() { return $tr("ui.common.hour", "Hour") }, get plural() { return $tr("ui.common.hours", "Hours") } },
11
+ { id: TimeUnit.Day, get label() { return $tr("ui.common.day", "Day") }, get plural() { return $tr("ui.common.days", "Days") } },
12
+ { id: TimeUnit.Week, get label() { return $tr("ui.common.week", "Week") }, get plural() { return $tr("ui.common.weeks", "Weeks") } },
13
+ { id: TimeUnit.Month, get label() { return $tr("ui.common.month", "Month") }, get plural() { return $tr("ui.common.months", "Months") } },
14
+ { id: TimeUnit.Year, get label() { return $tr("ui.common.year", "Year") }, get plural() { return $tr("ui.common.years", "Years") } },
15
15
  ];
16
16
 
17
17
  export const timeStepToString = (value: { value: number, unit: TimeUnit } | null): string => {
@@ -28,12 +28,12 @@ export const timeStepToString = (value: { value: number, unit: TimeUnit } | null
28
28
  };
29
29
 
30
30
  // TODO : remove everything below this line
31
- export const timeScale: any[] = [
32
- { id: 1, label: $tr("ui.time-field.second.singular", "Second"), plural: $tr("ui.time-field.second.plural", "Seconds") },
33
- { id: 60, label: $tr("ui.time-field.minute.singular", "Minute"), plural: $tr("ui.time-field.minute.plural", "Minutes") },
34
- { id: 3600, label: $tr("ui.time-field.hour.singular", "Hour"), plural: $tr("ui.time-field.hour.plural", "Hours") },
35
- { id: 86400, label: $tr("ui.time-field.day.singular", "Day"), plural: $tr("ui.time-field.day.plural", "Days") },
36
- { id: 604800, label: $tr("ui.time-field.week.singular", "Week"), plural: $tr("ui.time-field.week.plural", "Weeks") },
31
+ export const timeScale = [
32
+ { id: 1, get label() { return $tr("ui.common.second", "Second") }, get plural() { return $tr("ui.common.seconds", "Seconds") } },
33
+ { id: 60, get label() { return $tr("ui.common.minute", "Minute") }, get plural() { return $tr("ui.common.minutes", "Minutes") } },
34
+ { id: 3600, get label() { return $tr("ui.common.hour", "Hour") }, get plural() { return $tr("ui.common.hours", "Hours") } },
35
+ { id: 86400, get label() { return $tr("ui.common.day", "Day") }, get plural() { return $tr("ui.common.days", "Days") } },
36
+ { id: 604800, get label() { return $tr("ui.common.week", "Week") }, get plural() { return $tr("ui.common.weeks", "Weeks") } },
37
37
  ];
38
38
 
39
39
  export const getTimeScaleIndex = (value: number): number => {
@@ -1,250 +0,0 @@
1
- <template>
2
- <FSBaseField
3
- :description="$props.description"
4
- :hideHeader="$props.hideHeader"
5
- :required="$props.required"
6
- :editable="$props.editable"
7
- :label="$props.label"
8
- :messages="messages"
9
- >
10
- <FSRow>
11
- <FSRow
12
- :wrap="false"
13
- >
14
- <FSSelectField
15
- :validationValue="$props.modelValue"
16
- :editable="$props.editable"
17
- :validateOn="validateOn"
18
- :rules="$props.rules"
19
- :items="daysObject"
20
- :hideHeader="true"
21
- :clearable="false"
22
- :style="style"
23
- :modelValue="dayStart"
24
- @update:modelValue="onChangeDayStart"
25
- />
26
- <FSClock
27
- class="fs-time-slot-field-number"
28
- :editable="$props.editable"
29
- :color="ColorEnum.Light"
30
- :slider="false"
31
- :style="style"
32
- :modelValue="$props.modelValue[0][1]"
33
- @update:modelValue="onChangeHourStart"
34
- />
35
- </FSRow>
36
- <FSRow
37
- :wrap="false"
38
- >
39
- <FSSelectField
40
- class="fs-time-slot-field-select"
41
- :editable="$props.editable"
42
- :items="daysObject"
43
- :hideHeader="true"
44
- :clearable="false"
45
- :style="style"
46
- :modelValue="dayEnd"
47
- @update:modelValue="onChangeDayEnd"
48
- />
49
- <FSClock
50
- class="fs-time-slot-field-number"
51
- :editable="$props.editable"
52
- :color="ColorEnum.Light"
53
- :slider="false"
54
- :style="style"
55
- :modelValue="$props.modelValue[1][1]"
56
- @update:modelValue="onChangeHourEnd"
57
- />
58
- </FSRow>
59
- </FSRow>
60
- </FSBaseField>
61
- </template>
62
-
63
- <script lang="ts">
64
- import { computed, defineComponent, type PropType, type StyleValue } from "vue";
65
-
66
- import { useColors, useRules } from "@dative-gpi/foundation-shared-components/composables";
67
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
68
- import { Days } from "@dative-gpi/foundation-shared-domain/enums";
69
-
70
- import FSSelectField from "./FSSelectField.vue";
71
- import FSBaseField from "./FSBaseField.vue";
72
- import FSClock from "../FSClock.vue";
73
- import FSRow from "../FSRow.vue";
74
-
75
- export default defineComponent({
76
- name: "FSTimeSlotField",
77
- components: {
78
- FSSelectField,
79
- FSBaseField,
80
- FSClock,
81
- FSRow
82
- },
83
- props: {
84
- label: {
85
- type: String as PropType<string | null>,
86
- required: false,
87
- default: null
88
- },
89
- description: {
90
- type: String as PropType<string | null>,
91
- required: false,
92
- default: null
93
- },
94
- modelValue: {
95
- type: Array as PropType<number[][] | null>,
96
- required: true,
97
- default: null
98
- },
99
- hideHeader: {
100
- type: Boolean,
101
- required: false,
102
- default: false
103
- },
104
- required: {
105
- type: Boolean,
106
- required: false,
107
- default: false
108
- },
109
- rules: {
110
- type: Array as PropType<any[]>,
111
- required: false,
112
- default: () => []
113
- },
114
- messages: {
115
- type: Array as PropType<string[]>,
116
- required: false,
117
- default: null
118
- },
119
- editable: {
120
- type: Boolean,
121
- required: false,
122
- default: true
123
- }
124
- },
125
- emits: ["update:modelValue"],
126
- setup(props, { emit }) {
127
- const { validateOn, getMessages } = useRules();
128
- const { getColors } = useColors();
129
-
130
- const errors = getColors(ColorEnum.Error);
131
- const lights = getColors(ColorEnum.Light);
132
- const darks = getColors(ColorEnum.Dark);
133
-
134
- const daysObject: { id: number; label: string }[] = Object.keys(Days).reduce((acc, key) => {
135
- if (isNaN(Number(key))) {
136
- acc.push({
137
- id: Days[key],
138
- label: key
139
- });
140
- }
141
- return acc;
142
- }, [] as { id: number, label: string }[]);
143
-
144
- const style = computed((): StyleValue => {
145
- if (!props.editable) {
146
- return {
147
- "--fs-time-slot-field-cursor" : "default",
148
- "--fs-time-slot-field-border-color" : lights.base,
149
- "--fs-time-slot-field-color" : lights.dark,
150
- "--fs-time-slot-field-active-border-color": lights.base
151
- };
152
- }
153
- return {
154
- "--fs-time-slot-field-cursor" : "text",
155
- "--fs-time-slot-field-border-color" : lights.dark,
156
- "--fs-time-slot-field-color" : darks.base,
157
- "--fs-time-slot-field-active-border-color": darks.dark,
158
- "--fs-time-slot-field-error-color" : errors.base,
159
- "--fs-time-slot-field-error-border-color" : errors.base
160
- };
161
- });
162
-
163
- const dayStart = computed((): number => {
164
- if (props.modelValue) {
165
- return props.modelValue[1][0] === 7 ? 7 : props.modelValue[0][0];
166
- }
167
- return 0;
168
- });
169
-
170
- const dayEnd = computed((): number => {
171
- if (props.modelValue) {
172
- return props.modelValue[0][0] === 7 ? 7 : props.modelValue[1][0];
173
- }
174
- return 0;
175
- });
176
-
177
- const messages = computed((): string[] => props.messages ?? getMessages(props.modelValue, props.rules));
178
-
179
- const onChangeDayStart = (value: number) => {
180
- if (value === 7) {
181
- if (props.modelValue) {
182
- emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
183
- return;
184
- }
185
- emit("update:modelValue", [[7, 0], [7, 0]]);
186
- return;
187
- }
188
- if (props.modelValue) {
189
- if (props.modelValue[1][0] === 7) {
190
- emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
191
- return;
192
- }
193
- emit("update:modelValue", [[value, props.modelValue[0][1]], props.modelValue[1]]);
194
- return;
195
- }
196
- emit("update:modelValue", [[value, 0], [value, 0]]);
197
- };
198
-
199
- const onChangeHourStart = (value: number) => {
200
- if (props.modelValue) {
201
- emit("update:modelValue", [[props.modelValue[0][0], value], props.modelValue[1]]);
202
- return;
203
- }
204
- emit("update:modelValue", [[0, value], [0, 0]]);
205
- };
206
-
207
- const onChangeDayEnd = (value: number) => {
208
- if (value === 7) {
209
- if (props.modelValue) {
210
- emit("update:modelValue", [[7, props.modelValue[0][1]], [7, props.modelValue[1][1]]]);
211
- return;
212
- }
213
- emit("update:modelValue", [[7, 0], [7, 0]]);
214
- return;
215
- }
216
- if (props.modelValue) {
217
- if (props.modelValue[0][0] === 7) {
218
- emit("update:modelValue", [[value, props.modelValue[0][1]], [value, props.modelValue[1][1]]]);
219
- return;
220
- }
221
- emit("update:modelValue", [props.modelValue[0], [value, props.modelValue[1][1]]]);
222
- return;
223
- }
224
- emit("update:modelValue", [[value, 0], [value, 0]]);
225
- };
226
-
227
- const onChangeHourEnd = (value: number) => {
228
- if (props.modelValue) {
229
- emit("update:modelValue", [props.modelValue[0], [props.modelValue[1][0], value]]);
230
- return;
231
- }
232
- emit("update:modelValue", [[0, 0], [0, value]]);
233
- };
234
-
235
- return {
236
- daysObject,
237
- validateOn,
238
- ColorEnum,
239
- dayStart,
240
- messages,
241
- dayEnd,
242
- style,
243
- onChangeHourStart,
244
- onChangeDayStart,
245
- onChangeHourEnd,
246
- onChangeDayEnd
247
- };
248
- }
249
- });
250
- </script>
@@ -1,343 +0,0 @@
1
- <template>
2
- <template
3
- v-if="isExtraSmall"
4
- >
5
- <FSCol
6
- class="f-entity-header"
7
- padding="0 10px 0 0"
8
- align="center-left"
9
- gap="12px"
10
- >
11
- <FSRow
12
- align="center-left"
13
- gap="12px"
14
- :height="imageSize"
15
- :wrap="false"
16
- >
17
- <template
18
- v-if="$props.imageId"
19
- >
20
- <slot
21
- name="image"
22
- v-bind="{ imageSize }"
23
- >
24
- <FSImage
25
- :imageId="$props.imageId"
26
- :cover="imageCover"
27
- :height="imageSize"
28
- :width="imageSize"
29
- />
30
- </slot>
31
- </template>
32
- <FSIconCard
33
- v-else-if="$props.icon"
34
- :backgroundVariant="$props.iconBackgroundVariant"
35
- :backgroundColor="$props.iconBackgroundColors"
36
- :border="$props.iconBorder"
37
- :icon="$props.icon"
38
- :iconColor="$props.color"
39
- :size="imageSize"
40
- />
41
- <FSCol
42
- align="center-left"
43
- :width="`calc(100% - ${rightOverflow})`"
44
- >
45
- <template
46
- v-if="$props.subtitle && $props.description"
47
- >
48
- <FSText
49
- font="text-h3"
50
- >
51
- {{ $props.title }}
52
- </FSText>
53
- <FSCol
54
- align="center-left"
55
- gap="4px"
56
- >
57
- <FSText
58
- font="text-button"
59
- >
60
- {{ $props.subtitle }}
61
- </FSText>
62
- <FSText
63
- font="text-body"
64
- >
65
- {{ $props.description }}
66
- </FSText>
67
- </FSCol>
68
- </template>
69
- <template
70
- v-else-if="$props.subtitle && !$props.description"
71
- >
72
- <FSText
73
- font="text-h3"
74
- :lineClamp="2"
75
- >
76
- {{ $props.title }}
77
- </FSText>
78
- <FSText
79
- font="text-button"
80
- >
81
- {{ $props.subtitle }}
82
- </FSText>
83
- </template>
84
- <template
85
- v-else-if="!$props.subtitle && $props.description"
86
- >
87
- <FSText
88
- font="text-h3"
89
- :lineClamp="2"
90
- >
91
- {{ $props.title }}
92
- </FSText>
93
- <FSText
94
- font="text-body"
95
- :lineClamp="2"
96
- >
97
- {{ $props.description }}
98
- </FSText>
99
- </template>
100
- <template
101
- v-else
102
- >
103
- <FSText
104
- font="text-h3"
105
- :lineClamp="2"
106
- >
107
- {{ $props.title }}
108
- </FSText>
109
- </template>
110
- </FSCol>
111
- </FSRow>
112
- <template
113
- v-if="!$props.light"
114
- >
115
- <FSBreadcrumbs
116
- :items="$props.breadcrumbs"
117
- />
118
- <FSSlideGroup
119
- v-if="slots['toolbar']"
120
- >
121
- <slot
122
- name="toolbar"
123
- />
124
- </FSSlideGroup>
125
- <slot
126
- name="title-append"
127
- />
128
- </template>
129
- </FSCol>
130
- </template>
131
- <template
132
- v-else
133
- >
134
- <FSCol
135
- class="f-entity-header"
136
- padding="0 14px 0 0"
137
- align="center-left"
138
- gap="16px"
139
- >
140
- <FSRow
141
- align="center-left"
142
- gap="16px"
143
- :height="imageSize"
144
- :wrap="false"
145
- >
146
-
147
- <template
148
- v-if="$props.imageId"
149
- >
150
- <slot
151
- name="image"
152
- v-bind="{ imageSize }"
153
- >
154
- <FSImage
155
- :imageId="$props.imageId"
156
- :cover="imageCover"
157
- :height="imageSize"
158
- :width="imageSize"
159
- />
160
- </slot>
161
- </template>
162
- <FSIconCard
163
- v-else-if="$props.icon"
164
- iconSize="70px"
165
- :backgroundVariant="$props.iconBackgroundVariant"
166
- :backgroundColor="$props.iconBackgroundColors"
167
- :border="$props.iconBorder"
168
- :iconColor="$props.color"
169
- :icon="$props.icon"
170
- :size="imageSize"
171
- />
172
- <FSCol
173
- align="center-left"
174
- >
175
- <FSText
176
- :font="$props.light ? 'text-h3' : 'text-h2'"
177
- >
178
- {{ $props.title }}
179
- </FSText>
180
- <FSCol
181
- v-if="!$props.light && ($props.subtitle || $props.description)"
182
- gap="4px"
183
- >
184
- <FSText
185
- v-if="$props.subtitle"
186
- font="text-button"
187
- >
188
- {{ $props.subtitle }}
189
- </FSText>
190
- <FSText
191
- v-if="$props.description"
192
- font="text-body"
193
- :lineClamp="2"
194
- >
195
- {{ $props.description }}
196
- </FSText>
197
- </FSCol>
198
- </FSCol>
199
- <FSRow
200
- v-if="!$props.light"
201
- align="center-right"
202
- >
203
- <slot
204
- name="title-append"
205
- />
206
- </FSRow>
207
- </FSRow>
208
- <template
209
- v-if="!$props.light"
210
- >
211
- <FSBreadcrumbs
212
- :items="$props.breadcrumbs"
213
- />
214
- <FSSlideGroup
215
- v-if="slots['toolbar']"
216
- >
217
- <slot
218
- name="toolbar"
219
- />
220
- </FSSlideGroup>
221
- </template>
222
- </FSCol>
223
- </template>
224
- </template>
225
-
226
- <script lang="ts">
227
- import { computed, defineComponent, type PropType } from "vue";
228
-
229
- import { type ColorBase, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
230
- import { useBreakpoints, useSlots } from "@dative-gpi/foundation-shared-components/composables";
231
-
232
- import FSBreadcrumbs from "../FSBreadcrumbs.vue";
233
- import FSSlideGroup from "../FSSlideGroup.vue";
234
- import FSIconCard from "../FSIconCard.vue";
235
- import FSImage from "../FSImage.vue";
236
- import FSText from "../FSText.vue";
237
- import FSCol from "../FSCol.vue";
238
- import FSRow from "../FSRow.vue";
239
-
240
- export default defineComponent({
241
- name: "FSEntityHeader",
242
- components: {
243
- FSBreadcrumbs,
244
- FSSlideGroup,
245
- FSIconCard,
246
- FSImage,
247
- FSText,
248
- FSCol,
249
- FSRow
250
- },
251
- props: {
252
- imageId: {
253
- type: String as PropType<string | null>,
254
- required: false,
255
- default: null
256
- },
257
- color: {
258
- type: String as PropType<ColorBase>,
259
- required: false,
260
- default: null
261
- },
262
- icon: {
263
- type: String as PropType<string>,
264
- required: false,
265
- default: "mdi-ab-testing"
266
- },
267
- iconBackgroundVariant: {
268
- type: String as PropType<"background" | "standard" | "full" | "gradient">,
269
- required: false,
270
- default: "background"
271
- },
272
- iconBackgroundColors: {
273
- type: Array as PropType<string[]>,
274
- required: false,
275
- default: () => []
276
- },
277
- iconBorder: {
278
- type: Boolean as PropType<boolean>,
279
- required: false,
280
- default: true
281
- },
282
- title: {
283
- type: String as PropType<string | null>,
284
- required: false,
285
- default: null
286
- },
287
- subtitle: {
288
- type: String as PropType<string | null>,
289
- required: false,
290
- default: null
291
- },
292
- description: {
293
- type: String as PropType<string | null>,
294
- required: false,
295
- default: null
296
- },
297
- breadcrumbs: {
298
- type: Array as PropType<Array<FSBreadcrumbItem>>,
299
- required: false,
300
- default: () => []
301
- },
302
- light: {
303
- type: Boolean,
304
- required: false,
305
- default: false
306
- },
307
- imageCover: {
308
- type: Boolean,
309
- required: false,
310
- default: true
311
- }
312
- },
313
- setup(props) {
314
- const { isExtraSmall, isMobileSized } = useBreakpoints();
315
- const { slots } = useSlots();
316
-
317
- const imageSize = computed((): string[] | string => {
318
- if (props.light) {
319
- return ["40px", "36px"];
320
- }
321
- return ["124px", "96px", "80px"];
322
- });
323
-
324
- const rightOverflow = computed(() => {
325
- let result = imageSize.value[0];
326
- if (isExtraSmall.value && imageSize.value[2]) {
327
- result = imageSize.value[2];
328
- }
329
- if ((isExtraSmall.value || isMobileSized.value) && imageSize.value[1]) {
330
- result = imageSize.value[1];
331
- }
332
- return result;
333
- });
334
-
335
- return {
336
- rightOverflow,
337
- isExtraSmall,
338
- imageSize,
339
- slots
340
- };
341
- }
342
- });
343
- </script>