@dative-gpi/foundation-core-components 0.0.230 → 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 (84) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +46 -53
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +46 -53
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +24 -39
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +46 -38
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +19 -39
  6. package/components/autocompletes/FSAutocompleteGroup.vue +17 -38
  7. package/components/autocompletes/FSAutocompleteLocation.vue +17 -38
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +57 -2
  9. package/components/autocompletes/FSAutocompleteModel.vue +58 -3
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +17 -0
  11. package/components/autocompletes/FSAutocompleteRole.vue +46 -53
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +99 -0
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +24 -57
  14. package/components/customProperties/FSMetaField.vue +5 -6
  15. package/components/customProperties/FSMetaFormContent.vue +4 -5
  16. package/components/customProperties/FSMetaGrid.vue +3 -4
  17. package/components/customProperties/FSMetaHistory.vue +16 -15
  18. package/components/customProperties/FSMetaValue.vue +67 -36
  19. package/components/customProperties/helpers.ts +5 -4
  20. package/components/entities/FSBaseEntitiesList.vue +50 -0
  21. package/components/entities/FSDialogSelectEntities.vue +76 -0
  22. package/components/entities/FSEntityField.vue +149 -0
  23. package/components/entities/FSSelectEntitiesList.vue +192 -0
  24. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  25. package/components/explorers/FSBaseFoldersExplorer.vue +258 -0
  26. package/components/lists/FSDataTable.vue +4 -8
  27. package/components/lists/alerts/FSBaseAlertsList.vue +357 -0
  28. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  29. package/components/lists/authTokens/FSBaseAuthTokensList.vue +78 -0
  30. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +159 -0
  31. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +159 -0
  32. package/components/lists/charts/FSBaseChartsList.vue +218 -0
  33. package/components/lists/comments/FSBaseCommentsList.vue +127 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +164 -0
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +222 -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 +128 -0
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +354 -0
  40. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  41. package/components/lists/folders/FSBaseFoldersList.vue +116 -0
  42. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  43. package/components/lists/groups/FSBaseGroupsList.vue +133 -0
  44. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  45. package/components/lists/locations/FSBaseLocationsList.vue +115 -0
  46. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  47. package/components/lists/models/FSBaseModelsList.vue +152 -0
  48. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  49. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +127 -0
  50. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +127 -0
  51. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +120 -0
  52. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +107 -0
  53. package/components/lists/scenarios/FSBaseScenariosList.vue +206 -0
  54. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +153 -0
  55. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisations.vue +127 -0
  56. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +169 -0
  57. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  58. package/components/selects/FSAggregationSelector.vue +5 -5
  59. package/components/selects/FSAxisTypeSelector.vue +1 -1
  60. package/components/selects/FSDisplayAsSelector.vue +5 -5
  61. package/components/selects/FSFilterTypeSelector.vue +2 -2
  62. package/components/selects/FSHeatmapRuleSelector.vue +5 -5
  63. package/components/selects/FSOperationOnSelector.vue +5 -5
  64. package/components/selects/FSPlanningTypeSelector.vue +6 -5
  65. package/components/selects/FSPlotPerSelector.vue +5 -5
  66. package/components/selects/{FSSelectSelectedEntities.vue → FSSelectEntityType.vue} +12 -12
  67. package/components/selects/FSSerieTypeSelector.vue +5 -5
  68. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  69. package/components/tiles/FSLocationTile.vue +65 -0
  70. package/components/tiles/FSServiceAccountOrganisationTile.vue +68 -0
  71. package/components/tiles/FSUserOrganisationTile.vue +0 -2
  72. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  73. package/components/treeviews/FSTreeViewGroup.vue +15 -3
  74. package/package.json +7 -7
  75. package/utils/charts.ts +2 -1
  76. package/utils/dashboards.ts +31 -4
  77. package/utils/index.ts +2 -1
  78. package/utils/permissions.ts +80 -0
  79. package/utils/roles.ts +2 -3
  80. package/utils/tables.ts +41 -0
  81. package/utils/users.ts +4 -1
  82. package/components/selects/FSDataCategorySelector.vue +0 -62
  83. package/components/selects/FSDataDefinitionSelector.vue +0 -66
  84. package/components/selects/FSModelSelector.vue +0 -56
@@ -2,6 +2,7 @@
2
2
  <FSAutocompleteField
3
3
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
4
  :multiple="$props.multiple"
5
+ :placeholder="placeholder"
5
6
  :loading="loading"
6
7
  :items="charts"
7
8
  :modelValue="$props.modelValue"
@@ -9,51 +10,22 @@
9
10
  v-bind="$attrs"
10
11
  >
11
12
  <template
12
- #autocomplete-selection="{ item }"
13
+ #item-prepend="{ item }"
13
14
  >
14
- <FSRow
15
- v-if="$props.modelValue"
16
- align="center-center"
17
- :wrap="false"
15
+ <FSIcon
16
+ v-if="item.icon"
18
17
  >
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>
18
+ {{ item.icon }}
19
+ </FSIcon>
33
20
  </template>
34
21
  <template
35
- #item-label="{ item, font }"
22
+ #item-append="{ item }"
36
23
  >
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>
24
+ <FSChip
25
+ :color="chartOriginColor(item.type)"
26
+ :label="chartOriginLabel(item.type)"
27
+ :editable="false"
28
+ />
57
29
  </template>
58
30
  <template
59
31
  #toggle-set-item="props"
@@ -67,6 +39,7 @@
67
39
  @click="props.toggle(props.item)"
68
40
  >
69
41
  <template
42
+ v-if="props.item.type"
70
43
  #append
71
44
  >
72
45
  <FSChip
@@ -83,18 +56,18 @@
83
56
  <script lang="ts">
84
57
  import { computed, defineComponent, type PropType } from "vue";
85
58
 
86
- import { type ChartOrganisationFilters, ChartOrigin, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
59
+ import { type ChartOrganisationFilters, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
87
60
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
88
61
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
62
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
89
63
 
90
64
  import { chartOriginColor, chartOriginLabel } from "../../utils";
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,
@@ -142,6 +123,7 @@ export default defineComponent({
142
123
  setup(props, { emit }) {
143
124
  const { getMany: getManyChartOrganisationTypes, fetching: fetchingChartOrganisationTypes, entities: chartOrganisationTypes } = useChartOrganisationTypes();
144
125
  const { getMany: getManyChartOrganisations, fetching: fetchingChartOrganisations, entities: chartOrganisations } = useChartOrganisations();
126
+ const { $tr } = useTranslationsProvider();
145
127
 
146
128
  const charts = computed(() => {
147
129
  return chartOrganisationTypes.value.map(rot => ({
@@ -161,6 +143,13 @@ export default defineComponent({
161
143
  return init.value && (fetchingChartOrganisationTypes.value || fetchingChartOrganisations.value);
162
144
  });
163
145
 
146
+ const placeholder = computed((): string | null => {
147
+ if (props.multiple && props.modelValue) {
148
+ return $tr("ui.autocomplete-chart.placeholder", "{0} chart(s) selected", props.modelValue.length);
149
+ }
150
+ return null;
151
+ });
152
+
164
153
  const update = (value: Chart[] | Chart | null) => {
165
154
  if (Array.isArray(value)) {
166
155
  emit("update:modelValue", value.map(v => v.id));
@@ -173,13 +162,17 @@ export default defineComponent({
173
162
  };
174
163
 
175
164
  const fetch = (search: string | null) => {
176
- return Promise.all([
177
- getManyChartOrganisationTypes({ ...props.chartOrganisationTypeFilters, search: search ?? undefined }),
178
- getManyChartOrganisations({ ...props.chartOrganisationFilters, search: search ?? undefined })
179
- ]);
165
+ const promises = [];
166
+ if (!props.ignoreChartOrganisationTypes) {
167
+ promises.push(getManyChartOrganisationTypes({ ...props.chartOrganisationTypeFilters, search: search ?? undefined }));
168
+ }
169
+ if (!props.ignoreChartOrganisations) {
170
+ promises.push(getManyChartOrganisations({ ...props.chartOrganisationFilters, search: search ?? undefined }));
171
+ }
172
+ return Promise.all(promises);
180
173
  };
181
174
 
182
- const { toggleSet, search, init, onUpdate } = useAutocomplete(
175
+ const { toggleSet, init, onUpdate } = useAutocomplete(
183
176
  charts,
184
177
  [() => props.chartOrganisationTypeFilters, () => props.chartOrganisationFilters],
185
178
  emit,
@@ -188,9 +181,9 @@ export default defineComponent({
188
181
  );
189
182
 
190
183
  return {
184
+ placeholder,
191
185
  toggleSet,
192
186
  loading,
193
- search,
194
187
  charts,
195
188
  chartOriginColor,
196
189
  chartOriginLabel,
@@ -2,58 +2,30 @@
2
2
  <FSAutocompleteField
3
3
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
4
  :multiple="$props.multiple"
5
- :loading="loading"
5
+ :placeholder="placeholder"
6
6
  :items="dashboards"
7
+ :loading="loading"
7
8
  :modelValue="$props.modelValue"
8
9
  @update:modelValue="onUpdate"
9
10
  v-bind="$attrs"
10
11
  >
11
12
  <template
12
- #autocomplete-selection="{ item }"
13
+ #item-prepend="{ item }"
13
14
  >
14
- <FSRow
15
- v-if="$props.modelValue"
16
- align="center-center"
17
- :wrap="false"
15
+ <FSIcon
16
+ v-if="item.icon"
18
17
  >
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>
18
+ {{ item.icon }}
19
+ </FSIcon>
33
20
  </template>
34
21
  <template
35
- #item-label="{ item, font }"
22
+ #item-append="{ item }"
36
23
  >
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>
24
+ <FSChip
25
+ :color="dashboardTypeColor(item.type)"
26
+ :label="dashboardTypeLabel(item.type)"
27
+ :editable="false"
28
+ />
57
29
  </template>
58
30
  <template
59
31
  #toggle-set-item="props"
@@ -67,6 +39,7 @@
67
39
  @click="props.toggle(props.item)"
68
40
  >
69
41
  <template
42
+ v-if="props.item.type"
70
43
  #append
71
44
  >
72
45
  <FSChip
@@ -86,16 +59,15 @@ import { computed, defineComponent, type PropType } from "vue";
86
59
  import { type DashboardOrganisationFilters, type DashboardOrganisationTypeFilters, type DashboardShallowFilters } from "@dative-gpi/foundation-core-domain/models";
87
60
  import { useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
88
61
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
89
- import { DashboardType } from "@dative-gpi/foundation-shared-domain/models";
62
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
90
63
 
64
+ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
91
65
  import { dashboardTypeColor, dashboardTypeLabel } from "../../utils";
92
66
 
93
67
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
94
68
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
95
69
  import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
96
70
  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
71
 
100
72
 
101
73
  export default defineComponent({
@@ -104,9 +76,7 @@ export default defineComponent({
104
76
  FSAutocompleteField,
105
77
  FSButton,
106
78
  FSChip,
107
- FSIcon,
108
- FSSpan,
109
- FSRow
79
+ FSIcon
110
80
  },
111
81
  props: {
112
82
  dashboardOrganisationTypeFilters: {
@@ -130,10 +100,20 @@ export default defineComponent({
130
100
  default: null
131
101
  },
132
102
  type: {
133
- type: Number as PropType<DashboardType>,
103
+ type: [Array, Number] as PropType<DashboardType[] | DashboardType>,
134
104
  required: false,
135
105
  default: DashboardType.None
136
106
  },
107
+ ignoreDashboardOrganisationTypes: {
108
+ type: Boolean,
109
+ required: false,
110
+ default: false
111
+ },
112
+ ignoreDashboardOrganisations: {
113
+ type: Boolean,
114
+ required: false,
115
+ default: false
116
+ },
137
117
  multiple: {
138
118
  type: Boolean,
139
119
  required: false,
@@ -150,6 +130,7 @@ export default defineComponent({
150
130
  const { getMany: getManyDashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, entities: dashboardOrganisationTypes } = useDashboardOrganisationTypes();
151
131
  const { getMany: getManyDashboardOrganisations, fetching: fetchingDashboardOrganisations, entities: dashboardOrganisations } = useDashboardOrganisations();
152
132
  const { getMany: getManyDashboardShallows, fetching: fetchingDashboardShallows, entities: dashboardShallows } = useDashboardShallows();
133
+ const { $tr } = useTranslationsProvider();
153
134
 
154
135
  const dashboards = computed(() => {
155
136
  return dashboardOrganisationTypes.value.map(rot => ({
@@ -174,6 +155,13 @@ export default defineComponent({
174
155
  return init.value && (fetchingDashboardOrganisationTypes.value || fetchingDashboardOrganisations.value || fetchingDashboardShallows.value);
175
156
  });
176
157
 
158
+ const placeholder = computed((): string | null => {
159
+ if (props.multiple && props.modelValue) {
160
+ return $tr("ui.autocomplete-dashboard.placeholder", "{0} dashboard(s) selected", props.modelValue.length);
161
+ }
162
+ return null;
163
+ });
164
+
177
165
  const update = (value: Dashboard[] | Dashboard | null) => {
178
166
  if (Array.isArray(value)) {
179
167
  emit("update:modelValue", value.map(v => v.id));
@@ -186,11 +174,15 @@ export default defineComponent({
186
174
  };
187
175
 
188
176
  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
- ]);
177
+ const promises = [];
178
+ if (!props.ignoreDashboardOrganisationTypes) {
179
+ promises.push(getManyDashboardOrganisationTypes({ ...props.dashboardOrganisationTypeFilters, search: search ?? undefined }));
180
+ }
181
+ if (!props.ignoreDashboardOrganisations) {
182
+ promises.push(getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined }));
183
+ promises.push(getManyDashboardShallows({ ...props.dashboardShallowFilters, search: search ?? undefined }));
184
+ }
185
+ return Promise.all(promises);
194
186
  };
195
187
 
196
188
  const { toggleSet, init, onUpdate } = useAutocomplete(
@@ -202,6 +194,7 @@ export default defineComponent({
202
194
  );
203
195
 
204
196
  return {
197
+ placeholder,
205
198
  dashboards,
206
199
  toggleSet,
207
200
  loading,
@@ -1,48 +1,22 @@
1
1
  <template>
2
2
  <FSAutocompleteField
3
3
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
- :loading="loading"
5
4
  :items="dashboardOrganisations"
5
+ :multiple="$props.multiple"
6
+ :placeholder="placeholder"
7
+ :loading="loading"
6
8
  :modelValue="$props.modelValue"
7
9
  @update:modelValue="onUpdate"
8
10
  v-bind="$attrs"
9
11
  >
10
12
  <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 }"
13
+ #item-prepend="{ item }"
30
14
  >
31
- <FSRow
32
- align="center-left"
33
- :wrap="false"
15
+ <FSIcon
16
+ v-if="item.icon"
34
17
  >
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>
18
+ {{ item.icon }}
19
+ </FSIcon>
46
20
  </template>
47
21
  </FSAutocompleteField>
48
22
  </template>
@@ -53,20 +27,17 @@ import { computed, defineComponent, type PropType } from "vue";
53
27
  import { type DashboardOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
54
28
  import { useDashboardOrganisations } from "@dative-gpi/foundation-core-services/composables";
55
29
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
30
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
56
31
 
57
32
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
58
33
  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
34
 
62
35
 
63
36
  export default defineComponent({
64
37
  name: "FSAutocompleteDashboard",
65
38
  components: {
66
39
  FSAutocompleteField,
67
- FSIcon,
68
- FSSpan,
69
- FSRow
40
+ FSIcon
70
41
  },
71
42
  props: {
72
43
  dashboardOrganisationFilters: {
@@ -79,6 +50,11 @@ export default defineComponent({
79
50
  required: false,
80
51
  default: null
81
52
  },
53
+ multiple: {
54
+ type: Boolean,
55
+ required: false,
56
+ default: false
57
+ },
82
58
  toggleSetDisabled: {
83
59
  type: Boolean,
84
60
  required: false,
@@ -88,11 +64,19 @@ export default defineComponent({
88
64
  emits: ["update:modelValue"],
89
65
  setup(props, { emit }) {
90
66
  const { getMany: getManyDashboardOrganisations, fetching: fetchingDashboardOrganisations, entities: dashboardOrganisations } = useDashboardOrganisations();
67
+ const { $tr } = useTranslationsProvider();
91
68
 
92
69
  const loading = computed((): boolean => {
93
70
  return init.value && fetchingDashboardOrganisations.value;
94
71
  });
95
72
 
73
+ const placeholder = computed((): string | null => {
74
+ if (props.multiple && props.modelValue) {
75
+ return $tr("ui.autocomplete-dashboard-organisation.placeholder", "{0} dashboard(s) selected", props.modelValue.length);
76
+ }
77
+ return null;
78
+ });
79
+
96
80
  const fetch = (search: string | null) => {
97
81
  return getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined });
98
82
  };
@@ -106,6 +90,7 @@ export default defineComponent({
106
90
 
107
91
  return {
108
92
  dashboardOrganisations,
93
+ placeholder,
109
94
  toggleSet,
110
95
  loading,
111
96
  onUpdate
@@ -2,6 +2,7 @@
2
2
  <FSAutocompleteField
3
3
  :toggleSet="!$props.toggleSetDisabled && toggleSet"
4
4
  :multiple="$props.multiple"
5
+ :placeholder="placeholder"
5
6
  :items="dataCategories"
6
7
  :loading="loading"
7
8
  :modelValue="$props.modelValue"
@@ -9,49 +10,48 @@
9
10
  v-bind="$attrs"
10
11
  >
11
12
  <template
12
- #autocomplete-selection="{ item }"
13
+ #item-append="{ item }"
13
14
  >
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>
15
+ <FSChip
16
+ v-if="item.correlated"
17
+ prependIcon="mdi-link"
18
+ :label="$tr('ui.autocomplete-data-category.linked','Linked')"
19
+ :color="ColorEnum.Success"
20
+ />
21
+ <FSChip
22
+ v-else
23
+ prependIcon="mdi-link-off"
24
+ :label="$tr('ui.autocomplete-data-category.not-linked','Not linked')"
25
+ :color="ColorEnum.Warning"
26
+ />
43
27
  </template>
44
28
  <template
45
29
  #toggle-set-item="props"
46
30
  >
47
31
  <FSButton
48
- :prependIcon="props.item.correlated ? 'mdi-link' : 'mdi-link-off'"
49
32
  :variant="props.getVariant(props.item)"
50
33
  :color="props.getColor(props.item)"
51
34
  :class="props.getClass(props.item)"
52
35
  :label="props.item.label"
53
36
  @click="props.toggle(props.item)"
54
- />
37
+ >
38
+ <template
39
+ #append
40
+ >
41
+ <FSChip
42
+ v-if="props.item.correlated"
43
+ prependIcon="mdi-link"
44
+ :label="$tr('ui.autocomplete-data-category.linked','Linked')"
45
+ :color="ColorEnum.Success"
46
+ />
47
+ <FSChip
48
+ v-else
49
+ prependIcon="mdi-link-off"
50
+ :label="$tr('ui.autocomplete-data-category.not-linked','Not linked')"
51
+ :color="ColorEnum.Warning"
52
+ />
53
+ </template>
54
+ </FSButton>
55
55
  </template>
56
56
  </FSAutocompleteField>
57
57
  </template>
@@ -62,21 +62,19 @@ import { computed, defineComponent, type PropType } from "vue";
62
62
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
63
63
  import { type DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
64
64
  import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
65
+ import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
66
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
65
67
 
66
68
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
67
69
  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";
70
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
71
71
 
72
72
  export default defineComponent({
73
73
  name: "FSAutocompleteDataCategory",
74
74
  components: {
75
75
  FSAutocompleteField,
76
76
  FSButton,
77
- FSIcon,
78
- FSSpan,
79
- FSRow
77
+ FSChip
80
78
  },
81
79
  props: {
82
80
  dataCategoriesFilters: {
@@ -103,11 +101,19 @@ export default defineComponent({
103
101
  emits: ["update:modelValue"],
104
102
  setup(props, { emit }) {
105
103
  const { getMany: getManyDataCategories, fetching: fetchingDataCategories, entities: dataCategories } = useDataCategories();
104
+ const { $tr } = useTranslationsProvider();
106
105
 
107
106
  const loading = computed((): boolean => {
108
107
  return init.value && fetchingDataCategories.value;
109
108
  });
110
109
 
110
+ const placeholder = computed((): string | null => {
111
+ if (props.multiple && props.modelValue) {
112
+ return $tr("ui.autocomplete-data-category.placeholder", "{0} data category(ies) selected", props.modelValue.length);
113
+ }
114
+ return null;
115
+ });
116
+
111
117
  const fetch = (search: string | null) => {
112
118
  return getManyDataCategories({ ...props.dataCategoriesFilters, search: search ?? undefined });
113
119
  };
@@ -121,6 +127,8 @@ export default defineComponent({
121
127
 
122
128
  return {
123
129
  dataCategories,
130
+ placeholder,
131
+ ColorEnum,
124
132
  toggleSet,
125
133
  loading,
126
134
  onUpdate