@dative-gpi/foundation-core-components 0.0.101 → 0.0.103

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.
@@ -0,0 +1,90 @@
1
+ <template>
2
+ <FSGrid
3
+ :items="$props.items"
4
+ >
5
+ <template
6
+ v-for="(_, name) in $slots"
7
+ v-slot:[name]="slotData"
8
+ >
9
+ <slot
10
+ :name="name"
11
+ v-bind="slotData"
12
+ />
13
+ </template>
14
+
15
+ <template
16
+ v-for="(metaItem, index) in metaItems"
17
+ #[`item.${metaItem.value.code}`]
18
+ :key="index"
19
+ >
20
+ <FSMetaValue
21
+ v-if="!metaItem.value.hideDefault && metaItem.customProperty"
22
+ :customProperty="metaItem.customProperty"
23
+ :meta="meta"
24
+ />
25
+ </template>
26
+ <template
27
+ v-for="(metaItem, index) in metaItems"
28
+ #[`item-end.${metaItem.value.code}`]
29
+ :key="index"
30
+ >
31
+ <FSMetaValue
32
+ v-if="metaItem.value.hideDefault && metaItem.customProperty"
33
+ :customProperty="metaItem.customProperty"
34
+ :meta="meta"
35
+ />
36
+ </template>
37
+ </FSGrid>
38
+ </template>
39
+
40
+ <script lang="ts">
41
+ import { computed, defineComponent, PropType } from "vue";
42
+
43
+ import { FSGridItem } from "@dative-gpi/foundation-shared-components/models";
44
+
45
+ import { CustomPropertyInfos } from "../../../foundation-core-domain/models";
46
+
47
+ import FSGrid from "@dative-gpi/foundation-shared-components/components/FSGrid.vue";
48
+
49
+ import FSMetaValue from "./FSMetaValue.vue";
50
+
51
+ export default defineComponent({
52
+ name: "FSMetaGrid",
53
+ components: {
54
+ FSMetaValue,
55
+ FSGrid
56
+ },
57
+ props: {
58
+ items: {
59
+ type: Array as PropType<FSGridItem[]>,
60
+ default: () => [],
61
+ required: false
62
+ },
63
+ customProperties: {
64
+ type: Array as PropType<CustomPropertyInfos[]>,
65
+ default: () => [],
66
+ required: false
67
+ },
68
+ meta: {
69
+ type: Object as PropType<{ [key: string]: string }>,
70
+ required: true
71
+ }
72
+ },
73
+ setup(props) {
74
+ const metaItems = computed(() => {
75
+ return props.items.filter(i => i.code.startsWith("meta.")).map(metaItem => ({
76
+ value: metaItem,
77
+ customProperty: customProperty(metaItem.code)
78
+ }));
79
+ });
80
+
81
+ const customProperty = (code: string): CustomPropertyInfos | undefined => {
82
+ return props.customProperties.find(cp => `meta.${cp.code}` === code);
83
+ };
84
+
85
+ return {
86
+ metaItems
87
+ };
88
+ }
89
+ });
90
+ </script>
@@ -12,11 +12,16 @@
12
12
  {{ value }}
13
13
  </FSText>
14
14
  <FSIcon
15
- v-else-if="[PropertyDataType.Boolean, PropertyDataType.Icon].includes($props.customProperty.dataType)"
15
+ v-else-if="[PropertyDataType.Icon].includes($props.customProperty.dataType)"
16
16
  :color="getColor($props.customProperty, meta[$props.customProperty.code])"
17
17
  >
18
18
  {{ value }}
19
19
  </FSIcon>
20
+ <FSIconCheck
21
+ v-else-if="[PropertyDataType.Boolean].includes($props.customProperty.dataType)"
22
+ :color="getColor($props.customProperty, meta[$props.customProperty.code])"
23
+ :value="value.toLowerCase() === 'true'"
24
+ />
20
25
  </template>
21
26
 
22
27
  <script lang="ts">
@@ -27,9 +32,17 @@ import { useAppTimeZone } from "@dative-gpi/foundation-shared-services/composabl
27
32
  import { CustomPropertyInfos, PropertyDataType } from "../../../foundation-core-domain/models";
28
33
  import { getColor } from "./helpers";
29
34
 
35
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
36
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
37
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
30
38
 
31
39
  export default defineComponent({
32
40
  name: "FSMetaValue",
41
+ components: {
42
+ FSIconCheck,
43
+ FSText,
44
+ FSIcon
45
+ },
33
46
  props: {
34
47
  customProperty: {
35
48
  type: Object as PropType<CustomPropertyInfos>,
@@ -50,12 +63,6 @@ export default defineComponent({
50
63
  }
51
64
  }
52
65
  switch (props.customProperty.dataType) {
53
- case PropertyDataType.Boolean: {
54
- if (props.meta[props.customProperty.code]?.toLowerCase() === "true") {
55
- return "mdi-check-circle-outline";
56
- }
57
- return "mdi-close-circle-outline";
58
- }
59
66
  case PropertyDataType.DateTime: {
60
67
  return epochToLongTimeFormat(parseInt(props.meta[props.customProperty.code]));
61
68
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.101",
4
+ "version": "0.0.103",
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": "0.0.101",
14
- "@dative-gpi/foundation-core-services": "0.0.101",
15
- "@dative-gpi/foundation-shared-components": "0.0.101",
16
- "@dative-gpi/foundation-shared-domain": "0.0.101",
17
- "@dative-gpi/foundation-shared-services": "0.0.101",
13
+ "@dative-gpi/foundation-core-domain": "0.0.103",
14
+ "@dative-gpi/foundation-core-services": "0.0.103",
15
+ "@dative-gpi/foundation-shared-components": "0.0.103",
16
+ "@dative-gpi/foundation-shared-domain": "0.0.103",
17
+ "@dative-gpi/foundation-shared-services": "0.0.103",
18
18
  "color": "^4.2.3",
19
19
  "vue": "^3.4.23",
20
20
  "vuedraggable": "^4.1.0"
@@ -24,5 +24,5 @@
24
24
  "sass": "^1.69.5",
25
25
  "sass-loader": "^13.3.2"
26
26
  },
27
- "gitHead": "8ab763942b592e5d46dc629ca95e80cfb7729400"
27
+ "gitHead": "dd1b4c1e23a1826d70e02de27cb419205392fc5c"
28
28
  }