@sfxcode/nuxt-ui-formkit 1.0.3 → 1.0.6
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/FUDataEdit.d.vue.ts +4 -12
- package/dist/runtime/components/FUDataEdit.vue +11 -3
- package/dist/runtime/components/FUDataEdit.vue.d.ts +4 -12
- package/dist/runtime/components/FUDataView.d.vue.ts +4 -8
- package/dist/runtime/components/FUDataView.vue +11 -1
- package/dist/runtime/components/FUDataView.vue.d.ts +4 -8
- package/dist/runtime/formkit/definitions/repeater.js +34 -29
- package/dist/runtime/formkit/definitions/repeater.mjs +34 -29
- package/package.json +26 -16
package/dist/module.json
CHANGED
|
@@ -73,13 +73,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
73
73
|
type: BooleanConstructor;
|
|
74
74
|
default: boolean;
|
|
75
75
|
};
|
|
76
|
-
modelValue:
|
|
77
|
-
type: PropType<object>;
|
|
78
|
-
};
|
|
76
|
+
modelValue: FormKitSchemaDefinition;
|
|
79
77
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
80
|
-
|
|
81
|
-
dataSaved: (...args: any[]) => void;
|
|
82
|
-
"update:modelValue": (value: object | undefined) => void;
|
|
78
|
+
"update:modelValue": (value: any) => any;
|
|
83
79
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
80
|
id: {
|
|
85
81
|
type: StringConstructor;
|
|
@@ -145,13 +141,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
145
141
|
type: BooleanConstructor;
|
|
146
142
|
default: boolean;
|
|
147
143
|
};
|
|
148
|
-
modelValue:
|
|
149
|
-
type: PropType<object>;
|
|
150
|
-
};
|
|
144
|
+
modelValue: FormKitSchemaDefinition;
|
|
151
145
|
}>> & Readonly<{
|
|
152
|
-
|
|
153
|
-
onDataSaved?: ((...args: any[]) => any) | undefined;
|
|
154
|
-
"onUpdate:modelValue"?: ((value: object | undefined) => any) | undefined;
|
|
146
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
155
147
|
}>, {
|
|
156
148
|
data: Record<string, any>;
|
|
157
149
|
id: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { reset } from "@formkit/core";
|
|
3
3
|
import { FormKit, FormKitMessages, FormKitSchema } from "@formkit/vue";
|
|
4
|
-
import { ref } from "vue";
|
|
4
|
+
import { ref, watch } from "vue";
|
|
5
5
|
import FUDataDebug from "./FUDataDebug.vue";
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
id: {
|
|
@@ -70,11 +70,19 @@ const props = defineProps({
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
const emit = defineEmits(["dataSaved", "onReset"]);
|
|
73
|
-
const
|
|
73
|
+
const formSchema = ref(props.schema);
|
|
74
|
+
const formData = defineModel({ type: null });
|
|
75
|
+
watch(() => props.schema, (newSchema) => {
|
|
76
|
+
formSchema.value = newSchema;
|
|
77
|
+
}, { deep: true });
|
|
78
|
+
watch(() => props.data, (newData) => {
|
|
79
|
+
if (newData && newData !== formData.value) {
|
|
80
|
+
formData.value = newData;
|
|
81
|
+
}
|
|
82
|
+
}, { deep: true });
|
|
74
83
|
if (props.data) {
|
|
75
84
|
formData.value = props.data;
|
|
76
85
|
}
|
|
77
|
-
const formSchema = ref(props.schema);
|
|
78
86
|
function handleSave() {
|
|
79
87
|
emit("dataSaved", formData.value);
|
|
80
88
|
}
|
|
@@ -73,13 +73,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
73
73
|
type: BooleanConstructor;
|
|
74
74
|
default: boolean;
|
|
75
75
|
};
|
|
76
|
-
modelValue:
|
|
77
|
-
type: PropType<object>;
|
|
78
|
-
};
|
|
76
|
+
modelValue: FormKitSchemaDefinition;
|
|
79
77
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
80
|
-
|
|
81
|
-
dataSaved: (...args: any[]) => void;
|
|
82
|
-
"update:modelValue": (value: object | undefined) => void;
|
|
78
|
+
"update:modelValue": (value: any) => any;
|
|
83
79
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
84
80
|
id: {
|
|
85
81
|
type: StringConstructor;
|
|
@@ -145,13 +141,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
145
141
|
type: BooleanConstructor;
|
|
146
142
|
default: boolean;
|
|
147
143
|
};
|
|
148
|
-
modelValue:
|
|
149
|
-
type: PropType<object>;
|
|
150
|
-
};
|
|
144
|
+
modelValue: FormKitSchemaDefinition;
|
|
151
145
|
}>> & Readonly<{
|
|
152
|
-
|
|
153
|
-
onDataSaved?: ((...args: any[]) => any) | undefined;
|
|
154
|
-
"onUpdate:modelValue"?: ((value: object | undefined) => any) | undefined;
|
|
146
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
155
147
|
}>, {
|
|
156
148
|
data: Record<string, any>;
|
|
157
149
|
id: string;
|
|
@@ -25,11 +25,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
25
25
|
type: BooleanConstructor;
|
|
26
26
|
default: boolean;
|
|
27
27
|
};
|
|
28
|
-
modelValue:
|
|
29
|
-
type: PropType<Record<string, unknown>>;
|
|
30
|
-
};
|
|
28
|
+
modelValue: FormKitSchemaDefinition;
|
|
31
29
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
|
-
"update:modelValue": (value:
|
|
30
|
+
"update:modelValue": (value: any) => any;
|
|
33
31
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
32
|
data: {
|
|
35
33
|
type: ObjectConstructor;
|
|
@@ -51,11 +49,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
51
49
|
type: BooleanConstructor;
|
|
52
50
|
default: boolean;
|
|
53
51
|
};
|
|
54
|
-
modelValue:
|
|
55
|
-
type: PropType<Record<string, unknown>>;
|
|
56
|
-
};
|
|
52
|
+
modelValue: FormKitSchemaDefinition;
|
|
57
53
|
}>> & Readonly<{
|
|
58
|
-
"onUpdate:modelValue"?: ((value:
|
|
54
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
59
55
|
}>, {
|
|
60
56
|
data: Record<string, any>;
|
|
61
57
|
schema: FormKitSchemaDefinition;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { FormKitSchema } from "@formkit/vue";
|
|
3
3
|
import FuDataDebug from "./FUDataDebug.vue";
|
|
4
|
+
import { ref, watch } from "vue";
|
|
4
5
|
const props = defineProps({
|
|
5
6
|
data: {
|
|
6
7
|
type: Object,
|
|
@@ -23,7 +24,16 @@ const props = defineProps({
|
|
|
23
24
|
default: false
|
|
24
25
|
}
|
|
25
26
|
});
|
|
26
|
-
const
|
|
27
|
+
const formSchema = ref(props.schema);
|
|
28
|
+
const formData = defineModel({ type: null });
|
|
29
|
+
watch(() => props.schema, (newSchema) => {
|
|
30
|
+
formSchema.value = newSchema;
|
|
31
|
+
}, { deep: true });
|
|
32
|
+
watch(() => props.data, (newData) => {
|
|
33
|
+
if (newData && newData !== formData.value) {
|
|
34
|
+
formData.value = newData;
|
|
35
|
+
}
|
|
36
|
+
}, { deep: true });
|
|
27
37
|
if (props.data) {
|
|
28
38
|
formData.value = props.data;
|
|
29
39
|
}
|
|
@@ -25,11 +25,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
25
25
|
type: BooleanConstructor;
|
|
26
26
|
default: boolean;
|
|
27
27
|
};
|
|
28
|
-
modelValue:
|
|
29
|
-
type: PropType<Record<string, unknown>>;
|
|
30
|
-
};
|
|
28
|
+
modelValue: FormKitSchemaDefinition;
|
|
31
29
|
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
|
-
"update:modelValue": (value:
|
|
30
|
+
"update:modelValue": (value: any) => any;
|
|
33
31
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
34
32
|
data: {
|
|
35
33
|
type: ObjectConstructor;
|
|
@@ -51,11 +49,9 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
51
49
|
type: BooleanConstructor;
|
|
52
50
|
default: boolean;
|
|
53
51
|
};
|
|
54
|
-
modelValue:
|
|
55
|
-
type: PropType<Record<string, unknown>>;
|
|
56
|
-
};
|
|
52
|
+
modelValue: FormKitSchemaDefinition;
|
|
57
53
|
}>> & Readonly<{
|
|
58
|
-
"onUpdate:modelValue"?: ((value:
|
|
54
|
+
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
59
55
|
}>, {
|
|
60
56
|
data: Record<string, any>;
|
|
61
57
|
schema: FormKitSchemaDefinition;
|
|
@@ -2,20 +2,20 @@ import { createInput } from "@formkit/vue";
|
|
|
2
2
|
import { useFormKitSchema } from "../../composables/useFormKitSchema.js";
|
|
3
3
|
const { addList, addElement, addListGroup, addComponent } = useFormKitSchema();
|
|
4
4
|
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
5
|
-
const addActionButtonComponent = (onClick = "", icon = "", color = "", render2 = "true", disabled) => {
|
|
5
|
+
const addActionButtonComponent = (onClick = "", icon = "", color = "", render2 = "true", disabled = "false") => {
|
|
6
6
|
return addElement("div", [addComponent("UButton", { onClick, icon, color, disabled, size: buttonSize })], { class: buttonGroupItemClass }, render2);
|
|
7
7
|
};
|
|
8
8
|
return addElement("div", [
|
|
9
9
|
addActionButtonComponent("$moveNodeUp($node.parent, $index)", "i-lucide-arrow-up", "primary", "$renderMoveButtons", "$index === 0"),
|
|
10
|
-
addActionButtonComponent("$removeNode($node.parent, $index)", "i-lucide-trash", "error", "$displayDeleteButton"),
|
|
11
|
-
addActionButtonComponent("$cloneNode($node.parent, $index)", "i-lucide-copy", "secondary", "$displayCloneButton"),
|
|
12
|
-
addActionButtonComponent("$addNode($node.parent, $index)", "i-lucide-plus", "secondary", "$displayAddButton"),
|
|
10
|
+
addActionButtonComponent("$removeNode($node.parent, $index)", "i-lucide-trash", "error", "$displayDeleteButton", "$node.parent.value.length === $minItems"),
|
|
11
|
+
addActionButtonComponent("$cloneNode($node.parent, $index)", "i-lucide-copy", "secondary", "$displayCloneButton", "$node.parent.value.length > $maxItems -1"),
|
|
12
|
+
addActionButtonComponent("$addNode($node.parent, $index)", "i-lucide-plus", "secondary", "$displayAddButton", "$node.parent.value.length > $maxItems -1"),
|
|
13
13
|
addActionButtonComponent("$moveNodeDown($node.parent, $index)", "i-lucide-arrow-down", "primary", "$renderMoveButtons", "$index === $node.parent.value.length -1")
|
|
14
14
|
], { class: buttonGroupClass }, render);
|
|
15
15
|
}
|
|
16
16
|
function addInsertButton(label = "Add Item", icon = "i-lucide-plus", styleClass = "", buttonSize, render = "true") {
|
|
17
17
|
return addElement("div", [
|
|
18
|
-
addComponent("UButton", { onClick: "$insertNode($node)", label, icon, size: buttonSize })
|
|
18
|
+
addComponent("UButton", { onClick: "$insertNode($node)", label, icon, size: buttonSize, disabled: "$node.value.length > $maxItems -1" })
|
|
19
19
|
], { class: styleClass }, render);
|
|
20
20
|
}
|
|
21
21
|
export const nuxtUIRepeaterDefinition = createInput(
|
|
@@ -47,18 +47,20 @@ export const nuxtUIRepeaterDefinition = createInput(
|
|
|
47
47
|
"buttonSize",
|
|
48
48
|
"displayCloneButton",
|
|
49
49
|
"displayAddButton",
|
|
50
|
-
"displayDeleteButton"
|
|
50
|
+
"displayDeleteButton",
|
|
51
|
+
"minItems",
|
|
52
|
+
"maxItems"
|
|
51
53
|
],
|
|
52
54
|
features: [addRepeaterHandler]
|
|
53
55
|
}
|
|
54
56
|
);
|
|
55
57
|
function addRepeaterHandler(node) {
|
|
56
58
|
const swapElements = (array, index1, index2) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
59
|
+
const [element] = array.splice(index1, 1);
|
|
60
|
+
if (element !== void 0) {
|
|
61
|
+
array.splice(index2, 0, element);
|
|
62
|
+
}
|
|
63
|
+
return array;
|
|
62
64
|
};
|
|
63
65
|
node.on("created", () => {
|
|
64
66
|
node.context.listName = node.name;
|
|
@@ -68,44 +70,47 @@ function addRepeaterHandler(node) {
|
|
|
68
70
|
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
69
71
|
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
70
72
|
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
73
|
+
node.context.minItems = node.context.minItems !== void 0 ? node.context.minItems : 0;
|
|
74
|
+
node.context.maxItems = node.context.maxItems !== void 0 ? node.context.maxItems : Number.POSITIVE_INFINITY;
|
|
71
75
|
node.context.insertNode = (parentNode) => () => {
|
|
72
|
-
if (parentNode && parentNode._value
|
|
76
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
73
77
|
const item = node.context.newItem ? { ...node.context.newItem } : {};
|
|
74
|
-
const
|
|
75
|
-
|
|
78
|
+
const array = parentNode.value;
|
|
79
|
+
array.push(item);
|
|
80
|
+
parentNode.input(array, false);
|
|
76
81
|
}
|
|
77
82
|
};
|
|
78
83
|
node.context.removeNode = (parentNode, index) => () => {
|
|
79
|
-
if (parentNode && parentNode._value
|
|
84
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
80
85
|
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
81
86
|
}
|
|
82
87
|
};
|
|
83
88
|
node.context.addNode = (parentNode, index) => () => {
|
|
84
|
-
if (parentNode && parentNode._value
|
|
89
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
90
|
+
const array = parentNode.value;
|
|
85
91
|
const item = node.context.newItem ? { ...node.context.newItem } : {};
|
|
86
|
-
|
|
87
|
-
parentNode.input(
|
|
92
|
+
array.splice(index + 1, 0, item);
|
|
93
|
+
parentNode.input(array, false);
|
|
88
94
|
}
|
|
89
95
|
};
|
|
90
96
|
node.context.cloneNode = (parentNode, index) => () => {
|
|
91
|
-
if (parentNode && parentNode._value
|
|
92
|
-
const item = parentNode.
|
|
93
|
-
const
|
|
94
|
-
|
|
97
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
98
|
+
const item = parentNode.value[index];
|
|
99
|
+
const array = parentNode.value;
|
|
100
|
+
array.splice(index + 1, 0, item);
|
|
101
|
+
parentNode.input(array, false);
|
|
95
102
|
}
|
|
96
103
|
};
|
|
97
104
|
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
98
|
-
if (parentNode && parentNode._value
|
|
99
|
-
const array = [...parentNode._value];
|
|
105
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
100
106
|
if (index > 0)
|
|
101
|
-
parentNode.input(swapElements(
|
|
107
|
+
parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
105
|
-
if (parentNode && parentNode._value
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
parentNode.input(swapElements(array, index, index + 1), false);
|
|
111
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
112
|
+
if (index < parentNode.value.length - 1)
|
|
113
|
+
parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
109
114
|
}
|
|
110
115
|
};
|
|
111
116
|
});
|
|
@@ -2,20 +2,20 @@ import { createInput } from "@formkit/vue";
|
|
|
2
2
|
import { useFormKitSchema } from "../../composables/useFormKitSchema";
|
|
3
3
|
const { addList, addElement, addListGroup, addComponent } = useFormKitSchema();
|
|
4
4
|
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
5
|
-
const addActionButtonComponent = (onClick = "", icon = "", color = "", render2 = "true", disabled) => {
|
|
5
|
+
const addActionButtonComponent = (onClick = "", icon = "", color = "", render2 = "true", disabled = "false") => {
|
|
6
6
|
return addElement("div", [addComponent("UButton", { onClick, icon, color, disabled, size: buttonSize })], { class: buttonGroupItemClass }, render2);
|
|
7
7
|
};
|
|
8
8
|
return addElement("div", [
|
|
9
9
|
addActionButtonComponent("$moveNodeUp($node.parent, $index)", "i-lucide-arrow-up", "primary", "$renderMoveButtons", "$index === 0"),
|
|
10
|
-
addActionButtonComponent("$removeNode($node.parent, $index)", "i-lucide-trash", "error", "$displayDeleteButton"),
|
|
11
|
-
addActionButtonComponent("$cloneNode($node.parent, $index)", "i-lucide-copy", "secondary", "$displayCloneButton"),
|
|
12
|
-
addActionButtonComponent("$addNode($node.parent, $index)", "i-lucide-plus", "secondary", "$displayAddButton"),
|
|
10
|
+
addActionButtonComponent("$removeNode($node.parent, $index)", "i-lucide-trash", "error", "$displayDeleteButton", "$node.parent.value.length === $minItems"),
|
|
11
|
+
addActionButtonComponent("$cloneNode($node.parent, $index)", "i-lucide-copy", "secondary", "$displayCloneButton", "$node.parent.value.length > $maxItems -1"),
|
|
12
|
+
addActionButtonComponent("$addNode($node.parent, $index)", "i-lucide-plus", "secondary", "$displayAddButton", "$node.parent.value.length > $maxItems -1"),
|
|
13
13
|
addActionButtonComponent("$moveNodeDown($node.parent, $index)", "i-lucide-arrow-down", "primary", "$renderMoveButtons", "$index === $node.parent.value.length -1")
|
|
14
14
|
], { class: buttonGroupClass }, render);
|
|
15
15
|
}
|
|
16
16
|
function addInsertButton(label = "Add Item", icon = "i-lucide-plus", styleClass = "", buttonSize, render = "true") {
|
|
17
17
|
return addElement("div", [
|
|
18
|
-
addComponent("UButton", { onClick: "$insertNode($node)", label, icon, size: buttonSize })
|
|
18
|
+
addComponent("UButton", { onClick: "$insertNode($node)", label, icon, size: buttonSize, disabled: "$node.value.length > $maxItems -1" })
|
|
19
19
|
], { class: styleClass }, render);
|
|
20
20
|
}
|
|
21
21
|
export const nuxtUIRepeaterDefinition = createInput(
|
|
@@ -47,18 +47,20 @@ export const nuxtUIRepeaterDefinition = createInput(
|
|
|
47
47
|
"buttonSize",
|
|
48
48
|
"displayCloneButton",
|
|
49
49
|
"displayAddButton",
|
|
50
|
-
"displayDeleteButton"
|
|
50
|
+
"displayDeleteButton",
|
|
51
|
+
"minItems",
|
|
52
|
+
"maxItems"
|
|
51
53
|
],
|
|
52
54
|
features: [addRepeaterHandler]
|
|
53
55
|
}
|
|
54
56
|
);
|
|
55
57
|
function addRepeaterHandler(node) {
|
|
56
58
|
const swapElements = (array, index1, index2) => {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return
|
|
59
|
+
const [element] = array.splice(index1, 1);
|
|
60
|
+
if (element !== void 0) {
|
|
61
|
+
array.splice(index2, 0, element);
|
|
62
|
+
}
|
|
63
|
+
return array;
|
|
62
64
|
};
|
|
63
65
|
node.on("created", () => {
|
|
64
66
|
node.context.listName = node.name;
|
|
@@ -68,44 +70,47 @@ function addRepeaterHandler(node) {
|
|
|
68
70
|
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
69
71
|
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
70
72
|
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
73
|
+
node.context.minItems = node.context.minItems !== void 0 ? node.context.minItems : 0;
|
|
74
|
+
node.context.maxItems = node.context.maxItems !== void 0 ? node.context.maxItems : Number.POSITIVE_INFINITY;
|
|
71
75
|
node.context.insertNode = (parentNode) => () => {
|
|
72
|
-
if (parentNode && parentNode._value
|
|
76
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
73
77
|
const item = node.context.newItem ? { ...node.context.newItem } : {};
|
|
74
|
-
const
|
|
75
|
-
|
|
78
|
+
const array = parentNode.value;
|
|
79
|
+
array.push(item);
|
|
80
|
+
parentNode.input(array, false);
|
|
76
81
|
}
|
|
77
82
|
};
|
|
78
83
|
node.context.removeNode = (parentNode, index) => () => {
|
|
79
|
-
if (parentNode && parentNode._value
|
|
84
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
80
85
|
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
81
86
|
}
|
|
82
87
|
};
|
|
83
88
|
node.context.addNode = (parentNode, index) => () => {
|
|
84
|
-
if (parentNode && parentNode._value
|
|
89
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
90
|
+
const array = parentNode.value;
|
|
85
91
|
const item = node.context.newItem ? { ...node.context.newItem } : {};
|
|
86
|
-
|
|
87
|
-
parentNode.input(
|
|
92
|
+
array.splice(index + 1, 0, item);
|
|
93
|
+
parentNode.input(array, false);
|
|
88
94
|
}
|
|
89
95
|
};
|
|
90
96
|
node.context.cloneNode = (parentNode, index) => () => {
|
|
91
|
-
if (parentNode && parentNode._value
|
|
92
|
-
const item = parentNode.
|
|
93
|
-
const
|
|
94
|
-
|
|
97
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
98
|
+
const item = parentNode.value[index];
|
|
99
|
+
const array = parentNode.value;
|
|
100
|
+
array.splice(index + 1, 0, item);
|
|
101
|
+
parentNode.input(array, false);
|
|
95
102
|
}
|
|
96
103
|
};
|
|
97
104
|
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
98
|
-
if (parentNode && parentNode._value
|
|
99
|
-
const array = [...parentNode._value];
|
|
105
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
100
106
|
if (index > 0)
|
|
101
|
-
parentNode.input(swapElements(
|
|
107
|
+
parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
102
108
|
}
|
|
103
109
|
};
|
|
104
110
|
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
105
|
-
if (parentNode && parentNode._value
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
parentNode.input(swapElements(array, index, index + 1), false);
|
|
111
|
+
if (parentNode && Array.isArray(parentNode._value)) {
|
|
112
|
+
if (index < parentNode.value.length - 1)
|
|
113
|
+
parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
109
114
|
}
|
|
110
115
|
};
|
|
111
116
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sfxcode/nuxt-ui-formkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "FormKit integration for Nuxt UI - Seamlessly connect FormKit form handling with Nuxt UI components",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Tom",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
"design-system",
|
|
35
35
|
"form-builder"
|
|
36
36
|
],
|
|
37
|
-
"packageManager": "pnpm@11.0.9+sha512.34ce82e6780233cf9cad8685029a8f81d2e06196c5a9bad98879f7424940c6817c4e4524fb7d38b8553ceed48b9758b8ebaf1abd3600c232c4c8cf7366086f38",
|
|
38
37
|
"type": "module",
|
|
39
38
|
"exports": {
|
|
40
39
|
".": {
|
|
@@ -83,35 +82,46 @@
|
|
|
83
82
|
"lint": "eslint .",
|
|
84
83
|
"test": "vitest run",
|
|
85
84
|
"test:watch": "vitest watch",
|
|
86
|
-
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
|
|
85
|
+
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
|
|
86
|
+
"docs:dev": "vitepress dev docs",
|
|
87
|
+
"docs:build": "vitepress build docs",
|
|
88
|
+
"docs:preview": "vitepress preview docs"
|
|
87
89
|
},
|
|
88
90
|
"dependencies": {
|
|
89
91
|
"@formkit/addons": "^2.0.0",
|
|
90
92
|
"@formkit/nuxt": "^2.0.0",
|
|
91
|
-
"@nuxt/kit": "
|
|
92
|
-
"@nuxt/ui": "^4.
|
|
93
|
+
"@nuxt/kit": "4.4.6",
|
|
94
|
+
"@nuxt/ui": "^4.8.2",
|
|
95
|
+
"@vue/compiler-dom": "^3.5.35"
|
|
93
96
|
},
|
|
94
97
|
"devDependencies": {
|
|
95
98
|
"@iconify-json/heroicons": "^1.2.3",
|
|
96
|
-
"@iconify-json/lucide": "^1.2.
|
|
97
|
-
"@iconify-json/simple-icons": "^1.2.
|
|
98
|
-
"@nuxt/devtools": "4.0.0-alpha.
|
|
99
|
+
"@iconify-json/lucide": "^1.2.111",
|
|
100
|
+
"@iconify-json/simple-icons": "^1.2.85",
|
|
101
|
+
"@nuxt/devtools": "4.0.0-alpha.7",
|
|
99
102
|
"@nuxt/eslint-config": "^1.15.2",
|
|
100
103
|
"@nuxt/module-builder": "^1.0.2",
|
|
101
|
-
"@nuxt/schema": "
|
|
104
|
+
"@nuxt/schema": "4.4.6",
|
|
102
105
|
"@nuxt/test-utils": "^4.0.3",
|
|
103
106
|
"@types/node": "latest",
|
|
104
107
|
"@vitejs/plugin-vue": "^6.0.7",
|
|
105
108
|
"changelogen": "^0.6.2",
|
|
106
|
-
"eslint": "^10.
|
|
109
|
+
"eslint": "^10.4.1",
|
|
107
110
|
"jsdom": "^29.1.1",
|
|
108
111
|
"mkdist": "^2.4.1",
|
|
109
|
-
"nuxt": "
|
|
110
|
-
"sass-embedded": "^1.
|
|
112
|
+
"nuxt": "4.4.6",
|
|
113
|
+
"sass-embedded": "^1.100.0",
|
|
111
114
|
"typescript": "~6.0.3",
|
|
112
115
|
"unbuild": "^3.6.1",
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"vue
|
|
116
|
-
|
|
116
|
+
"vitepress": "2.0.0-alpha.17",
|
|
117
|
+
"vitest": "^4.1.8",
|
|
118
|
+
"vue": "^3.5.35",
|
|
119
|
+
"vue-tsc": "^3.3.3",
|
|
120
|
+
"@codemirror/lang-json": "^6.0.2",
|
|
121
|
+
"@codemirror/state": "^6.6.0",
|
|
122
|
+
"@codemirror/theme-one-dark": "^6.1.3",
|
|
123
|
+
"@codemirror/view": "^6.43.0",
|
|
124
|
+
"codemirror": "^6.0.2"
|
|
125
|
+
},
|
|
126
|
+
"packageManager": "pnpm@11.1.2+sha512.415a1cc25974731e75455c1468371be74c5aa5fb7621b50d4056d222451609f11412f23fd602e6169f1e060466641f798597e1be961a10688836a67b16569499"
|
|
117
127
|
}
|