@dative-gpi/foundation-shared-components 0.1.120 → 1.0.0

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 (196) hide show
  1. package/assets/images/map/imagery.png +0 -0
  2. package/assets/images/map/map.png +0 -0
  3. package/components/FSAccordion.vue +2 -1
  4. package/components/FSAccordionPanel.vue +20 -1
  5. package/components/FSBadge.vue +7 -3
  6. package/components/FSBreadcrumbs.vue +4 -2
  7. package/components/FSButton.vue +15 -8
  8. package/components/FSCalendar.vue +5 -2
  9. package/components/FSCalendarTwin.vue +6 -3
  10. package/components/FSCard.vue +4 -2
  11. package/components/FSCardPlaceholder.vue +80 -0
  12. package/components/FSCheckbox.vue +10 -7
  13. package/components/FSChip.vue +4 -2
  14. package/components/FSClickable.vue +5 -3
  15. package/components/FSClock.vue +18 -4
  16. package/components/FSCol.vue +12 -5
  17. package/components/FSColor.vue +4 -2
  18. package/components/FSColorIcon.vue +5 -3
  19. package/components/FSDialog.vue +28 -87
  20. package/components/FSDialogContent.vue +133 -0
  21. package/components/FSDialogForm.vue +25 -236
  22. package/components/FSDialogFormBody.vue +273 -0
  23. package/components/FSDialogMenu.vue +5 -2
  24. package/components/FSDialogMultiForm.vue +21 -197
  25. package/components/FSDialogMultiFormBody.vue +231 -0
  26. package/components/FSDialogSubmit.vue +4 -2
  27. package/components/FSDivider.vue +6 -4
  28. package/components/FSEditImage.vue +16 -9
  29. package/components/FSErrorToast.vue +2 -1
  30. package/components/FSFadeOut.vue +1 -1
  31. package/components/FSForm.vue +7 -7
  32. package/components/FSGrid.vue +4 -2
  33. package/components/FSGridMosaic.vue +3 -2
  34. package/components/FSIcon.vue +3 -2
  35. package/components/FSIconCard.vue +10 -3
  36. package/components/FSIconCheck.vue +2 -1
  37. package/components/FSIconFlag.vue +2 -1
  38. package/components/FSImage.vue +2 -1
  39. package/components/FSImageCard.vue +72 -0
  40. package/components/FSLabel.vue +4 -2
  41. package/components/FSLink.vue +5 -3
  42. package/components/FSLoader.vue +2 -1
  43. package/components/FSOptionGroup.vue +28 -20
  44. package/components/FSOptionItem.vue +8 -18
  45. package/components/FSPagination.vue +4 -2
  46. package/components/FSRadio.vue +23 -11
  47. package/components/FSRadioGroup.vue +23 -10
  48. package/components/FSRow.vue +8 -1
  49. package/components/FSSlideGroup.vue +27 -6
  50. package/components/FSSlider.vue +4 -2
  51. package/components/FSSpan.vue +2 -1
  52. package/components/FSSwitch.vue +13 -10
  53. package/components/FSTab.vue +4 -2
  54. package/components/FSTabs.vue +5 -14
  55. package/components/FSTag.vue +11 -4
  56. package/components/FSTagGroup.vue +4 -2
  57. package/components/FSText.vue +4 -2
  58. package/components/FSToggleSet.vue +30 -17
  59. package/components/FSTooltip.vue +15 -4
  60. package/components/FSWindow.vue +2 -2
  61. package/components/FSWrapGroup.vue +2 -1
  62. package/components/autocompletes/FSAutoCompleteAddress.vue +104 -0
  63. package/components/autocompletes/FSAutocompleteLanguage.vue +18 -26
  64. package/components/autocompletes/FSAutocompleteTag.vue +138 -0
  65. package/components/autocompletes/FSAutocompleteTimeZone.vue +19 -30
  66. package/components/buttons/FSButtonAdd.vue +28 -0
  67. package/components/buttons/FSButtonAddIcon.vue +28 -0
  68. package/components/buttons/FSButtonAddLabel.vue +27 -0
  69. package/components/buttons/FSButtonAddMini.vue +27 -0
  70. package/components/buttons/FSButtonFile.vue +4 -4
  71. package/components/buttons/FSButtonFileIcon.vue +4 -4
  72. package/components/buttons/FSButtonFileLabel.vue +4 -4
  73. package/components/buttons/FSButtonFileMini.vue +4 -4
  74. package/components/deviceOrganisations/FSConnectivity.vue +3 -2
  75. package/components/deviceOrganisations/FSConnectivityCard.vue +3 -2
  76. package/components/deviceOrganisations/FSStatus.vue +3 -2
  77. package/components/deviceOrganisations/FSStatusCard.vue +3 -2
  78. package/components/deviceOrganisations/FSStatusesCarousel.vue +3 -2
  79. package/components/deviceOrganisations/FSStatusesRow.vue +3 -2
  80. package/components/deviceOrganisations/FSWorstAlert.vue +5 -4
  81. package/components/deviceOrganisations/FSWorstAlertCard.vue +4 -2
  82. package/components/fields/FSAutocompleteField.vue +210 -97
  83. package/components/fields/FSBaseField.vue +2 -1
  84. package/components/fields/FSColorField.vue +65 -94
  85. package/components/fields/FSDateField.vue +12 -25
  86. package/components/fields/FSDateRangeField.vue +15 -27
  87. package/components/fields/FSDateTimeField.vue +22 -32
  88. package/components/fields/FSDateTimeRangeField.vue +43 -51
  89. package/components/fields/FSGradientField.vue +143 -0
  90. package/components/fields/FSIconField.vue +9 -6
  91. package/components/fields/FSMagicConfigField.vue +154 -0
  92. package/components/fields/FSMagicField.vue +185 -0
  93. package/components/fields/FSNumberField.vue +3 -1
  94. package/components/fields/FSPasswordField.vue +10 -10
  95. package/components/fields/FSRichTextField.vue +136 -50
  96. package/components/fields/FSSearchField.vue +41 -62
  97. package/components/fields/FSSelectField.vue +148 -53
  98. package/components/fields/FSTagField.vue +19 -16
  99. package/components/fields/FSTermField.vue +192 -186
  100. package/components/fields/FSTextArea.vue +4 -4
  101. package/components/fields/FSTextField.vue +29 -6
  102. package/components/fields/FSTimeField.vue +55 -20
  103. package/components/fields/FSTimeSlotField.vue +6 -5
  104. package/components/fields/FSTranslateField.vue +234 -0
  105. package/components/fields/FSTranslateRichTextField.vue +185 -0
  106. package/components/fields/FSTreeViewField.vue +520 -0
  107. package/components/lists/FSDataIteratorItem.vue +18 -3
  108. package/components/lists/FSDataTableUI.vue +138 -51
  109. package/components/lists/FSFilterButton.vue +4 -2
  110. package/components/lists/FSHiddenButton.vue +4 -2
  111. package/components/map/FSMap.vue +598 -0
  112. package/components/map/FSMapEditPointAddressOverlay.vue +164 -0
  113. package/components/map/FSMapLayerButton.vue +77 -0
  114. package/components/map/FSMapOverlay.vue +150 -0
  115. package/components/selects/FSSelectAutoRefresh.vue +62 -0
  116. package/components/selects/FSSelectDashboardVariableType.vue +47 -0
  117. package/components/selects/FSSelectDateSetting.vue +39 -37
  118. package/components/selects/FSSelectDays.vue +62 -0
  119. package/components/tiles/FSDashboardOrganisationTileUI.vue +7 -5
  120. package/components/tiles/FSDashboardOrganisationTypeTileUI.vue +7 -5
  121. package/components/tiles/FSDashboardShallowTileUI.vue +7 -5
  122. package/components/tiles/FSDeviceOrganisationTileUI.vue +11 -12
  123. package/components/tiles/FSFolderTileUI.vue +8 -6
  124. package/components/tiles/FSGroupTileUI.vue +13 -15
  125. package/components/tiles/{FSSimpleIconTileUI.vue → FSSimpleTileUI.vue} +29 -15
  126. package/components/tiles/FSTile.vue +5 -11
  127. package/components/tiles/FSUserOrganisationTileUI.vue +2 -1
  128. package/components/toggleSets/FSToggleSetPosition.vue +61 -0
  129. package/composables/index.ts +5 -1
  130. package/composables/useAddress.ts +158 -0
  131. package/composables/useAutocomplete.ts +4 -3
  132. package/composables/useColors.ts +8 -25
  133. package/composables/useDebounce.ts +2 -1
  134. package/composables/useMagicFieldProvider.ts +22 -0
  135. package/composables/useRules.ts +4 -12
  136. package/composables/useSlots.ts +46 -26
  137. package/composables/useTables.ts +29 -0
  138. package/composables/useTreeView.ts +48 -0
  139. package/elements/FSFormElement.ts +2 -1
  140. package/icons/flags/France.vue +21 -5
  141. package/icons/flags/Germany.vue +16 -4
  142. package/icons/flags/GreatBritain.vue +25 -6
  143. package/icons/flags/Italy.vue +21 -5
  144. package/icons/flags/Portugal.vue +225 -51
  145. package/icons/flags/Spain.vue +2781 -543
  146. package/icons/flags/UnitedStates.vue +31 -7
  147. package/icons/widgetTemplates/DevicesWidget.vue +189 -189
  148. package/icons/widgetTemplates/ProfileWidget.vue +9 -9
  149. package/icons/widgetTemplates/TextWidget.vue +6 -6
  150. package/models/breadcrumbs.ts +1 -1
  151. package/models/deviceAlerts.ts +1 -1
  152. package/models/deviceConnectivities.ts +1 -1
  153. package/models/index.ts +2 -0
  154. package/models/magicFields.ts +9 -0
  155. package/models/map.ts +18 -0
  156. package/models/richTextVariable.ts +5 -0
  157. package/models/rules.ts +11 -2
  158. package/models/tables.ts +30 -21
  159. package/models/variableNode.ts +104 -0
  160. package/package.json +21 -18
  161. package/plugins/colorPlugin.ts +2 -2
  162. package/plugins/index.ts +2 -1
  163. package/plugins/mapsPlugin.ts +37 -0
  164. package/shims-plugin.d.ts +2 -2
  165. package/shims-window.d.ts +3 -0
  166. package/styles/components/fs_button.scss +5 -0
  167. package/styles/components/fs_card.scss +0 -1
  168. package/styles/components/fs_col.scss +1 -0
  169. package/styles/components/fs_color_field.scss +12 -2
  170. package/styles/components/fs_data_iterator_item.scss +19 -6
  171. package/styles/components/fs_dialog.scss +12 -22
  172. package/styles/components/fs_gradient_field.scss +16 -0
  173. package/styles/components/fs_image_card.scss +18 -0
  174. package/styles/components/fs_magic_config_field.scss +13 -0
  175. package/styles/components/fs_map.scss +129 -0
  176. package/styles/components/fs_map_overlay.scss +38 -0
  177. package/styles/components/fs_meta_field.scss +6 -0
  178. package/styles/components/fs_option_group.scss +1 -0
  179. package/styles/components/fs_radio.scss +1 -1
  180. package/styles/components/fs_rich_text_field.scss +17 -5
  181. package/styles/components/fs_row.scss +1 -1
  182. package/styles/components/fs_select_field.scss +9 -14
  183. package/styles/components/fs_text.scss +1 -1
  184. package/styles/components/fs_time_field.scss +0 -4
  185. package/styles/components/fs_translate_field.scss +3 -0
  186. package/styles/components/fs_tree_view_field.scss +53 -0
  187. package/styles/components/index.scss +8 -1
  188. package/styles/globals/overrides.scss +54 -8
  189. package/styles/globals/scrollbars.scss +2 -2
  190. package/themes/default.ts +1 -1
  191. package/utils/gradient.ts +1601 -0
  192. package/utils/index.ts +3 -1
  193. package/utils/leafletMarkers.ts +23 -0
  194. package/utils/lexical.ts +3 -1
  195. package/components/selects/FSSelectTimeZone.vue +0 -67
  196. package/styles/components/fs_date_field.scss +0 -8
@@ -11,10 +11,12 @@
11
11
  </template>
12
12
 
13
13
  <script lang="ts">
14
- import { computed, defineComponent, PropType } from "vue";
14
+ import type { PropType } from "vue";
15
+ import { computed, defineComponent } from "vue";
15
16
 
16
17
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
17
- import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
18
+ import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
19
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
18
20
 
19
21
  export default defineComponent({
20
22
  name: "FSText",
@@ -1,9 +1,8 @@
1
1
  <template>
2
2
  <v-input
3
3
  class="fs-toggle-set"
4
- ref="inputRef"
5
- :modelValue="$props.modelValue"
6
4
  :rules="$props.rules"
5
+ :modelValue="$props.modelValue"
7
6
  >
8
7
  <FSWrapGroup
9
8
  v-if="['wrap'].includes($props.variant)"
@@ -95,10 +94,11 @@
95
94
  </template>
96
95
 
97
96
  <script lang="ts">
98
- import { defineComponent, PropType, ref } from "vue";
97
+ import type { PropType} from "vue";
98
+ import { defineComponent, ref } from "vue";
99
99
 
100
- import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
101
- import { FSToggle } from "@dative-gpi/foundation-shared-components/models";
100
+ import type { ColorBase, FSToggle } from "@dative-gpi/foundation-shared-components/models";
101
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
102
102
 
103
103
  import FSSlideGroup from "./FSSlideGroup.vue";
104
104
  import FSWrapGroup from "./FSWrapGroup.vue";
@@ -112,6 +112,16 @@ export default defineComponent({
112
112
  FSButton
113
113
  },
114
114
  props: {
115
+ padding: {
116
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
117
+ required: false,
118
+ default: "0"
119
+ },
120
+ gap: {
121
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
122
+ required: false,
123
+ default: "8px"
124
+ },
115
125
  values: {
116
126
  type: Array as PropType<FSToggle[]>,
117
127
  required: false,
@@ -132,6 +142,11 @@ export default defineComponent({
132
142
  required: false,
133
143
  default: "standard"
134
144
  },
145
+ errorVariant: {
146
+ type: String as PropType<"standard" | "full" | "icon">,
147
+ required: false,
148
+ default: "standard"
149
+ },
135
150
  buttonClass: {
136
151
  type: [Array, String] as PropType<string[] | string>,
137
152
  required: false,
@@ -142,8 +157,8 @@ export default defineComponent({
142
157
  required: false,
143
158
  default: null
144
159
  },
145
- modelValue: {
146
- type: [Array, String, Number] as PropType<(string | number)[] | string | number | null>,
160
+ errorClass: {
161
+ type: [Array, String] as PropType<string[] | string>,
147
162
  required: false,
148
163
  default: null
149
164
  },
@@ -157,21 +172,21 @@ export default defineComponent({
157
172
  required: false,
158
173
  default: ColorEnum.Primary
159
174
  },
160
- padding: {
161
- type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
162
- required: false,
163
- default: "0"
164
- },
165
- gap: {
166
- type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
175
+ errorColor: {
176
+ type: String as PropType<ColorBase>,
167
177
  required: false,
168
- default: "8px"
178
+ default: ColorEnum.Error
169
179
  },
170
180
  rules: {
171
181
  type: Array as PropType<any[]>,
172
182
  required: false,
173
183
  default: () => []
174
184
  },
185
+ modelValue: {
186
+ type: [Array, String, Number] as PropType<(string | number)[] | string | number | null>,
187
+ required: false,
188
+ default: null
189
+ },
175
190
  multiple: {
176
191
  type: Boolean,
177
192
  required: false,
@@ -191,7 +206,6 @@ export default defineComponent({
191
206
  emits: ["update:modelValue"],
192
207
  setup(props, { emit }) {
193
208
  const toggleSetRef = ref(null);
194
- const inputRef = ref(null);
195
209
 
196
210
  const getVariant = (value: FSToggle): "standard" | "full" | "icon" => {
197
211
  if (Array.isArray(props.modelValue) && props.modelValue.some(v => v === value.id)) {
@@ -294,7 +308,6 @@ export default defineComponent({
294
308
 
295
309
  return {
296
310
  toggleSetRef,
297
- inputRef,
298
311
  getVariant,
299
312
  goToStart,
300
313
  getColor,
@@ -3,11 +3,22 @@
3
3
  class="fs-tooltip"
4
4
  location="top"
5
5
  >
6
- <template #activator="{ props }">
7
- <slot name="activator" v-bind="props" />
6
+ <template
7
+ #activator="{ props }"
8
+ >
9
+ <slot
10
+ name="activator"
11
+ v-bind="props"
12
+ />
8
13
  </template>
9
- <template v-for="(_, name) in $slots" v-slot:[name]="slotData">
10
- <slot :name="name" v-bind="slotData" />
14
+ <template
15
+ v-for="(_, name) in $slots"
16
+ v-slot:[name]="slotData"
17
+ >
18
+ <slot
19
+ :name="name"
20
+ v-bind="slotData"
21
+ />
11
22
  </template>
12
23
  </v-tooltip>
13
24
  </template>
@@ -27,7 +27,7 @@
27
27
  </template>
28
28
 
29
29
  <script lang="ts">
30
- import { computed, defineComponent, PropType, VNode } from "vue";
30
+ import { computed, defineComponent, type PropType, type VNode } from "vue";
31
31
 
32
32
  import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
33
33
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
@@ -59,7 +59,7 @@ export default defineComponent({
59
59
  style,
60
60
  getChildren,
61
61
  value
62
- }
62
+ };
63
63
  }
64
64
  });
65
65
  </script>
@@ -19,7 +19,8 @@
19
19
  </template>
20
20
 
21
21
  <script lang="ts">
22
- import { computed, defineComponent, onMounted, onUnmounted, PropType, ref } from "vue";
22
+ import type { PropType} from "vue";
23
+ import { computed, defineComponent, onMounted, onUnmounted, ref } from "vue";
23
24
 
24
25
  import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
25
26
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -0,0 +1,104 @@
1
+ <template>
2
+ <FSAutocompleteField
3
+ :clearable="false"
4
+ :toggleSet="false"
5
+ :multiple="false"
6
+ :items="places"
7
+ :modelValue="modelValuePlace"
8
+ @update:modelValue="onUpdate"
9
+ v-model:search="search"
10
+ v-bind="$attrs"
11
+ />
12
+ </template>
13
+
14
+ <script lang="ts">
15
+ import { defineComponent, onMounted, ref, watch } from "vue";
16
+
17
+ import { type Address, type Place } from "@dative-gpi/foundation-shared-domain/models";
18
+ import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
19
+
20
+ import { useAddress } from "../../composables/useAddress";
21
+
22
+ import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
23
+
24
+ export default defineComponent({
25
+ name: "FSAutocompleteAddress",
26
+ components: {
27
+ FSAutocompleteField
28
+ },
29
+ props: {
30
+ modelValue: {
31
+ type: Object as () => Address | null,
32
+ required: false,
33
+ default: null
34
+ },
35
+ },
36
+ emits: ["update:modelValue"],
37
+ setup(props, { emit }) {
38
+ const { search: searchAddress, get: getAddress } = useAddress();
39
+
40
+ const places = ref<Place[]>([]);
41
+ const modelValuePlace = ref<Place | null>(null);
42
+
43
+ const fetch = async (search: string | null) => {
44
+ if (search === null) {
45
+ return Promise.resolve([]);
46
+ }
47
+ places.value = await searchAddress(search);
48
+ return Promise.resolve([]);
49
+ };
50
+
51
+ const update = async (value: { id: string; label: string; } | { id: string; label: string; }[] | null) => {
52
+ if (value === null) {
53
+ emit("update:modelValue", null);
54
+ return;
55
+ }
56
+ if (Array.isArray(value)) {
57
+ value = value[0];
58
+ }
59
+ const address = await getAddress(value);
60
+ emit("update:modelValue", address );
61
+ };
62
+
63
+ const { search, onUpdate } = useAutocomplete(
64
+ places,
65
+ [],
66
+ emit,
67
+ fetch,
68
+ update,
69
+ (item) => (item).id,
70
+ (item) => (item).label,
71
+ true,
72
+ false
73
+ );
74
+
75
+ const addressToPlace = (address: Address): Place => {
76
+ return {
77
+ id: address.placeId,
78
+ label: address.placeLabel
79
+ };
80
+ };
81
+
82
+ onMounted(() => {
83
+ if(!props.modelValue) {
84
+ return;
85
+ }
86
+ modelValuePlace.value = addressToPlace(props.modelValue);
87
+ });
88
+
89
+ watch(() => props.modelValue, (newValue) => {
90
+ if(!newValue) {
91
+ return;
92
+ }
93
+ modelValuePlace.value = addressToPlace(newValue);
94
+ });
95
+
96
+ return {
97
+ modelValuePlace,
98
+ places,
99
+ search,
100
+ onUpdate
101
+ };
102
+ }
103
+ });
104
+ </script>
@@ -27,42 +27,35 @@
27
27
  </FSRow>
28
28
  </template>
29
29
  <template
30
- #autocomplete-item="{ props, item }"
30
+ #item-label="{ item, font }"
31
31
  >
32
- <v-list-item
33
- v-bind="{ ...props, title: '' }"
32
+ <FSRow
33
+ align="center-left"
34
+ :wrap="false"
34
35
  >
35
- <FSRow
36
- align="center-left"
36
+ <FSIcon
37
+ v-if="item.raw.icon"
38
+ >
39
+ {{ item.raw.icon }}
40
+ </FSIcon>
41
+ <FSSpan
42
+ :font="font"
37
43
  >
38
- <FSCheckbox
39
- v-if="$props.multiple"
40
- :modelValue="$props.modelValue?.includes(item.value)"
41
- @click="props.onClick"
42
- />
43
- <FSIcon
44
- v-if="item.raw.icon"
45
- >
46
- {{ item.raw.icon }}
47
- </FSIcon>
48
- <FSSpan>
49
- {{ item.raw.label }}
50
- </FSSpan>
51
- </FSRow>
52
- </v-list-item>
44
+ {{ item.raw.label }}
45
+ </FSSpan>
46
+ </FSRow>
53
47
  </template>
54
48
  </FSAutocompleteField>
55
49
  </template>
56
50
 
57
51
  <script lang="ts">
58
- import { computed, defineComponent, PropType } from "vue"
52
+ import { computed, defineComponent, type PropType } from "vue"
59
53
 
60
54
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
55
+ import { type LanguageFilters } from "@dative-gpi/foundation-shared-domain/models";
61
56
  import { useLanguages } from "@dative-gpi/foundation-shared-services/composables";
62
- import { LanguageFilters } from "@dative-gpi/foundation-shared-domain/models";
63
57
 
64
58
  import FSAutocompleteField from "../fields/FSAutocompleteField.vue";
65
- import FSCheckbox from "../FSCheckbox.vue";
66
59
  import FSIcon from "../FSIcon.vue";
67
60
  import FSSpan from "../FSSpan.vue";
68
61
  import FSRow from "../FSRow.vue";
@@ -71,7 +64,6 @@ export default defineComponent({
71
64
  name: "FSAutocompleteLanguage",
72
65
  components: {
73
66
  FSAutocompleteField,
74
- FSCheckbox,
75
67
  FSIcon,
76
68
  FSSpan,
77
69
  FSRow
@@ -106,7 +98,7 @@ export default defineComponent({
106
98
  return init.value && fetchingLanguages.value;
107
99
  });
108
100
 
109
- const innerFetch = (search: string | null) => {
101
+ const fetch = (search: string | null) => {
110
102
  return getManyLanguages({ ...props.languageFilters, search: search ?? undefined });
111
103
  };
112
104
 
@@ -114,7 +106,7 @@ export default defineComponent({
114
106
  languages,
115
107
  [() => props.languageFilters],
116
108
  emit,
117
- innerFetch
109
+ fetch
118
110
  );
119
111
 
120
112
  return {
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <FSCol>
3
+ <FSAutocompleteField
4
+ v-if="variant=='standard'"
5
+ :label="label"
6
+ :items="innerItems"
7
+ :multiple="true"
8
+ :modelValue="modelValue?.map(m=>m.id)"
9
+ @update:modelValue="onUpdateModelValue"
10
+ @keydown="onKeydown"
11
+ v-binds="$attrs"
12
+ >
13
+ <template
14
+ #autocomplete-chip
15
+ >
16
+ </template>
17
+ </FSAutocompleteField>
18
+ <FSAutocompleteField
19
+ v-else
20
+ :label="label"
21
+ :items="innerItems"
22
+ :multiple="true"
23
+ :modelValue="modelValue?.map(m=>m.id)"
24
+ :showSearch="true"
25
+ @update:modelValue="onUpdateModelValue"
26
+ @add:item="onAddItem"
27
+ @keydown="onKeydown"
28
+ v-binds="$attrs"
29
+ >
30
+ <template
31
+ #autocomplete-chip
32
+ >
33
+ </template>
34
+ </FSAutocompleteField>
35
+ <FSTagGroup
36
+ v-if="modelValue != null"
37
+ :tags="modelValue?.map((v) => v.label) ?? []"
38
+ @remove="onRemoveValue($event)"
39
+ />
40
+ </FSCol>
41
+ </template>
42
+
43
+ <script lang="ts">
44
+ import type { PropType } from "vue";
45
+ import { computed, defineComponent, ref, watch } from "vue";
46
+
47
+ import { uuidv4 } from '@dative-gpi/bones-ui';
48
+
49
+ import FSAutocompleteField from "../fields/FSAutocompleteField.vue";
50
+ import FSTagGroup from "../FSTagGroup.vue";
51
+
52
+ export default defineComponent({
53
+ components: {
54
+ FSAutocompleteField,
55
+ FSTagGroup,
56
+ },
57
+ props:{
58
+ modelValue: {
59
+ type: Array as PropType<{id : string, label : string, isCustom: boolean}[] | null>,
60
+ required: false,
61
+ default: () => []
62
+ },
63
+ items: {
64
+ type: Array as PropType<{id : string, label : string, isCustom: boolean}[]>,
65
+ required: false,
66
+ default: () => []
67
+ },
68
+ label : {
69
+ type: String,
70
+ required: false
71
+ },
72
+ variant: {
73
+ type: String as PropType<'standard' | 'tagged'>,
74
+ required: false,
75
+ default : 'standard'
76
+ },
77
+ },
78
+ emits: ["update:modelValue"],
79
+ setup(props, {emit}) {
80
+
81
+ const tagValues = ref<{id : string, label : string, isCustom : boolean}[]>([]);
82
+
83
+ const innerItems = computed(()=>{
84
+
85
+ if(props.variant === 'standard'){
86
+ return props.items
87
+ }
88
+ else{
89
+ return props.items.concat(tagValues.value);
90
+ }
91
+ });
92
+
93
+ const onUpdateModelValue = (value: string[] | null) => {
94
+ emit('update:modelValue', value?.map((v) => innerItems.value.find((i) => i.id === v)));
95
+ }
96
+
97
+ const onRemoveValue = (value: string) => {
98
+ const idValue = innerItems.value.find((v) => v.label === value)?.id;
99
+ if (idValue) {
100
+ if(tagValues.value.map((v) => v.label).includes(value)){
101
+ tagValues.value = tagValues.value.filter((v) => v.label !== value);
102
+ }
103
+ emit('update:modelValue', [...props.modelValue?.filter((v) => v.id !== idValue) ?? []]);
104
+ }
105
+ }
106
+
107
+ const onAddItem = (value: string) => {
108
+ if (innerItems.value.map((v) => v.label).includes(value)) {
109
+ return;
110
+ }
111
+ let item = {id: uuidv4(), label: value, isCustom: true};
112
+ tagValues.value.push(item);
113
+ emit('update:modelValue', [...props.modelValue?? [],item]);
114
+ }
115
+
116
+ const onKeydown = (event: KeyboardEvent) => {
117
+ if (event.key === 'Backspace') {
118
+ emit('update:modelValue', [...props.modelValue ?? []]);
119
+ }
120
+ };
121
+
122
+ watch(() => props.modelValue, (newValue) => {
123
+ if (newValue) {
124
+ tagValues.value = props.modelValue?.filter(m=>m.isCustom) ?? [];
125
+ }
126
+ }, {immediate: true});
127
+
128
+
129
+ return {
130
+ innerItems,
131
+ onUpdateModelValue,
132
+ onAddItem,
133
+ onRemoveValue,
134
+ onKeydown
135
+ }
136
+ }
137
+ })
138
+ </script>
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ itemTitle="id"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
- :customFilter="customFilter"
5
5
  :multiple="$props.multiple"
6
6
  :loading="loading"
7
7
  :items="timeZones"
@@ -26,27 +26,21 @@
26
26
  </FSRow>
27
27
  </template>
28
28
  <template
29
- #autocomplete-item="{ props, item }"
29
+ #item-label="{ item, font }"
30
30
  >
31
- <v-list-item
32
- v-bind="{ ...props, title: '' }"
31
+ <FSRow
32
+ align="center-left"
33
+ :wrap="false"
33
34
  >
34
- <FSRow
35
- align="center-left"
35
+ <FSChip
36
+ :label="item.raw.offset"
37
+ />
38
+ <FSSpan
39
+ :font="font"
36
40
  >
37
- <FSCheckbox
38
- v-if="$props.multiple"
39
- :modelValue="$props.modelValue?.includes(item.value)"
40
- @click="props.onClick"
41
- />
42
- <FSChip
43
- :label="item.raw.offset"
44
- />
45
- <FSSpan>
46
- {{ item.raw.id }}
47
- </FSSpan>
48
- </FSRow>
49
- </v-list-item>
41
+ {{ item.raw.id }}
42
+ </FSSpan>
43
+ </FSRow>
50
44
  </template>
51
45
  <template
52
46
  #toggle-set-item="props"
@@ -71,14 +65,14 @@
71
65
  </template>
72
66
 
73
67
  <script lang="ts">
74
- import { computed, defineComponent, PropType } from "vue";
68
+ import { computed, defineComponent, type PropType } from "vue";
75
69
 
76
- import { TimeZoneFilters, TimeZoneInfos } from "@dative-gpi/foundation-shared-domain/models";
70
+ import { type TimeZoneFilters, type TimeZoneInfos } from "@dative-gpi/foundation-shared-domain/models";
77
71
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
78
72
  import { useTimeZones } from "@dative-gpi/foundation-shared-services/composables";
73
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
79
74
 
80
75
  import FSAutocompleteField from "../fields/FSAutocompleteField.vue";
81
- import FSCheckbox from "../FSCheckbox.vue"
82
76
  import FSButton from "../FSButton.vue";
83
77
  import FSChip from "../FSChip.vue";
84
78
  import FSSpan from "../FSSpan.vue";
@@ -88,7 +82,6 @@ export default defineComponent({
88
82
  name: "FSAutocompleteTimeZone",
89
83
  components: {
90
84
  FSAutocompleteField,
91
- FSCheckbox,
92
85
  FSButton,
93
86
  FSChip,
94
87
  FSSpan,
@@ -124,30 +117,26 @@ export default defineComponent({
124
117
  return init.value && fetchingTimeZones.value;
125
118
  });
126
119
 
127
- const innerFetch = (search: string | null) => {
120
+ const fetch = (search: string | null) => {
128
121
  return getManyTimeZones({ ...props.timeZoneFilters, search: search ?? undefined });
129
122
  };
130
123
 
131
- const customFilter = (_: any, search: string, item: any): boolean => {
132
- return item.raw.id.toLowerCase().includes(search.toLowerCase());
133
- };
134
-
135
124
  const { toggleSet, search, init, onUpdate } = useAutocomplete(
136
125
  timeZones,
137
126
  [() => props.timeZoneFilters],
138
127
  emit,
139
- innerFetch,
128
+ fetch,
140
129
  null,
141
130
  (item: TimeZoneInfos) => item.id,
142
131
  (item: TimeZoneInfos) => item.id
143
132
  );
144
133
 
145
134
  return {
135
+ ColorEnum,
146
136
  timeZones,
147
137
  toggleSet,
148
138
  loading,
149
139
  search,
150
- customFilter,
151
140
  onUpdate
152
141
  };
153
142
  }
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <FSButton
3
+ prependIcon="mdi-plus-circle-outline"
4
+ :label="$tr('ui.button.add', 'Add')"
5
+ :color="ColorEnum.Primary"
6
+ v-bind="$attrs"
7
+ />
8
+ </template>
9
+
10
+ <script lang="ts">
11
+ import { defineComponent } from "vue";
12
+
13
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
14
+
15
+ import FSButton from "../FSButton.vue";
16
+
17
+ export default defineComponent({
18
+ name: "FSButtonAdd",
19
+ components: {
20
+ FSButton
21
+ },
22
+ setup() {
23
+ return {
24
+ ColorEnum
25
+ }
26
+ }
27
+ });
28
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <FSButton
3
+ icon="mdi-plus-circle-outline"
4
+ variant="icon"
5
+ :color="ColorEnum.Primary"
6
+ v-bind="$attrs"
7
+ />
8
+ </template>
9
+
10
+ <script lang="ts">
11
+ import { defineComponent } from "vue";
12
+
13
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
14
+
15
+ import FSButton from "../FSButton.vue";
16
+
17
+ export default defineComponent({
18
+ name: "FSButtonAddIcon",
19
+ components: {
20
+ FSButton
21
+ },
22
+ setup() {
23
+ return {
24
+ ColorEnum
25
+ };
26
+ }
27
+ });
28
+ </script>