@hostlink/nuxt-light 1.8.6 → 1.8.8
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.
- package/dist/module.json +1 -1
- package/dist/runtime/components/L/Revision.vue +0 -1
- package/dist/runtime/components/l-drag-drop-container.vue +15 -0
- package/dist/runtime/components/l-drag-drop-group.vue +55 -0
- package/dist/runtime/components/l-drag-drop.vue +50 -0
- package/dist/runtime/components/l-tabs.vue +5 -1
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useSlots } from 'vue'
|
|
3
|
+
const slots = useSlots().default();
|
|
4
|
+
|
|
5
|
+
//fine component by name
|
|
6
|
+
|
|
7
|
+
const DragDropContainer = resolveComponent("l-drag-drop-container")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
//find all l-drag-drop-container (include children)
|
|
11
|
+
function getContainers(nodes) {
|
|
12
|
+
const containers = [];
|
|
13
|
+
for (const node of nodes) {
|
|
14
|
+
console.log(node)
|
|
15
|
+
|
|
16
|
+
//check node is l-drag-drop-container
|
|
17
|
+
|
|
18
|
+
if (node.type === DragDropContainer) {
|
|
19
|
+
containers.push(node);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if (node.children) {
|
|
25
|
+
if (node.children.default) {
|
|
26
|
+
containers.push(...getContainers(node.children.default()));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return containers;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const containers = getContainers(slots);
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
//get all containers children and join them
|
|
39
|
+
function getItems(containers) {
|
|
40
|
+
const items = [];
|
|
41
|
+
for (const container of containers) {
|
|
42
|
+
items.push(...container.children.default());
|
|
43
|
+
}
|
|
44
|
+
return items;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const items = getItems(containers);
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
</script>
|
|
51
|
+
<template>
|
|
52
|
+
<div>
|
|
53
|
+
<slot></slot>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { animations } from "@formkit/drag-and-drop";
|
|
3
|
+
import { useSlots, watch } from 'vue'
|
|
4
|
+
import { useDragAndDrop } from '@formkit/drag-and-drop/vue'
|
|
5
|
+
const slots = useSlots();
|
|
6
|
+
|
|
7
|
+
const model = defineModel()
|
|
8
|
+
|
|
9
|
+
const props = defineProps<{
|
|
10
|
+
group?: string
|
|
11
|
+
dragHandle?: string
|
|
12
|
+
}>()
|
|
13
|
+
|
|
14
|
+
const [parent, items] = useDragAndDrop(slots.default(), {
|
|
15
|
+
plugins: [animations()],
|
|
16
|
+
group: props.group,
|
|
17
|
+
dragHandle: props.dragHandle
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
if (model.value === null) { //default
|
|
21
|
+
model.value = items.value.map((item) => {
|
|
22
|
+
return item.props.name;
|
|
23
|
+
})
|
|
24
|
+
} else {
|
|
25
|
+
items.value = model.value.map((name) => {
|
|
26
|
+
return items.value.find((item) => item.props.name === name);
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
watch(items, () => {
|
|
32
|
+
model.value = items.value.map((item) => {
|
|
33
|
+
return item.props.name ?? Symbol();
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
<template>
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
<div ref="parent">
|
|
44
|
+
<template v-for="item in items" :key="item">
|
|
45
|
+
<component :is="item" />
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
</template>
|
|
@@ -12,9 +12,13 @@ defineProps<LTabsProps>()
|
|
|
12
12
|
const slots = useSlots();
|
|
13
13
|
const defaultSlots = slots.default ? slots.default() : []
|
|
14
14
|
|
|
15
|
+
|
|
16
|
+
const LTab = resolveComponent("l-tab")
|
|
15
17
|
//get the tabs from the default slot
|
|
16
18
|
let name = 0;
|
|
17
|
-
const tabContents = defaultSlots.
|
|
19
|
+
const tabContents = defaultSlots.filter((slot) => {
|
|
20
|
+
return slot.type === LTab
|
|
21
|
+
}).map((slot) => {
|
|
18
22
|
const n = slot.props?.name || name++;
|
|
19
23
|
return {
|
|
20
24
|
label: slot.props?.label,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hostlink/nuxt-light",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.8",
|
|
4
4
|
"description": "HostLink Nuxt Light Framework",
|
|
5
5
|
"repository": "@hostlink/nuxt-light",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"route-gen": "node route-generate.mjs"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@formkit/drag-and-drop": "^0.0.
|
|
37
|
+
"@formkit/drag-and-drop": "^0.0.36",
|
|
38
38
|
"@hostlink/light": "^1.2.1",
|
|
39
39
|
"@nuxt/kit": "^3.7.4",
|
|
40
40
|
"@nuxt/module-builder": "^0.5.2",
|