@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
@@ -3,7 +3,7 @@
3
3
  gap="16px"
4
4
  >
5
5
  <FSRow
6
- align="bottom-center"
6
+ align="bottom-left"
7
7
  :wrap="isExtraSmall ? false : true"
8
8
  width="fill"
9
9
  >
@@ -689,17 +689,15 @@
689
689
  </template>
690
690
 
691
691
  <script lang="ts">
692
- import type { PropType, Ref, Slot} from "vue";
693
- import { computed, defineComponent, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
692
+ import { computed, defineComponent, nextTick, onMounted, onUnmounted, type PropType, type Ref, ref, type Slot, type StyleValue, watch } from "vue";
694
693
  import { useRouter } from "vue-router";
695
694
 
696
- import type { FSDataTableColumn, FSDataTableFilter, FSDataTableOrder, FSToggle } from "@dative-gpi/foundation-shared-components/models";
697
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
695
+ import { ColorEnum, type FSDataTableColumn, type FSDataTableFilter, type FSDataTableOrder, type FSToggle } from "@dative-gpi/foundation-shared-components/models";
698
696
  import { useBreakpoints, useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
699
697
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
700
698
  import { uuidv4 } from "@dative-gpi/bones-ui/tools/uuid"
701
699
 
702
- import { alphanumericSort, sizeToVar } from "../../utils";
700
+ import { alphanumericSort, containsSearchTerm, sizeToVar } from "../../utils";
703
701
 
704
702
  import FSDataIteratorItem from "./FSDataIteratorItem.vue";
705
703
  import FSSearchField from "../fields/FSSearchField.vue";
@@ -834,7 +832,7 @@ export default defineComponent({
834
832
  mode: {
835
833
  type: String as PropType<"table" | "iterator">,
836
834
  required: false,
837
- default: "table"
835
+ default: "iterator"
838
836
  },
839
837
  disableTable: {
840
838
  type: Boolean,
@@ -898,7 +896,7 @@ export default defineComponent({
898
896
  const innerSortBy = ref(props.sortBy);
899
897
  const innerMode = ref(props.mode);
900
898
  const innerPage = ref(props.page);
901
- const showFilters = ref(true);
899
+ const showFilters = ref(false);
902
900
  const resetable = ref(false);
903
901
 
904
902
  const intersectionObserver = ref<IntersectionObserver | null>(null);
@@ -907,8 +905,8 @@ export default defineComponent({
907
905
  const elementId = `id${uuidv4()}`;
908
906
 
909
907
  const modeOptions: FSToggle[] = [
910
- { id: "table", prependIcon: "mdi-table" },
911
- { id: "iterator", prependIcon: "mdi-apps" }
908
+ { id: "iterator", prependIcon: "mdi-view-grid-outline" },
909
+ { id: "table", prependIcon: "mdi-format-list-bulleted" }
912
910
  ];
913
911
 
914
912
  const rowsPerPageOptions: { id: number, label: string }[] = [
@@ -963,13 +961,11 @@ export default defineComponent({
963
961
  return slots;
964
962
  });
965
963
 
966
- const style = computed((): { [key: string]: string | undefined } => {
967
- return {
968
- "--fs-data-table-background-color": backgrounds.base,
969
- "--fs-data-table-border-color": lights.base,
970
- "--fs-data-table-row-gap": sizeToVar(props.rowGap)
971
- };
972
- });
964
+ const style = computed((): StyleValue => ({
965
+ "--fs-data-table-background-color": backgrounds.base,
966
+ "--fs-data-table-border-color": lights.base,
967
+ "--fs-data-table-row-gap": sizeToVar(props.rowGap)
968
+ }));
973
969
 
974
970
  const classes = computed((): string[] => {
975
971
  const classNames = ["fs-data-table"];
@@ -1028,14 +1024,13 @@ export default defineComponent({
1028
1024
  return acc.concat(filters.value[key].filter((filter) => filter.hidden).map((filter) => ({ key, filter })));
1029
1025
  }, [] as { key: string, filter: FSDataTableFilter }[]);
1030
1026
  if (props.items && props.items.length) {
1027
+ const innerSearchFormatted = innerSearch.value ? innerSearch.value.toLowerCase() : null;
1031
1028
  return props.items.filter((item) => {
1032
1029
  if (props.selectedOnly && !props.modelValue.includes(item[props.itemValue])) {
1033
1030
  return false;
1034
1031
  }
1035
- if (innerSearch.value) {
1036
- if (!JSON.stringify(item).toLowerCase().includes(innerSearch.value.toString().toLowerCase())) {
1037
- return false;
1038
- }
1032
+ if (innerSearchFormatted) {
1033
+ return containsSearchTerm(item, innerSearchFormatted);
1039
1034
  }
1040
1035
  if (activeFilters.some(af => af.filter.filter && af.filter.filter(af.filter.value, item[af.key], item))) {
1041
1036
  return false;
@@ -1100,10 +1095,10 @@ export default defineComponent({
1100
1095
  },
1101
1096
  mobile: (event: any, item: any) => {
1102
1097
  if (props.itemTo && router) {
1103
- router.push(props.itemTo(item));
1098
+ router.push(props.itemTo(item.raw));
1104
1099
  }
1105
1100
  else {
1106
- emit("click:row", item);
1101
+ emit("click:row", item.raw);
1107
1102
  }
1108
1103
  }
1109
1104
  }
@@ -1217,6 +1212,8 @@ export default defineComponent({
1217
1212
  const key = header.value!;
1218
1213
  const currentFilters = filters.value[key];
1219
1214
 
1215
+ const getPath = (object: any, keys: string[]) => keys.reduce((acc, key) => acc[key] ?? null, object);
1216
+
1220
1217
  let value: FSDataTableFilter[] = [];
1221
1218
 
1222
1219
  if (header.fixedFilters) {
@@ -1224,32 +1221,43 @@ export default defineComponent({
1224
1221
  hidden: currentFilters?.find((cf) => cf.value == (ff.value || null))?.hidden ?? false,
1225
1222
  text: ff.text?.toString() ?? "—",
1226
1223
  value: ff.value || null,
1227
- filter: header.methodFilter ?? ((value, property) => {
1228
- property = [property].flat();
1229
- return Array.isArray(property) ? property.includes(value) || (!value && property.length == 0) : (!value && !property) || value == property;
1224
+ filter: header.methodFilter ?? ((_, property, item) => {
1225
+ if (header.methodFilterRaw) {
1226
+ return header.methodFilterRaw(ff.value, item);
1227
+ }
1228
+ const flat = property = [property].flat();
1229
+ return Array.isArray(flat) ? flat.includes(ff.value) || (!ff.value && flat.length == 0) : (!ff.value && !flat) || ff.value == flat;
1230
1230
  })
1231
1231
  }));
1232
+ filterDictionary[key] = value;
1232
1233
  }
1233
1234
  else {
1234
1235
  if (props.items && props.items.length) {
1235
1236
  const mapToInnerValue = header.innerValue ? header.innerValue : (i: any) => i;
1236
- const itemValues = props.items.flatMap((item) => Array.isArray(item[key]) && item[key].length == 0 ? undefined : item[key]).map(mapToInnerValue);
1237
+ const itemValues = props.items.flatMap((item) => {
1238
+ return Array.isArray(getPath(item, key.split("."))) && getPath(item, key.split(".")).length == 0 ? undefined : getPath(item, key.split("."))
1239
+ }).map(mapToInnerValue);
1237
1240
  const distinctValues = [...new Set(itemValues)];
1238
1241
 
1239
- value = distinctValues.map((dv): FSDataTableFilter => ({
1240
- hidden: currentFilters?.find((cf) => cf.value == (dv || null))?.hidden ?? false,
1241
- text: dv?.toString() ?? "—",
1242
- value: dv || null,
1243
- filter: header.methodFilter ?? ((_, property) => {
1244
- property = [property].flat().map(mapToInnerValue);
1245
- return Array.isArray(property) ? property.includes(dv) || (!dv && property.length == 0) : (!dv && !property) || dv == property;
1246
- })
1247
- }));
1242
+ value = distinctValues.map((dv): FSDataTableFilter => {
1243
+ return {
1244
+ hidden: currentFilters?.find((cf) => cf.value == (dv || null))?.hidden ?? false,
1245
+ text: dv?.toString() ?? "—",
1246
+ value: dv || null,
1247
+ filter: header.methodFilter ?? ((_, property, item) => {
1248
+ if (header.methodFilterRaw) {
1249
+ return header.methodFilterRaw(dv, item);
1250
+ }
1251
+ const flat = [property].flat().map(mapToInnerValue);
1252
+ return Array.isArray(flat) ? flat.includes(dv) || (!dv && flat.length == 0) : (!dv && !flat) || dv == flat;
1253
+ })
1254
+ }
1255
+ });
1248
1256
  }
1257
+ filterDictionary[key] = value.sort((v1, v2) => {
1258
+ return v1.text.localeCompare(v2.text, undefined, { numeric: true });
1259
+ });
1249
1260
  }
1250
- filterDictionary[key] = value.sort((v1, v2) => {
1251
- return v1.text.localeCompare(v2.text, undefined, { numeric: true });
1252
- });
1253
1261
  }
1254
1262
  for (const [key, filters] of Object.entries(props.filters)) {
1255
1263
  for (const filter of filters) {
@@ -7,10 +7,10 @@
7
7
  #activator="{ props }"
8
8
  >
9
9
  <FSChip
10
+ prependIcon="mdi-filter-variant"
10
11
  class="fs-filter-button"
11
12
  variant="standard"
12
- prependIcon="mdi-filter-variant"
13
- :height="[30, 24]"
13
+ :height="['30px', '24px']"
14
14
  :color="ColorEnum.Dark"
15
15
  :editable="true"
16
16
  :label="label"
@@ -23,12 +23,12 @@
23
23
  :border="false"
24
24
  >
25
25
  <FSCol
26
- gap="12px"
27
26
  padding="16px 0 24px 16px"
27
+ gap="12px"
28
28
  >
29
29
  <FSCol
30
- gap="12px"
31
30
  padding="0 16px 0 0"
31
+ gap="12px"
32
32
  >
33
33
  <FSSpan
34
34
  font="text-overline"
@@ -37,11 +37,11 @@
37
37
  </FSSpan>
38
38
  <FSChip
39
39
  class="fs-filter-button-chip"
40
- :height="[30, 24]"
41
- :editable="true"
42
- :color="$props.color"
43
- :variant="getAllVariant()"
44
40
  :label="$tr('ui.data-table.all-values', 'All values')"
41
+ :height="['30px', '24px']"
42
+ :variant="getAllVariant()"
43
+ :color="$props.color"
44
+ :editable="true"
45
45
  @click="onToggleAll"
46
46
  />
47
47
  <FSDivider
@@ -55,7 +55,7 @@
55
55
  </FSCol>
56
56
  <FSFadeOut
57
57
  padding="0 8px 0 0"
58
- height="360px"
58
+ maxHeight="360px"
59
59
  >
60
60
  <FSCol
61
61
  gap="6px"
@@ -63,12 +63,12 @@
63
63
  <FSChip
64
64
  v-for="(filter, index) in searchedFilters"
65
65
  class="fs-filter-button-chip"
66
- :height="[30, 24]"
67
- :key="index"
68
- :editable="true"
69
- :label="filter.text"
70
- :color="$props.color"
71
66
  :variant="getVariant(filter)"
67
+ :height="['30px', '24px']"
68
+ :color="$props.color"
69
+ :label="filter.text"
70
+ :editable="true"
71
+ :key="index"
72
72
  @click="() => onToggle(filter)"
73
73
  >
74
74
  <template
@@ -87,11 +87,9 @@
87
87
  </template>
88
88
 
89
89
  <script lang="ts">
90
- import type { PropType} from "vue";
91
- import { computed, defineComponent, ref } from "vue";
90
+ import { computed, defineComponent, type PropType, ref } from "vue";
92
91
 
93
- import type { ColorBase, FSDataTableColumn, FSDataTableFilter } from "@dative-gpi/foundation-shared-components/models";
94
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
92
+ import { type ColorBase, ColorEnum, type FSDataTableColumn, type FSDataTableFilter } from "@dative-gpi/foundation-shared-components/models";
95
93
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
96
94
 
97
95
  import FSSearchField from "../fields/FSSearchField.vue";
@@ -196,15 +194,15 @@ export default defineComponent({
196
194
 
197
195
  return {
198
196
  searchedFilters,
197
+ singlePick,
199
198
  ColorEnum,
200
199
  expanded,
201
200
  search,
202
201
  label,
203
- singlePick,
204
- getVariant,
205
202
  getAllVariant,
206
- onToggle,
207
- onToggleAll
203
+ onToggleAll,
204
+ getVariant,
205
+ onToggle
208
206
  };
209
207
  }
210
208
  });
@@ -21,12 +21,12 @@
21
21
  :border="false"
22
22
  >
23
23
  <FSCol
24
- gap="12px"
25
24
  padding="16px 0px 24px 16px"
25
+ gap="12px"
26
26
  >
27
27
  <FSCol
28
- gap="12px"
29
28
  padding="0 16px 0 0"
29
+ gap="12px"
30
30
  >
31
31
  <FSSpan
32
32
  font="text-overline"
@@ -36,7 +36,7 @@
36
36
  </FSCol>
37
37
  <FSFadeOut
38
38
  padding="0 8px 0 0"
39
- height="360px"
39
+ maxHeight="360px"
40
40
  >
41
41
  <FSCol
42
42
  gap="6px"
@@ -44,12 +44,12 @@
44
44
  <FSChip
45
45
  v-for="(header, index) in $props.headers"
46
46
  class="fs-hidden-button-chip"
47
- :height="[30, 24]"
48
- :key="index"
49
- :editable="true"
50
- :label="header.text"
51
- :color="$props.color"
52
47
  variant="full"
48
+ :height="['30px', '24px']"
49
+ :color="$props.color"
50
+ :label="header.text"
51
+ :editable="true"
52
+ :key="index"
53
53
  @click="$emit('update:show', header)"
54
54
  >
55
55
  </FSChip>
@@ -61,11 +61,9 @@
61
61
  </template>
62
62
 
63
63
  <script lang="ts">
64
- import type { PropType} from "vue";
65
- import { defineComponent, ref } from "vue";
64
+ import { defineComponent, type PropType, ref } from "vue";
66
65
 
67
- import type { ColorBase, FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
68
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
66
+ import { type ColorBase, ColorEnum, type FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
69
67
 
70
68
  import FSCard from "../FSCard.vue";
71
69
  import FSChip from "../FSChip.vue";
@@ -60,7 +60,7 @@
60
60
  </template>
61
61
 
62
62
  <script lang="ts">
63
- import { computed, defineComponent } from "vue";
63
+ import { computed, defineComponent, type StyleValue } from "vue";
64
64
 
65
65
  import { useColors } from "@dative-gpi/foundation-shared-components/composables";
66
66
  import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
@@ -81,11 +81,9 @@ export default defineComponent({
81
81
 
82
82
  const backgroundColors = getColors(ColorEnum.Background);
83
83
 
84
- const style = computed((): { [key: string] : string | null | undefined } => {
85
- return {
86
- "--fs-load-data-table-background-color": backgroundColors.base
87
- };
88
- });
84
+ const style = computed((): StyleValue => ({
85
+ "--fs-load-data-table-background-color": backgroundColors.base
86
+ }));
89
87
 
90
88
  return {
91
89
  style
@@ -0,0 +1,229 @@
1
+ <template>
2
+ <FSCol
3
+ v-bind="$props"
4
+ gap="12px"
5
+ >
6
+ <FSSearchField
7
+ v-if="$props.searchable"
8
+ padding="0 12px 0 0"
9
+ :hideHeader="true"
10
+ :modelValue="actualSearch"
11
+ placeholder="Search"
12
+ @update:modelValue="onSearch"
13
+ />
14
+ <FSFadeOut
15
+ padding="0 4px 0 0"
16
+ :maxHeight="$props.maxHeight"
17
+ :maskHeight="0"
18
+ >
19
+ <component
20
+ :is="$props.direction == 'row' ? FSRow : FSCol"
21
+ >
22
+ <template
23
+ v-if="$props.loading"
24
+ >
25
+ <FSLoader
26
+ v-for="i in 4"
27
+ :key="i"
28
+ :width="$props.direction == 'row' ? '220px' : '100%'"
29
+ height="50px"
30
+ />
31
+ </template>
32
+ <template
33
+ v-else
34
+ >
35
+ <FSTile
36
+ v-for="item in filteredItems"
37
+ :key="item.id"
38
+ v-bind="tileProps(item)"
39
+ :width="$props.direction == 'row' ? 'fit-content' : '100%'"
40
+ height="fit-content"
41
+ :editable="false"
42
+ >
43
+ <slot
44
+ name="item"
45
+ :item="item"
46
+ >
47
+ <FSRow
48
+ align="center-left"
49
+ height="24px"
50
+ :wrap="false"
51
+ >
52
+ <FSButtonDragIcon
53
+ v-if="showDraggable"
54
+ />
55
+ <slot
56
+ name="itemContent"
57
+ :item="item"
58
+ >
59
+ <!-- TODO : add draggable option -->
60
+ <FSImage
61
+ v-if="item.imageId"
62
+ :imageId="item.imageId"
63
+ width="24px"
64
+ height="24px"
65
+ />
66
+ <FSIcon
67
+ size="24px"
68
+ v-else-if="item.icon"
69
+ :icon="item.icon"
70
+ />
71
+ <FSSpan
72
+ font="text-overline"
73
+ >
74
+ {{ item[$props.itemLabel || 'label'] }}
75
+ </FSSpan>
76
+ </slot>
77
+ <FSRow
78
+ align="center-right"
79
+ :wrap="false"
80
+ >
81
+ <FSButtonEditIcon
82
+ v-if="showEdit"
83
+ @click="$emit('click:edit', item.id)"
84
+ />
85
+ <FSButtonRemoveIcon
86
+ v-if="showRemove"
87
+ @click="$emit('click:remove', item.id)"
88
+ />
89
+ </FSRow>
90
+ </FSRow>
91
+ </slot>
92
+ </FSTile>
93
+ </template>
94
+ </component>
95
+ </FSFadeOut>
96
+ </FSCol>
97
+ </template>
98
+
99
+
100
+ <script lang="ts">
101
+ import { computed } from "vue";
102
+ import { defineComponent, type PropType, ref, watch } from "vue";
103
+
104
+ import { ColorEnum } from "../../models"
105
+ import { filterItems } from "../../utils";
106
+
107
+ import FSRow from "../FSRow.vue";
108
+ import FSCol from "../FSCol.vue";
109
+ import FSIcon from "../FSIcon.vue";
110
+ import FSSpan from "../FSSpan.vue";
111
+ import FSImage from "../FSImage.vue";
112
+ import FSLoader from "../FSLoader.vue";
113
+ import FSTile from "../tiles/FSTile.vue";
114
+ import FSFadeOut from "../FSFadeOut.vue";
115
+ import FSSearchField from "../fields/FSSearchField.vue";
116
+ import FSButtonEditIcon from "../buttons/FSButtonEditIcon.vue";
117
+ import FSButtonDragIcon from "../buttons/FSButtonDragIcon.vue";
118
+ import FSButtonRemoveIcon from "../buttons/FSButtonRemoveIcon.vue";
119
+
120
+ export default defineComponent({
121
+ name: "FSSimpleList",
122
+ components: {
123
+ FSRow,
124
+ FSCol,
125
+ FSTile,
126
+ FSIcon,
127
+ FSSpan,
128
+ FSImage,
129
+ FSLoader,
130
+ FSFadeOut,
131
+ FSSearchField,
132
+ FSButtonEditIcon,
133
+ FSButtonDragIcon,
134
+ FSButtonRemoveIcon,
135
+ },
136
+ props: {
137
+ items: {
138
+ type: Array as PropType<{id: string, label?: string, icon?: string, imageId?: string, [index: string]: any}[]>,
139
+ required: true
140
+ },
141
+ tileProps: {
142
+ type: Function as PropType<(item: any) => Record<string, any>>,
143
+ required: false,
144
+ default: () => () => ({})
145
+ },
146
+ showEdit: {
147
+ type: Boolean,
148
+ required: false,
149
+ default: true
150
+ },
151
+ showRemove: {
152
+ type: Boolean,
153
+ required: false,
154
+ default: true
155
+ },
156
+ showDraggable: {
157
+ type: Boolean,
158
+ required: false,
159
+ default: false
160
+ },
161
+ searchable: {
162
+ type: Boolean,
163
+ required: false,
164
+ default: false
165
+ },
166
+ search: {
167
+ type: String,
168
+ required: false,
169
+ default: ""
170
+ },
171
+ noFilter: {
172
+ type: Boolean,
173
+ required: false,
174
+ default: false
175
+ },
176
+ maxHeight: {
177
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null | undefined>,
178
+ required: false,
179
+ default: undefined
180
+ },
181
+ direction: {
182
+ type: String as PropType<"row" | "column">,
183
+ required: false,
184
+ default: "column"
185
+ },
186
+ itemLabel: {
187
+ type: String,
188
+ required: false,
189
+ default: "label"
190
+ },
191
+ loading: {
192
+ type: Boolean,
193
+ required: false,
194
+ default: false
195
+ }
196
+ },
197
+ emits: ["click:edit", "click:remove", "update:search"],
198
+ setup(props, { emit }) {
199
+ const actualSearch = ref<string | null>(props.search);
200
+ const filteredItems = computed(() => {
201
+ if(!actualSearch.value) {
202
+ return props.items;
203
+ }
204
+ return filterItems(props.items, actualSearch.value);
205
+ });
206
+
207
+ const onSearch = (value: string) => {
208
+ if(props.noFilter) {
209
+ emit("update:search", value);
210
+ } else {
211
+ actualSearch.value = value;
212
+ }
213
+ }
214
+
215
+ watch(() => props.search, (value) => {
216
+ actualSearch.value = value;
217
+ });
218
+
219
+ return {
220
+ actualSearch,
221
+ filteredItems,
222
+ ColorEnum,
223
+ onSearch,
224
+ FSRow,
225
+ FSCol,
226
+ }
227
+ }
228
+ });
229
+ </script>