@sfxcode/nuxt-ui-formkit 0.8.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 +430 -0
- package/dist/module.d.mts +7 -0
- package/dist/module.d.ts +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 +32 -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 +143 -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 +59 -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 +44 -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 +45 -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 +61 -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 +63 -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 +76 -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 +60 -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 +64 -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 +61 -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 +46 -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 +62 -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 +73 -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 +45 -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 +61 -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 +20 -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 +27 -0
- package/dist/runtime/components/output/FUOutputText.vue +90 -0
- package/dist/runtime/components/output/FUOutputText.vue.d.ts +27 -0
- package/dist/runtime/composables/useFormKitRepeater.d.ts +5 -0
- package/dist/runtime/composables/useFormKitRepeater.js +53 -0
- package/dist/runtime/composables/useFormKitSchema.d.ts +26 -0
- package/dist/runtime/composables/useFormKitSchema.js +58 -0
- package/dist/runtime/formkit/definitions/index.d.ts +28 -0
- package/dist/runtime/formkit/definitions/index.js +30 -0
- package/dist/runtime/formkit/definitions/index.mjs +30 -0
- package/dist/runtime/formkit/definitions/input.d.ts +17 -0
- package/dist/runtime/formkit/definitions/input.js +81 -0
- package/dist/runtime/formkit/definitions/input.mjs +81 -0
- package/dist/runtime/formkit/definitions/output.d.ts +7 -0
- package/dist/runtime/formkit/definitions/output.js +31 -0
- package/dist/runtime/formkit/definitions/output.mjs +31 -0
- package/dist/runtime/formkit/index.d.ts +93 -0
- package/dist/runtime/formkit/index.js +2 -0
- package/dist/runtime/formkit/index.mjs +2 -0
- package/dist/runtime/formkit/plugins/index.d.ts +3 -0
- package/dist/runtime/formkit/plugins/index.js +55 -0
- package/dist/runtime/formkit/plugins/index.mjs +55 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.js +3 -0
- package/dist/runtime/server/tsconfig.json +3 -0
- package/dist/runtime/utils/colorConverter.d.ts +5 -0
- package/dist/runtime/utils/colorConverter.js +134 -0
- package/dist/runtime/utils/durationConverter.d.ts +2 -0
- package/dist/runtime/utils/durationConverter.js +32 -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 +114 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { FormKitFrameworkContext } from '@formkit/core';
|
|
2
|
+
import type { PropType } from 'vue';
|
|
3
|
+
import type { FormKitIconProps } from './FUIcon.vue.js';
|
|
4
|
+
export interface FormKitOutputDateProps {
|
|
5
|
+
color?: 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'error' | 'neutral';
|
|
6
|
+
dateStyle?: 'short' | 'medium' | 'long' | 'full';
|
|
7
|
+
icon?: string;
|
|
8
|
+
leading?: boolean;
|
|
9
|
+
leadingIcon?: string;
|
|
10
|
+
locale?: string;
|
|
11
|
+
relative?: boolean;
|
|
12
|
+
size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
13
|
+
timeStyle?: 'short' | 'medium' | 'long';
|
|
14
|
+
trailing?: boolean;
|
|
15
|
+
trailingIcon?: string;
|
|
16
|
+
variant?: 'outline' | 'soft' | 'subtle' | 'ghost' | 'none';
|
|
17
|
+
}
|
|
18
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
19
|
+
context: {
|
|
20
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputDateProps & FormKitIconProps>;
|
|
21
|
+
required: true;
|
|
22
|
+
};
|
|
23
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
24
|
+
context: {
|
|
25
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputDateProps & FormKitIconProps>;
|
|
26
|
+
required: true;
|
|
27
|
+
};
|
|
28
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
29
|
+
declare const _default: typeof __VLS_export;
|
|
30
|
+
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 FormKitOutputLinkProps {
|
|
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
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
14
|
+
rel?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
context: {
|
|
18
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputLinkProps & 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 & FormKitOutputLinkProps & 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,78 @@
|
|
|
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 linkUrl = computed(() => props.context._value ?? "");
|
|
12
|
+
const isExternal = computed(() => {
|
|
13
|
+
const url = linkUrl.value;
|
|
14
|
+
if (!url)
|
|
15
|
+
return false;
|
|
16
|
+
return url.startsWith("http://") || url.startsWith("https://") || url.startsWith("//");
|
|
17
|
+
});
|
|
18
|
+
const linkTarget = computed(() => {
|
|
19
|
+
return props.context.target ?? (isExternal.value ? "_blank" : void 0);
|
|
20
|
+
});
|
|
21
|
+
const linkRel = computed(() => {
|
|
22
|
+
if (props.context.rel)
|
|
23
|
+
return props.context.rel;
|
|
24
|
+
if (isExternal.value && linkTarget.value === "_blank")
|
|
25
|
+
return "noopener noreferrer";
|
|
26
|
+
return void 0;
|
|
27
|
+
});
|
|
28
|
+
const displayValue = computed(() => {
|
|
29
|
+
return linkUrl;
|
|
30
|
+
});
|
|
31
|
+
const { containerClass, iconClass, leadingIconName, trailingIconName } = useFormKitOutput(props.context);
|
|
32
|
+
const linkClass = computed(() => {
|
|
33
|
+
const classes = [
|
|
34
|
+
containerClass.value
|
|
35
|
+
];
|
|
36
|
+
return classes.filter(Boolean).join(" ");
|
|
37
|
+
});
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<template>
|
|
41
|
+
<div
|
|
42
|
+
:id="context.id"
|
|
43
|
+
:class="containerClass"
|
|
44
|
+
:style="context?.attrs?.style"
|
|
45
|
+
>
|
|
46
|
+
<FUIcon
|
|
47
|
+
v-if="leadingIconName"
|
|
48
|
+
:name="leadingIconName"
|
|
49
|
+
:class="iconClass"
|
|
50
|
+
:on-click="context?.onLeadingIconClicked"
|
|
51
|
+
/>
|
|
52
|
+
<ULink
|
|
53
|
+
v-if="isExternal"
|
|
54
|
+
:href="isExternal ? linkUrl : void 0"
|
|
55
|
+
:target="linkTarget"
|
|
56
|
+
:rel="linkRel"
|
|
57
|
+
:class="linkClass"
|
|
58
|
+
:style="context?.attrs?.style"
|
|
59
|
+
>
|
|
60
|
+
<span>{{ displayValue }}</span>
|
|
61
|
+
</ULink>
|
|
62
|
+
<NuxtLink
|
|
63
|
+
v-else
|
|
64
|
+
:to="linkUrl"
|
|
65
|
+
:class="linkClass"
|
|
66
|
+
:style="context?.attrs?.style"
|
|
67
|
+
>
|
|
68
|
+
<span>{{ displayValue }}</span>
|
|
69
|
+
</NuxtLink>
|
|
70
|
+
|
|
71
|
+
<FUIcon
|
|
72
|
+
v-if="trailingIconName"
|
|
73
|
+
:name="trailingIconName"
|
|
74
|
+
:class="iconClass"
|
|
75
|
+
:on-click="context?.onTrailingIconClicked"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
</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 FormKitOutputLinkProps {
|
|
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
|
+
target?: '_blank' | '_self' | '_parent' | '_top';
|
|
14
|
+
rel?: string;
|
|
15
|
+
}
|
|
16
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
17
|
+
context: {
|
|
18
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputLinkProps & 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 & FormKitOutputLinkProps & 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,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,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
|
+
: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
|
+
: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
|
+
:class="iconClass"
|
|
42
|
+
:on-click="context?.onLeadingIconClicked"
|
|
43
|
+
/>
|
|
44
|
+
<span>{{ displayValue }}</span>
|
|
45
|
+
<FUIcon
|
|
46
|
+
v-if="trailingIconName"
|
|
47
|
+
:name="trailingIconName"
|
|
48
|
+
: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,27 @@
|
|
|
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
|
+
outputType?: 'text' | 'email' | 'url' | 'tel' | 'color' | 'duration';
|
|
14
|
+
}
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
16
|
+
context: {
|
|
17
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
context: {
|
|
22
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { computed } from "vue";
|
|
3
|
+
import { useFormKitOutput } from "../../utils/useFormKitOutput";
|
|
4
|
+
import { convertColorToHex } from "../../utils/colorConverter";
|
|
5
|
+
import { formattedDuration } from "../../utils/durationConverter";
|
|
6
|
+
import FUIcon from "./FUIcon.vue";
|
|
7
|
+
const props = defineProps({
|
|
8
|
+
context: {
|
|
9
|
+
type: Object,
|
|
10
|
+
required: true
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
const outputType = computed(() => props.context.outputType ?? "text");
|
|
14
|
+
const displayValue = computed(() => {
|
|
15
|
+
let result = props.context._value ?? "";
|
|
16
|
+
if (outputType.value === "duration") {
|
|
17
|
+
result = formattedDuration(result);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
});
|
|
21
|
+
const isLink = computed(() => ["email", "url", "tel"].includes(outputType.value));
|
|
22
|
+
const linkHref = computed(() => {
|
|
23
|
+
const value = displayValue.value;
|
|
24
|
+
if (!value)
|
|
25
|
+
return "";
|
|
26
|
+
switch (outputType.value) {
|
|
27
|
+
case "email":
|
|
28
|
+
return value.startsWith("mailto:") ? value : `mailto:${value}`;
|
|
29
|
+
case "tel":
|
|
30
|
+
return value.startsWith("tel:") ? value : `tel:${value}`;
|
|
31
|
+
case "url":
|
|
32
|
+
return value;
|
|
33
|
+
default:
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const colorValue = computed(() => {
|
|
38
|
+
if (outputType.value === "color") {
|
|
39
|
+
return convertColorToHex(displayValue.value);
|
|
40
|
+
}
|
|
41
|
+
return void 0;
|
|
42
|
+
});
|
|
43
|
+
const colorStyle = computed(() => {
|
|
44
|
+
if (outputType.value === "color") {
|
|
45
|
+
return `color: ${colorValue.value} `;
|
|
46
|
+
}
|
|
47
|
+
return " ";
|
|
48
|
+
});
|
|
49
|
+
const { containerClass, iconClass, leadingIconName, trailingIconName } = useFormKitOutput(props.context);
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<div
|
|
54
|
+
:id="context.id"
|
|
55
|
+
:class="containerClass"
|
|
56
|
+
:style="context?.attrs?.style"
|
|
57
|
+
>
|
|
58
|
+
<FUIcon
|
|
59
|
+
v-if="leadingIconName"
|
|
60
|
+
:name="leadingIconName"
|
|
61
|
+
:class="iconClass"
|
|
62
|
+
:style="colorStyle"
|
|
63
|
+
:on-click="context?.onLeadingIconClicked"
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<!-- Link output types (email, url, tel) -->
|
|
67
|
+
<ULink
|
|
68
|
+
v-if="isLink && displayValue"
|
|
69
|
+
:href="linkHref"
|
|
70
|
+
:target="outputType === 'url' ? '_blank' : void 0"
|
|
71
|
+
:rel="outputType === 'url' ? 'noopener noreferrer' : void 0"
|
|
72
|
+
>
|
|
73
|
+
{{ displayValue }}
|
|
74
|
+
</ULink>
|
|
75
|
+
|
|
76
|
+
<!-- Default text output -->
|
|
77
|
+
<span
|
|
78
|
+
v-else
|
|
79
|
+
:style="colorStyle"
|
|
80
|
+
>{{ displayValue }}</span>
|
|
81
|
+
|
|
82
|
+
<FUIcon
|
|
83
|
+
v-if="trailingIconName"
|
|
84
|
+
:name="trailingIconName"
|
|
85
|
+
:class="iconClass"
|
|
86
|
+
:style="colorStyle"
|
|
87
|
+
:on-click="context?.onTrailingIconClicked"
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</template>
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
outputType?: 'text' | 'email' | 'url' | 'tel' | 'color' | 'duration';
|
|
14
|
+
}
|
|
15
|
+
declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
16
|
+
context: {
|
|
17
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
18
|
+
required: true;
|
|
19
|
+
};
|
|
20
|
+
}>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
context: {
|
|
22
|
+
type: PropType<FormKitFrameworkContext & FormKitOutputTextProps & FormKitIconProps>;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function useFormKitRepeater(): {
|
|
2
|
+
addInsertButton: (label?: string, icon?: string, styleClass?: string, render?: 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
|
+
};
|