@dative-gpi/foundation-shared-components 0.0.229 → 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 +36 -16
  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 +11 -5
  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 +51 -28
  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
@@ -52,7 +52,7 @@
52
52
  </template>
53
53
 
54
54
  <script lang="ts">
55
- import { computed, defineComponent, type PropType } from "vue";
55
+ import { computed, defineComponent, type PropType, type StyleValue } from "vue";
56
56
 
57
57
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
58
58
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -136,15 +136,13 @@ export default defineComponent({
136
136
  const backgrounds = getColors(ColorEnum.Background);
137
137
  const lights = getColors(ColorEnum.Light);
138
138
 
139
- const style = computed((): { [key: string] : string | null | undefined } => {
140
- return {
141
- "--fs-accordion-panel-padding-title" : sizeToVar(props.paddingTitle),
142
- "--fs-accordion-panel-padding-content" : sizeToVar(props.paddingContent),
143
- "--fs-accordion-panel-divider-size" : props.divider ? "1px" : "0",
144
- "--fs-accordion-panel-divider-color" : lights.dark,
145
- "--fs-accordion-panel-background-color" : backgrounds.base
146
- };
147
- });
139
+ const style = computed((): StyleValue => ({
140
+ "--fs-accordion-panel-padding-title" : sizeToVar(props.paddingTitle),
141
+ "--fs-accordion-panel-padding-content" : sizeToVar(props.paddingContent),
142
+ "--fs-accordion-panel-divider-size" : props.divider ? "1px" : "0",
143
+ "--fs-accordion-panel-divider-color" : lights.dark,
144
+ "--fs-accordion-panel-background-color": backgrounds.base
145
+ }));
148
146
 
149
147
  return {
150
148
  style
@@ -18,11 +18,9 @@
18
18
  </template>
19
19
 
20
20
  <script lang="ts">
21
- import type { PropType } from "vue";
22
- import { defineComponent } from "vue";
21
+ import { defineComponent, type PropType } from "vue";
23
22
 
24
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
25
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
23
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
26
24
 
27
25
  export default defineComponent({
28
26
  name: "FSBadge",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <v-breadcrumbs
3
- :style="style"
4
3
  :items="$props.items"
4
+ :style="style"
5
5
  v-bind="$attrs"
6
6
  >
7
7
  <template
@@ -27,11 +27,9 @@
27
27
  </template>
28
28
 
29
29
  <script lang="ts">
30
- import type { PropType, Ref} from "vue";
31
- import { defineComponent, ref } from "vue";
30
+ import { computed, defineComponent, type PropType, type StyleValue } from "vue";
32
31
 
33
- import type { FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
34
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
32
+ import { ColorEnum, type FSBreadcrumbItem } from "@dative-gpi/foundation-shared-components/models";
35
33
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
36
34
 
37
35
  import FSSpan from "./FSSpan.vue";
@@ -46,7 +44,8 @@ export default defineComponent({
46
44
  props: {
47
45
  items: {
48
46
  type: Array as PropType<FSBreadcrumbItem[]>,
49
- required: true,
47
+ required: false,
48
+ default: () => []
50
49
  }
51
50
  },
52
51
  setup() {
@@ -54,11 +53,11 @@ export default defineComponent({
54
53
 
55
54
  const darks = getColors(ColorEnum.Dark);
56
55
 
57
- const style: Ref<{ [key: string] : string }> = ref({
58
- "--fs-breadcrumbs-color": darks.dark,
59
- "--fs-breadcrumbs-active-color": darks.base,
56
+ const style = computed((): StyleValue => ({
57
+ "--fs-breadcrumbs-color" : darks.dark,
58
+ "--fs-breadcrumbs-active-color" : darks.base,
60
59
  "--fs-breadcrumbs-disabled-color": darks.soft
61
- });
60
+ }));
62
61
 
63
62
  const classes = (item: FSBreadcrumbItem): string[] => {
64
63
  const classNames = ["fs-breadcrumbs-label"];
@@ -1,20 +1,19 @@
1
1
  <template>
2
2
  <FSClickable
3
- v-if="!['icon'].includes($props.variant)"
3
+ v-if="$props.variant !== 'icon'"
4
4
  :editable="$props.editable"
5
- :height="['40px', '36px']"
5
+ :padding="padding"
6
6
  :variant="$props.variant"
7
7
  :color="$props.color"
8
8
  :load="$props.load"
9
9
  :href="$props.href"
10
- :padding="padding"
11
10
  :to="$props.to"
12
11
  :style="style"
13
- :width="width"
14
12
  @click.stop="onClick"
15
13
  v-bind="$attrs"
16
14
  >
17
15
  <FSRow
16
+ v-if="$props.direction === 'row'"
18
17
  align="center-center"
19
18
  width="fill"
20
19
  :wrap="false"
@@ -51,6 +50,43 @@
51
50
  </FSIcon>
52
51
  </slot>
53
52
  </FSRow>
53
+ <FSCol
54
+ v-else
55
+ align="center-center"
56
+ width="fill"
57
+ >
58
+ <slot
59
+ name="prepend"
60
+ v-bind="{ color: $props.color, colors }"
61
+ >
62
+ <FSIcon
63
+ v-if="$props.prependIcon || $props.icon"
64
+ :size="$props.iconSize"
65
+ >
66
+ {{ $props.prependIcon ?? $props.icon }}
67
+ </FSIcon>
68
+ </slot>
69
+ <slot
70
+ v-bind="{ color: $props.color, colors }"
71
+ >
72
+ <FSSpan
73
+ v-if="$props.label"
74
+ >
75
+ {{ $props.label }}
76
+ </FSSpan>
77
+ </slot>
78
+ <slot
79
+ name="append"
80
+ v-bind="{ color: $props.color, colors }"
81
+ >
82
+ <FSIcon
83
+ v-if="$props.appendIcon"
84
+ :size="$props.iconSize"
85
+ >
86
+ {{ $props.appendIcon }}
87
+ </FSIcon>
88
+ </slot>
89
+ </FSCol>
54
90
  </FSClickable>
55
91
  <FSRow
56
92
  v-else
@@ -128,28 +164,39 @@
128
164
  </template>
129
165
 
130
166
  <script lang="ts">
131
- import type { PropType } from "vue";
132
- import { computed, defineComponent } from "vue";
133
- import type { RouteLocation } from "vue-router";
167
+ import { computed, defineComponent, type PropType, type StyleValue, useSlots } from "vue";
168
+ import { type RouteLocation } from "vue-router";
134
169
 
135
- import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
136
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
137
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
170
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
171
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
138
172
 
139
173
  import FSClickable from "./FSClickable.vue";
140
174
  import FSSpan from "./FSSpan.vue";
141
175
  import FSIcon from "./FSIcon.vue";
176
+ import FSCol from "./FSCol.vue";
142
177
  import FSRow from "./FSRow.vue";
143
178
 
179
+ const PADDING_ICON_ONLY = "7px";
180
+ const PADDING_LABEL_ONLY = ["9px 16px", "9px 12px"];
181
+ const PADDING_ICON_LABEL = ["7px 16px", "7px 12px"];
182
+
183
+ const DEFAULT_PADDING = PADDING_ICON_LABEL;
184
+
144
185
  export default defineComponent({
145
186
  name: "FSButton",
146
187
  components: {
147
188
  FSClickable,
148
189
  FSSpan,
149
190
  FSIcon,
191
+ FSCol,
150
192
  FSRow
151
193
  },
152
194
  props: {
195
+ padding: {
196
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
197
+ required: false,
198
+ default: DEFAULT_PADDING
199
+ },
153
200
  to: {
154
201
  type: [String, Object] as PropType<string | RouteLocation | null>,
155
202
  required: false,
@@ -166,7 +213,7 @@ export default defineComponent({
166
213
  default: null
167
214
  },
168
215
  label: {
169
- type: [String, Function],
216
+ type: [String, Function] as PropType<string | Function | null>,
170
217
  required: false,
171
218
  default: null
172
219
  },
@@ -183,23 +230,23 @@ export default defineComponent({
183
230
  iconSize: {
184
231
  type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
185
232
  required: false,
186
- default: "l"
233
+ default: () => ["24px", "20px"]
187
234
  },
188
235
  variant: {
189
236
  type: String as PropType<"standard" | "full" | "icon">,
190
237
  required: false,
191
238
  default: "standard"
192
239
  },
240
+ direction: {
241
+ type: String as PropType<"row" | "column">,
242
+ required: false,
243
+ default: "row"
244
+ },
193
245
  color: {
194
246
  type: String as PropType<ColorBase>,
195
247
  required: false,
196
248
  default: ColorEnum.Light
197
249
  },
198
- fullWidth: {
199
- type: Boolean,
200
- required: false,
201
- default: false
202
- },
203
250
  load: {
204
251
  type: Boolean,
205
252
  required: false,
@@ -214,13 +261,13 @@ export default defineComponent({
214
261
  emits: ["click"],
215
262
  setup(props, { emit }) {
216
263
  const { getColors } = useColors();
217
- const { slots } = useSlots();
218
264
 
219
265
  const colors = computed(() => getColors(props.color));
220
266
  const lights = getColors(ColorEnum.Light);
221
267
  const darks = getColors(ColorEnum.Dark);
268
+ const slots = useSlots();
222
269
 
223
- const style = computed((): { [key: string] : string | null | undefined } => {
270
+ const style = computed((): StyleValue => {
224
271
  if (!props.editable) {
225
272
  switch (props.variant) {
226
273
  case "icon": return {
@@ -262,19 +309,23 @@ export default defineComponent({
262
309
  }
263
310
  });
264
311
 
265
- const padding = computed((): string | number => {
266
- switch (props.variant) {
267
- case "standard":
268
- case "full": return (!slots.default && !props.label) ? "0 7px" : "0 16px";
269
- default: return "0px";
312
+ const padding = computed(() => {
313
+ if (props.padding !== DEFAULT_PADDING) {
314
+ return props.padding;
270
315
  }
271
- });
272
316
 
273
- const width = computed((): string | number => {
274
- if (props.fullWidth) {
275
- return "100%";
317
+ const hasIcon = props.prependIcon || props.appendIcon || props.icon
318
+ || !!slots.prepend || !!slots.append;
319
+
320
+ const hasLabel = props.label || !!slots.default;
321
+
322
+ if (!hasLabel && hasIcon) {
323
+ return PADDING_ICON_ONLY;
276
324
  }
277
- return "fit-content";
325
+ else if (hasLabel && !hasIcon) {
326
+ return PADDING_LABEL_ONLY;
327
+ }
328
+ return DEFAULT_PADDING;
278
329
  });
279
330
 
280
331
  const onClick = (event: MouseEvent) => {
@@ -286,10 +337,9 @@ export default defineComponent({
286
337
  return {
287
338
  iconClasses,
288
339
  loadColor,
289
- padding,
290
340
  colors,
291
341
  style,
292
- width,
342
+ padding,
293
343
  onClick
294
344
  };
295
345
  }
@@ -65,12 +65,10 @@
65
65
  </template>
66
66
 
67
67
  <script lang="ts">
68
- import type { PropType} from "vue";
69
- import { computed, defineComponent, ref } from "vue";
68
+ import { computed, defineComponent, onMounted, type PropType, ref, type StyleValue } from "vue";
70
69
 
71
- import { useAppTimeZone, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
72
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
73
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
70
+ import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
71
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
74
72
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
75
73
 
76
74
  import FSButton from "./FSButton.vue";
@@ -110,30 +108,28 @@ export default defineComponent({
110
108
  },
111
109
  emits: ["update:modelValue"],
112
110
  setup(props, { emit }) {
113
- const { epochToPicker, pickerToEpoch, todayToEpoch } = useAppTimeZone();
111
+ const { epochToPicker, pickerToEpoch, todayToEpoch } = useDateFormat();
114
112
  const { languageCode } = useAppLanguageCode();
115
113
  const { getColors } = useColors();
114
+
115
+ const innerMonth = ref(new Date().getMonth());
116
+ const innerYear = ref(new Date().getFullYear());
116
117
 
117
118
  const colors = computed(() => getColors(props.color));
118
119
  const backgrounds = getColors(ColorEnum.Background);
119
120
  const darks = getColors(ColorEnum.Dark);
120
-
121
- const innerMonth = ref(props.modelValue ? epochToPicker(props.modelValue).getMonth() : new Date().getMonth());
122
- const innerYear = ref(props.modelValue ? epochToPicker(props.modelValue).getFullYear() : new Date().getFullYear());
123
121
 
124
- const style = computed((): { [key: string] : string | null | undefined } => {
125
- return {
126
- "--fs-calendar-background-color" : backgrounds.base,
127
- "--fs-calendar-hover-background-color" : colors.value.light,
128
- "--fs-calendar-active-background-color": colors.value.base,
129
- "--fs-calendar-border-color" : darks.base,
130
- "--fs-calendar-hover-border-color" : colors.value.base,
131
- "--fs-calendar-active-border-color" : colors.value.base,
132
- "--fs-calendar-color" : darks.base,
133
- "--fs-calendar-hover-color" : colors.value.base,
134
- "--fs-calendar-active-color" : colors.value.light
135
- };
136
- });
122
+ const style = computed((): StyleValue => ({
123
+ "--fs-calendar-background-color" : backgrounds.base,
124
+ "--fs-calendar-hover-background-color" : colors.value.light,
125
+ "--fs-calendar-active-background-color": colors.value.base,
126
+ "--fs-calendar-border-color" : darks.base,
127
+ "--fs-calendar-hover-border-color" : colors.value.base,
128
+ "--fs-calendar-active-border-color" : colors.value.base,
129
+ "--fs-calendar-color" : darks.base,
130
+ "--fs-calendar-hover-color" : colors.value.base,
131
+ "--fs-calendar-active-color" : colors.value.light
132
+ }));
137
133
 
138
134
  const text = computed((): string => {
139
135
  const date = new Date(0);
@@ -163,24 +159,30 @@ export default defineComponent({
163
159
  };
164
160
 
165
161
  const onClickDate = (value: unknown): void => {
166
- const date = (value as Date[])[0];
167
- const epoch = pickerToEpoch(date);
168
- emit("update:modelValue", epoch);
162
+ if (!Array.isArray(value) || !(value[0] instanceof Date)) {
163
+ return;
164
+ }
165
+ emit("update:modelValue", pickerToEpoch(value[0]));
169
166
  };
170
167
 
171
168
  const allowedDates = (value: unknown): boolean => {
172
- const date = value as Date;
173
- const valueEpoch = pickerToEpoch(date);
169
+ if (!(value instanceof Date)) {
170
+ return false;
171
+ }
174
172
  switch (props.limit) {
175
- case "past":
176
- return valueEpoch <= todayToEpoch(true);
177
- case "future":
178
- return valueEpoch >= todayToEpoch(true);
179
- default:
180
- return true;
173
+ case "past" : return pickerToEpoch(value) <= todayToEpoch();
174
+ case "future": return pickerToEpoch(value) >= todayToEpoch();
175
+ default : return true;
181
176
  }
182
177
  };
183
178
 
179
+ onMounted(() => {
180
+ if (props.modelValue) {
181
+ innerMonth.value = epochToPicker(props.modelValue).getMonth();
182
+ innerYear.value = epochToPicker(props.modelValue).getFullYear();
183
+ }
184
+ });
185
+
184
186
  return {
185
187
  ColorEnum,
186
188
  languageCode,
@@ -112,12 +112,10 @@
112
112
  </template>
113
113
 
114
114
  <script lang="ts">
115
- import type { PropType} from "vue";
116
- import { computed, defineComponent, onMounted, ref } from "vue";
115
+ import { computed, defineComponent, onMounted, type PropType, ref, type StyleValue } from "vue";
117
116
 
118
- import { useAppTimeZone, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
119
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
120
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
117
+ import { useDateFormat, useAppLanguageCode } from "@dative-gpi/foundation-shared-services/composables";
118
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
121
119
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
122
120
 
123
121
  import FSButton from "./FSButton.vue";
@@ -157,13 +155,9 @@ export default defineComponent({
157
155
  },
158
156
  emits: ["update:modelValue"],
159
157
  setup(props, { emit }) {
160
- const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useAppTimeZone();
158
+ const { epochToPicker, epochToPickerHeader, pickerToEpoch, todayToEpoch } = useDateFormat();
161
159
  const { languageCode } = useAppLanguageCode();
162
160
  const { getColors } = useColors();
163
-
164
- const colors = computed(() => getColors(props.color));
165
- const backgrounds = getColors(ColorEnum.Background);
166
- const darks = getColors(ColorEnum.Dark);
167
161
 
168
162
  const innerLeftMonth = ref(new Date().getMonth());
169
163
  const innerLeftYear = ref(new Date().getFullYear());
@@ -173,72 +167,21 @@ export default defineComponent({
173
167
 
174
168
  const toggle = ref((props.modelValue?.length ?? 0) % 2);
175
169
 
176
- onMounted((): void => {
177
- if (!props.modelValue || !props.modelValue.length) {
178
- innerLeftMonth.value = new Date().getMonth();
179
- innerLeftYear.value = new Date().getFullYear();
180
- if (innerLeftMonth.value < 11) {
181
- innerRightMonth.value = innerLeftMonth.value + 1;
182
- innerRightYear.value = innerLeftYear.value;
183
- }
184
- else {
185
- innerRightMonth.value = 0;
186
- innerRightYear.value = innerLeftYear.value + 1;
187
- }
188
- }
189
- else {
190
- innerLeftMonth.value = epochToPickerHeader(props.modelValue[0]).m;
191
- innerLeftYear.value = epochToPickerHeader(props.modelValue[0]).y;
192
- if (innerLeftMonth.value < 11) {
193
- innerRightMonth.value = innerLeftMonth.value + 1;
194
- innerRightYear.value = innerLeftYear.value;
195
- }
196
- else {
197
- innerRightMonth.value = 0;
198
- innerRightYear.value = innerLeftYear.value + 1;
199
- }
200
- }
201
- });
202
-
203
- const compare = (operator: "before" | "during" | "after", side: "left" | "right", date: { d: number, m: number, y: number }): boolean => {
204
- switch (operator) {
205
- case "before":
206
- switch (side) {
207
- case "left":
208
- return innerLeftYear.value > date.y || (innerLeftYear.value === date.y && innerLeftMonth.value > date.m);
209
- default:
210
- return innerRightYear.value > date.y || (innerRightYear.value === date.y && innerRightMonth.value > date.m);
211
- }
212
- case "during":
213
- switch (side) {
214
- case "left":
215
- return innerLeftYear.value === date.y && innerLeftMonth.value === date.m;
216
- default:
217
- return innerRightYear.value === date.y && innerRightMonth.value === date.m;
218
- }
219
- case "after":
220
- switch (side) {
221
- case "left":
222
- return innerLeftYear.value < date.y || (innerLeftYear.value === date.y && innerLeftMonth.value < date.m);
223
- default:
224
- return innerRightYear.value < date.y || (innerRightYear.value === date.y && innerRightMonth.value < date.m);
225
- }
226
- }
227
- }
170
+ const colors = computed(() => getColors(props.color));
171
+ const backgrounds = getColors(ColorEnum.Background);
172
+ const darks = getColors(ColorEnum.Dark);
228
173
 
229
- const style = computed((): { [key: string] : string | null | undefined } => {
230
- return {
231
- "--fs-calendar-background-color" : backgrounds.base,
232
- "--fs-calendar-hover-background-color" : colors.value.light,
233
- "--fs-calendar-active-background-color": colors.value.base,
234
- "--fs-calendar-border-color" : darks.base,
235
- "--fs-calendar-hover-border-color" : colors.value.base,
236
- "--fs-calendar-active-border-color" : colors.value.base,
237
- "--fs-calendar-color" : darks.base,
238
- "--fs-calendar-hover-color" : colors.value.base,
239
- "--fs-calendar-active-color" : colors.value.light
240
- };
241
- });
174
+ const style = computed((): StyleValue => ({
175
+ "--fs-calendar-background-color" : backgrounds.base,
176
+ "--fs-calendar-hover-background-color" : colors.value.light,
177
+ "--fs-calendar-active-background-color": colors.value.base,
178
+ "--fs-calendar-border-color" : darks.base,
179
+ "--fs-calendar-hover-border-color" : colors.value.base,
180
+ "--fs-calendar-active-border-color" : colors.value.base,
181
+ "--fs-calendar-color" : darks.base,
182
+ "--fs-calendar-hover-color" : colors.value.base,
183
+ "--fs-calendar-active-color" : colors.value.light
184
+ }));
242
185
 
243
186
  const innerLeftValue = computed((): number[] => {
244
187
  if (!props.modelValue || !props.modelValue.length) {
@@ -318,6 +261,32 @@ export default defineComponent({
318
261
  return classNames;
319
262
  });
320
263
 
264
+ const compare = (operator: "before" | "during" | "after", side: "left" | "right", date: { d: number, m: number, y: number }): boolean => {
265
+ switch (operator) {
266
+ case "before":
267
+ switch (side) {
268
+ case "left":
269
+ return innerLeftYear.value > date.y || (innerLeftYear.value === date.y && innerLeftMonth.value > date.m);
270
+ default:
271
+ return innerRightYear.value > date.y || (innerRightYear.value === date.y && innerRightMonth.value > date.m);
272
+ }
273
+ case "during":
274
+ switch (side) {
275
+ case "left":
276
+ return innerLeftYear.value === date.y && innerLeftMonth.value === date.m;
277
+ default:
278
+ return innerRightYear.value === date.y && innerRightMonth.value === date.m;
279
+ }
280
+ case "after":
281
+ switch (side) {
282
+ case "left":
283
+ return innerLeftYear.value < date.y || (innerLeftYear.value === date.y && innerLeftMonth.value < date.m);
284
+ default:
285
+ return innerRightYear.value < date.y || (innerRightYear.value === date.y && innerRightMonth.value < date.m);
286
+ }
287
+ }
288
+ };
289
+
321
290
  const onClickPrevious = (): void => {
322
291
  if (innerLeftMonth.value === 11) {
323
292
  innerLeftMonth.value--;
@@ -372,7 +341,6 @@ export default defineComponent({
372
341
  }
373
342
  };
374
343
 
375
-
376
344
  const onClickRight = (value: unknown): void => {
377
345
  const dates = value as Date[];
378
346
  const clicked = pickerToEpoch(dates[dates.length - 1]);
@@ -395,18 +363,43 @@ export default defineComponent({
395
363
  };
396
364
 
397
365
  const allowedDates = (value: unknown): boolean => {
398
- const date = value as Date;
399
- const valueEpoch = pickerToEpoch(date);
366
+ if (!(value instanceof Date)) {
367
+ return false;
368
+ }
400
369
  switch (props.limit) {
401
- case "past":
402
- return valueEpoch <= todayToEpoch(true);
403
- case "future":
404
- return valueEpoch >= todayToEpoch(true);
405
- default:
406
- return true;
370
+ case "past" : return pickerToEpoch(value) <= todayToEpoch();
371
+ case "future": return pickerToEpoch(value) >= todayToEpoch();
372
+ default : return true;
407
373
  }
408
374
  };
409
375
 
376
+ onMounted((): void => {
377
+ if (!props.modelValue || !props.modelValue.length) {
378
+ innerLeftMonth.value = new Date().getMonth();
379
+ innerLeftYear.value = new Date().getFullYear();
380
+ if (innerLeftMonth.value < 11) {
381
+ innerRightMonth.value = innerLeftMonth.value + 1;
382
+ innerRightYear.value = innerLeftYear.value;
383
+ }
384
+ else {
385
+ innerRightMonth.value = 0;
386
+ innerRightYear.value = innerLeftYear.value + 1;
387
+ }
388
+ }
389
+ else {
390
+ innerLeftMonth.value = epochToPickerHeader(props.modelValue[0]).m;
391
+ innerLeftYear.value = epochToPickerHeader(props.modelValue[0]).y;
392
+ if (innerLeftMonth.value < 11) {
393
+ innerRightMonth.value = innerLeftMonth.value + 1;
394
+ innerRightYear.value = innerLeftYear.value;
395
+ }
396
+ else {
397
+ innerRightMonth.value = 0;
398
+ innerRightYear.value = innerLeftYear.value + 1;
399
+ }
400
+ }
401
+ });
402
+
410
403
  return {
411
404
  ColorEnum,
412
405
  languageCode,