@dative-gpi/foundation-shared-components 0.0.228 → 0.0.230

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.
@@ -10,24 +10,15 @@
10
10
  @update:modelValue="$emit('update:tab', $event)"
11
11
  v-bind="$attrs"
12
12
  >
13
- <template
14
- v-for="(component, index) in getChildren()"
15
- :key="index"
16
- >
17
- <component
18
- :is="component"
19
- />
20
- </template>
13
+ <slot/>
21
14
  </v-tabs>
22
15
  </template>
23
16
 
24
17
  <script lang="ts">
25
- import type { PropType } from "vue";
26
- import { computed, defineComponent } from "vue";
18
+ import { computed, defineComponent, type PropType } from "vue";
27
19
 
28
- import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
29
- import type { ColorBase} from "@dative-gpi/foundation-shared-components/models";
30
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
20
+ import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
21
+ import { useColors } from "@dative-gpi/foundation-shared-components/composables";
31
22
 
32
23
  export default defineComponent({
33
24
  name: "FSTabs",
@@ -44,7 +35,6 @@ export default defineComponent({
44
35
  }
45
36
  },
46
37
  setup(props) {
47
- const { getChildren } = useSlots();
48
38
  const { getColors } = useColors();
49
39
 
50
40
  const colors = computed(() => getColors(props.color));
@@ -62,8 +52,7 @@ export default defineComponent({
62
52
  }));
63
53
 
64
54
  return {
65
- style,
66
- getChildren
55
+ style
67
56
  };
68
57
  }
69
58
  });
@@ -27,8 +27,7 @@
27
27
  </template>
28
28
 
29
29
  <script lang="ts">
30
- import type { PropType, VNode } from "vue";
31
- import { computed, defineComponent } from "vue";
30
+ import { computed, defineComponent, type PropType, type VNode } from "vue";
32
31
 
33
32
  import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
34
33
  import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
@@ -60,7 +59,7 @@ export default defineComponent({
60
59
  style,
61
60
  getChildren,
62
61
  value
63
- }
62
+ };
64
63
  }
65
64
  });
66
65
  </script>
@@ -1,32 +1,51 @@
1
- import type { Slot} from "vue";
2
- import { useSlots as useVueSlots } from "vue"
1
+ import { type Slot, useSlots as useVueSlots } from "vue"
3
2
 
4
3
  export const useSlots = () => {
5
- const getChildren = (name: string | undefined = undefined): any => {
6
- const innerSlots = { ...useVueSlots() };
7
- const innerName = name ?? "default";
8
- if (innerSlots[innerName] != null) {
9
- const slot = innerSlots[innerName]!;
10
- switch (typeof(slot()[0].type)) {
11
- // Directive wrapper (v-for, v-if)
12
- case "symbol":
13
- switch (slot()[0].type) {
14
- case Symbol.for("v-fgt"): return slot()[0].children;
15
- case Symbol.for("v-cmt"): return slot();
16
- default: return slot();
17
- }
18
- // Custom component
19
- case "object": return slot();
20
- // Pre-existing component
21
- case "string": return slot();
22
- }
23
- return slot();
4
+ const getChildren = (name: string | undefined = undefined): any => {
5
+ const innerSlots = { ...useVueSlots() };
6
+ const innerName = name ?? "default";
7
+ if (innerSlots[innerName] != null) {
8
+ const slot = innerSlots[innerName]!;
9
+ switch (typeof(slot()[0].type)) {
10
+ // Directive wrapper (v-for, v-if)
11
+ case "symbol":
12
+ switch (slot()[0].type) {
13
+ case Symbol.for("v-fgt"): return recursiveGetChildren(slot()[0].children);
14
+ case Symbol.for("v-cmt"): return slot();
15
+ default: return slot();
16
+ }
17
+ // Custom component
18
+ case "object": return slot();
19
+ // Pre-existing component
20
+ case "string": return slot();
21
+ }
22
+ return slot();
23
+ }
24
+ return null;
25
+ };
26
+
27
+ const recursiveGetChildren = (element: any): any => {
28
+ if (element == null) {
29
+ return null;
30
+ }
31
+ switch (typeof(element[0].type)) {
32
+ // Directive wrapper (v-for, v-if)
33
+ case "symbol":
34
+ switch (element[0].type) {
35
+ case Symbol.for("v-fgt"): return recursiveGetChildren(element[0].children);
36
+ case Symbol.for("v-cmt"): return element;
37
+ default: return element;
24
38
  }
25
- return null;
26
- };
39
+ // Custom component
40
+ case "object": return element;
41
+ // Pre-existing component
42
+ case "string": return element;
43
+ }
44
+ return element;
45
+ };
27
46
 
28
- return {
29
- slots: { ...useVueSlots() } as { [label: string]: Slot<any> },
30
- getChildren
31
- };
47
+ return {
48
+ slots: { ...useVueSlots() } as { [label: string]: Slot<any> },
49
+ getChildren
50
+ };
32
51
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.228",
4
+ "version": "0.0.230",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "0.0.228",
14
- "@dative-gpi/foundation-shared-services": "0.0.228"
13
+ "@dative-gpi/foundation-shared-domain": "0.0.230",
14
+ "@dative-gpi/foundation-shared-services": "0.0.230"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "ca012ee265fbeeddb5ce423de66b84a324143b8f"
38
+ "gitHead": "93365f65d39d6c9cc3821ffb48cba187200deaf9"
39
39
  }