@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
@@ -12,8 +12,8 @@
12
12
  gap="24px"
13
13
  >
14
14
  <FSFadeOut
15
- :height="height"
16
15
  padding="0 8px 0 0"
16
+ :maxHeight="maxHeight"
17
17
  >
18
18
  <slot
19
19
  name="body"
@@ -60,8 +60,8 @@
60
60
  gap="24px"
61
61
  >
62
62
  <FSFadeOut
63
- :height="height"
64
63
  padding="0 8px 0 0"
64
+ :maxHeight="maxHeight"
65
65
  >
66
66
  <slot
67
67
  name="validation"
@@ -227,7 +227,7 @@ export default defineComponent({
227
227
  const formRef = ref<HTMLElement | null>(null);
228
228
  const valid = ref(false);
229
229
 
230
- const height = computed(() => {
230
+ const maxHeight = computed(() => {
231
231
  const other = 24 + 24 // Paddings
232
232
  + (isMobileSized.value ? 24 : 32) + 24 // Title
233
233
  + (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
@@ -262,8 +262,8 @@ export default defineComponent({
262
262
  cancelLabel,
263
263
  submitLabel,
264
264
  ColorEnum,
265
+ maxHeight,
265
266
  formRef,
266
- height,
267
267
  valid,
268
268
  onValidate,
269
269
  onSubmit
@@ -25,11 +25,9 @@
25
25
  </template>
26
26
 
27
27
  <script lang="ts">
28
- import type { PropType } from "vue";
29
- import { computed, defineComponent } from "vue";
28
+ import { computed, defineComponent, type PropType } from "vue";
30
29
 
31
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
32
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
30
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
33
31
  import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
34
32
 
35
33
  import FSCard from "./FSCard.vue";
@@ -1,60 +1,69 @@
1
1
  <template>
2
- <FSWindow
3
- width="100%"
4
- :modelValue="currentStep - 1"
2
+ <FSCol
3
+ gap="24px"
5
4
  >
6
- <FSForm
7
- v-for="(step, index) in $props.steps"
8
- :variant="$props.variant"
9
- :key="index"
10
- @submit="onSubmit"
11
- v-model="valid"
5
+ <FSPagination
6
+ width="calc(100% - 16px)"
7
+ :pages="$props.steps"
8
+ :modelValue="currentStep - 1"
9
+ />
10
+ <FSWindow
11
+ width="100%"
12
+ :modelValue="currentStep - 1"
12
13
  >
13
- <FSCol
14
- gap="24px"
14
+ <FSForm
15
+ v-for="(step, index) in $props.steps"
16
+ :variant="$props.variant"
17
+ :key="index"
18
+ @submit="onSubmit"
19
+ v-model="valid"
15
20
  >
16
- <FSFadeOut
17
- :height="height"
18
- padding="0 8px 0 0"
21
+ <FSCol
22
+ gap="24px"
19
23
  >
20
- <slot
21
- :name="`step-${step}`"
22
- />
23
- </FSFadeOut>
24
- <FSRow
25
- padding="0 16px 0 0"
26
- >
27
- <slot
28
- name="left-footer"
29
- />
30
- <FSRow
31
- class="fs-dialog-actions"
32
- align="top-right"
33
- :wrap="false"
24
+ <FSFadeOut
25
+ padding="0 8px 0 0"
26
+ :maxHeight="maxHeight"
34
27
  >
35
- <FSButton
36
- :prependIcon="$props.cancelButtonPrependIcon"
37
- :appendIcon="$props.cancelButtonAppendIcon"
38
- :variant="$props.cancelButtonVariant"
39
- :color="$props.cancelButtonColor"
40
- :label="previousButtonLabel"
41
- @click="onPrevious()"
28
+ <slot
29
+ :name="`step-${step}`"
42
30
  />
43
- <FSButton
44
- type="submit"
45
- :prependIcon="$props.submitButtonPrependIcon"
46
- :appendIcon="$props.submitButtonAppendIcon"
47
- :color="$props.submitButtonColor"
48
- :variant="nextButtonVariant"
49
- :editable="$props.editable"
50
- :label="nextButtonLabel"
51
- :load="$props.load"
31
+ </FSFadeOut>
32
+ <FSRow
33
+ padding="0 16px 0 0"
34
+ >
35
+ <slot
36
+ name="left-footer"
52
37
  />
38
+ <FSRow
39
+ class="fs-dialog-actions"
40
+ align="top-right"
41
+ :wrap="false"
42
+ >
43
+ <FSButton
44
+ :prependIcon="$props.cancelButtonPrependIcon"
45
+ :appendIcon="$props.cancelButtonAppendIcon"
46
+ :variant="$props.cancelButtonVariant"
47
+ :color="$props.cancelButtonColor"
48
+ :label="previousButtonLabel"
49
+ @click="onPrevious()"
50
+ />
51
+ <FSButton
52
+ type="submit"
53
+ :prependIcon="$props.submitButtonPrependIcon"
54
+ :appendIcon="$props.submitButtonAppendIcon"
55
+ :color="$props.submitButtonColor"
56
+ :variant="nextButtonVariant"
57
+ :editable="$props.editable"
58
+ :label="nextButtonLabel"
59
+ :load="$props.load"
60
+ />
61
+ </FSRow>
53
62
  </FSRow>
54
- </FSRow>
55
- </FSCol>
56
- </FSForm>
57
- </FSWindow>
63
+ </FSCol>
64
+ </FSForm>
65
+ </FSWindow>
66
+ </FSCol>
58
67
  </template>
59
68
 
60
69
  <script lang="ts">
@@ -64,17 +73,21 @@ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui
64
73
  import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
65
74
  import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
66
75
 
76
+ import FSPagination from "./FSPagination.vue";
67
77
  import FSFadeOut from "./FSFadeOut.vue";
68
78
  import FSButton from "./FSButton.vue";
69
79
  import FSForm from "./FSForm.vue";
80
+ import FSCol from "./FSCol.vue";
70
81
  import FSRow from "./FSRow.vue";
71
82
 
72
83
  export default defineComponent({
73
84
  name: "FSDialogMultiFormBody",
74
85
  components: {
86
+ FSPagination,
75
87
  FSFadeOut,
76
88
  FSButton,
77
89
  FSForm,
90
+ FSCol,
78
91
  FSRow
79
92
  },
80
93
  props: {
@@ -167,7 +180,7 @@ export default defineComponent({
167
180
  const valid = ref(false);
168
181
  const valids = ref(Array.from({ length: props.steps }, () => false));
169
182
 
170
- const height = computed(() => {
183
+ const maxHeight = computed(() => {
171
184
  const other = 24 + 24 // Paddings
172
185
  + (isMobileSized.value ? 24 : 32) + 24 // Title
173
186
  + (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
@@ -220,7 +233,7 @@ export default defineComponent({
220
233
  nextButtonLabel,
221
234
  currentStep,
222
235
  ColorEnum,
223
- height,
236
+ maxHeight,
224
237
  valids,
225
238
  valid,
226
239
  onPrevious,
@@ -1,5 +1,6 @@
1
1
  <template>
2
2
  <FSDialogSubmit
3
+ width="460px"
3
4
  :title="title"
4
5
  :submitButtonLabel="$tr('ui.button.remove', 'Remove')"
5
6
  :submitButtonColor="ColorEnum.Error"
@@ -11,8 +11,8 @@
11
11
  #body
12
12
  >
13
13
  <FSFadeOut
14
- :height="height"
15
14
  padding="0 8px 0 0"
15
+ :maxHeight="maxHeight"
16
16
  >
17
17
  <slot
18
18
  name="body"
@@ -61,12 +61,10 @@
61
61
  </template>
62
62
 
63
63
  <script lang="ts">
64
- import type { PropType } from "vue";
65
- import { computed, defineComponent } from "vue";
64
+ import { computed, defineComponent, type PropType } from "vue";
66
65
 
67
66
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
68
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
69
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
67
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
70
68
  import { useBreakpoints } from "@dative-gpi/foundation-shared-components/composables";
71
69
 
72
70
  import FSFadeOut from "./FSFadeOut.vue";
@@ -169,7 +167,7 @@ export default defineComponent({
169
167
  const { isMobileSized } = useBreakpoints();
170
168
  const { $tr } = useTranslationsProvider();
171
169
 
172
- const height = computed(() => {
170
+ const maxHeight = computed(() => {
173
171
  const other = 24 + 24 // Paddings
174
172
  + (isMobileSized.value ? 24 : 32) + 24 // Title
175
173
  + (props.subtitle ? (isMobileSized.value ? 14 : 16) + 8 : 0) // Subtitle
@@ -189,7 +187,7 @@ export default defineComponent({
189
187
  cancelLabel,
190
188
  submitLabel,
191
189
  ColorEnum,
192
- height
190
+ maxHeight
193
191
  };
194
192
  }
195
193
  });
@@ -34,12 +34,10 @@
34
34
  </template>
35
35
 
36
36
  <script lang="ts">
37
- import type { PropType } from "vue";
38
- import { computed, defineComponent } from "vue";
37
+ import { computed, defineComponent, type PropType, type StyleValue } from "vue";
39
38
 
39
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
40
40
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
41
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
42
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
43
41
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
44
42
 
45
43
  import FSText from "./FSText.vue";
@@ -61,7 +59,7 @@ export default defineComponent({
61
59
  default: "100%"
62
60
  },
63
61
  font: {
64
- type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-h4" | "text-body" | "text-button" | "text-overline" | "text-underline">,
62
+ type: String as PropType<"text-h1" | "text-h2" | "text-h3" | "text-h4" | "text-body" | "text-button" | "text-overline">,
65
63
  required: false,
66
64
  default: "text-body"
67
65
  },
@@ -87,7 +85,7 @@ export default defineComponent({
87
85
 
88
86
  const colors = computed(() => getColors(props.color));
89
87
 
90
- const style = computed((): { [key: string] : string | null | undefined } => {
88
+ const style = computed((): StyleValue => {
91
89
  switch (props.variant) {
92
90
  case "base": return {
93
91
  "--fs-divider-size" : sizeToVar(props.size),
@@ -109,9 +107,9 @@ export default defineComponent({
109
107
  });
110
108
 
111
109
  return {
112
- style,
113
- isEmpty
110
+ isEmpty,
111
+ style
114
112
  };
115
113
  }
116
114
  });
117
- </script>
115
+ </script>
@@ -1,300 +1,53 @@
1
1
  <template>
2
- <FSCol
3
- gap="8px"
4
- >
5
- <slot
6
- v-if="!$props.hideHeader"
7
- name="label"
8
- >
9
- <FSRow
10
- :wrap="false"
11
- >
12
- <FSSpan
13
- v-if="$props.label"
14
- class="fs-edit-image-label"
15
- font="text-overline"
16
- :style="style"
17
- >
18
- {{ $props.label }}
19
- </FSSpan>
20
- <FSSpan
21
- v-if="$props.label && $props.required"
22
- class="fs-edit-image-label"
23
- style="margin-left: -8px;"
24
- font="text-overline"
25
- :ellipsis="false"
26
- :style="style"
27
- >
28
- *
29
- </FSSpan>
30
- </FSRow>
31
- </slot>
32
- <FSCard
33
- v-if="['standard'].includes($props.variant)"
34
- padding="12px"
35
- width="100%"
36
- >
37
- <FSRow
38
- align="center-left"
39
- :wrap="false"
40
- >
41
- <FSRow
42
- gap="24px"
43
- :wrap="false"
44
- >
45
- <FSImage
46
- v-if="$props.imageId || $props.modelValue"
47
- :aspectRatio="$props.aspectRatio"
48
- :height="$props.height"
49
- :width="$props.width"
50
- :imageId="$props.imageId"
51
- :imageB64="$props.modelValue"
52
- />
53
- <FSCard
54
- v-else
55
- borderStyle="dashed"
56
- :aspectRatio="$props.aspectRatio"
57
- :height="$props.height"
58
- :width="$props.width"
59
- />
60
- <FSCol
61
- align="center-left"
62
- height="fill"
63
- width="hug"
64
- gap="10px"
65
- >
66
- <FSText
67
- v-if="fileSelected && fileSelected.fileName"
68
- font="text-body"
69
- :lineClamp="2"
70
- >
71
- {{ fileSelected.fileName }}
72
- </FSText>
73
- <FSCol
74
- gap="0px"
75
- >
76
- <FSText
77
- class="fs-edit-image-overline"
78
- font="text-overline"
79
- :style="style"
80
- >
81
- {{ $tr('ui.edit-image.format', 'PNG or JPG format') }}
82
- </FSText>
83
- <FSText
84
- class="fs-edit-image-overline"
85
- font="text-overline"
86
- :style="style"
87
- >
88
- {{ $tr('ui.edit-image.size', '10 MB Maximum') }}
89
- </FSText>
90
- </FSCol>
91
- </FSCol>
92
- </FSRow>
93
- <v-spacer />
94
- <FSRow
95
- width="hug"
96
- >
97
- <FSButtonFileMini
98
- accept="image/*"
99
- :readFile="false"
100
- @update:metadata="onUpload"
101
- />
102
- <FSButtonRemoveMini
103
- @click="onRemove"
104
- />
105
- </FSRow>
106
- </FSRow>
107
- </FSCard>
108
- <FSRow
109
- v-else-if="$props.imageId || $props.modelValue"
110
- :width="$props.width"
111
- class="fs-edit-image-full"
112
- >
113
- <FSImage
114
- :aspectRatio="$props.aspectRatio"
115
- :height="$props.height"
116
- :width="$props.width"
117
- :imageId="$props.imageId"
118
- :imageB64="$props.modelValue"
119
- />
120
- <FSRow
121
- class="fs-edit-image-full-toolbar"
122
- padding="4px"
123
- >
124
- <FSButtonFileMini
125
- accept="image/*"
126
- :readFile="false"
127
- @update:metadata="onUpload"
128
- />
129
- <FSButtonRemoveMini
130
- @click="onRemove"
131
- />
132
- </FSRow>
133
- </FSRow>
134
- <FSClickable
135
- v-else
136
- borderStyle="dashed"
137
- variant="background"
138
- :height="$props.height"
139
- :width="$props.width"
140
- @click="() => invisibleButtonRef.input.click()"
141
- >
142
- <FSRow
143
- align="center-center"
144
- :wrap="false"
145
- >
146
- <FSIcon>
147
- mdi-plus-box-outline
148
- </FSIcon>
149
- <FSText
150
- font="text-body"
151
- :lineClamp="2"
152
- >
153
- {{ $tr('ui.edit-image.add-image', 'Add an image.') }}
154
- </FSText>
155
- <FSButtonFileMini
156
- class="fs-edit-image-hidden-button"
157
- ref="invisibleButtonRef"
158
- accept="image/*"
159
- :readFile="false"
160
- @update:metadata="onUpload"
161
- />
162
- </FSRow>
163
- </FSClickable>
164
- </FSCol>
2
+ <FSEditImageUI
3
+ :source="source"
4
+ :blurHash="image"
5
+ @error="onError"
6
+ @update:source="$emit('update:imageId', $event)"
7
+ v-bind="$attrs"
8
+ />
165
9
  </template>
166
10
 
167
11
  <script lang="ts">
168
- import { computed, defineComponent, type PropType, ref, watch } from "vue";
12
+ import { computed, defineComponent, type PropType } from "vue";
169
13
 
170
- import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
171
- import { ColorEnum, type FileImage } from "@dative-gpi/foundation-shared-components/models";
172
- import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
14
+ import { IMAGE_RAW_URL } from "@dative-gpi/foundation-shared-services/config";
173
15
 
174
- import FSButtonRemoveMini from "./buttons/FSButtonRemoveMini.vue";
175
- import FSButtonFileMini from "./buttons/FSButtonFileMini.vue";
176
- import FSClickable from "./FSClickable.vue";
177
- import FSImage from "./FSImage.vue";
178
- import FSCard from "./FSCard.vue";
179
- import FSText from "./FSText.vue";
180
- import FSCol from "./FSCol.vue";
181
- import FSRow from "./FSRow.vue";
16
+ import { useImage } from "@dative-gpi/foundation-shared-services/composables";
17
+
18
+ import FSEditImageUI from "./FSEditImageUI.vue";
182
19
 
183
20
  export default defineComponent({
184
21
  name: "FSEditImage",
185
22
  components: {
186
- FSButtonRemoveMini,
187
- FSButtonFileMini,
188
- FSClickable,
189
- FSImage,
190
- FSCard,
191
- FSText,
192
- FSCol,
193
- FSRow
23
+ FSEditImageUI
194
24
  },
195
25
  props: {
196
- height: {
197
- type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
198
- required: false,
199
- default: null
200
- },
201
- width: {
202
- type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
203
- required: false,
204
- default: null
205
- },
206
- label: {
207
- type: String as PropType<string | null>,
208
- required: false,
209
- default: null
210
- },
211
26
  imageId: {
212
27
  type: String as PropType<string | null>,
213
28
  required: false,
214
29
  default: null
215
- },
216
- aspectRatio: {
217
- type: String as PropType<string | null>,
218
- required: false,
219
- default: null
220
- },
221
- modelValue: {
222
- type: String as PropType<string | null>,
223
- required: false,
224
- default: null
225
- },
226
- variant: {
227
- type: String as PropType<"standard" | "full">,
228
- required: false,
229
- default: "standard"
230
- },
231
- hideHeader: {
232
- type: Boolean,
233
- required: false,
234
- default: false
235
- },
236
- required: {
237
- type: Boolean,
238
- required: false,
239
- default: false
240
30
  }
241
31
  },
242
- emits: ["update:modelValue", "update:imageId"],
243
- setup(props, { emit }) {
244
- const { isExtraSmall } = useBreakpoints();
245
- const { getColors } = useColors();
246
- const { readFile } = useFiles();
247
-
248
- const fileSelected = ref<FileImage>({ fileName: "", fileContent: null });
249
- const invisibleButtonRef = ref<HTMLFormElement | null>(null);
250
-
251
- const errors = getColors(ColorEnum.Error);
252
- const lights = getColors(ColorEnum.Light);
253
- const darks = getColors(ColorEnum.Dark);
254
-
255
- const style = computed((): { [key: string]: string | undefined } => {
256
- return {
257
- "--fs-edit-image-overline-text-color": lights.dark,
258
- "--fs-edit-image-color" : darks.base,
259
- "--fs-edit-image-error-color" : errors.base
260
- };
261
- });
262
-
263
- const onUpload = async (payload: File) => {
264
- const content = (await readFile(payload)) as string;
265
- fileSelected.value.fileName = payload.name;
266
- fileSelected.value.fileContent = content;
267
- emit("update:modelValue", content.substring(content.indexOf(',') + 1));
32
+ emits: ["update:imageId"],
33
+ setup(props) {
34
+ const { get: getImage, entity: image } = useImage();
35
+
36
+ const source = computed(() => {
37
+ return props.imageId ? IMAGE_RAW_URL(props.imageId) : null;
38
+ })
39
+
40
+ const onError = (): void => {
268
41
  if (props.imageId) {
269
- emit("update:imageId", null);
42
+ console.error("Error loading image", props.imageId);
43
+ getImage(props.imageId);
270
44
  }
271
45
  };
272
46
 
273
- const onRemove = () => {
274
- fileSelected.value.fileName = "";
275
- fileSelected.value.fileContent = null;
276
- if (props.modelValue) {
277
- emit("update:modelValue", null);
278
- }
279
- else {
280
- emit("update:imageId", null);
281
- }
282
- };
283
-
284
- watch(() => props.modelValue, () => {
285
- if (!props.modelValue) {
286
- fileSelected.value.fileName = "";
287
- fileSelected.value.fileContent = null;
288
- }
289
- });
290
-
291
47
  return {
292
- invisibleButtonRef,
293
- fileSelected,
294
- isExtraSmall,
295
- style,
296
- onUpload,
297
- onRemove
48
+ image,
49
+ source,
50
+ onError
298
51
  };
299
52
  }
300
53
  });