@dative-gpi/foundation-core-components 1.0.30 → 1.0.31

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.
@@ -14,16 +14,31 @@
14
14
  <FSRow
15
15
  v-if="$props.modelValue"
16
16
  align="center-center"
17
+ padding="0 8px 0 0"
18
+ gap="4px"
17
19
  :wrap="false"
18
20
  >
19
- <FSIcon>
20
- {{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
21
- </FSIcon>
22
21
  <FSSpan>
23
22
  {{ item.raw.label }}
24
23
  </FSSpan>
24
+ <FSIcon
25
+ v-if="$props.multiple"
26
+ :color="item.raw.correlated ? ColorEnum.Success : ColorEnum.Warning"
27
+ >
28
+ {{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
29
+ </FSIcon>
25
30
  </FSRow>
26
31
  </template>
32
+ <template
33
+ v-if="selected"
34
+ #autocomplete-suffix
35
+ >
36
+ <FSChip
37
+ :label="selected.correlated ? $tr('ui.common.linked','Linked') : $tr('ui.common.not-linked','Not linked')"
38
+ :color="selected.correlated ? ColorEnum.Success : ColorEnum.Warning"
39
+ :prependIcon="selected.correlated ? 'mdi-link' : 'mdi-link-off'"
40
+ />
41
+ </template>
27
42
  <template
28
43
  #item-label="{ item, font }"
29
44
  >
@@ -31,20 +46,23 @@
31
46
  align="center-left"
32
47
  :wrap="false"
33
48
  >
34
- <FSIcon>
35
- {{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
36
- </FSIcon>
37
49
  <FSSpan
38
50
  :font="font"
39
51
  >
40
52
  {{ item.raw.label }}
41
53
  </FSSpan>
54
+ <FSIcon
55
+ :color="item.raw.correlated ? ColorEnum.Success : ColorEnum.Warning"
56
+ >
57
+ {{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
58
+ </FSIcon>
42
59
  </FSRow>
43
60
  </template>
44
61
  <template
45
62
  #toggle-set-item="props"
46
63
  >
47
64
  <FSButton
65
+ :iconColor="props.item.correlated ? ColorEnum.Success : ColorEnum.Warning"
48
66
  :prependIcon="props.item.correlated ? 'mdi-link' : 'mdi-link-off'"
49
67
  :variant="props.getVariant(props.item)"
50
68
  :color="props.getColor(props.item)"
@@ -59,14 +77,16 @@
59
77
  <script lang="ts">
60
78
  import { computed, defineComponent, type PropType } from "vue";
61
79
 
80
+ import { type DataCategoryInfos, type DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
62
81
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
63
- import { type DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
64
82
  import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
83
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
65
84
 
66
85
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
67
86
  import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
68
87
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
69
88
  import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
89
+ import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
70
90
  import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
71
91
 
72
92
  export default defineComponent({
@@ -76,6 +96,7 @@ export default defineComponent({
76
96
  FSButton,
77
97
  FSIcon,
78
98
  FSSpan,
99
+ FSChip,
79
100
  FSRow
80
101
  },
81
102
  props: {
@@ -108,6 +129,13 @@ export default defineComponent({
108
129
  return init.value && fetchingDataCategories.value;
109
130
  });
110
131
 
132
+ const selected = computed((): DataCategoryInfos | undefined => {
133
+ if (props.multiple) {
134
+ return undefined;
135
+ }
136
+ return dataCategories.value.find((dataCategory: DataCategoryInfos) => dataCategory.id === props.modelValue);
137
+ });
138
+
111
139
  const fetch = (search: string | null) => {
112
140
  return getManyDataCategories({ ...props.dataCategoriesFilters, search: search ?? undefined });
113
141
  };
@@ -121,7 +149,9 @@ export default defineComponent({
121
149
 
122
150
  return {
123
151
  dataCategories,
152
+ ColorEnum,
124
153
  toggleSet,
154
+ selected,
125
155
  loading,
126
156
  onUpdate
127
157
  };
@@ -14,16 +14,26 @@
14
14
  <FSRow
15
15
  v-if="$props.modelValue"
16
16
  align="center-center"
17
+ padding="0 8px 0 0"
18
+ gap="4px"
17
19
  :wrap="false"
18
20
  >
19
- <FSChip
20
- v-if="item.raw.unit"
21
- :label="item.raw.unit"
22
- />
23
21
  <FSSpan>
24
22
  {{ item.raw.label }}
25
23
  </FSSpan>
26
- </FSRow>
24
+ <FSChip
25
+ v-if="$props.multiple && item.raw.unit"
26
+ :label="item.raw.unit"
27
+ />
28
+ </FSRow>
29
+ </template>
30
+ <template
31
+ v-if="selected && selected.unit"
32
+ #autocomplete-suffix
33
+ >
34
+ <FSChip
35
+ :label="selected.unit"
36
+ />
27
37
  </template>
28
38
  <template
29
39
  #item-label="{ item, font }"
@@ -32,15 +42,15 @@
32
42
  align="center-left"
33
43
  :wrap="false"
34
44
  >
35
- <FSChip
36
- v-if="item.raw.unit"
37
- :label="item.raw.unit"
38
- />
39
45
  <FSSpan
40
46
  :font="font"
41
47
  >
42
48
  {{ item.raw.label }}
43
49
  </FSSpan>
50
+ <FSChip
51
+ v-if="item.raw.unit"
52
+ :label="item.raw.unit"
53
+ />
44
54
  </FSRow>
45
55
  </template>
46
56
  <template
@@ -55,7 +65,7 @@
55
65
  >
56
66
  <template
57
67
  v-if="props.item.unit"
58
- #prepend
68
+ #append
59
69
  >
60
70
  <FSChip
61
71
  :label="props.item.unit"
@@ -69,7 +79,7 @@
69
79
  <script lang="ts">
70
80
  import { computed, defineComponent, type PropType } from "vue";
71
81
 
72
- import { type DataDefinitionFilters } from "@dative-gpi/foundation-core-domain/models";
82
+ import { type DataDefinitionInfos, type DataDefinitionFilters } from "@dative-gpi/foundation-core-domain/models";
73
83
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
74
84
  import { useDataDefinitions } from "@dative-gpi/foundation-core-services/composables";
75
85
 
@@ -118,6 +128,13 @@ export default defineComponent({
118
128
  return init.value && fetchingDataDefinitions.value;
119
129
  });
120
130
 
131
+ const selected = computed((): DataDefinitionInfos | undefined => {
132
+ if (props.multiple) {
133
+ return undefined;
134
+ }
135
+ return dataDefinitions.value.find((dataDefinition: DataDefinitionInfos) => dataDefinition.id === props.modelValue);
136
+ });
137
+
121
138
  const fetch = (search: string | null) => {
122
139
  return getManyDataDefinitions({ ...props.dataDefinitionFilters, search: search ?? undefined });
123
140
  };
@@ -132,6 +149,7 @@ export default defineComponent({
132
149
  return {
133
150
  dataDefinitions,
134
151
  toggleSet,
152
+ selected,
135
153
  loading,
136
154
  onUpdate
137
155
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.30",
4
+ "version": "1.0.31",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,11 +10,11 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-core-domain": "1.0.30",
14
- "@dative-gpi/foundation-core-services": "1.0.30",
15
- "@dative-gpi/foundation-shared-components": "1.0.30",
16
- "@dative-gpi/foundation-shared-domain": "1.0.30",
17
- "@dative-gpi/foundation-shared-services": "1.0.30"
13
+ "@dative-gpi/foundation-core-domain": "1.0.31",
14
+ "@dative-gpi/foundation-core-services": "1.0.31",
15
+ "@dative-gpi/foundation-shared-components": "1.0.31",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.31",
17
+ "@dative-gpi/foundation-shared-services": "1.0.31"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -26,5 +26,5 @@
26
26
  "sass": "1.71.1",
27
27
  "sass-loader": "13.3.2"
28
28
  },
29
- "gitHead": "33f1a6d59ab513176b3710729a39ec701462fdfb"
29
+ "gitHead": "ea23a4b514a19e238373a52d9dd99b24c17adf1c"
30
30
  }