@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.chart', 'Chart')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
5
  :multiple="$props.multiple"
6
+ :placeholder="placeholder"
5
7
  :loading="loading"
6
8
  :items="charts"
7
9
  :modelValue="$props.modelValue"
@@ -9,51 +11,22 @@
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
- <FSChip
28
- :color="chartOriginColor(item.raw.type)"
29
- :label="chartOriginLabel(item.raw.type)"
30
- :editable="false"
31
- />
32
- </FSRow>
19
+ {{ item.icon }}
20
+ </FSIcon>
33
21
  </template>
34
22
  <template
35
- #item-label="{ item, font }"
23
+ #item-append="{ item }"
36
24
  >
37
- <FSRow
38
- align="center-left"
39
- :wrap="false"
40
- >
41
- <FSIcon
42
- v-if="item.raw.icon"
43
- >
44
- {{ item.raw.icon }}
45
- </FSIcon>
46
- <FSSpan
47
- :font="font"
48
- >
49
- {{ item.raw.label }}
50
- </FSSpan>
51
- <FSChip
52
- :color="chartOriginColor(item.raw.type)"
53
- :label="chartOriginLabel(item.raw.type)"
54
- :editable="false"
55
- />
56
- </FSRow>
25
+ <FSChip
26
+ :color="chartOriginColor(item.type)"
27
+ :label="chartOriginLabel(item.type)"
28
+ :editable="false"
29
+ />
57
30
  </template>
58
31
  <template
59
32
  #toggle-set-item="props"
@@ -67,6 +40,7 @@
67
40
  @click="props.toggle(props.item)"
68
41
  >
69
42
  <template
43
+ v-if="props.item.type"
70
44
  #append
71
45
  >
72
46
  <FSChip
@@ -83,18 +57,17 @@
83
57
  <script lang="ts">
84
58
  import { computed, defineComponent, type PropType } from "vue";
85
59
 
86
- import { type ChartOrganisationFilters, ChartOrigin, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
60
+ import { type ChartOrganisationFilters, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
87
61
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
62
+ import { chartOriginColor, chartOriginLabel } from "@dative-gpi/foundation-shared-components/tools";
88
63
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
89
-
90
- import { chartOriginColor, chartOriginLabel } from "../../utils";
64
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
65
+ import { ChartOrigin } from "@dative-gpi/foundation-shared-domain/enums";
91
66
 
92
67
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
93
68
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
94
69
  import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
95
70
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
96
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
97
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
98
71
 
99
72
  export default defineComponent({
100
73
  name: "FSAutocompleteChart",
@@ -102,9 +75,7 @@ export default defineComponent({
102
75
  FSAutocompleteField,
103
76
  FSButton,
104
77
  FSChip,
105
- FSIcon,
106
- FSSpan,
107
- FSRow
78
+ FSIcon
108
79
  },
109
80
  props: {
110
81
  chartOrganisationTypeFilters: {
@@ -123,10 +94,20 @@ export default defineComponent({
123
94
  default: null
124
95
  },
125
96
  type: {
126
- type: Number as PropType<ChartOrigin>,
97
+ type: [Array, Number] as PropType<ChartOrigin[] | ChartOrigin>,
127
98
  required: false,
128
99
  default: ChartOrigin.None
129
100
  },
101
+ ignoreChartOrganisationTypes: {
102
+ type: Boolean,
103
+ required: false,
104
+ default: false
105
+ },
106
+ ignoreChartOrganisations: {
107
+ type: Boolean,
108
+ required: false,
109
+ default: false
110
+ },
130
111
  multiple: {
131
112
  type: Boolean,
132
113
  required: false,
@@ -136,12 +117,18 @@ export default defineComponent({
136
117
  type: Boolean,
137
118
  required: false,
138
119
  default: false
120
+ },
121
+ label: {
122
+ type: String as PropType<string | null>,
123
+ required: false,
124
+ default: null
139
125
  }
140
126
  },
141
- emits: ["update:modelValue", "update:type"],
127
+ emits: ["update", "update:modelValue", "update:type"],
142
128
  setup(props, { emit }) {
143
129
  const { getMany: getManyChartOrganisationTypes, fetching: fetchingChartOrganisationTypes, entities: chartOrganisationTypes } = useChartOrganisationTypes();
144
130
  const { getMany: getManyChartOrganisations, fetching: fetchingChartOrganisations, entities: chartOrganisations } = useChartOrganisations();
131
+ const { $tr } = useTranslationsProvider();
145
132
 
146
133
  const charts = computed(() => {
147
134
  return chartOrganisationTypes.value.map(rot => ({
@@ -161,25 +148,40 @@ export default defineComponent({
161
148
  return init.value && (fetchingChartOrganisationTypes.value || fetchingChartOrganisations.value);
162
149
  });
163
150
 
151
+ const placeholder = computed((): string | null => {
152
+ if (props.multiple && props.modelValue) {
153
+ return $tr("autocomplete.chart.placeholder", "{0} chart(s) selected", props.modelValue.length);
154
+ }
155
+ return null;
156
+ });
157
+
164
158
  const update = (value: Chart[] | Chart | null) => {
165
159
  if (Array.isArray(value)) {
166
- emit("update:modelValue", value.map(v => v.id));
167
- emit("update:type", value.map(v => v.type));
160
+ const newModelValue = value.map(v => v.id);
161
+ const newType = value.map(v => v.type);
162
+ emit("update:modelValue", newModelValue);
163
+ emit("update:type", newType);
164
+ emit("update", { modelValue: newModelValue, type: newType });
168
165
  }
169
166
  else {
170
167
  emit("update:modelValue", value?.id);
171
168
  emit("update:type", value?.type);
169
+ emit("update", { modelValue: value?.id, type: value?.type });
172
170
  }
173
171
  };
174
172
 
175
173
  const fetch = (search: string | null) => {
176
- return Promise.all([
177
- getManyChartOrganisationTypes({ ...props.chartOrganisationTypeFilters, search: search ?? undefined }),
178
- getManyChartOrganisations({ ...props.chartOrganisationFilters, search: search ?? undefined })
179
- ]);
174
+ const promises = [];
175
+ if (!props.ignoreChartOrganisationTypes) {
176
+ promises.push(getManyChartOrganisationTypes({ ...props.chartOrganisationTypeFilters, search: search ?? undefined }));
177
+ }
178
+ if (!props.ignoreChartOrganisations) {
179
+ promises.push(getManyChartOrganisations({ ...props.chartOrganisationFilters, search: search ?? undefined }));
180
+ }
181
+ return Promise.all(promises);
180
182
  };
181
183
 
182
- const { toggleSet, search, init, onUpdate } = useAutocomplete(
184
+ const { toggleSet, init, onUpdate } = useAutocomplete(
183
185
  charts,
184
186
  [() => props.chartOrganisationTypeFilters, () => props.chartOrganisationFilters],
185
187
  emit,
@@ -188,9 +190,9 @@ export default defineComponent({
188
190
  );
189
191
 
190
192
  return {
193
+ placeholder,
191
194
  toggleSet,
192
195
  loading,
193
- search,
194
196
  charts,
195
197
  chartOriginColor,
196
198
  chartOriginLabel,
@@ -1,59 +1,32 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.dashboard', 'Dashboard')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
5
  :multiple="$props.multiple"
5
- :loading="loading"
6
+ :placeholder="placeholder"
6
7
  :items="dashboards"
8
+ :loading="loading"
7
9
  :modelValue="$props.modelValue"
8
10
  @update:modelValue="onUpdate"
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
- <FSChip
28
- :color="dashboardTypeColor(item.raw.type)"
29
- :label="dashboardTypeLabel(item.raw.type)"
30
- :editable="false"
31
- />
32
- </FSRow>
19
+ {{ item.icon }}
20
+ </FSIcon>
33
21
  </template>
34
22
  <template
35
- #item-label="{ item, font }"
23
+ #item-append="{ item }"
36
24
  >
37
- <FSRow
38
- align="center-left"
39
- :wrap="false"
40
- >
41
- <FSIcon
42
- v-if="item.raw.icon"
43
- >
44
- {{ item.raw.icon }}
45
- </FSIcon>
46
- <FSSpan
47
- :font="font"
48
- >
49
- {{ item.raw.label }}
50
- </FSSpan>
51
- <FSChip
52
- :color="dashboardTypeColor(item.raw.type)"
53
- :label="dashboardTypeLabel(item.raw.type)"
54
- :editable="false"
55
- />
56
- </FSRow>
25
+ <FSChip
26
+ :color="dashboardTypeColor(item.type)"
27
+ :label="dashboardTypeLabel(item.type)"
28
+ :editable="false"
29
+ />
57
30
  </template>
58
31
  <template
59
32
  #toggle-set-item="props"
@@ -67,6 +40,7 @@
67
40
  @click="props.toggle(props.item)"
68
41
  >
69
42
  <template
43
+ v-if="props.item.type"
70
44
  #append
71
45
  >
72
46
  <FSChip
@@ -86,16 +60,15 @@ import { computed, defineComponent, type PropType } from "vue";
86
60
  import { type DashboardOrganisationFilters, type DashboardOrganisationTypeFilters, type DashboardShallowFilters } from "@dative-gpi/foundation-core-domain/models";
87
61
  import { useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
88
62
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
89
- import { DashboardType } from "@dative-gpi/foundation-shared-domain/models";
63
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
90
64
 
65
+ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
91
66
  import { dashboardTypeColor, dashboardTypeLabel } from "../../utils";
92
67
 
93
68
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
94
69
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
95
70
  import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
96
71
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
97
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
98
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
99
72
 
100
73
 
101
74
  export default defineComponent({
@@ -104,9 +77,7 @@ export default defineComponent({
104
77
  FSAutocompleteField,
105
78
  FSButton,
106
79
  FSChip,
107
- FSIcon,
108
- FSSpan,
109
- FSRow
80
+ FSIcon
110
81
  },
111
82
  props: {
112
83
  dashboardOrganisationTypeFilters: {
@@ -130,10 +101,20 @@ export default defineComponent({
130
101
  default: null
131
102
  },
132
103
  type: {
133
- type: Number as PropType<DashboardType>,
104
+ type: [Array, Number] as PropType<DashboardType[] | DashboardType>,
134
105
  required: false,
135
106
  default: DashboardType.None
136
107
  },
108
+ ignoreDashboardOrganisationTypes: {
109
+ type: Boolean,
110
+ required: false,
111
+ default: false
112
+ },
113
+ ignoreDashboardOrganisations: {
114
+ type: Boolean,
115
+ required: false,
116
+ default: false
117
+ },
137
118
  multiple: {
138
119
  type: Boolean,
139
120
  required: false,
@@ -143,13 +124,19 @@ export default defineComponent({
143
124
  type: Boolean,
144
125
  required: false,
145
126
  default: false
127
+ },
128
+ label: {
129
+ type: String as PropType<string | null>,
130
+ required: false,
131
+ default: null
146
132
  }
147
133
  },
148
- emits: ["update:modelValue", "update:type"],
134
+ emits: ["update", "update:modelValue", "update:type"],
149
135
  setup(props, { emit }) {
150
136
  const { getMany: getManyDashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, entities: dashboardOrganisationTypes } = useDashboardOrganisationTypes();
151
137
  const { getMany: getManyDashboardOrganisations, fetching: fetchingDashboardOrganisations, entities: dashboardOrganisations } = useDashboardOrganisations();
152
138
  const { getMany: getManyDashboardShallows, fetching: fetchingDashboardShallows, entities: dashboardShallows } = useDashboardShallows();
139
+ const { $tr } = useTranslationsProvider();
153
140
 
154
141
  const dashboards = computed(() => {
155
142
  return dashboardOrganisationTypes.value.map(rot => ({
@@ -174,23 +161,38 @@ export default defineComponent({
174
161
  return init.value && (fetchingDashboardOrganisationTypes.value || fetchingDashboardOrganisations.value || fetchingDashboardShallows.value);
175
162
  });
176
163
 
164
+ const placeholder = computed((): string | null => {
165
+ if (props.multiple && props.modelValue) {
166
+ return $tr("autocomplete.dashboard.placeholder", "{0} dashboard(s) selected", props.modelValue.length);
167
+ }
168
+ return null;
169
+ });
170
+
177
171
  const update = (value: Dashboard[] | Dashboard | null) => {
178
172
  if (Array.isArray(value)) {
179
- emit("update:modelValue", value.map(v => v.id));
180
- emit("update:type", value.map(v => v.type));
173
+ const newModelValue = value.map(v => v.id);
174
+ const newType = value.map(v => v.type);
175
+ emit("update:modelValue", newModelValue);
176
+ emit("update:type", newType);
177
+ emit("update", { modelValue: newModelValue, type: newType });
181
178
  }
182
179
  else {
183
180
  emit("update:modelValue", value?.id);
184
181
  emit("update:type", value?.type);
182
+ emit("update", { modelValue: value?.id, type: value?.type });
185
183
  }
186
184
  };
187
185
 
188
186
  const fetch = (search: string | null) => {
189
- return Promise.all([
190
- getManyDashboardOrganisationTypes({ ...props.dashboardOrganisationTypeFilters, search: search ?? undefined }),
191
- getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined }),
192
- getManyDashboardShallows({ ...props.dashboardShallowFilters, search: search ?? undefined })
193
- ]);
187
+ const promises = [];
188
+ if (!props.ignoreDashboardOrganisationTypes) {
189
+ promises.push(getManyDashboardOrganisationTypes({ ...props.dashboardOrganisationTypeFilters, search: search ?? undefined }));
190
+ }
191
+ if (!props.ignoreDashboardOrganisations) {
192
+ promises.push(getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined }));
193
+ promises.push(getManyDashboardShallows({ ...props.dashboardShallowFilters, search: search ?? undefined }));
194
+ }
195
+ return Promise.all(promises);
194
196
  };
195
197
 
196
198
  const { toggleSet, init, onUpdate } = useAutocomplete(
@@ -202,6 +204,7 @@ export default defineComponent({
202
204
  );
203
205
 
204
206
  return {
207
+ placeholder,
205
208
  dashboards,
206
209
  toggleSet,
207
210
  loading,
@@ -1,48 +1,23 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
+ :label="$props.label ?? $tr('ui.common.dashboard', 'Dashboard')"
3
4
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
- :loading="loading"
5
5
  :items="dashboardOrganisations"
6
+ :multiple="$props.multiple"
7
+ :placeholder="placeholder"
8
+ :loading="loading"
6
9
  :modelValue="$props.modelValue"
7
10
  @update:modelValue="onUpdate"
8
11
  v-bind="$attrs"
9
12
  >
10
13
  <template
11
- #autocomplete-selection="{ item }"
12
- >
13
- <FSRow
14
- v-if="$props.modelValue"
15
- align="center-center"
16
- :wrap="false"
17
- >
18
- <FSIcon
19
- v-if="item.raw.icon"
20
- >
21
- {{ item.raw.icon }}
22
- </FSIcon>
23
- <FSSpan>
24
- {{ item.raw.label }}
25
- </FSSpan>
26
- </FSRow>
27
- </template>
28
- <template
29
- #item-label="{ item, font }"
14
+ #item-prepend="{ item }"
30
15
  >
31
- <FSRow
32
- align="center-left"
33
- :wrap="false"
16
+ <FSIcon
17
+ v-if="item.icon"
34
18
  >
35
- <FSIcon
36
- v-if="item.raw.icon"
37
- >
38
- {{ item.raw.icon }}
39
- </FSIcon>
40
- <FSSpan
41
- :font="font"
42
- >
43
- {{ item.raw.label }}
44
- </FSSpan>
45
- </FSRow>
19
+ {{ item.icon }}
20
+ </FSIcon>
46
21
  </template>
47
22
  </FSAutocompleteField>
48
23
  </template>
@@ -53,20 +28,17 @@ import { computed, defineComponent, type PropType } from "vue";
53
28
  import { type DashboardOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
54
29
  import { useDashboardOrganisations } from "@dative-gpi/foundation-core-services/composables";
55
30
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
31
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
56
32
 
57
33
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
58
34
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
59
- import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
60
- import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
61
35
 
62
36
 
63
37
  export default defineComponent({
64
38
  name: "FSAutocompleteDashboard",
65
39
  components: {
66
40
  FSAutocompleteField,
67
- FSIcon,
68
- FSSpan,
69
- FSRow
41
+ FSIcon
70
42
  },
71
43
  props: {
72
44
  dashboardOrganisationFilters: {
@@ -79,20 +51,38 @@ export default defineComponent({
79
51
  required: false,
80
52
  default: null
81
53
  },
54
+ multiple: {
55
+ type: Boolean,
56
+ required: false,
57
+ default: false
58
+ },
82
59
  toggleSetDisabled: {
83
60
  type: Boolean,
84
61
  required: false,
85
62
  default: false
63
+ },
64
+ label: {
65
+ type: String as PropType<string | null>,
66
+ required: false,
67
+ default: null
86
68
  }
87
69
  },
88
70
  emits: ["update:modelValue"],
89
71
  setup(props, { emit }) {
90
72
  const { getMany: getManyDashboardOrganisations, fetching: fetchingDashboardOrganisations, entities: dashboardOrganisations } = useDashboardOrganisations();
73
+ const { $tr } = useTranslationsProvider();
91
74
 
92
75
  const loading = computed((): boolean => {
93
76
  return init.value && fetchingDashboardOrganisations.value;
94
77
  });
95
78
 
79
+ const placeholder = computed((): string | null => {
80
+ if (props.multiple && props.modelValue) {
81
+ return $tr("autocomplete.dashboard.placeholder", "{0} dashboard(s) selected", props.modelValue.length);
82
+ }
83
+ return null;
84
+ });
85
+
96
86
  const fetch = (search: string | null) => {
97
87
  return getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined });
98
88
  };
@@ -106,6 +96,7 @@ export default defineComponent({
106
96
 
107
97
  return {
108
98
  dashboardOrganisations,
99
+ placeholder,
109
100
  toggleSet,
110
101
  loading,
111
102
  onUpdate