@sfxcode/nuxt-ui-formkit 1.2.5 → 1.2.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/README.md +2 -1
- package/dist/module.json +1 -1
- package/dist/runtime/components/FUAutoForm.d.vue.ts +3 -3
- package/dist/runtime/components/FUAutoForm.vue +6 -3
- package/dist/runtime/components/FUAutoForm.vue.d.ts +3 -3
- package/dist/runtime/components/inputs/FUCheckbox.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue +1 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue +1 -1
- package/dist/runtime/components/inputs/FUFileUpload.vue +1 -1
- package/dist/runtime/components/inputs/FUInputMenu.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUInputMenu.vue +1 -0
- package/dist/runtime/components/inputs/FUInputMenu.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FUListbox.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUListbox.vue +3 -0
- package/dist/runtime/components/inputs/FUListbox.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FUPinInput.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUPinInput.vue +1 -0
- package/dist/runtime/components/inputs/FUPinInput.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FURadioGroup.vue +1 -1
- package/dist/runtime/components/inputs/FUSelect.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUSelect.vue +1 -0
- package/dist/runtime/components/inputs/FUSelect.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FUSelectMenu.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUSelectMenu.vue +1 -0
- package/dist/runtime/components/inputs/FUSelectMenu.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FUSlider.vue +1 -1
- package/dist/runtime/components/inputs/FUSwitch.d.vue.ts +1 -0
- package/dist/runtime/components/inputs/FUSwitch.vue +1 -0
- package/dist/runtime/components/inputs/FUSwitch.vue.d.ts +1 -0
- package/dist/runtime/components/inputs/FUTree.d.vue.ts +36 -0
- package/dist/runtime/components/inputs/FUTree.vue +52 -0
- package/dist/runtime/components/inputs/FUTree.vue.d.ts +36 -0
- package/dist/runtime/composables/useFormKitAutoForm.d.ts +2 -0
- package/dist/runtime/composables/useFormKitAutoForm.js +86 -1
- package/dist/runtime/formkit/definitions/index.d.ts +1 -0
- package/dist/runtime/formkit/definitions/index.js +2 -1
- package/dist/runtime/formkit/definitions/index.mjs +2 -1
- package/dist/runtime/formkit/definitions/input.d.ts +1 -0
- package/dist/runtime/formkit/definitions/input.js +12 -7
- package/dist/runtime/formkit/definitions/input.mjs +12 -7
- package/dist/runtime/formkit/definitions/multiStep.js +8 -4
- package/dist/runtime/formkit/definitions/multiStep.mjs +8 -4
- package/dist/runtime/formkit/index.d.ts +5 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ FormKit Nuxt UI bridges the gap between [FormKit](https://formkit.com/)'s powerf
|
|
|
18
18
|
|
|
19
19
|
## Features
|
|
20
20
|
|
|
21
|
-
✨ **
|
|
21
|
+
✨ **21 Input Components** - Complete set of FormKit-wrapped Nuxt UI input components
|
|
22
22
|
- `nuxtUICalendar` - Bare date-grid picker with range/multiple selection
|
|
23
23
|
- `nuxtUICheckbox` - Single checkbox with label and description
|
|
24
24
|
- `nuxtUICheckboxGroup` - Multiple checkbox selection
|
|
@@ -39,6 +39,7 @@ FormKit Nuxt UI bridges the gap between [FormKit](https://formkit.com/)'s powerf
|
|
|
39
39
|
- `nuxtUISlider` - Range slider for numeric values
|
|
40
40
|
- `nuxtUISwitch` - Toggle switch for boolean states
|
|
41
41
|
- `nuxtUITextarea` - Multi-line text input with autoresize
|
|
42
|
+
- `nuxtUITree` - Hierarchical selection input (categories, org charts, file trees)
|
|
42
43
|
|
|
43
44
|
🔁 **Repeater Component** - Dynamic repeatable form sections
|
|
44
45
|
- `nuxtUIRepeater` - Create dynamic lists with add, remove, clone, and reorder functionality
|
package/dist/module.json
CHANGED
|
@@ -6,7 +6,7 @@ type __VLS_Slots = {} & {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
data: {
|
|
9
|
-
type: PropType<Record<string, unknown
|
|
9
|
+
type: PropType<Record<string, unknown> | Record<string, unknown>[]>;
|
|
10
10
|
default: null;
|
|
11
11
|
};
|
|
12
12
|
overrides: {
|
|
@@ -28,7 +28,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
28
28
|
"update:modelValue": (value: Record<string, unknown> | undefined) => any;
|
|
29
29
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
30
|
data: {
|
|
31
|
-
type: PropType<Record<string, unknown
|
|
31
|
+
type: PropType<Record<string, unknown> | Record<string, unknown>[]>;
|
|
32
32
|
default: null;
|
|
33
33
|
};
|
|
34
34
|
overrides: {
|
|
@@ -49,7 +49,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
49
49
|
}>> & Readonly<{
|
|
50
50
|
"onUpdate:modelValue"?: ((value: Record<string, unknown> | undefined) => any) | undefined;
|
|
51
51
|
}>, {
|
|
52
|
-
data: Record<string, unknown
|
|
52
|
+
data: Record<string, unknown> | Record<string, unknown>[];
|
|
53
53
|
overrides: AutoFormOverrides;
|
|
54
54
|
valibotSchema: ValibotLikeSchema;
|
|
55
55
|
zodSchema: ZodLikeSchema;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { ref, watch } from "vue";
|
|
3
|
-
import { inferFormSchema, inferFormSchemaFromValibot, inferFormSchemaFromZod } from "../composables/useFormKitAutoForm";
|
|
3
|
+
import { inferFormSchema, inferFormSchemaFromSamples, inferFormSchemaFromValibot, inferFormSchemaFromZod } from "../composables/useFormKitAutoForm";
|
|
4
4
|
import FUDataEdit from "./FUDataEdit.vue";
|
|
5
5
|
defineOptions({ inheritAttrs: false });
|
|
6
6
|
const props = defineProps({
|
|
7
7
|
data: {
|
|
8
|
-
type: Object,
|
|
8
|
+
type: [Object, Array],
|
|
9
9
|
default: null
|
|
10
10
|
},
|
|
11
11
|
overrides: {
|
|
@@ -22,7 +22,7 @@ const props = defineProps({
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
const formData = defineModel({ type: Object });
|
|
25
|
-
if (!formData.value && props.data) {
|
|
25
|
+
if (!formData.value && props.data && !Array.isArray(props.data)) {
|
|
26
26
|
formData.value = props.data;
|
|
27
27
|
}
|
|
28
28
|
function buildSchema(data) {
|
|
@@ -32,6 +32,9 @@ function buildSchema(data) {
|
|
|
32
32
|
if (props.zodSchema) {
|
|
33
33
|
return inferFormSchemaFromZod(props.zodSchema, props.overrides);
|
|
34
34
|
}
|
|
35
|
+
if (Array.isArray(data)) {
|
|
36
|
+
return inferFormSchemaFromSamples(data, props.overrides);
|
|
37
|
+
}
|
|
35
38
|
return inferFormSchema(data ?? formData.value ?? {}, props.overrides);
|
|
36
39
|
}
|
|
37
40
|
const formSchema = ref(buildSchema(props.data));
|
|
@@ -6,7 +6,7 @@ type __VLS_Slots = {} & {
|
|
|
6
6
|
};
|
|
7
7
|
declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
8
8
|
data: {
|
|
9
|
-
type: PropType<Record<string, unknown
|
|
9
|
+
type: PropType<Record<string, unknown> | Record<string, unknown>[]>;
|
|
10
10
|
default: null;
|
|
11
11
|
};
|
|
12
12
|
overrides: {
|
|
@@ -28,7 +28,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
28
28
|
"update:modelValue": (value: Record<string, unknown> | undefined) => any;
|
|
29
29
|
}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
30
|
data: {
|
|
31
|
-
type: PropType<Record<string, unknown
|
|
31
|
+
type: PropType<Record<string, unknown> | Record<string, unknown>[]>;
|
|
32
32
|
default: null;
|
|
33
33
|
};
|
|
34
34
|
overrides: {
|
|
@@ -49,7 +49,7 @@ declare const __VLS_base: import("vue").DefineComponent<import("vue").ExtractPro
|
|
|
49
49
|
}>> & Readonly<{
|
|
50
50
|
"onUpdate:modelValue"?: ((value: Record<string, unknown> | undefined) => any) | undefined;
|
|
51
51
|
}>, {
|
|
52
|
-
data: Record<string, unknown
|
|
52
|
+
data: Record<string, unknown> | Record<string, unknown>[];
|
|
53
53
|
overrides: AutoFormOverrides;
|
|
54
54
|
valibotSchema: ValibotLikeSchema;
|
|
55
55
|
zodSchema: ZodLikeSchema;
|
|
@@ -12,6 +12,7 @@ export interface FormKitCheckboxProps {
|
|
|
12
12
|
trueValue?: unknown;
|
|
13
13
|
falseValue?: unknown;
|
|
14
14
|
autofocus?: false | true | 'true' | 'false';
|
|
15
|
+
name?: string;
|
|
15
16
|
ui?: Record<string, unknown>;
|
|
16
17
|
}
|
|
17
18
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -12,6 +12,7 @@ export interface FormKitCheckboxProps {
|
|
|
12
12
|
trueValue?: unknown;
|
|
13
13
|
falseValue?: unknown;
|
|
14
14
|
autofocus?: false | true | 'true' | 'false';
|
|
15
|
+
name?: string;
|
|
15
16
|
ui?: Record<string, unknown>;
|
|
16
17
|
}
|
|
17
18
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -30,7 +30,7 @@ const handleContainerBlur = createContainerBlurHandler(props.context);
|
|
|
30
30
|
:label-key="context.labelKey"
|
|
31
31
|
:description-key="context.descriptionKey"
|
|
32
32
|
:loop="context.loop ?? false"
|
|
33
|
-
:name="context.name"
|
|
33
|
+
:name="context.node.name"
|
|
34
34
|
:ui="ui"
|
|
35
35
|
@change="handleChange"
|
|
36
36
|
@update:model-value="handleInput"
|
|
@@ -37,7 +37,7 @@ const { handleInput, handleChange, handleBlur, isInvalid, styleClass, color, mod
|
|
|
37
37
|
:file-delete="context.fileDelete"
|
|
38
38
|
:file-delete-icon="context.fileDeleteIcon"
|
|
39
39
|
:preview="context.preview"
|
|
40
|
-
:name="context.name"
|
|
40
|
+
:name="context.node.name"
|
|
41
41
|
:ui="ui"
|
|
42
42
|
@change="handleChange"
|
|
43
43
|
@update:model-value="handleInput"
|
|
@@ -60,6 +60,7 @@ export interface FormKitInputMenuProps {
|
|
|
60
60
|
list?: string;
|
|
61
61
|
autocomplete?: string & {} | 'on' | 'off';
|
|
62
62
|
searchTerm?: string;
|
|
63
|
+
name?: string;
|
|
63
64
|
ui?: Record<string, unknown>;
|
|
64
65
|
}
|
|
65
66
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -60,6 +60,7 @@ export interface FormKitInputMenuProps {
|
|
|
60
60
|
list?: string;
|
|
61
61
|
autocomplete?: string & {} | 'on' | 'off';
|
|
62
62
|
searchTerm?: string;
|
|
63
|
+
name?: string;
|
|
63
64
|
ui?: Record<string, unknown>;
|
|
64
65
|
}
|
|
65
66
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -49,6 +49,7 @@ export interface FormKitListboxProps {
|
|
|
49
49
|
autofocus?: boolean;
|
|
50
50
|
autofocusDelay?: number;
|
|
51
51
|
searchTerm?: string;
|
|
52
|
+
name?: string;
|
|
52
53
|
ui?: Record<string, unknown>;
|
|
53
54
|
}
|
|
54
55
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -212,6 +212,7 @@ watch(targetItems, (newVal) => {
|
|
|
212
212
|
v-if="!context.displayMode || context.displayMode === 'single'"
|
|
213
213
|
:id="context.id"
|
|
214
214
|
v-model="modelValue"
|
|
215
|
+
:name="context.node.name"
|
|
215
216
|
v-bind="{ ...context?.attrs }"
|
|
216
217
|
:class="styleClass"
|
|
217
218
|
:style="context?.attrs.style"
|
|
@@ -278,6 +279,7 @@ watch(targetItems, (newVal) => {
|
|
|
278
279
|
<UListbox
|
|
279
280
|
:id="context.id + '-transfer-left'"
|
|
280
281
|
v-model="sourceSelection"
|
|
282
|
+
:name="context.node.name + '-transfer-left'"
|
|
281
283
|
v-bind="{ ...context?.attrs }"
|
|
282
284
|
:class="styleClass"
|
|
283
285
|
:style="context?.attrs.style"
|
|
@@ -380,6 +382,7 @@ watch(targetItems, (newVal) => {
|
|
|
380
382
|
<UListbox
|
|
381
383
|
:id="context.id + '-transfer-right'"
|
|
382
384
|
v-model="targetSelection"
|
|
385
|
+
:name="context.node.name + '-transfer-right'"
|
|
383
386
|
v-bind="{ ...context?.attrs }"
|
|
384
387
|
:class="styleClass"
|
|
385
388
|
:style="context?.attrs.style"
|
|
@@ -49,6 +49,7 @@ export interface FormKitListboxProps {
|
|
|
49
49
|
autofocus?: boolean;
|
|
50
50
|
autofocusDelay?: number;
|
|
51
51
|
searchTerm?: string;
|
|
52
|
+
name?: string;
|
|
52
53
|
ui?: Record<string, unknown>;
|
|
53
54
|
}
|
|
54
55
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -15,6 +15,7 @@ export interface FormKitPinInputProps {
|
|
|
15
15
|
separator?: number | number[];
|
|
16
16
|
type?: 'text' | 'number';
|
|
17
17
|
placeholder?: string;
|
|
18
|
+
name?: string;
|
|
18
19
|
ui?: Record<string, unknown>;
|
|
19
20
|
}
|
|
20
21
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -15,6 +15,7 @@ export interface FormKitPinInputProps {
|
|
|
15
15
|
separator?: number | number[];
|
|
16
16
|
type?: 'text' | 'number';
|
|
17
17
|
placeholder?: string;
|
|
18
|
+
name?: string;
|
|
18
19
|
ui?: Record<string, unknown>;
|
|
19
20
|
}
|
|
20
21
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -29,7 +29,7 @@ const handleContainerBlur = createContainerBlurHandler(props.context);
|
|
|
29
29
|
:label-key="context.labelKey"
|
|
30
30
|
:description-key="context.descriptionKey"
|
|
31
31
|
:loop="context.loop ?? false"
|
|
32
|
-
:name="context.name"
|
|
32
|
+
:name="context.node.name"
|
|
33
33
|
:ui="ui"
|
|
34
34
|
@change="handleChange"
|
|
35
35
|
@update:model-value="handleInput"
|
|
@@ -58,6 +58,7 @@ export interface FormKitSelectMenuProps {
|
|
|
58
58
|
resetModelValueOnClear?: boolean;
|
|
59
59
|
highlightOnHover?: boolean;
|
|
60
60
|
searchTerm?: string;
|
|
61
|
+
name?: string;
|
|
61
62
|
ui?: Record<string, unknown>;
|
|
62
63
|
}
|
|
63
64
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -58,6 +58,7 @@ export interface FormKitSelectMenuProps {
|
|
|
58
58
|
resetModelValueOnClear?: boolean;
|
|
59
59
|
highlightOnHover?: boolean;
|
|
60
60
|
searchTerm?: string;
|
|
61
|
+
name?: string;
|
|
61
62
|
ui?: Record<string, unknown>;
|
|
62
63
|
}
|
|
63
64
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -23,7 +23,7 @@ const { handleInput, handleChange, styleClass, color, modelValue, ui } = useForm
|
|
|
23
23
|
:orientation="context.orientation ?? 'horizontal'"
|
|
24
24
|
:tooltip="context.tooltip"
|
|
25
25
|
:default-value="context.defaultValue"
|
|
26
|
-
:name="context.name"
|
|
26
|
+
:name="context.node.name"
|
|
27
27
|
:inverted="context.inverted"
|
|
28
28
|
:min="context.min"
|
|
29
29
|
:max="context.max"
|
|
@@ -13,6 +13,7 @@ export interface FormKitSwitchProps {
|
|
|
13
13
|
trueValue?: unknown;
|
|
14
14
|
falseValue?: unknown;
|
|
15
15
|
autofocus?: false | true | 'true' | 'false';
|
|
16
|
+
name?: string;
|
|
16
17
|
ui?: Record<string, unknown>;
|
|
17
18
|
}
|
|
18
19
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -13,6 +13,7 @@ export interface FormKitSwitchProps {
|
|
|
13
13
|
trueValue?: unknown;
|
|
14
14
|
falseValue?: unknown;
|
|
15
15
|
autofocus?: false | true | 'true' | 'false';
|
|
16
|
+
name?: string;
|
|
16
17
|
ui?: Record<string, unknown>;
|
|
17
18
|
}
|
|
18
19
|
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
export interface FormKitTreeProps {
|
|
4
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
5
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
nested?: boolean;
|
|
9
|
+
virtualize?: boolean | {
|
|
10
|
+
overscan?: number;
|
|
11
|
+
estimateSize?: number | ((index: number) => number);
|
|
12
|
+
};
|
|
13
|
+
labelKey?: string;
|
|
14
|
+
trailingIcon?: string;
|
|
15
|
+
expandedIcon?: string;
|
|
16
|
+
collapsedIcon?: string;
|
|
17
|
+
expanded?: string[];
|
|
18
|
+
defaultExpanded?: string[];
|
|
19
|
+
selectionBehavior?: 'toggle' | 'replace';
|
|
20
|
+
propagateSelect?: boolean;
|
|
21
|
+
bubbleSelect?: boolean;
|
|
22
|
+
ui?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
25
|
+
context: {
|
|
26
|
+
type: PropType<FormKitFrameworkContext & FormKitTreeProps>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
|
+
context: {
|
|
31
|
+
type: PropType<FormKitFrameworkContext & FormKitTreeProps>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { useFormKitInput } from "../../utils/useFormKitInput";
|
|
3
|
+
import { createContainerBlurHandler } from "../../utils/useFormKitContainerBlur";
|
|
4
|
+
const props = defineProps({
|
|
5
|
+
context: {
|
|
6
|
+
type: Object,
|
|
7
|
+
required: true
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
const { handleInput, styleClass, color, modelValue, items, validSlotNames, ui } = useFormKitInput(props.context);
|
|
11
|
+
const handleContainerBlur = createContainerBlurHandler(props.context);
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<UTree
|
|
16
|
+
:id="context.id"
|
|
17
|
+
v-model="modelValue"
|
|
18
|
+
v-bind="{ ...context?.attrs }"
|
|
19
|
+
:class="styleClass"
|
|
20
|
+
:style="context?.attrs.style"
|
|
21
|
+
:color="color"
|
|
22
|
+
:size="context.size ?? 'md'"
|
|
23
|
+
:items="items"
|
|
24
|
+
:disabled="!!context?.disabled"
|
|
25
|
+
:multiple="context.multiple"
|
|
26
|
+
:nested="context.nested ?? true"
|
|
27
|
+
:virtualize="context.virtualize"
|
|
28
|
+
:label-key="context.labelKey"
|
|
29
|
+
:trailing-icon="context.trailingIcon"
|
|
30
|
+
:expanded-icon="context.expandedIcon"
|
|
31
|
+
:collapsed-icon="context.collapsedIcon"
|
|
32
|
+
:expanded="context.expanded"
|
|
33
|
+
:default-expanded="context.defaultExpanded"
|
|
34
|
+
:selection-behavior="context.selectionBehavior"
|
|
35
|
+
:propagate-select="context.propagateSelect"
|
|
36
|
+
:bubble-select="context.bubbleSelect"
|
|
37
|
+
:ui="ui"
|
|
38
|
+
@update:model-value="handleInput"
|
|
39
|
+
@focusout="handleContainerBlur"
|
|
40
|
+
>
|
|
41
|
+
<template
|
|
42
|
+
v-for="slotName in validSlotNames"
|
|
43
|
+
:key="slotName"
|
|
44
|
+
#[slotName]="slotProps"
|
|
45
|
+
>
|
|
46
|
+
<component
|
|
47
|
+
:is="context?.slots[slotName]"
|
|
48
|
+
v-bind="{ ...context, ...slotProps }"
|
|
49
|
+
/>
|
|
50
|
+
</template>
|
|
51
|
+
</UTree>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
export interface FormKitTreeProps {
|
|
4
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
5
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
multiple?: boolean;
|
|
8
|
+
nested?: boolean;
|
|
9
|
+
virtualize?: boolean | {
|
|
10
|
+
overscan?: number;
|
|
11
|
+
estimateSize?: number | ((index: number) => number);
|
|
12
|
+
};
|
|
13
|
+
labelKey?: string;
|
|
14
|
+
trailingIcon?: string;
|
|
15
|
+
expandedIcon?: string;
|
|
16
|
+
collapsedIcon?: string;
|
|
17
|
+
expanded?: string[];
|
|
18
|
+
defaultExpanded?: string[];
|
|
19
|
+
selectionBehavior?: 'toggle' | 'replace';
|
|
20
|
+
propagateSelect?: boolean;
|
|
21
|
+
bubbleSelect?: boolean;
|
|
22
|
+
ui?: Record<string, unknown>;
|
|
23
|
+
}
|
|
24
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
25
|
+
context: {
|
|
26
|
+
type: PropType<FormKitFrameworkContext & FormKitTreeProps>;
|
|
27
|
+
required: true;
|
|
28
|
+
};
|
|
29
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
30
|
+
context: {
|
|
31
|
+
type: PropType<FormKitFrameworkContext & FormKitTreeProps>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
35
|
+
declare const _default: typeof __VLS_export;
|
|
36
|
+
export default _default;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { FormKitSchemaNode } from '@formkit/core';
|
|
2
2
|
export type AutoFormOverrides = Record<string, Record<string, unknown> | boolean>;
|
|
3
3
|
export declare function inferFormSchema(data: Record<string, unknown>, overrides?: AutoFormOverrides): FormKitSchemaNode[];
|
|
4
|
+
export declare function inferFormSchemaFromSamples(samples: Record<string, unknown>[], overrides?: AutoFormOverrides): FormKitSchemaNode[];
|
|
4
5
|
export interface ValibotLikePipeEntry {
|
|
5
6
|
kind: string;
|
|
6
7
|
type: string;
|
|
@@ -33,6 +34,7 @@ export interface ZodLikeSchema {
|
|
|
33
34
|
export declare function inferFormSchemaFromZod(schema: object, overrides?: AutoFormOverrides): FormKitSchemaNode[];
|
|
34
35
|
export declare function useFormKitAutoForm(): {
|
|
35
36
|
inferFormSchema: typeof inferFormSchema;
|
|
37
|
+
inferFormSchemaFromSamples: typeof inferFormSchemaFromSamples;
|
|
36
38
|
inferFormSchemaFromValibot: typeof inferFormSchemaFromValibot;
|
|
37
39
|
inferFormSchemaFromZod: typeof inferFormSchemaFromZod;
|
|
38
40
|
};
|
|
@@ -127,6 +127,91 @@ function inferNodes(data, overrides, pathPrefix = "") {
|
|
|
127
127
|
export function inferFormSchema(data, overrides) {
|
|
128
128
|
return inferNodes(data, overrides);
|
|
129
129
|
}
|
|
130
|
+
function isFilled(value) {
|
|
131
|
+
if (value === void 0 || value === null) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
if (typeof value === "string") {
|
|
135
|
+
return value !== "";
|
|
136
|
+
}
|
|
137
|
+
if (Array.isArray(value)) {
|
|
138
|
+
return value.length > 0;
|
|
139
|
+
}
|
|
140
|
+
return true;
|
|
141
|
+
}
|
|
142
|
+
function transposeSamples(samples) {
|
|
143
|
+
const columns = {};
|
|
144
|
+
for (const sample of samples) {
|
|
145
|
+
for (const key of Object.keys(sample)) {
|
|
146
|
+
columns[key] ??= samples.map((entry) => entry[key]);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return columns;
|
|
150
|
+
}
|
|
151
|
+
function inferSampleNode(name, values, overrides, path) {
|
|
152
|
+
const presentValues = values.filter((value) => value !== void 0 && value !== null);
|
|
153
|
+
if (presentValues.length === 0) {
|
|
154
|
+
return void 0;
|
|
155
|
+
}
|
|
156
|
+
const filledValues = presentValues.filter(isFilled);
|
|
157
|
+
const required = filledValues.length === values.length;
|
|
158
|
+
const representative = filledValues[0] ?? presentValues[0];
|
|
159
|
+
const label = humanizeKey(name);
|
|
160
|
+
const validation = required && typeof representative !== "boolean" ? "required" : void 0;
|
|
161
|
+
const base = validation ? { name, label, validation } : { name, label };
|
|
162
|
+
if (typeof representative === "boolean") {
|
|
163
|
+
return { $formkit: "nuxtUISwitch", ...base };
|
|
164
|
+
}
|
|
165
|
+
if (typeof representative === "number") {
|
|
166
|
+
return { $formkit: "nuxtUIInputNumber", ...base };
|
|
167
|
+
}
|
|
168
|
+
if (representative instanceof Date) {
|
|
169
|
+
return { $formkit: "nuxtUIInputDate", ...base, valueType: "date" };
|
|
170
|
+
}
|
|
171
|
+
if (isDateValue(representative)) {
|
|
172
|
+
return { $formkit: "nuxtUIInputDate", ...base, valueType: "calendar" };
|
|
173
|
+
}
|
|
174
|
+
if (typeof representative === "string") {
|
|
175
|
+
if (isIsoDateString(representative)) {
|
|
176
|
+
return { $formkit: "nuxtUIInputDate", ...base, valueType: "iso" };
|
|
177
|
+
}
|
|
178
|
+
if (representative.includes("\n")) {
|
|
179
|
+
return { $formkit: "nuxtUITextarea", ...base };
|
|
180
|
+
}
|
|
181
|
+
return { $formkit: "nuxtUIInput", ...base };
|
|
182
|
+
}
|
|
183
|
+
if (Array.isArray(representative)) {
|
|
184
|
+
const [first] = representative;
|
|
185
|
+
if (isPlainObject(first)) {
|
|
186
|
+
const rows = presentValues.filter(Array.isArray).flat().filter(isPlainObject);
|
|
187
|
+
return {
|
|
188
|
+
$formkit: "nuxtUIRepeater",
|
|
189
|
+
...base,
|
|
190
|
+
newItem: blankItem(rows[0] ?? first),
|
|
191
|
+
children: inferSampleNodes(rows, overrides, path),
|
|
192
|
+
...REPEATER_BUTTON_DEFAULTS
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return { $formkit: "nuxtUIInputTags", ...base };
|
|
196
|
+
}
|
|
197
|
+
if (isPlainObject(representative)) {
|
|
198
|
+
return { $formkit: "group", name, children: inferSampleNodes(presentValues.filter(isPlainObject), overrides, path) };
|
|
199
|
+
}
|
|
200
|
+
return void 0;
|
|
201
|
+
}
|
|
202
|
+
function inferSampleNodes(samples, overrides, pathPrefix = "") {
|
|
203
|
+
return buildNodes(transposeSamples(samples), (key, values, path) => inferSampleNode(key, values, overrides, path), overrides, pathPrefix);
|
|
204
|
+
}
|
|
205
|
+
export function inferFormSchemaFromSamples(samples, overrides) {
|
|
206
|
+
if (!Array.isArray(samples)) {
|
|
207
|
+
return [];
|
|
208
|
+
}
|
|
209
|
+
const records = samples.filter(isPlainObject);
|
|
210
|
+
if (records.length === 0) {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
return inferSampleNodes(records, overrides);
|
|
214
|
+
}
|
|
130
215
|
const OPTIONAL_WRAPPER_TYPES = /* @__PURE__ */ new Set(["optional", "nullable", "nullish", "exact_optional"]);
|
|
131
216
|
function unwrapValibot(entry) {
|
|
132
217
|
let schema = entry;
|
|
@@ -345,5 +430,5 @@ export function inferFormSchemaFromZod(schema, overrides) {
|
|
|
345
430
|
return inferZodNodes(root.shape, overrides);
|
|
346
431
|
}
|
|
347
432
|
export function useFormKitAutoForm() {
|
|
348
|
-
return { inferFormSchema, inferFormSchemaFromValibot, inferFormSchemaFromZod };
|
|
433
|
+
return { inferFormSchema, inferFormSchemaFromSamples, inferFormSchemaFromValibot, inferFormSchemaFromZod };
|
|
349
434
|
}
|
|
@@ -24,6 +24,7 @@ export declare const nuxtUIInputs: {
|
|
|
24
24
|
nuxtUIStep: import("@formkit/core").FormKitTypeDefinition;
|
|
25
25
|
nuxtUISwitch: import("@formkit/core").FormKitTypeDefinition;
|
|
26
26
|
nuxtUITextarea: import("@formkit/core").FormKitTypeDefinition;
|
|
27
|
+
nuxtUITree: import("@formkit/core").FormKitTypeDefinition;
|
|
27
28
|
nuxtUIRepeater: import("@formkit/core").FormKitTypeDefinition;
|
|
28
29
|
};
|
|
29
30
|
export declare const nuxtUIOutputs: {
|
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
import { nuxtUICalendarDefinition, nuxtUICheckboxDefinition, nuxtUICheckboxGroupDefinition, nuxtUIColorPickerDefinition, nuxtUIEditorDefinition, nuxtUIFileUploadDefinition, nuxtUIInputDateDefinition, nuxtUIInputDefinition, nuxtUIInputMenuDefinition, nuxtUIInputNumberDefinition, nuxtUIInputTagsDefinition, nuxtUIInputTimeDefinition, nuxtUIListboxDefinition, nuxtUIPinInputDefinition, nuxtUIRadioGroupDefinition, nuxtUISelectDefinition, nuxtUISelectMenuDefinition, nuxtUISliderDefinition, nuxtUISwitchDefinition, nuxtUITextareaDefinition, nuxtUITreeDefinition } from "./input.js";
|
|
2
2
|
import { nuxtUIMultiStepDefinition, nuxtUIStepDefinition } from "./multiStep.js";
|
|
3
3
|
import { nuxtUIOutputBooleanDefinition, nuxtUIOutputDateDefinition, nuxtUIOutputLinkDefinition, nuxtUIOutputListDefinition, nuxtUIOutputNumberDefinition, nuxtUIOutputTextDefinition } from "./output.js";
|
|
4
4
|
import { nuxtUIRepeaterDefinition } from "./repeater.js";
|
|
@@ -28,6 +28,7 @@ export const nuxtUIInputs = {
|
|
|
28
28
|
nuxtUIStep: nuxtUIStepDefinition,
|
|
29
29
|
nuxtUISwitch: nuxtUISwitchDefinition,
|
|
30
30
|
nuxtUITextarea: nuxtUITextareaDefinition,
|
|
31
|
+
nuxtUITree: nuxtUITreeDefinition,
|
|
31
32
|
nuxtUIRepeater: nuxtUIRepeaterDefinition
|
|
32
33
|
};
|
|
33
34
|
export const nuxtUIOutputs = {
|
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
1
|
+
import { nuxtUICalendarDefinition, nuxtUICheckboxDefinition, nuxtUICheckboxGroupDefinition, nuxtUIColorPickerDefinition, nuxtUIEditorDefinition, nuxtUIFileUploadDefinition, nuxtUIInputDateDefinition, nuxtUIInputDefinition, nuxtUIInputMenuDefinition, nuxtUIInputNumberDefinition, nuxtUIInputTagsDefinition, nuxtUIInputTimeDefinition, nuxtUIListboxDefinition, nuxtUIPinInputDefinition, nuxtUIRadioGroupDefinition, nuxtUISelectDefinition, nuxtUISelectMenuDefinition, nuxtUISliderDefinition, nuxtUISwitchDefinition, nuxtUITextareaDefinition, nuxtUITreeDefinition } from "./input.mjs";
|
|
2
2
|
import { nuxtUIMultiStepDefinition, nuxtUIStepDefinition } from "./multiStep.mjs";
|
|
3
3
|
import { nuxtUIOutputBooleanDefinition, nuxtUIOutputDateDefinition, nuxtUIOutputLinkDefinition, nuxtUIOutputListDefinition, nuxtUIOutputNumberDefinition, nuxtUIOutputTextDefinition } from "./output.mjs";
|
|
4
4
|
import { nuxtUIRepeaterDefinition } from "./repeater.mjs";
|
|
@@ -28,6 +28,7 @@ export const nuxtUIInputs = {
|
|
|
28
28
|
nuxtUIStep: nuxtUIStepDefinition,
|
|
29
29
|
nuxtUISwitch: nuxtUISwitchDefinition,
|
|
30
30
|
nuxtUITextarea: nuxtUITextareaDefinition,
|
|
31
|
+
nuxtUITree: nuxtUITreeDefinition,
|
|
31
32
|
nuxtUIRepeater: nuxtUIRepeaterDefinition
|
|
32
33
|
};
|
|
33
34
|
export const nuxtUIOutputs = {
|
|
@@ -19,3 +19,4 @@ export declare const nuxtUISelectMenuDefinition: FormKitTypeDefinition;
|
|
|
19
19
|
export declare const nuxtUISliderDefinition: FormKitTypeDefinition;
|
|
20
20
|
export declare const nuxtUISwitchDefinition: FormKitTypeDefinition;
|
|
21
21
|
export declare const nuxtUITextareaDefinition: FormKitTypeDefinition;
|
|
22
|
+
export declare const nuxtUITreeDefinition: FormKitTypeDefinition;
|
|
@@ -19,12 +19,13 @@ import FUSelectMenu from "../../../runtime/components/inputs/FUSelectMenu.vue";
|
|
|
19
19
|
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
|
+
import FUTree from "../../../runtime/components/inputs/FUTree.vue";
|
|
22
23
|
export const nuxtUICalendarDefinition = createInput(FUCalendar, {
|
|
23
24
|
props: ["type", "range", "multiple", "color", "variant", "size", "weekNumbers", "monthControls", "yearControls", "viewControl", "defaultValue", "minValue", "maxValue", "isDateDisabled", "isDateUnavailable", "ui", "valueType", "timeZone"],
|
|
24
25
|
family: "NuxtUIInput"
|
|
25
26
|
});
|
|
26
27
|
export const nuxtUICheckboxDefinition = createInput(FUCheckbox, {
|
|
27
|
-
props: ["label", "description", "color", "variant", "size", "indicator", "icon", "indeterminateIcon", "trueValue", "falseValue", "autofocus", "ui"],
|
|
28
|
+
props: ["label", "description", "color", "variant", "size", "indicator", "icon", "indeterminateIcon", "trueValue", "falseValue", "autofocus", "name", "ui"],
|
|
28
29
|
family: "NuxtUIInput"
|
|
29
30
|
});
|
|
30
31
|
export const nuxtUICheckboxGroupDefinition = createInput(FUCheckboxGroup, {
|
|
@@ -52,7 +53,7 @@ export const nuxtUIInputDateDefinition = createInput(FUInputDate, {
|
|
|
52
53
|
family: "NuxtUIInput"
|
|
53
54
|
});
|
|
54
55
|
export const nuxtUIInputMenuDefinition = createInput(FUInputMenu, {
|
|
55
|
-
props: ["options", "inputType", "placeholder", "color", "variant", "size", "autofocus", "autofocusDelay", "trailingIcon", "selectedIcon", "deleteIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "mode", "by", "open", "valueKey", "labelKey", "descriptionKey", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "icon", "leading", "leadingIcon", "trailing", "loading", "loadingIcon", "list", "autocomplete", "searchTerm", "ui"],
|
|
56
|
+
props: ["options", "inputType", "placeholder", "color", "variant", "size", "autofocus", "autofocusDelay", "trailingIcon", "selectedIcon", "deleteIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "mode", "by", "open", "valueKey", "labelKey", "descriptionKey", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "icon", "leading", "leadingIcon", "trailing", "loading", "loadingIcon", "list", "autocomplete", "searchTerm", "name", "ui"],
|
|
56
57
|
family: "NuxtUIInput"
|
|
57
58
|
});
|
|
58
59
|
export const nuxtUIInputNumberDefinition = createInput(FUInputNumber, {
|
|
@@ -68,11 +69,11 @@ export const nuxtUIInputTimeDefinition = createInput(FUInputTime, {
|
|
|
68
69
|
family: "NuxtUIInput"
|
|
69
70
|
});
|
|
70
71
|
export const nuxtUIListboxDefinition = createInput(FUListbox, {
|
|
71
|
-
props: ["options", "as", "color", "size", "by", "orientation", "selectionBehavior", "disabled", "defaultValue", "multiple", "valueKey", "labelKey", "descriptionKey", "loading", "loadingIcon", "filter", "filterFields", "ignoreFilter", "selectedIcon", "virtualize", "highlight", "highlightOnHover", "autofocus", "autofocusDelay", "searchTerm", "ui", "displayMode", "transferLeftHeaderText", "transferRightHeaderText", "transferAll", "transferHeaderClass", "transferSortIcons", "transferItemDraggable"],
|
|
72
|
+
props: ["options", "as", "color", "size", "by", "orientation", "selectionBehavior", "disabled", "defaultValue", "multiple", "valueKey", "labelKey", "descriptionKey", "loading", "loadingIcon", "filter", "filterFields", "ignoreFilter", "selectedIcon", "virtualize", "highlight", "highlightOnHover", "autofocus", "autofocusDelay", "searchTerm", "name", "ui", "displayMode", "transferLeftHeaderText", "transferRightHeaderText", "transferAll", "transferHeaderClass", "transferSortIcons", "transferItemDraggable"],
|
|
72
73
|
family: "NuxtUIInput"
|
|
73
74
|
});
|
|
74
75
|
export const nuxtUIPinInputDefinition = createInput(FUPinInput, {
|
|
75
|
-
props: ["color", "variant", "size", "length", "autofocus", "autofocusDelay", "highlight", "fixed", "defaultValue", "mask", "otp", "separator", "type", "placeholder", "ui"],
|
|
76
|
+
props: ["color", "variant", "size", "length", "autofocus", "autofocusDelay", "highlight", "fixed", "defaultValue", "mask", "otp", "separator", "type", "placeholder", "name", "ui"],
|
|
76
77
|
family: "NuxtUIInput"
|
|
77
78
|
});
|
|
78
79
|
export const nuxtUIRadioGroupDefinition = createInput(FURadioGroup, {
|
|
@@ -80,11 +81,11 @@ export const nuxtUIRadioGroupDefinition = createInput(FURadioGroup, {
|
|
|
80
81
|
family: "NuxtUIInput"
|
|
81
82
|
});
|
|
82
83
|
export const nuxtUISelectDefinition = createInput(FUSelect, {
|
|
83
|
-
props: ["options", "placeholder", "color", "variant", "size", "selectedIcon", "arrow", "portal", "content", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "autofocus", "autofocusDelay", "open", "defaultOpen", "autocomplete", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "ui"],
|
|
84
|
+
props: ["options", "placeholder", "color", "variant", "size", "selectedIcon", "arrow", "portal", "content", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "autofocus", "autofocusDelay", "open", "defaultOpen", "autocomplete", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "name", "ui"],
|
|
84
85
|
family: "NuxtUIInput"
|
|
85
86
|
});
|
|
86
87
|
export const nuxtUISelectMenuDefinition = createInput(FUSelectMenu, {
|
|
87
|
-
props: ["options", "placeholder", "searchInput", "color", "variant", "size", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "selectedIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "by", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "autofocus", "autofocusDelay", "open", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "searchTerm", "ui"],
|
|
88
|
+
props: ["options", "placeholder", "searchInput", "color", "variant", "size", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "selectedIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "by", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "autofocus", "autofocusDelay", "open", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "searchTerm", "name", "ui"],
|
|
88
89
|
family: "NuxtUIInput"
|
|
89
90
|
});
|
|
90
91
|
export const nuxtUISliderDefinition = createInput(FUSlider, {
|
|
@@ -92,10 +93,14 @@ export const nuxtUISliderDefinition = createInput(FUSlider, {
|
|
|
92
93
|
family: "NuxtUIInput"
|
|
93
94
|
});
|
|
94
95
|
export const nuxtUISwitchDefinition = createInput(FUSwitch, {
|
|
95
|
-
props: ["color", "size", "loading", "loadingIcon", "checkedIcon", "uncheckedIcon", "label", "description", "defaultValue", "trueValue", "falseValue", "autofocus", "ui"],
|
|
96
|
+
props: ["color", "size", "loading", "loadingIcon", "checkedIcon", "uncheckedIcon", "label", "description", "defaultValue", "trueValue", "falseValue", "autofocus", "name", "ui"],
|
|
96
97
|
family: "NuxtUIInput"
|
|
97
98
|
});
|
|
98
99
|
export const nuxtUITextareaDefinition = createInput(FUTextarea, {
|
|
99
100
|
props: ["color", "size", "variant", "placeholder", "autofocus", "autofocusDelay", "autoresize", "autoresizeDelay", "rows", "maxrows", "highlight", "fixed", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "cols", "dirname", "maxlength", "minlength", "wrap", "ui"],
|
|
100
101
|
family: "NuxtUIInput"
|
|
101
102
|
});
|
|
103
|
+
export const nuxtUITreeDefinition = createInput(FUTree, {
|
|
104
|
+
props: ["color", "size", "disabled", "multiple", "nested", "virtualize", "labelKey", "trailingIcon", "expandedIcon", "collapsedIcon", "expanded", "defaultExpanded", "selectionBehavior", "propagateSelect", "bubbleSelect", "ui", "items", "options"],
|
|
105
|
+
family: "NuxtUIInput"
|
|
106
|
+
});
|
|
@@ -19,12 +19,13 @@ import FUSelectMenu from "../../../runtime/components/inputs/FUSelectMenu.vue";
|
|
|
19
19
|
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
|
+
import FUTree from "../../../runtime/components/inputs/FUTree.vue";
|
|
22
23
|
export const nuxtUICalendarDefinition = createInput(FUCalendar, {
|
|
23
24
|
props: ["type", "range", "multiple", "color", "variant", "size", "weekNumbers", "monthControls", "yearControls", "viewControl", "defaultValue", "minValue", "maxValue", "isDateDisabled", "isDateUnavailable", "ui", "valueType", "timeZone"],
|
|
24
25
|
family: "NuxtUIInput"
|
|
25
26
|
});
|
|
26
27
|
export const nuxtUICheckboxDefinition = createInput(FUCheckbox, {
|
|
27
|
-
props: ["label", "description", "color", "variant", "size", "indicator", "icon", "indeterminateIcon", "trueValue", "falseValue", "autofocus", "ui"],
|
|
28
|
+
props: ["label", "description", "color", "variant", "size", "indicator", "icon", "indeterminateIcon", "trueValue", "falseValue", "autofocus", "name", "ui"],
|
|
28
29
|
family: "NuxtUIInput"
|
|
29
30
|
});
|
|
30
31
|
export const nuxtUICheckboxGroupDefinition = createInput(FUCheckboxGroup, {
|
|
@@ -52,7 +53,7 @@ export const nuxtUIInputDateDefinition = createInput(FUInputDate, {
|
|
|
52
53
|
family: "NuxtUIInput"
|
|
53
54
|
});
|
|
54
55
|
export const nuxtUIInputMenuDefinition = createInput(FUInputMenu, {
|
|
55
|
-
props: ["options", "inputType", "placeholder", "color", "variant", "size", "autofocus", "autofocusDelay", "trailingIcon", "selectedIcon", "deleteIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "mode", "by", "open", "valueKey", "labelKey", "descriptionKey", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "icon", "leading", "leadingIcon", "trailing", "loading", "loadingIcon", "list", "autocomplete", "searchTerm", "ui"],
|
|
56
|
+
props: ["options", "inputType", "placeholder", "color", "variant", "size", "autofocus", "autofocusDelay", "trailingIcon", "selectedIcon", "deleteIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "mode", "by", "open", "valueKey", "labelKey", "descriptionKey", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "openOnClick", "openOnFocus", "icon", "leading", "leadingIcon", "trailing", "loading", "loadingIcon", "list", "autocomplete", "searchTerm", "name", "ui"],
|
|
56
57
|
family: "NuxtUIInput"
|
|
57
58
|
});
|
|
58
59
|
export const nuxtUIInputNumberDefinition = createInput(FUInputNumber, {
|
|
@@ -68,11 +69,11 @@ export const nuxtUIInputTimeDefinition = createInput(FUInputTime, {
|
|
|
68
69
|
family: "NuxtUIInput"
|
|
69
70
|
});
|
|
70
71
|
export const nuxtUIListboxDefinition = createInput(FUListbox, {
|
|
71
|
-
props: ["options", "as", "color", "size", "by", "orientation", "selectionBehavior", "disabled", "defaultValue", "multiple", "valueKey", "labelKey", "descriptionKey", "loading", "loadingIcon", "filter", "filterFields", "ignoreFilter", "selectedIcon", "virtualize", "highlight", "highlightOnHover", "autofocus", "autofocusDelay", "searchTerm", "ui", "displayMode", "transferLeftHeaderText", "transferRightHeaderText", "transferAll", "transferHeaderClass", "transferSortIcons", "transferItemDraggable"],
|
|
72
|
+
props: ["options", "as", "color", "size", "by", "orientation", "selectionBehavior", "disabled", "defaultValue", "multiple", "valueKey", "labelKey", "descriptionKey", "loading", "loadingIcon", "filter", "filterFields", "ignoreFilter", "selectedIcon", "virtualize", "highlight", "highlightOnHover", "autofocus", "autofocusDelay", "searchTerm", "name", "ui", "displayMode", "transferLeftHeaderText", "transferRightHeaderText", "transferAll", "transferHeaderClass", "transferSortIcons", "transferItemDraggable"],
|
|
72
73
|
family: "NuxtUIInput"
|
|
73
74
|
});
|
|
74
75
|
export const nuxtUIPinInputDefinition = createInput(FUPinInput, {
|
|
75
|
-
props: ["color", "variant", "size", "length", "autofocus", "autofocusDelay", "highlight", "fixed", "defaultValue", "mask", "otp", "separator", "type", "placeholder", "ui"],
|
|
76
|
+
props: ["color", "variant", "size", "length", "autofocus", "autofocusDelay", "highlight", "fixed", "defaultValue", "mask", "otp", "separator", "type", "placeholder", "name", "ui"],
|
|
76
77
|
family: "NuxtUIInput"
|
|
77
78
|
});
|
|
78
79
|
export const nuxtUIRadioGroupDefinition = createInput(FURadioGroup, {
|
|
@@ -80,11 +81,11 @@ export const nuxtUIRadioGroupDefinition = createInput(FURadioGroup, {
|
|
|
80
81
|
family: "NuxtUIInput"
|
|
81
82
|
});
|
|
82
83
|
export const nuxtUISelectDefinition = createInput(FUSelect, {
|
|
83
|
-
props: ["options", "placeholder", "color", "variant", "size", "selectedIcon", "arrow", "portal", "content", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "autofocus", "autofocusDelay", "open", "defaultOpen", "autocomplete", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "ui"],
|
|
84
|
+
props: ["options", "placeholder", "color", "variant", "size", "selectedIcon", "arrow", "portal", "content", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "autofocus", "autofocusDelay", "open", "defaultOpen", "autocomplete", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "name", "ui"],
|
|
84
85
|
family: "NuxtUIInput"
|
|
85
86
|
});
|
|
86
87
|
export const nuxtUISelectMenuDefinition = createInput(FUSelectMenu, {
|
|
87
|
-
props: ["options", "placeholder", "searchInput", "color", "variant", "size", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "selectedIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "by", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "autofocus", "autofocusDelay", "open", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "searchTerm", "ui"],
|
|
88
|
+
props: ["options", "placeholder", "searchInput", "color", "variant", "size", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "selectedIcon", "clear", "clearIcon", "arrow", "portal", "virtualize", "content", "by", "valueKey", "labelKey", "descriptionKey", "defaultValue", "multiple", "highlight", "fixed", "createItem", "filterFields", "ignoreFilter", "autofocus", "autofocusDelay", "open", "defaultOpen", "resetSearchTermOnBlur", "resetSearchTermOnSelect", "resetModelValueOnClear", "highlightOnHover", "searchTerm", "name", "ui"],
|
|
88
89
|
family: "NuxtUIInput"
|
|
89
90
|
});
|
|
90
91
|
export const nuxtUISliderDefinition = createInput(FUSlider, {
|
|
@@ -92,10 +93,14 @@ export const nuxtUISliderDefinition = createInput(FUSlider, {
|
|
|
92
93
|
family: "NuxtUIInput"
|
|
93
94
|
});
|
|
94
95
|
export const nuxtUISwitchDefinition = createInput(FUSwitch, {
|
|
95
|
-
props: ["color", "size", "loading", "loadingIcon", "checkedIcon", "uncheckedIcon", "label", "description", "defaultValue", "trueValue", "falseValue", "autofocus", "ui"],
|
|
96
|
+
props: ["color", "size", "loading", "loadingIcon", "checkedIcon", "uncheckedIcon", "label", "description", "defaultValue", "trueValue", "falseValue", "autofocus", "name", "ui"],
|
|
96
97
|
family: "NuxtUIInput"
|
|
97
98
|
});
|
|
98
99
|
export const nuxtUITextareaDefinition = createInput(FUTextarea, {
|
|
99
100
|
props: ["color", "size", "variant", "placeholder", "autofocus", "autofocusDelay", "autoresize", "autoresizeDelay", "rows", "maxrows", "highlight", "fixed", "icon", "avatar", "leading", "leadingIcon", "trailing", "trailingIcon", "loading", "loadingIcon", "cols", "dirname", "maxlength", "minlength", "wrap", "ui"],
|
|
100
101
|
family: "NuxtUIInput"
|
|
101
102
|
});
|
|
103
|
+
export const nuxtUITreeDefinition = createInput(FUTree, {
|
|
104
|
+
props: ["color", "size", "disabled", "multiple", "nested", "virtualize", "labelKey", "trailingIcon", "expandedIcon", "collapsedIcon", "expanded", "defaultExpanded", "selectionBehavior", "propagateSelect", "bubbleSelect", "ui", "items", "options"],
|
|
105
|
+
family: "NuxtUIInput"
|
|
106
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { disablesChildren } from "@formkit/inputs";
|
|
1
|
+
import { disablesChildren, localize } from "@formkit/inputs";
|
|
2
2
|
import { createInput } from "@formkit/vue";
|
|
3
3
|
import { useFormKitMultiStep } from "../../composables/useFormKitMultiStep.js";
|
|
4
4
|
import { useFormKitSchema } from "../../composables/useFormKitSchema.js";
|
|
@@ -14,14 +14,14 @@ export const nuxtUIStepDefinition = createInput(
|
|
|
14
14
|
addElement("div", "$slots.default", { class: "formkit-step-inner" }),
|
|
15
15
|
addElement("div", [
|
|
16
16
|
addStepActionButton(
|
|
17
|
-
{ if: "$previousLabel", then: "$previousLabel", else: "
|
|
17
|
+
{ if: "$previousLabel", then: "$previousLabel", else: "$ui.prev.value" },
|
|
18
18
|
"$handlers.previous",
|
|
19
19
|
"$previousAttrs",
|
|
20
20
|
"$isFirstStep === false",
|
|
21
21
|
"outline"
|
|
22
22
|
),
|
|
23
23
|
addStepActionButton(
|
|
24
|
-
{ if: "$nextLabel", then: "$nextLabel", else: "
|
|
24
|
+
{ if: "$nextLabel", then: "$nextLabel", else: "$ui.next.value" },
|
|
25
25
|
"$handlers.next",
|
|
26
26
|
"$nextAttrs",
|
|
27
27
|
"$isLastStep === false || $stepIndex === 0",
|
|
@@ -42,7 +42,11 @@ export const nuxtUIStepDefinition = createInput(
|
|
|
42
42
|
forceTypeProp: "step",
|
|
43
43
|
family: "NuxtUIInput",
|
|
44
44
|
props: ["beforeStepChange", "nextAttrs", "nextLabel", "previousAttrs", "previousLabel", "validStepIcon", "ui", "stepActionsClass"],
|
|
45
|
-
|
|
45
|
+
// `localize('next')`/`localize('prev')` seed the `node.store` "ui" messages
|
|
46
|
+
// that `$ui.next.value`/`$ui.prev.value` (in the schema above) read - without
|
|
47
|
+
// them the schema expression resolves to nothing. Matches `@formkit/addons`'
|
|
48
|
+
// own `step` input definition, which includes the same two features.
|
|
49
|
+
features: [disablesChildren, addStepHandler, localize("next"), localize("prev")]
|
|
46
50
|
},
|
|
47
51
|
{
|
|
48
52
|
// `createInput()` always wraps the given schema in FormKit's standard
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { disablesChildren } from "@formkit/inputs";
|
|
1
|
+
import { disablesChildren, localize } from "@formkit/inputs";
|
|
2
2
|
import { createInput } from "@formkit/vue";
|
|
3
3
|
import { useFormKitMultiStep } from "../../composables/useFormKitMultiStep";
|
|
4
4
|
import { useFormKitSchema } from "../../composables/useFormKitSchema";
|
|
@@ -14,14 +14,14 @@ export const nuxtUIStepDefinition = createInput(
|
|
|
14
14
|
addElement("div", "$slots.default", { class: "formkit-step-inner" }),
|
|
15
15
|
addElement("div", [
|
|
16
16
|
addStepActionButton(
|
|
17
|
-
{ if: "$previousLabel", then: "$previousLabel", else: "
|
|
17
|
+
{ if: "$previousLabel", then: "$previousLabel", else: "$ui.prev.value" },
|
|
18
18
|
"$handlers.previous",
|
|
19
19
|
"$previousAttrs",
|
|
20
20
|
"$isFirstStep === false",
|
|
21
21
|
"outline"
|
|
22
22
|
),
|
|
23
23
|
addStepActionButton(
|
|
24
|
-
{ if: "$nextLabel", then: "$nextLabel", else: "
|
|
24
|
+
{ if: "$nextLabel", then: "$nextLabel", else: "$ui.next.value" },
|
|
25
25
|
"$handlers.next",
|
|
26
26
|
"$nextAttrs",
|
|
27
27
|
"$isLastStep === false || $stepIndex === 0",
|
|
@@ -42,7 +42,11 @@ export const nuxtUIStepDefinition = createInput(
|
|
|
42
42
|
forceTypeProp: "step",
|
|
43
43
|
family: "NuxtUIInput",
|
|
44
44
|
props: ["beforeStepChange", "nextAttrs", "nextLabel", "previousAttrs", "previousLabel", "validStepIcon", "ui", "stepActionsClass"],
|
|
45
|
-
|
|
45
|
+
// `localize('next')`/`localize('prev')` seed the `node.store` "ui" messages
|
|
46
|
+
// that `$ui.next.value`/`$ui.prev.value` (in the schema above) read - without
|
|
47
|
+
// them the schema expression resolves to nothing. Matches `@formkit/addons`'
|
|
48
|
+
// own `step` input definition, which includes the same two features.
|
|
49
|
+
features: [disablesChildren, addStepHandler, localize("next"), localize("prev")]
|
|
46
50
|
},
|
|
47
51
|
{
|
|
48
52
|
// `createInput()` always wraps the given schema in FormKit's standard
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FormKitMultiStepSlots, FormKitStepSlots } from '@formkit/addons';
|
|
2
2
|
import type { FormKitBaseSlots, FormKitInputs } from '@formkit/inputs';
|
|
3
|
-
import type { CalendarSlots, CheckboxSlots, CheckboxGroupSlots, EditorSlots, FileUploadSlots, RadioGroupSlots, InputSlots, TextareaSlots, SelectSlots, SelectMenuSlots, InputDateSlots, InputMenuSlots, InputNumberSlots, InputTagsSlots, InputTimeSlots, ListboxSlots, PinInputSlots, SwitchSlots } from '@nuxt/ui';
|
|
3
|
+
import type { CalendarSlots, CheckboxSlots, CheckboxGroupSlots, EditorSlots, FileUploadSlots, RadioGroupSlots, InputSlots, TextareaSlots, SelectSlots, SelectMenuSlots, InputDateSlots, InputMenuSlots, InputNumberSlots, InputTagsSlots, InputTimeSlots, ListboxSlots, PinInputSlots, SwitchSlots, TreeSlots } from '@nuxt/ui';
|
|
4
4
|
export * from './createNuxtUiFormkitConfig.js';
|
|
5
5
|
export * from './definitions/index.js';
|
|
6
6
|
export * from './plugins/index.js';
|
|
@@ -79,6 +79,9 @@ declare module '@formkit/inputs' {
|
|
|
79
79
|
nuxtUITextarea: {
|
|
80
80
|
type: 'nuxtUITextarea';
|
|
81
81
|
};
|
|
82
|
+
nuxtUITree: {
|
|
83
|
+
type: 'nuxtUITree';
|
|
84
|
+
};
|
|
82
85
|
nuxtUIOutputText: {
|
|
83
86
|
type: 'nuxtUIOutputText';
|
|
84
87
|
};
|
|
@@ -120,5 +123,6 @@ declare module '@formkit/inputs' {
|
|
|
120
123
|
nuxtUIStep: MergeSlots<FormKitBaseSlots<Props>, FormKitStepSlots<Props>>;
|
|
121
124
|
nuxtUISwitch: MergeSlots<FormKitBaseSlots<Props>, SwitchSlots>;
|
|
122
125
|
nuxtUITextarea: MergeSlots<FormKitBaseSlots<Props>, TextareaSlots>;
|
|
126
|
+
nuxtUITree: MergeSlots<FormKitBaseSlots<Props>, TreeSlots>;
|
|
123
127
|
}
|
|
124
128
|
}
|