@sfxcode/formkit-nuxt-ui 0.7.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/LICENSE +22 -0
- package/README.md +385 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.json +12 -0
- package/dist/module.mjs +29 -0
- package/dist/runtime/components/FUDataDebug.d.vue.ts +43 -0
- package/dist/runtime/components/FUDataDebug.vue +30 -0
- package/dist/runtime/components/FUDataDebug.vue.d.ts +43 -0
- package/dist/runtime/components/FUDataEdit.d.vue.ts +180 -0
- package/dist/runtime/components/FUDataEdit.vue +141 -0
- package/dist/runtime/components/FUDataEdit.vue.d.ts +180 -0
- package/dist/runtime/components/FUDataView.d.vue.ts +73 -0
- package/dist/runtime/components/FUDataView.vue +49 -0
- package/dist/runtime/components/FUDataView.vue.d.ts +73 -0
- package/dist/runtime/components/inputs/FUCheckbox.d.vue.ts +27 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue +33 -0
- package/dist/runtime/components/inputs/FUCheckbox.vue.d.ts +27 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.d.vue.ts +38 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue +34 -0
- package/dist/runtime/components/inputs/FUCheckboxGroup.vue.d.ts +38 -0
- package/dist/runtime/components/inputs/FUColorPicker.d.vue.ts +22 -0
- package/dist/runtime/components/inputs/FUColorPicker.vue +27 -0
- package/dist/runtime/components/inputs/FUColorPicker.vue.d.ts +22 -0
- package/dist/runtime/components/inputs/FUInput.d.vue.ts +44 -0
- package/dist/runtime/components/inputs/FUInput.vue +50 -0
- package/dist/runtime/components/inputs/FUInput.vue.d.ts +44 -0
- package/dist/runtime/components/inputs/FUInputDate.d.vue.ts +51 -0
- package/dist/runtime/components/inputs/FUInputDate.vue +52 -0
- package/dist/runtime/components/inputs/FUInputDate.vue.d.ts +51 -0
- package/dist/runtime/components/inputs/FUInputMenu.d.vue.ts +73 -0
- package/dist/runtime/components/inputs/FUInputMenu.vue +65 -0
- package/dist/runtime/components/inputs/FUInputMenu.vue.d.ts +73 -0
- package/dist/runtime/components/inputs/FUInputNumber.d.vue.ts +43 -0
- package/dist/runtime/components/inputs/FUInputNumber.vue +49 -0
- package/dist/runtime/components/inputs/FUInputNumber.vue.d.ts +43 -0
- package/dist/runtime/components/inputs/FUInputTags.d.vue.ts +47 -0
- package/dist/runtime/components/inputs/FUInputTags.vue +53 -0
- package/dist/runtime/components/inputs/FUInputTags.vue.d.ts +47 -0
- package/dist/runtime/components/inputs/FUInputTime.d.vue.ts +50 -0
- package/dist/runtime/components/inputs/FUInputTime.vue +50 -0
- package/dist/runtime/components/inputs/FUInputTime.vue.d.ts +50 -0
- package/dist/runtime/components/inputs/FUPinInput.d.vue.ts +30 -0
- package/dist/runtime/components/inputs/FUPinInput.vue +37 -0
- package/dist/runtime/components/inputs/FUPinInput.vue.d.ts +30 -0
- package/dist/runtime/components/inputs/FURadioGroup.d.vue.ts +37 -0
- package/dist/runtime/components/inputs/FURadioGroup.vue +35 -0
- package/dist/runtime/components/inputs/FURadioGroup.vue.d.ts +37 -0
- package/dist/runtime/components/inputs/FUSelect.d.vue.ts +48 -0
- package/dist/runtime/components/inputs/FUSelect.vue +51 -0
- package/dist/runtime/components/inputs/FUSelect.vue.d.ts +48 -0
- package/dist/runtime/components/inputs/FUSelectMenu.d.vue.ts +73 -0
- package/dist/runtime/components/inputs/FUSelectMenu.vue +62 -0
- package/dist/runtime/components/inputs/FUSelectMenu.vue.d.ts +73 -0
- package/dist/runtime/components/inputs/FUSlider.d.vue.ts +29 -0
- package/dist/runtime/components/inputs/FUSlider.vue +36 -0
- package/dist/runtime/components/inputs/FUSlider.vue.d.ts +29 -0
- package/dist/runtime/components/inputs/FUSwitch.d.vue.ts +28 -0
- package/dist/runtime/components/inputs/FUSwitch.vue +34 -0
- package/dist/runtime/components/inputs/FUSwitch.vue.d.ts +28 -0
- package/dist/runtime/components/inputs/FUTextarea.d.vue.ts +44 -0
- package/dist/runtime/components/inputs/FUTextarea.vue +50 -0
- package/dist/runtime/components/inputs/FUTextarea.vue.d.ts +44 -0
- package/dist/runtime/components/output/FUIcon.d.vue.ts +38 -0
- package/dist/runtime/components/output/FUIcon.vue +21 -0
- package/dist/runtime/components/output/FUIcon.vue.d.ts +38 -0
- package/dist/runtime/components/output/FUOutputBoolean.d.vue.ts +30 -0
- package/dist/runtime/components/output/FUOutputBoolean.vue +56 -0
- package/dist/runtime/components/output/FUOutputBoolean.vue.d.ts +30 -0
- package/dist/runtime/components/output/FUOutputDate.d.vue.ts +30 -0
- package/dist/runtime/components/output/FUOutputDate.vue +52 -0
- package/dist/runtime/components/output/FUOutputDate.vue.d.ts +30 -0
- package/dist/runtime/components/output/FUOutputLink.d.vue.ts +28 -0
- package/dist/runtime/components/output/FUOutputLink.vue +78 -0
- package/dist/runtime/components/output/FUOutputLink.vue.d.ts +28 -0
- package/dist/runtime/components/output/FUOutputList.d.vue.ts +29 -0
- package/dist/runtime/components/output/FUOutputList.vue +143 -0
- package/dist/runtime/components/output/FUOutputList.vue.d.ts +29 -0
- package/dist/runtime/components/output/FUOutputNumber.d.vue.ts +28 -0
- package/dist/runtime/components/output/FUOutputNumber.vue +52 -0
- package/dist/runtime/components/output/FUOutputNumber.vue.d.ts +28 -0
- package/dist/runtime/components/output/FUOutputText.d.vue.ts +26 -0
- package/dist/runtime/components/output/FUOutputText.vue +35 -0
- package/dist/runtime/components/output/FUOutputText.vue.d.ts +26 -0
- package/dist/runtime/composables/useFormKitRepeater.d.ts +5 -0
- package/dist/runtime/composables/useFormKitRepeater.js +54 -0
- package/dist/runtime/composables/useFormKitSchema.d.ts +26 -0
- package/dist/runtime/composables/useFormKitSchema.js +58 -0
- package/dist/runtime/definitions/index.d.ts +26 -0
- package/dist/runtime/definitions/index.js +28 -0
- package/dist/runtime/definitions/input.d.ts +17 -0
- package/dist/runtime/definitions/input.js +81 -0
- package/dist/runtime/definitions/output.d.ts +7 -0
- package/dist/runtime/definitions/output.js +31 -0
- package/dist/runtime/formkit.config.d.ts +3 -0
- package/dist/runtime/formkit.config.js +33 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +5 -0
- package/dist/runtime/plugins/index.d.ts +3 -0
- package/dist/runtime/plugins/index.js +55 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/utils/useFormKitInput.d.ts +13 -0
- package/dist/runtime/utils/useFormKitInput.js +42 -0
- package/dist/runtime/utils/useFormKitOutput.d.ts +10 -0
- package/dist/runtime/utils/useFormKitOutput.js +73 -0
- package/dist/types.d.mts +3 -0
- package/package.json +91 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useFormKitOutput } from "../../utils/useFormKitOutput";
|
|
4
|
+
import FUIcon from "./FUIcon.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
context: {
|
|
7
|
+
type: Object,
|
|
8
|
+
required: true
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const listValue = computed(() => {
|
|
12
|
+
const value = props.context._value;
|
|
13
|
+
if (!value) return [];
|
|
14
|
+
if (Array.isArray(value)) return value.map(String);
|
|
15
|
+
if (typeof value === "string") return value.split(",").map((s) => s.trim());
|
|
16
|
+
return [String(value)];
|
|
17
|
+
});
|
|
18
|
+
const listType = computed(() => props.context.listType ?? "span");
|
|
19
|
+
const separator = computed(() => {
|
|
20
|
+
if (props.context.separator) return props.context.separator;
|
|
21
|
+
const separatorMap = {
|
|
22
|
+
comma: ", ",
|
|
23
|
+
semicolon: "; ",
|
|
24
|
+
pipe: " | ",
|
|
25
|
+
dash: " - ",
|
|
26
|
+
space: " "
|
|
27
|
+
};
|
|
28
|
+
return separatorMap[listType.value] || ", ";
|
|
29
|
+
});
|
|
30
|
+
const isInlineList = computed(() => {
|
|
31
|
+
return ["span", "comma", "semicolon", "pipe", "dash", "space"].includes(listType.value);
|
|
32
|
+
});
|
|
33
|
+
const displayValue = computed(() => {
|
|
34
|
+
if (isInlineList.value && listType.value !== "span") {
|
|
35
|
+
return listValue.value.join(separator.value);
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
});
|
|
39
|
+
const itemClass = computed(() => {
|
|
40
|
+
return props.context.itemClass ?? "";
|
|
41
|
+
});
|
|
42
|
+
const badgeVariant = computed(() => {
|
|
43
|
+
const variant = props.context.variant;
|
|
44
|
+
if (variant === "ghost" || variant === "none") return "soft";
|
|
45
|
+
return variant;
|
|
46
|
+
});
|
|
47
|
+
const { containerClass, iconClass, leadingIconName, trailingIconName } = useFormKitOutput(props.context);
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div
|
|
52
|
+
:id="context.id"
|
|
53
|
+
:class="containerClass"
|
|
54
|
+
:style="context?.attrs?.style"
|
|
55
|
+
>
|
|
56
|
+
<FUIcon
|
|
57
|
+
v-if="leadingIconName"
|
|
58
|
+
:name="leadingIconName"
|
|
59
|
+
:icon-class="iconClass"
|
|
60
|
+
:on-click="context?.onLeadingIconClicked"
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
<!-- Inline list with separators (comma, semicolon, pipe, dash) -->
|
|
64
|
+
<span v-if="displayValue">{{ displayValue }}</span>
|
|
65
|
+
|
|
66
|
+
<!-- Span list (inline items without separator) -->
|
|
67
|
+
<template v-else-if="listType === 'span'">
|
|
68
|
+
<span
|
|
69
|
+
v-for="(item, index) in listValue"
|
|
70
|
+
:key="index"
|
|
71
|
+
:class="itemClass"
|
|
72
|
+
>
|
|
73
|
+
{{ item }}
|
|
74
|
+
</span>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<!-- Div list (block items) -->
|
|
78
|
+
<div
|
|
79
|
+
v-else-if="listType === 'div'"
|
|
80
|
+
class="flex flex-col gap-1"
|
|
81
|
+
>
|
|
82
|
+
<div
|
|
83
|
+
v-for="(item, index) in listValue"
|
|
84
|
+
:key="index"
|
|
85
|
+
:class="itemClass"
|
|
86
|
+
>
|
|
87
|
+
{{ item }}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<!-- Unordered list -->
|
|
92
|
+
<ul
|
|
93
|
+
v-else-if="listType === 'ul'"
|
|
94
|
+
class="list-disc list-inside"
|
|
95
|
+
>
|
|
96
|
+
<li
|
|
97
|
+
v-for="(item, index) in listValue"
|
|
98
|
+
:key="index"
|
|
99
|
+
:class="itemClass"
|
|
100
|
+
>
|
|
101
|
+
{{ item }}
|
|
102
|
+
</li>
|
|
103
|
+
</ul>
|
|
104
|
+
|
|
105
|
+
<!-- Ordered list -->
|
|
106
|
+
<ol
|
|
107
|
+
v-else-if="listType === 'ol'"
|
|
108
|
+
class="list-decimal list-inside"
|
|
109
|
+
>
|
|
110
|
+
<li
|
|
111
|
+
v-for="(item, index) in listValue"
|
|
112
|
+
:key="index"
|
|
113
|
+
:class="itemClass"
|
|
114
|
+
>
|
|
115
|
+
{{ item }}
|
|
116
|
+
</li>
|
|
117
|
+
</ol>
|
|
118
|
+
|
|
119
|
+
<!-- Badge list (styled like tags/badges) -->
|
|
120
|
+
<div
|
|
121
|
+
v-else-if="listType === 'badge'"
|
|
122
|
+
class="flex flex-wrap gap-2"
|
|
123
|
+
>
|
|
124
|
+
<UBadge
|
|
125
|
+
v-for="(item, index) in listValue"
|
|
126
|
+
:key="index"
|
|
127
|
+
:color="context.color"
|
|
128
|
+
:variant="badgeVariant"
|
|
129
|
+
:size="context.size"
|
|
130
|
+
:class="itemClass"
|
|
131
|
+
>
|
|
132
|
+
{{ item }}
|
|
133
|
+
</UBadge>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<FUIcon
|
|
137
|
+
v-if="trailingIconName"
|
|
138
|
+
:name="trailingIconName"
|
|
139
|
+
:icon-class="iconClass"
|
|
140
|
+
:on-click="context?.onTrailingIconClicked"
|
|
141
|
+
/>
|
|
142
|
+
</div>
|
|
143
|
+
</template>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FUIcon.vue.js';
|
|
4
|
+
export interface FormKitOutputListProps {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
6
|
+
icon?: string;
|
|
7
|
+
itemClass?: string;
|
|
8
|
+
leading?: boolean;
|
|
9
|
+
leadingIcon?: string;
|
|
10
|
+
listType?: 'span' | 'div' | 'ul' | 'ol' | 'comma' | 'semicolon' | 'pipe' | 'dash' | 'space' | 'badge';
|
|
11
|
+
separator?: string;
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
trailing?: boolean;
|
|
14
|
+
trailingIcon?: string;
|
|
15
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
16
|
+
}
|
|
17
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
18
|
+
context: {
|
|
19
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputListProps & FormKitIconProps>;
|
|
20
|
+
required: true;
|
|
21
|
+
};
|
|
22
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
23
|
+
context: {
|
|
24
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputListProps & FormKitIconProps>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
29
|
+
export default _default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FUIcon.vue.js';
|
|
4
|
+
export interface FormKitOutputNumberProps {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
6
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
7
|
+
icon?: string;
|
|
8
|
+
leading?: boolean;
|
|
9
|
+
leadingIcon?: string;
|
|
10
|
+
locale?: string;
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
trailing?: boolean;
|
|
13
|
+
trailingIcon?: string;
|
|
14
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
15
|
+
}
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
context: {
|
|
18
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputNumberProps & FormKitIconProps>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
context: {
|
|
23
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputNumberProps & FormKitIconProps>;
|
|
24
|
+
required: true;
|
|
25
|
+
};
|
|
26
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useFormKitOutput } from "../../utils/useFormKitOutput";
|
|
4
|
+
import FUIcon from "./FUIcon.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
context: {
|
|
7
|
+
type: Object,
|
|
8
|
+
required: true
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const numberValue = computed(() => {
|
|
12
|
+
const value = props.context._value;
|
|
13
|
+
if (value === null || value === void 0 || value === "")
|
|
14
|
+
return null;
|
|
15
|
+
return Number(value);
|
|
16
|
+
});
|
|
17
|
+
const displayValue = computed(() => {
|
|
18
|
+
if (numberValue.value === null || Number.isNaN(numberValue.value))
|
|
19
|
+
return "";
|
|
20
|
+
const locale = props.context.locale ?? "en-US";
|
|
21
|
+
const formatOptions = props.context.formatOptions ?? {};
|
|
22
|
+
try {
|
|
23
|
+
return new Intl.NumberFormat(locale, formatOptions).format(numberValue.value);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
console.error("Error formatting number:", error);
|
|
26
|
+
return String(numberValue.value);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const { containerClass, iconClass, leadingIconName, trailingIconName } = useFormKitOutput(props.context);
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<div
|
|
34
|
+
:id="context.id"
|
|
35
|
+
:class="containerClass"
|
|
36
|
+
:style="context?.attrs?.style"
|
|
37
|
+
>
|
|
38
|
+
<FUIcon
|
|
39
|
+
v-if="leadingIconName"
|
|
40
|
+
:name="leadingIconName"
|
|
41
|
+
:icon-class="iconClass"
|
|
42
|
+
:on-click="context?.onLeadingIconClicked"
|
|
43
|
+
/>
|
|
44
|
+
<span>{{ displayValue }}</span>
|
|
45
|
+
<FUIcon
|
|
46
|
+
v-if="trailingIconName"
|
|
47
|
+
:name="trailingIconName"
|
|
48
|
+
:icon-class="iconClass"
|
|
49
|
+
:on-click="context?.onTrailingIconClicked"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
</template>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FUIcon.vue.js';
|
|
4
|
+
export interface FormKitOutputNumberProps {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
6
|
+
formatOptions?: Intl.NumberFormatOptions;
|
|
7
|
+
icon?: string;
|
|
8
|
+
leading?: boolean;
|
|
9
|
+
leadingIcon?: string;
|
|
10
|
+
locale?: string;
|
|
11
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
12
|
+
trailing?: boolean;
|
|
13
|
+
trailingIcon?: string;
|
|
14
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
15
|
+
}
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
context: {
|
|
18
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputNumberProps & FormKitIconProps>;
|
|
19
|
+
required: true;
|
|
20
|
+
};
|
|
21
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
22
|
+
context: {
|
|
23
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputNumberProps & FormKitIconProps>;
|
|
24
|
+
required: true;
|
|
25
|
+
};
|
|
26
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
27
|
+
declare const _default: typeof __VLS_export;
|
|
28
|
+
export default _default;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FUIcon.vue.js';
|
|
4
|
+
export interface FormKitOutputTextProps {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
6
|
+
icon?: string;
|
|
7
|
+
leading?: boolean;
|
|
8
|
+
leadingIcon?: string;
|
|
9
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
trailing?: boolean;
|
|
11
|
+
trailingIcon?: string;
|
|
12
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
13
|
+
}
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
15
|
+
context: {
|
|
16
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
context: {
|
|
21
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useFormKitOutput } from "../../utils/useFormKitOutput";
|
|
4
|
+
import FUIcon from "./FUIcon.vue";
|
|
5
|
+
const props = defineProps({
|
|
6
|
+
context: {
|
|
7
|
+
type: Object,
|
|
8
|
+
required: true
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
const displayValue = computed(() => props.context._value ?? "");
|
|
12
|
+
const { containerClass, iconClass, leadingIconName, trailingIconName } = useFormKitOutput(props.context);
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<template>
|
|
16
|
+
<div
|
|
17
|
+
:id="context.id"
|
|
18
|
+
:class="containerClass"
|
|
19
|
+
:style="context?.attrs?.style"
|
|
20
|
+
>
|
|
21
|
+
<FUIcon
|
|
22
|
+
v-if="leadingIconName"
|
|
23
|
+
:name="leadingIconName"
|
|
24
|
+
:icon-class="iconClass"
|
|
25
|
+
:on-click="context?.onLeadingIconClicked"
|
|
26
|
+
/>
|
|
27
|
+
<span>{{ displayValue }}</span>
|
|
28
|
+
<FUIcon
|
|
29
|
+
v-if="trailingIconName"
|
|
30
|
+
:name="trailingIconName"
|
|
31
|
+
:icon-class="iconClass"
|
|
32
|
+
:on-click="context?.onTrailingIconClicked"
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
</template>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FUIcon.vue.js';
|
|
4
|
+
export interface FormKitOutputTextProps {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
6
|
+
icon?: string;
|
|
7
|
+
leading?: boolean;
|
|
8
|
+
leadingIcon?: string;
|
|
9
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
10
|
+
trailing?: boolean;
|
|
11
|
+
trailingIcon?: string;
|
|
12
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
13
|
+
}
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
15
|
+
context: {
|
|
16
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
17
|
+
required: true;
|
|
18
|
+
};
|
|
19
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
context: {
|
|
21
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
22
|
+
required: true;
|
|
23
|
+
};
|
|
24
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
25
|
+
declare const _default: typeof __VLS_export;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useFormKitRepeater(): {
|
|
2
|
+
addInsertButton: (label?: string, innerClass?: string, outerClass?: string, buttonClass?: string, iconClass?: string) => object;
|
|
3
|
+
addGroupButtons: (innerClass?: string, outerClass?: string, label?: string, help?: string, render?: string) => object;
|
|
4
|
+
addListGroupFunctions: (data: Record<string, unknown>, addNodeDefaultObject?: object) => void;
|
|
5
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useFormKitSchema } from "./useFormKitSchema.js";
|
|
2
|
+
export function useFormKitRepeater() {
|
|
3
|
+
const { addElement, addComponent, addElementsInOuterDiv } = useFormKitSchema();
|
|
4
|
+
function addInsertButton(label = "Add", innerClass = "", outerClass = "", buttonClass = "p-button-sm", iconClass = "pi pi-plus") {
|
|
5
|
+
return addElementsInOuterDiv([
|
|
6
|
+
addComponent("Button", { onClick: "$addNode($node.parent)", label, class: buttonClass, icon: iconClass }, "$node.parent.value.length == 0")
|
|
7
|
+
], innerClass, outerClass);
|
|
8
|
+
}
|
|
9
|
+
function addListGroupFunctions(data, addNodeDefaultObject = {}) {
|
|
10
|
+
const swapElements = (array, index1, index2) => {
|
|
11
|
+
const newArray = [...array];
|
|
12
|
+
const temp = newArray[index1];
|
|
13
|
+
newArray[index1] = newArray[index2];
|
|
14
|
+
newArray[index2] = temp;
|
|
15
|
+
return newArray;
|
|
16
|
+
};
|
|
17
|
+
data.addNode = (parentNode) => () => {
|
|
18
|
+
const newArray = [...parentNode.value, addNodeDefaultObject];
|
|
19
|
+
parentNode.input(newArray, false);
|
|
20
|
+
};
|
|
21
|
+
data.removeNode = (parentNode, index) => () => {
|
|
22
|
+
parentNode.input(parentNode._value.filter((_, i) => i !== index), false);
|
|
23
|
+
};
|
|
24
|
+
data.moveNodeUp = (parentNode, index) => () => {
|
|
25
|
+
const array = [...parentNode.value];
|
|
26
|
+
if (index > 0)
|
|
27
|
+
parentNode.input(swapElements(array, index - 1, index), false);
|
|
28
|
+
};
|
|
29
|
+
data.moveNodeDown = (parentNode, index) => () => {
|
|
30
|
+
const array = [...parentNode.value];
|
|
31
|
+
if (index < array.length - 1)
|
|
32
|
+
parentNode.input(swapElements(array, index, index + 1), false);
|
|
33
|
+
};
|
|
34
|
+
data.copyNode = (parentNode, index) => () => {
|
|
35
|
+
const obj = parentNode.value[index];
|
|
36
|
+
const newArray = [...parentNode.value, { ...obj }];
|
|
37
|
+
parentNode.input(newArray, false);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function addGroupButtons(innerClass = "", outerClass = "col-4", label = "Actions", help = "", render = "true") {
|
|
41
|
+
const addButtonComponent = (onClick = "", label2 = "", icon = "", severity = "", render2 = "true", styleClass = "p-button-sm") => {
|
|
42
|
+
return addComponent("Button", { onClick, label: label2, icon, class: styleClass, severity }, render2);
|
|
43
|
+
};
|
|
44
|
+
return addElementsInOuterDiv([
|
|
45
|
+
addButtonComponent("$removeNode($node.parent, $index)", "", "pi pi-times", "danger"),
|
|
46
|
+
addButtonComponent("$copyNode($node.parent, $index)", "", "pi pi-plus"),
|
|
47
|
+
addButtonComponent("$moveNodeUp($node.parent, $index)", "", "pi pi-arrow-up", "secondary", "$index != 0"),
|
|
48
|
+
addElement("span", [], { class: "p-space" }, "$index == 0"),
|
|
49
|
+
addButtonComponent("$moveNodeDown($node.parent, $index)", "", "pi pi-arrow-down", "secondary", "$index < $node.parent.value.length -1"),
|
|
50
|
+
addElement("span", [], { class: "p-space" }, "$index == $node.parent.value.length -1")
|
|
51
|
+
], `p-action-buttons ${innerClass}`, outerClass, label, help, render);
|
|
52
|
+
}
|
|
53
|
+
return { addInsertButton, addGroupButtons, addListGroupFunctions };
|
|
54
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare function useFormKitSchema(): {
|
|
2
|
+
addComponent: (component?: string, props?: object, render?: string | boolean, formKitAttrs?: object) => object;
|
|
3
|
+
addElement: (element?: string, children?: unknown[] | string, attrs?: object, render?: string | boolean, formKitAttrs?: object) => object;
|
|
4
|
+
addGroup: (name: string, children?: object[], render?: string | boolean, formKitAttrs?: object) => {
|
|
5
|
+
$formkit: string;
|
|
6
|
+
if: string;
|
|
7
|
+
name: string;
|
|
8
|
+
children: object[];
|
|
9
|
+
};
|
|
10
|
+
addList: (name: string, children?: object[], dynamic?: boolean, render?: string | boolean, formKitAttrs?: object) => {
|
|
11
|
+
$formkit: string;
|
|
12
|
+
if: string;
|
|
13
|
+
name: string;
|
|
14
|
+
dynamic: boolean;
|
|
15
|
+
children: object[];
|
|
16
|
+
};
|
|
17
|
+
addListGroup: (children?: object[], render?: string | boolean, formKitAttrs?: object) => {
|
|
18
|
+
$formkit: string;
|
|
19
|
+
if: string;
|
|
20
|
+
for: string[];
|
|
21
|
+
key: string;
|
|
22
|
+
index: string;
|
|
23
|
+
children: object[];
|
|
24
|
+
};
|
|
25
|
+
addElementsInOuterDiv: (children?: object[], innerClass?: string, outerClass?: string, label?: string, help?: string, render?: string | boolean) => object;
|
|
26
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export function useFormKitSchema() {
|
|
2
|
+
const addComponent = (component = "Button", props = {}, render = true, formKitAttrs = {}) => {
|
|
3
|
+
return {
|
|
4
|
+
$cmp: component,
|
|
5
|
+
if: render.toString(),
|
|
6
|
+
props,
|
|
7
|
+
...formKitAttrs
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
const addElement = (element = "div", children = [], attrs = {}, render = true, formKitAttrs = {}) => {
|
|
11
|
+
return {
|
|
12
|
+
$el: element,
|
|
13
|
+
if: render.toString(),
|
|
14
|
+
attrs,
|
|
15
|
+
children,
|
|
16
|
+
...formKitAttrs
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const addGroup = (name, children = [], render = true, formKitAttrs = {}) => {
|
|
20
|
+
return {
|
|
21
|
+
$formkit: "group",
|
|
22
|
+
if: render.toString(),
|
|
23
|
+
name,
|
|
24
|
+
children,
|
|
25
|
+
...formKitAttrs
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
const addList = (name, children = [], dynamic = true, render = true, formKitAttrs = {}) => {
|
|
29
|
+
return {
|
|
30
|
+
$formkit: "list",
|
|
31
|
+
if: render.toString(),
|
|
32
|
+
name,
|
|
33
|
+
dynamic,
|
|
34
|
+
children,
|
|
35
|
+
...formKitAttrs
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
const addListGroup = (children = [], render = true, formKitAttrs = {}) => {
|
|
39
|
+
return {
|
|
40
|
+
$formkit: "group",
|
|
41
|
+
if: render.toString(),
|
|
42
|
+
for: ["item", "index", "$items"],
|
|
43
|
+
// 👈 $items is in the slot’s scope
|
|
44
|
+
key: "$item",
|
|
45
|
+
index: "$index",
|
|
46
|
+
children,
|
|
47
|
+
...formKitAttrs
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
const addElementsInOuterDiv = (children = [], innerClass = "", outerClass = "", label = "", help = "", render = true) => {
|
|
51
|
+
const inner = addElement("div", children, { class: `formkit-inner ${innerClass}`, style: "position: relative;" });
|
|
52
|
+
const labelDiv = addElement("label", [label], { class: "formkit-label" });
|
|
53
|
+
const wrapperDiv = addElement("div", [labelDiv, inner], { class: "formkit-wrapper" });
|
|
54
|
+
const helpDiv = addElement("div", [help], { class: "formkit-help" });
|
|
55
|
+
return addElement("div", [wrapperDiv, helpDiv], { class: `formkit-outer ${outerClass}`, style: "position: relative;" }, render);
|
|
56
|
+
};
|
|
57
|
+
return { addComponent, addElement, addGroup, addList, addListGroup, addElementsInOuterDiv };
|
|
58
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export declare const nuxtUIInputs: {
|
|
2
|
+
nuxtUICheckbox: import("@formkit/core").FormKitTypeDefinition;
|
|
3
|
+
nuxtUICheckboxGroup: import("@formkit/core").FormKitTypeDefinition;
|
|
4
|
+
nuxtUIColorPicker: import("@formkit/core").FormKitTypeDefinition;
|
|
5
|
+
nuxtUIInput: import("@formkit/core").FormKitTypeDefinition;
|
|
6
|
+
nuxtUIInputDate: import("@formkit/core").FormKitTypeDefinition;
|
|
7
|
+
nuxtUIInputMenu: import("@formkit/core").FormKitTypeDefinition;
|
|
8
|
+
nuxtUIInputNumber: import("@formkit/core").FormKitTypeDefinition;
|
|
9
|
+
nuxtUIInputTags: import("@formkit/core").FormKitTypeDefinition;
|
|
10
|
+
nuxtUIInputTime: import("@formkit/core").FormKitTypeDefinition;
|
|
11
|
+
nuxtUIPinInput: import("@formkit/core").FormKitTypeDefinition;
|
|
12
|
+
nuxtUIRadioGroup: import("@formkit/core").FormKitTypeDefinition;
|
|
13
|
+
nuxtUISelect: import("@formkit/core").FormKitTypeDefinition;
|
|
14
|
+
nuxtUISelectMenu: import("@formkit/core").FormKitTypeDefinition;
|
|
15
|
+
nuxtUISlider: import("@formkit/core").FormKitTypeDefinition;
|
|
16
|
+
nuxtUISwitch: import("@formkit/core").FormKitTypeDefinition;
|
|
17
|
+
nuxtUITextarea: import("@formkit/core").FormKitTypeDefinition;
|
|
18
|
+
};
|
|
19
|
+
export declare const nuxtUIOutputs: {
|
|
20
|
+
nuxtUIOutputBoolean: import("@formkit/core").FormKitTypeDefinition;
|
|
21
|
+
nuxtUIOutputDate: import("@formkit/core").FormKitTypeDefinition;
|
|
22
|
+
nuxtUIOutputLink: import("@formkit/core").FormKitTypeDefinition;
|
|
23
|
+
nuxtUIOutputList: import("@formkit/core").FormKitTypeDefinition;
|
|
24
|
+
nuxtUIOutputNumber: import("@formkit/core").FormKitTypeDefinition;
|
|
25
|
+
nuxtUIOutputText: import("@formkit/core").FormKitTypeDefinition;
|
|
26
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { nuxtUICheckboxDefinition, nuxtUICheckboxGroupDefinition, nuxtUIColorPickerDefinition, nuxtUIInputDateDefinition, nuxtUIInputDefinition, nuxtUIInputMenuDefinition, nuxtUIInputNumberDefinition, nuxtUIInputTagsDefinition, nuxtUIInputTimeDefinition, nuxtUIPinInputDefinition, nuxtUIRadioGroupDefinition, nuxtUISelectDefinition, nuxtUISelectMenuDefinition, nuxtUISliderDefinition, nuxtUISwitchDefinition, nuxtUITextareaDefinition } from "../definitions/input.js";
|
|
2
|
+
import { nuxtUIOutputBooleanDefinition, nuxtUIOutputDateDefinition, nuxtUIOutputLinkDefinition, nuxtUIOutputListDefinition, nuxtUIOutputNumberDefinition, nuxtUIOutputTextDefinition } from "../definitions/output.js";
|
|
3
|
+
export const nuxtUIInputs = {
|
|
4
|
+
nuxtUICheckbox: nuxtUICheckboxDefinition,
|
|
5
|
+
nuxtUICheckboxGroup: nuxtUICheckboxGroupDefinition,
|
|
6
|
+
nuxtUIColorPicker: nuxtUIColorPickerDefinition,
|
|
7
|
+
nuxtUIInput: nuxtUIInputDefinition,
|
|
8
|
+
nuxtUIInputDate: nuxtUIInputDateDefinition,
|
|
9
|
+
nuxtUIInputMenu: nuxtUIInputMenuDefinition,
|
|
10
|
+
nuxtUIInputNumber: nuxtUIInputNumberDefinition,
|
|
11
|
+
nuxtUIInputTags: nuxtUIInputTagsDefinition,
|
|
12
|
+
nuxtUIInputTime: nuxtUIInputTimeDefinition,
|
|
13
|
+
nuxtUIPinInput: nuxtUIPinInputDefinition,
|
|
14
|
+
nuxtUIRadioGroup: nuxtUIRadioGroupDefinition,
|
|
15
|
+
nuxtUISelect: nuxtUISelectDefinition,
|
|
16
|
+
nuxtUISelectMenu: nuxtUISelectMenuDefinition,
|
|
17
|
+
nuxtUISlider: nuxtUISliderDefinition,
|
|
18
|
+
nuxtUISwitch: nuxtUISwitchDefinition,
|
|
19
|
+
nuxtUITextarea: nuxtUITextareaDefinition
|
|
20
|
+
};
|
|
21
|
+
export const nuxtUIOutputs = {
|
|
22
|
+
nuxtUIOutputBoolean: nuxtUIOutputBooleanDefinition,
|
|
23
|
+
nuxtUIOutputDate: nuxtUIOutputDateDefinition,
|
|
24
|
+
nuxtUIOutputLink: nuxtUIOutputLinkDefinition,
|
|
25
|
+
nuxtUIOutputList: nuxtUIOutputListDefinition,
|
|
26
|
+
nuxtUIOutputNumber: nuxtUIOutputNumberDefinition,
|
|
27
|
+
nuxtUIOutputText: nuxtUIOutputTextDefinition
|
|
28
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { FormKitTypeDefinition } from '@formkit/core';
|
|
2
|
+
export declare const nuxtUICheckboxDefinition: FormKitTypeDefinition;
|
|
3
|
+
export declare const nuxtUICheckboxGroupDefinition: FormKitTypeDefinition;
|
|
4
|
+
export declare const nuxtUIColorPickerDefinition: FormKitTypeDefinition;
|
|
5
|
+
export declare const nuxtUIInputDefinition: FormKitTypeDefinition;
|
|
6
|
+
export declare const nuxtUIInputDateDefinition: FormKitTypeDefinition;
|
|
7
|
+
export declare const nuxtUIInputMenuDefinition: FormKitTypeDefinition;
|
|
8
|
+
export declare const nuxtUIInputNumberDefinition: FormKitTypeDefinition;
|
|
9
|
+
export declare const nuxtUIInputTagsDefinition: FormKitTypeDefinition;
|
|
10
|
+
export declare const nuxtUIInputTimeDefinition: FormKitTypeDefinition;
|
|
11
|
+
export declare const nuxtUIPinInputDefinition: FormKitTypeDefinition;
|
|
12
|
+
export declare const nuxtUIRadioGroupDefinition: FormKitTypeDefinition;
|
|
13
|
+
export declare const nuxtUISelectDefinition: FormKitTypeDefinition;
|
|
14
|
+
export declare const nuxtUISelectMenuDefinition: FormKitTypeDefinition;
|
|
15
|
+
export declare const nuxtUISliderDefinition: FormKitTypeDefinition;
|
|
16
|
+
export declare const nuxtUISwitchDefinition: FormKitTypeDefinition;
|
|
17
|
+
export declare const nuxtUITextareaDefinition: FormKitTypeDefinition;
|