@dative-gpi/foundation-core-components 1.0.26 → 1.0.28-remove-deprecated2

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 (82) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +60 -58
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +59 -56
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +30 -39
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +52 -38
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +25 -39
  6. package/components/autocompletes/FSAutocompleteGroup.vue +23 -38
  7. package/components/autocompletes/FSAutocompleteLocation.vue +23 -38
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +65 -2
  9. package/components/autocompletes/FSAutocompleteModel.vue +66 -3
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +23 -0
  11. package/components/autocompletes/FSAutocompleteRole.vue +59 -56
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +105 -0
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +32 -57
  14. package/components/customProperties/FSMetaField.vue +31 -35
  15. package/components/customProperties/FSMetaHistory.vue +4 -4
  16. package/components/customProperties/FSMetaValue.vue +66 -33
  17. package/components/customProperties/helpers.ts +2 -1
  18. package/components/entities/FSBaseEntitiesList.vue +50 -0
  19. package/components/entities/FSDialogSelectEntities.vue +83 -0
  20. package/components/entities/FSEntityField.vue +203 -0
  21. package/components/entities/FSSelectEntitiesList.vue +209 -0
  22. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  23. package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +265 -0
  25. package/components/lists/FSDataTable.vue +23 -21
  26. package/components/lists/alerts/FSBaseAlertsList.vue +337 -0
  27. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  28. package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
  29. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +204 -0
  30. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +205 -0
  31. package/components/lists/charts/FSBaseChartsList.vue +268 -0
  32. package/components/lists/comments/FSBaseCommentsList.vue +143 -0
  33. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +168 -0
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +227 -0
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +129 -0
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +327 -0
  40. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  41. package/components/lists/folders/FSBaseFoldersList.vue +127 -0
  42. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  43. package/components/lists/groups/FSBaseGroupsList.vue +136 -0
  44. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  45. package/components/lists/locations/FSBaseLocationsList.vue +118 -0
  46. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  47. package/components/lists/models/FSBaseModelsList.vue +155 -0
  48. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  49. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
  50. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
  51. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
  52. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
  53. package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
  54. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +156 -0
  55. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  56. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +172 -0
  57. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  58. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  59. package/components/tiles/FSLocationTile.vue +66 -0
  60. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  61. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  62. package/package.json +9 -9
  63. package/utils/dashboards.ts +33 -5
  64. package/utils/index.ts +2 -2
  65. package/utils/permissions.ts +80 -0
  66. package/utils/roles.ts +4 -4
  67. package/utils/tables.ts +41 -0
  68. package/utils/users.ts +7 -4
  69. package/components/selects/FSAggregationSelector.vue +0 -51
  70. package/components/selects/FSAxisTypeSelector.vue +0 -48
  71. package/components/selects/FSDataCategorySelector.vue +0 -62
  72. package/components/selects/FSDataDefinitionSelector.vue +0 -66
  73. package/components/selects/FSDisplayAsSelector.vue +0 -52
  74. package/components/selects/FSFilterTypeSelector.vue +0 -53
  75. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  76. package/components/selects/FSModelSelector.vue +0 -56
  77. package/components/selects/FSOperationOnSelector.vue +0 -51
  78. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  79. package/components/selects/FSPlotPerSelector.vue +0 -51
  80. package/components/selects/FSSelectSelectedEntities.vue +0 -59
  81. package/components/selects/FSSerieTypeSelector.vue +0 -51
  82. package/utils/charts.ts +0 -136
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.data-category', 'Data category')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
5
  :multiple="$props.multiple"
6
+ :placeholder="placeholder"
5
7
  :items="dataCategories"
6
8
  :loading="loading"
7
9
  :modelValue="$props.modelValue"
@@ -9,49 +11,48 @@
9
11
  v-bind="$attrs"
10
12
  >
11
13
  <template
12
- #autocomplete-selection="{ item }"
14
+ #item-append="{ item }"
13
15
  >
14
- <FSRow
15
- v-if="$props.modelValue"
16
- align="center-center"
17
- :wrap="false"
18
- >
19
- <FSIcon>
20
- {{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
21
- </FSIcon>
22
- <FSSpan>
23
- {{ item.raw.label }}
24
- </FSSpan>
25
- </FSRow>
26
- </template>
27
- <template
28
- #item-label="{ item, font }"
29
- >
30
- <FSRow
31
- align="center-left"
32
- :wrap="false"
33
- >
34
- <FSIcon>
35
- {{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
36
- </FSIcon>
37
- <FSSpan
38
- :font="font"
39
- >
40
- {{ item.raw.label }}
41
- </FSSpan>
42
- </FSRow>
16
+ <FSChip
17
+ v-if="item.correlated"
18
+ prependIcon="mdi-link"
19
+ :label="$tr('autocomplete.data-category.linked','Linked')"
20
+ :color="ColorEnum.Success"
21
+ />
22
+ <FSChip
23
+ v-else
24
+ prependIcon="mdi-link-off"
25
+ :label="$tr('autocomplete.data-category.not-linked','Not linked')"
26
+ :color="ColorEnum.Warning"
27
+ />
43
28
  </template>
44
29
  <template
45
30
  #toggle-set-item="props"
46
31
  >
47
32
  <FSButton
48
- :prependIcon="props.item.correlated ? 'mdi-link' : 'mdi-link-off'"
49
33
  :variant="props.getVariant(props.item)"
50
34
  :color="props.getColor(props.item)"
51
35
  :class="props.getClass(props.item)"
52
36
  :label="props.item.label"
53
37
  @click="props.toggle(props.item)"
54
- />
38
+ >
39
+ <template
40
+ #append
41
+ >
42
+ <FSChip
43
+ v-if="props.item.correlated"
44
+ prependIcon="mdi-link"
45
+ :label="$tr('autocomplete.data-category.linked','Linked')"
46
+ :color="ColorEnum.Success"
47
+ />
48
+ <FSChip
49
+ v-else
50
+ prependIcon="mdi-link-off"
51
+ :label="$tr('autocomplete.data-category.not-linked','Not linked')"
52
+ :color="ColorEnum.Warning"
53
+ />
54
+ </template>
55
+ </FSButton>
55
56
  </template>
56
57
  </FSAutocompleteField>
57
58
  </template>
@@ -62,21 +63,19 @@ import { computed, defineComponent, type PropType } from "vue";
62
63
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
63
64
  import { type DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
64
65
  import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
66
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
67
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
65
68
 
66
69
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
67
70
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
68
- import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
69
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
70
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
71
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
71
72
 
72
73
  export default defineComponent({
73
74
  name: "FSAutocompleteDataCategory",
74
75
  components: {
75
76
  FSAutocompleteField,
76
77
  FSButton,
77
- FSIcon,
78
- FSSpan,
79
- FSRow
78
+ FSChip
80
79
  },
81
80
  props: {
82
81
  dataCategoriesFilters: {
@@ -98,16 +97,29 @@ export default defineComponent({
98
97
  type: Boolean,
99
98
  required: false,
100
99
  default: false
100
+ },
101
+ label: {
102
+ type: String as PropType<string | null>,
103
+ required: false,
104
+ default: null
101
105
  }
102
106
  },
103
107
  emits: ["update:modelValue"],
104
108
  setup(props, { emit }) {
105
109
  const { getMany: getManyDataCategories, fetching: fetchingDataCategories, entities: dataCategories } = useDataCategories();
110
+ const { $tr } = useTranslationsProvider();
106
111
 
107
112
  const loading = computed((): boolean => {
108
113
  return init.value && fetchingDataCategories.value;
109
114
  });
110
115
 
116
+ const placeholder = computed((): string | null => {
117
+ if (props.multiple && props.modelValue) {
118
+ return $tr("autocomplete.data-category.placeholder", "{0} data category(ies) selected", props.modelValue.length);
119
+ }
120
+ return null;
121
+ });
122
+
111
123
  const fetch = (search: string | null) => {
112
124
  return getManyDataCategories({ ...props.dataCategoriesFilters, search: search ?? undefined });
113
125
  };
@@ -121,6 +133,8 @@ export default defineComponent({
121
133
 
122
134
  return {
123
135
  dataCategories,
136
+ placeholder,
137
+ ColorEnum,
124
138
  toggleSet,
125
139
  loading,
126
140
  onUpdate
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.data-definition', 'Data')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
5
  :multiple="$props.multiple"
6
+ :placeholder="placeholder"
5
7
  :items="dataDefinitions"
6
8
  :loading="loading"
7
9
  :modelValue="$props.modelValue"
@@ -9,39 +11,12 @@
9
11
  v-bind="$attrs"
10
12
  >
11
13
  <template
12
- #autocomplete-selection="{ item }"
14
+ #item-append="{ item }"
13
15
  >
14
- <FSRow
15
- v-if="$props.modelValue"
16
- align="center-center"
17
- :wrap="false"
18
- >
19
- <FSChip
20
- v-if="item.raw.unit"
21
- :label="item.raw.unit"
22
- />
23
- <FSSpan>
24
- {{ item.raw.label }}
25
- </FSSpan>
26
- </FSRow>
27
- </template>
28
- <template
29
- #item-label="{ item, font }"
30
- >
31
- <FSRow
32
- align="center-left"
33
- :wrap="false"
34
- >
35
- <FSChip
36
- v-if="item.raw.unit"
37
- :label="item.raw.unit"
38
- />
39
- <FSSpan
40
- :font="font"
41
- >
42
- {{ item.raw.label }}
43
- </FSSpan>
44
- </FSRow>
16
+ <FSChip
17
+ v-if="item.unit"
18
+ :label="item.unit"
19
+ />
45
20
  </template>
46
21
  <template
47
22
  #toggle-set-item="props"
@@ -54,10 +29,10 @@
54
29
  @click="props.toggle(props.item)"
55
30
  >
56
31
  <template
57
- #prepend
32
+ v-if="props.item.unit"
33
+ #append
58
34
  >
59
35
  <FSChip
60
- v-if="props.item.unit"
61
36
  :label="props.item.unit"
62
37
  />
63
38
  </template>
@@ -72,21 +47,18 @@ import { computed, defineComponent, type PropType } from "vue";
72
47
  import { type DataDefinitionFilters } from "@dative-gpi/foundation-core-domain/models";
73
48
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
74
49
  import { useDataDefinitions } from "@dative-gpi/foundation-core-services/composables";
50
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
75
51
 
76
52
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
77
53
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
78
54
  import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
79
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
80
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
81
55
 
82
56
  export default defineComponent({
83
57
  name: "FSAutocompleteDataDefinition",
84
58
  components: {
85
59
  FSAutocompleteField,
86
60
  FSButton,
87
- FSChip,
88
- FSSpan,
89
- FSRow
61
+ FSChip
90
62
  },
91
63
  props: {
92
64
  dataDefinitionFilters: {
@@ -108,16 +80,29 @@ export default defineComponent({
108
80
  type: Boolean,
109
81
  required: false,
110
82
  default: false
83
+ },
84
+ label: {
85
+ type: String as PropType<string | null>,
86
+ required: false,
87
+ default: null
111
88
  }
112
89
  },
113
90
  emits: ["update:modelValue"],
114
91
  setup(props, { emit }) {
115
92
  const { getMany: getManyDataDefinitions, fetching: fetchingDataDefinitions, entities: dataDefinitions } = useDataDefinitions();
93
+ const { $tr } = useTranslationsProvider();
116
94
 
117
95
  const loading = computed((): boolean => {
118
96
  return init.value && fetchingDataDefinitions.value;
119
97
  });
120
98
 
99
+ const placeholder = computed((): string | null => {
100
+ if (props.multiple && props.modelValue) {
101
+ return $tr("autocomplete.data-definition.placeholder", "{0} data definition(s) selected", props.modelValue.length);
102
+ }
103
+ return null;
104
+ });
105
+
121
106
  const fetch = (search: string | null) => {
122
107
  return getManyDataDefinitions({ ...props.dataDefinitionFilters, search: search ?? undefined });
123
108
  };
@@ -131,6 +116,7 @@ export default defineComponent({
131
116
 
132
117
  return {
133
118
  dataDefinitions,
119
+ placeholder,
134
120
  toggleSet,
135
121
  loading,
136
122
  onUpdate
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.group', 'Group')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
5
  :multiple="$props.multiple"
6
+ :placeholder="placeholder"
5
7
  :loading="loading"
6
8
  :items="groups"
7
9
  :modelValue="$props.modelValue"
@@ -9,41 +11,13 @@
9
11
  v-bind="$attrs"
10
12
  >
11
13
  <template
12
- #autocomplete-selection="{ item }"
14
+ #item-prepend="{ item }"
13
15
  >
14
- <FSRow
15
- v-if="$props.modelValue"
16
- align="center-center"
17
- :wrap="false"
16
+ <FSIcon
17
+ v-if="item.icon"
18
18
  >
19
- <FSIcon
20
- v-if="item.raw.icon"
21
- >
22
- {{ item.raw.icon }}
23
- </FSIcon>
24
- <FSSpan>
25
- {{ item.raw.label }}
26
- </FSSpan>
27
- </FSRow>
28
- </template>
29
- <template
30
- #item-label="{ item, font }"
31
- >
32
- <FSRow
33
- align="center-left"
34
- :wrap="false"
35
- >
36
- <FSIcon
37
- v-if="item.raw.icon"
38
- >
39
- {{ item.raw.icon }}
40
- </FSIcon>
41
- <FSSpan
42
- :font="font"
43
- >
44
- {{ item.raw.label }}
45
- </FSSpan>
46
- </FSRow>
19
+ {{ item.icon }}
20
+ </FSIcon>
47
21
  </template>
48
22
  </FSAutocompleteField>
49
23
  </template>
@@ -52,21 +26,18 @@
52
26
  import { computed, defineComponent, type PropType } from "vue";
53
27
 
54
28
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
29
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
55
30
  import { type GroupFilters } from "@dative-gpi/foundation-core-domain/models";
56
31
  import { useGroups } from "@dative-gpi/foundation-core-services/composables";
57
32
 
58
33
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
59
34
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
60
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
61
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
62
35
 
63
36
  export default defineComponent({
64
37
  name: "FSAutocompleteGroup",
65
38
  components: {
66
39
  FSAutocompleteField,
67
- FSIcon,
68
- FSSpan,
69
- FSRow
40
+ FSIcon
70
41
  },
71
42
  props: {
72
43
  groupFilters: {
@@ -88,16 +59,29 @@ export default defineComponent({
88
59
  type: Boolean,
89
60
  required: false,
90
61
  default: false
62
+ },
63
+ label: {
64
+ type: String as PropType<string | null>,
65
+ required: false,
66
+ default: null
91
67
  }
92
68
  },
93
69
  emits: ["update:modelValue"],
94
70
  setup(props, { emit }) {
95
71
  const { getMany: getManyGroups, fetching: fetchingGroups, entities: groups } = useGroups();
72
+ const { $tr } = useTranslationsProvider();
96
73
 
97
74
  const loading = computed((): boolean => {
98
75
  return init.value && fetchingGroups.value;
99
76
  });
100
77
 
78
+ const placeholder = computed((): string | null => {
79
+ if (props.multiple && props.modelValue) {
80
+ return $tr("autocomplete.group.placeholder", "{0} group(s) selected", props.modelValue.length);
81
+ }
82
+ return null;
83
+ });
84
+
101
85
  const fetch = (search: string | null) => {
102
86
  return getManyGroups({ ...props.groupFilters, search: search ?? undefined });
103
87
  };
@@ -110,6 +94,7 @@ export default defineComponent({
110
94
  );
111
95
 
112
96
  return {
97
+ placeholder,
113
98
  toggleSet,
114
99
  loading,
115
100
  groups,
@@ -1,7 +1,9 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.location', 'Location')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
5
  :multiple="$props.multiple"
6
+ :placeholder="placeholder"
5
7
  :loading="loading"
6
8
  :items="locations"
7
9
  :modelValue="$props.modelValue"
@@ -9,41 +11,13 @@
9
11
  v-bind="$attrs"
10
12
  >
11
13
  <template
12
- #autocomplete-selection="{ item }"
14
+ #item-prepend="{ item }"
13
15
  >
14
- <FSRow
15
- v-if="$props.modelValue"
16
- align="center-center"
17
- :wrap="false"
16
+ <FSIcon
17
+ v-if="item.icon"
18
18
  >
19
- <FSIcon
20
- v-if="item.raw.icon"
21
- >
22
- {{ item.raw.icon }}
23
- </FSIcon>
24
- <FSSpan>
25
- {{ item.raw.label }}
26
- </FSSpan>
27
- </FSRow>
28
- </template>
29
- <template
30
- #item-label="{ item, font }"
31
- >
32
- <FSRow
33
- align="center-left"
34
- :wrap="false"
35
- >
36
- <FSIcon
37
- v-if="item.raw.icon"
38
- >
39
- {{ item.raw.icon }}
40
- </FSIcon>
41
- <FSSpan
42
- :font="font"
43
- >
44
- {{ item.raw.label }}
45
- </FSSpan>
46
- </FSRow>
19
+ {{ item.icon }}
20
+ </FSIcon>
47
21
  </template>
48
22
  </FSAutocompleteField>
49
23
  </template>
@@ -52,21 +26,18 @@
52
26
  import { computed, defineComponent, type PropType } from "vue";
53
27
 
54
28
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
29
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
55
30
  import { type LocationFilters } from "@dative-gpi/foundation-core-domain/models";
56
31
  import { useLocations } from "@dative-gpi/foundation-core-services/composables";
57
32
 
58
33
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
59
34
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
60
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
61
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
62
35
 
63
36
  export default defineComponent({
64
37
  name: "FSAutocompleteLocation",
65
38
  components: {
66
39
  FSAutocompleteField,
67
- FSIcon,
68
- FSSpan,
69
- FSRow
40
+ FSIcon
70
41
  },
71
42
  props: {
72
43
  locationFilters: {
@@ -88,16 +59,29 @@ export default defineComponent({
88
59
  type: Boolean,
89
60
  required: false,
90
61
  default: false
62
+ },
63
+ label: {
64
+ type: String as PropType<string | null>,
65
+ required: false,
66
+ default: null
91
67
  }
92
68
  },
93
69
  emits: ["update:modelValue"],
94
70
  setup(props, { emit }) {
95
71
  const { getMany: getManyLocations, fetching: fetchingLocations, entities: locations } = useLocations();
72
+ const { $tr } = useTranslationsProvider();
96
73
 
97
74
  const loading = computed((): boolean => {
98
75
  return init.value && fetchingLocations.value;
99
76
  });
100
77
 
78
+ const placeholder = computed((): string | null => {
79
+ if (props.multiple && props.modelValue) {
80
+ return $tr("ui.autocomplete-location.placeholder", "{0} location(s) selected", props.modelValue.length);
81
+ }
82
+ return null;
83
+ });
84
+
101
85
  const fetch = (search: string | null) => {
102
86
  return getManyLocations({ ...props.locationFilters, search: search ?? undefined });
103
87
  };
@@ -110,6 +94,7 @@ export default defineComponent({
110
94
  );
111
95
 
112
96
  return {
97
+ placeholder,
113
98
  locations,
114
99
  toggleSet,
115
100
  loading,
@@ -1,12 +1,51 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.manufacturer', 'Manufacturer')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
5
+ :multiple="$props.multiple"
6
+ :placeholder="placeholder"
4
7
  :items="manufacturers"
5
8
  :loading="loading"
6
9
  :modelValue="$props.modelValue"
7
10
  @update:modelValue="onUpdate"
8
11
  v-bind="$attrs"
9
- />
12
+ >
13
+ <template
14
+ #item-prepend="{ item }"
15
+ >
16
+ <FSImage
17
+ v-if="item.imageId"
18
+ height="26px"
19
+ width="26px"
20
+ :imageId="item.imageId"
21
+ :thumbnail="true"
22
+ />
23
+ </template>
24
+ <template
25
+ #toggle-set-item="props"
26
+ >
27
+ <FSButton
28
+ :padding="props.item.imageId ? ['6px 16px', '4px 12px'] : undefined"
29
+ :variant="props.getVariant(props.item)"
30
+ :color="props.getColor(props.item)"
31
+ :class="props.getClass(props.item)"
32
+ :label="props.item.label"
33
+ @click="props.toggle(props.item)"
34
+ >
35
+ <template
36
+ v-if="props.item.imageId"
37
+ #prepend
38
+ >
39
+ <FSImage
40
+ height="26px"
41
+ width="26px"
42
+ :imageId="props.item.imageId"
43
+ :thumbnail="true"
44
+ />
45
+ </template>
46
+ </FSButton>
47
+ </template>
48
+ </FSAutocompleteField>
10
49
  </template>
11
50
 
12
51
  <script lang="ts">
@@ -15,13 +54,18 @@ import { computed, defineComponent, type PropType } from "vue";
15
54
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
16
55
  import { type ManufacturerFilters } from "@dative-gpi/foundation-core-domain/models";
17
56
  import { useManufacturers } from "@dative-gpi/foundation-core-services/composables";
57
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
18
58
 
19
59
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
60
+ import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
61
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
20
62
 
21
63
  export default defineComponent({
22
64
  name: "FSAutocompleteManufacturer",
23
65
  components: {
24
- FSAutocompleteField
66
+ FSAutocompleteField,
67
+ FSButton,
68
+ FSImage
25
69
  },
26
70
  props: {
27
71
  manufacturerFilters: {
@@ -34,20 +78,38 @@ export default defineComponent({
34
78
  required: false,
35
79
  default: null
36
80
  },
81
+ multiple: {
82
+ type: Boolean,
83
+ required: false,
84
+ default: false
85
+ },
37
86
  toggleSetDisabled: {
38
87
  type: Boolean,
39
88
  required: false,
40
89
  default: false
90
+ },
91
+ label: {
92
+ type: String as PropType<string | null>,
93
+ required: false,
94
+ default: null
41
95
  }
42
96
  },
43
97
  emits: ["update:modelValue"],
44
98
  setup(props, { emit }) {
45
99
  const { getMany: getManyManufacturers, fetching: fetchingManufacturers, entities: manufacturers } = useManufacturers();
100
+ const { $tr } = useTranslationsProvider();
46
101
 
47
102
  const loading = computed((): boolean => {
48
103
  return init.value && fetchingManufacturers.value;
49
104
  });
50
105
 
106
+ const placeholder = computed((): string | null => {
107
+ if (props.multiple && props.modelValue) {
108
+ return $tr("ui.autocomplete-manufacturer.placeholder", "{0} manufacturer(s) selected", props.modelValue.length);
109
+ }
110
+ return null;
111
+ });
112
+
51
113
  const fetch = (search: string | null) => {
52
114
  return getManyManufacturers({ ...props.manufacturerFilters, search: search ?? undefined });
53
115
  };
@@ -61,6 +123,7 @@ export default defineComponent({
61
123
 
62
124
  return {
63
125
  manufacturers,
126
+ placeholder,
64
127
  toggleSet,
65
128
  loading,
66
129
  onUpdate