@sfxcode/nuxt-ui-formkit 1.2.0 → 1.2.2
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/README.md +25 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/components/FUAutoForm.d.vue.ts +65 -0
- package/dist/runtime/components/FUAutoForm.vue +59 -0
- package/dist/runtime/components/FUAutoForm.vue.d.ts +65 -0
- package/dist/runtime/components/FUDataEdit.d.vue.ts +1 -1
- package/dist/runtime/components/FUDataEdit.vue.d.ts +1 -1
- package/dist/runtime/components/FUDataView.d.vue.ts +1 -1
- package/dist/runtime/components/FUDataView.vue.d.ts +1 -1
- package/dist/runtime/components/inputs/FUCalendar.d.vue.ts +15 -5
- package/dist/runtime/components/inputs/FUCalendar.vue +16 -4
- package/dist/runtime/components/inputs/FUCalendar.vue.d.ts +15 -5
- package/dist/runtime/components/inputs/FUInputDate.d.vue.ts +18 -5
- package/dist/runtime/components/inputs/FUInputDate.vue +24 -6
- package/dist/runtime/components/inputs/FUInputDate.vue.d.ts +18 -5
- package/dist/runtime/composables/useFormKitAutoForm.d.ts +38 -0
- package/dist/runtime/composables/useFormKitAutoForm.js +349 -0
- package/dist/runtime/composables/useFormKitForm.d.ts +11 -0
- package/dist/runtime/composables/useFormKitForm.js +38 -0
- package/dist/runtime/composables/useFormKitMultiStep.d.ts +5 -0
- package/dist/runtime/composables/useFormKitMultiStep.js +65 -0
- package/dist/runtime/composables/useFormKitRepeater.d.ts +4 -0
- package/dist/runtime/composables/useFormKitRepeater.js +138 -0
- package/dist/runtime/formkit/createNuxtUiFormkitConfig.d.ts +19 -0
- package/dist/runtime/formkit/createNuxtUiFormkitConfig.js +12 -0
- package/dist/runtime/formkit/createNuxtUiFormkitConfig.mjs +12 -0
- package/dist/runtime/formkit/definitions/index.d.ts +3 -0
- package/dist/runtime/formkit/definitions/index.js +4 -0
- package/dist/runtime/formkit/definitions/index.mjs +4 -0
- package/dist/runtime/formkit/definitions/input.js +2 -2
- package/dist/runtime/formkit/definitions/input.mjs +2 -2
- package/dist/runtime/formkit/definitions/multiStep.d.ts +3 -0
- package/dist/runtime/formkit/definitions/multiStep.js +90 -0
- package/dist/runtime/formkit/definitions/multiStep.mjs +90 -0
- package/dist/runtime/formkit/definitions/repeater.js +3 -119
- package/dist/runtime/formkit/definitions/repeater.mjs +3 -119
- package/dist/runtime/formkit/index.d.ts +10 -0
- package/dist/runtime/formkit/index.js +1 -0
- package/dist/runtime/formkit/index.mjs +1 -0
- package/dist/runtime/formkit/plugins/index.d.ts +1 -0
- package/dist/runtime/formkit/plugins/index.js +1 -0
- package/dist/runtime/formkit/plugins/index.mjs +1 -0
- package/dist/runtime/plugin.js +2 -1
- package/dist/runtime/utils/dateValueConversion.d.ts +36 -0
- package/dist/runtime/utils/dateValueConversion.js +80 -0
- package/package.json +6 -3
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { nuxtUICalendarDefinition, nuxtUICheckboxDefinition, nuxtUICheckboxGroupDefinition, nuxtUIColorPickerDefinition, nuxtUIEditorDefinition, nuxtUIFileUploadDefinition, nuxtUIInputDateDefinition, nuxtUIInputDefinition, nuxtUIInputMenuDefinition, nuxtUIInputNumberDefinition, nuxtUIInputTagsDefinition, nuxtUIInputTimeDefinition, nuxtUIListboxDefinition, nuxtUIPinInputDefinition, nuxtUIRadioGroupDefinition, nuxtUISelectDefinition, nuxtUISelectMenuDefinition, nuxtUISliderDefinition, nuxtUISwitchDefinition, nuxtUITextareaDefinition } from "./input.js";
|
|
2
|
+
import { nuxtUIMultiStepDefinition, nuxtUIStepDefinition } from "./multiStep.js";
|
|
2
3
|
import { nuxtUIOutputBooleanDefinition, nuxtUIOutputDateDefinition, nuxtUIOutputLinkDefinition, nuxtUIOutputListDefinition, nuxtUIOutputNumberDefinition, nuxtUIOutputTextDefinition } from "./output.js";
|
|
3
4
|
import { nuxtUIRepeaterDefinition } from "./repeater.js";
|
|
4
5
|
export * from "./input.js";
|
|
6
|
+
export * from "./multiStep.js";
|
|
5
7
|
export * from "./output.js";
|
|
6
8
|
export const nuxtUIInputs = {
|
|
7
9
|
nuxtUICalendar: nuxtUICalendarDefinition,
|
|
@@ -17,11 +19,13 @@ export const nuxtUIInputs = {
|
|
|
17
19
|
nuxtUIInputTags: nuxtUIInputTagsDefinition,
|
|
18
20
|
nuxtUIInputTime: nuxtUIInputTimeDefinition,
|
|
19
21
|
nuxtUIListbox: nuxtUIListboxDefinition,
|
|
22
|
+
nuxtUIMultiStep: nuxtUIMultiStepDefinition,
|
|
20
23
|
nuxtUIPinInput: nuxtUIPinInputDefinition,
|
|
21
24
|
nuxtUIRadioGroup: nuxtUIRadioGroupDefinition,
|
|
22
25
|
nuxtUISelect: nuxtUISelectDefinition,
|
|
23
26
|
nuxtUISelectMenu: nuxtUISelectMenuDefinition,
|
|
24
27
|
nuxtUISlider: nuxtUISliderDefinition,
|
|
28
|
+
nuxtUIStep: nuxtUIStepDefinition,
|
|
25
29
|
nuxtUISwitch: nuxtUISwitchDefinition,
|
|
26
30
|
nuxtUITextarea: nuxtUITextareaDefinition,
|
|
27
31
|
nuxtUIRepeater: nuxtUIRepeaterDefinition
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { nuxtUICalendarDefinition, nuxtUICheckboxDefinition, nuxtUICheckboxGroupDefinition, nuxtUIColorPickerDefinition, nuxtUIEditorDefinition, nuxtUIFileUploadDefinition, nuxtUIInputDateDefinition, nuxtUIInputDefinition, nuxtUIInputMenuDefinition, nuxtUIInputNumberDefinition, nuxtUIInputTagsDefinition, nuxtUIInputTimeDefinition, nuxtUIListboxDefinition, nuxtUIPinInputDefinition, nuxtUIRadioGroupDefinition, nuxtUISelectDefinition, nuxtUISelectMenuDefinition, nuxtUISliderDefinition, nuxtUISwitchDefinition, nuxtUITextareaDefinition } from "./input.mjs";
|
|
2
|
+
import { nuxtUIMultiStepDefinition, nuxtUIStepDefinition } from "./multiStep.mjs";
|
|
2
3
|
import { nuxtUIOutputBooleanDefinition, nuxtUIOutputDateDefinition, nuxtUIOutputLinkDefinition, nuxtUIOutputListDefinition, nuxtUIOutputNumberDefinition, nuxtUIOutputTextDefinition } from "./output.mjs";
|
|
3
4
|
import { nuxtUIRepeaterDefinition } from "./repeater.mjs";
|
|
4
5
|
export * from "./input.mjs";
|
|
6
|
+
export * from "./multiStep.mjs";
|
|
5
7
|
export * from "./output.mjs";
|
|
6
8
|
export const nuxtUIInputs = {
|
|
7
9
|
nuxtUICalendar: nuxtUICalendarDefinition,
|
|
@@ -17,11 +19,13 @@ export const nuxtUIInputs = {
|
|
|
17
19
|
nuxtUIInputTags: nuxtUIInputTagsDefinition,
|
|
18
20
|
nuxtUIInputTime: nuxtUIInputTimeDefinition,
|
|
19
21
|
nuxtUIListbox: nuxtUIListboxDefinition,
|
|
22
|
+
nuxtUIMultiStep: nuxtUIMultiStepDefinition,
|
|
20
23
|
nuxtUIPinInput: nuxtUIPinInputDefinition,
|
|
21
24
|
nuxtUIRadioGroup: nuxtUIRadioGroupDefinition,
|
|
22
25
|
nuxtUISelect: nuxtUISelectDefinition,
|
|
23
26
|
nuxtUISelectMenu: nuxtUISelectMenuDefinition,
|
|
24
27
|
nuxtUISlider: nuxtUISliderDefinition,
|
|
28
|
+
nuxtUIStep: nuxtUIStepDefinition,
|
|
25
29
|
nuxtUISwitch: nuxtUISwitchDefinition,
|
|
26
30
|
nuxtUITextarea: nuxtUITextareaDefinition,
|
|
27
31
|
nuxtUIRepeater: nuxtUIRepeaterDefinition
|
|
@@ -20,7 +20,7 @@ import FUSlider from "../../../runtime/components/inputs/FUSlider.vue";
|
|
|
20
20
|
import FUSwitch from "../../../runtime/components/inputs/FUSwitch.vue";
|
|
21
21
|
import FUTextarea from "../../../runtime/components/inputs/FUTextarea.vue";
|
|
22
22
|
export const nuxtUICalendarDefinition = createInput(FUCalendar, {
|
|
23
|
-
props: ["type", "range", "multiple", "color", "variant", "size", "weekNumbers", "monthControls", "yearControls", "viewControl", "defaultValue", "minValue", "maxValue", "isDateDisabled", "isDateUnavailable", "ui"],
|
|
23
|
+
props: ["type", "range", "multiple", "color", "variant", "size", "weekNumbers", "monthControls", "yearControls", "viewControl", "defaultValue", "minValue", "maxValue", "isDateDisabled", "isDateUnavailable", "ui", "valueType", "timeZone"],
|
|
24
24
|
family: "NuxtUIInput"
|
|
25
25
|
});
|
|
26
26
|
export const nuxtUICheckboxDefinition = createInput(FUCheckbox, {
|
|
@@ -48,7 +48,7 @@ export const nuxtUIInputDefinition = createInput(FUInput, {
|
|
|
48
48
|
family: "NuxtUIInput"
|
|
49
49
|
});
|
|
50
50
|
export const nuxtUIInputDateDefinition = createInput(FUInputDate, {
|
|
51
|
-
props: ["defaultValue", "color", "variant", "size", "highlight", "fixed", "autofocus", "autofocusDelay", "range", "separatorIcon", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "placeholder", "defaultPlaceholder", "hourCycle", "step", "granularity", "hideTimeZone", "maxValue", "minValue", "isDateUnavailable", "ui"],
|
|
51
|
+
props: ["defaultValue", "color", "variant", "size", "highlight", "fixed", "autofocus", "autofocusDelay", "range", "separatorIcon", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "placeholder", "defaultPlaceholder", "hourCycle", "step", "granularity", "hideTimeZone", "maxValue", "minValue", "isDateUnavailable", "ui", "valueType", "timeZone"],
|
|
52
52
|
family: "NuxtUIInput"
|
|
53
53
|
});
|
|
54
54
|
export const nuxtUIInputMenuDefinition = createInput(FUInputMenu, {
|
|
@@ -20,7 +20,7 @@ import FUSlider from "../../../runtime/components/inputs/FUSlider.vue";
|
|
|
20
20
|
import FUSwitch from "../../../runtime/components/inputs/FUSwitch.vue";
|
|
21
21
|
import FUTextarea from "../../../runtime/components/inputs/FUTextarea.vue";
|
|
22
22
|
export const nuxtUICalendarDefinition = createInput(FUCalendar, {
|
|
23
|
-
props: ["type", "range", "multiple", "color", "variant", "size", "weekNumbers", "monthControls", "yearControls", "viewControl", "defaultValue", "minValue", "maxValue", "isDateDisabled", "isDateUnavailable", "ui"],
|
|
23
|
+
props: ["type", "range", "multiple", "color", "variant", "size", "weekNumbers", "monthControls", "yearControls", "viewControl", "defaultValue", "minValue", "maxValue", "isDateDisabled", "isDateUnavailable", "ui", "valueType", "timeZone"],
|
|
24
24
|
family: "NuxtUIInput"
|
|
25
25
|
});
|
|
26
26
|
export const nuxtUICheckboxDefinition = createInput(FUCheckbox, {
|
|
@@ -48,7 +48,7 @@ export const nuxtUIInputDefinition = createInput(FUInput, {
|
|
|
48
48
|
family: "NuxtUIInput"
|
|
49
49
|
});
|
|
50
50
|
export const nuxtUIInputDateDefinition = createInput(FUInputDate, {
|
|
51
|
-
props: ["defaultValue", "color", "variant", "size", "highlight", "fixed", "autofocus", "autofocusDelay", "range", "separatorIcon", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "placeholder", "defaultPlaceholder", "hourCycle", "step", "granularity", "hideTimeZone", "maxValue", "minValue", "isDateUnavailable", "ui"],
|
|
51
|
+
props: ["defaultValue", "color", "variant", "size", "highlight", "fixed", "autofocus", "autofocusDelay", "range", "separatorIcon", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "placeholder", "defaultPlaceholder", "hourCycle", "step", "granularity", "hideTimeZone", "maxValue", "minValue", "isDateUnavailable", "ui", "valueType", "timeZone"],
|
|
52
52
|
family: "NuxtUIInput"
|
|
53
53
|
});
|
|
54
54
|
export const nuxtUIInputMenuDefinition = createInput(FUInputMenu, {
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { disablesChildren } from "@formkit/inputs";
|
|
2
|
+
import { createInput } from "@formkit/vue";
|
|
3
|
+
import { useFormKitMultiStep } from "../../composables/useFormKitMultiStep.js";
|
|
4
|
+
import { useFormKitSchema } from "../../composables/useFormKitSchema.js";
|
|
5
|
+
const { addElement, addComponent } = useFormKitSchema();
|
|
6
|
+
const { addMultiStepHandler, addStepHandler } = useFormKitMultiStep();
|
|
7
|
+
function addStepActionButton(label, onClick, bindAttrs, render, variant, disabled) {
|
|
8
|
+
return addElement("div", [
|
|
9
|
+
addComponent("UButton", { label, onClick, variant, disabled, ui: "$ui" }, true, { bind: bindAttrs })
|
|
10
|
+
], {}, render);
|
|
11
|
+
}
|
|
12
|
+
export const nuxtUIStepDefinition = createInput(
|
|
13
|
+
addElement("div", [
|
|
14
|
+
addElement("div", "$slots.default", { class: "formkit-step-inner" }),
|
|
15
|
+
addElement("div", [
|
|
16
|
+
addStepActionButton(
|
|
17
|
+
{ if: "$previousLabel", then: "$previousLabel", else: "Previous" },
|
|
18
|
+
"$handlers.previous",
|
|
19
|
+
"$previousAttrs",
|
|
20
|
+
"$isFirstStep === false",
|
|
21
|
+
"outline"
|
|
22
|
+
),
|
|
23
|
+
addStepActionButton(
|
|
24
|
+
{ if: "$nextLabel", then: "$nextLabel", else: "Next" },
|
|
25
|
+
"$handlers.next",
|
|
26
|
+
"$nextAttrs",
|
|
27
|
+
"$isLastStep === false || $stepIndex === 0",
|
|
28
|
+
void 0,
|
|
29
|
+
"$nextDisabled"
|
|
30
|
+
)
|
|
31
|
+
], { class: "$internalStepActionsClass" })
|
|
32
|
+
], {
|
|
33
|
+
"id": "$id",
|
|
34
|
+
"role": "tabpanel",
|
|
35
|
+
"aria-labelledby": '$node.parent.props.id + "_tab_" + $stepIndex'
|
|
36
|
+
}, true),
|
|
37
|
+
{
|
|
38
|
+
// The core node `type` (input|list|group) - not to be confused with
|
|
39
|
+
// `forceTypeProp` below, which is what makes `@formkit/addons`' own
|
|
40
|
+
// `createMultiStepPlugin` recognize this node as a `step`.
|
|
41
|
+
type: "group",
|
|
42
|
+
forceTypeProp: "step",
|
|
43
|
+
family: "NuxtUIInput",
|
|
44
|
+
props: ["beforeStepChange", "nextAttrs", "nextLabel", "previousAttrs", "previousLabel", "validStepIcon", "ui", "stepActionsClass"],
|
|
45
|
+
features: [disablesChildren, addStepHandler]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
// `createInput()` always wraps the given schema in FormKit's standard
|
|
49
|
+
// outer/wrapper/label/inner/help/messages chrome (`useSchema()`) - the
|
|
50
|
+
// `hidden` attr on our own inner div (above) only hid *that* div, while
|
|
51
|
+
// the auto-generated `label` section (which renders whenever `$label`
|
|
52
|
+
// is set - and every step needs a `label` prop so `stepName` has
|
|
53
|
+
// something better than the raw step name to show in the tab strip)
|
|
54
|
+
// is a *sibling* of it, one level up, and stayed visible regardless -
|
|
55
|
+
// every inactive step's label text leaked into the page between the
|
|
56
|
+
// active step's "Next" button and the form's own submit button. Move
|
|
57
|
+
// `hidden` to the actual outermost element instead, and suppress the
|
|
58
|
+
// redundant label section entirely (a wizard step isn't a labeled
|
|
59
|
+
// field - its `label` prop only feeds the tab strip's text).
|
|
60
|
+
outer: {
|
|
61
|
+
attrs: {
|
|
62
|
+
hidden: "$isActiveStep === false || undefined"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
label: {
|
|
66
|
+
if: "false"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
export const nuxtUIMultiStepDefinition = createInput(
|
|
71
|
+
addElement("div", [
|
|
72
|
+
addElement("div", [
|
|
73
|
+
addComponent("UTabs", {
|
|
74
|
+
"items": "$tabItems",
|
|
75
|
+
"modelValue": "$activeStep",
|
|
76
|
+
"content": false,
|
|
77
|
+
"onUpdate:modelValue": "$handleTabChange",
|
|
78
|
+
"ui": "$ui"
|
|
79
|
+
})
|
|
80
|
+
], { class: "formkit-multi-step-tabs" }),
|
|
81
|
+
addElement("div", "$slots.default", { class: "formkit-multi-step-steps" })
|
|
82
|
+
], { id: "$id" }, true),
|
|
83
|
+
{
|
|
84
|
+
type: "group",
|
|
85
|
+
forceTypeProp: "multi-step",
|
|
86
|
+
family: "NuxtUIInput",
|
|
87
|
+
props: ["allowIncomplete", "tabStyle", "hideProgressLabels", "validStepIcon", "beforeStepChange", "ui"],
|
|
88
|
+
features: [disablesChildren, addMultiStepHandler]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { disablesChildren } from "@formkit/inputs";
|
|
2
|
+
import { createInput } from "@formkit/vue";
|
|
3
|
+
import { useFormKitMultiStep } from "../../composables/useFormKitMultiStep";
|
|
4
|
+
import { useFormKitSchema } from "../../composables/useFormKitSchema";
|
|
5
|
+
const { addElement, addComponent } = useFormKitSchema();
|
|
6
|
+
const { addMultiStepHandler, addStepHandler } = useFormKitMultiStep();
|
|
7
|
+
function addStepActionButton(label, onClick, bindAttrs, render, variant, disabled) {
|
|
8
|
+
return addElement("div", [
|
|
9
|
+
addComponent("UButton", { label, onClick, variant, disabled, ui: "$ui" }, true, { bind: bindAttrs })
|
|
10
|
+
], {}, render);
|
|
11
|
+
}
|
|
12
|
+
export const nuxtUIStepDefinition = createInput(
|
|
13
|
+
addElement("div", [
|
|
14
|
+
addElement("div", "$slots.default", { class: "formkit-step-inner" }),
|
|
15
|
+
addElement("div", [
|
|
16
|
+
addStepActionButton(
|
|
17
|
+
{ if: "$previousLabel", then: "$previousLabel", else: "Previous" },
|
|
18
|
+
"$handlers.previous",
|
|
19
|
+
"$previousAttrs",
|
|
20
|
+
"$isFirstStep === false",
|
|
21
|
+
"outline"
|
|
22
|
+
),
|
|
23
|
+
addStepActionButton(
|
|
24
|
+
{ if: "$nextLabel", then: "$nextLabel", else: "Next" },
|
|
25
|
+
"$handlers.next",
|
|
26
|
+
"$nextAttrs",
|
|
27
|
+
"$isLastStep === false || $stepIndex === 0",
|
|
28
|
+
void 0,
|
|
29
|
+
"$nextDisabled"
|
|
30
|
+
)
|
|
31
|
+
], { class: "$internalStepActionsClass" })
|
|
32
|
+
], {
|
|
33
|
+
"id": "$id",
|
|
34
|
+
"role": "tabpanel",
|
|
35
|
+
"aria-labelledby": '$node.parent.props.id + "_tab_" + $stepIndex'
|
|
36
|
+
}, true),
|
|
37
|
+
{
|
|
38
|
+
// The core node `type` (input|list|group) - not to be confused with
|
|
39
|
+
// `forceTypeProp` below, which is what makes `@formkit/addons`' own
|
|
40
|
+
// `createMultiStepPlugin` recognize this node as a `step`.
|
|
41
|
+
type: "group",
|
|
42
|
+
forceTypeProp: "step",
|
|
43
|
+
family: "NuxtUIInput",
|
|
44
|
+
props: ["beforeStepChange", "nextAttrs", "nextLabel", "previousAttrs", "previousLabel", "validStepIcon", "ui", "stepActionsClass"],
|
|
45
|
+
features: [disablesChildren, addStepHandler]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
// `createInput()` always wraps the given schema in FormKit's standard
|
|
49
|
+
// outer/wrapper/label/inner/help/messages chrome (`useSchema()`) - the
|
|
50
|
+
// `hidden` attr on our own inner div (above) only hid *that* div, while
|
|
51
|
+
// the auto-generated `label` section (which renders whenever `$label`
|
|
52
|
+
// is set - and every step needs a `label` prop so `stepName` has
|
|
53
|
+
// something better than the raw step name to show in the tab strip)
|
|
54
|
+
// is a *sibling* of it, one level up, and stayed visible regardless -
|
|
55
|
+
// every inactive step's label text leaked into the page between the
|
|
56
|
+
// active step's "Next" button and the form's own submit button. Move
|
|
57
|
+
// `hidden` to the actual outermost element instead, and suppress the
|
|
58
|
+
// redundant label section entirely (a wizard step isn't a labeled
|
|
59
|
+
// field - its `label` prop only feeds the tab strip's text).
|
|
60
|
+
outer: {
|
|
61
|
+
attrs: {
|
|
62
|
+
hidden: "$isActiveStep === false || undefined"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
label: {
|
|
66
|
+
if: "false"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
export const nuxtUIMultiStepDefinition = createInput(
|
|
71
|
+
addElement("div", [
|
|
72
|
+
addElement("div", [
|
|
73
|
+
addComponent("UTabs", {
|
|
74
|
+
"items": "$tabItems",
|
|
75
|
+
"modelValue": "$activeStep",
|
|
76
|
+
"content": false,
|
|
77
|
+
"onUpdate:modelValue": "$handleTabChange",
|
|
78
|
+
"ui": "$ui"
|
|
79
|
+
})
|
|
80
|
+
], { class: "formkit-multi-step-tabs" }),
|
|
81
|
+
addElement("div", "$slots.default", { class: "formkit-multi-step-steps" })
|
|
82
|
+
], { id: "$id" }, true),
|
|
83
|
+
{
|
|
84
|
+
type: "group",
|
|
85
|
+
forceTypeProp: "multi-step",
|
|
86
|
+
family: "NuxtUIInput",
|
|
87
|
+
props: ["allowIncomplete", "tabStyle", "hideProgressLabels", "validStepIcon", "beforeStepChange", "ui"],
|
|
88
|
+
features: [disablesChildren, addMultiStepHandler]
|
|
89
|
+
}
|
|
90
|
+
);
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createInput } from "@formkit/vue";
|
|
2
|
+
import { useFormKitRepeater } from "../../composables/useFormKitRepeater.js";
|
|
2
3
|
import { useFormKitSchema } from "../../composables/useFormKitSchema.js";
|
|
3
4
|
const { addList, addElement, addListGroup, addComponent } = useFormKitSchema();
|
|
5
|
+
const { addRepeaterHandler } = useFormKitRepeater();
|
|
4
6
|
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
5
7
|
const addActionButtonComponent = (onClick = "", icon = "", color = "", render2 = "true", disabled = "false") => {
|
|
6
8
|
return addElement("div", [addComponent("UButton", { onClick, icon, color, disabled, size: buttonSize })], { class: buttonGroupItemClass }, render2);
|
|
@@ -53,7 +55,7 @@ export const nuxtUIRepeaterDefinition = createInput(
|
|
|
53
55
|
onDragend: "$dragNodeEnd"
|
|
54
56
|
})
|
|
55
57
|
], true, {})
|
|
56
|
-
], true, "true", { value: "$value" })
|
|
58
|
+
], true, "true", { value: "$value", validation: "$repeaterValidation" })
|
|
57
59
|
], { class: "$internalListClass", id: "$internalListId" }, true),
|
|
58
60
|
{
|
|
59
61
|
props: [
|
|
@@ -82,121 +84,3 @@ export const nuxtUIRepeaterDefinition = createInput(
|
|
|
82
84
|
features: [addRepeaterHandler]
|
|
83
85
|
}
|
|
84
86
|
);
|
|
85
|
-
function addRepeaterHandler(node) {
|
|
86
|
-
const swapElements = (array, index1, index2) => {
|
|
87
|
-
const [element] = array.splice(index1, 1);
|
|
88
|
-
if (element !== void 0) {
|
|
89
|
-
array.splice(index2, 0, element);
|
|
90
|
-
}
|
|
91
|
-
return array;
|
|
92
|
-
};
|
|
93
|
-
const uuid = typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
94
|
-
node.on("created", () => {
|
|
95
|
-
if (node.context) {
|
|
96
|
-
let dragStartIndex = null;
|
|
97
|
-
let dragOverIndex = null;
|
|
98
|
-
const newItem = node.context.newItem || {};
|
|
99
|
-
node.context.listName = node.name;
|
|
100
|
-
node.context.renderButtons = !node.context.hideButtonGroup;
|
|
101
|
-
node.context.insertButtonSize = node.context.insertButtonSize ? node.context.insertButtonSize : "md";
|
|
102
|
-
node.context.buttonSize = node.context.buttonSize ? node.context.buttonSize : "md";
|
|
103
|
-
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
104
|
-
node.context.draggable = !!node.context.draggable;
|
|
105
|
-
node.context.renderDragHandle = !!node.context.displayDragHandle;
|
|
106
|
-
node.context.dragHandleIconName = node.context.dragHandleIconName || "i-lucide-grip-vertical";
|
|
107
|
-
node.context.internalDragHandleClass = node.context.dragHandleClass ? `formkit-repeater-drag-handle ${node.context.dragHandleClass}` : "formkit-repeater-drag-handle";
|
|
108
|
-
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
109
|
-
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
110
|
-
node.context.internalListId = `formkit-items-${uuid}`;
|
|
111
|
-
node.context.minItems = node.context.minItems !== void 0 ? node.context.minItems : 0;
|
|
112
|
-
node.context.maxItems = node.context.maxItems !== void 0 ? node.context.maxItems : Number.POSITIVE_INFINITY;
|
|
113
|
-
node.context.getListItemClass = (index) => {
|
|
114
|
-
if (dragOverIndex === index && dragStartIndex !== index)
|
|
115
|
-
return `${node.context?.internalListItemClass} formkit-repeater-drop-target`;
|
|
116
|
-
return node.context?.internalListItemClass?.toString() ?? "";
|
|
117
|
-
};
|
|
118
|
-
node.context.getListItemId = (index) => {
|
|
119
|
-
return `formkit-item-${index}-${uuid}`;
|
|
120
|
-
};
|
|
121
|
-
node.context.insertNode = (parentNode) => () => {
|
|
122
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
123
|
-
const newArray = [{ ...newItem }, ...parentNode.value];
|
|
124
|
-
parentNode.input(newArray, false);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
node.context.removeNode = (parentNode, index) => () => {
|
|
128
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
129
|
-
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
node.context.addNode = (parentNode, index) => () => {
|
|
133
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
134
|
-
const array = parentNode.value;
|
|
135
|
-
array.splice(index + 1, 0, { ...newItem });
|
|
136
|
-
parentNode.input(array, false);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
node.context.cloneNode = (parentNode, index) => () => {
|
|
140
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
141
|
-
const item = parentNode.value[index];
|
|
142
|
-
const array = parentNode.value;
|
|
143
|
-
array.splice(index + 1, 0, { ...item });
|
|
144
|
-
parentNode.input(array, false);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
148
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
149
|
-
if (index > 0)
|
|
150
|
-
parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
154
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
155
|
-
if (index < parentNode.value.length - 1)
|
|
156
|
-
parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
node.context.dragNodeStart = (_parentNode, index) => (event) => {
|
|
160
|
-
dragStartIndex = index;
|
|
161
|
-
if (event?.dataTransfer) {
|
|
162
|
-
event.dataTransfer.effectAllowed = "move";
|
|
163
|
-
event.dataTransfer.setData("text/plain", String(index));
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
node.context.dragNodeOver = (targetIndex) => (event) => {
|
|
167
|
-
event?.preventDefault();
|
|
168
|
-
dragOverIndex = targetIndex;
|
|
169
|
-
if (event?.dataTransfer)
|
|
170
|
-
event.dataTransfer.dropEffect = "move";
|
|
171
|
-
};
|
|
172
|
-
node.context.dragNodeLeave = (targetIndex) => () => {
|
|
173
|
-
if (dragOverIndex === targetIndex)
|
|
174
|
-
dragOverIndex = null;
|
|
175
|
-
};
|
|
176
|
-
node.context.dropNode = (parentNode, targetIndex) => (event) => {
|
|
177
|
-
event?.preventDefault();
|
|
178
|
-
if (!parentNode || !Array.isArray(parentNode._value)) {
|
|
179
|
-
dragOverIndex = null;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
const sourceFromEvent = Number.parseInt(event?.dataTransfer?.getData("text/plain") || "", 10);
|
|
183
|
-
const sourceIndex = Number.isInteger(sourceFromEvent) ? sourceFromEvent : dragStartIndex;
|
|
184
|
-
if (sourceIndex === null || sourceIndex === targetIndex) {
|
|
185
|
-
dragOverIndex = null;
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (sourceIndex < 0 || sourceIndex >= parentNode.value.length) {
|
|
189
|
-
dragOverIndex = null;
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
parentNode.input(swapElements(parentNode.value, sourceIndex, targetIndex), false);
|
|
193
|
-
dragStartIndex = null;
|
|
194
|
-
dragOverIndex = null;
|
|
195
|
-
};
|
|
196
|
-
node.context.dragNodeEnd = () => {
|
|
197
|
-
dragStartIndex = null;
|
|
198
|
-
dragOverIndex = null;
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { createInput } from "@formkit/vue";
|
|
2
|
+
import { useFormKitRepeater } from "../../composables/useFormKitRepeater";
|
|
2
3
|
import { useFormKitSchema } from "../../composables/useFormKitSchema";
|
|
3
4
|
const { addList, addElement, addListGroup, addComponent } = useFormKitSchema();
|
|
5
|
+
const { addRepeaterHandler } = useFormKitRepeater();
|
|
4
6
|
function addButtonGroup(buttonGroupClass = "", buttonGroupItemClass = "", buttonSize, render = "true") {
|
|
5
7
|
const addActionButtonComponent = (onClick = "", icon = "", color = "", render2 = "true", disabled = "false") => {
|
|
6
8
|
return addElement("div", [addComponent("UButton", { onClick, icon, color, disabled, size: buttonSize })], { class: buttonGroupItemClass }, render2);
|
|
@@ -53,7 +55,7 @@ export const nuxtUIRepeaterDefinition = createInput(
|
|
|
53
55
|
onDragend: "$dragNodeEnd"
|
|
54
56
|
})
|
|
55
57
|
], true, {})
|
|
56
|
-
], true, "true", { value: "$value" })
|
|
58
|
+
], true, "true", { value: "$value", validation: "$repeaterValidation" })
|
|
57
59
|
], { class: "$internalListClass", id: "$internalListId" }, true),
|
|
58
60
|
{
|
|
59
61
|
props: [
|
|
@@ -82,121 +84,3 @@ export const nuxtUIRepeaterDefinition = createInput(
|
|
|
82
84
|
features: [addRepeaterHandler]
|
|
83
85
|
}
|
|
84
86
|
);
|
|
85
|
-
function addRepeaterHandler(node) {
|
|
86
|
-
const swapElements = (array, index1, index2) => {
|
|
87
|
-
const [element] = array.splice(index1, 1);
|
|
88
|
-
if (element !== void 0) {
|
|
89
|
-
array.splice(index2, 0, element);
|
|
90
|
-
}
|
|
91
|
-
return array;
|
|
92
|
-
};
|
|
93
|
-
const uuid = typeof crypto !== "undefined" && crypto.randomUUID ? crypto.randomUUID() : Math.random().toString(36).slice(2);
|
|
94
|
-
node.on("created", () => {
|
|
95
|
-
if (node.context) {
|
|
96
|
-
let dragStartIndex = null;
|
|
97
|
-
let dragOverIndex = null;
|
|
98
|
-
const newItem = node.context.newItem || {};
|
|
99
|
-
node.context.listName = node.name;
|
|
100
|
-
node.context.renderButtons = !node.context.hideButtonGroup;
|
|
101
|
-
node.context.insertButtonSize = node.context.insertButtonSize ? node.context.insertButtonSize : "md";
|
|
102
|
-
node.context.buttonSize = node.context.buttonSize ? node.context.buttonSize : "md";
|
|
103
|
-
node.context.renderMoveButtons = !node.context.hideMoveButtons;
|
|
104
|
-
node.context.draggable = !!node.context.draggable;
|
|
105
|
-
node.context.renderDragHandle = !!node.context.displayDragHandle;
|
|
106
|
-
node.context.dragHandleIconName = node.context.dragHandleIconName || "i-lucide-grip-vertical";
|
|
107
|
-
node.context.internalDragHandleClass = node.context.dragHandleClass ? `formkit-repeater-drag-handle ${node.context.dragHandleClass}` : "formkit-repeater-drag-handle";
|
|
108
|
-
node.context.internalListClass = node.context.listClass ? `formkit-items ${node.context.listClass}` : "formkit-items";
|
|
109
|
-
node.context.internalListItemClass = node.context.listItemClass ? `formkit-item ${node.context.listItemClass}` : "formkit-item";
|
|
110
|
-
node.context.internalListId = `formkit-items-${uuid}`;
|
|
111
|
-
node.context.minItems = node.context.minItems !== void 0 ? node.context.minItems : 0;
|
|
112
|
-
node.context.maxItems = node.context.maxItems !== void 0 ? node.context.maxItems : Number.POSITIVE_INFINITY;
|
|
113
|
-
node.context.getListItemClass = (index) => {
|
|
114
|
-
if (dragOverIndex === index && dragStartIndex !== index)
|
|
115
|
-
return `${node.context?.internalListItemClass} formkit-repeater-drop-target`;
|
|
116
|
-
return node.context?.internalListItemClass?.toString() ?? "";
|
|
117
|
-
};
|
|
118
|
-
node.context.getListItemId = (index) => {
|
|
119
|
-
return `formkit-item-${index}-${uuid}`;
|
|
120
|
-
};
|
|
121
|
-
node.context.insertNode = (parentNode) => () => {
|
|
122
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
123
|
-
const newArray = [{ ...newItem }, ...parentNode.value];
|
|
124
|
-
parentNode.input(newArray, false);
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
node.context.removeNode = (parentNode, index) => () => {
|
|
128
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
129
|
-
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
node.context.addNode = (parentNode, index) => () => {
|
|
133
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
134
|
-
const array = parentNode.value;
|
|
135
|
-
array.splice(index + 1, 0, { ...newItem });
|
|
136
|
-
parentNode.input(array, false);
|
|
137
|
-
}
|
|
138
|
-
};
|
|
139
|
-
node.context.cloneNode = (parentNode, index) => () => {
|
|
140
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
141
|
-
const item = parentNode.value[index];
|
|
142
|
-
const array = parentNode.value;
|
|
143
|
-
array.splice(index + 1, 0, { ...item });
|
|
144
|
-
parentNode.input(array, false);
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
node.context.moveNodeUp = (parentNode, index) => () => {
|
|
148
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
149
|
-
if (index > 0)
|
|
150
|
-
parentNode.input(swapElements(parentNode.value, index - 1, index), false);
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
node.context.moveNodeDown = (parentNode, index) => () => {
|
|
154
|
-
if (parentNode && Array.isArray(parentNode._value)) {
|
|
155
|
-
if (index < parentNode.value.length - 1)
|
|
156
|
-
parentNode.input(swapElements(parentNode.value, index, index + 1), false);
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
node.context.dragNodeStart = (_parentNode, index) => (event) => {
|
|
160
|
-
dragStartIndex = index;
|
|
161
|
-
if (event?.dataTransfer) {
|
|
162
|
-
event.dataTransfer.effectAllowed = "move";
|
|
163
|
-
event.dataTransfer.setData("text/plain", String(index));
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
node.context.dragNodeOver = (targetIndex) => (event) => {
|
|
167
|
-
event?.preventDefault();
|
|
168
|
-
dragOverIndex = targetIndex;
|
|
169
|
-
if (event?.dataTransfer)
|
|
170
|
-
event.dataTransfer.dropEffect = "move";
|
|
171
|
-
};
|
|
172
|
-
node.context.dragNodeLeave = (targetIndex) => () => {
|
|
173
|
-
if (dragOverIndex === targetIndex)
|
|
174
|
-
dragOverIndex = null;
|
|
175
|
-
};
|
|
176
|
-
node.context.dropNode = (parentNode, targetIndex) => (event) => {
|
|
177
|
-
event?.preventDefault();
|
|
178
|
-
if (!parentNode || !Array.isArray(parentNode._value)) {
|
|
179
|
-
dragOverIndex = null;
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
const sourceFromEvent = Number.parseInt(event?.dataTransfer?.getData("text/plain") || "", 10);
|
|
183
|
-
const sourceIndex = Number.isInteger(sourceFromEvent) ? sourceFromEvent : dragStartIndex;
|
|
184
|
-
if (sourceIndex === null || sourceIndex === targetIndex) {
|
|
185
|
-
dragOverIndex = null;
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
if (sourceIndex < 0 || sourceIndex >= parentNode.value.length) {
|
|
189
|
-
dragOverIndex = null;
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
parentNode.input(swapElements(parentNode.value, sourceIndex, targetIndex), false);
|
|
193
|
-
dragStartIndex = null;
|
|
194
|
-
dragOverIndex = null;
|
|
195
|
-
};
|
|
196
|
-
node.context.dragNodeEnd = () => {
|
|
197
|
-
dragStartIndex = null;
|
|
198
|
-
dragOverIndex = null;
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
});
|
|
202
|
-
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { FormKitMultiStepSlots, FormKitStepSlots } from '@formkit/addons';
|
|
1
2
|
import type { FormKitBaseSlots, FormKitInputs } from '@formkit/inputs';
|
|
2
3
|
import type { CalendarSlots, CheckboxSlots, CheckboxGroupSlots, EditorSlots, FileUploadSlots, RadioGroupSlots, InputSlots, TextareaSlots, SelectSlots, SelectMenuSlots, InputDateSlots, InputMenuSlots, InputNumberSlots, InputTagsSlots, InputTimeSlots, ListboxSlots, SwitchSlots } from '@nuxt/ui';
|
|
4
|
+
export * from './createNuxtUiFormkitConfig.js';
|
|
3
5
|
export * from './definitions/index.js';
|
|
4
6
|
export * from './plugins/index.js';
|
|
5
7
|
/**
|
|
@@ -47,6 +49,9 @@ declare module '@formkit/inputs' {
|
|
|
47
49
|
nuxtUIListbox: {
|
|
48
50
|
type: 'nuxtUIListbox';
|
|
49
51
|
};
|
|
52
|
+
nuxtUIMultiStep: {
|
|
53
|
+
type: 'nuxtUIMultiStep';
|
|
54
|
+
};
|
|
50
55
|
nuxtUIPinInput: {
|
|
51
56
|
type: 'nuxtUIPinInput';
|
|
52
57
|
};
|
|
@@ -62,6 +67,9 @@ declare module '@formkit/inputs' {
|
|
|
62
67
|
nuxtUISlider: {
|
|
63
68
|
type: 'nuxtUISlider';
|
|
64
69
|
};
|
|
70
|
+
nuxtUIStep: {
|
|
71
|
+
type: 'nuxtUIStep';
|
|
72
|
+
};
|
|
65
73
|
nuxtUISwitch: {
|
|
66
74
|
type: 'nuxtUISwitch';
|
|
67
75
|
};
|
|
@@ -100,9 +108,11 @@ declare module '@formkit/inputs' {
|
|
|
100
108
|
nuxtUIInputTags: MergeSlots<FormKitBaseSlots<Props>, InputTagsSlots>;
|
|
101
109
|
nuxtUIInputTime: MergeSlots<FormKitBaseSlots<Props>, InputTimeSlots>;
|
|
102
110
|
nuxtUIListbox: MergeSlots<FormKitBaseSlots<Props>, ListboxSlots>;
|
|
111
|
+
nuxtUIMultiStep: MergeSlots<FormKitBaseSlots<Props>, FormKitMultiStepSlots<Props>>;
|
|
103
112
|
nuxtUIRadioGroup: MergeSlots<FormKitBaseSlots<Props>, RadioGroupSlots>;
|
|
104
113
|
nuxtUISelect: MergeSlots<FormKitBaseSlots<Props>, SelectSlots>;
|
|
105
114
|
nuxtUISelectMenu: MergeSlots<FormKitBaseSlots<Props>, SelectMenuSlots>;
|
|
115
|
+
nuxtUIStep: MergeSlots<FormKitBaseSlots<Props>, FormKitStepSlots<Props>>;
|
|
106
116
|
nuxtUISwitch: MergeSlots<FormKitBaseSlots<Props>, SwitchSlots>;
|
|
107
117
|
nuxtUITextarea: MergeSlots<FormKitBaseSlots<Props>, TextareaSlots>;
|
|
108
118
|
}
|
package/dist/runtime/plugin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { defineNuxtPlugin } from "#app";
|
|
2
|
-
import { UButton, UIcon } from "#components";
|
|
2
|
+
import { UButton, UIcon, UTabs } from "#components";
|
|
3
3
|
export default defineNuxtPlugin((_nuxtApp) => {
|
|
4
4
|
_nuxtApp.vueApp.component("UButton", UButton);
|
|
5
5
|
_nuxtApp.vueApp.component("UIcon", UIcon);
|
|
6
|
+
_nuxtApp.vueApp.component("UTabs", UTabs);
|
|
6
7
|
});
|